mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into sergbook.mylan:/usr/home/serg/Abk/mysql-4.1 mysql-test/r/fulltext.result: Auto merged mysql-test/t/fulltext.test: Auto merged
This commit is contained in:
@@ -420,6 +420,7 @@ libmysqld/sql_unions.cc
|
|||||||
libmysqld/sql_update.cc
|
libmysqld/sql_update.cc
|
||||||
libmysqld/sql_yacc.cc
|
libmysqld/sql_yacc.cc
|
||||||
libmysqld/stacktrace.c
|
libmysqld/stacktrace.c
|
||||||
|
libmysqld/strfunc.cc
|
||||||
libmysqld/table.cc
|
libmysqld/table.cc
|
||||||
libmysqld/thr_malloc.cc
|
libmysqld/thr_malloc.cc
|
||||||
libmysqld/time.cc
|
libmysqld/time.cc
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
path=`dirname $0`
|
path=`dirname $0`
|
||||||
. "$path/SETUP.sh"
|
. "$path/SETUP.sh"
|
||||||
|
|
||||||
extra_flags="$pentium_cflags -fprofile-arcs -ftest-coverage"
|
extra_flags="$pentium_cflags -fprofile-arcs -ftest-coverage -fmessage-length=0 "
|
||||||
extra_configs="$pentium_configs $debug_configs --disable-shared $static_link"
|
extra_configs="$pentium_configs $debug_configs --disable-shared $static_link"
|
||||||
extra_configs="$extra_configs --with-innodb --with-berkeley-db"
|
extra_configs="$extra_configs --with-innodb --with-berkeley-db"
|
||||||
|
|
||||||
|
@@ -14,6 +14,7 @@ extra_configs="$extra_configs --with-berkeley-db --with-innodb --without-isam --
|
|||||||
|
|
||||||
if test -z "$just_print"
|
if test -z "$just_print"
|
||||||
then
|
then
|
||||||
|
set +v +x
|
||||||
echo "\
|
echo "\
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
Note that by default BUILD/compile-pentium-valgrind-max calls 'configure' with
|
Note that by default BUILD/compile-pentium-valgrind-max calls 'configure' with
|
||||||
|
@@ -100,6 +100,7 @@ peter@linux.local
|
|||||||
peter@mysql.com
|
peter@mysql.com
|
||||||
peterg@mysql.com
|
peterg@mysql.com
|
||||||
pgulutzan@linux.local
|
pgulutzan@linux.local
|
||||||
|
ram@deer.(none)
|
||||||
ram@gw.mysql.r18.ru
|
ram@gw.mysql.r18.ru
|
||||||
ram@gw.udmsearch.izhnet.ru
|
ram@gw.udmsearch.izhnet.ru
|
||||||
ram@mysql.r18.ru
|
ram@mysql.r18.ru
|
||||||
|
@@ -19,7 +19,7 @@ BK_STATUS=$BK_STATUS$BK_COMMIT
|
|||||||
if [ "$BK_STATUS" = OK ]
|
if [ "$BK_STATUS" = OK ]
|
||||||
then
|
then
|
||||||
|
|
||||||
CHANGESET=`bk -R prs -r+ -h -d':I:' ChangeSet`
|
CHANGESET=`bk -R prs -r+ -h -d':P:::I:' ChangeSet`
|
||||||
|
|
||||||
#++
|
#++
|
||||||
# dev-public@
|
# dev-public@
|
||||||
|
@@ -446,6 +446,10 @@ SOURCE=..\strings\strcont.c
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\sql\strfunc.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\strings\strinstr.c
|
SOURCE=..\strings\strinstr.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@@ -430,6 +430,10 @@ SOURCE=.\my_symlink2.c
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\my_sync.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\my_tempnam.c
|
SOURCE=.\my_tempnam.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@@ -1253,6 +1253,26 @@ SOURCE=.\sql_yacc.cpp
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\strfunc.cpp
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "mysqld - Win32 Release"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "mysqld - Win32 Debug"
|
||||||
|
|
||||||
|
# ADD CPP /G5
|
||||||
|
# SUBTRACT CPP /YX /Yc /Yu
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "mysqld - Win32 nt"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "mysqld - Win32 Max nt"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "mysqld - Win32 Max"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\table.cpp
|
SOURCE=.\table.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@@ -945,6 +945,22 @@ SOURCE=.\sql_yacc.cpp
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\strfunc.cpp
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "mysqldmax - Win32 Release"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "mysqldmax - Win32 Debug"
|
||||||
|
|
||||||
|
# ADD CPP /G5
|
||||||
|
# SUBTRACT CPP /YX /Yc /Yu
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "mysqldmax - Win32 nt"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\table.cpp
|
SOURCE=.\table.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@@ -188,6 +188,10 @@ SOURCE=.\longlong2str.c
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\my_strtoll10.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\my_vsnprintf.c
|
SOURCE=.\my_vsnprintf.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@@ -52,7 +52,7 @@ static const char* host = 0;
|
|||||||
static int port = MYSQL_PORT;
|
static int port = MYSQL_PORT;
|
||||||
static const char* sock= 0;
|
static const char* sock= 0;
|
||||||
static const char* user = 0;
|
static const char* user = 0;
|
||||||
static const char* pass = "";
|
static char* pass = 0;
|
||||||
static ulonglong position = 0;
|
static ulonglong position = 0;
|
||||||
static short binlog_flags = 0;
|
static short binlog_flags = 0;
|
||||||
static MYSQL* mysql = NULL;
|
static MYSQL* mysql = NULL;
|
||||||
@@ -226,7 +226,7 @@ static struct my_option my_long_options[] =
|
|||||||
{"offset", 'o', "Skip the first N entries.", (gptr*) &offset, (gptr*) &offset,
|
{"offset", 'o', "Skip the first N entries.", (gptr*) &offset, (gptr*) &offset,
|
||||||
0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"password", 'p', "Password to connect to remote server.",
|
{"password", 'p', "Password to connect to remote server.",
|
||||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"port", 'P', "Use port to connect to the remote server.",
|
{"port", 'P', "Use port to connect to the remote server.",
|
||||||
(gptr*) &port, (gptr*) &port, 0, GET_INT, REQUIRED_ARG, MYSQL_PORT, 0, 0,
|
(gptr*) &port, (gptr*) &port, 0, GET_INT, REQUIRED_ARG, MYSQL_PORT, 0, 0,
|
||||||
0, 0, 0},
|
0, 0, 0},
|
||||||
@@ -266,6 +266,11 @@ void sql_print_error(const char *format,...)
|
|||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void cleanup()
|
||||||
|
{
|
||||||
|
my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
|
}
|
||||||
|
|
||||||
static void die(const char* fmt, ...)
|
static void die(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
@@ -274,6 +279,7 @@ static void die(const char* fmt, ...)
|
|||||||
vfprintf(stderr, fmt, args);
|
vfprintf(stderr, fmt, args);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
cleanup();
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,6 +339,7 @@ extern "C" my_bool
|
|||||||
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||||
char *argument)
|
char *argument)
|
||||||
{
|
{
|
||||||
|
bool tty_password=0;
|
||||||
switch (optid) {
|
switch (optid) {
|
||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
case '#':
|
case '#':
|
||||||
@@ -343,7 +350,17 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
one_database = 1;
|
one_database = 1;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
pass = my_strdup(argument, MYF(0));
|
if (argument)
|
||||||
|
{
|
||||||
|
my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
|
char *start=argument;
|
||||||
|
pass= my_strdup(argument,MYF(MY_FAE));
|
||||||
|
while (*argument) *argument++= 'x'; /* Destroy argument */
|
||||||
|
if (*start)
|
||||||
|
start[1]=0; /* Cut length of argument */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
tty_password=1;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
if (!(result_file = my_fopen(argument, O_WRONLY | O_BINARY, MYF(MY_WME))))
|
if (!(result_file = my_fopen(argument, O_WRONLY | O_BINARY, MYF(MY_WME))))
|
||||||
@@ -359,6 +376,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
usage();
|
usage();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
if (tty_password)
|
||||||
|
pass= get_tty_password(NullS);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -707,6 +727,7 @@ int main(int argc, char** argv)
|
|||||||
my_fclose(result_file, MYF(0));
|
my_fclose(result_file, MYF(0));
|
||||||
if (remote_opt)
|
if (remote_opt)
|
||||||
mysql_close(mysql);
|
mysql_close(mysql);
|
||||||
|
cleanup();
|
||||||
free_defaults(defaults_argv);
|
free_defaults(defaults_argv);
|
||||||
my_end(0);
|
my_end(0);
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -68,13 +68,6 @@
|
|||||||
/* Size of buffer for dump's select query */
|
/* Size of buffer for dump's select query */
|
||||||
#define QUERY_LENGTH 1536
|
#define QUERY_LENGTH 1536
|
||||||
|
|
||||||
#define print_xml_tag(out_file, sbeg, sval, send) \
|
|
||||||
{ \
|
|
||||||
fputs(sbeg, out_file); \
|
|
||||||
print_quoted_xml(out_file, sval, 0); \
|
|
||||||
fputs(send, out_file); \
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *add_load_option(char *ptr, const char *object,
|
static char *add_load_option(char *ptr, const char *object,
|
||||||
const char *statement);
|
const char *statement);
|
||||||
static ulong find_set(TYPELIB *lib, const char *x, uint length,
|
static ulong find_set(TYPELIB *lib, const char *x, uint length,
|
||||||
@@ -305,7 +298,6 @@ static int init_dumping(char *);
|
|||||||
static int dump_databases(char **);
|
static int dump_databases(char **);
|
||||||
static int dump_all_databases();
|
static int dump_all_databases();
|
||||||
static char *quote_name(const char *name, char *buff, my_bool force);
|
static char *quote_name(const char *name, char *buff, my_bool force);
|
||||||
static void print_quoted_xml(FILE *output, char *str, ulong len);
|
|
||||||
|
|
||||||
static void print_version(void)
|
static void print_version(void)
|
||||||
{
|
{
|
||||||
@@ -640,6 +632,7 @@ static my_bool test_if_special_chars(const char *str)
|
|||||||
} /* test_if_special_chars */
|
} /* test_if_special_chars */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static char *quote_name(const char *name, char *buff, my_bool force)
|
static char *quote_name(const char *name, char *buff, my_bool force)
|
||||||
{
|
{
|
||||||
char *to= buff;
|
char *to= buff;
|
||||||
@@ -658,8 +651,98 @@ static char *quote_name(const char *name, char *buff, my_bool force)
|
|||||||
} /* quote_name */
|
} /* quote_name */
|
||||||
|
|
||||||
|
|
||||||
void print_xml_row(FILE *xml_file, const char *row_name, MYSQL_RES *tableRes,
|
/*
|
||||||
MYSQL_ROW *row)
|
Quote and print a string.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
print_quoted_xml()
|
||||||
|
output - output file
|
||||||
|
str - string to print
|
||||||
|
len - its length
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
Quote '<' '>' '&' '\"' singns and print a string to the xml_file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void print_quoted_xml(FILE *xml_file, const char *str, ulong len)
|
||||||
|
{
|
||||||
|
const char *end;
|
||||||
|
|
||||||
|
for (end= str + len; str != end; str++)
|
||||||
|
{
|
||||||
|
switch (*str) {
|
||||||
|
case '<':
|
||||||
|
fputs("<", xml_file);
|
||||||
|
break;
|
||||||
|
case '>':
|
||||||
|
fputs(">", xml_file);
|
||||||
|
break;
|
||||||
|
case '&':
|
||||||
|
fputs("&", xml_file);
|
||||||
|
break;
|
||||||
|
case '\"':
|
||||||
|
fputs(""", xml_file);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fputc(*str, xml_file);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Print xml tag with one attribute.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
print_xml_tag1()
|
||||||
|
xml_file - output file
|
||||||
|
sbeg - line beginning
|
||||||
|
stag_atr - tag and attribute
|
||||||
|
sval - value of attribute
|
||||||
|
send - line ending
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
Print tag with one attribute to the xml_file. Format is:
|
||||||
|
sbeg<stag_atr="sval">send
|
||||||
|
NOTE
|
||||||
|
sval MUST be a NULL terminated string.
|
||||||
|
sval string will be qouted before output.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void print_xml_tag1(FILE * xml_file, const char* sbeg,
|
||||||
|
const char* stag_atr, const char* sval,
|
||||||
|
const char* send)
|
||||||
|
{
|
||||||
|
fputs(sbeg, xml_file);
|
||||||
|
fputs("<", xml_file);
|
||||||
|
fputs(stag_atr, xml_file);
|
||||||
|
fputs("\"", xml_file);
|
||||||
|
print_quoted_xml(xml_file, sval, strlen(sval));
|
||||||
|
fputs("\">", xml_file);
|
||||||
|
fputs(send, xml_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Print xml tag with many attributes.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
print_xml_row()
|
||||||
|
xml_file - output file
|
||||||
|
row_name - xml tag name
|
||||||
|
tableRes - query result
|
||||||
|
row - result row
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
Print tag with many attribute to the xml_file. Format is:
|
||||||
|
\t\t<row_name Atr1="Val1" Atr2="Val2"... />
|
||||||
|
NOTE
|
||||||
|
All atributes and values will be quoted before output.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void print_xml_row(FILE *xml_file, const char *row_name,
|
||||||
|
MYSQL_RES *tableRes, MYSQL_ROW *row)
|
||||||
{
|
{
|
||||||
uint i;
|
uint i;
|
||||||
MYSQL_FIELD *field;
|
MYSQL_FIELD *field;
|
||||||
@@ -669,10 +752,10 @@ void print_xml_row(FILE *xml_file, const char *row_name, MYSQL_RES *tableRes,
|
|||||||
mysql_field_seek(tableRes, 0);
|
mysql_field_seek(tableRes, 0);
|
||||||
for (i= 0; (field= mysql_fetch_field(tableRes)); i++)
|
for (i= 0; (field= mysql_fetch_field(tableRes)); i++)
|
||||||
{
|
{
|
||||||
if ((*row)[i] && (*row)[i][0])
|
if ((*row)[i])
|
||||||
{
|
{
|
||||||
fputs(" ", xml_file);
|
fputs(" ", xml_file);
|
||||||
print_quoted_xml(xml_file, field->name, 0);
|
print_quoted_xml(xml_file, field->name, field->name_length);
|
||||||
fputs("=\"", xml_file);
|
fputs("=\"", xml_file);
|
||||||
print_quoted_xml(xml_file, (*row)[i], lengths[i]);
|
print_quoted_xml(xml_file, (*row)[i], lengths[i]);
|
||||||
fputs("\"", xml_file);
|
fputs("\"", xml_file);
|
||||||
@@ -707,7 +790,8 @@ static uint getTableStructure(char *table, char* db)
|
|||||||
if (verbose)
|
if (verbose)
|
||||||
fprintf(stderr, "-- Retrieving table structure for table %s...\n", table);
|
fprintf(stderr, "-- Retrieving table structure for table %s...\n", table);
|
||||||
|
|
||||||
sprintf(insert_pat,"SET OPTION SQL_QUOTE_SHOW_CREATE=%d", (opt_quoted || opt_keywords));
|
sprintf(insert_pat,"SET OPTION SQL_QUOTE_SHOW_CREATE=%d",
|
||||||
|
(opt_quoted || opt_keywords));
|
||||||
result_table= quote_name(table, table_buff, 1);
|
result_table= quote_name(table, table_buff, 1);
|
||||||
opt_quoted_table= quote_name(table, table_buff2, 0);
|
opt_quoted_table= quote_name(table, table_buff2, 0);
|
||||||
if (!opt_xml && !mysql_query(sock,insert_pat))
|
if (!opt_xml && !mysql_query(sock,insert_pat))
|
||||||
@@ -849,7 +933,7 @@ static uint getTableStructure(char *table, char* db)
|
|||||||
if (!opt_xml)
|
if (!opt_xml)
|
||||||
fprintf(sql_file, "CREATE TABLE %s (\n", result_table);
|
fprintf(sql_file, "CREATE TABLE %s (\n", result_table);
|
||||||
else
|
else
|
||||||
print_xml_tag(sql_file, "\t<table_structure name=\"", table, "\">\n");
|
print_xml_tag1(sql_file, "\t", "table_structure name=", table, "\n");
|
||||||
}
|
}
|
||||||
if (cFlag)
|
if (cFlag)
|
||||||
sprintf(insert_pat, "INSERT %sINTO %s (", delayed, result_table);
|
sprintf(insert_pat, "INSERT %sINTO %s (", delayed, result_table);
|
||||||
@@ -959,7 +1043,8 @@ static uint getTableStructure(char *table, char* db)
|
|||||||
else if (keynr == primary_key)
|
else if (keynr == primary_key)
|
||||||
fputs(",\n PRIMARY KEY (",sql_file); /* First UNIQUE is primary */
|
fputs(",\n PRIMARY KEY (",sql_file); /* First UNIQUE is primary */
|
||||||
else
|
else
|
||||||
fprintf(sql_file, ",\n UNIQUE %s (",quote_name(row[2],name_buff,0));
|
fprintf(sql_file, ",\n UNIQUE %s (",quote_name(row[2],name_buff,
|
||||||
|
0));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
putc(',', sql_file);
|
putc(',', sql_file);
|
||||||
@@ -1192,9 +1277,7 @@ static void dumpTable(uint numFields, char *table)
|
|||||||
rownr=0;
|
rownr=0;
|
||||||
init_length=(uint) strlen(insert_pat)+4;
|
init_length=(uint) strlen(insert_pat)+4;
|
||||||
if (opt_xml)
|
if (opt_xml)
|
||||||
{
|
print_xml_tag1(md_result_file, "\t", "table_data name=", table, "\n");
|
||||||
print_xml_tag(md_result_file, "\t<table_data name=\"", table, "\">\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opt_autocommit)
|
if (opt_autocommit)
|
||||||
fprintf(md_result_file, "set autocommit=0;\n");
|
fprintf(md_result_file, "set autocommit=0;\n");
|
||||||
@@ -1275,8 +1358,8 @@ static void dumpTable(uint numFields, char *table)
|
|||||||
{
|
{
|
||||||
if (opt_xml)
|
if (opt_xml)
|
||||||
{
|
{
|
||||||
print_xml_tag(md_result_file, "\t\t<field name=\"", field->name,
|
print_xml_tag1(md_result_file, "\t\t", "field name=",
|
||||||
"\">");
|
field->name, "");
|
||||||
print_quoted_xml(md_result_file, row[i], lengths[i]);
|
print_quoted_xml(md_result_file, row[i], lengths[i]);
|
||||||
fputs("</field>\n", md_result_file);
|
fputs("</field>\n", md_result_file);
|
||||||
}
|
}
|
||||||
@@ -1289,8 +1372,8 @@ static void dumpTable(uint numFields, char *table)
|
|||||||
char *ptr = row[i];
|
char *ptr = row[i];
|
||||||
if (opt_xml)
|
if (opt_xml)
|
||||||
{
|
{
|
||||||
print_xml_tag(md_result_file, "\t\t<field name=\"", field->name,
|
print_xml_tag1(md_result_file, "\t\t", "field name=",
|
||||||
"\">");
|
field->name, "");
|
||||||
fputs(!my_isalpha(charset_info, *ptr) ? ptr: "NULL",
|
fputs(!my_isalpha(charset_info, *ptr) ? ptr: "NULL",
|
||||||
md_result_file);
|
md_result_file);
|
||||||
fputs("</field>\n", md_result_file);
|
fputs("</field>\n", md_result_file);
|
||||||
@@ -1303,10 +1386,8 @@ static void dumpTable(uint numFields, char *table)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (opt_xml)
|
if (opt_xml)
|
||||||
{
|
print_xml_tag1(md_result_file, "\t\t", "field name=",
|
||||||
print_xml_tag(md_result_file, "\t\t<field name=\"", field->name,
|
field->name, "NULL</field>\n");
|
||||||
"\">NULL</field>\n");
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
fputs("NULL", md_result_file);
|
fputs("NULL", md_result_file);
|
||||||
}
|
}
|
||||||
@@ -1372,32 +1453,6 @@ static void dumpTable(uint numFields, char *table)
|
|||||||
} /* dumpTable */
|
} /* dumpTable */
|
||||||
|
|
||||||
|
|
||||||
static void print_quoted_xml(FILE *output, char *str, ulong len)
|
|
||||||
{
|
|
||||||
const char *end= str + (len ? len : strlen(str));
|
|
||||||
|
|
||||||
for (; str != end; str++)
|
|
||||||
{
|
|
||||||
switch (*str) {
|
|
||||||
case '<':
|
|
||||||
fputs("<", output);
|
|
||||||
break;
|
|
||||||
case '>':
|
|
||||||
fputs(">", output);
|
|
||||||
break;
|
|
||||||
case '&':
|
|
||||||
fputs("&", output);
|
|
||||||
break;
|
|
||||||
case '\"':
|
|
||||||
fputs(""", output);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fputc(*str, output);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *getTableName(int reset)
|
static char *getTableName(int reset)
|
||||||
{
|
{
|
||||||
static MYSQL_RES *res = NULL;
|
static MYSQL_RES *res = NULL;
|
||||||
@@ -1468,23 +1523,28 @@ static int init_dumping(char *database)
|
|||||||
{
|
{
|
||||||
if (opt_databases || opt_alldbs)
|
if (opt_databases || opt_alldbs)
|
||||||
{
|
{
|
||||||
fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", database);
|
/*
|
||||||
|
length of table name * 2 (if name contain quotas), 2 quotas and 0
|
||||||
|
*/
|
||||||
|
char quoted_database_buf[64*2+3];
|
||||||
|
char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted);
|
||||||
|
|
||||||
|
fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", qdatabase);
|
||||||
if (!opt_create_db)
|
if (!opt_create_db)
|
||||||
{
|
{
|
||||||
char qbuf[128];
|
char qbuf[256];
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
MYSQL_RES *dbinfo;
|
MYSQL_RES *dbinfo;
|
||||||
|
|
||||||
sprintf(qbuf,"SHOW CREATE DATABASE WITH IF NOT EXISTS %s",database);
|
sprintf(qbuf,"SHOW CREATE DATABASE WITH IF NOT EXISTS %s",
|
||||||
|
qdatabase);
|
||||||
|
|
||||||
if (mysql_query(sock, qbuf) || !(dbinfo = mysql_store_result(sock)))
|
if (mysql_query(sock, qbuf) || !(dbinfo = mysql_store_result(sock)))
|
||||||
{
|
{
|
||||||
/* Old server version, dump generic CREATE DATABASE */
|
/* Old server version, dump generic CREATE DATABASE */
|
||||||
fprintf(md_result_file,
|
fprintf(md_result_file,
|
||||||
"\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s%s%s;\n",
|
"\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n",
|
||||||
(opt_quoted ? "`" : ""),
|
qdatabase);
|
||||||
database,
|
|
||||||
(opt_quoted ? "`" : ""));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1495,18 +1555,16 @@ static int init_dumping(char *database)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(md_result_file,"\nUSE %s%s%s;\n", (opt_quoted ? "`" : ""),
|
fprintf(md_result_file,"\nUSE %s;\n", qdatabase);
|
||||||
database,
|
|
||||||
(opt_quoted ? "`" : ""));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (extended_insert)
|
if (extended_insert && init_dynamic_string(&extended_row, "", 1024, 1024))
|
||||||
if (init_dynamic_string(&extended_row, "", 1024, 1024))
|
exit(EX_EOM);
|
||||||
exit(EX_EOM);
|
|
||||||
return 0;
|
return 0;
|
||||||
} /* init_dumping */
|
} /* init_dumping */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int dump_all_tables_in_db(char *database)
|
static int dump_all_tables_in_db(char *database)
|
||||||
{
|
{
|
||||||
char *table;
|
char *table;
|
||||||
@@ -1516,9 +1574,7 @@ static int dump_all_tables_in_db(char *database)
|
|||||||
if (init_dumping(database))
|
if (init_dumping(database))
|
||||||
return 1;
|
return 1;
|
||||||
if (opt_xml)
|
if (opt_xml)
|
||||||
{
|
print_xml_tag1(md_result_file, "", "database name=", database, "\n");
|
||||||
print_xml_tag(md_result_file, "<database name=\"", database, "\">\n");
|
|
||||||
}
|
|
||||||
if (lock_tables)
|
if (lock_tables)
|
||||||
{
|
{
|
||||||
DYNAMIC_STRING query;
|
DYNAMIC_STRING query;
|
||||||
@@ -1584,9 +1640,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
|||||||
/* We shall countinue here, if --force was given */
|
/* We shall countinue here, if --force was given */
|
||||||
}
|
}
|
||||||
if (opt_xml)
|
if (opt_xml)
|
||||||
{
|
print_xml_tag1(md_result_file, "", "database name=", db, "\n");
|
||||||
print_xml_tag(md_result_file, "<database name=\"", db, "\">\n");
|
|
||||||
}
|
|
||||||
for (; tables > 0 ; tables-- , table_names++)
|
for (; tables > 0 ; tables-- , table_names++)
|
||||||
{
|
{
|
||||||
numrows = getTableStructure(*table_names, db);
|
numrows = getTableStructure(*table_names, db);
|
||||||
|
@@ -731,7 +731,7 @@ AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
|
|||||||
strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \
|
strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \
|
||||||
sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
|
sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
|
||||||
unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \
|
unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \
|
||||||
sys/ioctl.h)
|
sys/ioctl.h malloc.h sys/malloc.h)
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# Check for system libraries. Adds the library to $LIBS
|
# Check for system libraries. Adds the library to $LIBS
|
||||||
@@ -1832,7 +1832,7 @@ AC_CHECK_FUNCS(alarm bmove \
|
|||||||
pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \
|
pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \
|
||||||
pthread_attr_getstacksize \
|
pthread_attr_getstacksize \
|
||||||
pthread_condattr_create rwlock_init pthread_rwlock_rdlock \
|
pthread_condattr_create rwlock_init pthread_rwlock_rdlock \
|
||||||
fchmod getpass getpassphrase initgroups mlockall)
|
fsync fdatasync fchmod getpass getpassphrase initgroups mlockall)
|
||||||
|
|
||||||
CFLAGS="$ORG_CFLAGS"
|
CFLAGS="$ORG_CFLAGS"
|
||||||
|
|
||||||
|
@@ -36,10 +36,6 @@
|
|||||||
extern int h_errno;
|
extern int h_errno;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_IN_ADDR_T
|
|
||||||
#define in_addr_t ulong
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static my_bool silent;
|
static my_bool silent;
|
||||||
|
|
||||||
static struct my_option my_long_options[] =
|
static struct my_option my_long_options[] =
|
||||||
|
@@ -183,8 +183,8 @@ inline double rint(double nr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
#define ulonglong2double(A) ((double) (A))
|
#define ulonglong2double(A) ((double) (ulonglong) (A))
|
||||||
#define my_off_t2double(A) ((double) (A))
|
#define my_off_t2double(A) ((double) (my_off_t) (A))
|
||||||
|
|
||||||
#else
|
#else
|
||||||
inline double ulonglong2double(ulonglong value)
|
inline double ulonglong2double(ulonglong value)
|
||||||
|
@@ -86,7 +86,7 @@ enum my_lex_states
|
|||||||
{
|
{
|
||||||
MY_LEX_START, MY_LEX_CHAR, MY_LEX_IDENT,
|
MY_LEX_START, MY_LEX_CHAR, MY_LEX_IDENT,
|
||||||
MY_LEX_IDENT_SEP, MY_LEX_IDENT_START,
|
MY_LEX_IDENT_SEP, MY_LEX_IDENT_START,
|
||||||
MY_LEX_FOUND_IDENT, MY_LEX_REAL, MY_LEX_HEX_NUMBER,
|
MY_LEX_REAL, MY_LEX_HEX_NUMBER,
|
||||||
MY_LEX_CMP_OP, MY_LEX_LONG_CMP_OP, MY_LEX_STRING, MY_LEX_COMMENT, MY_LEX_END,
|
MY_LEX_CMP_OP, MY_LEX_LONG_CMP_OP, MY_LEX_STRING, MY_LEX_COMMENT, MY_LEX_END,
|
||||||
MY_LEX_OPERATOR_OR_IDENT, MY_LEX_NUMBER_IDENT, MY_LEX_INT_OR_REAL,
|
MY_LEX_OPERATOR_OR_IDENT, MY_LEX_NUMBER_IDENT, MY_LEX_INT_OR_REAL,
|
||||||
MY_LEX_REAL_OR_POINT, MY_LEX_BOOL, MY_LEX_EOL, MY_LEX_ESCAPE,
|
MY_LEX_REAL_OR_POINT, MY_LEX_BOOL, MY_LEX_EOL, MY_LEX_ESCAPE,
|
||||||
|
@@ -232,6 +232,7 @@ extern char *int2str(long val,char *dst,int radix);
|
|||||||
extern char *int10_to_str(long val,char *dst,int radix);
|
extern char *int10_to_str(long val,char *dst,int radix);
|
||||||
extern char *str2int(const char *src,int radix,long lower,long upper,
|
extern char *str2int(const char *src,int radix,long lower,long upper,
|
||||||
long *val);
|
long *val);
|
||||||
|
longlong my_strtoll10(const char *nptr, char **endptr, int *error);
|
||||||
#if SIZEOF_LONG == SIZEOF_LONG_LONG
|
#if SIZEOF_LONG == SIZEOF_LONG_LONG
|
||||||
#define longlong2str(A,B,C) int2str((A),(B),(C))
|
#define longlong2str(A,B,C) int2str((A),(B),(C))
|
||||||
#define longlong10_to_str(A,B,C) int10_to_str((A),(B),(C))
|
#define longlong10_to_str(A,B,C) int10_to_str((A),(B),(C))
|
||||||
|
@@ -594,8 +594,8 @@ extern double my_atof(const char*);
|
|||||||
#define closesocket(A) close(A)
|
#define closesocket(A) close(A)
|
||||||
#endif
|
#endif
|
||||||
#ifndef ulonglong2double
|
#ifndef ulonglong2double
|
||||||
#define ulonglong2double(A) ((double) (A))
|
#define ulonglong2double(A) ((double) (ulonglong) (A))
|
||||||
#define my_off_t2double(A) ((double) (A))
|
#define my_off_t2double(A) ((double) (my_off_t) (A))
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -63,6 +63,15 @@ C_MODE_START
|
|||||||
#define O_NONBLOCK 1 /* For emulation of fcntl() */
|
#define O_NONBLOCK 1 /* For emulation of fcntl() */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
On OSes which don't have the in_addr_t, we guess that using uint32 is the best
|
||||||
|
possible choice. We guess this from the fact that on HP-UX64bit & FreeBSD64bit
|
||||||
|
& Solaris64bit, in_addr_t is equivalent to uint32. And on Linux32bit too.
|
||||||
|
*/
|
||||||
|
#ifndef HAVE_IN_ADDR_T
|
||||||
|
#define in_addr_t uint32
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Thread safe or portable version of some functions */
|
/* Thread safe or portable version of some functions */
|
||||||
|
|
||||||
void my_inet_ntoa(struct in_addr in, char *buf);
|
void my_inet_ntoa(struct in_addr in, char *buf);
|
||||||
|
@@ -645,6 +645,7 @@ struct st_my_thread_var
|
|||||||
long id;
|
long id;
|
||||||
int cmp_length;
|
int cmp_length;
|
||||||
int volatile abort;
|
int volatile abort;
|
||||||
|
my_bool init;
|
||||||
struct st_my_thread_var *next,**prev;
|
struct st_my_thread_var *next,**prev;
|
||||||
void *opt_info;
|
void *opt_info;
|
||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
@@ -669,8 +670,6 @@ extern pthread_t shutdown_th, main_th, signal_th;
|
|||||||
#define thread_safe_increment(V,L) atomic_add(1,(atomic_t*) &V);
|
#define thread_safe_increment(V,L) atomic_add(1,(atomic_t*) &V);
|
||||||
#define thread_safe_add(V,C,L) atomic_add((C),(atomic_t*) &V);
|
#define thread_safe_add(V,C,L) atomic_add((C),(atomic_t*) &V);
|
||||||
#define thread_safe_sub(V,C,L) atomic_sub((C),(atomic_t*) &V);
|
#define thread_safe_sub(V,C,L) atomic_sub((C),(atomic_t*) &V);
|
||||||
#define statistic_increment(V,L) thread_safe_increment((V),(L))
|
|
||||||
#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
|
|
||||||
#else
|
#else
|
||||||
#define thread_safe_increment(V,L) \
|
#define thread_safe_increment(V,L) \
|
||||||
pthread_mutex_lock((L)); (V)++; pthread_mutex_unlock((L));
|
pthread_mutex_lock((L)); (V)++; pthread_mutex_unlock((L));
|
||||||
@@ -678,6 +677,7 @@ extern pthread_t shutdown_th, main_th, signal_th;
|
|||||||
pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
|
pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
|
||||||
#define thread_safe_sub(V,C,L) \
|
#define thread_safe_sub(V,C,L) \
|
||||||
pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
|
pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
|
||||||
|
#endif /* HAVE_ATOMIC_ADD */
|
||||||
#ifdef SAFE_STATISTICS
|
#ifdef SAFE_STATISTICS
|
||||||
#define statistic_increment(V,L) thread_safe_increment((V),(L))
|
#define statistic_increment(V,L) thread_safe_increment((V),(L))
|
||||||
#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
|
#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
|
||||||
@@ -685,7 +685,6 @@ extern pthread_t shutdown_th, main_th, signal_th;
|
|||||||
#define statistic_increment(V,L) (V)++
|
#define statistic_increment(V,L) (V)++
|
||||||
#define statistic_add(V,C,L) (V)+=(C)
|
#define statistic_add(V,C,L) (V)+=(C)
|
||||||
#endif /* SAFE_STATISTICS */
|
#endif /* SAFE_STATISTICS */
|
||||||
#endif /* HAVE_ATOMIC_ADD */
|
|
||||||
#endif /* thread_safe_increment */
|
#endif /* thread_safe_increment */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@@ -614,6 +614,7 @@ extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
|
|||||||
extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
|
extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
|
||||||
extern int my_fclose(FILE *fd,myf MyFlags);
|
extern int my_fclose(FILE *fd,myf MyFlags);
|
||||||
extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags);
|
extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags);
|
||||||
|
extern int my_sync(File fd, myf my_flags);
|
||||||
extern int my_error _VARARGS((int nr,myf MyFlags, ...));
|
extern int my_error _VARARGS((int nr,myf MyFlags, ...));
|
||||||
extern int my_printf_error _VARARGS((uint my_err, const char *format,
|
extern int my_printf_error _VARARGS((uint my_err, const char *format,
|
||||||
myf MyFlags, ...)
|
myf MyFlags, ...)
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#if defined(__WIN__) && !defined( _CUSTOMCONFIG_)
|
#if defined(__WIN__) && !defined( _CUSTOMCONFIG_)
|
||||||
#define MYSQL_NAMEDPIPE "MySQL"
|
#define MYSQL_NAMEDPIPE "MySQL"
|
||||||
#define MYSQL_SERVICENAME "MySql"
|
#define MYSQL_SERVICENAME "MySQL"
|
||||||
#endif /* __WIN__ */
|
#endif /* __WIN__ */
|
||||||
|
|
||||||
enum enum_server_command
|
enum enum_server_command
|
||||||
|
@@ -295,7 +295,12 @@
|
|||||||
#define ER_BAD_SLAVE_UNTIL_COND 1276
|
#define ER_BAD_SLAVE_UNTIL_COND 1276
|
||||||
#define ER_MISSING_SKIP_SLAVE 1277
|
#define ER_MISSING_SKIP_SLAVE 1277
|
||||||
#define ER_UNTIL_COND_IGNORED 1278
|
#define ER_UNTIL_COND_IGNORED 1278
|
||||||
#define ER_WRONG_INDEX_NAME 1279
|
#define ER_WRONG_NAME 1279
|
||||||
#define ER_WARN_QC_RESIZE 1280
|
#define ER_TABLE 1280
|
||||||
#define ER_BAD_FT_COLUMN 1281
|
#define ER_DATABASE 1281
|
||||||
#define ER_ERROR_MESSAGES 282
|
#define ER_COLUMN 1282
|
||||||
|
#define ER_INDEX 1283
|
||||||
|
#define ER_CATALOG 1284
|
||||||
|
#define ER_WARN_QC_RESIZE 1285
|
||||||
|
#define ER_BAD_FT_COLUMN 1286
|
||||||
|
#define ER_ERROR_MESSAGES 287
|
||||||
|
@@ -21,7 +21,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GLOB 0 /* Error maps */
|
#define GLOB 0 /* Error maps */
|
||||||
#define GLOBERRS 27 /* Max number of error messages in map's */
|
#define GLOBERRS 28 /* Max number of error messages in map's */
|
||||||
#define EE(X) globerrs[ X ] /* Defines to add error to right map */
|
#define EE(X) globerrs[ X ] /* Defines to add error to right map */
|
||||||
|
|
||||||
extern const char * NEAR globerrs[]; /* my_error_messages is here */
|
extern const char * NEAR globerrs[]; /* my_error_messages is here */
|
||||||
@@ -53,6 +53,7 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */
|
|||||||
#define EE_CANT_READLINK 24
|
#define EE_CANT_READLINK 24
|
||||||
#define EE_CANT_SYMLINK 25
|
#define EE_CANT_SYMLINK 25
|
||||||
#define EE_REALPATH 26
|
#define EE_REALPATH 26
|
||||||
|
#define EE_SYNC 27
|
||||||
|
|
||||||
/* exit codes for all MySQL programs */
|
/* exit codes for all MySQL programs */
|
||||||
|
|
||||||
|
@@ -159,4 +159,4 @@ ER_WARN_TOO_MANY_RECORDS, "01000", "",
|
|||||||
ER_WARN_NULL_TO_NOTNULL, "01000", "",
|
ER_WARN_NULL_TO_NOTNULL, "01000", "",
|
||||||
ER_WARN_DATA_OUT_OF_RANGE, "01000", "",
|
ER_WARN_DATA_OUT_OF_RANGE, "01000", "",
|
||||||
ER_WARN_DATA_TRUNCATED, "01000", "",
|
ER_WARN_DATA_TRUNCATED, "01000", "",
|
||||||
ER_WRONG_INDEX_NAME, "42000", "",
|
ER_WRONG_NAME, "42000", "",
|
||||||
|
@@ -297,8 +297,9 @@ buf_page_is_corrupted(
|
|||||||
ulint old_checksum;
|
ulint old_checksum;
|
||||||
ulint checksum_field;
|
ulint checksum_field;
|
||||||
ulint old_checksum_field;
|
ulint old_checksum_field;
|
||||||
|
#ifndef UNIV_HOTBACKUP
|
||||||
dulint current_lsn;
|
dulint current_lsn;
|
||||||
|
#endif
|
||||||
if (mach_read_from_4(read_buf + FIL_PAGE_LSN + 4)
|
if (mach_read_from_4(read_buf + FIL_PAGE_LSN + 4)
|
||||||
!= mach_read_from_4(read_buf + UNIV_PAGE_SIZE
|
!= mach_read_from_4(read_buf + UNIV_PAGE_SIZE
|
||||||
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
|
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
|
||||||
|
@@ -301,9 +301,12 @@ dict_build_table_def_step(
|
|||||||
- page 2 is the first inode page,
|
- page 2 is the first inode page,
|
||||||
- page 3 will contain the root of the clustered index of the
|
- page 3 will contain the root of the clustered index of the
|
||||||
table we create here. */
|
table we create here. */
|
||||||
|
|
||||||
|
table->space = 0; /* reset to zero for the call below */
|
||||||
|
|
||||||
error = fil_create_new_single_table_tablespace(
|
error = fil_create_new_single_table_tablespace(
|
||||||
&(table->space), table->name, 4);
|
&(table->space), table->name,
|
||||||
|
FIL_IBD_FILE_INITIAL_SIZE);
|
||||||
if (error != DB_SUCCESS) {
|
if (error != DB_SUCCESS) {
|
||||||
|
|
||||||
return(error);
|
return(error);
|
||||||
@@ -311,7 +314,7 @@ dict_build_table_def_step(
|
|||||||
|
|
||||||
mtr_start(&mtr);
|
mtr_start(&mtr);
|
||||||
|
|
||||||
fsp_header_init(table->space, 4, &mtr);
|
fsp_header_init(table->space, FIL_IBD_FILE_INITIAL_SIZE, &mtr);
|
||||||
|
|
||||||
mtr_commit(&mtr);
|
mtr_commit(&mtr);
|
||||||
}
|
}
|
||||||
|
@@ -2580,7 +2580,7 @@ dict_create_foreign_constraints_low(
|
|||||||
sprintf(buf + strlen(buf),
|
sprintf(buf + strlen(buf),
|
||||||
" Error in foreign key constraint of table %.500s.\n"
|
" Error in foreign key constraint of table %.500s.\n"
|
||||||
"Cannot find the table from the internal data dictionary of InnoDB.\n"
|
"Cannot find the table from the internal data dictionary of InnoDB.\n"
|
||||||
"Create table statement:\n%.2000\n", name, sql_string);
|
"Create table statement:\n%.2000s\n", name, sql_string);
|
||||||
ut_a(strlen(buf) < DICT_FOREIGN_ERR_BUF_LEN);
|
ut_a(strlen(buf) < DICT_FOREIGN_ERR_BUF_LEN);
|
||||||
mutex_exit(&dict_foreign_err_mutex);
|
mutex_exit(&dict_foreign_err_mutex);
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -27,6 +27,10 @@ Created 11/29/1995 Heikki Tuuri
|
|||||||
#include "dict0mem.h"
|
#include "dict0mem.h"
|
||||||
#include "log0log.h"
|
#include "log0log.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define FSP_HEADER_OFFSET FIL_PAGE_DATA /* Offset of the space header
|
||||||
|
within a file page */
|
||||||
|
|
||||||
/* The data structures in files are defined just as byte strings in C */
|
/* The data structures in files are defined just as byte strings in C */
|
||||||
typedef byte fsp_header_t;
|
typedef byte fsp_header_t;
|
||||||
typedef byte xdes_t;
|
typedef byte xdes_t;
|
||||||
@@ -38,8 +42,6 @@ File space header data structure: this data structure is contained in the
|
|||||||
first page of a space. The space for this header is reserved in every extent
|
first page of a space. The space for this header is reserved in every extent
|
||||||
descriptor page, but used only in the first. */
|
descriptor page, but used only in the first. */
|
||||||
|
|
||||||
#define FSP_HEADER_OFFSET FIL_PAGE_DATA /* Offset of the space header
|
|
||||||
within a file page */
|
|
||||||
/*-------------------------------------*/
|
/*-------------------------------------*/
|
||||||
#define FSP_SPACE_ID 0 /* space id */
|
#define FSP_SPACE_ID 0 /* space id */
|
||||||
#define FSP_NOT_USED 4 /* this field contained a value up to
|
#define FSP_NOT_USED 4 /* this field contained a value up to
|
||||||
@@ -90,7 +92,6 @@ descriptor page, but used only in the first. */
|
|||||||
#define FSP_FREE_ADD 4 /* this many free extents are added
|
#define FSP_FREE_ADD 4 /* this many free extents are added
|
||||||
to the free list from above
|
to the free list from above
|
||||||
FSP_FREE_LIMIT at a time */
|
FSP_FREE_LIMIT at a time */
|
||||||
|
|
||||||
|
|
||||||
/* FILE SEGMENT INODE
|
/* FILE SEGMENT INODE
|
||||||
==================
|
==================
|
||||||
@@ -298,6 +299,19 @@ fseg_alloc_free_page_low(
|
|||||||
FSP_UP, FSP_NO_DIR */
|
FSP_UP, FSP_NO_DIR */
|
||||||
mtr_t* mtr); /* in: mtr handle */
|
mtr_t* mtr); /* in: mtr handle */
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
Reads the file space size stored in the header page. */
|
||||||
|
|
||||||
|
ulint
|
||||||
|
fsp_get_size_low(
|
||||||
|
/*=============*/
|
||||||
|
/* out: tablespace size stored in the space header */
|
||||||
|
page_t* page) /* in: header page (page 0 in the tablespace) */
|
||||||
|
{
|
||||||
|
return(mach_read_from_4(page + FSP_HEADER_OFFSET + FSP_SIZE));
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Gets a pointer to the space header and x-locks its page. */
|
Gets a pointer to the space header and x-locks its page. */
|
||||||
UNIV_INLINE
|
UNIV_INLINE
|
||||||
@@ -1034,8 +1048,9 @@ fsp_try_extend_data_file_with_pages(
|
|||||||
fsp_header_t* header, /* in: space header */
|
fsp_header_t* header, /* in: space header */
|
||||||
mtr_t* mtr) /* in: mtr */
|
mtr_t* mtr) /* in: mtr */
|
||||||
{
|
{
|
||||||
ulint size;
|
|
||||||
ibool success;
|
ibool success;
|
||||||
|
ulint actual_size;
|
||||||
|
ulint size;
|
||||||
|
|
||||||
ut_a(space != 0);
|
ut_a(space != 0);
|
||||||
|
|
||||||
@@ -1043,12 +1058,12 @@ fsp_try_extend_data_file_with_pages(
|
|||||||
|
|
||||||
ut_a(page_no >= size);
|
ut_a(page_no >= size);
|
||||||
|
|
||||||
success = fil_extend_data_file_with_pages(space, size, page_no + 1);
|
success = fil_extend_space_to_desired_size(&actual_size, space,
|
||||||
|
page_no + 1);
|
||||||
if (success) {
|
/* actual_size now has the space size in pages; it may be less than
|
||||||
mlog_write_ulint(header + FSP_SIZE, page_no + 1, MLOG_4BYTES,
|
we wanted if we ran out of disk space */
|
||||||
mtr);
|
|
||||||
}
|
mlog_write_ulint(header + FSP_SIZE, actual_size, MLOG_4BYTES, mtr);
|
||||||
|
|
||||||
return(success);
|
return(success);
|
||||||
}
|
}
|
||||||
@@ -1060,13 +1075,20 @@ ibool
|
|||||||
fsp_try_extend_data_file(
|
fsp_try_extend_data_file(
|
||||||
/*=====================*/
|
/*=====================*/
|
||||||
/* out: FALSE if not auto-extending */
|
/* out: FALSE if not auto-extending */
|
||||||
ulint* actual_increase,/* out: actual increase in pages */
|
ulint* actual_increase,/* out: actual increase in pages, where
|
||||||
|
we measure the tablespace size from
|
||||||
|
what the header field says; it may be
|
||||||
|
the actual file size rounded down to
|
||||||
|
megabyte */
|
||||||
ulint space, /* in: space */
|
ulint space, /* in: space */
|
||||||
fsp_header_t* header, /* in: space header */
|
fsp_header_t* header, /* in: space header */
|
||||||
mtr_t* mtr) /* in: mtr */
|
mtr_t* mtr) /* in: mtr */
|
||||||
{
|
{
|
||||||
ulint size;
|
ulint size;
|
||||||
|
ulint new_size;
|
||||||
|
ulint old_size;
|
||||||
ulint size_increase;
|
ulint size_increase;
|
||||||
|
ulint actual_size;
|
||||||
ibool success;
|
ibool success;
|
||||||
|
|
||||||
*actual_increase = 0;
|
*actual_increase = 0;
|
||||||
@@ -1078,6 +1100,8 @@ fsp_try_extend_data_file(
|
|||||||
|
|
||||||
size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr);
|
size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr);
|
||||||
|
|
||||||
|
old_size = size;
|
||||||
|
|
||||||
if (space == 0 && srv_last_file_size_max != 0) {
|
if (space == 0 && srv_last_file_size_max != 0) {
|
||||||
if (srv_last_file_size_max
|
if (srv_last_file_size_max
|
||||||
< srv_data_file_sizes[srv_n_data_files - 1]) {
|
< srv_data_file_sizes[srv_n_data_files - 1]) {
|
||||||
@@ -1107,8 +1131,12 @@ fsp_try_extend_data_file(
|
|||||||
success = fsp_try_extend_data_file_with_pages(
|
success = fsp_try_extend_data_file_with_pages(
|
||||||
space, FSP_EXTENT_SIZE - 1,
|
space, FSP_EXTENT_SIZE - 1,
|
||||||
header, mtr);
|
header, mtr);
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
new_size = mtr_read_ulint(
|
||||||
|
header + FSP_SIZE, MLOG_4BYTES, mtr);
|
||||||
|
|
||||||
|
*actual_increase = new_size - old_size;
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1118,7 +1146,10 @@ fsp_try_extend_data_file(
|
|||||||
if (size < 32 * FSP_EXTENT_SIZE) {
|
if (size < 32 * FSP_EXTENT_SIZE) {
|
||||||
size_increase = FSP_EXTENT_SIZE;
|
size_increase = FSP_EXTENT_SIZE;
|
||||||
} else {
|
} else {
|
||||||
size_increase = 8 * FSP_EXTENT_SIZE;
|
/* Below in fsp_fill_free_list() we assume
|
||||||
|
that we add at most FSP_FREE_ADD extents at
|
||||||
|
a time */
|
||||||
|
size_increase = FSP_FREE_ADD * FSP_EXTENT_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1128,18 +1159,17 @@ fsp_try_extend_data_file(
|
|||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extend the data file. If we are not able to extend the full
|
success = fil_extend_space_to_desired_size(&actual_size, space,
|
||||||
requested length, the function tells how many pages we were able to
|
size + size_increase);
|
||||||
extend so that the size of the tablespace would be divisible by 1 MB
|
/* We ignore any fragments of a full megabyte when storing the size
|
||||||
(we possibly managed to extend more, but we only take into account
|
to the space header */
|
||||||
full megabytes). */
|
|
||||||
|
mlog_write_ulint(header + FSP_SIZE,
|
||||||
success = fil_extend_last_data_file(actual_increase, space, size,
|
ut_calc_align_down(actual_size, (1024 * 1024) / UNIV_PAGE_SIZE),
|
||||||
size_increase);
|
|
||||||
if (success) {
|
|
||||||
mlog_write_ulint(header + FSP_SIZE, size + *actual_increase,
|
|
||||||
MLOG_4BYTES, mtr);
|
MLOG_4BYTES, mtr);
|
||||||
}
|
new_size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr);
|
||||||
|
|
||||||
|
*actual_increase = new_size - old_size;
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
@@ -1186,8 +1216,10 @@ fsp_fill_free_list(
|
|||||||
size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr);
|
size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (space != 0 && !init_space) {
|
if (space != 0 && !init_space
|
||||||
/* Try to increase the data file size */
|
&& size < limit + FSP_EXTENT_SIZE * FSP_FREE_ADD) {
|
||||||
|
|
||||||
|
/* Try to increase the .ibd file size */
|
||||||
fsp_try_extend_data_file(&actual_increase, space, header, mtr);
|
fsp_try_extend_data_file(&actual_increase, space, header, mtr);
|
||||||
size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr);
|
size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr);
|
||||||
}
|
}
|
||||||
@@ -1222,7 +1254,7 @@ fsp_fill_free_list(
|
|||||||
fsp_init_file_page(descr_page, mtr);
|
fsp_init_file_page(descr_page, mtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the ibuf page in a separate
|
/* Initialize the ibuf bitmap page in a separate
|
||||||
mini-transaction because it is low in the latching
|
mini-transaction because it is low in the latching
|
||||||
order, and we must be able to release its latch
|
order, and we must be able to release its latch
|
||||||
before returning from the fsp routine */
|
before returning from the fsp routine */
|
||||||
@@ -1797,7 +1829,7 @@ fsp_free_seg_inode(
|
|||||||
flst_remove(space_header + FSP_SEG_INODES_FREE,
|
flst_remove(space_header + FSP_SEG_INODES_FREE,
|
||||||
page + FSEG_INODE_PAGE_NODE, mtr);
|
page + FSEG_INODE_PAGE_NODE, mtr);
|
||||||
|
|
||||||
fsp_free_page(space, buf_frame_get_page_no(page), mtr);
|
fsp_free_page(space, buf_frame_get_page_no(page), mtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3157,7 +3189,7 @@ fseg_free_step(
|
|||||||
freed yet */
|
freed yet */
|
||||||
|
|
||||||
ut_a(descr);
|
ut_a(descr);
|
||||||
ut_anp(xdes_get_bit(descr, XDES_FREE_BIT, buf_frame_get_page_no(header)
|
ut_a(xdes_get_bit(descr, XDES_FREE_BIT, buf_frame_get_page_no(header)
|
||||||
% FSP_EXTENT_SIZE, mtr) == FALSE);
|
% FSP_EXTENT_SIZE, mtr) == FALSE);
|
||||||
inode = fseg_inode_get(header, mtr);
|
inode = fseg_inode_get(header, mtr);
|
||||||
|
|
||||||
|
@@ -16,6 +16,14 @@ Created 10/25/1995 Heikki Tuuri
|
|||||||
#include "ut0byte.h"
|
#include "ut0byte.h"
|
||||||
#include "os0file.h"
|
#include "os0file.h"
|
||||||
|
|
||||||
|
/* When mysqld is run, the default directory "." is the mysqld datadir, but in
|
||||||
|
ibbackup we must set it explicitly; the patgh must NOT contain the trailing
|
||||||
|
'/' or '\' */
|
||||||
|
extern char* fil_path_to_mysql_datadir;
|
||||||
|
|
||||||
|
/* Initial size of a single-table tablespace in pages */
|
||||||
|
#define FIL_IBD_FILE_INITIAL_SIZE 4
|
||||||
|
|
||||||
/* 'null' (undefined) page offset in the context of file spaces */
|
/* 'null' (undefined) page offset in the context of file spaces */
|
||||||
#define FIL_NULL ULINT32_UNDEFINED
|
#define FIL_NULL ULINT32_UNDEFINED
|
||||||
|
|
||||||
@@ -261,6 +269,35 @@ fil_decr_pending_ibuf_merges(
|
|||||||
/*========================*/
|
/*========================*/
|
||||||
ulint id); /* in: space id */
|
ulint id); /* in: space id */
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
Parses the body of a log record written about an .ibd file operation. That is,
|
||||||
|
the log record part after the standard (type, space id, page no) header of the
|
||||||
|
log record.
|
||||||
|
|
||||||
|
If desired, also replays the delete or rename operation if the .ibd file
|
||||||
|
exists and the space id in it matches. Replays the create operation if a file
|
||||||
|
at that path does not exist yet. If the database directory for the file to be
|
||||||
|
created does not exist, then we create the directory, too.
|
||||||
|
|
||||||
|
Note that ibbackup --apply-log sets fil_path_to_mysql_datadir to point to the
|
||||||
|
datadir that we should use in replaying the file operations. */
|
||||||
|
|
||||||
|
byte*
|
||||||
|
fil_op_log_parse_or_replay(
|
||||||
|
/*=======================*/
|
||||||
|
/* out: end of log record, or NULL if the
|
||||||
|
record was not completely contained between
|
||||||
|
ptr and end_ptr */
|
||||||
|
byte* ptr, /* in: buffer containing the log record body,
|
||||||
|
or an initial segment of it, if the record does
|
||||||
|
not fir completely between ptr and end_ptr */
|
||||||
|
byte* end_ptr, /* in: buffer end */
|
||||||
|
ulint type, /* in: the type of this log record */
|
||||||
|
ibool do_replay, /* in: TRUE if we want to replay the
|
||||||
|
operation, and not just parse the log record */
|
||||||
|
ulint space_id); /* in: if do_replay is TRUE, the space id of
|
||||||
|
the tablespace in question; otherwise
|
||||||
|
ignored */
|
||||||
|
/***********************************************************************
|
||||||
Deletes a single-table tablespace. The tablespace must be cached in the
|
Deletes a single-table tablespace. The tablespace must be cached in the
|
||||||
memory cache. */
|
memory cache. */
|
||||||
|
|
||||||
@@ -306,16 +343,18 @@ ulint
|
|||||||
fil_create_new_single_table_tablespace(
|
fil_create_new_single_table_tablespace(
|
||||||
/*===================================*/
|
/*===================================*/
|
||||||
/* out: DB_SUCCESS or error code */
|
/* out: DB_SUCCESS or error code */
|
||||||
ulint* space_id, /* out: space id */
|
ulint* space_id, /* in/out: space id; if this is != 0, then
|
||||||
|
this is an input parameter, otherwise
|
||||||
|
output */
|
||||||
char* tablename, /* in: the table name in the usual
|
char* tablename, /* in: the table name in the usual
|
||||||
databasename/tablename format of InnoDB */
|
databasename/tablename format of InnoDB */
|
||||||
ulint size); /* in: the initial size of the tablespace file
|
ulint size); /* in: the initial size of the tablespace file
|
||||||
in pages */
|
in pages, must be > 0 */
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
Tries to open a single-table tablespace and checks the space id is right in
|
Tries to open a single-table tablespace and checks the space id is right in
|
||||||
it. If does not succeed, prints an error message to the .err log. This
|
it. If does not succeed, prints an error message to the .err log. This
|
||||||
function is used to open the tablespace when we load a table definition
|
function is used to open the tablespace when we load a table definition
|
||||||
to the dictionarky cache. NOTE that we assume this operation is used under the
|
to the dictionary cache. NOTE that we assume this operation is used under the
|
||||||
protection of the dictionary mutex, so that two users cannot race here. */
|
protection of the dictionary mutex, so that two users cannot race here. */
|
||||||
|
|
||||||
ibool
|
ibool
|
||||||
@@ -410,39 +449,32 @@ fil_space_for_table_exists_in_mem(
|
|||||||
the .err log if a matching tablespace is
|
the .err log if a matching tablespace is
|
||||||
not found from memory */
|
not found from memory */
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Tries to extend a data file by the number of pages given. Fractions of 1 MB
|
|
||||||
are ignored. The tablespace must be cached in the memory cache. */
|
|
||||||
|
|
||||||
ibool
|
|
||||||
fil_extend_last_data_file(
|
|
||||||
/*======================*/
|
|
||||||
/* out: TRUE if success, also if we run
|
|
||||||
out of disk space we may return TRUE */
|
|
||||||
ulint* actual_increase,/* out: number of pages we were able to
|
|
||||||
extend, here the original size of the file and
|
|
||||||
the resulting size of the file are rounded
|
|
||||||
downwards to a full megabyte, and the
|
|
||||||
difference expressed in pages is returned */
|
|
||||||
ulint space_id, /* in: space id */
|
|
||||||
ulint size, /* in: current size of the space in pages, as
|
|
||||||
stored in the fsp header */
|
|
||||||
ulint size_increase); /* in: try to extend this many pages */
|
|
||||||
/**************************************************************************
|
|
||||||
Tries to extend a data file so that it would accommodate the number of pages
|
Tries to extend a data file so that it would accommodate the number of pages
|
||||||
given. The tablespace must be cached in the memory cache. */
|
given. The tablespace must be cached in the memory cache. If the space is big
|
||||||
|
enough already, does nothing. */
|
||||||
|
|
||||||
ibool
|
ibool
|
||||||
fil_extend_data_file_with_pages(
|
fil_extend_space_to_desired_size(
|
||||||
/*============================*/
|
/*=============================*/
|
||||||
/* out: TRUE if success */
|
/* out: TRUE if success */
|
||||||
|
ulint* actual_size, /* out: size of the space after extension;
|
||||||
|
if we ran out of disk space this may be lower
|
||||||
|
than the desired size */
|
||||||
ulint space_id, /* in: space id, must be != 0 */
|
ulint space_id, /* in: space id, must be != 0 */
|
||||||
ulint size, /* in: current size of the space in pages, as
|
|
||||||
stored in the fsp header */
|
|
||||||
ulint size_after_extend);/* in: desired size in pages after the
|
ulint size_after_extend);/* in: desired size in pages after the
|
||||||
extension, should be less than 4 GB (this
|
extension; if the current space size is bigger
|
||||||
function is primarily intended for increasing
|
than this already, the function does nothing */
|
||||||
the data file size from < 64 pages to up to
|
#ifdef UNIV_HOTBACKUP
|
||||||
64 pages) */
|
/************************************************************************
|
||||||
|
Extends all tablespaces to the size stored in the space header. During the
|
||||||
|
ibbackup --apply-log phase we extended the spaces on-demand so that log records
|
||||||
|
could be appllied, but that may have left spaces still too small compared to
|
||||||
|
the size stored in the space header. */
|
||||||
|
|
||||||
|
void
|
||||||
|
fil_extend_tablespaces_to_stored_len(void);
|
||||||
|
/*======================================*/
|
||||||
|
#endif
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
Tries to reserve free extents in a file space. */
|
Tries to reserve free extents in a file space. */
|
||||||
|
|
||||||
|
@@ -67,6 +67,14 @@ fsp_header_get_tablespace_size(
|
|||||||
/* out: size in pages */
|
/* out: size in pages */
|
||||||
ulint space); /* in: space id, must be 0 */
|
ulint space); /* in: space id, must be 0 */
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
Reads the file space size stored in the header page. */
|
||||||
|
|
||||||
|
ulint
|
||||||
|
fsp_get_size_low(
|
||||||
|
/*=============*/
|
||||||
|
/* out: tablespace size stored in the space header */
|
||||||
|
page_t* page); /* in: header page (page 0 in the tablespace) */
|
||||||
|
/**************************************************************************
|
||||||
Reads the space id from the first page of a tablespace. */
|
Reads the space id from the first page of a tablespace. */
|
||||||
|
|
||||||
ulint
|
ulint
|
||||||
|
@@ -51,8 +51,6 @@ ha_chain_get_next(
|
|||||||
/* out: next node, NULL if none */
|
/* out: next node, NULL if none */
|
||||||
ha_node_t* node) /* in: hash chain node */
|
ha_node_t* node) /* in: hash chain node */
|
||||||
{
|
{
|
||||||
ut_ad(table);
|
|
||||||
|
|
||||||
return(node->next);
|
return(node->next);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,8 +142,6 @@ ha_next(
|
|||||||
|
|
||||||
fold = node->fold;
|
fold = node->fold;
|
||||||
|
|
||||||
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
|
|
||||||
|
|
||||||
node = ha_chain_get_next(node);
|
node = ha_chain_get_next(node);
|
||||||
|
|
||||||
while (node) {
|
while (node) {
|
||||||
|
@@ -175,17 +175,14 @@ recv_apply_hashed_log_recs(
|
|||||||
disk and invalidated in buffer pool: this
|
disk and invalidated in buffer pool: this
|
||||||
alternative means that no new log records
|
alternative means that no new log records
|
||||||
can be generated during the application */
|
can be generated during the application */
|
||||||
|
#ifdef UNIV_HOTBACKUP
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
Applies log records in the hash table to a backup. */
|
Applies log records in the hash table to a backup. */
|
||||||
|
|
||||||
void
|
void
|
||||||
recv_apply_log_recs_for_backup(
|
recv_apply_log_recs_for_backup(void);
|
||||||
/*===========================*/
|
/*================================*/
|
||||||
ulint n_data_files, /* in: number of data files */
|
#endif
|
||||||
char** data_files, /* in: array containing the paths to the
|
|
||||||
data files */
|
|
||||||
ulint* file_sizes); /* in: sizes of the data files in database
|
|
||||||
pages */
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Recovers from archived log files, and also from log files, if they exist. */
|
Recovers from archived log files, and also from log files, if they exist. */
|
||||||
|
|
||||||
|
@@ -58,6 +58,19 @@ mlog_write_initial_log_record(
|
|||||||
byte type, /* in: log item type: MLOG_1BYTE, ... */
|
byte type, /* in: log item type: MLOG_1BYTE, ... */
|
||||||
mtr_t* mtr); /* in: mini-transaction handle */
|
mtr_t* mtr); /* in: mini-transaction handle */
|
||||||
/************************************************************
|
/************************************************************
|
||||||
|
Writes a log record about an .ibd file create/delete/rename. */
|
||||||
|
UNIV_INLINE
|
||||||
|
byte*
|
||||||
|
mlog_write_initial_log_record_for_file_op(
|
||||||
|
/*======================================*/
|
||||||
|
/* out: new value of log_ptr */
|
||||||
|
ulint type, /* in: MLOG_FILE_CREATE, MLOG_FILE_DELETE, or
|
||||||
|
MLOG_FILE_RENAME */
|
||||||
|
ulint space_id,/* in: space id, if applicable */
|
||||||
|
ulint page_no,/* in: page number (not relevant currently) */
|
||||||
|
byte* log_ptr,/* in: pointer to mtr log which has been opened */
|
||||||
|
mtr_t* mtr); /* in: mtr */
|
||||||
|
/************************************************************
|
||||||
Catenates 1 - 4 bytes to the mtr log. */
|
Catenates 1 - 4 bytes to the mtr log. */
|
||||||
UNIV_INLINE
|
UNIV_INLINE
|
||||||
void
|
void
|
||||||
|
@@ -185,3 +185,31 @@ mlog_write_initial_log_record_fast(
|
|||||||
#endif
|
#endif
|
||||||
return(log_ptr);
|
return(log_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/************************************************************
|
||||||
|
Writes a log record about an .ibd file create/delete/rename. */
|
||||||
|
UNIV_INLINE
|
||||||
|
byte*
|
||||||
|
mlog_write_initial_log_record_for_file_op(
|
||||||
|
/*======================================*/
|
||||||
|
/* out: new value of log_ptr */
|
||||||
|
ulint type, /* in: MLOG_FILE_CREATE, MLOG_FILE_DELETE, or
|
||||||
|
MLOG_FILE_RENAME */
|
||||||
|
ulint space_id,/* in: space id, if applicable */
|
||||||
|
ulint page_no,/* in: page number (not relevant currently) */
|
||||||
|
byte* log_ptr,/* in: pointer to mtr log which has been opened */
|
||||||
|
mtr_t* mtr) /* in: mtr */
|
||||||
|
{
|
||||||
|
ut_ad(log_ptr);
|
||||||
|
|
||||||
|
mach_write_to_1(log_ptr, type);
|
||||||
|
log_ptr++;
|
||||||
|
|
||||||
|
/* We write dummy space id and page number */
|
||||||
|
log_ptr += mach_write_compressed(log_ptr, space_id);
|
||||||
|
log_ptr += mach_write_compressed(log_ptr, page_no);
|
||||||
|
|
||||||
|
mtr->n_log_recs++;
|
||||||
|
|
||||||
|
return(log_ptr);
|
||||||
|
}
|
||||||
|
@@ -96,7 +96,13 @@ flag value must give the length also! */
|
|||||||
sequence of these records */
|
sequence of these records */
|
||||||
#define MLOG_DUMMY_RECORD ((byte)32) /* dummy log record used to
|
#define MLOG_DUMMY_RECORD ((byte)32) /* dummy log record used to
|
||||||
pad a log block full */
|
pad a log block full */
|
||||||
#define MLOG_BIGGEST_TYPE ((byte)32) /* biggest value (used in
|
#define MLOG_FILE_CREATE ((byte)33) /* log record about an .ibd
|
||||||
|
file creation */
|
||||||
|
#define MLOG_FILE_RENAME ((byte)34) /* log record about an .ibd
|
||||||
|
file rename */
|
||||||
|
#define MLOG_FILE_DELETE ((byte)35) /* log record about an .ibd
|
||||||
|
file deletion */
|
||||||
|
#define MLOG_BIGGEST_TYPE ((byte)35) /* biggest value (used in
|
||||||
asserts) */
|
asserts) */
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
|
@@ -63,6 +63,7 @@ log. */
|
|||||||
|
|
||||||
#define OS_FILE_READ_ONLY 333
|
#define OS_FILE_READ_ONLY 333
|
||||||
#define OS_FILE_READ_WRITE 444
|
#define OS_FILE_READ_WRITE 444
|
||||||
|
#define OS_FILE_READ_ALLOW_DELETE 555 /* for ibbackup */
|
||||||
|
|
||||||
/* Options for file_create */
|
/* Options for file_create */
|
||||||
#define OS_FILE_AIO 61
|
#define OS_FILE_AIO 61
|
||||||
@@ -199,6 +200,21 @@ os_file_readdir_next_file(
|
|||||||
char* dirname,/* in: directory name or path */
|
char* dirname,/* in: directory name or path */
|
||||||
os_file_dir_t dir, /* in: directory stream */
|
os_file_dir_t dir, /* in: directory stream */
|
||||||
os_file_stat_t* info); /* in/out: buffer where the info is returned */
|
os_file_stat_t* info); /* in/out: buffer where the info is returned */
|
||||||
|
/*********************************************************************
|
||||||
|
This function attempts to create a directory named pathname. The new directory
|
||||||
|
gets default permissions. On Unix, the permissions are (0770 & ~umask). If the
|
||||||
|
directory exists already, nothing is done and the call succeeds, unless the
|
||||||
|
fail_if_exists arguments is true. */
|
||||||
|
|
||||||
|
ibool
|
||||||
|
os_file_create_directory(
|
||||||
|
/*=====================*/
|
||||||
|
/* out: TRUE if call succeeds, FALSE on
|
||||||
|
error */
|
||||||
|
char* pathname, /* in: directory name as null-terminated
|
||||||
|
string */
|
||||||
|
ibool fail_if_exists);/* in: if TRUE, pre-existing directory is
|
||||||
|
treated as an error. */
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
A simple function to open or create a file. */
|
A simple function to open or create a file. */
|
||||||
|
|
||||||
@@ -206,7 +222,8 @@ os_file_t
|
|||||||
os_file_create_simple(
|
os_file_create_simple(
|
||||||
/*==================*/
|
/*==================*/
|
||||||
/* out, own: handle to the file, not defined if error,
|
/* out, own: handle to the file, not defined if error,
|
||||||
error number can be retrieved with os_get_last_error */
|
error number can be retrieved with
|
||||||
|
os_file_get_last_error */
|
||||||
char* name, /* in: name of the file or path as a null-terminated
|
char* name, /* in: name of the file or path as a null-terminated
|
||||||
string */
|
string */
|
||||||
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
|
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
|
||||||
@@ -221,13 +238,16 @@ os_file_t
|
|||||||
os_file_create_simple_no_error_handling(
|
os_file_create_simple_no_error_handling(
|
||||||
/*====================================*/
|
/*====================================*/
|
||||||
/* out, own: handle to the file, not defined if error,
|
/* out, own: handle to the file, not defined if error,
|
||||||
error number can be retrieved with os_get_last_error */
|
error number can be retrieved with
|
||||||
|
os_file_get_last_error */
|
||||||
char* name, /* in: name of the file or path as a null-terminated
|
char* name, /* in: name of the file or path as a null-terminated
|
||||||
string */
|
string */
|
||||||
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
|
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
|
||||||
(if does not exist, error), or OS_FILE_CREATE if a new
|
(if does not exist, error), or OS_FILE_CREATE if a new
|
||||||
file is created (if exists, error) */
|
file is created (if exists, error) */
|
||||||
ulint access_type,/* in: OS_FILE_READ_ONLY or OS_FILE_READ_WRITE */
|
ulint access_type,/* in: OS_FILE_READ_ONLY, OS_FILE_READ_WRITE, or
|
||||||
|
OS_FILE_READ_ALLOW_DELETE; the last option is used by
|
||||||
|
a backup program reading the file */
|
||||||
ibool* success);/* out: TRUE if succeed, FALSE if error */
|
ibool* success);/* out: TRUE if succeed, FALSE if error */
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
Opens an existing file or creates a new. */
|
Opens an existing file or creates a new. */
|
||||||
@@ -236,7 +256,8 @@ os_file_t
|
|||||||
os_file_create(
|
os_file_create(
|
||||||
/*===========*/
|
/*===========*/
|
||||||
/* out, own: handle to the file, not defined if error,
|
/* out, own: handle to the file, not defined if error,
|
||||||
error number can be retrieved with os_get_last_error */
|
error number can be retrieved with
|
||||||
|
os_file_get_last_error */
|
||||||
char* name, /* in: name of the file or path as a null-terminated
|
char* name, /* in: name of the file or path as a null-terminated
|
||||||
string */
|
string */
|
||||||
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
|
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
|
||||||
|
@@ -20,81 +20,34 @@ extern ibool ut_dbg_stop_threads;
|
|||||||
|
|
||||||
extern ulint* ut_dbg_null_ptr;
|
extern ulint* ut_dbg_null_ptr;
|
||||||
|
|
||||||
|
extern const char* ut_dbg_msg_assert_fail;
|
||||||
|
extern const char* ut_dbg_msg_trap;
|
||||||
|
extern const char* ut_dbg_msg_stop;
|
||||||
|
|
||||||
#define ut_a(EXPR)\
|
#define ut_a(EXPR)\
|
||||||
{\
|
|
||||||
ulint dbg_i;\
|
|
||||||
\
|
|
||||||
if (!((ulint)(EXPR) + ut_dbg_zero)) {\
|
if (!((ulint)(EXPR) + ut_dbg_zero)) {\
|
||||||
ut_print_timestamp(stderr);\
|
ut_print_timestamp(stderr);\
|
||||||
fprintf(stderr,\
|
fprintf(stderr, ut_dbg_msg_assert_fail,\
|
||||||
" InnoDB: Assertion failure in thread %lu in file %s line %lu\n",\
|
|
||||||
os_thread_pf(os_thread_get_curr_id()), IB__FILE__,\
|
os_thread_pf(os_thread_get_curr_id()), IB__FILE__,\
|
||||||
(ulint)__LINE__);\
|
(ulint)__LINE__);\
|
||||||
fprintf(stderr,\
|
fputs("InnoDB: Failing assertion: " #EXPR "\n", stderr);\
|
||||||
"InnoDB: Failing assertion: " #EXPR);\
|
fputs(ut_dbg_msg_trap, stderr);\
|
||||||
fprintf(stderr,\
|
|
||||||
"\nInnoDB: We intentionally generate a memory trap.\n");\
|
|
||||||
fprintf(stderr,\
|
|
||||||
"InnoDB: Send a detailed bug report to mysql@lists.mysql.com\n");\
|
|
||||||
ut_dbg_stop_threads = TRUE;\
|
ut_dbg_stop_threads = TRUE;\
|
||||||
dbg_i = *(ut_dbg_null_ptr);\
|
(*ut_dbg_null_ptr)++;\
|
||||||
if (dbg_i) {\
|
|
||||||
ut_dbg_null_ptr = NULL;\
|
|
||||||
}\
|
|
||||||
}\
|
}\
|
||||||
if (ut_dbg_stop_threads) {\
|
if (ut_dbg_stop_threads) {\
|
||||||
fprintf(stderr,\
|
fprintf(stderr, ut_dbg_msg_stop,\
|
||||||
"InnoDB: Thread %lu stopped in file %s line %lu\n",\
|
|
||||||
os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
|
os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
|
||||||
os_thread_sleep(1000000000);\
|
os_thread_sleep(1000000000);\
|
||||||
}\
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* This can be used if there are % characters in the assertion formula:
|
#define ut_error\
|
||||||
if we try to printf the formula gcc would complain of illegal print
|
ut_print_timestamp(stderr);\
|
||||||
format characters */
|
fprintf(stderr, ut_dbg_msg_assert_fail,\
|
||||||
#define ut_anp(EXPR)\
|
os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
|
||||||
{\
|
fprintf(stderr, ut_dbg_msg_trap);\
|
||||||
ulint dbg_i;\
|
ut_dbg_stop_threads = TRUE;\
|
||||||
\
|
(*ut_dbg_null_ptr)++;
|
||||||
if (!((ulint)(EXPR) + ut_dbg_zero)) {\
|
|
||||||
ut_print_timestamp(stderr);\
|
|
||||||
fprintf(stderr,\
|
|
||||||
" InnoDB: Assertion failure in thread %lu in file %s line %lu\n",\
|
|
||||||
os_thread_pf(os_thread_get_curr_id()), IB__FILE__,\
|
|
||||||
(ulint)__LINE__);\
|
|
||||||
fprintf(stderr,\
|
|
||||||
"\nInnoDB: We intentionally generate a memory trap.\n");\
|
|
||||||
fprintf(stderr,\
|
|
||||||
"InnoDB: Send a detailed bug report to mysql@lists.mysql.com\n");\
|
|
||||||
ut_dbg_stop_threads = TRUE;\
|
|
||||||
dbg_i = *(ut_dbg_null_ptr);\
|
|
||||||
if (dbg_i) {\
|
|
||||||
ut_dbg_null_ptr = NULL;\
|
|
||||||
}\
|
|
||||||
}\
|
|
||||||
if (ut_dbg_stop_threads) {\
|
|
||||||
fprintf(stderr,\
|
|
||||||
"InnoDB: Thread %lu stopped in file %s line %lu\n",\
|
|
||||||
os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
|
|
||||||
os_thread_sleep(1000000000);\
|
|
||||||
}\
|
|
||||||
}
|
|
||||||
|
|
||||||
#define ut_error {\
|
|
||||||
ulint dbg_i;\
|
|
||||||
ut_print_timestamp(stderr);\
|
|
||||||
fprintf(stderr,\
|
|
||||||
" InnoDB: Assertion failure in thread %lu in file %s line %lu\n",\
|
|
||||||
os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
|
|
||||||
fprintf(stderr,\
|
|
||||||
"InnoDB: We intentionally generate a memory trap.\n");\
|
|
||||||
fprintf(stderr,\
|
|
||||||
"InnoDB: Send a detailed bug report to mysql@lists.mysql.com\n");\
|
|
||||||
ut_dbg_stop_threads = TRUE;\
|
|
||||||
dbg_i = *(ut_dbg_null_ptr);\
|
|
||||||
printf("%lu", dbg_i);\
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef UNIV_DEBUG
|
#ifdef UNIV_DEBUG
|
||||||
#define ut_ad(EXPR) ut_a(EXPR)
|
#define ut_ad(EXPR) ut_a(EXPR)
|
||||||
|
@@ -139,7 +139,7 @@ void
|
|||||||
ut_ulint_sort(ulint* arr, ulint* aux_arr, ulint low, ulint high);
|
ut_ulint_sort(ulint* arr, ulint* aux_arr, ulint low, ulint high);
|
||||||
/*============================================================*/
|
/*============================================================*/
|
||||||
/************************************************************
|
/************************************************************
|
||||||
The following function returns a clock time in milliseconds. */
|
The following function returns elapsed CPU time in milliseconds. */
|
||||||
|
|
||||||
ulint
|
ulint
|
||||||
ut_clock(void);
|
ut_clock(void);
|
||||||
@@ -174,6 +174,14 @@ ut_sprintf_timestamp(
|
|||||||
/*=================*/
|
/*=================*/
|
||||||
char* buf); /* in: buffer where to sprintf */
|
char* buf); /* in: buffer where to sprintf */
|
||||||
/**************************************************************
|
/**************************************************************
|
||||||
|
Sprintfs a timestamp to a buffer with no spaces and with ':' characters
|
||||||
|
replaced by '_'. */
|
||||||
|
|
||||||
|
void
|
||||||
|
ut_sprintf_timestamp_without_extra_chars(
|
||||||
|
/*=====================================*/
|
||||||
|
char* buf); /* in: buffer where to sprintf */
|
||||||
|
/**************************************************************
|
||||||
Returns current year, month, day. */
|
Returns current year, month, day. */
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -95,14 +95,6 @@ static
|
|||||||
void
|
void
|
||||||
log_io_complete_archive(void);
|
log_io_complete_archive(void);
|
||||||
/*=========================*/
|
/*=========================*/
|
||||||
/********************************************************************
|
|
||||||
Tries to establish a big enough margin of free space in the log groups, such
|
|
||||||
that a new log entry can be catenated without an immediate need for a
|
|
||||||
archiving. */
|
|
||||||
static
|
|
||||||
void
|
|
||||||
log_archive_margin(void);
|
|
||||||
/*====================*/
|
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
Sets the global variable log_fsp_current_free_limit. Also makes a checkpoint,
|
Sets the global variable log_fsp_current_free_limit. Also makes a checkpoint,
|
||||||
@@ -407,7 +399,7 @@ log_pad_current_log_block(void)
|
|||||||
log_close();
|
log_close();
|
||||||
log_release();
|
log_release();
|
||||||
|
|
||||||
ut_anp((ut_dulint_get_low(lsn) % OS_FILE_LOG_BLOCK_SIZE)
|
ut_a((ut_dulint_get_low(lsn) % OS_FILE_LOG_BLOCK_SIZE)
|
||||||
== LOG_BLOCK_HDR_SIZE);
|
== LOG_BLOCK_HDR_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -745,7 +737,8 @@ log_init(void)
|
|||||||
memset(log_sys->checkpoint_buf, '\0', OS_FILE_LOG_BLOCK_SIZE);
|
memset(log_sys->checkpoint_buf, '\0', OS_FILE_LOG_BLOCK_SIZE);
|
||||||
/*----------------------------*/
|
/*----------------------------*/
|
||||||
|
|
||||||
log_sys->archiving_state = LOG_ARCH_ON;
|
/* Under MySQL, log archiving is always off */
|
||||||
|
log_sys->archiving_state = LOG_ARCH_OFF;
|
||||||
log_sys->archived_lsn = log_sys->lsn;
|
log_sys->archived_lsn = log_sys->lsn;
|
||||||
log_sys->next_archived_lsn = ut_dulint_zero;
|
log_sys->next_archived_lsn = ut_dulint_zero;
|
||||||
|
|
||||||
@@ -754,13 +747,15 @@ log_init(void)
|
|||||||
rw_lock_create(&(log_sys->archive_lock));
|
rw_lock_create(&(log_sys->archive_lock));
|
||||||
rw_lock_set_level(&(log_sys->archive_lock), SYNC_NO_ORDER_CHECK);
|
rw_lock_set_level(&(log_sys->archive_lock), SYNC_NO_ORDER_CHECK);
|
||||||
|
|
||||||
log_sys->archive_buf = ut_align(
|
log_sys->archive_buf = NULL;
|
||||||
|
|
||||||
|
/* ut_align(
|
||||||
ut_malloc(LOG_ARCHIVE_BUF_SIZE
|
ut_malloc(LOG_ARCHIVE_BUF_SIZE
|
||||||
+ OS_FILE_LOG_BLOCK_SIZE),
|
+ OS_FILE_LOG_BLOCK_SIZE),
|
||||||
OS_FILE_LOG_BLOCK_SIZE);
|
OS_FILE_LOG_BLOCK_SIZE); */
|
||||||
log_sys->archive_buf_size = LOG_ARCHIVE_BUF_SIZE;
|
log_sys->archive_buf_size = 0;
|
||||||
|
|
||||||
memset(log_sys->archive_buf, '\0', LOG_ARCHIVE_BUF_SIZE);
|
/* memset(log_sys->archive_buf, '\0', LOG_ARCHIVE_BUF_SIZE); */
|
||||||
|
|
||||||
log_sys->archiving_on = os_event_create(NULL);
|
log_sys->archiving_on = os_event_create(NULL);
|
||||||
|
|
||||||
@@ -1107,8 +1102,8 @@ log_group_write_buf(
|
|||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
ut_anp(len % OS_FILE_LOG_BLOCK_SIZE == 0);
|
ut_a(len % OS_FILE_LOG_BLOCK_SIZE == 0);
|
||||||
ut_anp(ut_dulint_get_low(start_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
|
ut_a(ut_dulint_get_low(start_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
|
||||||
|
|
||||||
if (new_data_offset == 0) {
|
if (new_data_offset == 0) {
|
||||||
write_header = TRUE;
|
write_header = TRUE;
|
||||||
@@ -2080,6 +2075,8 @@ log_archived_file_name_gen(
|
|||||||
ulint id, /* in: group id */
|
ulint id, /* in: group id */
|
||||||
ulint file_no)/* in: file number */
|
ulint file_no)/* in: file number */
|
||||||
{
|
{
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
UT_NOT_USED(id); /* Currently we only archive the first group */
|
UT_NOT_USED(id); /* Currently we only archive the first group */
|
||||||
|
|
||||||
sprintf(buf, "%sib_arch_log_%010lu", srv_arch_dir, file_no);
|
sprintf(buf, "%sib_arch_log_%010lu", srv_arch_dir, file_no);
|
||||||
@@ -2101,6 +2098,8 @@ log_group_archive_file_header_write(
|
|||||||
byte* buf;
|
byte* buf;
|
||||||
ulint dest_offset;
|
ulint dest_offset;
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
|
||||||
ut_a(nth_file < group->n_files);
|
ut_a(nth_file < group->n_files);
|
||||||
@@ -2138,6 +2137,8 @@ log_group_archive_completed_header_write(
|
|||||||
byte* buf;
|
byte* buf;
|
||||||
ulint dest_offset;
|
ulint dest_offset;
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
ut_a(nth_file < group->n_files);
|
ut_a(nth_file < group->n_files);
|
||||||
|
|
||||||
@@ -2177,15 +2178,17 @@ log_group_archive(
|
|||||||
ulint n_files;
|
ulint n_files;
|
||||||
ulint open_mode;
|
ulint open_mode;
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
|
||||||
start_lsn = log_sys->archived_lsn;
|
start_lsn = log_sys->archived_lsn;
|
||||||
|
|
||||||
ut_anp(ut_dulint_get_low(start_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
|
ut_a(ut_dulint_get_low(start_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
|
||||||
|
|
||||||
end_lsn = log_sys->next_archived_lsn;
|
end_lsn = log_sys->next_archived_lsn;
|
||||||
|
|
||||||
ut_anp(ut_dulint_get_low(end_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
|
ut_a(ut_dulint_get_low(end_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
|
||||||
|
|
||||||
buf = log_sys->archive_buf;
|
buf = log_sys->archive_buf;
|
||||||
|
|
||||||
@@ -2289,7 +2292,7 @@ loop:
|
|||||||
group->next_archived_file_no = group->archived_file_no + n_files;
|
group->next_archived_file_no = group->archived_file_no + n_files;
|
||||||
group->next_archived_offset = next_offset % group->file_size;
|
group->next_archived_offset = next_offset % group->file_size;
|
||||||
|
|
||||||
ut_anp(group->next_archived_offset % OS_FILE_LOG_BLOCK_SIZE == 0);
|
ut_a(group->next_archived_offset % OS_FILE_LOG_BLOCK_SIZE == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************
|
/*********************************************************
|
||||||
@@ -2302,6 +2305,8 @@ log_archive_groups(void)
|
|||||||
{
|
{
|
||||||
log_group_t* group;
|
log_group_t* group;
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
|
||||||
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
||||||
@@ -2325,6 +2330,8 @@ log_archive_write_complete_groups(void)
|
|||||||
dulint end_lsn;
|
dulint end_lsn;
|
||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
|
||||||
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
||||||
@@ -2387,6 +2394,8 @@ void
|
|||||||
log_archive_check_completion_low(void)
|
log_archive_check_completion_low(void)
|
||||||
/*==================================*/
|
/*==================================*/
|
||||||
{
|
{
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
|
||||||
if (log_sys->n_pending_archive_ios == 0
|
if (log_sys->n_pending_archive_ios == 0
|
||||||
@@ -2423,6 +2432,8 @@ log_io_complete_archive(void)
|
|||||||
{
|
{
|
||||||
log_group_t* group;
|
log_group_t* group;
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
mutex_enter(&(log_sys->mutex));
|
mutex_enter(&(log_sys->mutex));
|
||||||
|
|
||||||
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
||||||
@@ -2458,6 +2469,8 @@ log_archive_do(
|
|||||||
dulint start_lsn;
|
dulint start_lsn;
|
||||||
dulint limit_lsn;
|
dulint limit_lsn;
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
calc_new_limit = TRUE;
|
calc_new_limit = TRUE;
|
||||||
loop:
|
loop:
|
||||||
mutex_enter(&(log_sys->mutex));
|
mutex_enter(&(log_sys->mutex));
|
||||||
@@ -2484,7 +2497,7 @@ loop:
|
|||||||
start_lsn = log_sys->archived_lsn;
|
start_lsn = log_sys->archived_lsn;
|
||||||
|
|
||||||
if (calc_new_limit) {
|
if (calc_new_limit) {
|
||||||
ut_anp(log_sys->archive_buf_size % OS_FILE_LOG_BLOCK_SIZE
|
ut_a(log_sys->archive_buf_size % OS_FILE_LOG_BLOCK_SIZE
|
||||||
== 0);
|
== 0);
|
||||||
limit_lsn = ut_dulint_add(start_lsn,
|
limit_lsn = ut_dulint_add(start_lsn,
|
||||||
log_sys->archive_buf_size);
|
log_sys->archive_buf_size);
|
||||||
@@ -2584,6 +2597,8 @@ log_archive_all(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
present_lsn = log_sys->lsn;
|
present_lsn = log_sys->lsn;
|
||||||
|
|
||||||
mutex_exit(&(log_sys->mutex));
|
mutex_exit(&(log_sys->mutex));
|
||||||
@@ -2621,11 +2636,17 @@ log_archive_close_groups(
|
|||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
|
||||||
|
if (log_sys->archiving_state == LOG_ARCH_OFF) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
||||||
|
|
||||||
trunc_len = UNIV_PAGE_SIZE
|
trunc_len = UNIV_PAGE_SIZE
|
||||||
* fil_space_get_size(group->archive_space_id);
|
* fil_space_get_size(group->archive_space_id);
|
||||||
|
|
||||||
if (trunc_len > 0) {
|
if (trunc_len > 0) {
|
||||||
ut_a(trunc_len == group->file_size);
|
ut_a(trunc_len == group->file_size);
|
||||||
|
|
||||||
@@ -2653,17 +2674,18 @@ log_archive_close_groups(
|
|||||||
/********************************************************************
|
/********************************************************************
|
||||||
Writes the log contents to the archive up to the lsn when this function was
|
Writes the log contents to the archive up to the lsn when this function was
|
||||||
called, and stops the archiving. When archiving is started again, the archived
|
called, and stops the archiving. When archiving is started again, the archived
|
||||||
log file numbers start from 2 higher, so that the archiving will
|
log file numbers start from 2 higher, so that the archiving will not write
|
||||||
not write again to the archived log files which exist when this function
|
again to the archived log files which exist when this function returns. */
|
||||||
returns. */
|
|
||||||
|
|
||||||
ulint
|
ulint
|
||||||
log_archive_stop(void)
|
log_archive_stop(void)
|
||||||
/*==================*/
|
/*==================*/
|
||||||
/* out: DB_SUCCESS or DB_ERROR */
|
/* out: DB_SUCCESS or DB_ERROR */
|
||||||
{
|
{
|
||||||
ibool success;
|
ibool success;
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
mutex_enter(&(log_sys->mutex));
|
mutex_enter(&(log_sys->mutex));
|
||||||
|
|
||||||
if (log_sys->archiving_state != LOG_ARCH_ON) {
|
if (log_sys->archiving_state != LOG_ARCH_ON) {
|
||||||
@@ -2676,7 +2698,7 @@ log_archive_stop(void)
|
|||||||
log_sys->archiving_state = LOG_ARCH_STOPPING;
|
log_sys->archiving_state = LOG_ARCH_STOPPING;
|
||||||
|
|
||||||
mutex_exit(&(log_sys->mutex));
|
mutex_exit(&(log_sys->mutex));
|
||||||
|
|
||||||
log_archive_all();
|
log_archive_all();
|
||||||
|
|
||||||
mutex_enter(&(log_sys->mutex));
|
mutex_enter(&(log_sys->mutex));
|
||||||
@@ -2697,7 +2719,7 @@ log_archive_stop(void)
|
|||||||
if appropriate */
|
if appropriate */
|
||||||
|
|
||||||
log_archive_close_groups(TRUE);
|
log_archive_close_groups(TRUE);
|
||||||
|
|
||||||
mutex_exit(&(log_sys->mutex));
|
mutex_exit(&(log_sys->mutex));
|
||||||
|
|
||||||
/* Make a checkpoint, so that if recovery is needed, the file numbers
|
/* Make a checkpoint, so that if recovery is needed, the file numbers
|
||||||
@@ -2726,6 +2748,8 @@ log_archive_start(void)
|
|||||||
/*===================*/
|
/*===================*/
|
||||||
/* out: DB_SUCCESS or DB_ERROR */
|
/* out: DB_SUCCESS or DB_ERROR */
|
||||||
{
|
{
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
mutex_enter(&(log_sys->mutex));
|
mutex_enter(&(log_sys->mutex));
|
||||||
|
|
||||||
if (log_sys->archiving_state != LOG_ARCH_STOPPED) {
|
if (log_sys->archiving_state != LOG_ARCH_STOPPED) {
|
||||||
@@ -2752,6 +2776,7 @@ log_archive_noarchivelog(void)
|
|||||||
/*==========================*/
|
/*==========================*/
|
||||||
/* out: DB_SUCCESS or DB_ERROR */
|
/* out: DB_SUCCESS or DB_ERROR */
|
||||||
{
|
{
|
||||||
|
ut_a(0);
|
||||||
loop:
|
loop:
|
||||||
mutex_enter(&(log_sys->mutex));
|
mutex_enter(&(log_sys->mutex));
|
||||||
|
|
||||||
@@ -2784,6 +2809,7 @@ log_archive_archivelog(void)
|
|||||||
/*========================*/
|
/*========================*/
|
||||||
/* out: DB_SUCCESS or DB_ERROR */
|
/* out: DB_SUCCESS or DB_ERROR */
|
||||||
{
|
{
|
||||||
|
ut_a(0);
|
||||||
mutex_enter(&(log_sys->mutex));
|
mutex_enter(&(log_sys->mutex));
|
||||||
|
|
||||||
if (log_sys->archiving_state == LOG_ARCH_OFF) {
|
if (log_sys->archiving_state == LOG_ARCH_OFF) {
|
||||||
@@ -2791,7 +2817,7 @@ log_archive_archivelog(void)
|
|||||||
log_sys->archiving_state = LOG_ARCH_ON;
|
log_sys->archiving_state = LOG_ARCH_ON;
|
||||||
|
|
||||||
log_sys->archived_lsn = ut_dulint_align_down(log_sys->lsn,
|
log_sys->archived_lsn = ut_dulint_align_down(log_sys->lsn,
|
||||||
OS_FILE_LOG_BLOCK_SIZE);
|
OS_FILE_LOG_BLOCK_SIZE);
|
||||||
mutex_exit(&(log_sys->mutex));
|
mutex_exit(&(log_sys->mutex));
|
||||||
|
|
||||||
return(DB_SUCCESS);
|
return(DB_SUCCESS);
|
||||||
@@ -2802,6 +2828,7 @@ log_archive_archivelog(void)
|
|||||||
return(DB_ERROR);
|
return(DB_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef notdefined
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
Tries to establish a big enough margin of free space in the log groups, such
|
Tries to establish a big enough margin of free space in the log groups, such
|
||||||
that a new log entry can be catenated without an immediate need for
|
that a new log entry can be catenated without an immediate need for
|
||||||
@@ -2855,6 +2882,7 @@ loop:
|
|||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
Checks that there is enough free space in the log to start a new query step.
|
Checks that there is enough free space in the log to start a new query step.
|
||||||
@@ -2871,7 +2899,7 @@ loop:
|
|||||||
|
|
||||||
log_checkpoint_margin();
|
log_checkpoint_margin();
|
||||||
|
|
||||||
log_archive_margin();
|
/* log_archive_margin(); */
|
||||||
|
|
||||||
mutex_enter(&(log_sys->mutex));
|
mutex_enter(&(log_sys->mutex));
|
||||||
|
|
||||||
@@ -3009,7 +3037,7 @@ loop:
|
|||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_archive_all();
|
/* log_archive_all(); */
|
||||||
log_make_checkpoint_at(ut_dulint_max, TRUE);
|
log_make_checkpoint_at(ut_dulint_max, TRUE);
|
||||||
|
|
||||||
mutex_enter(&(log_sys->mutex));
|
mutex_enter(&(log_sys->mutex));
|
||||||
@@ -3027,15 +3055,16 @@ loop:
|
|||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
arch_log_no =
|
arch_log_no = 0;
|
||||||
|
/*
|
||||||
UT_LIST_GET_FIRST(log_sys->log_groups)->archived_file_no;
|
UT_LIST_GET_FIRST(log_sys->log_groups)->archived_file_no;
|
||||||
|
|
||||||
if (0 == UT_LIST_GET_FIRST(log_sys->log_groups)->archived_offset) {
|
if (0 == UT_LIST_GET_FIRST(log_sys->log_groups)->archived_offset) {
|
||||||
|
|
||||||
arch_log_no--;
|
arch_log_no--;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
log_archive_close_groups(TRUE);
|
/* log_archive_close_groups(TRUE); */
|
||||||
|
|
||||||
mutex_exit(&(log_sys->mutex));
|
mutex_exit(&(log_sys->mutex));
|
||||||
|
|
||||||
|
@@ -721,7 +721,7 @@ recv_scan_log_seg_for_backup(
|
|||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
Tries to parse a single log record body and also applies it to a page if
|
Tries to parse a single log record body and also applies it to a page if
|
||||||
specified. */
|
specified. File ops are parsed, but not applied in this function. */
|
||||||
static
|
static
|
||||||
byte*
|
byte*
|
||||||
recv_parse_or_apply_log_rec_body(
|
recv_parse_or_apply_log_rec_body(
|
||||||
@@ -798,8 +798,14 @@ recv_parse_or_apply_log_rec_body(
|
|||||||
} else if (type == MLOG_INIT_FILE_PAGE) {
|
} else if (type == MLOG_INIT_FILE_PAGE) {
|
||||||
new_ptr = fsp_parse_init_file_page(ptr, end_ptr, page);
|
new_ptr = fsp_parse_init_file_page(ptr, end_ptr, page);
|
||||||
|
|
||||||
} else if (type <= MLOG_WRITE_STRING) {
|
} else if (type == MLOG_WRITE_STRING) {
|
||||||
new_ptr = mlog_parse_string(ptr, end_ptr, page);
|
new_ptr = mlog_parse_string(ptr, end_ptr, page);
|
||||||
|
|
||||||
|
} else if (type == MLOG_FILE_CREATE
|
||||||
|
|| type == MLOG_FILE_RENAME
|
||||||
|
|| type == MLOG_FILE_DELETE) {
|
||||||
|
new_ptr = fil_op_log_parse_or_replay(ptr, end_ptr, type, FALSE,
|
||||||
|
ULINT_UNDEFINED);
|
||||||
} else {
|
} else {
|
||||||
new_ptr = NULL;
|
new_ptr = NULL;
|
||||||
|
|
||||||
@@ -1322,7 +1328,6 @@ loop:
|
|||||||
|
|
||||||
fprintf(stderr, "%lu ",
|
fprintf(stderr, "%lu ",
|
||||||
(i * 100) / hash_get_n_cells(recv_sys->addr_hash));
|
(i * 100) / hash_get_n_cells(recv_sys->addr_hash));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1376,130 +1381,132 @@ loop:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef UNIV_HOTBACKUP
|
#ifdef UNIV_HOTBACKUP
|
||||||
|
/* This page is allocated from the buffer pool and used in the function
|
||||||
|
below */
|
||||||
|
page_t* recv_backup_application_page = NULL;
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
Applies log records in the hash table to a backup. */
|
Applies log records in the hash table to a backup. */
|
||||||
|
|
||||||
void
|
void
|
||||||
recv_apply_log_recs_for_backup(
|
recv_apply_log_recs_for_backup(void)
|
||||||
/*===========================*/
|
/*================================*/
|
||||||
ulint n_data_files, /* in: number of data files */
|
|
||||||
char** data_files, /* in: array containing the paths to the
|
|
||||||
data files */
|
|
||||||
ulint* file_sizes) /* in: sizes of the data files in database
|
|
||||||
pages */
|
|
||||||
{
|
{
|
||||||
recv_addr_t* recv_addr;
|
recv_addr_t* recv_addr;
|
||||||
os_file_t data_file;
|
ulint n_hash_cells;
|
||||||
ulint n_pages_total = 0;
|
|
||||||
ulint nth_file = 0;
|
|
||||||
ulint nth_page_in_file= 0;
|
|
||||||
byte* page;
|
byte* page;
|
||||||
|
ulint actual_size;
|
||||||
ibool success;
|
ibool success;
|
||||||
|
ulint error;
|
||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
recv_sys->apply_log_recs = TRUE;
|
recv_sys->apply_log_recs = TRUE;
|
||||||
recv_sys->apply_batch_on = TRUE;
|
recv_sys->apply_batch_on = TRUE;
|
||||||
|
|
||||||
page = buf_pool->frame_zero;
|
if (recv_backup_application_page == NULL) {
|
||||||
|
recv_backup_application_page = buf_frame_alloc();
|
||||||
for (i = 0; i < n_data_files; i++) {
|
|
||||||
n_pages_total += file_sizes[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recv_max_parsed_page_no >= n_pages_total) {
|
page = recv_backup_application_page;
|
||||||
printf(
|
|
||||||
"InnoDB: Error: tablespace size %lu pages, but a log record on page %lu!\n"
|
|
||||||
"InnoDB: Are you sure you have specified all the ibdata files right in\n"
|
|
||||||
"InnoDB: the my.cnf file you gave as the argument to ibbackup --restore?\n",
|
|
||||||
n_pages_total, recv_max_parsed_page_no);
|
|
||||||
}
|
|
||||||
|
|
||||||
printf(
|
printf(
|
||||||
"InnoDB: Starting an apply batch of log records to the database...\n"
|
"InnoDB: Starting an apply batch of log records to the database...\n"
|
||||||
"InnoDB: Progress in percents: ");
|
"InnoDB: Progress in percents: ");
|
||||||
|
|
||||||
for (i = 0; i < n_pages_total; i++) {
|
n_hash_cells = hash_get_n_cells(recv_sys->addr_hash);
|
||||||
|
|
||||||
if (i == 0 || nth_page_in_file == file_sizes[nth_file]) {
|
for (i = 0; i < n_hash_cells; i++) {
|
||||||
if (i != 0) {
|
/* The address hash table is externally chained */
|
||||||
nth_file++;
|
recv_addr = hash_get_nth_cell(recv_sys->addr_hash, i)->node;
|
||||||
nth_page_in_file = 0;
|
|
||||||
os_file_flush(data_file);
|
|
||||||
os_file_close(data_file);
|
|
||||||
}
|
|
||||||
|
|
||||||
data_file = os_file_create_simple(data_files[nth_file],
|
while (recv_addr != NULL) {
|
||||||
OS_FILE_OPEN,
|
|
||||||
OS_FILE_READ_WRITE,
|
if (!fil_tablespace_exists_in_mem(recv_addr->space)) {
|
||||||
&success);
|
/*
|
||||||
if (!success) {
|
|
||||||
printf(
|
printf(
|
||||||
"InnoDB: Error: cannot open %lu'th data file\n", nth_file);
|
"InnoDB: Warning: cannot apply log record to tablespace %lu page %lu,\n"
|
||||||
|
"InnoDB: because tablespace with that id does not exist.\n",
|
||||||
|
recv_addr->space, recv_addr->page_no);
|
||||||
|
*/
|
||||||
|
recv_addr->state = RECV_PROCESSED;
|
||||||
|
|
||||||
exit(1);
|
ut_a(recv_sys->n_addrs);
|
||||||
|
recv_sys->n_addrs--;
|
||||||
|
|
||||||
|
goto skip_this_recv_addr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
recv_addr = recv_get_fil_addr_struct(0, i);
|
|
||||||
|
|
||||||
if (recv_addr != NULL) {
|
/* We simulate a page read made by the buffer pool, to
|
||||||
success = os_file_read(data_file, page,
|
make sure the recovery apparatus works ok, for
|
||||||
(nth_page_in_file << UNIV_PAGE_SIZE_SHIFT)
|
example, the buf_frame_align() function. We must init
|
||||||
& 0xFFFFFFFFUL,
|
the block corresponding to buf_pool->frame_zero
|
||||||
nth_page_in_file >> (32 - UNIV_PAGE_SIZE_SHIFT),
|
(== page). */
|
||||||
UNIV_PAGE_SIZE);
|
|
||||||
if (!success) {
|
|
||||||
printf(
|
|
||||||
"InnoDB: Error: cannot read page no %lu from %lu'th data file\n",
|
|
||||||
nth_page_in_file, nth_file);
|
|
||||||
|
|
||||||
exit(1);
|
buf_page_init_for_backup_restore(recv_addr->space,
|
||||||
}
|
recv_addr->page_no,
|
||||||
|
|
||||||
/* We simulate a page read made by the buffer pool,
|
|
||||||
to make sure recovery works ok. We must init the
|
|
||||||
block corresponding to buf_pool->frame_zero
|
|
||||||
(== page) */
|
|
||||||
|
|
||||||
buf_page_init_for_backup_restore(0, i,
|
|
||||||
buf_block_align(page));
|
buf_block_align(page));
|
||||||
|
|
||||||
recv_recover_page(TRUE, FALSE, page, 0, i);
|
/* Extend the tablespace's last file if the page_no
|
||||||
|
does not fall inside its bounds; we assume the last
|
||||||
|
file is auto-extending, and ibbackup copied the file
|
||||||
|
when it still was smaller */
|
||||||
|
|
||||||
|
success = fil_extend_space_to_desired_size(
|
||||||
|
&actual_size,
|
||||||
|
recv_addr->space,
|
||||||
|
recv_addr->page_no + 1);
|
||||||
|
if (!success) {
|
||||||
|
printf(
|
||||||
|
"InnoDB: Fatal error: cannot extend tablespace %lu to hold %lu pages\n",
|
||||||
|
recv_addr->space, recv_addr->page_no);
|
||||||
|
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read the page from the tablespace file using the
|
||||||
|
fil0fil.c routines */
|
||||||
|
|
||||||
|
error = fil_io(OS_FILE_READ, TRUE, recv_addr->space,
|
||||||
|
recv_addr->page_no, 0, UNIV_PAGE_SIZE,
|
||||||
|
page, NULL);
|
||||||
|
if (error != DB_SUCCESS) {
|
||||||
|
printf(
|
||||||
|
"InnoDB: Fatal error: cannot read from tablespace %lu page number %lu\n",
|
||||||
|
recv_addr->space, recv_addr->page_no);
|
||||||
|
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Apply the log records to this page */
|
||||||
|
recv_recover_page(TRUE, FALSE, page, recv_addr->space,
|
||||||
|
recv_addr->page_no);
|
||||||
|
|
||||||
|
/* Write the page back to the tablespace file using the
|
||||||
|
fil0fil.c routines */
|
||||||
|
|
||||||
buf_flush_init_for_writing(page,
|
buf_flush_init_for_writing(page,
|
||||||
mach_read_from_8(page + FIL_PAGE_LSN),
|
mach_read_from_8(page + FIL_PAGE_LSN),
|
||||||
0, i);
|
recv_addr->space, recv_addr->page_no);
|
||||||
|
|
||||||
success = os_file_write(data_files[nth_file],
|
error = fil_io(OS_FILE_WRITE, TRUE, recv_addr->space,
|
||||||
data_file, page,
|
recv_addr->page_no, 0, UNIV_PAGE_SIZE,
|
||||||
(nth_page_in_file << UNIV_PAGE_SIZE_SHIFT)
|
page, NULL);
|
||||||
& 0xFFFFFFFF,
|
skip_this_recv_addr:
|
||||||
nth_page_in_file >> (32 - UNIV_PAGE_SIZE_SHIFT),
|
recv_addr = HASH_GET_NEXT(addr_hash, recv_addr);
|
||||||
UNIV_PAGE_SIZE);
|
|
||||||
if (!success) {
|
|
||||||
printf(
|
|
||||||
"InnoDB: Error: cannot write page no %lu to %lu'th data file\n",
|
|
||||||
nth_page_in_file, nth_file);
|
|
||||||
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((100 * i) / n_pages_total
|
if ((100 * i) / n_hash_cells
|
||||||
!= (100 * (i + 1)) / n_pages_total) {
|
!= (100 * (i + 1)) / n_hash_cells) {
|
||||||
printf("%lu ", (100 * i) / n_pages_total);
|
printf("%lu ", (100 * i) / n_hash_cells);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
nth_page_in_file++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
os_file_flush(data_file);
|
|
||||||
os_file_close(data_file);
|
|
||||||
|
|
||||||
recv_sys_empty_hash();
|
recv_sys_empty_hash();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef notdefined
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
In the debug version, updates the replica of a file page, based on a log
|
In the debug version, updates the replica of a file page, based on a log
|
||||||
record. */
|
record. */
|
||||||
@@ -1737,7 +1744,7 @@ recv_parse_log_rec(
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check that space id and page_no are sensible */
|
/* Check that page_no is sensible */
|
||||||
|
|
||||||
if (*page_no > 0x8FFFFFFFUL) {
|
if (*page_no > 0x8FFFFFFFUL) {
|
||||||
|
|
||||||
@@ -1911,12 +1918,16 @@ loop:
|
|||||||
single_rec = (ulint)*ptr & MLOG_SINGLE_REC_FLAG;
|
single_rec = (ulint)*ptr & MLOG_SINGLE_REC_FLAG;
|
||||||
|
|
||||||
if (single_rec || *ptr == MLOG_DUMMY_RECORD) {
|
if (single_rec || *ptr == MLOG_DUMMY_RECORD) {
|
||||||
/* The mtr only modified a single page */
|
/* The mtr only modified a single page, or this is a file op */
|
||||||
|
|
||||||
old_lsn = recv_sys->recovered_lsn;
|
old_lsn = recv_sys->recovered_lsn;
|
||||||
|
|
||||||
|
/* Try to parse a log record, fetching its type, space id,
|
||||||
|
page no, and a pointer to the body of the log record */
|
||||||
|
|
||||||
len = recv_parse_log_rec(ptr, end_ptr, &type, &space,
|
len = recv_parse_log_rec(ptr, end_ptr, &type, &space,
|
||||||
&page_no, &body);
|
&page_no, &body);
|
||||||
|
|
||||||
if (len == 0 || recv_sys->found_corrupt_log) {
|
if (len == 0 || recv_sys->found_corrupt_log) {
|
||||||
if (recv_sys->found_corrupt_log) {
|
if (recv_sys->found_corrupt_log) {
|
||||||
|
|
||||||
@@ -1954,6 +1965,26 @@ loop:
|
|||||||
if (type == MLOG_DUMMY_RECORD) {
|
if (type == MLOG_DUMMY_RECORD) {
|
||||||
/* Do nothing */
|
/* Do nothing */
|
||||||
|
|
||||||
|
} else if (store_to_hash && (type == MLOG_FILE_CREATE
|
||||||
|
|| type == MLOG_FILE_RENAME
|
||||||
|
|| type == MLOG_FILE_DELETE)) {
|
||||||
|
#ifdef UNIV_HOTBACKUP
|
||||||
|
/* In ibbackup --apply-log, replay an .ibd file
|
||||||
|
operation, if possible; note that
|
||||||
|
fil_path_to_mysql_datadir is set in ibbackup to
|
||||||
|
point to the datadir we should use there */
|
||||||
|
|
||||||
|
if (NULL == fil_op_log_parse_or_replay(body, end_ptr,
|
||||||
|
type, TRUE, space)) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"InnoDB: Error: file op log record of type %lu space %lu not complete in\n"
|
||||||
|
"InnoDB: the replay phase. Path %s\n", (ulint)type, space, (char*)(body + 2));
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/* In normal mysqld crash recovery we do not try to
|
||||||
|
replay file operations */
|
||||||
} else if (store_to_hash) {
|
} else if (store_to_hash) {
|
||||||
recv_add_to_hash_table(type, space, page_no, body,
|
recv_add_to_hash_table(type, space, page_no, body,
|
||||||
ptr + len, old_lsn,
|
ptr + len, old_lsn,
|
||||||
@@ -2915,6 +2946,8 @@ recv_reset_log_files_for_backup(
|
|||||||
|
|
||||||
buf = ut_malloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE);
|
buf = ut_malloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE);
|
||||||
|
|
||||||
|
memset(buf, LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE, '\0');
|
||||||
|
|
||||||
for (i = 0; i < n_log_files; i++) {
|
for (i = 0; i < n_log_files; i++) {
|
||||||
|
|
||||||
sprintf(name, "%sib_logfile%lu", log_dir, i);
|
sprintf(name, "%sib_logfile%lu", log_dir, i);
|
||||||
@@ -2954,7 +2987,7 @@ recv_reset_log_files_for_backup(
|
|||||||
log_block_init_in_old_format(buf + LOG_FILE_HDR_SIZE, lsn);
|
log_block_init_in_old_format(buf + LOG_FILE_HDR_SIZE, lsn);
|
||||||
log_block_set_first_rec_group(buf + LOG_FILE_HDR_SIZE,
|
log_block_set_first_rec_group(buf + LOG_FILE_HDR_SIZE,
|
||||||
LOG_BLOCK_HDR_SIZE);
|
LOG_BLOCK_HDR_SIZE);
|
||||||
sprintf(name, "%sib_logfile%lu", log_dir, 0);
|
sprintf(name, "%sib_logfile%lu", log_dir, 0UL);
|
||||||
|
|
||||||
log_file = os_file_create_simple(name, OS_FILE_OPEN,
|
log_file = os_file_create_simple(name, OS_FILE_OPEN,
|
||||||
OS_FILE_READ_WRITE, &success);
|
OS_FILE_READ_WRITE, &success);
|
||||||
@@ -2996,6 +3029,8 @@ log_group_recover_from_archive_file(
|
|||||||
int input_char;
|
int input_char;
|
||||||
char name[10000];
|
char name[10000];
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
try_open_again:
|
try_open_again:
|
||||||
buf = log_sys->buf;
|
buf = log_sys->buf;
|
||||||
|
|
||||||
@@ -3173,6 +3208,8 @@ recv_recovery_from_archive_start(
|
|||||||
ibool ret;
|
ibool ret;
|
||||||
ulint err;
|
ulint err;
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
recv_sys_create();
|
recv_sys_create();
|
||||||
recv_sys_init(FALSE, buf_pool_get_curr_size());
|
recv_sys_init(FALSE, buf_pool_get_curr_size());
|
||||||
|
|
||||||
@@ -3271,6 +3308,8 @@ void
|
|||||||
recv_recovery_from_archive_finish(void)
|
recv_recovery_from_archive_finish(void)
|
||||||
/*===================================*/
|
/*===================================*/
|
||||||
{
|
{
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
recv_recovery_from_checkpoint_finish();
|
recv_recovery_from_checkpoint_finish();
|
||||||
|
|
||||||
recv_recovery_from_backup_on = FALSE;
|
recv_recovery_from_backup_on = FALSE;
|
||||||
|
@@ -603,7 +603,7 @@ mem_pool_validate(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_anp(free + pool->reserved == pool->size);
|
ut_a(free + pool->reserved == pool->size);
|
||||||
|
|
||||||
mutex_exit(&(pool->mutex));
|
mutex_exit(&(pool->mutex));
|
||||||
|
|
||||||
|
@@ -595,6 +595,51 @@ next_file:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
This function attempts to create a directory named pathname. The new directory
|
||||||
|
gets default permissions. On Unix the permissions are (0770 & ~umask). If the
|
||||||
|
directory exists already, nothing is done and the call succeeds, unless the
|
||||||
|
fail_if_exists arguments is true. */
|
||||||
|
|
||||||
|
ibool
|
||||||
|
os_file_create_directory(
|
||||||
|
/*=====================*/
|
||||||
|
/* out: TRUE if call succeeds, FALSE on
|
||||||
|
error */
|
||||||
|
char* pathname, /* in: directory name as null-terminated
|
||||||
|
string */
|
||||||
|
ibool fail_if_exists) /* in: if TRUE, pre-existing directory is
|
||||||
|
treated as an error. */
|
||||||
|
{
|
||||||
|
#ifdef __WIN__
|
||||||
|
BOOL rcode;
|
||||||
|
|
||||||
|
rcode = CreateDirectory(pathname, NULL);
|
||||||
|
if (!(rcode != 0 ||
|
||||||
|
(GetLastError() == ERROR_FILE_EXISTS && !fail_if_exists))) {
|
||||||
|
/* failure */
|
||||||
|
os_file_handle_error(NULL, pathname, "CreateDirectory");
|
||||||
|
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (TRUE);
|
||||||
|
#else
|
||||||
|
int rcode;
|
||||||
|
|
||||||
|
rcode = mkdir(pathname, 0770);
|
||||||
|
|
||||||
|
if (!(rcode == 0 || (errno == EEXIST && !fail_if_exists))) {
|
||||||
|
/* failure */
|
||||||
|
os_file_handle_error(0, pathname, "mkdir");
|
||||||
|
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (TRUE);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
A simple function to open or create a file. */
|
A simple function to open or create a file. */
|
||||||
|
|
||||||
@@ -602,7 +647,8 @@ os_file_t
|
|||||||
os_file_create_simple(
|
os_file_create_simple(
|
||||||
/*==================*/
|
/*==================*/
|
||||||
/* out, own: handle to the file, not defined if error,
|
/* out, own: handle to the file, not defined if error,
|
||||||
error number can be retrieved with os_get_last_error */
|
error number can be retrieved with
|
||||||
|
os_file_get_last_error */
|
||||||
char* name, /* in: name of the file or path as a null-terminated
|
char* name, /* in: name of the file or path as a null-terminated
|
||||||
string */
|
string */
|
||||||
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
|
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
|
||||||
@@ -714,13 +760,16 @@ os_file_t
|
|||||||
os_file_create_simple_no_error_handling(
|
os_file_create_simple_no_error_handling(
|
||||||
/*====================================*/
|
/*====================================*/
|
||||||
/* out, own: handle to the file, not defined if error,
|
/* out, own: handle to the file, not defined if error,
|
||||||
error number can be retrieved with os_get_last_error */
|
error number can be retrieved with
|
||||||
|
os_file_get_last_error */
|
||||||
char* name, /* in: name of the file or path as a null-terminated
|
char* name, /* in: name of the file or path as a null-terminated
|
||||||
string */
|
string */
|
||||||
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
|
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
|
||||||
(if does not exist, error), or OS_FILE_CREATE if a new
|
(if does not exist, error), or OS_FILE_CREATE if a new
|
||||||
file is created (if exists, error) */
|
file is created (if exists, error) */
|
||||||
ulint access_type,/* in: OS_FILE_READ_ONLY or OS_FILE_READ_WRITE */
|
ulint access_type,/* in: OS_FILE_READ_ONLY, OS_FILE_READ_WRITE, or
|
||||||
|
OS_FILE_READ_ALLOW_DELETE; the last option is used by
|
||||||
|
a backup program reading the file */
|
||||||
ibool* success)/* out: TRUE if succeed, FALSE if error */
|
ibool* success)/* out: TRUE if succeed, FALSE if error */
|
||||||
{
|
{
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
@@ -728,6 +777,7 @@ os_file_create_simple_no_error_handling(
|
|||||||
DWORD create_flag;
|
DWORD create_flag;
|
||||||
DWORD access;
|
DWORD access;
|
||||||
DWORD attributes = 0;
|
DWORD attributes = 0;
|
||||||
|
DWORD share_mode = FILE_SHARE_READ;
|
||||||
|
|
||||||
ut_a(name);
|
ut_a(name);
|
||||||
|
|
||||||
@@ -744,6 +794,13 @@ os_file_create_simple_no_error_handling(
|
|||||||
access = GENERIC_READ;
|
access = GENERIC_READ;
|
||||||
} else if (access_type == OS_FILE_READ_WRITE) {
|
} else if (access_type == OS_FILE_READ_WRITE) {
|
||||||
access = GENERIC_READ | GENERIC_WRITE;
|
access = GENERIC_READ | GENERIC_WRITE;
|
||||||
|
} else if (access_type == OS_FILE_READ_ALLOW_DELETE) {
|
||||||
|
access = GENERIC_READ;
|
||||||
|
share_mode = FILE_SHARE_DELETE | FILE_SHARE_READ
|
||||||
|
| FILE_SHARE_WRITE; /* A backup program has to give
|
||||||
|
mysqld the maximum freedom to
|
||||||
|
do what it likes with the
|
||||||
|
file */
|
||||||
} else {
|
} else {
|
||||||
access = 0;
|
access = 0;
|
||||||
ut_error;
|
ut_error;
|
||||||
@@ -751,8 +808,7 @@ os_file_create_simple_no_error_handling(
|
|||||||
|
|
||||||
file = CreateFile(name,
|
file = CreateFile(name,
|
||||||
access,
|
access,
|
||||||
FILE_SHARE_READ,/* file can be read also by other
|
share_mode,
|
||||||
processes */
|
|
||||||
NULL, /* default security attributes */
|
NULL, /* default security attributes */
|
||||||
create_flag,
|
create_flag,
|
||||||
attributes,
|
attributes,
|
||||||
@@ -808,7 +864,8 @@ os_file_t
|
|||||||
os_file_create(
|
os_file_create(
|
||||||
/*===========*/
|
/*===========*/
|
||||||
/* out, own: handle to the file, not defined if error,
|
/* out, own: handle to the file, not defined if error,
|
||||||
error number can be retrieved with os_get_last_error */
|
error number can be retrieved with
|
||||||
|
os_file_get_last_error */
|
||||||
char* name, /* in: name of the file or path as a null-terminated
|
char* name, /* in: name of the file or path as a null-terminated
|
||||||
string */
|
string */
|
||||||
ulint create_mode, /* in: OS_FILE_OPEN if an existing file is opened
|
ulint create_mode, /* in: OS_FILE_OPEN if an existing file is opened
|
||||||
@@ -896,7 +953,7 @@ try_again:
|
|||||||
start 2 instances of mysqld on the
|
start 2 instances of mysqld on the
|
||||||
SAME files, that could cause severe
|
SAME files, that could cause severe
|
||||||
database corruption! When opening
|
database corruption! When opening
|
||||||
raw disk partitions Microsoft manuals
|
raw disk partitions, Microsoft manuals
|
||||||
say that we must give also the write
|
say that we must give also the write
|
||||||
permission. */
|
permission. */
|
||||||
NULL, /* default security attributes */
|
NULL, /* default security attributes */
|
||||||
@@ -1017,6 +1074,10 @@ os_file_delete(
|
|||||||
{
|
{
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
ulint count = 0;
|
||||||
|
loop:
|
||||||
|
/* In Windows, deleting an .ibd file may fail if ibbackup is copying
|
||||||
|
it */
|
||||||
|
|
||||||
ret = DeleteFile((LPCTSTR)name);
|
ret = DeleteFile((LPCTSTR)name);
|
||||||
|
|
||||||
@@ -1024,9 +1085,31 @@ os_file_delete(
|
|||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
os_file_handle_error(NULL, name, "delete");
|
if (GetLastError() == ERROR_PATH_NOT_FOUND) {
|
||||||
|
/* If the file does not exist, we classify this as a 'mild'
|
||||||
|
error and return */
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
count++;
|
||||||
|
|
||||||
|
if (count > 100 && 0 == (count % 10)) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"InnoDB: Warning: cannot delete file %s\n"
|
||||||
|
"InnoDB: Are you running ibbackup to back up the file?\n", name);
|
||||||
|
|
||||||
|
os_file_get_last_error(TRUE); /* print error information */
|
||||||
|
}
|
||||||
|
|
||||||
|
os_thread_sleep(1000000); /* sleep for a second */
|
||||||
|
|
||||||
|
if (count > 2000) {
|
||||||
|
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
goto loop;
|
||||||
#else
|
#else
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -1103,6 +1186,7 @@ os_file_close(
|
|||||||
}
|
}
|
||||||
|
|
||||||
os_file_handle_error(file, NULL, "close");
|
os_file_handle_error(file, NULL, "close");
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
#else
|
#else
|
||||||
int ret;
|
int ret;
|
||||||
@@ -1111,6 +1195,7 @@ os_file_close(
|
|||||||
|
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
os_file_handle_error(file, NULL, "close");
|
os_file_handle_error(file, NULL, "close");
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3010,7 +3095,15 @@ consecutive_loop:
|
|||||||
/* Do the i/o with ordinary, synchronous i/o functions: */
|
/* Do the i/o with ordinary, synchronous i/o functions: */
|
||||||
if (slot->type == OS_FILE_WRITE) {
|
if (slot->type == OS_FILE_WRITE) {
|
||||||
if (array == os_aio_write_array) {
|
if (array == os_aio_write_array) {
|
||||||
|
if ((total_len % UNIV_PAGE_SIZE != 0)
|
||||||
|
|| (slot->offset % UNIV_PAGE_SIZE != 0)) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"InnoDB: Error: trying a displaced write to %s %lu %lu, len %lu\n",
|
||||||
|
slot->name, slot->offset_high,
|
||||||
|
slot->offset, total_len);
|
||||||
|
ut_a(0);
|
||||||
|
}
|
||||||
|
|
||||||
/* Do a 'last millisecond' check that the page end
|
/* Do a 'last millisecond' check that the page end
|
||||||
is sensible; reported page checksum errors from
|
is sensible; reported page checksum errors from
|
||||||
Linux seem to wipe over the page end */
|
Linux seem to wipe over the page end */
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/* A lexical scanner generated by flex */
|
/* A lexical scanner generated by flex */
|
||||||
|
|
||||||
/* Scanner skeleton version:
|
/* Scanner skeleton version:
|
||||||
* $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
|
* $Header: /home/heikki/cvsroot/ib/pars/lexyy.c,v 1.2 2003/10/30 20:27:19 heikki Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define FLEX_SCANNER
|
#define FLEX_SCANNER
|
||||||
|
@@ -2346,8 +2346,13 @@ row_drop_table_for_mysql(
|
|||||||
/* Do not drop possible .ibd tablespace if something went
|
/* Do not drop possible .ibd tablespace if something went
|
||||||
wrong: we do not want to delete valuable data of the user */
|
wrong: we do not want to delete valuable data of the user */
|
||||||
|
|
||||||
if (err == DB_SUCCESS && space_id != 0
|
if (err == DB_SUCCESS && space_id > 0) {
|
||||||
&& fil_tablespace_exists_in_mem(space_id)) {
|
if (!fil_space_for_table_exists_in_mem(space_id, name,
|
||||||
|
FALSE, TRUE)) {
|
||||||
|
err = DB_ERROR;
|
||||||
|
|
||||||
|
goto funct_exit;
|
||||||
|
}
|
||||||
|
|
||||||
success = fil_delete_tablespace(space_id);
|
success = fil_delete_tablespace(space_id);
|
||||||
|
|
||||||
|
@@ -3287,8 +3287,14 @@ rec_loop:
|
|||||||
latest version of the record */
|
latest version of the record */
|
||||||
|
|
||||||
} else if (index == clust_index) {
|
} else if (index == clust_index) {
|
||||||
|
|
||||||
if (!lock_clust_rec_cons_read_sees(rec, index,
|
/* Fetch a previous version of the row if the current
|
||||||
|
one is not visible in the snapshot; if we have a very
|
||||||
|
high force recovery level set, we try to avoid crashes
|
||||||
|
by skipping this lookup */
|
||||||
|
|
||||||
|
if (srv_force_recovery < 5
|
||||||
|
&& !lock_clust_rec_cons_read_sees(rec, index,
|
||||||
trx->read_view)) {
|
trx->read_view)) {
|
||||||
|
|
||||||
err = row_sel_build_prev_vers_for_mysql(
|
err = row_sel_build_prev_vers_for_mysql(
|
||||||
|
@@ -102,7 +102,7 @@ char** srv_log_group_home_dirs = NULL;
|
|||||||
ulint srv_n_log_groups = ULINT_MAX;
|
ulint srv_n_log_groups = ULINT_MAX;
|
||||||
ulint srv_n_log_files = ULINT_MAX;
|
ulint srv_n_log_files = ULINT_MAX;
|
||||||
ulint srv_log_file_size = ULINT_MAX; /* size in database pages */
|
ulint srv_log_file_size = ULINT_MAX; /* size in database pages */
|
||||||
ibool srv_log_archive_on = TRUE;
|
ibool srv_log_archive_on = FALSE;
|
||||||
ulint srv_log_buffer_size = ULINT_MAX; /* size in database pages */
|
ulint srv_log_buffer_size = ULINT_MAX; /* size in database pages */
|
||||||
ulint srv_flush_log_at_trx_commit = 1;
|
ulint srv_flush_log_at_trx_commit = 1;
|
||||||
|
|
||||||
@@ -1717,7 +1717,7 @@ srv_init(void)
|
|||||||
os_fast_mutex_init(&srv_conc_mutex);
|
os_fast_mutex_init(&srv_conc_mutex);
|
||||||
|
|
||||||
UT_LIST_INIT(srv_conc_queue);
|
UT_LIST_INIT(srv_conc_queue);
|
||||||
|
|
||||||
srv_conc_slots = mem_alloc(OS_THREAD_MAX_N * sizeof(srv_conc_slot_t));
|
srv_conc_slots = mem_alloc(OS_THREAD_MAX_N * sizeof(srv_conc_slot_t));
|
||||||
|
|
||||||
for (i = 0; i < OS_THREAD_MAX_N; i++) {
|
for (i = 0; i < OS_THREAD_MAX_N; i++) {
|
||||||
@@ -3209,11 +3209,13 @@ flush_loop:
|
|||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
mutex_exit(&kernel_mutex);
|
mutex_exit(&kernel_mutex);
|
||||||
|
/*
|
||||||
srv_main_thread_op_info =
|
srv_main_thread_op_info =
|
||||||
(char*)"archiving log (if log archive is on)";
|
(char*)"archiving log (if log archive is on)";
|
||||||
|
|
||||||
log_archive_do(FALSE, &n_bytes_archived);
|
log_archive_do(FALSE, &n_bytes_archived);
|
||||||
|
*/
|
||||||
|
n_bytes_archived = 0;
|
||||||
|
|
||||||
/* Keep looping in the background loop if still work to do */
|
/* Keep looping in the background loop if still work to do */
|
||||||
|
|
||||||
|
@@ -553,7 +553,6 @@ open_or_create_log_file(
|
|||||||
ulint i) /* in: log file number in group */
|
ulint i) /* in: log file number in group */
|
||||||
{
|
{
|
||||||
ibool ret;
|
ibool ret;
|
||||||
ulint arch_space_id;
|
|
||||||
ulint size;
|
ulint size;
|
||||||
ulint size_high;
|
ulint size_high;
|
||||||
char name[10000];
|
char name[10000];
|
||||||
@@ -649,9 +648,10 @@ open_or_create_log_file(
|
|||||||
|
|
||||||
fil_node_create(name, srv_log_file_size,
|
fil_node_create(name, srv_log_file_size,
|
||||||
2 * k + SRV_LOG_SPACE_FIRST_ID, FALSE);
|
2 * k + SRV_LOG_SPACE_FIRST_ID, FALSE);
|
||||||
|
#ifdef notdefined
|
||||||
/* If this is the first log group, create the file space object
|
/* If this is the first log group, create the file space object
|
||||||
for archived logs */
|
for archived logs.
|
||||||
|
Under MySQL, no archiving ever done. */
|
||||||
|
|
||||||
if (k == 0 && i == 0) {
|
if (k == 0 && i == 0) {
|
||||||
arch_space_id = 2 * k + 1 + SRV_LOG_SPACE_FIRST_ID;
|
arch_space_id = 2 * k + 1 + SRV_LOG_SPACE_FIRST_ID;
|
||||||
@@ -661,12 +661,13 @@ open_or_create_log_file(
|
|||||||
} else {
|
} else {
|
||||||
arch_space_id = ULINT_UNDEFINED;
|
arch_space_id = ULINT_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
log_group_init(k, srv_n_log_files,
|
log_group_init(k, srv_n_log_files,
|
||||||
srv_log_file_size * UNIV_PAGE_SIZE,
|
srv_log_file_size * UNIV_PAGE_SIZE,
|
||||||
2 * k + SRV_LOG_SPACE_FIRST_ID,
|
2 * k + SRV_LOG_SPACE_FIRST_ID,
|
||||||
arch_space_id);
|
SRV_LOG_SPACE_FIRST_ID + 1); /* dummy arch
|
||||||
|
space id */
|
||||||
}
|
}
|
||||||
|
|
||||||
return(DB_SUCCESS);
|
return(DB_SUCCESS);
|
||||||
@@ -1000,7 +1001,6 @@ innobase_start_or_create_for_mysql(void)
|
|||||||
dulint max_flushed_lsn;
|
dulint max_flushed_lsn;
|
||||||
ulint min_arch_log_no;
|
ulint min_arch_log_no;
|
||||||
ulint max_arch_log_no;
|
ulint max_arch_log_no;
|
||||||
ibool start_archive;
|
|
||||||
ulint sum_of_new_sizes;
|
ulint sum_of_new_sizes;
|
||||||
ulint sum_of_data_file_sizes;
|
ulint sum_of_data_file_sizes;
|
||||||
ulint tablespace_size_in_header;
|
ulint tablespace_size_in_header;
|
||||||
@@ -1156,7 +1156,7 @@ NetWare. */
|
|||||||
assume fewer threads. */
|
assume fewer threads. */
|
||||||
srv_max_n_threads = 10000;
|
srv_max_n_threads = 10000;
|
||||||
} else {
|
} else {
|
||||||
srv_max_n_threads = 1000; /* saves several MB of memory,
|
srv_max_n_threads = 1000; /* saves several MB of memory,
|
||||||
especially in 64-bit
|
especially in 64-bit
|
||||||
computers */
|
computers */
|
||||||
}
|
}
|
||||||
@@ -1164,6 +1164,28 @@ NetWare. */
|
|||||||
/* Note that the call srv_boot() also changes the values of
|
/* Note that the call srv_boot() also changes the values of
|
||||||
srv_pool_size etc. to the units used by InnoDB internally */
|
srv_pool_size etc. to the units used by InnoDB internally */
|
||||||
|
|
||||||
|
/* Set the maximum number of threads which can wait for a semaphore
|
||||||
|
inside InnoDB */
|
||||||
|
#if defined(__WIN__) || defined(__NETWARE__)
|
||||||
|
|
||||||
|
/* Create less event semaphores because Win 98/ME had difficulty creating
|
||||||
|
40000 event semaphores.
|
||||||
|
Comment from Novell, Inc.: also, these just take a lot of memory on
|
||||||
|
NetWare. */
|
||||||
|
srv_max_n_threads = 1000;
|
||||||
|
#else
|
||||||
|
if (srv_pool_size >= 8 * 1024 * 1024) {
|
||||||
|
/* Here we still have srv_pool_size counted
|
||||||
|
in bytes, srv_boot converts the value to
|
||||||
|
pages; if buffer pool is less than 8 MB,
|
||||||
|
assume fewer threads. */
|
||||||
|
srv_max_n_threads = 10000;
|
||||||
|
} else {
|
||||||
|
srv_max_n_threads = 1000; /* saves several MB of memory,
|
||||||
|
especially in 64-bit
|
||||||
|
computers */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
err = srv_boot();
|
err = srv_boot();
|
||||||
|
|
||||||
if (err != DB_SUCCESS) {
|
if (err != DB_SUCCESS) {
|
||||||
@@ -1341,7 +1363,9 @@ NetWare. */
|
|||||||
|
|
||||||
mutex_enter(&(log_sys->mutex));
|
mutex_enter(&(log_sys->mutex));
|
||||||
|
|
||||||
recv_reset_logs(max_flushed_lsn, max_arch_log_no + 1, TRUE);
|
/* Do not + 1 arch_log_no because we do not use log
|
||||||
|
archiving */
|
||||||
|
recv_reset_logs(max_flushed_lsn, max_arch_log_no, TRUE);
|
||||||
|
|
||||||
mutex_exit(&(log_sys->mutex));
|
mutex_exit(&(log_sys->mutex));
|
||||||
}
|
}
|
||||||
@@ -1430,6 +1454,8 @@ NetWare. */
|
|||||||
|
|
||||||
log_make_checkpoint_at(ut_dulint_max, TRUE);
|
log_make_checkpoint_at(ut_dulint_max, TRUE);
|
||||||
|
|
||||||
|
#ifdef notdefined
|
||||||
|
/* Archiving is always off under MySQL */
|
||||||
if (!srv_log_archive_on) {
|
if (!srv_log_archive_on) {
|
||||||
ut_a(DB_SUCCESS == log_archive_noarchivelog());
|
ut_a(DB_SUCCESS == log_archive_noarchivelog());
|
||||||
} else {
|
} else {
|
||||||
@@ -1447,7 +1473,7 @@ NetWare. */
|
|||||||
ut_a(DB_SUCCESS == log_archive_archivelog());
|
ut_a(DB_SUCCESS == log_archive_archivelog());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (!create_new_db && srv_force_recovery == 0) {
|
if (!create_new_db && srv_force_recovery == 0) {
|
||||||
/* After a crash recovery we only check that the info in data
|
/* After a crash recovery we only check that the info in data
|
||||||
dictionary is consistent with what we already know about space
|
dictionary is consistent with what we already know about space
|
||||||
|
@@ -19,9 +19,10 @@ ibool ut_dbg_stop_threads = FALSE;
|
|||||||
|
|
||||||
ulint* ut_dbg_null_ptr = NULL;
|
ulint* ut_dbg_null_ptr = NULL;
|
||||||
|
|
||||||
/* Dummy function to prevent gcc from ignoring this file */
|
const char* ut_dbg_msg_assert_fail =
|
||||||
void
|
"InnoDB: Assertion failure in thread %lu in file %s line %lu\n";
|
||||||
ut_dummy(void)
|
const char* ut_dbg_msg_trap =
|
||||||
{
|
"InnoDB: We intentionally generate a memory trap.\n"
|
||||||
printf("Hello world\n");
|
"InnoDB: Send a detailed bug report to mysql@lists.mysql.com.\n";
|
||||||
}
|
const char* ut_dbg_msg_stop =
|
||||||
|
"InnoDB: Thread %lu stopped in file %s line %lu\n";
|
||||||
|
@@ -71,9 +71,8 @@ ut_find_prime(
|
|||||||
|
|
||||||
/* Found a prime */
|
/* Found a prime */
|
||||||
break;
|
break;
|
||||||
next_n: ;
|
next_n: ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(n);
|
return(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -63,7 +63,7 @@ ut_get_high32(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
The following function returns a clock time in milliseconds. */
|
The following function returns elapsed CPU time in milliseconds. */
|
||||||
|
|
||||||
ulint
|
ulint
|
||||||
ut_clock(void)
|
ut_clock(void)
|
||||||
@@ -181,6 +181,50 @@ ut_sprintf_timestamp(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**************************************************************
|
||||||
|
Sprintfs a timestamp to a buffer with no spaces and with ':' characters
|
||||||
|
replaced by '_'. */
|
||||||
|
|
||||||
|
void
|
||||||
|
ut_sprintf_timestamp_without_extra_chars(
|
||||||
|
/*=====================================*/
|
||||||
|
char* buf) /* in: buffer where to sprintf */
|
||||||
|
{
|
||||||
|
#ifdef __WIN__
|
||||||
|
SYSTEMTIME cal_tm;
|
||||||
|
|
||||||
|
GetLocalTime(&cal_tm);
|
||||||
|
|
||||||
|
sprintf(buf, "%02d%02d%02d_%2d_%02d_%02d",
|
||||||
|
(int)cal_tm.wYear % 100,
|
||||||
|
(int)cal_tm.wMonth,
|
||||||
|
(int)cal_tm.wDay,
|
||||||
|
(int)cal_tm.wHour,
|
||||||
|
(int)cal_tm.wMinute,
|
||||||
|
(int)cal_tm.wSecond);
|
||||||
|
#else
|
||||||
|
struct tm cal_tm;
|
||||||
|
struct tm* cal_tm_ptr;
|
||||||
|
time_t tm;
|
||||||
|
|
||||||
|
time(&tm);
|
||||||
|
|
||||||
|
#ifdef HAVE_LOCALTIME_R
|
||||||
|
localtime_r(&tm, &cal_tm);
|
||||||
|
cal_tm_ptr = &cal_tm;
|
||||||
|
#else
|
||||||
|
cal_tm_ptr = localtime(&tm);
|
||||||
|
#endif
|
||||||
|
sprintf(buf, "%02d%02d%02d_%2d_%02d_%02d",
|
||||||
|
cal_tm_ptr->tm_year % 100,
|
||||||
|
cal_tm_ptr->tm_mon + 1,
|
||||||
|
cal_tm_ptr->tm_mday,
|
||||||
|
cal_tm_ptr->tm_hour,
|
||||||
|
cal_tm_ptr->tm_min,
|
||||||
|
cal_tm_ptr->tm_sec);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************
|
/**************************************************************
|
||||||
Returns current year, month, day. */
|
Returns current year, month, day. */
|
||||||
|
|
||||||
|
10
isam/extra.c
10
isam/extra.c
@@ -250,17 +250,15 @@ int nisam_extra(N_INFO *info, enum ha_extra_function function)
|
|||||||
pthread_mutex_unlock(&THR_LOCK_isam);
|
pthread_mutex_unlock(&THR_LOCK_isam);
|
||||||
break;
|
break;
|
||||||
case HA_EXTRA_FLUSH:
|
case HA_EXTRA_FLUSH:
|
||||||
#ifdef __WIN__
|
|
||||||
if (info->s->not_flushed)
|
if (info->s->not_flushed)
|
||||||
{
|
{
|
||||||
info->s->not_flushed=0;
|
info->s->not_flushed=0;
|
||||||
if (_commit(info->s->kfile))
|
if (my_sync(info->s->kfile, MYF(0)))
|
||||||
error=errno;
|
error= my_errno;
|
||||||
if (_commit(info->dfile))
|
if (my_sync(info->dfile, MYF(0)))
|
||||||
error=errno;
|
error= my_errno;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case HA_EXTRA_NORMAL: /* Theese isn't in use */
|
case HA_EXTRA_NORMAL: /* Theese isn't in use */
|
||||||
case HA_EXTRA_QUICK:
|
case HA_EXTRA_QUICK:
|
||||||
case HA_EXTRA_KEY_CACHE:
|
case HA_EXTRA_KEY_CACHE:
|
||||||
|
@@ -90,7 +90,7 @@ MYSQL_MANAGER* STDCALL mysql_manager_connect(MYSQL_MANAGER* con,
|
|||||||
{
|
{
|
||||||
my_socket sock;
|
my_socket sock;
|
||||||
struct sockaddr_in sock_addr;
|
struct sockaddr_in sock_addr;
|
||||||
uint32 ip_addr;
|
in_addr_t ip_addr;
|
||||||
char msg_buf[MAX_MYSQL_MANAGER_MSG];
|
char msg_buf[MAX_MYSQL_MANAGER_MSG];
|
||||||
int msg_len;
|
int msg_len;
|
||||||
Vio* vio;
|
Vio* vio;
|
||||||
|
@@ -38,7 +38,7 @@ libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c
|
|||||||
|
|
||||||
noinst_HEADERS = embedded_priv.h
|
noinst_HEADERS = embedded_priv.h
|
||||||
|
|
||||||
sqlsources = derror.cc field.cc field_conv.cc filesort.cc \
|
sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
|
||||||
ha_innodb.cc ha_berkeley.cc ha_heap.cc ha_isam.cc ha_isammrg.cc \
|
ha_innodb.cc ha_berkeley.cc ha_heap.cc ha_isam.cc ha_isammrg.cc \
|
||||||
ha_myisam.cc ha_myisammrg.cc handler.cc sql_handler.cc \
|
ha_myisam.cc ha_myisammrg.cc handler.cc sql_handler.cc \
|
||||||
hostname.cc init.cc password.c \
|
hostname.cc init.cc password.c \
|
||||||
@@ -92,10 +92,10 @@ libmysqld.a: libmysqld_int.a $(INC_LIB)
|
|||||||
ar x $$file; \
|
ar x $$file; \
|
||||||
for obj in *.o ; do mv $$obj $${bfile}_$$obj ; done ; \
|
for obj in *.o ; do mv $$obj $${bfile}_$$obj ; done ; \
|
||||||
ar q ../libmysqld_int2.a *.o ; \
|
ar q ../libmysqld_int2.a *.o ; \
|
||||||
rm *.o ; \
|
rm -f *.o ; \
|
||||||
done
|
done
|
||||||
mv libmysqld_int2.a libmysqld.a
|
mv libmysqld_int2.a libmysqld.a
|
||||||
rm tmp/*
|
rm -f tmp/*
|
||||||
$(RANLIB) libmysqld.a
|
$(RANLIB) libmysqld.a
|
||||||
|
|
||||||
## XXX: any time the client interface changes, we'll need to bump
|
## XXX: any time the client interface changes, we'll need to bump
|
||||||
|
@@ -362,7 +362,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
|
|||||||
Hack: instead of init_queue, we'll use reinit queue to be able
|
Hack: instead of init_queue, we'll use reinit queue to be able
|
||||||
to alloc queue with alloc_root()
|
to alloc queue with alloc_root()
|
||||||
*/
|
*/
|
||||||
res=ftb->queue.max_elements=1+query_len/(ft_min_word_len+1);
|
res=ftb->queue.max_elements=1+query_len/(min(ft_min_word_len,2)+1);
|
||||||
ftb->queue.root=(byte **)alloc_root(&ftb->mem_root, (res+1)*sizeof(void*));
|
ftb->queue.root=(byte **)alloc_root(&ftb->mem_root, (res+1)*sizeof(void*));
|
||||||
reinit_queue(& ftb->queue, res, 0, 0,
|
reinit_queue(& ftb->queue, res, 0, 0,
|
||||||
(int (*)(void*,byte*,byte*))FTB_WORD_cmp, 0);
|
(int (*)(void*,byte*,byte*))FTB_WORD_cmp, 0);
|
||||||
|
@@ -336,22 +336,10 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
|
|||||||
if (share->not_flushed)
|
if (share->not_flushed)
|
||||||
{
|
{
|
||||||
share->not_flushed=0;
|
share->not_flushed=0;
|
||||||
#if defined(__WIN__)
|
if (my_sync(share->kfile, MYF(0)))
|
||||||
if (_commit(share->kfile))
|
error= my_errno;
|
||||||
error=errno;
|
if (my_sync(info->dfile, MYF(0)))
|
||||||
if (_commit(info->dfile))
|
error= my_errno;
|
||||||
error=errno;
|
|
||||||
#elif defined(HAVE_FDATASYNC)
|
|
||||||
if (fdatasync(share->kfile))
|
|
||||||
error=errno;
|
|
||||||
if (fdatasync(share->dfile))
|
|
||||||
error=errno;
|
|
||||||
#elif defined(HAVE_FSYNC)
|
|
||||||
if ( fsync(share->kfile))
|
|
||||||
error=errno;
|
|
||||||
if (fsync(share->dfile))
|
|
||||||
error=errno;
|
|
||||||
#endif
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
share->changed=1;
|
share->changed=1;
|
||||||
|
@@ -98,22 +98,10 @@ int mi_lock_database(MI_INFO *info, int lock_type)
|
|||||||
share->changed=0;
|
share->changed=0;
|
||||||
if (myisam_flush)
|
if (myisam_flush)
|
||||||
{
|
{
|
||||||
#if defined(__WIN__)
|
if (my_sync(share->kfile, MYF(0)))
|
||||||
if (_commit(share->kfile))
|
error= my_errno;
|
||||||
error=errno;
|
if (my_sync(info->dfile, MYF(0)))
|
||||||
if (_commit(info->dfile))
|
error= my_errno;
|
||||||
error=errno;
|
|
||||||
#elif defined(HAVE_FDATASYNC)
|
|
||||||
if (fdatasync(share->kfile))
|
|
||||||
error=errno;
|
|
||||||
if (fdatasync(share->dfile))
|
|
||||||
error=errno;
|
|
||||||
#elif defined(HAVE_FSYNC)
|
|
||||||
if (fsync(share->kfile))
|
|
||||||
error=errno;
|
|
||||||
if (fsync(share->dfile))
|
|
||||||
error=errno;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
share->not_flushed=1;
|
share->not_flushed=1;
|
||||||
|
@@ -508,6 +508,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
|
|||||||
&info.buff,(share->base.max_key_block_length*2+
|
&info.buff,(share->base.max_key_block_length*2+
|
||||||
share->base.max_key_length),
|
share->base.max_key_length),
|
||||||
&info.lastkey,share->base.max_key_length*3+1,
|
&info.lastkey,share->base.max_key_length*3+1,
|
||||||
|
&info.first_mbr_key, share->base.max_key_length,
|
||||||
&info.filename,strlen(org_name)+1,
|
&info.filename,strlen(org_name)+1,
|
||||||
&info.rtree_recursion_state,have_rtree ? 1024 : 0,
|
&info.rtree_recursion_state,have_rtree ? 1024 : 0,
|
||||||
NullS))
|
NullS))
|
||||||
|
@@ -41,17 +41,20 @@ int mi_rnext_same(MI_INFO *info, byte *buf)
|
|||||||
if (info->s->concurrent_insert)
|
if (info->s->concurrent_insert)
|
||||||
rw_rdlock(&info->s->key_root_lock[inx]);
|
rw_rdlock(&info->s->key_root_lock[inx]);
|
||||||
|
|
||||||
switch(keyinfo->key_alg)
|
switch (keyinfo->key_alg)
|
||||||
{
|
{
|
||||||
case HA_KEY_ALG_RTREE:
|
case HA_KEY_ALG_RTREE:
|
||||||
if((error=rtree_find_next(info,inx,myisam_read_vec[info->last_key_func])))
|
if ((error=rtree_find_next(info,inx,
|
||||||
{
|
myisam_read_vec[info->last_key_func])))
|
||||||
/* FIXME: What to do?*/
|
{
|
||||||
}
|
error=1;
|
||||||
|
my_errno=HA_ERR_END_OF_FILE;
|
||||||
|
info->lastpos= HA_OFFSET_ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case HA_KEY_ALG_BTREE:
|
case HA_KEY_ALG_BTREE:
|
||||||
default:
|
default:
|
||||||
|
|
||||||
memcpy(info->lastkey2,info->lastkey,info->last_rkey_length);
|
memcpy(info->lastkey2,info->lastkey,info->last_rkey_length);
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
@@ -411,6 +411,8 @@ static void usage(void)
|
|||||||
-q, --quick Faster repair by not modifying the data file.\n\
|
-q, --quick Faster repair by not modifying the data file.\n\
|
||||||
One can give a second '-q' to force myisamchk to\n\
|
One can give a second '-q' to force myisamchk to\n\
|
||||||
modify the original datafile in case of duplicate keys.\n\
|
modify the original datafile in case of duplicate keys.\n\
|
||||||
|
NOTE: Tables where the data file is currupted can't be\n\
|
||||||
|
fixed with this option.\n\
|
||||||
-u, --unpack Unpack file packed with myisampack.\n\
|
-u, --unpack Unpack file packed with myisampack.\n\
|
||||||
");
|
");
|
||||||
|
|
||||||
@@ -1109,7 +1111,7 @@ end2:
|
|||||||
filename));
|
filename));
|
||||||
if (param->testflag & T_REP_ANY)
|
if (param->testflag & T_REP_ANY)
|
||||||
VOID(fprintf(stderr,
|
VOID(fprintf(stderr,
|
||||||
"Try fixing it by using the --safe-recover (-o) or the --force (-f) option\n"));
|
"Try fixing it by using the --safe-recover (-o), the --force (-f) option or by not using the --quick (-q) flag\n"));
|
||||||
}
|
}
|
||||||
else if (!(param->error_printed & 2) &&
|
else if (!(param->error_printed & 2) &&
|
||||||
!(param->testflag & T_FORCE_CREATE))
|
!(param->testflag & T_FORCE_CREATE))
|
||||||
|
@@ -229,6 +229,7 @@ struct st_myisam_info {
|
|||||||
char *filename; /* parameter to open filename */
|
char *filename; /* parameter to open filename */
|
||||||
uchar *buff, /* Temp area for key */
|
uchar *buff, /* Temp area for key */
|
||||||
*lastkey,*lastkey2; /* Last used search key */
|
*lastkey,*lastkey2; /* Last used search key */
|
||||||
|
uchar *first_mbr_key; /* Searhed spatial key */
|
||||||
byte *rec_buff; /* Tempbuff for recordpack */
|
byte *rec_buff; /* Tempbuff for recordpack */
|
||||||
uchar *int_keypos, /* Save position for next/previous */
|
uchar *int_keypos, /* Save position for next/previous */
|
||||||
*int_maxpos; /* -""- */
|
*int_maxpos; /* -""- */
|
||||||
|
@@ -36,16 +36,21 @@ typedef struct st_page_list
|
|||||||
stPageLevel *pages;
|
stPageLevel *pages;
|
||||||
} stPageList;
|
} stPageList;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Find next key in r-tree according to search_flag recursively
|
Find next key in r-tree according to search_flag recursively
|
||||||
Used in rtree_find_first() and rtree_find_next()
|
|
||||||
Result values:
|
NOTES
|
||||||
-1 - error
|
Used in rtree_find_first() and rtree_find_next()
|
||||||
0 - found
|
|
||||||
1 - not found
|
RETURN
|
||||||
|
-1 Error
|
||||||
|
0 Found
|
||||||
|
1 Not found
|
||||||
*/
|
*/
|
||||||
static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag, uint nod_cmp_flag,
|
|
||||||
my_off_t page, int level)
|
static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag,
|
||||||
|
uint nod_cmp_flag, my_off_t page, int level)
|
||||||
{
|
{
|
||||||
uchar *k;
|
uchar *k;
|
||||||
uchar *last;
|
uchar *last;
|
||||||
@@ -81,7 +86,7 @@ static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag, u
|
|||||||
if (nod_flag)
|
if (nod_flag)
|
||||||
{
|
{
|
||||||
/* this is an internal node in the tree */
|
/* this is an internal node in the tree */
|
||||||
if (!(res = rtree_key_cmp(keyinfo->seg, info->lastkey2, k,
|
if (!(res = rtree_key_cmp(keyinfo->seg, info->first_mbr_key, k,
|
||||||
info->last_rkey_length, nod_cmp_flag)))
|
info->last_rkey_length, nod_cmp_flag)))
|
||||||
{
|
{
|
||||||
switch ((res = rtree_find_req(info, keyinfo, search_flag, nod_cmp_flag,
|
switch ((res = rtree_find_req(info, keyinfo, search_flag, nod_cmp_flag,
|
||||||
@@ -102,7 +107,7 @@ static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag, u
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* this is a leaf */
|
/* this is a leaf */
|
||||||
if (!rtree_key_cmp(keyinfo->seg, info->lastkey2, k,
|
if (!rtree_key_cmp(keyinfo->seg, info->first_mbr_key, k,
|
||||||
info->last_rkey_length, search_flag))
|
info->last_rkey_length, search_flag))
|
||||||
{
|
{
|
||||||
uchar *after_key = rt_PAGE_NEXT_KEY(k, k_len, nod_flag);
|
uchar *after_key = rt_PAGE_NEXT_KEY(k, k_len, nod_flag);
|
||||||
@@ -143,13 +148,24 @@ err1:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Find first key in r-tree according to search_flag condition
|
Find first key in r-tree according to search_flag condition
|
||||||
Result values:
|
|
||||||
-1 - error
|
SYNOPSIS
|
||||||
0 - found
|
rtree_find_first()
|
||||||
1 - not found
|
info Handler to MyISAM file
|
||||||
|
uint keynr Key number to use
|
||||||
|
key Key to search for
|
||||||
|
key_length Length of 'key'
|
||||||
|
search_flag Bitmap of flags how to do the search
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
-1 Error
|
||||||
|
0 Found
|
||||||
|
1 Not found
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int rtree_find_first(MI_INFO *info, uint keynr, uchar *key, uint key_length,
|
int rtree_find_first(MI_INFO *info, uint keynr, uchar *key, uint key_length,
|
||||||
uint search_flag)
|
uint search_flag)
|
||||||
{
|
{
|
||||||
@@ -164,7 +180,8 @@ int rtree_find_first(MI_INFO *info, uint keynr, uchar *key, uint key_length,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Save searched key */
|
/* Save searched key */
|
||||||
memcpy(info->lastkey2, key, keyinfo->keylength - info->s->base.rec_reflength);
|
memcpy(info->first_mbr_key, key, keyinfo->keylength -
|
||||||
|
info->s->base.rec_reflength);
|
||||||
info->last_rkey_length = key_length;
|
info->last_rkey_length = key_length;
|
||||||
|
|
||||||
info->rtree_recursion_depth = -1;
|
info->rtree_recursion_depth = -1;
|
||||||
@@ -175,13 +192,22 @@ int rtree_find_first(MI_INFO *info, uint keynr, uchar *key, uint key_length,
|
|||||||
return rtree_find_req(info, keyinfo, search_flag, nod_cmp_flag, root, 0);
|
return rtree_find_req(info, keyinfo, search_flag, nod_cmp_flag, root, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Find next key in r-tree according to search_flag condition
|
Find next key in r-tree according to search_flag condition
|
||||||
Result values:
|
|
||||||
-1 - error
|
SYNOPSIS
|
||||||
0 - found
|
rtree_find_next()
|
||||||
1 - not found
|
info Handler to MyISAM file
|
||||||
|
uint keynr Key number to use
|
||||||
|
search_flag Bitmap of flags how to do the search
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
-1 Error
|
||||||
|
0 Found
|
||||||
|
1 Not found
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int rtree_find_next(MI_INFO *info, uint keynr, uint search_flag)
|
int rtree_find_next(MI_INFO *info, uint keynr, uint search_flag)
|
||||||
{
|
{
|
||||||
my_off_t root;
|
my_off_t root;
|
||||||
@@ -189,40 +215,30 @@ int rtree_find_next(MI_INFO *info, uint keynr, uint search_flag)
|
|||||||
MI_KEYDEF *keyinfo = info->s->keyinfo + keynr;
|
MI_KEYDEF *keyinfo = info->s->keyinfo + keynr;
|
||||||
|
|
||||||
if (info->update & HA_STATE_DELETED)
|
if (info->update & HA_STATE_DELETED)
|
||||||
{
|
|
||||||
return rtree_find_first(info, keynr, info->lastkey, info->lastkey_length,
|
return rtree_find_first(info, keynr, info->lastkey, info->lastkey_length,
|
||||||
search_flag);
|
search_flag);
|
||||||
}
|
|
||||||
|
|
||||||
if (!info->buff_used)
|
if (!info->buff_used)
|
||||||
{
|
{
|
||||||
uchar *key = info->int_keypos;
|
uchar *key= info->int_keypos;
|
||||||
|
|
||||||
while (key < info->int_maxpos)
|
while (key < info->int_maxpos)
|
||||||
{
|
{
|
||||||
if (!rtree_key_cmp(keyinfo->seg, info->lastkey2, key,
|
if (!rtree_key_cmp(keyinfo->seg, info->first_mbr_key, key,
|
||||||
info->last_rkey_length, search_flag))
|
info->last_rkey_length, search_flag))
|
||||||
{
|
{
|
||||||
uchar *after_key = key + keyinfo->keylength;
|
uchar *after_key = key + keyinfo->keylength;
|
||||||
|
|
||||||
info->lastpos = _mi_dpos(info, 0, after_key);
|
info->lastpos= _mi_dpos(info, 0, after_key);
|
||||||
memcpy(info->lastkey, key, info->lastkey_length);
|
memcpy(info->lastkey, key, info->lastkey_length);
|
||||||
|
|
||||||
if (after_key < info->int_maxpos)
|
if (after_key < info->int_maxpos)
|
||||||
{
|
info->int_keypos= after_key;
|
||||||
info->int_keypos = after_key;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
info->buff_used= 1;
|
||||||
info->buff_used = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
key+= keyinfo->keylength;
|
||||||
{
|
|
||||||
key += keyinfo->keylength;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR)
|
if ((root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR)
|
||||||
@@ -236,14 +252,19 @@ int rtree_find_next(MI_INFO *info, uint keynr, uint search_flag)
|
|||||||
return rtree_find_req(info, keyinfo, search_flag, nod_cmp_flag, root, 0);
|
return rtree_find_req(info, keyinfo, search_flag, nod_cmp_flag, root, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get next key in r-tree recursively
|
Get next key in r-tree recursively
|
||||||
Used in rtree_get_first() and rtree_get_next()
|
|
||||||
Result values:
|
NOTES
|
||||||
-1 - error
|
Used in rtree_get_first() and rtree_get_next()
|
||||||
0 - found
|
|
||||||
1 - not found
|
RETURN
|
||||||
|
-1 Error
|
||||||
|
0 Found
|
||||||
|
1 Not found
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int rtree_get_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint key_length,
|
static int rtree_get_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint key_length,
|
||||||
my_off_t page, int level)
|
my_off_t page, int level)
|
||||||
{
|
{
|
||||||
@@ -339,13 +360,16 @@ err1:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get first key in r-tree
|
Get first key in r-tree
|
||||||
Result values:
|
|
||||||
-1 - error
|
RETURN
|
||||||
0 - found
|
-1 Error
|
||||||
1 - not found
|
0 Found
|
||||||
|
1 Not found
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int rtree_get_first(MI_INFO *info, uint keynr, uint key_length)
|
int rtree_get_first(MI_INFO *info, uint keynr, uint key_length)
|
||||||
{
|
{
|
||||||
my_off_t root;
|
my_off_t root;
|
||||||
@@ -363,12 +387,16 @@ int rtree_get_first(MI_INFO *info, uint keynr, uint key_length)
|
|||||||
return rtree_get_req(info, &keyinfo[keynr], key_length, root, 0);
|
return rtree_get_req(info, &keyinfo[keynr], key_length, root, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get next key in r-tree
|
|
||||||
Result values:
|
/*
|
||||||
-1 - error
|
Get next key in r-tree
|
||||||
0 - found
|
|
||||||
1 - not found
|
RETURN
|
||||||
|
-1 Error
|
||||||
|
0 Found
|
||||||
|
1 Not found
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int rtree_get_next(MI_INFO *info, uint keynr, uint key_length)
|
int rtree_get_next(MI_INFO *info, uint keynr, uint key_length)
|
||||||
{
|
{
|
||||||
my_off_t root;
|
my_off_t root;
|
||||||
@@ -407,13 +435,16 @@ int rtree_get_next(MI_INFO *info, uint keynr, uint key_length)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Go down and insert key into tree
|
Go down and insert key into tree
|
||||||
Result values:
|
|
||||||
-1 - error
|
RETURN
|
||||||
0 - child was not split
|
-1 Error
|
||||||
1 - child was split
|
0 Child was not split
|
||||||
|
1 Child was split
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int rtree_insert_req(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
|
static int rtree_insert_req(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
|
||||||
uint key_length, my_off_t page, my_off_t *new_page,
|
uint key_length, my_off_t page, my_off_t *new_page,
|
||||||
int ins_level, int level)
|
int ins_level, int level)
|
||||||
@@ -490,13 +521,16 @@ err1:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Insert key into the tree
|
Insert key into the tree
|
||||||
Result values:
|
|
||||||
-1 - error
|
RETURN
|
||||||
0 - root was not split
|
-1 Error
|
||||||
1 - root was split
|
0 Root was not split
|
||||||
|
1 Root was split
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int rtree_insert_level(MI_INFO *info, uint keynr, uchar *key,
|
static int rtree_insert_level(MI_INFO *info, uint keynr, uchar *key,
|
||||||
uint key_length, int ins_level)
|
uint key_length, int ins_level)
|
||||||
{
|
{
|
||||||
@@ -580,20 +614,29 @@ err1:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Insert key into the tree - interface function
|
Insert key into the tree - interface function
|
||||||
Result values:
|
|
||||||
-1 - error
|
RETURN
|
||||||
0 - OK
|
-1 Error
|
||||||
|
0 OK
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int rtree_insert(MI_INFO *info, uint keynr, uchar *key, uint key_length)
|
int rtree_insert(MI_INFO *info, uint keynr, uchar *key, uint key_length)
|
||||||
{
|
{
|
||||||
return (rtree_insert_level(info, keynr, key, key_length, -1) == -1) ? -1 : 0;
|
return (rtree_insert_level(info, keynr, key, key_length, -1) == -1) ? -1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Fill reinsert page buffer
|
Fill reinsert page buffer
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
-1 Error
|
||||||
|
0 OK
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int rtree_fill_reinsert_list(stPageList *ReinsertList, my_off_t page,
|
static int rtree_fill_reinsert_list(stPageList *ReinsertList, my_off_t page,
|
||||||
int level)
|
int level)
|
||||||
{
|
{
|
||||||
@@ -614,14 +657,17 @@ err1:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Go down and delete key from the tree
|
Go down and delete key from the tree
|
||||||
Result values:
|
|
||||||
-1 - error
|
RETURN
|
||||||
0 - deleted
|
-1 Error
|
||||||
1 - not found
|
0 Deleted
|
||||||
2 - empty leaf
|
1 Not found
|
||||||
|
2 Empty leaf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int rtree_delete_req(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
|
static int rtree_delete_req(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
|
||||||
uint key_length, my_off_t page, uint *page_size,
|
uint key_length, my_off_t page, uint *page_size,
|
||||||
stPageList *ReinsertList, int level)
|
stPageList *ReinsertList, int level)
|
||||||
@@ -740,12 +786,15 @@ err1:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Delete key - interface function
|
Delete key - interface function
|
||||||
Result values:
|
|
||||||
-1 - error
|
RETURN
|
||||||
0 - deleted
|
-1 Error
|
||||||
|
0 Deleted
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length)
|
int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length)
|
||||||
{
|
{
|
||||||
uint page_size;
|
uint page_size;
|
||||||
@@ -846,9 +895,14 @@ err1:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Estimate number of suitable keys in the tree
|
Estimate number of suitable keys in the tree
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
estimated value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ha_rows rtree_estimate(MI_INFO *info, uint keynr, uchar *key,
|
ha_rows rtree_estimate(MI_INFO *info, uint keynr, uchar *key,
|
||||||
uint key_length, uint flag)
|
uint key_length, uint flag)
|
||||||
{
|
{
|
||||||
|
@@ -326,7 +326,8 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key,
|
|||||||
cur2 = rt_PAGE_NEXT_KEY(cur2, key_length, nod_flag);
|
cur2 = rt_PAGE_NEXT_KEY(cur2, key_length, nod_flag);
|
||||||
++n2;
|
++n2;
|
||||||
}
|
}
|
||||||
memcpy(to - nod_flag, cur->key - nod_flag, full_length);
|
if (to != cur->key)
|
||||||
|
memcpy(to - nod_flag, cur->key - nod_flag, full_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
mi_putint(page, 2 + n1 * full_length, nod_flag);
|
mi_putint(page, 2 + n1 * full_length, nod_flag);
|
||||||
|
@@ -337,13 +337,23 @@ while test $# -gt 0; do
|
|||||||
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb"
|
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb"
|
||||||
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb"
|
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb"
|
||||||
;;
|
;;
|
||||||
--valgrind)
|
--valgrind | --valgrind-all)
|
||||||
VALGRIND="valgrind --alignment=8 --leak-check=yes --num-callers=16"
|
VALGRIND=`which valgrind` # this will print an error if not found
|
||||||
|
# Give good warning to the user and stop
|
||||||
|
if [ -z "$VALGRIND" ] ; then
|
||||||
|
$ECHO "You need to have the 'valgrind' program in your PATH to run mysql-test-run with option --valgrind. Valgrind's home page is http://developer.kde.org/~sewardj ."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
VALGRIND="$VALGRIND --alignment=8 --leak-check=yes --num-callers=16"
|
||||||
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc --skip-bdb"
|
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc --skip-bdb"
|
||||||
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc --skip-bdb"
|
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc --skip-bdb"
|
||||||
SLEEP_TIME_AFTER_RESTART=10
|
SLEEP_TIME_AFTER_RESTART=10
|
||||||
SLEEP_TIME_FOR_DELETE=60
|
SLEEP_TIME_FOR_DELETE=60
|
||||||
USE_RUNNING_SERVER=""
|
USE_RUNNING_SERVER=""
|
||||||
|
if test "$1" = "--valgrind-all"
|
||||||
|
then
|
||||||
|
VALGRIND="$VALGRIND -v --show-reachable=yes"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
--valgrind-options=*)
|
--valgrind-options=*)
|
||||||
TMP=`$ECHO "$1" | $SED -e "s;--valgrind-options=;;"`
|
TMP=`$ECHO "$1" | $SED -e "s;--valgrind-options=;;"`
|
||||||
@@ -394,7 +404,7 @@ SLAVE_MYLOG="$MYSQL_TEST_DIR/var/log/slave.log"
|
|||||||
SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/slave.err"
|
SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/slave.err"
|
||||||
|
|
||||||
CURRENT_TEST="$MYSQL_TEST_DIR/var/log/current_test"
|
CURRENT_TEST="$MYSQL_TEST_DIR/var/log/current_test"
|
||||||
SMALL_SERVER="-O key_buffer_size=1M -O sort_buffer=256K -O max_heap_table_size=1M"
|
SMALL_SERVER="--key_buffer_size=1M --sort_buffer=256K --max_heap_table_size=1M"
|
||||||
|
|
||||||
export MASTER_MYPORT
|
export MASTER_MYPORT
|
||||||
export SLAVE_MYPORT
|
export SLAVE_MYPORT
|
||||||
@@ -795,13 +805,13 @@ manager_launch()
|
|||||||
ident=$1
|
ident=$1
|
||||||
shift
|
shift
|
||||||
if [ $USE_MANAGER = 0 ] ; then
|
if [ $USE_MANAGER = 0 ] ; then
|
||||||
$@ >> $CUR_MYERR 2>&1 &
|
$@ >> $CUR_MYERR 2>&1 &
|
||||||
sleep 2 #hack
|
sleep 2 #hack
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
$MYSQL_MANAGER_CLIENT $MANAGER_QUIET_OPT --user=$MYSQL_MANAGER_USER \
|
$MYSQL_MANAGER_CLIENT $MANAGER_QUIET_OPT --user=$MYSQL_MANAGER_USER \
|
||||||
--password=$MYSQL_MANAGER_PW --port=$MYSQL_MANAGER_PORT <<EOF
|
--password=$MYSQL_MANAGER_PW --port=$MYSQL_MANAGER_PORT <<EOF
|
||||||
def_exec $ident $@
|
def_exec $ident "$@"
|
||||||
set_exec_stdout $ident $CUR_MYERR
|
set_exec_stdout $ident $CUR_MYERR
|
||||||
set_exec_stderr $ident $CUR_MYERR
|
set_exec_stderr $ident $CUR_MYERR
|
||||||
set_exec_con $ident root localhost $CUR_MYSOCK
|
set_exec_con $ident root localhost $CUR_MYSOCK
|
||||||
@@ -1163,7 +1173,7 @@ run_testcase ()
|
|||||||
echo $tname > $CURRENT_TEST
|
echo $tname > $CURRENT_TEST
|
||||||
SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0`
|
SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0`
|
||||||
if [ $USE_MANAGER = 1 ] ; then
|
if [ $USE_MANAGER = 1 ] ; then
|
||||||
many_slaves=`$EXPR \( $tname : rpl_failsafe \) != 0`
|
many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$SKIP_TEST" ] ; then
|
if [ -n "$SKIP_TEST" ] ; then
|
||||||
|
@@ -112,6 +112,11 @@ insert into t1 set i = null;
|
|||||||
select last_insert_id();
|
select last_insert_id();
|
||||||
last_insert_id()
|
last_insert_id()
|
||||||
255
|
255
|
||||||
|
explain extended select last_insert_id();
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority no_cache 255 AS `last_insert_id()`
|
||||||
insert into t1 set i = 254;
|
insert into t1 set i = 254;
|
||||||
ERROR 23000: Duplicate entry '254' for key 1
|
ERROR 23000: Duplicate entry '254' for key 1
|
||||||
select last_insert_id();
|
select last_insert_id();
|
||||||
|
@@ -3,4 +3,9 @@ create table t1(n int not null, key(n)) delay_key_write = 1;
|
|||||||
select count(distinct n) from t1;
|
select count(distinct n) from t1;
|
||||||
count(distinct n)
|
count(distinct n)
|
||||||
100
|
100
|
||||||
|
explain extended select count(distinct n) from t1;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 index NULL n 4 NULL 200 Using index
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority count(distinct test.t1.n) AS `count(distinct n)` from test.t1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@@ -23,6 +23,11 @@ false
|
|||||||
select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
|
select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
|
||||||
CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END
|
CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END
|
||||||
one
|
one
|
||||||
|
explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority (case 1 when 1 then _latin1'one' when 2 then _latin1'two' else _latin1'more' end) AS `CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END`
|
||||||
select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END;
|
select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END;
|
||||||
CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END
|
CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END
|
||||||
two
|
two
|
||||||
@@ -57,6 +62,11 @@ fcase count(*)
|
|||||||
0 2
|
0 2
|
||||||
2 1
|
2 1
|
||||||
3 1
|
3 1
|
||||||
|
explain extended select case a when 1 then 2 when 2 then 3 else 0 end as fcase, count(*) from t1 group by fcase;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority (case test.t1.a when 1 then 2 when 2 then 3 else 0 end) AS `fcase`,count(0) AS `count(*)` from test.t1 group by (case test.t1.a when 1 then 2 when 2 then 3 else 0 end)
|
||||||
select case a when 1 then "one" when 2 then "two" else "nothing" end as fcase, count(*) from t1 group by fcase;
|
select case a when 1 then "one" when 2 then "two" else "nothing" end as fcase, count(*) from t1 group by fcase;
|
||||||
fcase count(*)
|
fcase count(*)
|
||||||
nothing 2
|
nothing 2
|
||||||
@@ -122,6 +132,14 @@ CREATE TABLE t1 SELECT
|
|||||||
COALESCE(1), COALESCE(1.0),COALESCE('a'),
|
COALESCE(1), COALESCE(1.0),COALESCE('a'),
|
||||||
COALESCE(1,1.0), COALESCE(1,'1'),COALESCE(1.1,'1'),
|
COALESCE(1,1.0), COALESCE(1,'1'),COALESCE(1.1,'1'),
|
||||||
COALESCE('a' COLLATE latin1_bin,'b');
|
COALESCE('a' COLLATE latin1_bin,'b');
|
||||||
|
explain extended SELECT
|
||||||
|
COALESCE(1), COALESCE(1.0),COALESCE('a'),
|
||||||
|
COALESCE(1,1.0), COALESCE(1,'1'),COALESCE(1.1,'1'),
|
||||||
|
COALESCE('a' COLLATE latin1_bin,'b');
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,coalesce(_latin1'a') AS `COALESCE('a')`,coalesce(1,1.0) AS `COALESCE(1,1.0)`,coalesce(1,_latin1'1') AS `COALESCE(1,'1')`,coalesce(1.1,_latin1'1') AS `COALESCE(1.1,'1')`,coalesce((_latin1'a' collate _latin1'latin1_bin'),_latin1'b') AS `COALESCE('a' COLLATE latin1_bin,'b')`
|
||||||
SHOW CREATE TABLE t1;
|
SHOW CREATE TABLE t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
t1 CREATE TABLE `t1` (
|
t1 CREATE TABLE `t1` (
|
||||||
|
@@ -16,6 +16,11 @@ cast(-5 as unsigned) -1 cast(-5 as unsigned) + 1
|
|||||||
select ~5, cast(~5 as signed);
|
select ~5, cast(~5 as signed);
|
||||||
~5 cast(~5 as signed)
|
~5 cast(~5 as signed)
|
||||||
18446744073709551610 -6
|
18446744073709551610 -6
|
||||||
|
explain extended select ~5, cast(~5 as signed);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority ~(5) AS `~5`,cast(~(5) as signed) AS `cast(~5 as signed)`
|
||||||
select cast(5 as unsigned) -6.0;
|
select cast(5 as unsigned) -6.0;
|
||||||
cast(5 as unsigned) -6.0
|
cast(5 as unsigned) -6.0
|
||||||
-1.0
|
-1.0
|
||||||
|
@@ -521,6 +521,11 @@ character_set_client latin1
|
|||||||
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
|
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
|
||||||
charset('a') collation('a') coercibility('a') 'a'='A'
|
charset('a') collation('a') coercibility('a') 'a'='A'
|
||||||
latin1 latin1_swedish_ci 3 1
|
latin1 latin1_swedish_ci 3 1
|
||||||
|
explain extended SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority charset(_latin1'a') AS `charset('a')`,collation(_latin1'a') AS `collation('a')`,coercibility(_latin1'a') AS `coercibility('a')`,(_latin1'a' = _latin1'A') AS `'a'='A'`
|
||||||
SET CHARACTER SET koi8r;
|
SET CHARACTER SET koi8r;
|
||||||
SHOW VARIABLES LIKE 'collation_client';
|
SHOW VARIABLES LIKE 'collation_client';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
|
@@ -219,6 +219,13 @@ a
|
|||||||
test
|
test
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (word varchar(255) not null, word2 varchar(255) not null, index(word));
|
create table t1 (word varchar(255) not null, word2 varchar(255) not null, index(word));
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`word` varchar(255) collate latin1_german2_ci NOT NULL default '',
|
||||||
|
`word2` varchar(255) collate latin1_german2_ci NOT NULL default '',
|
||||||
|
KEY `word` (`word`)
|
||||||
|
) TYPE=MyISAM CHARSET=latin1 COLLATE=latin1_german2_ci
|
||||||
insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae');
|
insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae');
|
||||||
update t1 set word2=word;
|
update t1 set word2=word;
|
||||||
select word, word=binary 0xdf as t from t1 having t > 0;
|
select word, word=binary 0xdf as t from t1 having t > 0;
|
||||||
@@ -273,6 +280,11 @@ drop table t1;
|
|||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci
|
s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci
|
||||||
);
|
);
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`s1` char(5) collate latin1_german2_ci default NULL
|
||||||
|
) TYPE=MyISAM CHARSET=latin1 COLLATE=latin1_german2_ci
|
||||||
INSERT INTO t1 VALUES ('<27>');
|
INSERT INTO t1 VALUES ('<27>');
|
||||||
INSERT INTO t1 VALUES ('ue');
|
INSERT INTO t1 VALUES ('ue');
|
||||||
SELECT DISTINCT s1 FROM t1;
|
SELECT DISTINCT s1 FROM t1;
|
||||||
|
@@ -340,6 +340,129 @@ CYR CAPIT SOFT SIGN
|
|||||||
CYR CAPIT E <09> <09>
|
CYR CAPIT E <09> <09>
|
||||||
CYR CAPIT YU <09> <09>
|
CYR CAPIT YU <09> <09>
|
||||||
CYR CAPIT YA <09> <09>
|
CYR CAPIT YA <09> <09>
|
||||||
|
select CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci'), comment from t1;
|
||||||
|
CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci') comment
|
||||||
|
a LAT SMALL A
|
||||||
|
b LAT SMALL B
|
||||||
|
c LAT SMALL C
|
||||||
|
d LAT SMALL D
|
||||||
|
e LAT SMALL E
|
||||||
|
f LAT SMALL F
|
||||||
|
g LAT SMALL G
|
||||||
|
h LAT SMALL H
|
||||||
|
i LAT SMALL I
|
||||||
|
j LAT SMALL J
|
||||||
|
k LAT SMALL K
|
||||||
|
l LAT SMALL L
|
||||||
|
m LAT SMALL M
|
||||||
|
n LAT SMALL N
|
||||||
|
o LAT SMALL O
|
||||||
|
p LAT SMALL P
|
||||||
|
q LAT SMALL Q
|
||||||
|
r LAT SMALL R
|
||||||
|
s LAT SMALL S
|
||||||
|
t LAT SMALL T
|
||||||
|
u LAT SMALL U
|
||||||
|
v LAT SMALL V
|
||||||
|
w LAT SMALL W
|
||||||
|
x LAT SMALL X
|
||||||
|
y LAT SMALL Y
|
||||||
|
z LAT SMALL Z
|
||||||
|
A LAT CAPIT A
|
||||||
|
B LAT CAPIT B
|
||||||
|
C LAT CAPIT C
|
||||||
|
D LAT CAPIT D
|
||||||
|
E LAT CAPIT E
|
||||||
|
F LAT CAPIT F
|
||||||
|
G LAT CAPIT G
|
||||||
|
H LAT CAPIT H
|
||||||
|
I LAT CAPIT I
|
||||||
|
J LAT CAPIT J
|
||||||
|
K LAT CAPIT K
|
||||||
|
L LAT CAPIT L
|
||||||
|
M LAT CAPIT M
|
||||||
|
N LAT CAPIT N
|
||||||
|
O LAT CAPIT O
|
||||||
|
P LAT CAPIT P
|
||||||
|
Q LAT CAPIT Q
|
||||||
|
R LAT CAPIT R
|
||||||
|
S LAT CAPIT S
|
||||||
|
T LAT CAPIT T
|
||||||
|
U LAT CAPIT U
|
||||||
|
V LAT CAPIT V
|
||||||
|
W LAT CAPIT W
|
||||||
|
X LAT CAPIT X
|
||||||
|
Y LAT CAPIT Y
|
||||||
|
Z LAT CAPIT Z
|
||||||
|
<EFBFBD> CYR SMALL A
|
||||||
|
<EFBFBD> CYR SMALL BE
|
||||||
|
<EFBFBD> CYR SMALL VE
|
||||||
|
<EFBFBD> CYR SMALL GE
|
||||||
|
<EFBFBD> CYR SMALL DE
|
||||||
|
<EFBFBD> CYR SMALL IE
|
||||||
|
? CYR SMALL IO
|
||||||
|
<EFBFBD> CYR SMALL ZHE
|
||||||
|
<EFBFBD> CYR SMALL ZE
|
||||||
|
<EFBFBD> CYR SMALL I
|
||||||
|
<EFBFBD> CYR SMALL KA
|
||||||
|
<EFBFBD> CYR SMALL EL
|
||||||
|
<EFBFBD> CYR SMALL EM
|
||||||
|
<EFBFBD> CYR SMALL EN
|
||||||
|
<EFBFBD> CYR SMALL O
|
||||||
|
<EFBFBD> CYR SMALL PE
|
||||||
|
<EFBFBD> CYR SMALL ER
|
||||||
|
<EFBFBD> CYR SMALL ES
|
||||||
|
<EFBFBD> CYR SMALL TE
|
||||||
|
<EFBFBD> CYR SMALL U
|
||||||
|
<EFBFBD> CYR SMALL EF
|
||||||
|
<EFBFBD> CYR SMALL HA
|
||||||
|
<EFBFBD> CYR SMALL TSE
|
||||||
|
<EFBFBD> CYR SMALL CHE
|
||||||
|
<EFBFBD> CYR SMALL SHA
|
||||||
|
<EFBFBD> CYR SMALL SCHA
|
||||||
|
<EFBFBD> CYR SMALL HARD SIGN
|
||||||
|
<EFBFBD> CYR SMALL YERU
|
||||||
|
<EFBFBD> CYR SMALL SOFT SIGN
|
||||||
|
<EFBFBD> CYR SMALL E
|
||||||
|
<EFBFBD> CYR SMALL YU
|
||||||
|
<EFBFBD> CYR SMALL YA
|
||||||
|
<EFBFBD> CYR CAPIT A
|
||||||
|
<EFBFBD> CYR CAPIT BE
|
||||||
|
<EFBFBD> CYR CAPIT VE
|
||||||
|
<EFBFBD> CYR CAPIT GE
|
||||||
|
<EFBFBD> CYR CAPIT DE
|
||||||
|
<EFBFBD> CYR CAPIT IE
|
||||||
|
? CYR CAPIT IO
|
||||||
|
<EFBFBD> CYR CAPIT ZHE
|
||||||
|
<EFBFBD> CYR CAPIT ZE
|
||||||
|
<EFBFBD> CYR CAPIT I
|
||||||
|
<EFBFBD> CYR CAPIT KA
|
||||||
|
<EFBFBD> CYR CAPIT EL
|
||||||
|
<EFBFBD> CYR CAPIT EM
|
||||||
|
<EFBFBD> CYR CAPIT EN
|
||||||
|
<EFBFBD> CYR CAPIT O
|
||||||
|
<EFBFBD> CYR CAPIT PE
|
||||||
|
<EFBFBD> CYR CAPIT ER
|
||||||
|
<EFBFBD> CYR CAPIT ES
|
||||||
|
<EFBFBD> CYR CAPIT TE
|
||||||
|
<EFBFBD> CYR CAPIT U
|
||||||
|
<EFBFBD> CYR CAPIT EF
|
||||||
|
<EFBFBD> CYR CAPIT HA
|
||||||
|
<EFBFBD> CYR CAPIT TSE
|
||||||
|
<EFBFBD> CYR CAPIT CHE
|
||||||
|
<EFBFBD> CYR CAPIT SHA
|
||||||
|
<EFBFBD> CYR CAPIT SCHA
|
||||||
|
<EFBFBD> CYR CAPIT HARD SIGN
|
||||||
|
<EFBFBD> CYR CAPIT YERU
|
||||||
|
<EFBFBD> CYR CAPIT SOFT SIGN
|
||||||
|
<EFBFBD> CYR CAPIT E
|
||||||
|
<EFBFBD> CYR CAPIT YU
|
||||||
|
<EFBFBD> CYR CAPIT YA
|
||||||
|
explain extended select CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci'), comment from t1;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 116
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority convert(test.t1.koi8_ru_f,_latin1'utf8_general_ci',_latin1'cp1251_general_ci') AS `CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci')`,test.t1.comment AS `comment` from test.t1
|
||||||
ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL;
|
ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL;
|
||||||
UPDATE t1 SET bin_f=koi8_ru_f;
|
UPDATE t1 SET bin_f=koi8_ru_f;
|
||||||
SELECT COUNT(DISTINCT bin_f),COUNT(DISTINCT koi8_ru_f),COUNT(DISTINCT utf8_f) FROM t1;
|
SELECT COUNT(DISTINCT bin_f),COUNT(DISTINCT koi8_ru_f),COUNT(DISTINCT utf8_f) FROM t1;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
SET CHARACTER SET koi8r;
|
SET CHARACTER SET koi8r;
|
||||||
DROP TABLE IF EXISTS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
DROP TABLE IF EXISTS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, t1;
|
||||||
SET CHARACTER SET koi8r;
|
SET CHARACTER SET koi8r;
|
||||||
CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp1251) SELECT _koi8r'<27><><EFBFBD><EFBFBD><EFBFBD>' AS a;
|
CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp1251) SELECT _koi8r'<27><><EFBFBD><EFBFBD><EFBFBD>' AS a;
|
||||||
SHOW CREATE TABLE t1;
|
SHOW CREATE TABLE t1;
|
||||||
@@ -14,7 +14,7 @@ SELECT HEX(a) FROM t1;
|
|||||||
HEX(a)
|
HEX(a)
|
||||||
EFF0EEE1E0
|
EFF0EEE1E0
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
CREATE TABLE `<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>`
|
||||||
(
|
(
|
||||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"
|
||||||
) COMMENT "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
) COMMENT "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||||
|
@@ -47,6 +47,9 @@ locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2 collate utf8_bin)
|
|||||||
select locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2 collate utf8_bin);
|
select locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2 collate utf8_bin);
|
||||||
locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2 collate utf8_bin)
|
locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2 collate utf8_bin)
|
||||||
0
|
0
|
||||||
|
select length(_utf8 0xD0B1), bit_length(_utf8 0xD0B1), char_length(_utf8 0xD0B1);
|
||||||
|
length(_utf8 0xD0B1) bit_length(_utf8 0xD0B1) char_length(_utf8 0xD0B1)
|
||||||
|
2 16 1
|
||||||
select 'a' like 'a';
|
select 'a' like 'a';
|
||||||
'a' like 'a'
|
'a' like 'a'
|
||||||
1
|
1
|
||||||
|
@@ -1,151 +1,315 @@
|
|||||||
|
drop table if exists t1;
|
||||||
|
Warnings:
|
||||||
|
Note 1051 Unknown table 't1'
|
||||||
SHOW GLOBAL VARIABLES LIKE "%_format%";
|
SHOW GLOBAL VARIABLES LIKE "%_format%";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
date_format %d.%m.%Y
|
date_format %d.%m.%Y
|
||||||
datetime_format %Y/%d/%m-%H:%i:%s
|
datetime_format %Y-%m-%d %H:%i:%s
|
||||||
default_week_format 0
|
default_week_format 0
|
||||||
time_format %H.%i.%s
|
time_format %H.%i.%s
|
||||||
SHOW SESSION VARIABLES LIKE "%_format%";
|
SHOW SESSION VARIABLES LIKE "%_format%";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
date_format %d.%m.%Y
|
date_format %d.%m.%Y
|
||||||
datetime_format %Y/%d/%m-%H:%i:%s
|
datetime_format %Y-%m-%d %H:%i:%s
|
||||||
default_week_format 0
|
default_week_format 0
|
||||||
time_format %H.%i.%s
|
time_format %H.%i.%s
|
||||||
SET date_format="%d.%m.%Y";
|
SET time_format='%H%i%s';
|
||||||
select CAST("01.01.2001" as DATE) as a;
|
SET time_format='%H:%i:%s.%f';
|
||||||
a
|
SET time_format='%h-%i-%s.%f%p';
|
||||||
01.01.2001
|
SET time_format='%h:%i:%s.%f %p';
|
||||||
SET datetime_format="%d.%m.%Y %H.%i.%s";
|
SET time_format='%h:%i:%s%p';
|
||||||
select CAST("01.01.2001 05.12.06" as DATETIME) as a;
|
SET date_format='%Y%m%d';
|
||||||
a
|
SET date_format='%Y.%m.%d';
|
||||||
01.01.2001 05.12.06
|
SET date_format='%d.%m.%Y';
|
||||||
SET time_format="%H.%i.%s";
|
SET date_format='%m-%d-%Y';
|
||||||
select CAST("05.12.06" as TIME) as a;
|
set datetime_format= '%Y%m%d%H%i%s';
|
||||||
a
|
set datetime_format= '%Y-%m-%d %H:%i:%s';
|
||||||
05.12.06
|
set datetime_format= '%m-%d-%y %H:%i:%s.%f';
|
||||||
SET datetime_format="%d.%m.%Y %h:%i:%s %p";
|
set datetime_format= '%d-%m-%Y %h:%i:%s%p';
|
||||||
select CAST("01.01.2001 05:12:06AM" as DATETIME) as a;
|
set datetime_format= '%H:%i:%s %Y-%m-%d';
|
||||||
a
|
set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
|
||||||
01.01.2001 05:12:06 AM
|
set datetime_format= '%h:%i:%s %p %Y-%m-%d';
|
||||||
select CAST("01.01.2001 05:12:06 PM" as DATETIME) as a;
|
set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
|
||||||
a
|
SHOW SESSION VARIABLES LIKE "%format";
|
||||||
01.01.2001 05:12:06 PM
|
Variable_name Value
|
||||||
SET time_format="%h:%i:%s %p";
|
date_format %m-%d-%Y
|
||||||
select CAST("05:12:06 AM" as TIME) as a;
|
datetime_format %h:%i:%s.%f %p %Y-%m-%d
|
||||||
a
|
default_week_format 0
|
||||||
05:12:06 AM
|
time_format %h:%i:%s%p
|
||||||
select CAST("05:12:06.1234PM" as TIME) as a;
|
SET time_format='%h:%i:%s';
|
||||||
a
|
ERROR 42000: Variable 'time_format' can't be set to the value of '%h:%i:%s'
|
||||||
05:12:06.001234 PM
|
SET time_format='%H %i:%s';
|
||||||
SET time_format="%h.%i.%s %p";
|
ERROR 42000: Variable 'time_format' can't be set to the value of '%H %i:%s'
|
||||||
SET date_format='%d.%m.%y';
|
SET time_format='%H::%i:%s';
|
||||||
SET datetime_format="%d.%m.%y %h.%i.%s %p";
|
ERROR 42000: Variable 'time_format' can't be set to the value of '%H::%i:%s'
|
||||||
select CAST("12-12-06" as DATE) as a;
|
SET time_format='%H:%i:%s%f';
|
||||||
a
|
ERROR 42000: Variable 'time_format' can't be set to the value of '%H:%i:%s%f'
|
||||||
12.12.06
|
SET time_format='%H:%i.%f:%s';
|
||||||
select adddate("01.01.97 11.59.59.000001 PM", 10);
|
ERROR 42000: Variable 'time_format' can't be set to the value of '%H:%i.%f:%s'
|
||||||
adddate("01.01.97 11.59.59.000001 PM", 10)
|
SET time_format='%H:%i:%s%p';
|
||||||
11.01.97 11.59.59.000001 PM
|
ERROR 42000: Variable 'time_format' can't be set to the value of '%H:%i:%s%p'
|
||||||
select datediff("31.12.97 11.59:59.000001 PM","01.01.98");
|
SET time_format='%h:%i:%s.%f %p %Y-%m-%d';
|
||||||
datediff("31.12.97 11.59:59.000001 PM","01.01.98")
|
ERROR 42000: Variable 'time_format' can't be set to the value of '%h:%i:%s.%f %p %Y-%m-%d'
|
||||||
-1
|
SET time_format='%H%i%s.%f';
|
||||||
select weekofyear("31.11.97 11:59:59.000001 PM");
|
ERROR 42000: Variable 'time_format' can't be set to the value of '%H%i%s.%f'
|
||||||
weekofyear("31.11.97 11:59:59.000001 PM")
|
SET time_format='%H:%i-%s.%f';
|
||||||
49
|
ERROR 42000: Variable 'time_format' can't be set to the value of '%H:%i-%s.%f'
|
||||||
select makedate(1997,1);
|
|
||||||
makedate(1997,1)
|
|
||||||
01.01.97
|
|
||||||
select addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002");
|
|
||||||
addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")
|
|
||||||
02.01.98 01.01.01.000001 AM
|
|
||||||
select maketime(23,11,12);
|
|
||||||
maketime(23,11,12)
|
|
||||||
11.11.12 PM
|
|
||||||
select timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM");
|
|
||||||
timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM")
|
|
||||||
8795.59.59.999999 PM
|
|
||||||
SET time_format="%H%i%s";
|
|
||||||
SET time_format="%h%i%s";
|
|
||||||
ERROR HY000: Unknown error
|
|
||||||
SET date_format='%d.%m.%d';
|
SET date_format='%d.%m.%d';
|
||||||
ERROR HY000: Unknown error
|
ERROR 42000: Variable 'date_format' can't be set to the value of '%d.%m.%d'
|
||||||
SET datetime_format="%d.%m.%y %h.%i.%s";
|
SET datetime_format='%h.%m.%y %d.%i.%s';
|
||||||
ERROR HY000: Unknown error
|
ERROR 42000: Variable 'datetime_format' can't be set to the value of '%h.%m.%y %d.%i.%s'
|
||||||
SET GLOBAL date_format=default;
|
set datetime_format= '%H:%i:%s.%f %p %Y-%m-%d';
|
||||||
SHOW GLOBAL VARIABLES LIKE "date_format%";
|
ERROR 42000: Variable 'datetime_format' can't be set to the value of '%H:%i:%s.%f %p %Y-%m-%d'
|
||||||
Variable_name Value
|
set GLOBAL datetime_format= '%H:%i:%s %Y-%m-%d';
|
||||||
date_format %d.%m.%Y
|
SET SESSION datetime_format=default;
|
||||||
SET GLOBAL time_format=default;
|
select @@global.datetime_format, @@session.datetime_format;
|
||||||
SHOW GLOBAL VARIABLES LIKE "time_format%";
|
@@global.datetime_format @@session.datetime_format
|
||||||
Variable_name Value
|
%H:%i:%s %Y-%m-%d %H:%i:%s %Y-%m-%d
|
||||||
time_format %H.%i.%s
|
SET GLOBAL datetime_format=default;
|
||||||
|
SET SESSION datetime_format=default;
|
||||||
|
select @@global.datetime_format, @@session.datetime_format;
|
||||||
|
@@global.datetime_format @@session.datetime_format
|
||||||
|
%Y-%m-%d %H:%i:%s %Y-%m-%d %H:%i:%s
|
||||||
|
SET GLOBAL date_format=default;
|
||||||
|
SET GLOBAL time_format=default;
|
||||||
SET GLOBAL datetime_format=default;
|
SET GLOBAL datetime_format=default;
|
||||||
SHOW GLOBAL VARIABLES LIKE "datetime_format%";
|
|
||||||
Variable_name Value
|
|
||||||
datetime_format %Y/%d/%m-%H:%i:%s
|
|
||||||
SET date_format=default;
|
|
||||||
SHOW SESSION VARIABLES LIKE "date_format%";
|
|
||||||
Variable_name Value
|
|
||||||
date_format %d.%m.%Y
|
|
||||||
SET time_format=default;
|
SET time_format=default;
|
||||||
SHOW SESSION VARIABLES LIKE "time_format%";
|
SET date_format=default;
|
||||||
Variable_name Value
|
|
||||||
time_format %H.%i.%s
|
|
||||||
SET datetime_format=default;
|
SET datetime_format=default;
|
||||||
SHOW SESSION VARIABLES LIKE "datetime_format%";
|
select str_to_date(concat('15-01-2001',' 2:59:58.999'),
|
||||||
Variable_name Value
|
concat('%d-%m-%Y',' ','%H:%i:%s.%f'));
|
||||||
datetime_format %Y/%d/%m-%H:%i:%s
|
str_to_date(concat('15-01-2001',' 2:59:58.999'),
|
||||||
SET time_format='%i:%s:%H';
|
concat('%d-%m-%Y',' ','%H:%i:%s.%f'))
|
||||||
select cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME);
|
2001-01-15 02:59:58.000999
|
||||||
cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME)
|
create table t1 (date char(30), format char(30) not null);
|
||||||
59:59:12
|
insert into t1 values
|
||||||
SET GLOBAL date_format='%Y-%m-%d';
|
('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
|
||||||
SET GLOBAL time_format='%H:%i:%s';
|
('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S'),
|
||||||
SET GLOBAL datetime_format='%Y-%m-%d %H:%i:%s';
|
('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'),
|
||||||
SET date_format='%Y-%m-%d';
|
('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'),
|
||||||
SET time_format='%H:%i:%s';
|
('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'),
|
||||||
SET datetime_format='%Y-%m-%d %H:%i:%s';
|
('2003-01-02 12:11:12.12345 am', '%Y-%m-%d %h:%i:%S.%f%p'),
|
||||||
select str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S");
|
('2003-01-02 11:11:12Pm', '%Y-%m-%d %h:%i:%S%p'),
|
||||||
str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S")
|
('10:20:10', '%H:%i:%s'),
|
||||||
2001-01-15 12:59:59
|
('10:20:10', '%h:%i:%s.%f'),
|
||||||
select str_to_date("15 September 2001", "%d %M %Y");
|
('10:20:10AM', '%h:%i:%s%p'),
|
||||||
str_to_date("15 September 2001", "%d %M %Y")
|
('10:20:10.44AM', '%h:%i:%s.%f%p'),
|
||||||
2001-09-15 00:00:00
|
('15-01-2001 12:59:58', '%d-%m-%Y %H:%i:%S'),
|
||||||
select str_to_date("15 Septembeb 2001", "%d %M %Y");
|
('15 September 2001', '%d %M %Y'),
|
||||||
str_to_date("15 Septembeb 2001", "%d %M %Y")
|
('15 SEPTEMB 2001', '%d %M %Y'),
|
||||||
NULL
|
('15 MAY 2001', '%d %b %Y'),
|
||||||
select str_to_date("15 MAY 2001", "%d %b %Y");
|
('Sunday 15 MAY 2001', '%W %d %b %Y'),
|
||||||
str_to_date("15 MAY 2001", "%d %b %Y")
|
('Sund 15 MAY 2001', '%W %d %b %Y'),
|
||||||
2001-05-15 00:00:00
|
('Tuesday 00 2002', '%W %U %Y'),
|
||||||
select str_to_date("Sunday 15 MAY 2001", "%W %d %b %Y");
|
('Thursday 53 1998', '%W %u %Y'),
|
||||||
str_to_date("Sunday 15 MAY 2001", "%W %d %b %Y")
|
('15-01-2001', '%d-%m-%Y %H:%i:%S'),
|
||||||
2001-05-15 00:00:00
|
('15-01-20', '%d-%m-%y'),
|
||||||
select str_to_date("Sundai 15 MAY 2001", "%W %d %b %Y");
|
('15-2001-1', '%d-%Y-%c');
|
||||||
str_to_date("Sundai 15 MAY 2001", "%W %d %b %Y")
|
select date,format,str_to_date(date, format) as str_to_date from t1;
|
||||||
NULL
|
date format str_to_date
|
||||||
select str_to_date("Sundai 15 MA", "%W %d %b %Y");
|
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
|
||||||
str_to_date("Sundai 15 MA", "%W %d %b %Y")
|
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S 2003-01-02 08:11:02
|
||||||
NULL
|
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
||||||
select str_to_date("Tuesday 52 2001", "%W %V %X");
|
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.012345
|
||||||
str_to_date("Tuesday 52 2001", "%W %V %X")
|
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.012345
|
||||||
NULL
|
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.012345
|
||||||
select str_to_date("Sunday 01 2001", "%W %V %X");
|
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12
|
||||||
str_to_date("Sunday 01 2001", "%W %V %X")
|
10:20:10 %H:%i:%s 0000-00-00 10:20:10
|
||||||
NULL
|
10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10
|
||||||
select str_to_date("Tuesday 00 2002", "%W %U %Y");
|
10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10
|
||||||
str_to_date("Tuesday 00 2002", "%W %U %Y")
|
10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.000044
|
||||||
2002-01-01 00:00:00
|
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58
|
||||||
select str_to_date("Thursday 53 1998", "%W %u %Y");
|
15 September 2001 %d %M %Y 2001-09-15 00:00:00
|
||||||
str_to_date("Thursday 53 1998", "%W %u %Y")
|
15 SEPTEMB 2001 %d %M %Y 2001-01-15 00:00:00
|
||||||
1998-12-31 00:00:00
|
15 MAY 2001 %d %b %Y 2001-05-15 00:00:00
|
||||||
select str_to_date("15-01-2001", "%d-%m-%Y %H:%i:%S");
|
Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
|
||||||
str_to_date("15-01-2001", "%d-%m-%Y %H:%i:%S")
|
Sund 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
|
||||||
2001-01-15 00:00:00
|
Tuesday 00 2002 %W %U %Y 2002-01-01 00:00:00
|
||||||
select str_to_date("15-01-20", "%d-%m-%Y");
|
Thursday 53 1998 %W %u %Y 1998-12-31 00:00:00
|
||||||
str_to_date("15-01-20", "%d-%m-%Y")
|
15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00
|
||||||
NULL
|
15-01-20 %d-%m-%y 2020-01-15 00:00:00
|
||||||
select str_to_date("15-2001-1", "%d-%Y-%c");
|
15-2001-1 %d-%Y-%c 2001-01-15 00:00:00
|
||||||
str_to_date("15-2001-1", "%d-%Y-%c")
|
select date,format,concat('',str_to_date(date, format)) as con from t1;
|
||||||
2001-01-15 00:00:00
|
date format con
|
||||||
|
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
|
||||||
|
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S 2003-01-02 08:11:02
|
||||||
|
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
||||||
|
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.012345
|
||||||
|
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.012345
|
||||||
|
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.012345
|
||||||
|
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12
|
||||||
|
10:20:10 %H:%i:%s 0000-00-00 10:20:10
|
||||||
|
10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10
|
||||||
|
10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10
|
||||||
|
10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.000044
|
||||||
|
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58
|
||||||
|
15 September 2001 %d %M %Y 2001-09-15 00:00:00
|
||||||
|
15 SEPTEMB 2001 %d %M %Y 2001-01-15 00:00:00
|
||||||
|
15 MAY 2001 %d %b %Y 2001-05-15 00:00:00
|
||||||
|
Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
|
||||||
|
Sund 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
|
||||||
|
Tuesday 00 2002 %W %U %Y 2002-01-01 00:00:00
|
||||||
|
Thursday 53 1998 %W %u %Y 1998-12-31 00:00:00
|
||||||
|
15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00
|
||||||
|
15-01-20 %d-%m-%y 2020-01-15 00:00:00
|
||||||
|
15-2001-1 %d-%Y-%c 2001-01-15 00:00:00
|
||||||
|
select date,format,cast(str_to_date(date, format) as datetime) as datetime from t1;
|
||||||
|
date format datetime
|
||||||
|
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
|
||||||
|
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S 2003-01-02 08:11:02
|
||||||
|
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
||||||
|
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.012345
|
||||||
|
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.012345
|
||||||
|
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.012345
|
||||||
|
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12
|
||||||
|
10:20:10 %H:%i:%s 0000-00-00 10:20:10
|
||||||
|
10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10
|
||||||
|
10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10
|
||||||
|
10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.000044
|
||||||
|
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58
|
||||||
|
15 September 2001 %d %M %Y 2001-09-15 00:00:00
|
||||||
|
15 SEPTEMB 2001 %d %M %Y 2001-01-15 00:00:00
|
||||||
|
15 MAY 2001 %d %b %Y 2001-05-15 00:00:00
|
||||||
|
Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
|
||||||
|
Sund 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
|
||||||
|
Tuesday 00 2002 %W %U %Y 2002-01-01 00:00:00
|
||||||
|
Thursday 53 1998 %W %u %Y 1998-12-31 00:00:00
|
||||||
|
15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00
|
||||||
|
15-01-20 %d-%m-%y 2020-01-15 00:00:00
|
||||||
|
15-2001-1 %d-%Y-%c 2001-01-15 00:00:00
|
||||||
|
select date,format,DATE(str_to_date(date, format)) as date2 from t1;
|
||||||
|
date format date2
|
||||||
|
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02
|
||||||
|
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S 2003-01-02
|
||||||
|
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02
|
||||||
|
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02
|
||||||
|
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02
|
||||||
|
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02
|
||||||
|
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02
|
||||||
|
10:20:10 %H:%i:%s 0000-00-00
|
||||||
|
10:20:10 %h:%i:%s.%f 0000-00-00
|
||||||
|
10:20:10AM %h:%i:%s%p 0000-00-00
|
||||||
|
10:20:10.44AM %h:%i:%s.%f%p 0000-00-00
|
||||||
|
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15
|
||||||
|
15 September 2001 %d %M %Y 2001-09-15
|
||||||
|
15 SEPTEMB 2001 %d %M %Y 2001-01-15
|
||||||
|
15 MAY 2001 %d %b %Y 2001-05-15
|
||||||
|
Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15
|
||||||
|
Sund 15 MAY 2001 %W %d %b %Y 2001-05-15
|
||||||
|
Tuesday 00 2002 %W %U %Y 2002-01-01
|
||||||
|
Thursday 53 1998 %W %u %Y 1998-12-31
|
||||||
|
15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15
|
||||||
|
15-01-20 %d-%m-%y 2020-01-15
|
||||||
|
15-2001-1 %d-%Y-%c 2001-01-15
|
||||||
|
select date,format,TIME(str_to_date(date, format)) as time from t1;
|
||||||
|
date format time
|
||||||
|
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12
|
||||||
|
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S 08:11:02
|
||||||
|
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12
|
||||||
|
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.012345
|
||||||
|
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.012345
|
||||||
|
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.012345
|
||||||
|
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12
|
||||||
|
10:20:10 %H:%i:%s 10:20:10
|
||||||
|
10:20:10 %h:%i:%s.%f 10:20:10
|
||||||
|
10:20:10AM %h:%i:%s%p 10:20:10
|
||||||
|
10:20:10.44AM %h:%i:%s.%f%p 10:20:10.000044
|
||||||
|
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58
|
||||||
|
15 September 2001 %d %M %Y 00:00:00
|
||||||
|
15 SEPTEMB 2001 %d %M %Y 00:00:00
|
||||||
|
15 MAY 2001 %d %b %Y 00:00:00
|
||||||
|
Sunday 15 MAY 2001 %W %d %b %Y 00:00:00
|
||||||
|
Sund 15 MAY 2001 %W %d %b %Y 00:00:00
|
||||||
|
Tuesday 00 2002 %W %U %Y 00:00:00
|
||||||
|
Thursday 53 1998 %W %u %Y 00:00:00
|
||||||
|
15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00
|
||||||
|
15-01-20 %d-%m-%y 00:00:00
|
||||||
|
15-2001-1 %d-%Y-%c 00:00:00
|
||||||
|
select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1;
|
||||||
|
date format time2
|
||||||
|
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12
|
||||||
|
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S 08:11:02
|
||||||
|
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12
|
||||||
|
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.012345
|
||||||
|
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.012345
|
||||||
|
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.012345
|
||||||
|
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12
|
||||||
|
10:20:10 %H:%i:%s 10:20:10
|
||||||
|
10:20:10 %h:%i:%s.%f 10:20:10
|
||||||
|
10:20:10AM %h:%i:%s%p 10:20:10
|
||||||
|
10:20:10.44AM %h:%i:%s.%f%p 10:20:10.000044
|
||||||
|
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58
|
||||||
|
15 September 2001 %d %M %Y 00:00:00
|
||||||
|
15 SEPTEMB 2001 %d %M %Y 00:00:00
|
||||||
|
15 MAY 2001 %d %b %Y 00:00:00
|
||||||
|
Sunday 15 MAY 2001 %W %d %b %Y 00:00:00
|
||||||
|
Sund 15 MAY 2001 %W %d %b %Y 00:00:00
|
||||||
|
Tuesday 00 2002 %W %U %Y 00:00:00
|
||||||
|
Thursday 53 1998 %W %u %Y 00:00:00
|
||||||
|
15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00
|
||||||
|
15-01-20 %d-%m-%y 00:00:00
|
||||||
|
15-2001-1 %d-%Y-%c 00:00:00
|
||||||
|
truncate table t1;
|
||||||
|
insert into t1 values
|
||||||
|
('2003-01-02 10:11:12 PM', '%Y-%m-%d %H:%i:%S %p'),
|
||||||
|
('2003-01-02 10:11:12.123456', '%Y-%m-%d %h:%i:%S %p'),
|
||||||
|
('2003-01-02 10:11:12AM', '%Y-%m-%d %h:%i:%S.%f %p'),
|
||||||
|
('2003-01-02 10:11:12AN', '%Y-%m-%d %h:%i:%S%p'),
|
||||||
|
('2003-01-02 10:11:12 PM', '%y-%m-%d %H:%i:%S %p'),
|
||||||
|
('10:20:10AM', '%H:%i:%s%p'),
|
||||||
|
('15 Septembei 2001', '%d %M %Y'),
|
||||||
|
('15 Ju 2001', '%d %M %Y'),
|
||||||
|
('Sund 15 MA', '%W %d %b %Y'),
|
||||||
|
('Sunday 01 2001', '%W %V %X'),
|
||||||
|
('Thursdai 12 1998', '%W %u %Y'),
|
||||||
|
(NULL, get_format(DATE,'USA')),
|
||||||
|
('Tuesday 52 2001', '%W %V %X');
|
||||||
|
select date,format,str_to_date(date, format) as str_to_date from t1;
|
||||||
|
date format str_to_date
|
||||||
|
2003-01-02 10:11:12 PM %Y-%m-%d %H:%i:%S %p NULL
|
||||||
|
2003-01-02 10:11:12.123456 %Y-%m-%d %h:%i:%S %p NULL
|
||||||
|
2003-01-02 10:11:12AM %Y-%m-%d %h:%i:%S.%f %p NULL
|
||||||
|
2003-01-02 10:11:12AN %Y-%m-%d %h:%i:%S%p NULL
|
||||||
|
2003-01-02 10:11:12 PM %y-%m-%d %H:%i:%S %p NULL
|
||||||
|
10:20:10AM %H:%i:%s%p NULL
|
||||||
|
15 Septembei 2001 %d %M %Y NULL
|
||||||
|
15 Ju 2001 %d %M %Y NULL
|
||||||
|
Sund 15 MA %W %d %b %Y NULL
|
||||||
|
Sunday 01 2001 %W %V %X NULL
|
||||||
|
Thursdai 12 1998 %W %u %Y NULL
|
||||||
|
NULL %m.%d.%Y NULL
|
||||||
|
Tuesday 52 2001 %W %V %X NULL
|
||||||
|
select date,format,concat(str_to_date(date, format),'') as con from t1;
|
||||||
|
date format con
|
||||||
|
2003-01-02 10:11:12 PM %Y-%m-%d %H:%i:%S %p NULL
|
||||||
|
2003-01-02 10:11:12.123456 %Y-%m-%d %h:%i:%S %p NULL
|
||||||
|
2003-01-02 10:11:12AM %Y-%m-%d %h:%i:%S.%f %p NULL
|
||||||
|
2003-01-02 10:11:12AN %Y-%m-%d %h:%i:%S%p NULL
|
||||||
|
2003-01-02 10:11:12 PM %y-%m-%d %H:%i:%S %p NULL
|
||||||
|
10:20:10AM %H:%i:%s%p NULL
|
||||||
|
15 Septembei 2001 %d %M %Y NULL
|
||||||
|
15 Ju 2001 %d %M %Y NULL
|
||||||
|
Sund 15 MA %W %d %b %Y NULL
|
||||||
|
Sunday 01 2001 %W %V %X NULL
|
||||||
|
Thursdai 12 1998 %W %u %Y NULL
|
||||||
|
NULL %m.%d.%Y NULL
|
||||||
|
Tuesday 52 2001 %W %V %X NULL
|
||||||
|
truncate table t1;
|
||||||
|
insert into t1 values
|
||||||
|
('10:20:10AM', '%h:%i:%s'),
|
||||||
|
('2003-01-02 10:11:12', '%Y-%m-%d %h:%i:%S'),
|
||||||
|
('03-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p');
|
||||||
|
select date,format,str_to_date(date, format) as str_to_date from t1;
|
||||||
|
date format str_to_date
|
||||||
|
10:20:10AM %h:%i:%s 0000-00-00 10:20:10
|
||||||
|
2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12
|
||||||
|
03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 0003-01-02 22:11:12
|
||||||
|
select date,format,concat(str_to_date(date, format),'') as con from t1;
|
||||||
|
date format con
|
||||||
|
10:20:10AM %h:%i:%s 0000-00-00 10:20:10
|
||||||
|
2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12
|
||||||
|
03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 0003-01-02 22:11:12
|
||||||
|
drop table t1;
|
||||||
select get_format(DATE, 'USA') as a;
|
select get_format(DATE, 'USA') as a;
|
||||||
a
|
a
|
||||||
%m.%d.%Y
|
%m.%d.%Y
|
||||||
@@ -154,4 +318,15 @@ a
|
|||||||
%H%i%s
|
%H%i%s
|
||||||
select get_format(DATETIME, 'eur') as a;
|
select get_format(DATETIME, 'eur') as a;
|
||||||
a
|
a
|
||||||
%Y-%m-%d-%H.%i.%s
|
%Y-%m-%d %H.%i.%s
|
||||||
|
select get_format(DATE, 'TEST') as a;
|
||||||
|
a
|
||||||
|
NULL
|
||||||
|
select str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'));
|
||||||
|
str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'))
|
||||||
|
NULL
|
||||||
|
explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001");
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority makedate(1997,1) AS `makedate(1997,1)`,addtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'31.12.97 11.59.59.999999 PM') AS `addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,subtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'31.12.97 11.59.59.999999 PM') AS `subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,timediff(_latin1'01.01.97 11:59:59.000001 PM',_latin1'31.12.95 11:59:59.000002 PM') AS `timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM")`,cast(str_to_date(_latin1'15-01-2001 12:59:59',_latin1'%d-%m-%Y %H:%i:%S') as time) AS `cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME)`,maketime(23,11,12) AS `maketime(23,11,12)`,microsecond(_latin1'1997-12-31 23:59:59.000001') AS `microsecond("1997-12-31 23:59:59.000001")`
|
||||||
|
@@ -227,6 +227,4 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 THEMAX.E2 1 Using where
|
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 THEMAX.E2 1 Using where
|
||||||
2 DERIVED t1 ALL NULL NULL NULL NULL 2 Using where
|
2 DERIVED t1 ALL NULL NULL NULL NULL 2 Using where
|
||||||
3 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 2 Using where
|
3 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 2 Using where
|
||||||
Warnings:
|
|
||||||
Note 1275 Field or reference 'A.E2' of SELECT #3 was resolved in SELECT #2
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@@ -9,6 +9,11 @@ select * from t1 where MATCH(a,b) AGAINST ("collections");
|
|||||||
a b
|
a b
|
||||||
Only MyISAM tables support collections
|
Only MyISAM tables support collections
|
||||||
Full-text indexes are called collections
|
Full-text indexes are called collections
|
||||||
|
explain extended select * from t1 where MATCH(a,b) AGAINST ("collections");
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 fulltext a a 0 1 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority test.t1.a AS `a`,test.t1.b AS `b` from test.t1 where (match test.t1.a,test.t1.b against (_latin1'collections'))
|
||||||
select * from t1 where MATCH(a,b) AGAINST ("indexes");
|
select * from t1 where MATCH(a,b) AGAINST ("indexes");
|
||||||
a b
|
a b
|
||||||
Full-text indexes are called collections
|
Full-text indexes are called collections
|
||||||
@@ -65,6 +70,11 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE);
|
select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE);
|
||||||
a b
|
a b
|
||||||
MySQL has now support for full-text search
|
MySQL has now support for full-text search
|
||||||
|
explain extended select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 fulltext a a 0 1 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority test.t1.a AS `a`,test.t1.b AS `b` from test.t1 where (match test.t1.a,test.t1.b against (_latin1'support -collections' in boolean mode))
|
||||||
select * from t1 where MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE);
|
select * from t1 where MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE);
|
||||||
a b
|
a b
|
||||||
MySQL has now support for full-text search
|
MySQL has now support for full-text search
|
||||||
@@ -287,6 +297,8 @@ insert into t2 values (3, 1, 'xxbuz');
|
|||||||
select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('xxfoo' in boolean mode);
|
select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('xxfoo' in boolean mode);
|
||||||
t1_id name t2_id t1_id name
|
t1_id name t2_id t1_id name
|
||||||
1 data1 1 1 xxfoo
|
1 data1 1 1 xxfoo
|
||||||
|
select * from t2 where match name against ('a* b* c* d* e* f*' in boolean mode);
|
||||||
|
t2_id t1_id name
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
SET NAMES latin1;
|
SET NAMES latin1;
|
||||||
CREATE TABLE t1 (t text character set utf8 not null, fulltext(t));
|
CREATE TABLE t1 (t text character set utf8 not null, fulltext(t));
|
||||||
|
@@ -7,9 +7,19 @@ length(@test_compress_string)
|
|||||||
select uncompress(compress(@test_compress_string));
|
select uncompress(compress(@test_compress_string));
|
||||||
uncompress(compress(@test_compress_string))
|
uncompress(compress(@test_compress_string))
|
||||||
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||||
|
explain extended select uncompress(compress(@test_compress_string));
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority no_cache uncompress(compress((@test_compress_string))) AS `uncompress(compress(@test_compress_string))`
|
||||||
select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
|
select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
|
||||||
uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)
|
uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)
|
||||||
1
|
1
|
||||||
|
explain extended select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority no_cache (uncompressed_length(compress((@test_compress_string))) = length((@test_compress_string))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`
|
||||||
select uncompressed_length(compress(@test_compress_string));
|
select uncompressed_length(compress(@test_compress_string));
|
||||||
uncompressed_length(compress(@test_compress_string))
|
uncompressed_length(compress(@test_compress_string))
|
||||||
117
|
117
|
||||||
@@ -55,6 +65,6 @@ NULL
|
|||||||
50000
|
50000
|
||||||
NULL
|
NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Error 1258 Z_DATA_ERROR: Input data was corrupted for zlib
|
Error 1258 ZLIB: Input data was corrupted for zlib
|
||||||
Error 1255 Too big size of uncompressed data. The maximum size is 1048576. (probably, length of uncompressed data was corrupted)
|
Error 1255 Too big size of uncompressed data. The maximum size is 1048576. (probably, length of uncompressed data was corrupted)
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@@ -1,6 +1,16 @@
|
|||||||
|
drop table if exists t1;
|
||||||
select length(encrypt('foo', 'ff')) <> 0;
|
select length(encrypt('foo', 'ff')) <> 0;
|
||||||
length(encrypt('foo', 'ff')) <> 0
|
length(encrypt('foo', 'ff')) <> 0
|
||||||
1
|
1
|
||||||
|
create table t1 (name varchar(50), pw varchar(64));
|
||||||
|
insert into t1 values ('tom', password('my_pass'));
|
||||||
|
set @pass='my_pass';
|
||||||
|
select name from t1 where name='tom' and pw=password(@pass);
|
||||||
|
name
|
||||||
|
tom
|
||||||
|
select name from t1 where name='tom' and pw=password(@undefined);
|
||||||
|
name
|
||||||
|
drop table t1;
|
||||||
select password('abc');
|
select password('abc');
|
||||||
password('abc')
|
password('abc')
|
||||||
*0D3CED9BEC10A777AEC23CCC353A8C08A633045E
|
*0D3CED9BEC10A777AEC23CCC353A8C08A633045E
|
||||||
@@ -77,3 +87,8 @@ old_password('idkfa')
|
|||||||
select old_password(' i d k f a ');
|
select old_password(' i d k f a ');
|
||||||
old_password(' i d k f a ')
|
old_password(' i d k f a ')
|
||||||
5c078dc54ca0fcca
|
5c078dc54ca0fcca
|
||||||
|
explain extended select password('idkfa '), old_password('idkfa');
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority password(_latin1'idkfa ') AS `password('idkfa ')`,old_password(_latin1'idkfa') AS `old_password('idkfa')`
|
||||||
|
18
mysql-test/r/func_default.result
Normal file
18
mysql-test/r/func_default.result
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
drop table if exists t1,t2;
|
||||||
|
create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14');
|
||||||
|
insert into t1 values ('','',0,0.0);
|
||||||
|
select default(str), default(strnull), default(intg), default(rel) from t1;
|
||||||
|
default(str) default(strnull) default(intg) default(rel)
|
||||||
|
def NULL 10 3.14
|
||||||
|
explain extended select default(str), default(strnull), default(intg), default(rel) from t1;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 system NULL NULL NULL NULL 1
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority default(test.t1.str) AS `default(str)`,default(test.t1.strnull) AS `default(strnull)`,default(test.t1.intg) AS `default(intg)`,default(test.t1.rel) AS `default(rel)` from test.t1
|
||||||
|
select * from t1 where str <> default(str);
|
||||||
|
str strnull intg rel
|
||||||
|
0 0
|
||||||
|
explain select * from t1 where str <> default(str);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 system NULL NULL NULL NULL 1
|
||||||
|
drop table t1;
|
@@ -134,3 +134,8 @@ NULL
|
|||||||
select hex(des_decrypt(des_encrypt("hello","hidden")));
|
select hex(des_decrypt(des_encrypt("hello","hidden")));
|
||||||
hex(des_decrypt(des_encrypt("hello","hidden")))
|
hex(des_decrypt(des_encrypt("hello","hidden")))
|
||||||
NULL
|
NULL
|
||||||
|
explain extended select des_decrypt(des_encrypt("hello",4),'password2'), des_decrypt(des_encrypt("hello","hidden"));
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority des_decrypt(des_encrypt(_latin1'hello',4),_latin1'password2') AS `des_decrypt(des_encrypt("hello",4),'password2')`,des_decrypt(des_encrypt(_latin1'hello',_latin1'hidden')) AS `des_decrypt(des_encrypt("hello","hidden"))`
|
||||||
|
@@ -14,6 +14,11 @@ grp group_concat(c)
|
|||||||
1 a
|
1 a
|
||||||
2 b,c
|
2 b,c
|
||||||
3 E,C,D,d,d,D
|
3 E,C,D,d,d,D
|
||||||
|
explain extended select grp,group_concat(c) from t1 group by grp;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority test.t1.grp AS `grp`,group_concat(test.t1.c seperator ',') AS `group_concat(c)` from test.t1 group by test.t1.grp
|
||||||
select grp,group_concat(a,c) from t1 group by grp;
|
select grp,group_concat(a,c) from t1 group by grp;
|
||||||
grp group_concat(a,c)
|
grp group_concat(a,c)
|
||||||
1 1a
|
1 1a
|
||||||
@@ -79,6 +84,11 @@ grp group_concat(distinct c order by c desc)
|
|||||||
1 a
|
1 a
|
||||||
2 c,b
|
2 c,b
|
||||||
3 E,D,C
|
3 E,D,C
|
||||||
|
explain extended select grp,group_concat(distinct c order by c desc) from t1 group by grp;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c seperator ',') AS `group_concat(distinct c order by c desc)` from test.t1 group by test.t1.grp
|
||||||
select grp,group_concat(c order by c separator ",") from t1 group by grp;
|
select grp,group_concat(c order by c separator ",") from t1 group by grp;
|
||||||
grp group_concat(c order by c separator ",")
|
grp group_concat(c order by c separator ",")
|
||||||
1 a
|
1 a
|
||||||
@@ -94,6 +104,11 @@ grp group_concat(distinct c order by c separator ",")
|
|||||||
1 a
|
1 a
|
||||||
2 b,c
|
2 b,c
|
||||||
3 C,D,E
|
3 C,D,E
|
||||||
|
explain extended select grp,group_concat(distinct c order by c separator ",") from t1 group by grp;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c seperator ',') AS `group_concat(distinct c order by c separator ",")` from test.t1 group by test.t1.grp
|
||||||
select grp,group_concat(distinct c order by c desc separator ",") from t1 group by grp;
|
select grp,group_concat(distinct c order by c desc separator ",") from t1 group by grp;
|
||||||
grp group_concat(distinct c order by c desc separator ",")
|
grp group_concat(distinct c order by c desc separator ",")
|
||||||
1 a
|
1 a
|
||||||
|
@@ -559,8 +559,8 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
explain
|
explain
|
||||||
select concat(min(t1.a1),min(t2.a4)) from t1, t2 where t2.a4 <> 'AME';
|
select concat(min(t1.a1),min(t2.a4)) from t1, t2 where t2.a4 <> 'AME';
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 index NULL PRIMARY 3 NULL 14 Using index
|
|
||||||
1 SIMPLE t2 range k2 k2 4 NULL 6 Using where; Using index
|
1 SIMPLE t2 range k2 k2 4 NULL 6 Using where; Using index
|
||||||
|
1 SIMPLE t1 index NULL PRIMARY 3 NULL 14 Using index
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
CREATE TABLE t1 (a int, b int);
|
CREATE TABLE t1 (a int, b int);
|
||||||
select count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1;
|
select count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1;
|
||||||
@@ -597,11 +597,16 @@ a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
|||||||
1 0 NULL NULL NULL NULL NULL 0 0
|
1 0 NULL NULL NULL NULL NULL 0 0
|
||||||
2 1 1 1.0000 0.0000 1 1 0 1
|
2 1 1 1.0000 0.0000 1 1 0 1
|
||||||
3 1 1 1.0000 0.0000 1 1 1 1
|
3 1 1 1.0000 0.0000 1 1 1 1
|
||||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
|
||||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b) bit_xor(b)
|
||||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0 0
|
||||||
2 1 1 1.0000 0.0000 1 1 1 1
|
2 1 1 1.0000 0.0000 1 1 1 1 1
|
||||||
3 1 1 1.0000 0.0000 1 1 1 1
|
3 1 1 1.0000 0.0000 1 1 1 1 1
|
||||||
|
explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority big_result test.t1.a AS `a`,count(test.t1.b) AS `count(b)`,sum(test.t1.b) AS `sum(b)`,avg(test.t1.b) AS `avg(b)`,std(test.t1.b) AS `std(b)`,min(test.t1.b) AS `min(b)`,max(test.t1.b) AS `max(b)`,bit_and(test.t1.b) AS `bit_and(b)`,bit_or(test.t1.b) AS `bit_or(b)`,bit_xor(test.t1.b) AS `bit_xor(b)` from test.t1 group by test.t1.a
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) type=InnoDB;
|
create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) type=InnoDB;
|
||||||
insert into t1 values (1, 3);
|
insert into t1 values (1, 3);
|
||||||
|
@@ -39,6 +39,25 @@ a
|
|||||||
a
|
a
|
||||||
aa
|
aa
|
||||||
aaa
|
aaa
|
||||||
|
explain extended select if(u=1,st,binary st) s from t1 where st like "%a%" order by s;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using filesort
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority if((test.t1.u = 1),test.t1.st,(test.t1.st collate _latin1'BINARY')) AS `s` from test.t1 where (test.t1.st like _latin1'%a%') order by if((test.t1.u = 1),test.t1.st,(test.t1.st collate _latin1'BINARY'))
|
||||||
|
select nullif(u=0, 'test') from t1;
|
||||||
|
nullif(u=0, 'test')
|
||||||
|
NULL
|
||||||
|
NULL
|
||||||
|
NULL
|
||||||
|
NULL
|
||||||
|
NULL
|
||||||
|
1
|
||||||
|
1
|
||||||
|
explain extended select nullif(u=0, 'test') from t1;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 7
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority nullif((test.t1.u = 0),_latin1'test') AS `nullif(u=0, 'test')` from test.t1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (num double(12,2));
|
create table t1 (num double(12,2));
|
||||||
insert into t1 values (144.54);
|
insert into t1 values (144.54);
|
||||||
|
@@ -142,6 +142,11 @@ a c c
|
|||||||
select * from t1 where 'a' in (a,b,c collate latin1_bin);
|
select * from t1 where 'a' in (a,b,c collate latin1_bin);
|
||||||
a b c
|
a b c
|
||||||
a c c
|
a c c
|
||||||
|
explain extended select * from t1 where 'a' in (a,b,c collate latin1_bin);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c` from test.t1 where (_latin1'a' in (test.t1.a,test.t1.b,(test.t1.c collate _latin1'latin1_bin')))
|
||||||
drop table t1;
|
drop table t1;
|
||||||
select '1.0' in (1,2);
|
select '1.0' in (1,2);
|
||||||
'1.0' in (1,2)
|
'1.0' in (1,2)
|
||||||
|
@@ -1,43 +1,108 @@
|
|||||||
select floor(5.5),floor(-5.5);
|
select floor(5.5),floor(-5.5);
|
||||||
floor(5.5) floor(-5.5)
|
floor(5.5) floor(-5.5)
|
||||||
5 -6
|
5 -6
|
||||||
|
explain extended select floor(5.5),floor(-5.5);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority floor(5.5) AS `floor(5.5)`,floor(-(5.5)) AS `floor(-5.5)`
|
||||||
select ceiling(5.5),ceiling(-5.5);
|
select ceiling(5.5),ceiling(-5.5);
|
||||||
ceiling(5.5) ceiling(-5.5)
|
ceiling(5.5) ceiling(-5.5)
|
||||||
6 -5
|
6 -5
|
||||||
|
explain extended select ceiling(5.5),ceiling(-5.5);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority ceiling(5.5) AS `ceiling(5.5)`,ceiling(-(5.5)) AS `ceiling(-5.5)`
|
||||||
select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
|
select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
|
||||||
truncate(52.64,1) truncate(52.64,2) truncate(52.64,-1) truncate(52.64,-2) truncate(-52.64,1) truncate(-52.64,-1)
|
truncate(52.64,1) truncate(52.64,2) truncate(52.64,-1) truncate(52.64,-2) truncate(-52.64,1) truncate(-52.64,-1)
|
||||||
52.6 52.64 50 0 -52.6 -50
|
52.6 52.64 50 0 -52.6 -50
|
||||||
|
explain extended select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority truncate(52.64,1) AS `truncate(52.64,1)`,truncate(52.64,2) AS `truncate(52.64,2)`,truncate(52.64,-(1)) AS `truncate(52.64,-1)`,truncate(52.64,-(2)) AS `truncate(52.64,-2)`,truncate(-(52.64),1) AS `truncate(-52.64,1)`,truncate(-(52.64),-(1)) AS `truncate(-52.64,-1)`
|
||||||
select round(5.5),round(-5.5);
|
select round(5.5),round(-5.5);
|
||||||
round(5.5) round(-5.5)
|
round(5.5) round(-5.5)
|
||||||
6 -6
|
6 -6
|
||||||
|
explain extended select round(5.5),round(-5.5);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority round(5.5,0) AS `round(5.5)`,round(-(5.5),0) AS `round(-5.5)`
|
||||||
select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2);
|
select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2);
|
||||||
round(5.64,1) round(5.64,2) round(5.64,-1) round(5.64,-2)
|
round(5.64,1) round(5.64,2) round(5.64,-1) round(5.64,-2)
|
||||||
5.6 5.64 10 0
|
5.6 5.64 10 0
|
||||||
select abs(-10), sign(-5), sign(5), sign(0);
|
select abs(-10), sign(-5), sign(5), sign(0);
|
||||||
abs(-10) sign(-5) sign(5) sign(0)
|
abs(-10) sign(-5) sign(5) sign(0)
|
||||||
10 -1 1 0
|
10 -1 1 0
|
||||||
|
explain extended select abs(-10), sign(-5), sign(5), sign(0);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority abs(-(10)) AS `abs(-10)`,sign(-(5)) AS `sign(-5)`,sign(5) AS `sign(5)`,sign(0) AS `sign(0)`
|
||||||
select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
|
select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
|
||||||
log(exp(10)) exp(log(sqrt(10))*2) log(-1) log(NULL) log(1,1) log(3,9) log(-1,2) log(NULL,2)
|
log(exp(10)) exp(log(sqrt(10))*2) log(-1) log(NULL) log(1,1) log(3,9) log(-1,2) log(NULL,2)
|
||||||
10.000000 10.000000 NULL NULL NULL 2.000000 NULL NULL
|
10.000000 10.000000 NULL NULL NULL 2.000000 NULL NULL
|
||||||
|
explain extended select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority log(exp(10)) AS `log(exp(10))`,exp((log(sqrt(10)) * 2)) AS `exp(log(sqrt(10))*2)`,log(-(1)) AS `log(-1)`,log(NULL) AS `log(NULL)`,log(1,1) AS `log(1,1)`,log(3,9) AS `log(3,9)`,log(-(1),2) AS `log(-1,2)`,log(NULL,2) AS `log(NULL,2)`
|
||||||
select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
|
select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
|
||||||
ln(exp(10)) exp(ln(sqrt(10))*2) ln(-1) ln(0) ln(NULL)
|
ln(exp(10)) exp(ln(sqrt(10))*2) ln(-1) ln(0) ln(NULL)
|
||||||
10.000000 10.000000 NULL NULL NULL
|
10.000000 10.000000 NULL NULL NULL
|
||||||
|
explain extended select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority ln(exp(10)) AS `ln(exp(10))`,exp((ln(sqrt(10)) * 2)) AS `exp(ln(sqrt(10))*2)`,ln(-(1)) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)`
|
||||||
select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
|
select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
|
||||||
log2(8) log2(15) log2(-2) log2(0) log2(NULL)
|
log2(8) log2(15) log2(-2) log2(0) log2(NULL)
|
||||||
3.000000 3.906891 NULL NULL NULL
|
3.000000 3.906891 NULL NULL NULL
|
||||||
|
explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-(2)) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)`
|
||||||
select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
|
select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
|
||||||
log10(100) log10(18) log10(-4) log10(0) log10(NULL)
|
log10(100) log10(18) log10(-4) log10(0) log10(NULL)
|
||||||
2.000000 1.255273 NULL NULL NULL
|
2.000000 1.255273 NULL NULL NULL
|
||||||
|
explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority log10(100) AS `log10(100)`,log10(18) AS `log10(18)`,log10(-(4)) AS `log10(-4)`,log10(0) AS `log10(0)`,log10(NULL) AS `log10(NULL)`
|
||||||
select pow(10,log10(10)),power(2,4);
|
select pow(10,log10(10)),power(2,4);
|
||||||
pow(10,log10(10)) power(2,4)
|
pow(10,log10(10)) power(2,4)
|
||||||
10.000000 16.000000
|
10.000000 16.000000
|
||||||
|
explain extended select pow(10,log10(10)),power(2,4);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority pow(10,log10(10)) AS `pow(10,log10(10))`,pow(2,4) AS `power(2,4)`
|
||||||
set @@rand_seed1=10000000,@@rand_seed2=1000000;
|
set @@rand_seed1=10000000,@@rand_seed2=1000000;
|
||||||
select rand(999999),rand();
|
select rand(999999),rand();
|
||||||
rand(999999) rand()
|
rand(999999) rand()
|
||||||
0.014231365187309 0.028870999839968
|
0.014231365187309 0.028870999839968
|
||||||
|
explain extended select rand(999999),rand();
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority no_cache rand(999999) AS `rand(999999)`,rand() AS `rand()`
|
||||||
select pi(),sin(pi()/2),cos(pi()/2),abs(tan(pi())),cot(1),asin(1),acos(0),atan(1);
|
select pi(),sin(pi()/2),cos(pi()/2),abs(tan(pi())),cot(1),asin(1),acos(0),atan(1);
|
||||||
pi() sin(pi()/2) cos(pi()/2) abs(tan(pi())) cot(1) asin(1) acos(0) atan(1)
|
pi() sin(pi()/2) cos(pi()/2) abs(tan(pi())) cot(1) asin(1) acos(0) atan(1)
|
||||||
3.141593 1.000000 0.000000 0.000000 0.64209262 1.570796 1.570796 0.785398
|
3.141593 1.000000 0.000000 0.000000 0.64209262 1.570796 1.570796 0.785398
|
||||||
|
explain extended select pi(),sin(pi()/2),cos(pi()/2),abs(tan(pi())),cot(1),asin(1),acos(0),atan(1);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority pi() AS `pi()`,sin((pi() / 2)) AS `sin(pi()/2)`,cos((pi() / 2)) AS `cos(pi()/2)`,abs(tan(pi())) AS `abs(tan(pi()))`,(1 / tan(1)) AS `cot(1)`,asin(1) AS `asin(1)`,acos(0) AS `acos(0)`,atan(1) AS `atan(1)`
|
||||||
select degrees(pi()),radians(360);
|
select degrees(pi()),radians(360);
|
||||||
degrees(pi()) radians(360)
|
degrees(pi()) radians(360)
|
||||||
180 6.2831853071796
|
180 6.2831853071796
|
||||||
|
explain extended select degrees(pi()),radians(360);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)`
|
||||||
|
@@ -1,9 +1,19 @@
|
|||||||
select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
|
select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
|
||||||
1+1 1-1 1+1*2 8/5 8%5 mod(8,5) mod(8,5)|0 -(1+1)*-2
|
1+1 1-1 1+1*2 8/5 8%5 mod(8,5) mod(8,5)|0 -(1+1)*-2
|
||||||
2 0 3 1.60 3 3 3 4
|
2 0 3 1.60 3 3 3 4
|
||||||
|
explain extended select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority (1 + 1) AS `1+1`,(1 - 1) AS `1-1`,(1 + (1 * 2)) AS `1+1*2`,(8 / 5) AS `8/5`,(8 % 5) AS `8%5`,(8 % 5) AS `mod(8,5)`,((8 % 5) | 0) AS `mod(8,5)|0`,(-((1 + 1)) * -(2)) AS `-(1+1)*-2`
|
||||||
select 1 | (1+1),5 & 3,bit_count(7) ;
|
select 1 | (1+1),5 & 3,bit_count(7) ;
|
||||||
1 | (1+1) 5 & 3 bit_count(7)
|
1 | (1+1) 5 & 3 bit_count(7)
|
||||||
3 1 3
|
3 1 3
|
||||||
|
explain extended select 1 | (1+1),5 & 3,bit_count(7) ;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority (1 | (1 + 1)) AS `1 | (1+1)`,(5 & 3) AS `5 & 3`,bit_count(7) AS `bit_count(7)`
|
||||||
select 1 << 32,1 << 63, 1 << 64, 4 >> 2, 4 >> 63, 1<< 63 >> 60;
|
select 1 << 32,1 << 63, 1 << 64, 4 >> 2, 4 >> 63, 1<< 63 >> 60;
|
||||||
1 << 32 1 << 63 1 << 64 4 >> 2 4 >> 63 1<< 63 >> 60
|
1 << 32 1 << 63 1 << 64 4 >> 2 4 >> 63 1<< 63 >> 60
|
||||||
4294967296 9223372036854775808 0 1 0 8
|
4294967296 9223372036854775808 0 1 0 8
|
||||||
|
@@ -36,6 +36,11 @@ insert into t1 (xxx) values('this is a test of some long text to see what happen
|
|||||||
select * from t1 where xxx regexp('is a test of some long text to');
|
select * from t1 where xxx regexp('is a test of some long text to');
|
||||||
xxx
|
xxx
|
||||||
this is a test of some long text to see what happens
|
this is a test of some long text to see what happens
|
||||||
|
explain extended select * from t1 where xxx regexp('is a test of some long text to');
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 system NULL NULL NULL NULL 1
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority test.t1.xxx AS `xxx` from test.t1 where (test.t1.xxx regexp _latin1'is a test of some long text to')
|
||||||
select * from t1 where xxx regexp('is a test of some long text to ');
|
select * from t1 where xxx regexp('is a test of some long text to ');
|
||||||
xxx
|
xxx
|
||||||
this is a test of some long text to see what happens
|
this is a test of some long text to see what happens
|
||||||
|
@@ -1,6 +1,11 @@
|
|||||||
select interval(55,10,20,30,40,50,60,70,80,90,100),interval(3,1,1+1,1+1+1+1),field("IBM","NCA","ICL","SUN","IBM","DIGITAL"),field("A","B","C"),elt(2,"ONE","TWO","THREE"),interval(0,1,2,3,4),elt(1,1,2,3)|0,elt(1,1.1,1.2,1.3)+0;
|
select interval(55,10,20,30,40,50,60,70,80,90,100),interval(3,1,1+1,1+1+1+1),field("IBM","NCA","ICL","SUN","IBM","DIGITAL"),field("A","B","C"),elt(2,"ONE","TWO","THREE"),interval(0,1,2,3,4),elt(1,1,2,3)|0,elt(1,1.1,1.2,1.3)+0;
|
||||||
interval(55,10,20,30,40,50,60,70,80,90,100) interval(3,1,1+1,1+1+1+1) field("IBM","NCA","ICL","SUN","IBM","DIGITAL") field("A","B","C") elt(2,"ONE","TWO","THREE") interval(0,1,2,3,4) elt(1,1,2,3)|0 elt(1,1.1,1.2,1.3)+0
|
interval(55,10,20,30,40,50,60,70,80,90,100) interval(3,1,1+1,1+1+1+1) field("IBM","NCA","ICL","SUN","IBM","DIGITAL") field("A","B","C") elt(2,"ONE","TWO","THREE") interval(0,1,2,3,4) elt(1,1,2,3)|0 elt(1,1.1,1.2,1.3)+0
|
||||||
5 2 4 0 TWO 0 1 1.1
|
5 2 4 0 TWO 0 1 1.1
|
||||||
|
explain extended select INTERVAL(55,10,20,30,40,50,60,70,80,90,100),interval(3,1,1+1,1+1+1+1),field("IBM","NCA","ICL","SUN","IBM","DIGITAL"),field("A","B","C"),elt(2,"ONE","TWO","THREE"),interval(0,1,2,3,4),elt(1,1,2,3)|0,elt(1,1.1,1.2,1.3)+0;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority interval((55,10,20,30,40,50,60,70,80,90,100)) AS `INTERVAL(55,10,20,30,40,50,60,70,80,90,100)`,interval((3,1,(1 + 1),(((1 + 1) + 1) + 1))) AS `interval(3,1,1+1,1+1+1+1)`,field(_latin1'IBM',_latin1'NCA',_latin1'ICL',_latin1'SUN',_latin1'IBM',_latin1'DIGITAL') AS `field("IBM","NCA","ICL","SUN","IBM","DIGITAL")`,field(_latin1'A',_latin1'B',_latin1'C') AS `field("A","B","C")`,elt(2,_latin1'ONE',_latin1'TWO',_latin1'THREE') AS `elt(2,"ONE","TWO","THREE")`,interval((0,1,2,3,4)) AS `interval(0,1,2,3,4)`,(elt(1,1,2,3) | 0) AS `elt(1,1,2,3)|0`,(elt(1,1.1,1.2,1.3) + 0) AS `elt(1,1.1,1.2,1.3)+0`
|
||||||
select find_in_set("b","a,b,c"),find_in_set("c","a,b,c"),find_in_set("dd","a,bbb,dd"),find_in_set("bbb","a,bbb,dd");
|
select find_in_set("b","a,b,c"),find_in_set("c","a,b,c"),find_in_set("dd","a,bbb,dd"),find_in_set("bbb","a,bbb,dd");
|
||||||
find_in_set("b","a,b,c") find_in_set("c","a,b,c") find_in_set("dd","a,bbb,dd") find_in_set("bbb","a,bbb,dd")
|
find_in_set("b","a,b,c") find_in_set("c","a,b,c") find_in_set("dd","a,bbb,dd") find_in_set("bbb","a,bbb,dd")
|
||||||
2 3 3 2
|
2 3 3 2
|
||||||
|
@@ -12,9 +12,15 @@ length('\n\t\r\b\0\_\%\\')
|
|||||||
select bit_length('\n\t\r\b\0\_\%\\');
|
select bit_length('\n\t\r\b\0\_\%\\');
|
||||||
bit_length('\n\t\r\b\0\_\%\\')
|
bit_length('\n\t\r\b\0\_\%\\')
|
||||||
80
|
80
|
||||||
select concat('monty',' was here ','again'),length('hello'),char(ascii('h'));
|
select char_length('\n\t\r\b\0\_\%\\');
|
||||||
concat('monty',' was here ','again') length('hello') char(ascii('h'))
|
char_length('\n\t\r\b\0\_\%\\')
|
||||||
monty was here again 5 h
|
10
|
||||||
|
select length(_latin1'\n\t\n\b\0\\_\\%\\');
|
||||||
|
length(_latin1'\n\t\n\b\0\\_\\%\\')
|
||||||
|
10
|
||||||
|
select concat('monty',' was here ','again'),length('hello'),char(ascii('h')),ord('h');
|
||||||
|
concat('monty',' was here ','again') length('hello') char(ascii('h')) ord('h')
|
||||||
|
monty was here again 5 h 104
|
||||||
select locate('he','hello'),locate('he','hello',2),locate('lo','hello',2) ;
|
select locate('he','hello'),locate('he','hello',2),locate('lo','hello',2) ;
|
||||||
locate('he','hello') locate('he','hello',2) locate('lo','hello',2)
|
locate('he','hello') locate('he','hello',2) locate('lo','hello',2)
|
||||||
1 0 4
|
1 0 4
|
||||||
@@ -99,6 +105,9 @@ NULL
|
|||||||
select md5('hello');
|
select md5('hello');
|
||||||
md5('hello')
|
md5('hello')
|
||||||
5d41402abc4b2a76b9719d911017c592
|
5d41402abc4b2a76b9719d911017c592
|
||||||
|
select crc32("123");
|
||||||
|
crc32("123")
|
||||||
|
2286445522
|
||||||
select sha('abc');
|
select sha('abc');
|
||||||
sha('abc')
|
sha('abc')
|
||||||
a9993e364706816aba3e25717850c26c9cd0d89d
|
a9993e364706816aba3e25717850c26c9cd0d89d
|
||||||
@@ -579,3 +588,11 @@ CONCAT("</a>",RPAD("",(55 - LENGTH(title)),"."))
|
|||||||
NULL
|
NULL
|
||||||
</a>..........................
|
</a>..........................
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),substring_index("1abcd;2abcd;3abcd;4abcd", ';', -2);
|
||||||
|
substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2) substring_index("1abcd;2abcd;3abcd;4abcd", ';', -2)
|
||||||
|
1abcd;2abcd 3abcd;4abcd
|
||||||
|
explain extended select md5('hello'), sha('abc'), sha1('abc'), soundex(''), 'mood' sounds like 'mud', aes_decrypt(aes_encrypt('abc','1'),'1'),concat('*',space(5),'*'), reverse('abc'), rpad('a',4,'1'), lpad('a',4,'1'), concat_ws(',','',NULL,'a'),make_set(255,_latin2'a',_latin2'b',_latin2'c'),elt(2,1),locate("a","b",2),format(130,10),char(0),conv(130,16,10),hex(130),binary 'HE', export_set(255,_latin2'y',_latin2'n',_latin2' '),FIELD('b' COLLATE latin1_bin,'A','B'),FIND_IN_SET(_latin1'B',_latin1'a,b,c,d'),collation(conv(130,16,10)), coercibility(conv(130,16,10)),length('\n\t\r\b\0\_\%\\'),bit_length('\n\t\r\b\0\_\%\\'),bit_length('\n\t\r\b\0\_\%\\'),concat('monty',' was here ','again'),length('hello'),char(ascii('h')),ord('h'),quote(1/0),crc32("123"),replace('aaaa','a','b'),insert('txs',2,1,'hi'),left(_latin2'a',1),right(_latin2'a',1),lcase(_latin2'a'),ucase(_latin2'a'),SUBSTR('abcdefg',3,2),substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),trim(_latin2' a '),ltrim(_latin2' a '),rtrim(_latin2' a '), decode(encode(repeat("a",100000),"monty"),"monty");
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,(_latin1'HE' collate _latin1'BINARY') AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate _latin1'latin1_bin'),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substr_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")`
|
||||||
|
@@ -37,6 +37,11 @@ version()>=_latin1"3.23.29"
|
|||||||
select charset(version());
|
select charset(version());
|
||||||
charset(version())
|
charset(version())
|
||||||
utf8
|
utf8
|
||||||
|
explain extended select database(), user();
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority no_cache database() AS `database()`,user() AS `user()`
|
||||||
create table t1 (version char(40)) select database(), user(), version() as 'version';
|
create table t1 (version char(40)) select database(), user(), version() as 'version';
|
||||||
show create table t1;
|
show create table t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
|
@@ -44,19 +44,47 @@ select -1.49 or -1.49,0.6 or 0.6;
|
|||||||
select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
|
select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
|
||||||
3 ^ 11 1 ^ 1 1 ^ 0 1 ^ NULL NULL ^ 1
|
3 ^ 11 1 ^ 1 1 ^ 0 1 ^ NULL NULL ^ 1
|
||||||
8 0 1 NULL NULL
|
8 0 1 NULL NULL
|
||||||
|
explain extended select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority (3 ^ 11) AS `3 ^ 11`,(1 ^ 1) AS `1 ^ 1`,(1 ^ 0) AS `1 ^ 0`,(1 ^ NULL) AS `1 ^ NULL`,(NULL ^ 1) AS `NULL ^ 1`
|
||||||
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
|
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
|
||||||
1 XOR 1 1 XOR 0 0 XOR 1 0 XOR 0 NULL XOR 1 1 XOR NULL 0 XOR NULL
|
1 XOR 1 1 XOR 0 0 XOR 1 0 XOR 0 NULL XOR 1 1 XOR NULL 0 XOR NULL
|
||||||
0 1 1 0 NULL NULL NULL
|
0 1 1 0 NULL NULL NULL
|
||||||
select 10 % 7, 10 mod 7, 10 div 3;
|
select 10 % 7, 10 mod 7, 10 div 3;
|
||||||
10 % 7 10 mod 7 10 div 3
|
10 % 7 10 mod 7 10 div 3
|
||||||
3 3 3
|
3 3 3
|
||||||
|
explain extended select 10 % 7, 10 mod 7, 10 div 3;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority (10 % 7) AS `10 % 7`,(10 % 7) AS `10 mod 7`,(10 DIV 3) AS `10 div 3`
|
||||||
select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
|
select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
|
||||||
(1 << 64)-1 ((1 << 64)-1) DIV 1 ((1 << 64)-1) DIV 2
|
(1 << 64)-1 ((1 << 64)-1) DIV 1 ((1 << 64)-1) DIV 2
|
||||||
18446744073709551615 18446744073709551615 9223372036854775807
|
18446744073709551615 18446744073709551615 9223372036854775807
|
||||||
|
explain extended select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority ((1 << 64) - 1) AS `(1 << 64)-1`,(((1 << 64) - 1) DIV 1) AS `((1 << 64)-1) DIV 1`,(((1 << 64) - 1) DIV 2) AS `((1 << 64)-1) DIV 2`
|
||||||
create table t1 (a int);
|
create table t1 (a int);
|
||||||
insert t1 values (1);
|
insert t1 values (1);
|
||||||
select * from t1 where 1 xor 1;
|
select * from t1 where 1 xor 1;
|
||||||
a
|
a
|
||||||
|
explain extended select * from t1 where 1 xor 1;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority test.t1.a AS `a` from test.t1 where (1 xor 1)
|
||||||
|
select - a from t1;
|
||||||
|
- a
|
||||||
|
-1
|
||||||
|
explain extended select - a from t1;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 system NULL NULL NULL NULL 1
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority -(test.t1.a) AS `- a` from test.t1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
|
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
|
||||||
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
|
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
|
||||||
@@ -73,6 +101,11 @@ _koi8r'a' = _koi8r'A'
|
|||||||
select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
|
select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
|
||||||
_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci
|
_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci
|
||||||
1
|
1
|
||||||
|
explain extended select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority (_koi8r'a' = (_koi8r'A' collate _latin1'koi8r_general_ci')) AS `_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci`
|
||||||
select _koi8r'a' = _koi8r'A' COLLATE koi8r_bin;
|
select _koi8r'a' = _koi8r'A' COLLATE koi8r_bin;
|
||||||
_koi8r'a' = _koi8r'A' COLLATE koi8r_bin
|
_koi8r'a' = _koi8r'A' COLLATE koi8r_bin
|
||||||
0
|
0
|
||||||
|
@@ -486,3 +486,8 @@ strcmp(date_format(utc_timestamp(),"%Y-%m-%d"), utc_date())=0
|
|||||||
select strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0;
|
select strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0;
|
||||||
strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0
|
strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0
|
||||||
1
|
1
|
||||||
|
explain extended select period_add("9602",-12),period_diff(199505,"9404"),from_days(to_days("960101")),dayofmonth("1997-01-02"), month("1997-01-02"), monthname("1972-03-04"),dayofyear("0000-00-00"),HOUR("1997-03-03 23:03:22"),MINUTE("23:03:22"),SECOND(230322),QUARTER(980303),WEEK("1998-03-03"),yearweek("2000-01-01",1),week(19950101,1),year("98-02-03"),weekday(curdate())-weekday(now()),dayname("1962-03-03"),unix_timestamp(),sec_to_time(time_to_sec("0:30:47")/6.21),curtime(),utc_time(),curdate(),utc_date(),utc_timestamp(),date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w"),from_unixtime(unix_timestamp("1994-03-02 10:11:12")),"1997-12-31 23:59:59" + INTERVAL 1 SECOND,"1998-01-01 00:00:00" - INTERVAL 1 SECOND,INTERVAL 1 DAY + "1997-12-31", extract(YEAR FROM "1999-01-02 10:11:12"),date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority no_cache period_add(_latin1'9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,_latin1'9404') AS `period_diff(199505,"9404")`,from_days(to_days(_latin1'960101')) AS `from_days(to_days("960101"))`,dayofmonth(_latin1'1997-01-02') AS `dayofmonth("1997-01-02")`,month(_latin1'1997-01-02') AS `month("1997-01-02")`,monthname(_latin1'1972-03-04') AS `monthname("1972-03-04")`,dayofyear(_latin1'0000-00-00') AS `dayofyear("0000-00-00")`,hour(_latin1'1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute(_latin1'23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week(_latin1'1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek(_latin1'2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year(_latin1'98-02-03') AS `year("98-02-03")`,(weekday(to_days(curdate())) - weekday(to_days(now()))) AS `weekday(curdate())-weekday(now())`,dayname(to_days(_latin1'1962-03-03')) AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec(_latin1'0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format(_latin1'1997-01-02 03:04:05',_latin1'%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp(_latin1'1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,(_latin1'1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,(_latin1'1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from _latin1'1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)`
|
||||||
|
@@ -224,6 +224,11 @@ fid AsText(Envelope(g))
|
|||||||
119 POLYGON((0 0,3 0,3 3,0 3,0 0))
|
119 POLYGON((0 0,3 0,3 3,0 3,0 0))
|
||||||
120 POLYGON((0 0,10 0,10 10,0 10,0 0))
|
120 POLYGON((0 0,10 0,10 10,0 10,0 0))
|
||||||
121 POLYGON((3 6,44 6,44 9,3 9,3 6))
|
121 POLYGON((3 6,44 6,44 9,3 9,3 6))
|
||||||
|
explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from geo;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE geo ALL NULL NULL NULL NULL 21
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority dimension(test.geo.g) AS `Dimension(g)`,geometrytype(test.geo.g) AS `GeometryType(g)`,isempty(test.geo.g) AS `IsEmpty(g)`,astext(envelope(test.geo.g)) AS `AsText(Envelope(g))` from test.geo
|
||||||
SELECT fid, X(g) FROM pt;
|
SELECT fid, X(g) FROM pt;
|
||||||
fid X(g)
|
fid X(g)
|
||||||
101 10
|
101 10
|
||||||
@@ -236,6 +241,11 @@ fid Y(g)
|
|||||||
102 10
|
102 10
|
||||||
103 20
|
103 20
|
||||||
104 20
|
104 20
|
||||||
|
explain extended select X(g),Y(g) FROM pt;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE pt ALL NULL NULL NULL NULL 4
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority x(test.pt.g) AS `X(g)`,y(test.pt.g) AS `Y(g)` from test.pt
|
||||||
SELECT fid, AsText(StartPoint(g)) FROM ls;
|
SELECT fid, AsText(StartPoint(g)) FROM ls;
|
||||||
fid AsText(StartPoint(g))
|
fid AsText(StartPoint(g))
|
||||||
105 POINT(0 0)
|
105 POINT(0 0)
|
||||||
@@ -266,6 +276,11 @@ fid IsClosed(g)
|
|||||||
105 0
|
105 0
|
||||||
106 1
|
106 1
|
||||||
107 0
|
107 0
|
||||||
|
explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM ls;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE ls ALL NULL NULL NULL NULL 3
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority astext(startpoint(test.ls.g)) AS `AsText(StartPoint(g))`,astext(endpoint(test.ls.g)) AS `AsText(EndPoint(g))`,glength(test.ls.g) AS `GLength(g)`,numpoints(test.ls.g) AS `NumPoints(g)`,astext(pointn(test.ls.g,2)) AS `AsText(PointN(g, 2))`,isclosed(test.ls.g) AS `IsClosed(g)` from test.ls
|
||||||
SELECT fid, AsText(Centroid(g)) FROM p;
|
SELECT fid, AsText(Centroid(g)) FROM p;
|
||||||
fid AsText(Centroid(g))
|
fid AsText(Centroid(g))
|
||||||
108 POINT(15 15)
|
108 POINT(15 15)
|
||||||
@@ -291,6 +306,11 @@ fid AsText(InteriorRingN(g, 1))
|
|||||||
108 NULL
|
108 NULL
|
||||||
109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
|
109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
|
||||||
110 NULL
|
110 NULL
|
||||||
|
explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM p;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE p ALL NULL NULL NULL NULL 3
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority astext(centroid(test.p.g)) AS `AsText(Centroid(g))`,area(test.p.g) AS `Area(g)`,astext(exteriorring(test.p.g)) AS `AsText(ExteriorRing(g))`,numinteriorrings(test.p.g) AS `NumInteriorRings(g)`,astext(interiorringn(test.p.g,1)) AS `AsText(InteriorRingN(g, 1))` from test.p
|
||||||
SELECT fid, IsClosed(g) FROM mls;
|
SELECT fid, IsClosed(g) FROM mls;
|
||||||
fid IsClosed(g)
|
fid IsClosed(g)
|
||||||
114 0
|
114 0
|
||||||
@@ -325,6 +345,11 @@ SELECT fid, NumGeometries(g) from gc;
|
|||||||
fid NumGeometries(g)
|
fid NumGeometries(g)
|
||||||
120 2
|
120 2
|
||||||
121 2
|
121 2
|
||||||
|
explain extended SELECT fid, NumGeometries(g) from mpt;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE mpt ALL NULL NULL NULL NULL 3
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority test.mpt.fid AS `fid`,numgeometries(test.mpt.g) AS `NumGeometries(g)` from test.mpt
|
||||||
SELECT fid, AsText(GeometryN(g, 2)) from mpt;
|
SELECT fid, AsText(GeometryN(g, 2)) from mpt;
|
||||||
fid AsText(GeometryN(g, 2))
|
fid AsText(GeometryN(g, 2))
|
||||||
111 POINT(10 10)
|
111 POINT(10 10)
|
||||||
@@ -344,6 +369,11 @@ SELECT fid, AsText(GeometryN(g, 2)) from gc;
|
|||||||
fid AsText(GeometryN(g, 2))
|
fid AsText(GeometryN(g, 2))
|
||||||
120 LINESTRING(0 0,10 10)
|
120 LINESTRING(0 0,10 10)
|
||||||
121 LINESTRING(3 6,7 9)
|
121 LINESTRING(3 6,7 9)
|
||||||
|
explain extended SELECT fid, AsText(GeometryN(g, 2)) from mpt;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE mpt ALL NULL NULL NULL NULL 3
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority test.mpt.fid AS `fid`,astext(geometryn(test.mpt.g,2)) AS `AsText(GeometryN(g, 2))` from test.mpt
|
||||||
SELECT g1.fid as first, g2.fid as second,
|
SELECT g1.fid as first, g2.fid as second,
|
||||||
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
||||||
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
||||||
@@ -354,6 +384,16 @@ first second w c o e d t i r
|
|||||||
120 121 0 0 0 0 0 0 1 0
|
120 121 0 0 0 0 0 0 1 0
|
||||||
121 120 0 0 1 0 0 0 1 0
|
121 120 0 0 1 0 0 0 1 0
|
||||||
121 121 1 1 0 1 0 0 1 0
|
121 121 1 1 0 1 0 0 1 0
|
||||||
|
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||||
|
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
||||||
|
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
||||||
|
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
|
||||||
|
FROM gc g1, gc g2 ORDER BY first, second;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE g1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
|
||||||
|
1 SIMPLE g2 ALL NULL NULL NULL NULL 2
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority test.g1.fid AS `first`,test.g2.fid AS `second`,within(test.g1.g,test.g2.g) AS `w`,contains(test.g1.g,test.g2.g) AS `c`,overlaps(test.g1.g,test.g2.g) AS `o`,equals(test.g1.g,test.g2.g) AS `e`,disjoint(test.g1.g,test.g2.g) AS `d`,touches(test.g1.g,test.g2.g) AS `t`,intersects(test.g1.g,test.g2.g) AS `i`,crosses(test.g1.g,test.g2.g) AS `r` from test.gc g1 join test.gc g2 order by test.g1.fid,test.g2.fid
|
||||||
DROP TABLE pt, ls, p, mpt, mls, mp, gc, geo;
|
DROP TABLE pt, ls, p, mpt, mls, mp, gc, geo;
|
||||||
CREATE TABLE g1 (
|
CREATE TABLE g1 (
|
||||||
pt point,
|
pt point,
|
||||||
@@ -391,3 +431,26 @@ DROP TABLE g1;
|
|||||||
SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
|
SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
|
||||||
AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))
|
AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))
|
||||||
POINT(1 4)
|
POINT(1 4)
|
||||||
|
explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))`
|
||||||
|
explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))));
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))))`
|
||||||
|
SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
|
||||||
|
SRID(GeomFromText('LineString(1 1,2 2)',101))
|
||||||
|
101
|
||||||
|
explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority srid(geometryfromtext(_latin1'LineString(1 1,2 2)',101)) AS `SRID(GeomFromText('LineString(1 1,2 2)',101))`
|
||||||
|
explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6));
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority issimple(multipoint(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,issimple(point(3,6)) AS `issimple(Point(3, 6))`
|
||||||
|
@@ -284,9 +284,11 @@ select spid,count(*) from t1 where spid between 1 and 2 group by spid desc;
|
|||||||
spid count(*)
|
spid count(*)
|
||||||
2 2
|
2 2
|
||||||
1 1
|
1 1
|
||||||
explain select sql_big_result spid,sum(userid) from t1 group by spid desc;
|
explain extended select sql_big_result spid,sum(userid) from t1 group by spid desc;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using filesort
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using filesort
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority big_result test.t1.spID AS `spid`,sum(test.t1.userID) AS `sum(userid)` from test.t1 group by test.t1.spID desc
|
||||||
explain select sql_big_result spid,sum(userid) from t1 group by spid desc order by null;
|
explain select sql_big_result spid,sum(userid) from t1 group by spid desc order by null;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 8
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 8
|
||||||
|
@@ -8,6 +8,11 @@ b
|
|||||||
select count(a) as b from t1 where a=0 having b >=0;
|
select count(a) as b from t1 where a=0 having b >=0;
|
||||||
b
|
b
|
||||||
0
|
0
|
||||||
|
explain extended select count(a) as b from t1 where a=0 having b >=0;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority count(test.t1.a) AS `b` from test.t1 where (test.t1.a = 0) having (count(test.t1.a) >= 0)
|
||||||
drop table t1;
|
drop table t1;
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
raw_id int(10) NOT NULL default '0',
|
raw_id int(10) NOT NULL default '0',
|
||||||
|
@@ -56,4 +56,14 @@ a b c VALUES(a)
|
|||||||
5 0 30 NULL
|
5 0 30 NULL
|
||||||
8 9 60 NULL
|
8 9 60 NULL
|
||||||
2 1 11 NULL
|
2 1 11 NULL
|
||||||
|
explain extended SELECT *, VALUES(a) FROM t1;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c`,values(test.t1.a) AS `VALUES(a)` from test.t1
|
||||||
|
explain extended select * from t1 where values(a);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c` from test.t1
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
@@ -5,7 +5,7 @@ INSERT INTO t1 VALUES (1), (2);
|
|||||||
<mysqldump>
|
<mysqldump>
|
||||||
<database name="test">
|
<database name="test">
|
||||||
<table_structure name="t1">
|
<table_structure name="t1">
|
||||||
<field Field="a" Type="int(11)" Null="YES" />
|
<field Field="a" Type="int(11)" Null="YES" Key="" Extra="" />
|
||||||
</table_structure>
|
</table_structure>
|
||||||
<table_data name="t1">
|
<table_data name="t1">
|
||||||
<row>
|
<row>
|
||||||
@@ -18,15 +18,40 @@ INSERT INTO t1 VALUES (1), (2);
|
|||||||
</database>
|
</database>
|
||||||
</mysqldump>
|
</mysqldump>
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE `"t"1` (`a"b"` char(2));
|
CREATE TABLE t1(a int, b text, c varchar(3));
|
||||||
INSERT INTO `"t"1` VALUES ("1\""), ("\"2");
|
INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<mysqldump>
|
<mysqldump>
|
||||||
<database name="test">
|
<database name="test">
|
||||||
<table_structure name=""t"1">
|
<table_structure name="t1">
|
||||||
<field Field="a"b"" Type="char(2)" Null="YES" />
|
<field Field="a" Type="int(11)" Null="YES" Key="" Extra="" />
|
||||||
|
<field Field="b" Type="text" Null="YES" Key="" Extra="" />
|
||||||
|
<field Field="c" Type="char(3)" Null="YES" Key="" Extra="" />
|
||||||
</table_structure>
|
</table_structure>
|
||||||
<table_data name=""t"1">
|
<table_data name="t1">
|
||||||
|
<row>
|
||||||
|
<field name="a">1</field>
|
||||||
|
<field name="b">test</field>
|
||||||
|
<field name="c">tes</field>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<field name="a">2</field>
|
||||||
|
<field name="b">TEST</field>
|
||||||
|
<field name="c">TES</field>
|
||||||
|
</row>
|
||||||
|
</table_data>
|
||||||
|
</database>
|
||||||
|
</mysqldump>
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (`a"b"` char(2));
|
||||||
|
INSERT INTO t1 VALUES ("1\""), ("\"2");
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<mysqldump>
|
||||||
|
<database name="test">
|
||||||
|
<table_structure name="t1">
|
||||||
|
<field Field="a"b"" Type="char(2)" Null="YES" Key="" Extra="" />
|
||||||
|
</table_structure>
|
||||||
|
<table_data name="t1">
|
||||||
<row>
|
<row>
|
||||||
<field name="a"b"">1"</field>
|
<field name="a"b"">1"</field>
|
||||||
</row>
|
</row>
|
||||||
@@ -36,4 +61,4 @@ INSERT INTO `"t"1` VALUES ("1\""), ("\"2");
|
|||||||
</table_data>
|
</table_data>
|
||||||
</database>
|
</database>
|
||||||
</mysqldump>
|
</mysqldump>
|
||||||
DROP TABLE `"t"1`;
|
DROP TABLE t1;
|
||||||
|
@@ -2,6 +2,11 @@ drop table if exists t1;
|
|||||||
select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null;
|
select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null;
|
||||||
NULL NULL isnull(null) isnull(1/0) isnull(1/0 = null) ifnull(null,1) ifnull(null,"TRUE") ifnull("TRUE","ERROR") 1/0 is null 1 is not null
|
NULL NULL isnull(null) isnull(1/0) isnull(1/0 = null) ifnull(null,1) ifnull(null,"TRUE") ifnull("TRUE","ERROR") 1/0 is null 1 is not null
|
||||||
NULL NULL 1 1 1 1 TRUE TRUE 1 1
|
NULL NULL 1 1 1 1 TRUE TRUE 1 1
|
||||||
|
explain extended select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority NULL AS `NULL`,NULL AS `NULL`,isnull(NULL) AS `isnull(null)`,isnull((1 / 0)) AS `isnull(1/0)`,isnull(((1 / 0) = NULL)) AS `isnull(1/0 = null)`,ifnull(NULL,1) AS `ifnull(null,1)`,ifnull(NULL,_latin1'TRUE') AS `ifnull(null,"TRUE")`,ifnull(_latin1'TRUE',_latin1'ERROR') AS `ifnull("TRUE","ERROR")`,isnull((1 / 0)) AS `1/0 is null`,(1 is not null) AS `1 is not null`
|
||||||
select 1 | NULL,1 & NULL,1+NULL,1-NULL;
|
select 1 | NULL,1 & NULL,1+NULL,1-NULL;
|
||||||
1 | NULL 1 & NULL 1+NULL 1-NULL
|
1 | NULL 1 & NULL 1+NULL 1-NULL
|
||||||
NULL NULL NULL NULL
|
NULL NULL NULL NULL
|
||||||
@@ -23,6 +28,11 @@ field(NULL,"a","b","c")
|
|||||||
select 2 between null and 1,2 between 3 AND NULL,NULL between 1 and 2,2 between NULL and 3, 2 between 1 AND null;
|
select 2 between null and 1,2 between 3 AND NULL,NULL between 1 and 2,2 between NULL and 3, 2 between 1 AND null;
|
||||||
2 between null and 1 2 between 3 AND NULL NULL between 1 and 2 2 between NULL and 3 2 between 1 AND null
|
2 between null and 1 2 between 3 AND NULL NULL between 1 and 2 2 between NULL and 3 2 between 1 AND null
|
||||||
0 0 NULL NULL NULL
|
0 0 NULL NULL NULL
|
||||||
|
explain extended select 2 between null and 1,2 between 3 AND NULL,NULL between 1 and 2,2 between NULL and 3, 2 between 1 AND null;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority (2 between NULL and 1) AS `2 between null and 1`,(2 between 3 and NULL) AS `2 between 3 AND NULL`,(NULL between 1 and 2) AS `NULL between 1 and 2`,(2 between NULL and 3) AS `2 between NULL and 3`,(2 between 1 and NULL) AS `2 between 1 AND null`
|
||||||
SELECT NULL AND NULL, 1 AND NULL, NULL AND 1, NULL OR NULL, 0 OR NULL, NULL OR 0;
|
SELECT NULL AND NULL, 1 AND NULL, NULL AND 1, NULL OR NULL, 0 OR NULL, NULL OR 0;
|
||||||
NULL AND NULL 1 AND NULL NULL AND 1 NULL OR NULL 0 OR NULL NULL OR 0
|
NULL AND NULL 1 AND NULL NULL AND 1 NULL OR NULL 0 OR NULL NULL OR 0
|
||||||
NULL NULL NULL NULL NULL NULL
|
NULL NULL NULL NULL NULL NULL
|
||||||
@@ -35,6 +45,11 @@ NULL AND 0 0 and NULL
|
|||||||
select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton("");
|
select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton("");
|
||||||
inet_ntoa(null) inet_aton(null) inet_aton("122.256") inet_aton("122.226.") inet_aton("")
|
inet_ntoa(null) inet_aton(null) inet_aton("122.256") inet_aton("122.226.") inet_aton("")
|
||||||
NULL NULL NULL NULL NULL
|
NULL NULL NULL NULL NULL
|
||||||
|
explain extended select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton("");
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select high_priority inet_ntoa(NULL) AS `inet_ntoa(null)`,inet_aton(NULL) AS `inet_aton(null)`,inet_aton(_latin1'122.256') AS `inet_aton("122.256")`,inet_aton(_latin1'122.226.') AS `inet_aton("122.226.")`,inet_aton(_latin1'') AS `inet_aton("")`
|
||||||
create table t1 (x int);
|
create table t1 (x int);
|
||||||
insert into t1 values (null);
|
insert into t1 values (null);
|
||||||
select * from t1 where x != 0;
|
select * from t1 where x != 0;
|
||||||
|
@@ -153,12 +153,12 @@ a b
|
|||||||
7 NULL
|
7 NULL
|
||||||
explain select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
|
explain select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref_or_null a,b a 5 const 4 Using where; Using index
|
1 SIMPLE t1 range a,b a 10 NULL 3 Using where; Using index
|
||||||
select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
|
select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
|
||||||
a b
|
a b
|
||||||
|
NULL 7
|
||||||
7 NULL
|
7 NULL
|
||||||
7 7
|
7 7
|
||||||
NULL 7
|
|
||||||
explain select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
|
explain select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ref_or_null a a 5 const 5 Using where; Using index
|
1 SIMPLE t1 ref_or_null a a 5 const 5 Using where; Using index
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user