Merge 4.1 into 5.0.

BitKeeper/etc/logging_ok:
  auto-union
configure.in:
  Auto merged
BitKeeper/deleted/.del-opt_ft.cc~2048ffa561f9c59:
  Auto merged
BitKeeper/deleted/.del-opt_ft.h~24aac1d29304599a:
  Auto merged
client/mysql.cc:
  Auto merged
include/my_global.h:
  Auto merged
libmysql/libmysql.c:
  Auto merged
libmysqld/Makefile.am:
  Auto merged
libmysqld/lib_sql.cc:
  Auto merged
myisam/mi_check.c:
  Auto merged
mysql-test/install_test_db.sh:
  Auto merged
mysql-test/r/multi_update.result:
  Auto merged
mysql-test/r/mysqldump.result:
  Auto merged
mysql-test/r/null.result:
  Auto merged
mysql-test/r/show_check.result:
  Auto merged
mysql-test/r/subselect.result:
  Auto merged
mysql-test/r/symlink.result:
  Auto merged
mysql-test/t/multi_update.test:
  Auto merged
mysql-test/t/null.test:
  Auto merged
mysql-test/t/rpl_until.test:
  Auto merged
mysql-test/t/subselect.test:
  Auto merged
sql/Makefile.am:
  Auto merged
sql/filesort.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_cmpfunc.h:
  Auto merged
sql/item_create.cc:
  Auto merged
sql/item_create.h:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/item_sum.h:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/protocol.cc:
  Auto merged
sql/repl_failsafe.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/slave.cc:
  Auto merged
sql/slave.h:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_cache.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_db.cc:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_derived.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_list.h:
  Auto merged
sql/sql_load.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_select.h:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_union.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
sql-common/client.c:
  Auto merged
This commit is contained in:
unknown 2004-02-10 18:44:02 +01:00
commit 6efd76f317
253 changed files with 5962 additions and 2607 deletions

View File

@ -0,0 +1,13 @@
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$pentium_configs $debug_configs"
extra_configs="$extra_configs --with-berkeley-db --with-innodb --without-isam --with-openssl --with-raid"
. "$path/FINISH.sh"

View File

@ -16,6 +16,7 @@ arjen@george.bitbike.com
bar@bar.intranet.mysql.r18.ru
bar@bar.mysql.r18.ru
bar@bar.udmsearch.izhnet.ru
bar@deer.(none)
bar@gw.udmsearch.izhnet.ru
bell@laptop.sanja.is.com.ua
bell@sanja.is.com.ua
@ -54,6 +55,7 @@ jani@linux.local
jani@rhols221.adsl.netsonic.fi
jani@rhols221.arenanet.fi
jani@ua126d19.elisa.omakaista.fi
jani@ua141d10.elisa.omakaista.fi
jani@ua167d18.elisa.omakaista.fi
jcole@abel.spaceapes.com
jcole@main.burghcom.com

View File

@ -92,6 +92,28 @@ EXPORTS
mysql_thread_safe
mysql_use_result
mysql_warning_count
mysql_prepare
mysql_execute
mysql_param_count
mysql_bind_param
mysql_bind_result
mysql_fetch
mysql_fetch_column
mysql_send_long_data
mysql_get_metadata
mysql_param_result
mysql_stmt_close
mysql_stmt_reset
mysql_stmt_free_result
mysql_stmt_errno
mysql_stmt_error
mysql_stmt_sqlstate
mysql_stmt_affected_rows
mysql_stmt_store_result
mysql_stmt_row_seek
mysql_stmt_row_tell
mysql_stmt_data_seek
mysql_stmt_num_rows
net_buffer_length
set_dynamic
strcend

View File

@ -26,18 +26,21 @@
/* We have to define 'enum options' identical in all files to keep OS2 happy */
enum options_client { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET,
OPT_PAGER, OPT_NOPAGER, OPT_TEE, OPT_NOTEE,
OPT_LOW_PRIORITY, OPT_AUTO_REPAIR, OPT_COMPRESS,
OPT_DROP, OPT_LOCKS, OPT_KEYWORDS, OPT_DELAYED, OPT_OPTIMIZE,
OPT_FTB, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC, OPT_TABLES,
OPT_MASTER_DATA, OPT_AUTOCOMMIT, OPT_AUTO_REHASH,
OPT_LINE_NUMBERS, OPT_COLUMN_NAMES, OPT_CONNECT_TIMEOUT,
OPT_MAX_ALLOWED_PACKET, OPT_NET_BUFFER_LENGTH,
OPT_SELECT_LIMIT, OPT_MAX_JOIN_SIZE, OPT_SSL_SSL,
OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_CAPATH,
OPT_SSL_CIPHER, OPT_SHUTDOWN_TIMEOUT, OPT_LOCAL_INFILE,
OPT_DELETE_MASTER_LOGS,
OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL,
OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION,
OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH };
enum options_client
{
OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET,
OPT_PAGER, OPT_NOPAGER, OPT_TEE, OPT_NOTEE,
OPT_LOW_PRIORITY, OPT_AUTO_REPAIR, OPT_COMPRESS,
OPT_DROP, OPT_LOCKS, OPT_KEYWORDS, OPT_DELAYED, OPT_OPTIMIZE,
OPT_FTB, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC, OPT_TABLES,
OPT_MASTER_DATA, OPT_AUTOCOMMIT, OPT_AUTO_REHASH,
OPT_LINE_NUMBERS, OPT_COLUMN_NAMES, OPT_CONNECT_TIMEOUT,
OPT_MAX_ALLOWED_PACKET, OPT_NET_BUFFER_LENGTH,
OPT_SELECT_LIMIT, OPT_MAX_JOIN_SIZE, OPT_SSL_SSL,
OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_CAPATH,
OPT_SSL_CIPHER, OPT_SHUTDOWN_TIMEOUT, OPT_LOCAL_INFILE,
OPT_DELETE_MASTER_LOGS, OPT_COMPACT,
OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL,
OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION,
OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH,
};

View File

@ -44,7 +44,7 @@
#include <locale.h>
#endif
const char *VER= "14.3";
const char *VER= "14.5";
/* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024
@ -134,7 +134,8 @@ static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
vertical=0, line_numbers=1, column_names=1,opt_html=0,
opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0,
tty_password= 0, opt_nobeep=0, opt_reconnect=1,
default_charset_used= 0, opt_secure_auth= 0;
default_charset_used= 0, opt_secure_auth= 0,
default_pager_set= 0;
static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0;
static my_string opt_mysql_unix_port=0;
static int connect_flag=CLIENT_INTERACTIVE;
@ -173,9 +174,7 @@ static CHARSET_INFO *charset_info= &my_charset_latin1;
#include "sslopt-vars.h"
#ifndef DBUG_OFF
const char *default_dbug_option="d:t:o,/tmp/mysql.trace";
#endif
void tee_fprintf(FILE *file, const char *fmt, ...);
void tee_fputs(const char *s, FILE *file);
@ -227,11 +226,12 @@ typedef struct {
} COMMANDS;
static COMMANDS commands[] = {
{ "help", 'h', com_help, 1, "Display this help." },
{ "?", '?', com_help, 1, "Synonym for `help'." },
{ "clear", 'c', com_clear, 0, "Clear command."},
{ "connect",'r', com_connect,1,
"Reconnect to the server. Optional arguments are db and host." },
{ "delimiter", 'd', com_delimiter, 1,
"Set query delimiter. " },
#ifdef USE_POPEN
{ "edit", 'e', com_edit, 0, "Edit command with $EDITOR."},
#endif
@ -239,6 +239,7 @@ static COMMANDS commands[] = {
"Send command to mysql server, display result vertically."},
{ "exit", 'q', com_quit, 0, "Exit mysql. Same as quit."},
{ "go", 'g', com_go, 0, "Send command to mysql server." },
{ "help", 'h', com_help, 1, "Display this help." },
#ifdef USE_POPEN
{ "nopager",'n', com_nopager,0, "Disable pager, print to stdout." },
#endif
@ -261,8 +262,6 @@ static COMMANDS commands[] = {
"Set outfile [to_outfile]. Append everything into given outfile." },
{ "use", 'u', com_use, 1,
"Use another database. Takes database name as argument." },
{ "delimiter", 'd', com_delimiter, 1,
"Set query delimiter. " },
/* Get bash-like expansion for some commands */
{ "create table", 0, 0, 0, ""},
{ "create database", 0, 0, 0, ""},
@ -331,8 +330,11 @@ int main(int argc,char *argv[])
strmov(pager, "stdout"); // the default, if --pager wasn't given
{
char *tmp=getenv("PAGER");
if (tmp)
strmov(default_pager,tmp);
if (tmp && strlen(tmp))
{
default_pager_set= 1;
strmov(default_pager, tmp);
}
}
if (!isatty(0) || !isatty(1))
{
@ -467,6 +469,8 @@ static struct my_option my_long_options[] =
{
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
0, 0, 0, 0, 0},
{"help", 'I', "Synonym for -?", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
0, 0, 0, 0, 0},
{"auto-rehash", OPT_AUTO_REHASH,
"Enable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time. Disable with --disable-auto-rehash.",
(gptr*) &rehash, (gptr*) &rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
@ -484,8 +488,11 @@ static struct my_option my_long_options[] =
{"compress", 'C', "Use compression in server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
#ifndef DBUG_OFF
{"debug", '#', "Output debug log.", (gptr*) &default_dbug_option,
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit",
0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
{"debug", '#', "Output debug log", (gptr*) &default_dbug_option,
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"database", 'D', "Database to use.", (gptr*) &current_db,
@ -608,19 +615,27 @@ static struct my_option my_long_options[] =
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"wait", 'w', "Wait and retry if connection is down.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"connect_timeout", OPT_CONNECT_TIMEOUT, "", (gptr*) &opt_connect_timeout,
{"connect_timeout", OPT_CONNECT_TIMEOUT,
"Number of seconds before connection timeout.",
(gptr*) &opt_connect_timeout,
(gptr*) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0,
0, 1},
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "",
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
"Max packet length to send to, or receive from server",
(gptr*) &max_allowed_packet, (gptr*) &max_allowed_packet, 0, GET_ULONG,
REQUIRED_ARG, 16 *1024L*1024L, 4096, (longlong) 2*1024L*1024L*1024L,
MALLOC_OVERHEAD, 1024, 0},
{"net_buffer_length", OPT_NET_BUFFER_LENGTH, "",
{"net_buffer_length", OPT_NET_BUFFER_LENGTH,
"Buffer for TCP/IP and socket communication",
(gptr*) &net_buffer_length, (gptr*) &net_buffer_length, 0, GET_ULONG,
REQUIRED_ARG, 16384, 1024, 512*1024*1024L, MALLOC_OVERHEAD, 1024, 0},
{"select_limit", OPT_SELECT_LIMIT, "", (gptr*) &select_limit,
{"select_limit", OPT_SELECT_LIMIT,
"Automatic limit for SELECT when using --safe-updates",
(gptr*) &select_limit,
(gptr*) &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L, 1, ~0L, 0, 1, 0},
{"max_join_size", OPT_MAX_JOIN_SIZE, "", (gptr*) &max_join_size,
{"max_join_size", OPT_MAX_JOIN_SIZE,
"Automatic limit for rows in a join when using --safe-updates",
(gptr*) &max_join_size,
(gptr*) &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L, 1, ~0L, 0, 1,
0},
{"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it"
@ -689,11 +704,16 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
else
{
opt_nopager= 0;
if (argument)
if (argument && strlen(argument))
{
default_pager_set= 1;
strmov(pager, argument);
else
strmov(default_pager, pager);
}
else if (default_pager_set)
strmov(pager, default_pager);
strmov(default_pager, pager);
else
opt_nopager= 1;
}
break;
case OPT_NOPAGER:
@ -814,6 +834,7 @@ static int get_options(int argc, char **argv)
strmov(default_pager, "stdout");
strmov(pager, "stdout");
opt_nopager= 1;
default_pager_set= 0;
opt_outfile= 0;
opt_reconnect= 0;
connect_flag= 0; /* Not in interactive mode */
@ -1535,7 +1556,7 @@ static int com_server_help(String *buffer __attribute__((unused)),
init_pager();
char last_char;
int num_name, num_cat;
int num_name= 0, num_cat= 0;
LINT_INIT(num_name);
LINT_INIT(num_cat);
@ -1577,8 +1598,8 @@ static int
com_help(String *buffer __attribute__((unused)),
char *line __attribute__((unused)))
{
reg1 int i;
char * help_arg= strchr(line,' ');
reg1 int i, j;
char * help_arg= strchr(line,' '), buff[32], *end;
if (help_arg)
return com_server_help(buffer,line,help_arg+1);
@ -1591,8 +1612,11 @@ com_help(String *buffer __attribute__((unused)),
put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
for (i = 0; commands[i].name; i++)
{
end= strmov(buff, commands[i].name);
for (j= strlen(commands[i].name); j < 10; j++)
end= strmov(end, " ");
if (commands[i].func)
tee_fprintf(stdout, "%s\t(\\%c)\t%s\n", commands[i].name,
tee_fprintf(stdout, "%s(\\%c) %s\n", buff,
commands[i].cmd_char, commands[i].doc);
}
if (connected && mysql_get_server_version(&mysql) >= 40100)
@ -2160,12 +2184,17 @@ com_pager(String *buffer, char *line __attribute__((unused)))
if (status.batch)
return 0;
/* Skip space from file name */
while (my_isspace(charset_info,*line))
/* Skip spaces in front of the pager command */
while (my_isspace(charset_info, *line))
line++;
if (!(param= strchr(line, ' '))) // if pager was not given, use the default
/* Skip the pager command */
param= strchr(line, ' ');
/* Skip the spaces between the command and the argument */
while (param && my_isspace(charset_info, *param))
param++;
if (!param || !strlen(param)) // if pager was not given, use the default
{
if (!default_pager[0])
if (!default_pager_set)
{
tee_fprintf(stdout, "Default pager wasn't set, using stdout.\n");
opt_nopager=1;
@ -2177,9 +2206,7 @@ com_pager(String *buffer, char *line __attribute__((unused)))
}
else
{
while (my_isspace(charset_info,*param))
param++;
end=strmake(pager_name, param, sizeof(pager_name)-1);
end= strmake(pager_name, param, sizeof(pager_name)-1);
while (end > pager_name && (my_isspace(charset_info,end[-1]) ||
my_iscntrl(charset_info,end[-1])))
end--;
@ -2188,7 +2215,7 @@ com_pager(String *buffer, char *line __attribute__((unused)))
strmov(default_pager, pager_name);
}
opt_nopager=0;
tee_fprintf(stdout, "PAGER set to %s\n", pager);
tee_fprintf(stdout, "PAGER set to '%s'\n", pager);
return 0;
}
@ -2199,6 +2226,7 @@ com_nopager(String *buffer __attribute__((unused)),
{
strmov(pager, "stdout");
opt_nopager=1;
PAGER= stdout;
tee_fprintf(stdout, "PAGER set to stdout\n");
return 0;
}
@ -2433,8 +2461,9 @@ com_delimiter(String *buffer __attribute__((unused)), char *line)
static int
com_use(String *buffer __attribute__((unused)), char *line)
{
char *tmp;
char buff[256];
char *tmp, buff[FN_REFLEN + 1];
MYSQL_RES *res;
MYSQL_ROW row;
bzero(buff, sizeof(buff));
strmov(buff, line);
@ -2444,6 +2473,31 @@ com_use(String *buffer __attribute__((unused)), char *line)
put_info("USE must be followed by a database name", INFO_ERROR);
return 0;
}
/*
We need to recheck the current database, because it may change
under our feet, for example if DROP DATABASE or RENAME DATABASE
(latter one not yet available by the time the comment was written)
*/
current_db= 0; // Let's reset current_db, assume it's gone
/*
We don't care about in case of an error below because current_db
was just set to 0.
*/
if (!mysql_query(&mysql, "SELECT DATABASE()") &&
(res= mysql_use_result(&mysql)))
{
row= mysql_fetch_row(res);
if (row[0] &&
(!current_db || cmp_database(charset_info, current_db, row[0])))
{
my_free(current_db, MYF(MY_ALLOW_ZERO_PTR));
current_db= my_strdup(row[0], MYF(MY_WME));
}
(void) mysql_fetch_row(res); // Read eof
mysql_free_result(res);
}
if (!current_db || cmp_database(charset_info, current_db, tmp))
{
if (one_database)
@ -2649,6 +2703,9 @@ com_status(String *buffer __attribute__((unused)),
char *line __attribute__((unused)))
{
const char *status;
char buff[22];
ulonglong id;
tee_puts("--------------", stdout);
usage(1); /* Print version */
if (connected)
@ -2694,6 +2751,9 @@ com_status(String *buffer __attribute__((unused)),
tee_fprintf(stdout, "Server version:\t\t%s\n", mysql_get_server_info(&mysql));
tee_fprintf(stdout, "Protocol version:\t%d\n", mysql_get_proto_info(&mysql));
tee_fprintf(stdout, "Connection:\t\t%s\n", mysql_get_host_info(&mysql));
if ((id= mysql_insert_id(&mysql)))
tee_fprintf(stdout, "Insert id:\t\t%s\n", llstr(id, buff));
tee_fprintf(stdout, "Client characterset:\t%s\n",
charset_info->name);
tee_fprintf(stdout, "Server characterset:\t%s\n", mysql.charset->name);

View File

@ -37,7 +37,7 @@
** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov
*/
#define DUMP_VERSION "10.4"
#define DUMP_VERSION "10.5"
#include <my_global.h>
#include <my_sys.h>
@ -81,7 +81,7 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick= 1, extended_insert= 1,
opt_alldbs=0,opt_create_db=0,opt_first_slave=0,opt_set_names=0,
opt_autocommit=0,opt_master_data,opt_disable_keys=1,opt_xml=0,
opt_delete_master_logs=0, tty_password=0,
opt_single_transaction=0, opt_comments= 0;
opt_single_transaction=0, opt_comments= 0, opt_compact= 0;
static MYSQL mysql_connection,*sock=0;
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
*current_host=0,*path=0,*fields_terminated=0,
@ -107,7 +107,8 @@ static CHARSET_INFO *charset_info= &my_charset_latin1;
const char *compatible_mode_names[]=
{
"MYSQL323", "MYSQL40", "POSTGRESQL", "ORACLE", "MSSQL", "DB2",
"SAPDB", "NO_KEY_OPTIONS", "NO_TABLE_OPTIONS", "NO_FIELD_OPTIONS",
"MAXDB", "NO_KEY_OPTIONS", "NO_TABLE_OPTIONS", "NO_FIELD_OPTIONS",
"ANSI",
NullS
};
TYPELIB compatible_mode_typelib= {array_elements(compatible_mode_names) - 1,
@ -136,9 +137,13 @@ static struct my_option my_long_options[] =
"Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compatible", OPT_COMPATIBLE,
"Change the dump to be compatible with a given mode. By default tables are dumped without any restrictions. Legal modes are: mysql323, mysql40, postgresql, oracle, mssql, db2, sapdb, no_key_options, no_table_options, no_field_options. One can use several modes separated by commas. Note: Requires MySQL server version 4.1.0 or higher. This option does a no operation on earlier server versions.",
"Change the dump to be compatible with a given mode. By default tables are dumped without any restrictions. Legal modes are: ansi, mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options, no_table_options, no_field_options. One can use several modes separated by commas. Note: Requires MySQL server version 4.1.0 or higher. This option does a no operation on earlier server versions.",
(gptr*) &opt_compatible_mode_str, (gptr*) &opt_compatible_mode_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compact", OPT_COMPACT,
"Give less verbose output (useful for debugging). Disables structure comments and header/footer constructs. Enables options --skip-add-drop-table --no-set-names --skip-disable-keys --skip-lock-tables",
(gptr*) &opt_compact, (gptr*) &opt_compact, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"complete-insert", 'c', "Use complete insert statements.", (gptr*) &cFlag,
(gptr*) &cFlag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
@ -239,7 +244,7 @@ static struct my_option my_long_options[] =
{"quick", 'q', "Don't buffer query, dump directly to stdout.",
(gptr*) &quick, (gptr*) &quick, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"quote-names",'Q', "Quote table and column names with backticks (`).",
(gptr*) &opt_quoted, (gptr*) &opt_quoted, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
(gptr*) &opt_quoted, (gptr*) &opt_quoted, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
0, 0},
{"result-file", 'r',
"Direct output to a given file. This option should be used in MSDOS, because it prevents new line '\\n' from being converted to '\\r\\n' (carriage return + line feed).",
@ -346,15 +351,19 @@ static void write_header(FILE *sql_file, char *db_name)
fputs("<?xml version=\"1.0\"?>\n", sql_file);
fputs("<mysqldump>\n", sql_file);
}
else if (opt_comments)
else if (!opt_compact)
{
fprintf(sql_file, "-- MySQL dump %s\n--\n", DUMP_VERSION);
fprintf(sql_file, "-- Host: %s Database: %s\n",
current_host ? current_host : "localhost", db_name ? db_name : "");
fputs("-- ------------------------------------------------------\n",
sql_file);
fprintf(sql_file, "-- Server version\t%s\n",
mysql_get_server_info(&mysql_connection));
if (opt_comments)
{
fprintf(sql_file, "-- MySQL dump %s\n--\n", DUMP_VERSION);
fprintf(sql_file, "-- Host: %s Database: %s\n",
current_host ? current_host : "localhost", db_name ? db_name :
"");
fputs("-- ------------------------------------------------------\n",
sql_file);
fprintf(sql_file, "-- Server version\t%s\n",
mysql_get_server_info(&mysql_connection));
}
if (!opt_set_names)
fprintf(sql_file,"\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=%s */;\n",default_charset);
fprintf(md_result_file,"\
@ -370,17 +379,18 @@ static void write_header(FILE *sql_file, char *db_name)
static void write_footer(FILE *sql_file)
{
if (opt_xml)
fputs("</mysqldump>", sql_file);
else
fputs("</mysqldump>\n", sql_file);
else if (!opt_compact)
{
fprintf(md_result_file,"\n\
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;\n\
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;\n\
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;\n\
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n\
");
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;\n");
if (!opt_set_names)
fprintf(md_result_file,
"/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n");
fputs("\n", sql_file);
}
fputs("\n", sql_file);
} /* write_footer */
@ -447,6 +457,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
extended_insert= opt_drop= opt_lock= quick= create_options=
opt_disable_keys= lock_tables= 0;
break;
case (int) OPT_COMPACT:
if (opt_compact)
{
opt_comments= opt_drop= opt_disable_keys= opt_lock= 0;
opt_set_names= 1;
}
case (int) OPT_TABLES:
opt_databases=0;
break;
@ -648,7 +664,7 @@ static char *quote_name(const char *name, char *buff, my_bool force)
while (*name)
{
if (*name == QUOTE_CHAR)
*to= QUOTE_CHAR;
*to++= QUOTE_CHAR;
*to++= *name++;
}
to[0]=QUOTE_CHAR;
@ -830,7 +846,7 @@ static uint getTableStructure(char *table, char* db)
char *end;
uint i;
sprintf(buff, "/*!41000 SET @@sql_mode=\"");
sprintf(buff, "/*!40100 SET @@sql_mode=\"");
end= strend(buff);
for (i= 0; opt_compatible_mode; opt_compatible_mode>>= 1, i++)
{
@ -1269,7 +1285,7 @@ static void dumpTable(uint numFields, char *table)
fprintf(md_result_file,"-- WHERE: %s\n",where);
strxmov(strend(query), " WHERE ",where,NullS);
}
if (!opt_xml)
if (!opt_xml && !opt_compact)
fputs("\n", md_result_file);
if (mysql_query(sock, query))
{
@ -1646,7 +1662,7 @@ static int dump_all_tables_in_db(char *database)
if (opt_xml)
fputs("</database>\n", md_result_file);
if (lock_tables)
mysql_query(sock,"UNLOCK_TABLES");
mysql_query(sock,"UNLOCK TABLES");
return 0;
} /* dump_all_tables_in_db */

View File

@ -415,7 +415,7 @@ int String::strstr(const String &s,uint32 offset)
register const char *search=s.ptr();
const char *end=Ptr+str_length-s.length()+1;
const char *search_end=s.ptr()+s.length();
skipp:
skip:
while (str != end)
{
if (*str++ == *search)
@ -423,7 +423,7 @@ skipp:
register char *i,*j;
i=(char*) str; j=(char*) search+1;
while (j != search_end)
if (*i++ != *j++) goto skipp;
if (*i++ != *j++) goto skip;
return (int) (str-Ptr) -1;
}
}
@ -447,7 +447,7 @@ int String::strstr_case(const String &s,uint32 offset)
register const char *search=s.ptr();
const char *end=Ptr+str_length-s.length()+1;
const char *search_end=s.ptr()+s.length();
skipp:
skip:
while (str != end)
{
if (str_charset->sort_order[*str++] == str_charset->sort_order[*search])
@ -457,7 +457,7 @@ skipp:
while (j != search_end)
if (str_charset->sort_order[*i++] !=
str_charset->sort_order[*j++])
goto skipp;
goto skip;
return (int) (str-Ptr) -1;
}
}
@ -480,7 +480,7 @@ int String::strrstr(const String &s,uint32 offset)
const char *end=Ptr+s.length()-2;
const char *search_end=s.ptr()-1;
skipp:
skip:
while (str != end)
{
if (*str-- == *search)
@ -488,7 +488,7 @@ skipp:
register char *i,*j;
i=(char*) str; j=(char*) search-1;
while (j != search_end)
if (*i-- != *j--) goto skipp;
if (*i-- != *j--) goto skip;
return (int) (i-Ptr) +1;
}
}

View File

@ -24,10 +24,21 @@ noinst_HEADERS = chared.h el.h histedit.h key.h \
hist.h map.h prompt.h search.h \
strlcpy.h libedit_term.h tty.h
EXTRA_DIST = makelist
EXTRA_DIST = makelist.sh
CLEANFILES = makelist
DEFS = -DUNDEF_THREADS_HACK -DHAVE_CONFIG_H -DNO_KILL_INTR
SUFFIXES = .sh
.sh:
@RM@ -f $@ $@-t
@SED@ \
-e 's!@''AWK''@!@AWK@!' \
$< > $@-t
@MV@ $@-t $@
vi.h: vi.c makelist
sh ./makelist -h ./vi.c > $@.tmp && \
mv $@.tmp $@

View File

@ -39,7 +39,7 @@
# makelist.sh: Automatically generate header files...
AWK=/usr/bin/awk
AWK=@AWK@
USAGE="Usage: $0 -h|-e|-fc|-fh|-bc|-bh|-m <filenames>"
if [ "x$1" = "x" ]

View File

@ -452,6 +452,9 @@ then
FIND_PROC="$PS \$\$PID | grep mysqld > /dev/null"
else
case $SYSTEM_TYPE in
*freebsd*)
FIND_PROC="$PS p \$\$PID | grep mysqld > /dev/null"
;;
*darwin*)
FIND_PROC="$PS -uaxww | grep mysqld | grep \" \$\$PID \" > /dev/null"
;;

View File

@ -1640,7 +1640,7 @@ static char *static_strtok (char *s1, pchar separator)
cpy--; /* Point at separator */
break;
}
end++; /* Two separators in a row, skipp one */
end++; /* Two separators in a row, skip one */
}
} while (*end != EOS);
*cpy=EOS; /* Replace last separator */

View File

@ -144,6 +144,8 @@ typedef struct my_charset_handler_st
int (*mbcharlen)(struct charset_info_st *, uint);
uint (*numchars)(struct charset_info_st *, const char *b, const char *e);
uint (*charpos)(struct charset_info_st *, const char *b, const char *e, uint pos);
uint (*wellformedlen)(struct charset_info_st *,
const char *b,const char *e, uint nchars);
uint (*lengthsp)(struct charset_info_st *, const char *ptr, uint length);
/* Unicode convertion */
@ -206,8 +208,9 @@ typedef struct charset_info_st
uchar state_map[256];
uchar ident_map[256];
uint strxfrm_multiply;
uint mbminlen;
uint mbmaxlen;
char max_sort_char; /* For LIKE optimization */
char max_sort_char; /* For LIKE optimization */
MY_CHARSET_HANDLER *cset;
MY_COLLATION_HANDLER *coll;
@ -310,6 +313,7 @@ int my_wildcmp_8bit(CHARSET_INFO *,
uint my_numchars_8bit(CHARSET_INFO *, const char *b, const char *e);
uint my_charpos_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos);
uint my_wellformedlen_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos);
int my_mbcharlen_8bit(CHARSET_INFO *, uint c);
@ -326,6 +330,7 @@ int my_wildcmp_mb(CHARSET_INFO *,
int escape, int w_one, int w_many);
uint my_numchars_mb(CHARSET_INFO *, const char *b, const char *e);
uint my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
uint my_wellformedlen_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
uint my_instr_mb(struct charset_info_st *,
const char *b, uint b_length,
const char *s, uint s_length,

View File

@ -17,11 +17,12 @@
C_MODE_START
enum get_opt_var_type { GET_NO_ARG, GET_BOOL, GET_INT, GET_UINT, GET_LONG,
GET_ULONG, GET_LL, GET_ULL, GET_STR, GET_STR_ALLOC
GET_ULONG, GET_LL, GET_ULL, GET_STR, GET_STR_ALLOC,
GET_DISABLED
};
#define GET_ASK_ADDR 128
#define GET_TYPE_MASK 127
#define GET_ASK_ADDR 128
#define GET_TYPE_MASK 127
enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG };

View File

@ -1186,4 +1186,6 @@ typedef union {
#define MYSQL_UNIVERSAL_CLIENT_CHARSET MYSQL_DEFAULT_CHARSET_NAME
#endif
#define HAVE_SPATIAL
#define HAVE_RTREE_KEYS
#endif /* my_global_h */

View File

@ -32,6 +32,4 @@
#undef MYSQL_SERVER_SUFFIX
#define MYSQL_SERVER_SUFFIX "-embedded"
#undef HAVE_QUERY_CACHE /* Cache dosn't work yet */
#endif /* EMBEDDED_LIBRARY */

View File

@ -303,37 +303,40 @@
#define ER_WARN_HOSTNAME_WONT_WORK 1284
#define ER_UNKNOWN_STORAGE_ENGINE 1285
#define ER_WARN_DEPRECATED_SYNTAX 1286
#define ER_SP_NO_RECURSIVE_CREATE 1287
#define ER_SP_ALREADY_EXISTS 1288
#define ER_SP_DOES_NOT_EXIST 1289
#define ER_SP_DROP_FAILED 1290
#define ER_SP_STORE_FAILED 1291
#define ER_SP_LILABEL_MISMATCH 1292
#define ER_SP_LABEL_REDEFINE 1293
#define ER_SP_LABEL_MISMATCH 1294
#define ER_SP_UNINIT_VAR 1295
#define ER_SP_BADSELECT 1296
#define ER_SP_BADRETURN 1297
#define ER_SP_BADSTATEMENT 1298
#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1299
#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1300
#define ER_QUERY_INTERRUPTED 1301
#define ER_SP_WRONG_NO_OF_ARGS 1302
#define ER_SP_COND_MISMATCH 1303
#define ER_SP_NORETURN 1304
#define ER_SP_NORETURNEND 1305
#define ER_SP_BAD_CURSOR_QUERY 1306
#define ER_SP_BAD_CURSOR_SELECT 1307
#define ER_SP_CURSOR_MISMATCH 1308
#define ER_SP_CURSOR_ALREADY_OPEN 1309
#define ER_SP_CURSOR_NOT_OPEN 1310
#define ER_SP_UNDECLARED_VAR 1311
#define ER_SP_WRONG_NO_OF_FETCH_ARGS 1312
#define ER_SP_FETCH_NO_DATA 1313
#define ER_SP_DUP_PARAM 1314
#define ER_SP_DUP_VAR 1315
#define ER_SP_DUP_COND 1316
#define ER_SP_DUP_CURS 1317
#define ER_SP_CANT_ALTER 1318
#define ER_SP_SUBSELECT_NYI 1319
#define ER_ERROR_MESSAGES 320
#define ER_NON_UPDATABLE_TABLE 1287
#define ER_FEATURE_DISABLED 1288
#define ER_SKIP_GRANT_TABLES 1289
#define ER_SP_NO_RECURSIVE_CREATE 1290
#define ER_SP_ALREADY_EXISTS 1291
#define ER_SP_DOES_NOT_EXIST 1292
#define ER_SP_DROP_FAILED 1293
#define ER_SP_STORE_FAILED 1294
#define ER_SP_LILABEL_MISMATCH 1295
#define ER_SP_LABEL_REDEFINE 1296
#define ER_SP_LABEL_MISMATCH 1297
#define ER_SP_UNINIT_VAR 1298
#define ER_SP_BADSELECT 1299
#define ER_SP_BADRETURN 1300
#define ER_SP_BADSTATEMENT 1301
#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1302
#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1303
#define ER_QUERY_INTERRUPTED 1304
#define ER_SP_WRONG_NO_OF_ARGS 1305
#define ER_SP_COND_MISMATCH 1306
#define ER_SP_NORETURN 1307
#define ER_SP_NORETURNEND 1308
#define ER_SP_BAD_CURSOR_QUERY 1309
#define ER_SP_BAD_CURSOR_SELECT 1310
#define ER_SP_CURSOR_MISMATCH 1311
#define ER_SP_CURSOR_ALREADY_OPEN 1312
#define ER_SP_CURSOR_NOT_OPEN 1313
#define ER_SP_UNDECLARED_VAR 1314
#define ER_SP_WRONG_NO_OF_FETCH_ARGS 1315
#define ER_SP_FETCH_NO_DATA 1316
#define ER_SP_DUP_PARAM 1317
#define ER_SP_DUP_VAR 1318
#define ER_SP_DUP_COND 1319
#define ER_SP_DUP_CURS 1320
#define ER_SP_CANT_ALTER 1321
#define ER_SP_SUBSELECT_NYI 1322
#define ER_ERROR_MESSAGES 323

View File

@ -68,6 +68,7 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */
#define EXIT_UNKNOWN_SUFFIX 9
#define EXIT_NO_PTR_TO_VARIABLE 10
#define EXIT_CANNOT_CONNECT_TO_SERVICE 11
#define EXIT_OPTION_DISABLED 12
#ifdef __cplusplus

View File

@ -48,9 +48,12 @@ insert buffer tree, and that is in the system tablespace of InnoDB.
1. The first field is the space id.
2. The second field is a one-byte marker which differentiates records from
the < 4.1.x storage format.
3. The third field contains the type info, where we have also added 2 bytes to
store the charset.
4. The rest of the fields contain the fields of the actual index record.
3. The third field is the page number.
4. The fourth field contains the type info, where we have also added 2 bytes to
store the charset. In the compressed table format of 5.0.x we must add more
information here so that we can build a dummy 'index' struct which 5.0.x
can use in the binary search on the index page in the ibuf merge phase.
5. The rest of the fields contain the fields of the actual index record.
*/

View File

@ -15,6 +15,8 @@ Created 9/20/1997 Heikki Tuuri
#include "hash0hash.h"
#include "log0log.h"
extern ibool recv_replay_file_ops;
/***********************************************************************
Reads the checkpoint info needed in hot backup. */

View File

@ -34,6 +34,11 @@ Created 9/20/1997 Heikki Tuuri
#include "dict0boot.h"
#include "fil0fil.h"
/* This is set to FALSE if the backup was originally taken with the
ibbackup --include regexp option: then we do not want to create tables in
directories which were not included */
ibool recv_replay_file_ops = TRUE;
/* Log records are stored in the hash table in chunks at most of this size;
this must be less than UNIV_PAGE_SIZE as it is stored in the buffer pool */
#define RECV_DATA_BLOCK_SIZE (MEM_MAX_ALLOC_IN_BUF - sizeof(recv_data_t))
@ -1974,18 +1979,21 @@ loop:
|| 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 (recv_replay_file_ops) {
/* 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,
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);
ut_a(0);
}
}
#endif
/* In normal mysqld crash recovery we do not try to

View File

@ -1447,7 +1447,7 @@ row_create_table_for_mysql(
fprintf(stderr,
" InnoDB: Error: table %s already exists in InnoDB internal\n"
"InnoDB: data dictionary. Have you deleted the .frm file\n"
"InnoDB: and not used DROPT ABLE? Have you used DROP DATABASE\n"
"InnoDB: and not used DROP TABLE? Have you used DROP DATABASE\n"
"InnoDB: for InnoDB tables in MySQL version <= 3.23.43?\n"
"InnoDB: See the Restrictions section of the InnoDB manual.\n",
table->name);

View File

@ -534,6 +534,8 @@ row_purge_parse_undo_rec(
node->table = NULL;
row_mysql_unfreeze_data_dictionary(trx);
return(FALSE);
}

View File

@ -2773,6 +2773,18 @@ row_search_for_mysql(
ut_a(0);
}
if (trx->n_mysql_tables_in_use == 0) {
char err_buf[1000];
trx_print(err_buf, trx);
fprintf(stderr,
"InnoDB: Error: MySQL is trying to perform a SELECT\n"
"InnoDB: but it has not locked any tables in ::external_lock()!\n%s\n",
err_buf);
ut_a(0);
}
/* printf("Match mode %lu\n search tuple ", match_mode);
dtuple_print(search_tuple);
@ -2891,8 +2903,6 @@ row_search_for_mysql(
mtr_start(&mtr);
mtr_start(&mtr);
/*-------------------------------------------------------------*/
/* PHASE 2: Try fast adaptive hash index search if possible */
@ -3072,6 +3082,18 @@ shortcut_fails_too_big_rec:
if (!prebuilt->sql_stat_start) {
/* No need to set an intention lock or assign a read view */
if (trx->read_view == NULL
&& prebuilt->select_lock_type == LOCK_NONE) {
char err_buf[1000];
trx_print(err_buf, trx);
fprintf(stderr,
"InnoDB: Error: MySQL is trying to perform a consistent read\n"
"InnoDB: but the read view is not assigned!\n%s\n", err_buf);
ut_a(0);
}
} else if (prebuilt->select_lock_type == LOCK_NONE) {
/* This is a consistent read */
/* Assign a read view for the query */

View File

@ -2739,8 +2739,6 @@ loop:
cnt++;
os_thread_sleep(2000000);
/* Try to track a strange bug reported by Harald Fuchs and others,
where the lsn seems to decrease at times */
@ -2782,6 +2780,8 @@ loop:
fflush(stderr);
fflush(stdout);
os_thread_sleep(2000000);
if (srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE) {
goto loop;

View File

@ -1512,12 +1512,13 @@ NetWare. */
srv_is_being_started = FALSE;
#ifdef UNIV_DEBUG
/* Wait a while so that creates threads have time to suspend themselves
before we switch sync debugging on; otherwise a thread may execute
mutex_enter() before the checks are on, and mutex_exit() after the
checks are on. */
/* Wait a while so that the created threads have time to suspend
themselves before we switch sync debugging on; otherwise a thread may
execute mutex_enter() before the checks are on, and mutex_exit() after
the checks are on, which will cause an assertion failure in sync
debug. */
os_thread_sleep(2000000);
os_thread_sleep(3000000);
#endif
sync_order_checks_on = TRUE;
@ -1603,6 +1604,19 @@ NetWare. */
fflush(stderr);
if (trx_doublewrite_must_reset_space_ids) {
/* Actually, we did not change the undo log format between
4.0 and 4.1.1, and we would not need to run purge to
completion. Note also that the purge algorithm in 4.1.1
can process the the history list again even after a full
purge, because our algorithm does not cut the end of the
history list in all cases so that it would become empty
after a full purge. That mean that we may purge 4.0 type
undo log even after this phase.
The insert buffer record format changed between 4.0 and
4.1.1. It is essential that the insert buffer is emptied
here! */
fprintf(stderr,
"InnoDB: You are upgrading to an InnoDB version which allows multiple\n"
"InnoDB: tablespaces. Wait that purge and insert buffer merge run to\n"
@ -1625,8 +1639,9 @@ NetWare. */
fprintf(stderr,
"InnoDB: You have now successfully upgraded to the multiple tablespaces\n"
"InnoDB: format. You should not downgrade again to an earlier version of\n"
"InnoDB: InnoDB!\n");
"InnoDB: format. You should NOT DOWNGRADE again to an earlier version of\n"
"InnoDB: InnoDB! But if you absolutely need to downgrade, see section 4.6 of\n"
"InnoDB: http://www.innodb.com/ibman.php for instructions.\n");
}
if (srv_force_recovery == 0) {

View File

@ -1589,7 +1589,7 @@ static my_bool my_realloc_str(NET *net, ulong length)
********************************************************************/
/*
Read the prepare statement results ..
Read the prepared statement results ..
NOTE
This is only called for connection to servers that supports
@ -1815,7 +1815,7 @@ static void store_param_type(NET *net, uint type)
/****************************************************************************
Functions to store parameter data from a prepared statement.
All functions has the following characteristics:
All functions have the following characteristics:
SYNOPSIS
store_param_xxx()
@ -1997,7 +1997,7 @@ static my_bool store_param(MYSQL_STMT *stmt, MYSQL_BIND *param)
/*
Send the prepare query to server for execution
Send the prepared query to server for execution
*/
static my_bool execute(MYSQL_STMT * stmt, char *packet, ulong length)
@ -2035,14 +2035,6 @@ int cli_stmt_execute(MYSQL_STMT *stmt)
uint null_count;
my_bool result;
#ifdef CHECK_EXTRA_ARGUMENTS
if (!stmt->param_buffers)
{
/* Parameters exists, but no bound buffers */
set_stmt_error(stmt, CR_NOT_ALL_PARAMS_BOUND, unknown_sqlstate);
DBUG_RETURN(1);
}
#endif
net_clear(net); /* Sets net->write_pos */
/* Reserve place for null-marker bytes */
null_count= (stmt->param_count+7) /8;
@ -2087,7 +2079,7 @@ int cli_stmt_execute(MYSQL_STMT *stmt)
}
/*
Execute the prepare query
Execute the prepared query
*/
int STDCALL mysql_execute(MYSQL_STMT *stmt)
@ -2099,6 +2091,14 @@ int STDCALL mysql_execute(MYSQL_STMT *stmt)
set_stmt_error(stmt, CR_NO_PREPARE_STMT, unknown_sqlstate);
DBUG_RETURN(1);
}
#ifdef CHECK_EXTRA_ARGUMENTS
if (stmt->param_count && !stmt->param_buffers)
{
/* Parameters exists, but no bound buffers */
set_stmt_error(stmt, CR_NOT_ALL_PARAMS_BOUND, unknown_sqlstate);
DBUG_RETURN(1);
}
#endif
if ((*stmt->mysql->methods->stmt_execute)(stmt))
DBUG_RETURN(1);
@ -2332,7 +2332,7 @@ mysql_send_long_data(MYSQL_STMT *stmt, uint param_number,
/****************************************************************************
Functions to fetch data to application buffers
All functions has the following characteristics:
All functions have the following characteristics:
SYNOPSIS
fetch_result_xxx()
@ -3059,12 +3059,12 @@ no_data:
/*
Fetch datat for one specified column data
Fetch data for one specified column data
SYNOPSIS
mysql_fetch_column()
stmt Prepared statement handler
bind Where date should be placed. Should be filled in as
bind Where data should be placed. Should be filled in as
when calling mysql_bind_param()
column Column to fetch (first column is 0)
ulong offset Offset in result data (to fetch blob in pieces)
@ -3492,8 +3492,8 @@ my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode)
*********************************************************************/
/*
Returns if there are any more query results exists to be read using
mysql_next_result()
Returns true/false to indicate whether any more query results exist
to be read using mysql_next_result()
*/
my_bool STDCALL mysql_more_results(MYSQL *mysql)

View File

@ -33,10 +33,10 @@ INCLUDES= @MT_INCLUDES@ @bdb_includes@ -I$(top_srcdir)/include \
noinst_LIBRARIES = libmysqld_int.a
pkglib_LIBRARIES = libmysqld.a
SUBDIRS = . examples
libmysqld_sources= libmysqld.c lib_sql.cc
libmysqld_sources= libmysqld.c lib_sql.cc emb_qcache.cc
libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c
noinst_HEADERS = embedded_priv.h
noinst_HEADERS = embedded_priv.h emb_qcache.h
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 \
@ -46,7 +46,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
item_func.cc item_strfunc.cc item_sum.cc item_timefunc.cc \
item_geofunc.cc item_uniq.cc item_subselect.cc item_row.cc\
key.cc lock.cc log.cc log_event.cc sql_state.c \
protocol.cc net_serv.cc opt_ft.cc opt_range.cc \
protocol.cc net_serv.cc opt_range.cc \
opt_sum.cc procedure.cc records.cc sql_acl.cc \
sql_load.cc sql_olap.cc \
sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc \
@ -75,7 +75,6 @@ INC_LIB= $(top_builddir)/regex/libregex.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/regex/libregex.a \
$(top_builddir)/vio/libvio.a
#

446
libmysqld/emb_qcache.cc Normal file
View File

@ -0,0 +1,446 @@
/* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mysql_priv.h"
#ifdef HAVE_QUERY_CACHE
#include <mysql.h>
#include "emb_qcache.h"
void Querycache_stream::store_char(char c)
{
if (data_end == cur_data)
use_next_block();
*(cur_data++)= c;
#ifndef DBUG_OFF
stored_size++;
#endif
}
void Querycache_stream::store_short(ushort s)
{
#ifndef DBUG_OFF
stored_size+= 2;
#endif
if (data_end - cur_data > 1)
{
int2store(cur_data, s);
cur_data+= 2;
return;
}
if (data_end == cur_data)
{
use_next_block();
int2store(cur_data, s);
cur_data+= 2;
return;
}
*cur_data= ((byte *)(&s))[0];
use_next_block();
*(cur_data++)= ((byte *)(&s))[1];
}
void Querycache_stream::store_int(uint i)
{
#ifndef DBUG_OFF
stored_size+= 4;
#endif
size_t rest_len= data_end - cur_data;
if (rest_len > 3)
{
int4store(cur_data, i);
cur_data+= 4;
return;
}
if (!rest_len)
{
use_next_block();
int4store(cur_data, i);
cur_data+= 4;
return;
}
memcpy(cur_data, &i, rest_len);
use_next_block();
memcpy(cur_data, ((byte*)&i)+rest_len, 4-rest_len);
cur_data+= 4-rest_len;
}
void Querycache_stream::store_ll(ulonglong ll)
{
#ifndef DBUG_OFF
stored_size+= 8;
#endif
size_t rest_len= data_end - cur_data;
if (rest_len > 7)
{
int8store(cur_data, ll);
cur_data+= 8;
return;
}
if (!rest_len)
{
use_next_block();
int8store(cur_data, ll);
cur_data+= 8;
return;
}
memcpy(cur_data, &ll, rest_len);
use_next_block();
memcpy(cur_data, ((byte*)&ll)+rest_len, 8-rest_len);
cur_data+= 8-rest_len;
}
void Querycache_stream::store_str_only(const char *str, uint str_len)
{
#ifndef DBUG_OFF
stored_size+= str_len;
#endif
do
{
size_t rest_len= data_end - cur_data;
if (rest_len > str_len)
{
memcpy(cur_data, str, str_len);
cur_data+= str_len;
return;
}
memcpy(cur_data, str, rest_len);
use_next_block();
str_len-= rest_len;
str+= rest_len;
} while(str_len);
}
void Querycache_stream::store_str(const char *str, uint str_len)
{
store_int(str_len);
store_str_only(str, str_len);
}
void Querycache_stream::store_safe_str(const char *str, uint str_len)
{
if (str)
{
store_int(str_len+1);
store_str_only(str, str_len);
}
else
store_int(0);
}
char Querycache_stream::load_char()
{
if (cur_data == data_end)
use_next_block();
return *(cur_data++);
}
ushort Querycache_stream::load_short()
{
ushort result;
if (data_end-cur_data > 1)
{
result= uint2korr(cur_data);
cur_data+= 2;
return result;
}
if (data_end == cur_data)
{
use_next_block();
result= uint2korr(cur_data);
cur_data+= 2;
return result;
}
((byte*)&result)[0]= *cur_data;
use_next_block();
((byte*)&result)[1]= *(cur_data++);
return result;
}
uint Querycache_stream::load_int()
{
int result;
size_t rest_len= data_end - cur_data;
if (rest_len > 3)
{
result= uint4korr(cur_data);
cur_data+= 4;
return result;
}
if (!rest_len)
{
use_next_block();
result= uint4korr(cur_data);
cur_data+= 4;
return result;
}
memcpy(&result, cur_data, rest_len);
use_next_block();
memcpy(((byte*)&result)+rest_len, cur_data, 4-rest_len);
cur_data+= 4-rest_len;
return result;
}
ulonglong Querycache_stream::load_ll()
{
ulonglong result;
size_t rest_len= data_end - cur_data;
if (rest_len > 7)
{
result= uint8korr(cur_data);
cur_data+= 8;
return result;
}
if (!rest_len)
{
use_next_block();
result= uint8korr(cur_data);
cur_data+= 8;
return result;
}
memcpy(&result, cur_data, rest_len);
use_next_block();
memcpy(((byte*)&result)+rest_len, cur_data, 8-rest_len);
cur_data+= 8-rest_len;
return result;
}
void Querycache_stream::load_str_only(char *buffer, uint str_len)
{
do
{
size_t rest_len= data_end - cur_data;
if (rest_len > str_len)
{
memcpy(buffer, cur_data, str_len);
cur_data+= str_len;
buffer+= str_len;
break;
}
memcpy(buffer, cur_data, rest_len);
use_next_block();
str_len-= rest_len;
buffer+= rest_len;
} while(str_len);
*buffer= 0;
}
char *Querycache_stream::load_str(MEM_ROOT *alloc, uint *str_len)
{
char *result;
*str_len= load_int();
if (!(result= alloc_root(alloc, *str_len + 1)))
return 0;
load_str_only(result, *str_len);
return result;
}
int Querycache_stream::load_safe_str(MEM_ROOT *alloc, char **str, uint *str_len)
{
if (!(*str_len= load_int()))
{
*str= NULL;
return 0;
}
(*str_len)--;
if (!(*str= alloc_root(alloc, *str_len + 1)))
return 1;
load_str_only(*str, *str_len);
return 0;
}
int Querycache_stream::load_column(MEM_ROOT *alloc, char** column)
{
int len;
if (!(len = load_int()))
{
*column= NULL;
return 0;
}
len--;
if (!(*column= (char *)alloc_root(alloc, len + 4 + 1)))
return 1;
int4store(*column, len);
(*column)+= 4;
load_str_only(*column, len);
return 1;
}
uint emb_count_querycache_size(THD *thd)
{
uint result;
MYSQL *mysql= thd->mysql;
MYSQL_FIELD *field= mysql->fields;
MYSQL_FIELD *field_end= field + mysql->field_count;
MYSQL_ROWS *cur_row=NULL;
my_ulonglong n_rows=0;
if (!field)
return 0;
if (thd->data)
{
*thd->data->prev_ptr= NULL; // this marks the last record
cur_row= thd->data->data;
n_rows= thd->data->rows;
}
result= 4+8 + (42 + 4*n_rows)*mysql->field_count;
for(; field < field_end; field++)
{
result+= field->name_length + field->table_length +
field->org_name_length + field->org_table_length + field->db_length +
field->catalog_length;
if (field->def)
result+= field->def_length;
}
for (; cur_row; cur_row=cur_row->next)
{
MYSQL_ROW col= cur_row->data;
MYSQL_ROW col_end= col + mysql->field_count;
for (; col < col_end; col++)
if (*col)
result+= *(uint *)((*col) - sizeof(uint));
}
return result;
}
void emb_store_querycache_result(Querycache_stream *dst, THD *thd)
{
MYSQL *mysql= thd->mysql;
MYSQL_FIELD *field= mysql->fields;
MYSQL_FIELD *field_end= field + mysql->field_count;
MYSQL_ROWS *cur_row= NULL;
my_ulonglong n_rows= 0;
if (!field)
return;
if (thd->data)
{
*thd->data->prev_ptr= NULL; // this marks the last record
cur_row= thd->data->data;
n_rows= thd->data->rows;
}
dst->store_int((uint)mysql->field_count);
dst->store_ll((uint)n_rows);
for(; field < field_end; field++)
{
dst->store_int((uint)field->length);
dst->store_int((uint)field->max_length);
dst->store_char((char)field->type);
dst->store_short((ushort)field->flags);
dst->store_short((ushort)field->charsetnr);
dst->store_char((char)field->decimals);
dst->store_str(field->name, field->name_length);
dst->store_str(field->table, field->table_length);
dst->store_str(field->org_name, field->org_name_length);
dst->store_str(field->org_table, field->org_table_length);
dst->store_str(field->db, field->db_length);
dst->store_str(field->catalog, field->catalog_length);
dst->store_safe_str(field->def, field->def_length);
}
for (; cur_row; cur_row=cur_row->next)
{
MYSQL_ROW col= cur_row->data;
MYSQL_ROW col_end= col + mysql->field_count;
for (; col < col_end; col++)
{
uint len= *col ? *(uint *)((*col) - sizeof(uint)) : 0;
dst->store_safe_str(*col, len);
}
}
DBUG_ASSERT(emb_count_querycache_size(thd) == dst->stored_size);
}
int emb_load_querycache_result(THD *thd, Querycache_stream *src)
{
MYSQL *mysql= thd->mysql;
MYSQL_DATA *data;
MYSQL_FIELD *field;
MYSQL_FIELD *field_end;
MEM_ROOT *f_alloc= &mysql->field_alloc;
MYSQL_ROWS *row, *end_row;
MYSQL_ROWS **prev_row;
ulonglong rows;
MYSQL_ROW columns;
mysql->field_count= src->load_int();
rows= src->load_ll();
if (!(field= (MYSQL_FIELD *)
alloc_root(&mysql->field_alloc,mysql->field_count*sizeof(MYSQL_FIELD))))
goto err;
mysql->fields= field;
for(field_end= field+mysql->field_count; field < field_end; field++)
{
field->length= src->load_int();
field->max_length= (unsigned int)src->load_int();
field->type= (enum enum_field_types)src->load_char();
field->flags= (unsigned int)src->load_short();
field->charsetnr= (unsigned int)src->load_short();
field->decimals= (unsigned int)src->load_char();
if (!(field->name= src->load_str(f_alloc, &field->name_length)) ||
!(field->table= src->load_str(f_alloc,&field->table_length)) ||
!(field->org_name= src->load_str(f_alloc, &field->org_name_length)) ||
!(field->org_table= src->load_str(f_alloc, &field->org_table_length))||
!(field->db= src->load_str(f_alloc, &field->db_length)) ||
!(field->catalog= src->load_str(f_alloc, &field->catalog_length)) ||
src->load_safe_str(f_alloc, &field->def, &field->def_length))
goto err;
}
if (!rows)
return 0;
if (!(data= (MYSQL_DATA*)my_malloc(sizeof(MYSQL_DATA),
MYF(MY_WME | MY_ZEROFILL))))
goto err;
thd->data= data;
init_alloc_root(&data->alloc, 8192,0);
row= (MYSQL_ROWS *)alloc_root(&data->alloc, rows * sizeof(MYSQL_ROWS) +
rows * (mysql->field_count+1)*sizeof(char*));
end_row= row + rows;
columns= (MYSQL_ROW)end_row;
data->rows= rows;
data->fields= mysql->field_count;
data->data= row;
for (prev_row= &row->next; row < end_row; prev_row= &row->next, row++)
{
*prev_row= row;
row->data= columns;
MYSQL_ROW col_end= columns + mysql->field_count;
uint len;
for (; columns < col_end; columns++)
src->load_column(&data->alloc, columns);
*(columns++)= NULL;
}
*prev_row= NULL;
data->prev_ptr= prev_row;
return 0;
err:
return 1;
}
#endif /*HAVE_QUERY_CACHE*/

61
libmysqld/emb_qcache.h Normal file
View File

@ -0,0 +1,61 @@
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
class Querycache_stream
{
byte *cur_data;
byte *data_end;
Query_cache_block *block;
uint headers_len;
public:
#ifndef DBUG_OFF
uint stored_size;
#endif
Querycache_stream(Query_cache_block *ini_block, uint ini_headers_len) :
block(ini_block), headers_len(ini_headers_len)
{
use_next_block();
#ifndef DBUG_OFF
stored_size= 0;
#endif
}
void use_next_block()
{
cur_data= ((byte*)block)+headers_len;
data_end= cur_data + (block->used-headers_len);
}
void store_char(char c);
void store_short(ushort s);
void store_int(uint i);
void store_ll(ulonglong ll);
void store_str_only(const char *str, uint str_len);
void store_str(const char *str, uint str_len);
void store_safe_str(const char *str, uint str_len);
char load_char();
ushort load_short();
uint load_int();
ulonglong load_ll();
void load_str_only(char *buffer, uint str_len);
char *load_str(MEM_ROOT *alloc, uint *str_len);
int load_safe_str(MEM_ROOT *alloc, char **str, uint *str_len);
int load_column(MEM_ROOT *alloc, char **column);
};
uint emb_count_querycache_size(THD *thd);
int emb_load_querycache_result(THD *thd, Querycache_stream *src);
void emb_store_querycache_result(Querycache_stream *dst, THD* thd);

View File

@ -23,9 +23,10 @@
#include <my_pthread.h>
C_MODE_START
extern void lib_connection_phase(NET *net, int phase);
extern void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db);
extern void *create_embedded_thd(int client_flag, char *db);
extern MYSQL_METHODS embedded_methods;
void lib_connection_phase(NET *net, int phase);
void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db);
void *create_embedded_thd(int client_flag, char *db);
int check_embedded_connection(MYSQL *mysql);
void free_old_query(MYSQL *mysql);
extern MYSQL_METHODS embedded_methods;
C_MODE_END

View File

@ -96,6 +96,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
net->last_error[0]= 0;
strmov(net->sqlstate, not_error_sqlstate);
}
mysql->server_status= thd->server_status;
mysql->warning_count= ((THD*)mysql->thd)->total_warn_count;
return result;
}
@ -478,7 +479,17 @@ void *create_embedded_thd(int client_flag, char *db)
return thd;
}
#ifndef NO_EMBEDDED_ACCESS_CHECKS
#ifdef NO_EMBEDDED_ACCESS_CHECKS
int check_embedded_connection(MYSQL *mysql)
{
THD *thd= (THD*)mysql->thd;
thd->host= (char*)my_localhost;
thd->host_or_ip= thd->host;
thd->user= my_strdup(mysql->user, MYF(0));
return 0;
}
#else
int check_embedded_connection(MYSQL *mysql)
{
THD *thd= (THD*)mysql->thd;
@ -486,9 +497,13 @@ int check_embedded_connection(MYSQL *mysql)
char scramble_buff[SCRAMBLE_LENGTH];
int passwd_len;
thd->host= mysql->options.client_ip ?
mysql->options.client_ip : (char*)my_localhost;
thd->ip= thd->host;
if (mysql->options.client_ip)
{
thd->host= my_strdup(mysql->options.client_ip, MYF(0));
thd->ip= my_strdup(thd->host, MYF(0));
}
else
thd->host= (char*)my_localhost;
thd->host_or_ip= thd->host;
if (acl_check_host(thd->host,thd->ip))
@ -497,7 +512,7 @@ int check_embedded_connection(MYSQL *mysql)
goto err;
}
thd->user= mysql->user;
thd->user= my_strdup(mysql->user, MYF(0));
if (mysql->passwd && mysql->passwd[0])
{
memset(thd->scramble, 55, SCRAMBLE_LENGTH); // dummy scramble
@ -565,6 +580,9 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
client_field->org_name_length= strlen(client_field->org_name);
client_field->org_table_length= strlen(client_field->org_table);
client_field->charsetnr= server_field.charsetnr;
client_field->catalog= strdup_root(field_alloc, "std");
client_field->catalog_length= 3;
if (INTERNAL_NUM_FIELD(client_field))
client_field->flags|= NUM_FLAG;
@ -575,9 +593,15 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
String tmp(buff, sizeof(buff), default_charset_info), *res;
if (!(res=item->val_str(&tmp)))
{
client_field->def= strdup_root(field_alloc, "");
client_field->def_length= 0;
}
else
{
client_field->def= strdup_root(field_alloc, tmp.ptr());
client_field->def_length= tmp.length();
}
}
else
client_field->def=0;

View File

@ -81,28 +81,6 @@ static void end_server(MYSQL *mysql)
DBUG_VOID_RETURN;
}
/**************************************************************************
** Connect to sql server
** If host == 0 then use localhost
**************************************************************************/
MYSQL * STDCALL
mysql_connect(MYSQL *mysql,const char *host,
const char *user, const char *passwd)
{
MYSQL *res;
mysql=mysql_init(mysql); /* Make it thread safe */
{
DBUG_ENTER("mysql_connect");
if (!(res=mysql_real_connect(mysql,host,user,passwd,NullS,0,NullS,0)))
{
if (mysql->free_me)
my_free((gptr) mysql,MYF(0));
}
DBUG_RETURN(res);
}
}
static inline int mysql_init_charset(MYSQL *mysql)
{
char charset_name_buff[16], *charset_name;
@ -146,17 +124,14 @@ static inline int mysql_init_charset(MYSQL *mysql)
return 0;
}
int check_embedded_connection(MYSQL *mysql);
MYSQL * STDCALL
mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
const char *passwd, const char *db,
uint port, const char *unix_socket,ulong client_flag)
{
char *db_name;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
char name_buff[USERNAME_LENGTH];
#endif
DBUG_ENTER("mysql_real_connect");
DBUG_PRINT("enter",("host: %s db: %s user: %s",
host ? host : "(Null)",
@ -187,10 +162,10 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if (!db || !db[0])
db=mysql->options.db;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (!user || !user[0])
user=mysql->options.user;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (!passwd)
{
passwd=mysql->options.password;
@ -199,16 +174,18 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
passwd=getenv("MYSQL_PWD"); /* get it from environment */
#endif
}
mysql->passwd= passwd ? my_strdup(passwd,MYF(0)) : NULL;
#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/
if (!user || !user[0])
{
read_user_name(name_buff);
if (!name_buff[0])
if (name_buff[0])
user= name_buff;
}
if (!user)
user= "";
mysql->user=my_strdup(user,MYF(0));
mysql->passwd= passwd ? my_strdup(passwd,MYF(0)) : NULL;
#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/
port=0;
unix_socket=0;
@ -218,10 +195,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
init_embedded_mysql(mysql, client_flag, db_name);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_embedded_connection(mysql))
goto error;
#endif
if (mysql_init_charset(mysql))
goto error;

View File

@ -551,7 +551,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
ha_checksum *key_checksum, uint level)
{
int flag;
uint used_length,comp_flag,nod_flag,key_length,not_used;
uint used_length,comp_flag,nod_flag,key_length=0,not_used;
uchar key[MI_MAX_POSSIBLE_KEY_BUFF],*temp_buff,*keypos,*old_keypos,*endpos;
my_off_t next_page,record;
char llbuff[22];
@ -586,6 +586,8 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
}
for ( ;; )
{
memcpy((char*) info->lastkey,(char*) key,key_length);
info->lastkey_length=key_length;
if (nod_flag)
{
next_page=_mi_kpos(nod_flag,keypos);
@ -629,8 +631,6 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
}
(*key_checksum)+= mi_byte_checksum((byte*) key,
key_length- info->s->rec_reflength);
memcpy((char*) info->lastkey,(char*) key,key_length);
info->lastkey_length=key_length;
record= _mi_dpos(info,0,key+key_length);
if (keyinfo->flag & HA_FULLTEXT) /* special handling for ft2 */
{
@ -658,7 +658,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
DBUG_PRINT("test",("page: %s record: %s filelength: %s",
llstr(page,llbuff),llstr(record,llbuff2),
llstr(info->state->data_file_length,llbuff3)));
DBUG_DUMP("key",(byte*) info->lastkey,key_length);
DBUG_DUMP("key",(byte*) key,key_length);
DBUG_DUMP("new_in_page",(char*) old_keypos,(uint) (keypos-old_keypos));
goto err;
}

View File

@ -42,7 +42,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
int errpos,save_errno;
myf create_flag;
uint fields,length,max_key_length,packed,pointer,
key_length,info_length,key_segs,options,min_key_length_skipp,
key_length,info_length,key_segs,options,min_key_length_skip,
base_pos,varchar_count,long_varchar_count,varchar_length,
max_key_block_length,unique_key_parts,fulltext_keys,offset;
ulong reclength, real_reclength,min_pack_length;
@ -238,7 +238,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
{
share.state.key_root[i]= HA_OFFSET_ERROR;
min_key_length_skipp=length=0;
min_key_length_skip=length=0;
key_length=pointer;
if (keydef->flag & HA_SPATIAL)
{
@ -269,7 +269,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
keydef->keysegs+=sp_segs;
key_length+=SPLEN*sp_segs;
length++; /* At least one length byte */
min_key_length_skipp+=SPLEN*2*SPDIMS;
min_key_length_skip+=SPLEN*2*SPDIMS;
}
else
if (keydef->flag & HA_FULLTEXT)
@ -291,7 +291,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
fulltext_keys++;
key_length+= HA_FT_MAXBYTELEN+HA_FT_WLEN;
length++; /* At least one length byte */
min_key_length_skipp+=HA_FT_MAXBYTELEN;
min_key_length_skip+=HA_FT_MAXBYTELEN;
}
else
{
@ -348,10 +348,10 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
keydef->flag |= HA_SPACE_PACK_USED | HA_VAR_LENGTH_KEY;
options|=HA_OPTION_PACK_KEYS; /* Using packed keys */
length++; /* At least one length byte */
min_key_length_skipp+=keyseg->length;
min_key_length_skip+=keyseg->length;
if (keyseg->length >= 255)
{ /* prefix may be 3 bytes */
min_key_length_skipp+=2;
min_key_length_skip+=2;
length+=2;
}
}
@ -360,10 +360,10 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
keydef->flag|=HA_VAR_LENGTH_KEY;
length++; /* At least one length byte */
options|=HA_OPTION_PACK_KEYS; /* Using packed keys */
min_key_length_skipp+=keyseg->length;
min_key_length_skip+=keyseg->length;
if (keyseg->length >= 255)
{ /* prefix may be 3 bytes */
min_key_length_skipp+=2;
min_key_length_skip+=2;
length+=2;
}
}
@ -395,7 +395,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
}
set_if_bigger(max_key_block_length,keydef->block_length);
keydef->keylength= (uint16) key_length;
keydef->minlength= (uint16) (length-min_key_length_skipp);
keydef->minlength= (uint16) (length-min_key_length_skip);
keydef->maxlength= (uint16) length;
if (length > max_key_length)

View File

@ -20,10 +20,6 @@
#include "rt_index.h"
#include <assert.h>
#ifdef __WIN__
#include <errno.h>
#endif
static int d_search(MI_INFO *info,MI_KEYDEF *keyinfo,uint comp_flag,
uchar *key,uint key_length,my_off_t page,uchar *anc_buff);
static int del(MI_INFO *info,MI_KEYDEF *keyinfo,uchar *key,uchar *anc_buff,

View File

@ -19,9 +19,6 @@
*/
#include "fulltext.h"
#ifdef __WIN__
#include <errno.h>
#endif
int mi_delete_table(const char *name)
{

View File

@ -1248,7 +1248,7 @@ err:
int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
register my_off_t filepos,
my_bool skipp_deleted_blocks)
my_bool skip_deleted_blocks)
{
int flag,info_read,save_errno;
uint left_len,b_type;
@ -1299,7 +1299,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
{
if (_mi_read_cache(&info->rec_cache,(byte*) block_info.header,filepos,
sizeof(block_info.header),
(!flag && skipp_deleted_blocks ? READING_NEXT : 0) |
(!flag && skip_deleted_blocks ? READING_NEXT : 0) |
READING_HEADER))
goto panic;
b_type=_mi_get_block_info(&block_info,-1,filepos);
@ -1318,7 +1318,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
BLOCK_FATAL_ERROR))
{
if ((b_type & (BLOCK_DELETED | BLOCK_SYNC_ERROR))
&& skipp_deleted_blocks)
&& skip_deleted_blocks)
{
filepos=block_info.filepos+block_info.block_len;
block_info.second_read=0;
@ -1374,7 +1374,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
{
if (_mi_read_cache(&info->rec_cache,(byte*) to,filepos,
block_info.data_len,
(!flag && skipp_deleted_blocks) ? READING_NEXT :0))
(!flag && skip_deleted_blocks) ? READING_NEXT :0))
goto panic;
}
else
@ -1391,7 +1391,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
if (flag++ == 0)
{
info->nextpos=block_info.filepos+block_info.block_len;
skipp_deleted_blocks=0;
skip_deleted_blocks=0;
}
left_len-=block_info.data_len;
to+=block_info.data_len;

View File

@ -18,9 +18,6 @@
#ifdef HAVE_MMAP
#include <sys/mman.h>
#endif
#ifdef __WIN__
#include <errno.h>
#endif
/*
Set options and buffers to optimize table handling

View File

@ -22,9 +22,6 @@
*/
#include "myisamdef.h"
#ifdef __WIN__
#include <errno.h>
#endif
/* lock table by F_UNLCK, F_RDLCK or F_WRLCK */

View File

@ -21,7 +21,6 @@
#include "myisamdef.h"
#if defined(MSDOS) || defined(__WIN__)
#include <errno.h>
#include <fcntl.h>
#ifndef __WIN__
#include <process.h>

View File

@ -32,7 +32,7 @@
(BU)->current_byte & ((mi_bit_type) 1 << --(BU)->bits) :\
(fill_buffer(BU), (BU)->bits= BITS_SAVED-1,\
(BU)->current_byte & ((mi_bit_type) 1 << (BITS_SAVED-1))))
#define skipp_to_next_byte(BU) ((BU)->bits&=~7)
#define skip_to_next_byte(BU) ((BU)->bits&=~7)
#define get_bits(BU,count) (((BU)->bits >= count) ? (((BU)->current_byte >> ((BU)->bits-=count)) & mask[count]) : fill_and_get_bits(BU,count))
#define decode_bytes_test_bit(bit) \
@ -58,9 +58,9 @@ static void (*get_unpack_function(MI_COLUMNDEF *rec))(MI_COLUMNDEF *field,
MI_BIT_BUFF *buff,
uchar *to,
uchar *end);
static void uf_zerofill_skipp_zero(MI_COLUMNDEF *rec,MI_BIT_BUFF *bit_buff,
static void uf_zerofill_skip_zero(MI_COLUMNDEF *rec,MI_BIT_BUFF *bit_buff,
uchar *to,uchar *end);
static void uf_skipp_zero(MI_COLUMNDEF *rec,MI_BIT_BUFF *bit_buff,
static void uf_skip_zero(MI_COLUMNDEF *rec,MI_BIT_BUFF *bit_buff,
uchar *to,uchar *end);
static void uf_space_normal(MI_COLUMNDEF *rec,MI_BIT_BUFF *bit_buff,
uchar *to,uchar *end);
@ -210,7 +210,7 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
huff_tree_bits);
share->rec[i].unpack=get_unpack_function(share->rec+i);
}
skipp_to_next_byte(&bit_buff);
skip_to_next_byte(&bit_buff);
decode_table=share->decode_tables;
for (i=0 ; i < trees ; i++)
read_huff_table(&bit_buff,share->decode_trees+i,&decode_table,
@ -291,7 +291,7 @@ static void read_huff_table(MI_BIT_BUFF *bit_buff, MI_DECODE_TREE *decode_tree,
else
*ptr= (uint16) (IS_CHAR + (get_bits(bit_buff,char_bits) + min_chr));
}
skipp_to_next_byte(bit_buff);
skip_to_next_byte(bit_buff);
decode_tree->table= *decode_table;
decode_tree->intervalls= *intervall_buff;
@ -468,8 +468,8 @@ static void (*get_unpack_function(MI_COLUMNDEF *rec))
switch (rec->base_type) {
case FIELD_SKIP_ZERO:
if (rec->pack_type & PACK_TYPE_ZERO_FILL)
return &uf_zerofill_skipp_zero;
return &uf_skipp_zero;
return &uf_zerofill_skip_zero;
return &uf_skip_zero;
case FIELD_NORMAL:
if (rec->pack_type & PACK_TYPE_SPACE_FIELDS)
return &uf_space_normal;
@ -515,7 +515,7 @@ static void (*get_unpack_function(MI_COLUMNDEF *rec))
/* De different functions to unpack a field */
static void uf_zerofill_skipp_zero(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
static void uf_zerofill_skip_zero(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
uchar *to, uchar *end)
{
if (get_bit(bit_buff))
@ -528,7 +528,7 @@ static void uf_zerofill_skipp_zero(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff,
}
}
static void uf_skipp_zero(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to,
static void uf_skip_zero(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to,
uchar *end)
{
if (get_bit(bit_buff))

View File

@ -17,9 +17,6 @@
/* Read and write key blocks */
#include "myisamdef.h"
#ifdef __WIN__
#include <errno.h>
#endif
/* Fetch a key-page in memory */

View File

@ -19,9 +19,6 @@
*/
#include "fulltext.h"
#ifdef __WIN__
#include <errno.h>
#endif
int mi_rename(const char *old_name, const char *new_name)
{

View File

@ -32,14 +32,14 @@
int mi_rrnd(MI_INFO *info, byte *buf, register my_off_t filepos)
{
my_bool skipp_deleted_blocks;
my_bool skip_deleted_blocks;
DBUG_ENTER("mi_rrnd");
skipp_deleted_blocks=0;
skip_deleted_blocks=0;
if (filepos == HA_OFFSET_ERROR)
{
skipp_deleted_blocks=1;
skip_deleted_blocks=1;
if (info->lastpos == HA_OFFSET_ERROR) /* First read ? */
filepos= info->s->pack.header_length; /* Read first record */
else
@ -56,5 +56,5 @@ int mi_rrnd(MI_INFO *info, byte *buf, register my_off_t filepos)
if (info->opt_flag & WRITE_CACHE_USED && flush_io_cache(&info->rec_cache))
DBUG_RETURN(my_errno);
DBUG_RETURN ((*info->s->read_rnd)(info,buf,filepos,skipp_deleted_blocks));
DBUG_RETURN ((*info->s->read_rnd)(info,buf,filepos,skip_deleted_blocks));
}

View File

@ -202,7 +202,7 @@ int _mi_read_static_record(register MI_INFO *info, register my_off_t pos,
int _mi_read_rnd_static_record(MI_INFO *info, byte *buf,
register my_off_t filepos,
my_bool skipp_deleted_blocks)
my_bool skip_deleted_blocks)
{
int locked,error,cache_read;
uint cache_length;
@ -212,13 +212,13 @@ int _mi_read_rnd_static_record(MI_INFO *info, byte *buf,
cache_read=0;
cache_length=0;
if (info->opt_flag & WRITE_CACHE_USED &&
(info->rec_cache.pos_in_file <= filepos || skipp_deleted_blocks) &&
(info->rec_cache.pos_in_file <= filepos || skip_deleted_blocks) &&
flush_io_cache(&info->rec_cache))
DBUG_RETURN(my_errno);
if (info->opt_flag & READ_CACHE_USED)
{ /* Cache in use */
if (filepos == my_b_tell(&info->rec_cache) &&
(skipp_deleted_blocks || !filepos))
(skip_deleted_blocks || !filepos))
{
cache_read=1; /* Read record using cache */
cache_length=(uint) (info->rec_cache.read_end - info->rec_cache.read_pos);

View File

@ -318,7 +318,7 @@ static int run_test(const char *filename)
return (0);
err:
printf("got error: %3d when using myisam-database\n",my_errno);
return 1; /* skipp warning */
return 1; /* skip warning */
}

View File

@ -19,11 +19,6 @@
#include "fulltext.h"
#include "rt_index.h"
#ifdef __WIN__
#include <errno.h>
#endif
int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
{
int flag,key_changed,save_errno;

View File

@ -20,10 +20,6 @@
#include "rt_index.h"
#include <assert.h>
#ifdef __WIN__
#include <errno.h>
#endif
#define MAX_POINTER_LENGTH 8
/* Functions declared in this file */
@ -378,7 +374,7 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
my_off_t root=info->dupp_key_pos;
keyinfo=&info->s->ft2_keyinfo;
key+=off;
keypos-=keyinfo->keylength; /* we'll modify key entry 'in vivo' */
keypos-=keyinfo->keylength+nod_flag; /* we'll modify key entry 'in vivo' */
error=_mi_ck_real_write_btree(info, keyinfo, key, 0,
&root, comp_flag);
_mi_dpointer(info, keypos+HA_FT_WLEN, root);

View File

@ -1071,7 +1071,7 @@ test_space_compress(HUFF_COUNTS *huff_counts, my_off_t records,
{
int min_pos;
uint length_bits,i;
my_off_t space_count,min_space_count,min_pack,new_length,skipp;
my_off_t space_count,min_space_count,min_pack,new_length,skip;
length_bits=max_bit(max_space_length);
@ -1091,15 +1091,15 @@ test_space_compress(HUFF_COUNTS *huff_counts, my_off_t records,
min_space_count=space_count;
}
/* Test with length-flag */
for (skipp=0L, i=0 ; i < 8 ; i++)
for (skip=0L, i=0 ; i < 8 ; i++)
{
if (space_counts[i])
{
if (i)
huff_counts->counts[(uint) ' ']+=space_counts[i];
skipp+=huff_counts->pre_space[i];
skip+=huff_counts->pre_space[i];
new_length=calc_packed_length(huff_counts,0)+
(records+(records-skipp)*(1+length_bits))/8;
(records+(records-skip)*(1+length_bits))/8;
if (new_length < min_pack)
{
min_pos=(int) i;

View File

@ -307,7 +307,7 @@ int run_test(const char *filename)
err:
printf("got error: %3d when using myisam-database\n",my_errno);
return 1; /* skipp warning */
return 1; /* skip warning */
}

View File

@ -283,7 +283,7 @@ int run_test(const char *filename)
err:
printf("got error: %3d when using myisam-database\n",my_errno);
return 1; /* skipp warning */
return 1; /* skip warning */
}

View File

@ -0,0 +1,4 @@
-- require r/have_big5.require
disable_query_log;
show collation like "big5_chinese_ci";
enable_query_log;

View File

@ -0,0 +1,4 @@
-- require r/have_tis620.require
disable_query_log;
show collation like "tis620_thai_ci";
enable_query_log;

View File

@ -66,7 +66,7 @@ if [ x$BINARY_DIST = x1 ] ; then
basedir=..
else
basedir=.
EXTRA_ARG="--language=../sql/share/english/"
EXTRA_ARG="--language=../sql/share/english/ --character-sets-dir=../sql/share/charsets/"
fi
mysqld_boot=" $execdir/mysqld --no-defaults --bootstrap --skip-grant-tables \

View File

@ -603,7 +603,7 @@ error () {
error_is () {
$ECHO "Errors are (from $TIMEFILE) :"
$CAT < $TIMEFILE
$ECHO "(the last line(s) may be the ones that caused the die() in mysqltest)"
$ECHO "(the last lines may be the most important ones)"
}
prefix_to_8() {
@ -1309,6 +1309,9 @@ run_testcase ()
skip_inc
$ECHO "$RES$RES_SPACE [ skipped ]"
else
if [ $res -gt 2 ]; then
$ECHO "mysqltest returned unexpected code $res, it has probably crashed" >> $TIMEFILE
fi
total_inc
fail_inc
$ECHO "$RES$RES_SPACE [ fail ]"

View File

@ -412,3 +412,15 @@ t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
t1 0 PRIMARY 2 User A 0 NULL NULL BTREE
t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
DROP TABLE t1;
CREATE TABLE t1 (a int PRIMARY KEY, b INT UNIQUE);
ALTER TABLE t1 DROP PRIMARY KEY;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`b` int(11) default NULL,
UNIQUE KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t1 DROP PRIMARY KEY;
ERROR 42000: Can't DROP 'PRIMARY'. Check that column/key exists
DROP TABLE t1;

View File

@ -24,6 +24,12 @@ Note 1003 select high_priority ~(5) AS `~5`,cast(~(5) as signed) AS `cast(~5 as
select cast(5 as unsigned) -6.0;
cast(5 as unsigned) -6.0
-1.0
select cast(NULL as signed), cast(1/0 as signed);
cast(NULL as signed) cast(1/0 as signed)
NULL NULL
select cast(NULL as unsigned), cast(1/0 as unsigned);
cast(NULL as unsigned) cast(1/0 as unsigned)
NULL NULL
select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A";
cast("A" as binary) = "a" cast(BINARY "a" as CHAR) = "A"
0 1
@ -33,6 +39,24 @@ cast("2001-1-1" as DATE) cast("2001-1-1" as DATETIME)
select cast("1:2:3" as TIME);
cast("1:2:3" as TIME)
01:02:03
select CONVERT("2004-01-22 21:45:33",DATE);
CONVERT("2004-01-22 21:45:33",DATE)
2004-01-22
select CONVERT(DATE "2004-01-22 21:45:33" USING latin1);
CONVERT(DATE "2004-01-22 21:45:33" USING latin1)
2004-01-22 21:45:33
select CONVERT(DATE "2004-01-22 21:45:33",CHAR);
CONVERT(DATE "2004-01-22 21:45:33",CHAR)
2004-01-22 21:45:33
select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4));
CONVERT(DATE "2004-01-22 21:45:33",CHAR(4))
2004
select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4) BINARY);
CONVERT(DATE "2004-01-22 21:45:33",CHAR(4) BINARY)
2004
select CAST(DATE "2004-01-22 21:45:33" AS CHAR(4) BINARY);
CAST(DATE "2004-01-22 21:45:33" AS CHAR(4) BINARY)
2004
set names binary;
select cast(_latin1'test' as char character set latin2);
cast(_latin1'test' as char character set latin2)
@ -40,6 +64,12 @@ test
select cast(_koi8r'ÔĹÓÔ' as char character set cp1251);
cast(_koi8r'ÔĹÓÔ' as char character set cp1251)
ňĺńň
select convert(_latin1'test', "latin1_german1_ci", "latin1_swedish_ci");
convert(_latin1'test', "latin1_german1_ci", "latin1_swedish_ci")
test
select convert(_koi8r'ÔÅÓÔ', "koi8r_general_ci", "cp1251_general_ci");
convert(_koi8r'ÔÅÓÔ', "koi8r_general_ci", "cp1251_general_ci")
òåñò
create table t1 select cast(_koi8r'ÔĹÓÔ' as char character set cp1251) as t;
show create table t1;
Table Create Table
@ -101,6 +131,21 @@ t1 CREATE TABLE `t1` (
`c5` char(2) character set utf8 NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a binary(10), b char(10) character set koi8r);
insert into t1 values (_binary'ÔÅÓÔ',_binary'ÔÅÓÔ');
select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
a b cast(a as char character set cp1251) cast(b as binary)
ÔÅÓÔ ÔÅÓÔ ÔÅÓÔ ÔÅÓÔ
set names koi8r;
select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
a b cast(a as char character set cp1251) cast(b as binary)
ÔÅÓÔ ÔÅÓÔ æåõæ ÔÅÓÔ
set names cp1251;
select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
a b cast(a as char character set cp1251) cast(b as binary)
ÔÅÓÔ òåñò ÔÅÓÔ ÔÅÓÔ
drop table t1;
set names binary;
select cast("2001-1-1" as date) = "2001-01-01";
cast("2001-1-1" as date) = "2001-01-01"
1

View File

@ -0,0 +1,10 @@
drop table if exists t1;
SET NAMES big5;
CREATE TABLE t1 (c CHAR(10) CHARACTER SET big5, KEY(c));
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
SELECT * FROM t1 WHERE c LIKE 'aaa%';
c
aaa
aaaa
aaaaa
DROP TABLE t1;

View File

@ -541,3 +541,50 @@ s2 CHAR(5) COLLATE latin1_swedish_ci);
SELECT * FROM t1 WHERE s1 = s2;
ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '='
DROP TABLE t1;
SET NAMES latin1;
CREATE TABLE t1
(s1 char(10) COLLATE latin1_german1_ci,
s2 char(10) COLLATE latin1_swedish_ci,
KEY(s1),
KEY(s2));
INSERT INTO t1 VALUES ('a','a');
INSERT INTO t1 VALUES ('b','b');
INSERT INTO t1 VALUES ('c','c');
INSERT INTO t1 VALUES ('d','d');
INSERT INTO t1 VALUES ('e','e');
INSERT INTO t1 VALUES ('f','f');
INSERT INTO t1 VALUES ('g','g');
INSERT INTO t1 VALUES ('h','h');
INSERT INTO t1 VALUES ('i','i');
INSERT INTO t1 VALUES ('j','j');
EXPLAIN SELECT * FROM t1 WHERE s1='a';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref s1 s1 11 const 1 Using where
EXPLAIN SELECT * FROM t1 WHERE s2='a';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref s2 s2 11 const 1 Using where
EXPLAIN SELECT * FROM t1 WHERE s1='a' COLLATE latin1_german1_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref s1 s1 11 const 1 Using where
EXPLAIN SELECT * FROM t1 WHERE s2='a' COLLATE latin1_german1_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
EXPLAIN SELECT * FROM t1 WHERE s1 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range s1 s1 11 NULL 2 Using where
EXPLAIN SELECT * FROM t1 WHERE s2 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
EXPLAIN SELECT * FROM t1 WHERE s1 IN ('a','b' COLLATE latin1_german1_ci);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range s1 s1 11 NULL 2 Using where
EXPLAIN SELECT * FROM t1 WHERE s2 IN ('a','b' COLLATE latin1_german1_ci);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
EXPLAIN SELECT * FROM t1 WHERE s1 LIKE 'a' COLLATE latin1_german1_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range s1 s1 11 NULL 1 Using where
EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
DROP TABLE t1;

View File

@ -1,3 +1,5 @@
set names latin1;
set @@collation_connection=latin1_german2_ci;
select @@collation_connection;
@@collation_connection
latin1_german2_ci

View File

@ -22,7 +22,7 @@ Warning 1264 Data truncated for column 'c2' at row 1
Warning 1264 Data truncated for column 'c3' at row 1
SELECT * FROM t1;
c1 c2 c3
aaaabbbbcccc aaaabbbbcccc aaaabbbbcccc
aaaa aaaa aaaa
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(4) CHARACTER SET utf8, KEY key_a(a(3)));
SHOW CREATE TABLE t1;

View File

@ -19,6 +19,12 @@ SELECT HEX(a) FROM t2;
HEX(a)
D0BFD180D0BED0B1D0B0
DROP TABLE t1, t2;
CREATE TABLE t1 (description text character set cp1250 NOT NULL);
INSERT INTO t1 (description) VALUES (_latin2'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddde');
SELECT description FROM t1;
description
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddde
DROP TABLE t1;
CREATE TABLE t1 (a TEXT CHARACTER SET cp1251) SELECT _koi8r'ÐÒÏÂÁ' AS a;
CREATE TABLE t2 (a TEXT CHARACTER SET utf8);
SHOW CREATE TABLE t1;

View File

@ -0,0 +1,113 @@
drop table if exists t1;
SET @pl0= _tis620 0x000102030405060708090A0B0C0D0E0F;
SET @pl1= _tis620 0x101112131415161718191A1B1C1D1E1F;
SET @pl2= _tis620 0x202122232425262728292A2B2C2D2E2F;
SET @pl3= _tis620 0x303132333435363738393A3B3C3D3E3F;
SET @pl4= _tis620 0x404142434445464748494A4B4C4D4E4F;
SET @pl5= _tis620 0x505152535455565758595A5B5C5D5E5F;
SET @pl6= _tis620 0x606162636465666768696A6B6C6D6E6F;
SET @pl7= _tis620 0x707172737475767778797A7B7C7D7E7F;
SET @pl8= _tis620 0x808182838485868788898A8B8C8D8E8F;
SET @pl9= _tis620 0x909192939495969798999A9B9C9D9E9F;
SET @plA= _tis620 0xA0A1A2A3A4A5A6A7A8A9AAABACADAEAF;
SET @plB= _tis620 0xB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF;
SET @plC= _tis620 0xC0C1C2C3C4C5C6C7C8C9CACBCCCDCECF;
SET @plD= _tis620 0xD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF;
SET @plE= _tis620 0xE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF;
SET @plF= _tis620 0xF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF;
SELECT hex(@u0:=convert(@pl0 using utf8));
hex(@u0:=convert(@pl0 using utf8))
000102030405060708090A0B0C0D0E0F
SELECT hex(@u1:=convert(@pl1 using utf8));
hex(@u1:=convert(@pl1 using utf8))
101112131415161718191A1B1C1D1E1F
SELECT hex(@u2:=convert(@pl2 using utf8));
hex(@u2:=convert(@pl2 using utf8))
202122232425262728292A2B2C2D2E2F
SELECT hex(@u3:=convert(@pl3 using utf8));
hex(@u3:=convert(@pl3 using utf8))
303132333435363738393A3B3C3D3E3F
SELECT hex(@u4:=convert(@pl4 using utf8));
hex(@u4:=convert(@pl4 using utf8))
404142434445464748494A4B4C4D4E4F
SELECT hex(@u5:=convert(@pl5 using utf8));
hex(@u5:=convert(@pl5 using utf8))
505152535455565758595A5B5C5D5E5F
SELECT hex(@u6:=convert(@pl6 using utf8));
hex(@u6:=convert(@pl6 using utf8))
606162636465666768696A6B6C6D6E6F
SELECT hex(@u7:=convert(@pl7 using utf8));
hex(@u7:=convert(@pl7 using utf8))
707172737475767778797A7B7C7D7E7F
SELECT hex(@u8:=convert(@pl8 using utf8));
hex(@u8:=convert(@pl8 using utf8))
C280C281C282C283C284C285C286C287C288C289C28AC28BC28CC28DC28EC28F
SELECT hex(@u9:=convert(@pl9 using utf8));
hex(@u9:=convert(@pl9 using utf8))
C290C291C292C293C294C295C296C297C298C299C29AC29BC29CC29DC29EC29F
SELECT hex(@uA:=convert(@plA using utf8));
hex(@uA:=convert(@plA using utf8))
EFBFBDE0B881E0B882E0B883E0B884E0B885E0B886E0B887E0B888E0B889E0B88AE0B88BE0B88CE0B88DE0B88EE0B88F
SELECT hex(@uB:=convert(@plB using utf8));
hex(@uB:=convert(@plB using utf8))
E0B890E0B891E0B892E0B893E0B894E0B895E0B896E0B897E0B898E0B899E0B89AE0B89BE0B89CE0B89DE0B89EE0B89F
SELECT hex(@uC:=convert(@plC using utf8));
hex(@uC:=convert(@plC using utf8))
E0B8A0E0B8A1E0B8A2E0B8A3E0B8A4E0B8A5E0B8A6E0B8A7E0B8A8E0B8A9E0B8AAE0B8ABE0B8ACE0B8ADE0B8AEE0B8AF
SELECT hex(@uD:=convert(@plD using utf8));
hex(@uD:=convert(@plD using utf8))
E0B8B0E0B8B1E0B8B2E0B8B3E0B8B4E0B8B5E0B8B6E0B8B7E0B8B8E0B8B9E0B8BAEFBFBDEFBFBDEFBFBDEFBFBDE0B8BF
SELECT hex(@uE:=convert(@plE using utf8));
hex(@uE:=convert(@plE using utf8))
E0B980E0B981E0B982E0B983E0B984E0B985E0B986E0B987E0B988E0B989E0B98AE0B98BE0B98CE0B98DE0B98EE0B98F
SELECT hex(@uF:=convert(@plF using utf8));
hex(@uF:=convert(@plF using utf8))
E0B990E0B991E0B992E0B993E0B994E0B995E0B996E0B997E0B998E0B999E0B99AE0B99BEFBFBDEFBFBDEFBFBDEFBFBD
SELECT hex(convert(@u0 USING tis620));
hex(convert(@u0 USING tis620))
000102030405060708090A0B0C0D0E0F
SELECT hex(convert(@u1 USING tis620));
hex(convert(@u1 USING tis620))
101112131415161718191A1B1C1D1E1F
SELECT hex(convert(@u2 USING tis620));
hex(convert(@u2 USING tis620))
202122232425262728292A2B2C2D2E2F
SELECT hex(convert(@u3 USING tis620));
hex(convert(@u3 USING tis620))
303132333435363738393A3B3C3D3E3F
SELECT hex(convert(@u4 USING tis620));
hex(convert(@u4 USING tis620))
404142434445464748494A4B4C4D4E4F
SELECT hex(convert(@u5 USING tis620));
hex(convert(@u5 USING tis620))
505152535455565758595A5B5C5D5E5F
SELECT hex(convert(@u6 USING tis620));
hex(convert(@u6 USING tis620))
606162636465666768696A6B6C6D6E6F
SELECT hex(convert(@u7 USING tis620));
hex(convert(@u7 USING tis620))
707172737475767778797A7B7C7D7E7F
SELECT hex(convert(@u8 USING tis620));
hex(convert(@u8 USING tis620))
808182838485868788898A8B8C8D8E8F
SELECT hex(convert(@u9 USING tis620));
hex(convert(@u9 USING tis620))
909192939495969798999A9B9C9D9E9F
SELECT hex(convert(@uA USING tis620));
hex(convert(@uA USING tis620))
FFA1A2A3A4A5A6A7A8A9AAABACADAEAF
SELECT hex(convert(@uB USING tis620));
hex(convert(@uB USING tis620))
B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF
SELECT hex(convert(@uC USING tis620));
hex(convert(@uC USING tis620))
C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF
SELECT hex(convert(@uD USING tis620));
hex(convert(@uD USING tis620))
D0D1D2D3D4D5D6D7D8D9DAFFFFFFFFDF
SELECT hex(convert(@uE USING tis620));
hex(convert(@uE USING tis620))
E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF
SELECT hex(convert(@uF USING tis620));
hex(convert(@uF USING tis620))
F0F1F2F3F4F5F6F7F8F9FAFBFFFFFFFF

View File

@ -77,6 +77,9 @@ a
test
select * from t1 where a like "%a%";
a
a
abc
abcd
select * from t1 where a like "%abcd%";
a
abcd
@ -84,6 +87,78 @@ select * from t1 where a like "%abc\d%";
a
abcd
drop table t1;
select 'AA' like 'AA';
'AA' like 'AA'
1
select 'AA' like 'A%A';
'AA' like 'A%A'
1
select 'AA' like 'A%%A';
'AA' like 'A%%A'
1
select 'AA' like 'AA%';
'AA' like 'AA%'
1
select 'AA' like '%AA%';
'AA' like '%AA%'
1
select 'AA' like '%A';
'AA' like '%A'
1
select 'AA' like '%AA';
'AA' like '%AA'
1
select 'AA' like 'A%A%';
'AA' like 'A%A%'
1
select 'AA' like '_%_%';
'AA' like '_%_%'
1
select 'AA' like '%A%A';
'AA' like '%A%A'
1
select 'AAA'like 'A%A%A';
'AAA'like 'A%A%A'
1
select 'AZ' like 'AZ';
'AZ' like 'AZ'
1
select 'AZ' like 'A%Z';
'AZ' like 'A%Z'
1
select 'AZ' like 'A%%Z';
'AZ' like 'A%%Z'
1
select 'AZ' like 'AZ%';
'AZ' like 'AZ%'
1
select 'AZ' like '%AZ%';
'AZ' like '%AZ%'
1
select 'AZ' like '%Z';
'AZ' like '%Z'
1
select 'AZ' like '%AZ';
'AZ' like '%AZ'
1
select 'AZ' like 'A%Z%';
'AZ' like 'A%Z%'
1
select 'AZ' like '_%_%';
'AZ' like '_%_%'
1
select 'AZ' like '%A%Z';
'AZ' like '%A%Z'
1
select 'AZ' like 'A_';
'AZ' like 'A_'
1
select 'AZ' like '_Z';
'AZ' like '_Z'
1
select 'AMZ'like 'A%M%Z';
'AMZ'like 'A%M%Z'
1
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ucs2);
INSERT INTO t1 VALUES ('ÆÙ×Á'),('æÙ×Á'),('Æù×Á'),('ÆÙ÷Á'),('ÆÙ×á'),('æù÷á');
INSERT INTO t1 VALUES ('ÆÙ×ÁÐÒÏÌÄÖ'),('æÙ×ÁÐÒÏÌÄÖ'),('Æù×ÁÐÒÏÌÄÖ'),('ÆÙ÷ÁÐÒÏÌÄÖ');
@ -173,6 +248,12 @@ SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630061005F';
word
cat
DROP TABLE t1;
select insert(_ucs2 0x006100620063,10,2,_ucs2 0x006400650066);
insert(_ucs2 0x006100620063,10,2,_ucs2 0x006400650066)
abc
select insert(_ucs2 0x006100620063,1,2,_ucs2 0x006400650066);
insert(_ucs2 0x006100620063,1,2,_ucs2 0x006400650066)
defc
SET NAMES latin1;
CREATE TABLE t1 (
word VARCHAR(64),
@ -270,3 +351,107 @@ aardvara
aardvark
aardvarz
DROP TABLE t1;
SELECT HEX(_ucs2 0x0);
HEX(_ucs2 0x0)
0000
SELECT HEX(_ucs2 0x01);
HEX(_ucs2 0x01)
0001
SELECT HEX(_ucs2 0x012);
HEX(_ucs2 0x012)
0012
SELECT HEX(_ucs2 0x0123);
HEX(_ucs2 0x0123)
0123
SELECT HEX(_ucs2 0x01234);
HEX(_ucs2 0x01234)
00001234
SELECT HEX(_ucs2 0x012345);
HEX(_ucs2 0x012345)
00012345
SELECT HEX(_ucs2 0x0123456);
HEX(_ucs2 0x0123456)
00123456
SELECT HEX(_ucs2 0x01234567);
HEX(_ucs2 0x01234567)
01234567
SELECT HEX(_ucs2 0x012345678);
HEX(_ucs2 0x012345678)
000012345678
SELECT HEX(_ucs2 0x0123456789);
HEX(_ucs2 0x0123456789)
000123456789
SELECT HEX(_ucs2 0x0123456789A);
HEX(_ucs2 0x0123456789A)
00123456789A
SELECT HEX(_ucs2 0x0123456789AB);
HEX(_ucs2 0x0123456789AB)
0123456789AB
SELECT HEX(_ucs2 0x0123456789ABC);
HEX(_ucs2 0x0123456789ABC)
0000123456789ABC
SELECT HEX(_ucs2 0x0123456789ABCD);
HEX(_ucs2 0x0123456789ABCD)
000123456789ABCD
SELECT HEX(_ucs2 0x0123456789ABCDE);
HEX(_ucs2 0x0123456789ABCDE)
00123456789ABCDE
SELECT HEX(_ucs2 0x0123456789ABCDEF);
HEX(_ucs2 0x0123456789ABCDEF)
0123456789ABCDEF
SELECT hex(cast(0xAA as char character set ucs2));
hex(cast(0xAA as char character set ucs2))
00AA
SELECT hex(convert(0xAA using ucs2));
hex(convert(0xAA using ucs2))
00AA
CREATE TABLE t1 (a char(10) character set ucs2);
INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
SELECT HEX(a) FROM t1;
HEX(a)
000A
00AA
0AAA
AAAA
000AAAAA
DROP TABLE t1;
CREATE TABLE t1 (a varchar(10) character set ucs2);
INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
SELECT HEX(a) FROM t1;
HEX(a)
000A
00AA
0AAA
AAAA
000AAAAA
DROP TABLE t1;
CREATE TABLE t1 (a text character set ucs2);
INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
SELECT HEX(a) FROM t1;
HEX(a)
000A
00AA
0AAA
AAAA
000AAAAA
DROP TABLE t1;
CREATE TABLE t1 (a mediumtext character set ucs2);
INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
SELECT HEX(a) FROM t1;
HEX(a)
000A
00AA
0AAA
AAAA
000AAAAA
DROP TABLE t1;
CREATE TABLE t1 (a longtext character set ucs2);
INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
SELECT HEX(a) FROM t1;
HEX(a)
000A
00AA
0AAA
AAAA
000AAAAA
DROP TABLE t1;

View File

@ -1,3 +1,4 @@
drop table if exists t1;
set names utf8;
select left(_utf8 0xD0B0D0B1D0B2,1);
left(_utf8 0xD0B0D0B1D0B2,1)
@ -62,3 +63,107 @@ select 'A' like 'a' collate utf8_bin;
select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%');
_utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%')
1
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
this is a test
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
insert("aa",100,1,"b") insert("aa",1,3,"b")
aa b
create table t1 select date_format("2004-01-19 10:10:10", "%Y-%m-%d");
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`date_format("2004-01-19 10:10:10", "%Y-%m-%d")` char(10) binary default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t1;
date_format("2004-01-19 10:10:10", "%Y-%m-%d")
2004-01-19
drop table t1;
set names koi8r;
create table t1 (s1 char(1) character set utf8);
insert into t1 values (_koi8r'ÁÂ');
Warnings:
Warning 1264 Data truncated for column 's1' at row 1
select s1,hex(s1),char_length(s1),octet_length(s1) from t1;
s1 hex(s1) char_length(s1) octet_length(s1)
Á D0B0 1 2
drop table t1;
create table t1 (s1 tinytext character set utf8);
insert into t1 select repeat('a',300);
Warnings:
Warning 1264 Data truncated for column 's1' at row 1
insert into t1 select repeat('Ñ',300);
Warnings:
Warning 1264 Data truncated for column 's1' at row 1
insert into t1 select repeat('aÑ',300);
Warnings:
Warning 1264 Data truncated for column 's1' at row 1
insert into t1 select repeat('Ña',300);
Warnings:
Warning 1264 Data truncated for column 's1' at row 1
insert into t1 select repeat('ÑÑ',300);
Warnings:
Warning 1264 Data truncated for column 's1' at row 1
select hex(s1) from t1;
hex(s1)
616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161
D18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18F
61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F
D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61
D18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18F
select length(s1),char_length(s1) from t1;
length(s1) char_length(s1)
255 255
254 127
255 170
255 170
254 127
drop table t1;
create table t1 (s1 text character set utf8);
insert into t1 select repeat('a',66000);
Warnings:
Warning 1264 Data truncated for column 's1' at row 1
insert into t1 select repeat('Ñ',66000);
Warnings:
Warning 1264 Data truncated for column 's1' at row 1
insert into t1 select repeat('aÑ',66000);
Warnings:
Warning 1264 Data truncated for column 's1' at row 1
insert into t1 select repeat('Ña',66000);
Warnings:
Warning 1264 Data truncated for column 's1' at row 1
insert into t1 select repeat('ÑÑ',66000);
Warnings:
Warning 1264 Data truncated for column 's1' at row 1
select length(s1),char_length(s1) from t1;
length(s1) char_length(s1)
65535 65535
65534 32767
65535 43690
65535 43690
65534 32767
drop table t1;
create table t1 (s1 char(10) character set utf8);
insert into t1 values (0x41FF);
Warnings:
Warning 1264 Data truncated for column 's1' at row 1
select hex(s1) from t1;
hex(s1)
41
drop table t1;
create table t1 (s1 varchar(10) character set utf8);
insert into t1 values (0x41FF);
Warnings:
Warning 1264 Data truncated for column 's1' at row 1
select hex(s1) from t1;
hex(s1)
41
drop table t1;
create table t1 (s1 text character set utf8);
insert into t1 values (0x41FF);
Warnings:
Warning 1264 Data truncated for column 's1' at row 1
select hex(s1) from t1;
hex(s1)
41
drop table t1;

View File

@ -1,6 +1,4 @@
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
SHOW GLOBAL VARIABLES LIKE "%_format%";
Variable_name Value
date_format %d.%m.%Y

View File

@ -59,7 +59,7 @@ explain select * from t1 as x1, (select * from t1) as x2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY x1 ALL NULL NULL NULL NULL 4
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4
2 DERIVED x1 ALL NULL NULL NULL NULL 4
2 DERIVED t1 ALL NULL NULL NULL NULL 4
drop table if exists t2,t3;
select * from (select 1) as a;
1
@ -85,6 +85,10 @@ a b
2 b
3 c
3 c
select * from (select * from t1 union all select * from t1 limit 2) a;
a b
1 a
2 b
explain select * from (select * from t1 union select * from t1) a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3
@ -137,7 +141,7 @@ a t
explain select count(*) from t1 as tt1, (select * from t1) as tt2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
2 DERIVED tt1 ALL NULL NULL NULL NULL 10000
2 DERIVED t1 ALL NULL NULL NULL NULL 10000
drop table t1;
SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b;
(SELECT * FROM (SELECT 1 as a) as a )
@ -185,13 +189,13 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY m2 ALL NULL NULL NULL NULL 9
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 Using where
2 DERIVED mp ALL NULL NULL NULL NULL 9 Using temporary; Using filesort
2 DERIVED m2 index NULL PRIMARY 3 NULL 9 Using index
2 DERIVED m1 eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1
explain SELECT STRAIGHT_JOIN d.pla_id, m2.test FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY m2 ALL NULL NULL NULL NULL 9
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 Using where
2 DERIVED mp ALL NULL NULL NULL NULL 9 Using temporary; Using filesort
2 DERIVED m2 index NULL PRIMARY 3 NULL 9 Using index
2 DERIVED m1 eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1
drop table t1,t2;
SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1;
x
@ -209,7 +213,7 @@ ERROR 42000: You have an error in your SQL syntax. Check the manual that corres
create table t1 (a int);
insert into t1 values (1),(2),(3);
update (select * from t1) as t1 set a = 5;
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use
ERROR HY000: The target table t1 of the UPDATE is not updatable.
delete from (select * from t1);
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(select * from t1)' at line 1
insert into (select * from t1) values (5);
@ -225,7 +229,7 @@ explain select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
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 A ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 2 Using where
drop table t1;
create table t1 (a int);
@ -245,3 +249,74 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DERIVED t1 ALL NULL NULL NULL NULL 2
3 UNION t1 ALL NULL NULL NULL NULL 2
drop table t1;
CREATE TABLE `t1` (
`N` int(11) unsigned NOT NULL default '0',
`M` tinyint(1) default '0',
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0);
UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
select * from t1;
N M
1 2
1 2
1 2
2 2
2 2
3 0
UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2, P2.N = 2;
ERROR HY000: The target table P2 of the UPDATE is not updatable.
UPDATE `t1` AS P1 INNER JOIN (SELECT aaaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
ERROR 42S22: Unknown column 'aaaa' in 'field list'
delete P1.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
select * from t1;
N M
3 0
delete P1.*,P2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
ERROR HY000: The target table P2 of the DELETE is not updatable.
delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
ERROR 42S22: Unknown column 'aaa' in 'field list'
drop table t1;
CREATE TABLE t1 (
OBJECTID int(11) NOT NULL default '0',
SORTORDER int(11) NOT NULL auto_increment,
KEY t1_SortIndex (SORTORDER),
KEY t1_IdIndex (OBJECTID)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE t2 (
ID int(11) default NULL,
PARID int(11) default NULL,
UNIQUE KEY t2_ID_IDX (ID),
KEY t2_PARID_IDX (PARID)
) engine=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO t2 VALUES (1000,0),(1001,0),(1002,0),(1003,0),(1008,1),(1009,1),(1010,1),(1011,1),(1016,2);
CREATE TABLE t3 (
ID int(11) default NULL,
DATA decimal(10,2) default NULL,
UNIQUE KEY t3_ID_IDX (ID)
) engine=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO t3 VALUES (1000,0.00),(1001,0.25),(1002,0.50),(1003,0.75),(1008,1.00),(1009,1.25),(1010,1.50),(1011,1.75);
select 497, TMP.ID, NULL from (select 497 as ID, MAX(t3.DATA) as DATA from t1 join t2 on (t1.ObjectID = t2.ID) join t3 on (t1.ObjectID = t3.ID) group by t2.ParID order by DATA DESC) as TMP;
497 ID NULL
drop table t1, t2, t3;
CREATE TABLE t1 (name char(1) default NULL, val int(5) default NULL);
INSERT INTO t1 VALUES ('a',1), ('a',2), ('a',2), ('a',2), ('a',3), ('a',6), ('a',7), ('a',11), ('a',11), ('a',12), ('a',13), ('a',13), ('a',20), ('b',2), ('b',3), ('b',4), ('b',5);
SELECT s.name, AVG(s.val) AS median FROM (SELECT x.name, x.val FROM t1 x, t1 y WHERE x.name=y.name GROUP BY x.name, x.val HAVING SUM(y.val <= x.val) >= COUNT(*)/2 AND SUM(y.val >= x.val) >= COUNT(*)/2) AS s GROUP BY s.name;
name median
a 7.0000
b 3.5000
explain SELECT s.name, AVG(s.val) AS median FROM (SELECT x.name, x.val FROM t1 x, t1 y WHERE x.name=y.name GROUP BY x.name, x.val HAVING SUM(y.val <= x.val) >= COUNT(*)/2 AND SUM(y.val >= x.val) >= COUNT(*)/2) AS s GROUP BY s.name;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
2 DERIVED x ALL NULL NULL NULL NULL 17 Using temporary; Using filesort
2 DERIVED y ALL NULL NULL NULL NULL 17 Using where
drop table t1;
create table t2 (a int, b int, primary key (a));
insert into t2 values (1,7),(2,7);
explain select a from t2 where a>1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
explain select a from (select a from t2 where a>1) tt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
2 DERIVED t2 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
drop table t2;

View File

@ -104,3 +104,33 @@ a
фывапролдЖ
ФЫВАПРОЛДЖ
DROP TABLE t1;
SET NAMES cp1250;
CREATE TABLE t1 (a varchar(250) NOT NULL) DEFAULT CHARACTER SET=cp1250;
INSERT INTO t1 VALUES
('Techni Tapes Sp. z o.o.'),
('Pojazdy Szynowe PESA Bydgoszcz SA Holding'),
('AKAPESTER 1 P.P.H.U.'),
('Pojazdy Szynowe PESA Bydgoszcz S A Holding'),
('PPUH PESKA-I Maria Struniarska');
select * from t1 where a like '%PESA%';
a
Pojazdy Szynowe PESA Bydgoszcz SA Holding
Pojazdy Szynowe PESA Bydgoszcz S A Holding
select * from t1 where a like '%PESA %';
a
Pojazdy Szynowe PESA Bydgoszcz SA Holding
Pojazdy Szynowe PESA Bydgoszcz S A Holding
select * from t1 where a like '%PES%';
a
Techni Tapes Sp. z o.o.
Pojazdy Szynowe PESA Bydgoszcz SA Holding
AKAPESTER 1 P.P.H.U.
Pojazdy Szynowe PESA Bydgoszcz S A Holding
PPUH PESKA-I Maria Struniarska
select * from t1 where a like '%PESKA%';
a
PPUH PESKA-I Maria Struniarska
select * from t1 where a like '%ESKA%';
a
PPUH PESKA-I Maria Struniarska
DROP TABLE t1;

View File

@ -6,10 +6,19 @@ inet_ntoa(inet_aton("255.255.255.255.255.255.255.255"))
NULL
select inet_aton("255.255.255.255.255"),inet_aton("255.255.1.255"),inet_aton("0.1.255");
inet_aton("255.255.255.255.255") inet_aton("255.255.1.255") inet_aton("0.1.255")
1099511627775 4294902271 511
1099511627775 4294902271 65791
select inet_ntoa(1099511627775),inet_ntoa(4294902271),inet_ntoa(511);
inet_ntoa(1099511627775) inet_ntoa(4294902271) inet_ntoa(511)
NULL 255.255.1.255 0.0.1.255
select hex(inet_aton('127'));
hex(inet_aton('127'))
7F
select hex(inet_aton('127.1'));
hex(inet_aton('127.1'))
7F000001
select hex(inet_aton('127.1.1'));
hex(inet_aton('127.1.1'))
7F010001
select length(format('nan', 2)) > 0;
length(format('nan', 2)) > 0
1

View File

@ -605,3 +605,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 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")`
SELECT lpad(12345, 5, "#");
lpad(12345, 5, "#")
12345

View File

@ -165,3 +165,9 @@ SELECT f_acc.rank, a1.rank, a2.rank FROM t1 LEFT JOIN t1 f1 ON (f1.access_id=1
rank rank rank
2 2 NULL
DROP TABLE t1,t2;
CREATE TABLE t1 (d varchar(6), k int);
INSERT INTO t1 VALUES (NULL, 2);
SELECT GREATEST(d,d) FROM t1 WHERE k=2;
GREATEST(d,d)
NULL
DROP TABLE t1;

View File

@ -0,0 +1,2 @@
Collation Charset Id Default Compiled Sortlen
big5_chinese_ci big5 1 Yes Yes 1

View File

@ -0,0 +1,2 @@
Collation Charset Id Default Compiled Sortlen
tis620_thai_ci tis620 18 Yes Yes 4

View File

@ -100,7 +100,7 @@ p i a
4 3 zzzz
update t1 set p=2 where p=1;
update t2 set i=2 where i=1;
cache index t1 keys (`primary`) in keycache1;
cache index t1 key (`primary`) in keycache1;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
explain select p from t1;
@ -177,7 +177,7 @@ yyyy
zzzz
cache index t1 in unknown_key_cache;
ERROR HY000: Unknown key cache 'unknown_key_cache'
cache index t1 keys (unknown_key) in keycache1;
cache index t1 key (unknown_key) in keycache1;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache error Key column 'unknown_key' doesn't exist in table
test.t1 assign_to_keycache status Operation failed

View File

@ -244,7 +244,7 @@ select * from t2;
n d
1 30
1 30
DELETE t1, t2 FROM t1 a,t2 b where a.n=b.n;
DELETE a, b FROM t1 a,t2 b where a.n=b.n;
select * from t1;
n d
3 2

View File

@ -21,17 +21,22 @@ DROP TABLE t1;
CREATE TABLE t1 (a decimal(240, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
("0987654321098765432109876543210987654321");
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
a decimal(240,20) default NULL
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` decimal(240,20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE t1 DISABLE KEYS */;
LOCK TABLES t1 WRITE;
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890.00000000000000000000"),("0987654321098765432109876543210987654321.00000000000000000000");
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
LOCK TABLES `t1` WRITE;
INSERT INTO `t1` VALUES ("1234567890123456789012345678901234567890.00000000000000000000"),("0987654321098765432109876543210987654321.00000000000000000000");
UNLOCK TABLES;
/*!40000 ALTER TABLE t1 ENABLE KEYS */;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
@ -41,17 +46,22 @@ UNLOCK TABLES;
DROP TABLE t1;
CREATE TABLE t1 (a double);
INSERT INTO t1 VALUES (-9e999999);
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
a double default NULL
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE t1 DISABLE KEYS */;
LOCK TABLES t1 WRITE;
INSERT INTO t1 VALUES (RES);
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
LOCK TABLES `t1` WRITE;
INSERT INTO `t1` VALUES (RES);
UNLOCK TABLES;
/*!40000 ALTER TABLE t1 ENABLE KEYS */;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
@ -105,17 +115,22 @@ INSERT INTO t1 VALUES ("1\""), ("\"2");
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5');
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
a varchar(255) default NULL
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` varchar(255) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=koi8r;
/*!40000 ALTER TABLE t1 DISABLE KEYS */;
LOCK TABLES t1 WRITE;
INSERT INTO t1 VALUES ('абцде');
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
LOCK TABLES `t1` WRITE;
INSERT INTO `t1` VALUES ('абцде');
UNLOCK TABLES;
/*!40000 ALTER TABLE t1 ENABLE KEYS */;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
@ -123,3 +138,67 @@ UNLOCK TABLES;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
DROP TABLE t1;
CREATE TABLE t1 (a int) ENGINE=MYISAM;
INSERT INTO t1 VALUES (1), (2);
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL
) TYPE=MyISAM;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
LOCK TABLES `t1` WRITE;
INSERT INTO `t1` VALUES (1),(2);
UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL
) TYPE=MyISAM;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
LOCK TABLES `t1` WRITE;
INSERT INTO `t1` VALUES (1),(2);
UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
DROP TABLE t1;
create table ```a` (i int);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
DROP TABLE IF EXISTS ```a`;
CREATE TABLE ``a` (
`i` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE ```a` DISABLE KEYS */;
LOCK TABLES ```a` WRITE;
UNLOCK TABLES;
/*!40000 ALTER TABLE ```a` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
drop table ```a`;

View File

@ -153,3 +153,6 @@ explain select * from t1 where a between 2 and 3 or b is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx idx 4 NULL 2 Using where
drop table t1;
select cast(NULL as signed);
cast(NULL as signed)
NULL

View File

@ -590,3 +590,24 @@ SELECT id FROM t1 WHERE id <11984 AND menu =2 ORDER BY id DESC LIMIT 1 ;
id
11392
drop table t1;
create table t1(a int, b int, index(b));
insert into t1 values (2, 1), (1, 1), (4, NULL), (3, NULL), (6, 2), (5, 2);
explain select * from t1 where b=1 or b is null order by a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref_or_null b b 5 const 3 Using where; Using filesort
select * from t1 where b=1 or b is null order by a;
a b
1 1
2 1
3 NULL
4 NULL
explain select * from t1 where b=2 or b is null order by a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref_or_null b b 5 const 4 Using where; Using filesort
select * from t1 where b=2 or b is null order by a;
a b
3 NULL
4 NULL
5 2
6 2
drop table t1;

View File

@ -117,7 +117,7 @@ set session preload_buffer_size=1*1024;
select @@preload_buffer_size;
@@preload_buffer_size
1024
load index into cache t1, t2 keys (primary,b) ignore leaves;
load index into cache t1, t2 key (primary,b) ignore leaves;
Table Op Msg_type Msg_text
test.t1 preload_keys status OK
test.t2 preload_keys status OK
@ -141,7 +141,7 @@ show status like "key_read%";
Variable_name Value
Key_read_requests 0
Key_reads 0
load index into cache t3, t2 keys (primary,b) ;
load index into cache t3, t2 key (primary,b) ;
Table Op Msg_type Msg_text
test.t3 preload_keys error Table 'test.t3' doesn't exist
test.t2 preload_keys status OK
@ -155,7 +155,7 @@ show status like "key_read%";
Variable_name Value
Key_read_requests 0
Key_reads 0
load index into cache t3 keys (b), t2 keys (c) ;
load index into cache t3 key (b), t2 key (c) ;
Table Op Msg_type Msg_text
test.t3 preload_keys error Table 'test.t3' doesn't exist
test.t2 preload_keys error Key column 'c' doesn't exist in table

View File

@ -696,17 +696,22 @@ word
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
load data infile '../../std_data/words.dat' into table t1;
load data infile 'TEST_DIR/std_data/words.dat' into table t1;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
select count(*) from t1;
count(*)
70
drop table t1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
select * from t1 into outfile "query_caceh.out.file";
select * from t1 into outfile "query_cache.out.file";
select * from t1 into outfile "query_cache.out.file";
ERROR HY000: File 'query_cache.out.file' already exists
select * from t1 limit 1 into dumpfile "query_cache.dump.file";
show status like "Qcache_queries_in_cache";
Variable_name Value
@ -815,6 +820,14 @@ Qcache_hits 6
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 4
DROP TABLE t1;
CREATE TABLE t1 (a int(1));
CREATE DATABASE mysqltest;
USE mysqltest;
DROP DATABASE mysqltest;
SELECT * FROM test.t1;
a
USE test;
drop table t1;
create table t1 (a int);
show status like "Qcache_queries_in_cache";

View File

@ -31,7 +31,7 @@ n
4
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 731 slave-relay-bin.000004 439 master-bin.000001 Yes No 0 0 304 866 Master master-bin.000001 304 No #
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 244 # Master master-bin.000001 244 No #
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
select * from t1;
n

View File

@ -88,20 +88,37 @@ drop table t2;
create table t1 (
test_set set( 'val1', 'val2', 'val3' ) not null default '',
name char(20) default 'O''Brien' comment 'O''Brien as default',
c int not null comment 'int column'
) comment = 'it\'s a table' ;
show create table t1 ;
c int not null comment 'int column',
`c-b` int comment 'name with a space',
`space ` int comment 'name with a space',
) comment = 'it\'s a table' ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`test_set` set('val1','val2','val3') NOT NULL default '',
`name` char(20) default 'O''Brien' COMMENT 'O''Brien as default',
`c` int(11) NOT NULL default '0' COMMENT 'int column'
`c` int(11) NOT NULL default '0' COMMENT 'int column',
`c-b` int(11) default NULL COMMENT 'name with a space',
`space ` int(11) default NULL COMMENT 'name with a space'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table'
set sql_quote_show_create=0;
show create table t1;
Table Create Table
t1 CREATE TABLE t1 (
test_set set('val1','val2','val3') NOT NULL default '',
name char(20) default 'O''Brien' COMMENT 'O''Brien as default',
c int(11) NOT NULL default '0' COMMENT 'int column',
`c-b` int(11) default NULL COMMENT 'name with a space',
`space ` int(11) default NULL COMMENT 'name with a space'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table'
set sql_quote_show_create=1;
show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment
test_set set('val1','val2','val3') latin1_swedish_ci select,insert,update,references
name char(20) latin1_swedish_ci YES O'Brien select,insert,update,references O'Brien as default
c int(11) NULL 0 select,insert,update,references int column
c-b int(11) NULL YES NULL select,insert,update,references name with a space
space int(11) NULL YES NULL select,insert,update,references name with a space
drop table t1;
create table t1 (a int not null, unique aa (a));
show create table t1;

View File

@ -70,7 +70,7 @@ t1 CREATE TABLE `t1` (
`email` varchar(60) NOT NULL default '',
PRIMARY KEY (`a`),
UNIQUE KEY `email` (`email`)
) ENGINE=HEAP ROW_FORMAT=DYNAMIC
) TYPE=HEAP ROW_FORMAT=DYNAMIC
set sql_mode="postgresql,oracle,mssql,db2,maxdb";
select @@sql_mode;
@@sql_mode

View File

@ -1348,8 +1348,8 @@ a
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index
2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 Using index
2 DEPENDENT SUBQUERY t1 ref a a 10 func,test.t3.a 1000 Using where; Using index
2 DEPENDENT SUBQUERY t1 ref a a 5 func 1001 Using where; Using index
2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 Using where; Using index
Warnings:
Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(select 1 AS `Not_used` from test.t1 join test.t3 where ((test.t1.b = test.t3.a) and (<cache>(test.t2.a) = test.t1.a)) limit 1))
insert into t1 values (3,31);
@ -1577,3 +1577,37 @@ INSERT INTO t2 VALUES (100, 200, 'C');
SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1);
COLC
DROP TABLE t1, t2;
create table t1 (a int, b decimal(13, 3));
insert into t1 values (1, 0.123);
select a, (select max(b) from t1) into outfile "subselect.out.file.1" from t1;
delete from t1;
load data infile "subselect.out.file.1" into table t1;
select * from t1;
a b
1 0.123
drop table t1;
CREATE TABLE `t1` (
`id` int(11) NOT NULL auto_increment,
`id_cns` tinyint(3) unsigned NOT NULL default '0',
`tipo` enum('','UNO','DUE') NOT NULL default '',
`anno_dep` smallint(4) unsigned zerofill NOT NULL default '0000',
`particolare` mediumint(8) unsigned NOT NULL default '0',
`generale` mediumint(8) unsigned NOT NULL default '0',
`bis` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `idx_cns_gen_anno` (`anno_dep`,`id_cns`,`generale`,`particolare`),
UNIQUE KEY `idx_cns_par_anno` (`id_cns`,`anno_dep`,`tipo`,`particolare`,`bis`)
);
INSERT INTO `t1` VALUES (1,16,'UNO',1987,2048,9681,0),(2,50,'UNO',1987,1536,13987,0),(3,16,'UNO',1987,2432,14594,0),(4,16,'UNO',1987,1792,13422,0),(5,16,'UNO',1987,1025,10240,0),(6,16,'UNO',1987,1026,7089,0);
CREATE TABLE `t2` (
`id` tinyint(3) unsigned NOT NULL auto_increment,
`max_anno_dep` smallint(6) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
);
INSERT INTO `t2` VALUES (16,1987),(50,1990),(51,1990);
SELECT cns.id, cns.max_anno_dep, cns.max_anno_dep = (SELECT s.anno_dep FROM t1 AS s WHERE s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM t2 AS cns;
id max_anno_dep PIPPO
16 1987 1
50 1990 0
51 1990 NULL
DROP TABLE t1, t2;

View File

@ -60,6 +60,39 @@ INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
SELECT distinct p1.processor_id, (SELECT y.yod_id FROM t1 p2, t2 y WHERE p2.processor_id = p1.processor_id and p2.processor_id = y.processor_id) FROM t1 p1;
processor_id (SELECT y.yod_id FROM t1 p2, t2 y WHERE p2.processor_id = p1.processor_id and p2.processor_id = y.processor_id)
1 1
2 1
3 1
2 2
3 3
drop table t1,t2,t3;
CREATE TABLE t1 (
id int(11) NOT NULL default '0',
b int(11) default NULL,
c char(3) default NULL,
PRIMARY KEY (id),
KEY t2i1 (b)
) ENGINE=innodb DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES (0,0,'GPL'),(1,0,'GPL'),(2,1,'GPL'),(3,2,'GPL');
CREATE TABLE t2 (
id int(11) NOT NULL default '0',
b int(11) default NULL,
c char(3) default NULL,
PRIMARY KEY (id),
KEY t2i (b)
) ENGINE=innodb DEFAULT CHARSET=latin1;
INSERT INTO t2 VALUES (0,0,'GPL'),(1,0,'GPL'),(2,1,'GPL'),(3,2,'GPL');
select (select max(id) from t2 where b=1 group by b) as x,b from t1 where b=1;
x b
2 1
drop table t1,t2;
create table t1 (id int not null, value char(255), primary key(id)) engine=innodb;
create table t2 (id int not null, value char(255)) engine=innodb;
insert into t1 values (1,'a'),(2,'b');
insert into t2 values (1,'z'),(2,'x');
select t2.id,t2.value,(select t1.value from t1 where t1.id=t2.id) from t2;
id value (select t1.value from t1 where t1.id=t2.id)
1 z a
2 x b
select t2.id,t2.value,(select t1.value from t1 where t1.id=t2.id) from t2;
id value (select t1.value from t1 where t1.id=t2.id)
1 z a
2 x b
drop table t1,t2;

View File

@ -66,7 +66,7 @@ t9 CREATE TABLE `t9` (
drop database mysqltest;
create table t1 (a int not null) type=myisam;
Warnings:
Warning 1286 'TYPE=database_engine' is deprecated. Use 'ENGINE=database_engine' instead.
Warning 1286 'TYPE=storage_engine' is deprecated. Use 'ENGINE=storage_engine' instead.
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (

View File

@ -446,39 +446,6 @@ CREATE TABLE t1 (a_dec DECIMAL(-1,1));
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '-1,1))' at line 1
create table t1(a decimal(7,3));
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
Warnings:
Warning 1263 Data truncated, out of range for column 'a' at row 27
Warning 1263 Data truncated, out of range for column 'a' at row 30
Warning 1263 Data truncated, out of range for column 'a' at row 31
Warning 1263 Data truncated, out of range for column 'a' at row 32
Warning 1263 Data truncated, out of range for column 'a' at row 33
Warning 1263 Data truncated, out of range for column 'a' at row 34
Warning 1263 Data truncated, out of range for column 'a' at row 35
Warning 1263 Data truncated, out of range for column 'a' at row 36
Warning 1263 Data truncated, out of range for column 'a' at row 37
Warning 1263 Data truncated, out of range for column 'a' at row 38
Warning 1263 Data truncated, out of range for column 'a' at row 39
Warning 1263 Data truncated, out of range for column 'a' at row 40
Warning 1263 Data truncated, out of range for column 'a' at row 41
Warning 1263 Data truncated, out of range for column 'a' at row 42
Warning 1263 Data truncated, out of range for column 'a' at row 43
Warning 1263 Data truncated, out of range for column 'a' at row 44
Warning 1263 Data truncated, out of range for column 'a' at row 45
Warning 1263 Data truncated, out of range for column 'a' at row 46
Warning 1263 Data truncated, out of range for column 'a' at row 47
Warning 1263 Data truncated, out of range for column 'a' at row 48
Warning 1263 Data truncated, out of range for column 'a' at row 49
Warning 1263 Data truncated, out of range for column 'a' at row 50
Warning 1263 Data truncated, out of range for column 'a' at row 51
Warning 1263 Data truncated, out of range for column 'a' at row 52
Warning 1263 Data truncated, out of range for column 'a' at row 53
Warning 1263 Data truncated, out of range for column 'a' at row 54
Warning 1263 Data truncated, out of range for column 'a' at row 55
Warning 1263 Data truncated, out of range for column 'a' at row 56
Warning 1263 Data truncated, out of range for column 'a' at row 57
Warning 1263 Data truncated, out of range for column 'a' at row 58
Warning 1263 Data truncated, out of range for column 'a' at row 59
Warning 1263 Data truncated, out of range for column 'a' at row 60
select * from t1;
a
1.000
@ -544,51 +511,6 @@ a
drop table t1;
create table t1(a decimal(7,3) unsigned);
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
Warnings:
Warning 1263 Data truncated, out of range for column 'a' at row 3
Warning 1263 Data truncated, out of range for column 'a' at row 6
Warning 1263 Data truncated, out of range for column 'a' at row 9
Warning 1263 Data truncated, out of range for column 'a' at row 12
Warning 1263 Data truncated, out of range for column 'a' at row 15
Warning 1263 Data truncated, out of range for column 'a' at row 18
Warning 1263 Data truncated, out of range for column 'a' at row 21
Warning 1263 Data truncated, out of range for column 'a' at row 24
Warning 1263 Data truncated, out of range for column 'a' at row 25
Warning 1263 Data truncated, out of range for column 'a' at row 26
Warning 1263 Data truncated, out of range for column 'a' at row 27
Warning 1263 Data truncated, out of range for column 'a' at row 28
Warning 1263 Data truncated, out of range for column 'a' at row 29
Warning 1263 Data truncated, out of range for column 'a' at row 30
Warning 1263 Data truncated, out of range for column 'a' at row 31
Warning 1263 Data truncated, out of range for column 'a' at row 32
Warning 1263 Data truncated, out of range for column 'a' at row 33
Warning 1263 Data truncated, out of range for column 'a' at row 34
Warning 1263 Data truncated, out of range for column 'a' at row 35
Warning 1263 Data truncated, out of range for column 'a' at row 36
Warning 1263 Data truncated, out of range for column 'a' at row 37
Warning 1263 Data truncated, out of range for column 'a' at row 38
Warning 1263 Data truncated, out of range for column 'a' at row 39
Warning 1263 Data truncated, out of range for column 'a' at row 40
Warning 1263 Data truncated, out of range for column 'a' at row 41
Warning 1263 Data truncated, out of range for column 'a' at row 42
Warning 1263 Data truncated, out of range for column 'a' at row 43
Warning 1263 Data truncated, out of range for column 'a' at row 44
Warning 1263 Data truncated, out of range for column 'a' at row 45
Warning 1263 Data truncated, out of range for column 'a' at row 46
Warning 1263 Data truncated, out of range for column 'a' at row 47
Warning 1263 Data truncated, out of range for column 'a' at row 48
Warning 1263 Data truncated, out of range for column 'a' at row 49
Warning 1263 Data truncated, out of range for column 'a' at row 50
Warning 1263 Data truncated, out of range for column 'a' at row 51
Warning 1263 Data truncated, out of range for column 'a' at row 52
Warning 1263 Data truncated, out of range for column 'a' at row 53
Warning 1263 Data truncated, out of range for column 'a' at row 54
Warning 1263 Data truncated, out of range for column 'a' at row 55
Warning 1263 Data truncated, out of range for column 'a' at row 56
Warning 1263 Data truncated, out of range for column 'a' at row 57
Warning 1263 Data truncated, out of range for column 'a' at row 58
Warning 1263 Data truncated, out of range for column 'a' at row 59
Warning 1263 Data truncated, out of range for column 'a' at row 60
select * from t1;
a
1.000
@ -654,51 +576,6 @@ a
drop table t1;
create table t1(a decimal(7,3) zerofill);
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
Warnings:
Warning 1263 Data truncated, out of range for column 'a' at row 3
Warning 1263 Data truncated, out of range for column 'a' at row 6
Warning 1263 Data truncated, out of range for column 'a' at row 9
Warning 1263 Data truncated, out of range for column 'a' at row 12
Warning 1263 Data truncated, out of range for column 'a' at row 15
Warning 1263 Data truncated, out of range for column 'a' at row 18
Warning 1263 Data truncated, out of range for column 'a' at row 21
Warning 1263 Data truncated, out of range for column 'a' at row 24
Warning 1263 Data truncated, out of range for column 'a' at row 25
Warning 1263 Data truncated, out of range for column 'a' at row 26
Warning 1263 Data truncated, out of range for column 'a' at row 27
Warning 1263 Data truncated, out of range for column 'a' at row 28
Warning 1263 Data truncated, out of range for column 'a' at row 29
Warning 1263 Data truncated, out of range for column 'a' at row 30
Warning 1263 Data truncated, out of range for column 'a' at row 31
Warning 1263 Data truncated, out of range for column 'a' at row 32
Warning 1263 Data truncated, out of range for column 'a' at row 33
Warning 1263 Data truncated, out of range for column 'a' at row 34
Warning 1263 Data truncated, out of range for column 'a' at row 35
Warning 1263 Data truncated, out of range for column 'a' at row 36
Warning 1263 Data truncated, out of range for column 'a' at row 37
Warning 1263 Data truncated, out of range for column 'a' at row 38
Warning 1263 Data truncated, out of range for column 'a' at row 39
Warning 1263 Data truncated, out of range for column 'a' at row 40
Warning 1263 Data truncated, out of range for column 'a' at row 41
Warning 1263 Data truncated, out of range for column 'a' at row 42
Warning 1263 Data truncated, out of range for column 'a' at row 43
Warning 1263 Data truncated, out of range for column 'a' at row 44
Warning 1263 Data truncated, out of range for column 'a' at row 45
Warning 1263 Data truncated, out of range for column 'a' at row 46
Warning 1263 Data truncated, out of range for column 'a' at row 47
Warning 1263 Data truncated, out of range for column 'a' at row 48
Warning 1263 Data truncated, out of range for column 'a' at row 49
Warning 1263 Data truncated, out of range for column 'a' at row 50
Warning 1263 Data truncated, out of range for column 'a' at row 51
Warning 1263 Data truncated, out of range for column 'a' at row 52
Warning 1263 Data truncated, out of range for column 'a' at row 53
Warning 1263 Data truncated, out of range for column 'a' at row 54
Warning 1263 Data truncated, out of range for column 'a' at row 55
Warning 1263 Data truncated, out of range for column 'a' at row 56
Warning 1263 Data truncated, out of range for column 'a' at row 57
Warning 1263 Data truncated, out of range for column 'a' at row 58
Warning 1263 Data truncated, out of range for column 'a' at row 59
Warning 1263 Data truncated, out of range for column 'a' at row 60
select * from t1;
a
0001.000

View File

@ -158,7 +158,7 @@ insert into t1 (F1,F2,F3,cnt,groupid) values ('0','0','0',1,6),
('0','1','2',1,5), ('0','2','0',1,3), ('1','0','1',1,2),
('1','2','1',1,1), ('1','2','2',1,1), ('2','0','1',2,4),
('2','2','0',1,7);
delete from t1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3);
delete from m1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3);
select * from t1;
F1 F2 F3 cnt groupid
0 0 0 1 6

View File

@ -120,3 +120,45 @@ select @a+0, @a:=@a+0+count(*), count(*), @a+0 from t1 group by i;
1 3 2 0
3 6 3 0
drop table t1;
set @a=_latin2'test';
select charset(@a),collation(@a),coercibility(@a);
charset(@a) collation(@a) coercibility(@a)
latin2 latin2_general_ci 3
select @a=_latin2'TEST';
@a=_latin2'TEST'
1
select @a=_latin2'TEST' collate latin2_bin;
@a=_latin2'TEST' collate latin2_bin
0
set @a=_latin2'test' collate latin2_general_ci;
select charset(@a),collation(@a),coercibility(@a);
charset(@a) collation(@a) coercibility(@a)
latin2 latin2_general_ci 0
select @a=_latin2'TEST';
@a=_latin2'TEST'
1
select @a=_latin2'TEST' collate latin2_bin;
ERROR HY000: Illegal mix of collations (latin2_general_ci,EXPLICIT) and (latin2_bin,EXPLICIT) for operation '='
select charset(@a:=_latin2'test');
charset(@a:=_latin2'test')
latin2
select collation(@a:=_latin2'test');
collation(@a:=_latin2'test')
latin2_general_ci
select coercibility(@a:=_latin2'test');
coercibility(@a:=_latin2'test')
3
select collation(@a:=_latin2'test' collate latin2_bin);
collation(@a:=_latin2'test' collate latin2_bin)
latin2_bin
select coercibility(@a:=_latin2'test' collate latin2_bin);
coercibility(@a:=_latin2'test' collate latin2_bin)
0
select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST';
(@a:=_latin2'test' collate latin2_bin) = _latin2'TEST'
0
select charset(@a),collation(@a),coercibility(@a);
charset(@a) collation(@a) coercibility(@a)
latin2 latin2_bin 0
select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci;
ERROR HY000: Illegal mix of collations (latin2_bin,EXPLICIT) and (latin2_general_ci,EXPLICIT) for operation '='

View File

@ -1,7 +1,4 @@
drop table if exists t1, t2;
Warnings:
Note 1051 Unknown table 't1'
Note 1051 Unknown table 't2'
SET SQL_WARNINGS=1;
create table t1 (a int);
insert into t1 values (1);
@ -128,10 +125,10 @@ Warning 1265 Using storage engine MyISAM for table 't1'
drop table t1;
create table t1 (id int) type=heap;
Warnings:
Warning 1286 'TYPE=database_engine' is deprecated. Use 'ENGINE=database_engine' instead.
Warning 1286 'TYPE=storage_engine' is deprecated. Use 'ENGINE=storage_engine' instead.
alter table t1 type=myisam;
Warnings:
Warning 1286 'TYPE=database_engine' is deprecated. Use 'ENGINE=database_engine' instead.
Warning 1286 'TYPE=storage_engine' is deprecated. Use 'ENGINE=storage_engine' instead.
drop table t1;
set table_type=MYISAM;
Warnings:

View File

@ -244,3 +244,14 @@ LOCK TABLES t1 WRITE;
ALTER TABLE t1 DISABLE KEYS;
SHOW INDEX FROM t1;
DROP TABLE t1;
#
# Bug 2361
#
CREATE TABLE t1 (a int PRIMARY KEY, b INT UNIQUE);
ALTER TABLE t1 DROP PRIMARY KEY;
SHOW CREATE TABLE t1;
--error 1091
ALTER TABLE t1 DROP PRIMARY KEY;
DROP TABLE t1;

View File

@ -10,9 +10,17 @@ select cast(-5 as unsigned) -1, cast(-5 as unsigned) + 1;
select ~5, cast(~5 as signed);
explain extended select ~5, cast(~5 as signed);
select cast(5 as unsigned) -6.0;
select cast(NULL as signed), cast(1/0 as signed);
select cast(NULL as unsigned), cast(1/0 as unsigned);
select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A";
select cast("2001-1-1" as DATE), cast("2001-1-1" as DATETIME);
select cast("1:2:3" as TIME);
select CONVERT("2004-01-22 21:45:33",DATE);
select CONVERT(DATE "2004-01-22 21:45:33" USING latin1);
select CONVERT(DATE "2004-01-22 21:45:33",CHAR);
select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4));
select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4) BINARY);
select CAST(DATE "2004-01-22 21:45:33" AS CHAR(4) BINARY);
#
# Character set convertion
@ -20,6 +28,8 @@ select cast("1:2:3" as TIME);
set names binary;
select cast(_latin1'test' as char character set latin2);
select cast(_koi8r'ÔÅÓÔ' as char character set cp1251);
select convert(_latin1'test', "latin1_german1_ci", "latin1_swedish_ci");
select convert(_koi8r'ÔÅÓÔ', "koi8r_general_ci", "cp1251_general_ci");
create table t1 select cast(_koi8r'ÔÅÓÔ' as char character set cp1251) as t;
show create table t1;
drop table t1;
@ -64,6 +74,19 @@ select * from t1;
show create table t1;
drop table t1;
#
# Bug 2202
# CAST from BINARY to non-BINARY and from non-BINARY to BINARY
#
create table t1 (a binary(10), b char(10) character set koi8r);
insert into t1 values (_binary'ÔÅÓÔ',_binary'ÔÅÓÔ');
select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
set names koi8r;
select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
set names cp1251;
select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
drop table t1;
set names binary;
#
# The following should be fixed in 4.1

View File

@ -0,0 +1,18 @@
-- source include/have_big5.inc
#
# Tests with the big5 character set
#
--disable_warnings
drop table if exists t1;
--enable_warnings
SET NAMES big5;
#
# Bug 1883: LIKE did not work in some cases with a key.
#
CREATE TABLE t1 (c CHAR(10) CHARACTER SET big5, KEY(c));
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
SELECT * FROM t1 WHERE c LIKE 'aaa%';
DROP TABLE t1;

View File

@ -156,3 +156,41 @@ CREATE TABLE t1
--error 1266
SELECT * FROM t1 WHERE s1 = s2;
DROP TABLE t1;
#
# Test that optimizer doesn't use indexes with wrong collation
#
SET NAMES latin1;
CREATE TABLE t1
(s1 char(10) COLLATE latin1_german1_ci,
s2 char(10) COLLATE latin1_swedish_ci,
KEY(s1),
KEY(s2));
INSERT INTO t1 VALUES ('a','a');
INSERT INTO t1 VALUES ('b','b');
INSERT INTO t1 VALUES ('c','c');
INSERT INTO t1 VALUES ('d','d');
INSERT INTO t1 VALUES ('e','e');
INSERT INTO t1 VALUES ('f','f');
INSERT INTO t1 VALUES ('g','g');
INSERT INTO t1 VALUES ('h','h');
INSERT INTO t1 VALUES ('i','i');
INSERT INTO t1 VALUES ('j','j');
EXPLAIN SELECT * FROM t1 WHERE s1='a';
EXPLAIN SELECT * FROM t1 WHERE s2='a';
EXPLAIN SELECT * FROM t1 WHERE s1='a' COLLATE latin1_german1_ci;
EXPLAIN SELECT * FROM t1 WHERE s2='a' COLLATE latin1_german1_ci;
EXPLAIN SELECT * FROM t1 WHERE s1 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
EXPLAIN SELECT * FROM t1 WHERE s2 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
EXPLAIN SELECT * FROM t1 WHERE s1 IN ('a','b' COLLATE latin1_german1_ci);
EXPLAIN SELECT * FROM t1 WHERE s2 IN ('a','b' COLLATE latin1_german1_ci);
EXPLAIN SELECT * FROM t1 WHERE s1 LIKE 'a' COLLATE latin1_german1_ci;
EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci;
DROP TABLE t1;

View File

@ -2,6 +2,9 @@
# Test latin_de character set
#
set names latin1;
set @@collation_connection=latin1_german2_ci;
select @@collation_connection;
--disable_warnings

View File

@ -14,6 +14,15 @@ INSERT t2 SELECT * FROM t1;
SELECT HEX(a) FROM t2;
DROP TABLE t1, t2;
#
# Check that long strings conversion does not fail (bug#2218)
#
CREATE TABLE t1 (description text character set cp1250 NOT NULL);
INSERT INTO t1 (description) VALUES (_latin2'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddde');
SELECT description FROM t1;
DROP TABLE t1;
# same with TEXT
CREATE TABLE t1 (a TEXT CHARACTER SET cp1251) SELECT _koi8r'ÐÒÏÂÁ' AS a;
CREATE TABLE t2 (a TEXT CHARACTER SET utf8);
@ -62,3 +71,4 @@ SET NAMES koi8r;
SELECT hex('ÔÅÓÔ');
SET character_set_connection=cp1251;
SELECT hex('ÔÅÓÔ');

View File

@ -0,0 +1,64 @@
-- source include/have_tis620.inc
#
# Tests with the big5 character set
#
--disable_warnings
drop table if exists t1;
--enable_warnings
#
# Bug 1552: tis620 <-> unicode conversion crashed
# Check tis620 -> utf8 -> tis620 round trip conversion
#
SET @pl0= _tis620 0x000102030405060708090A0B0C0D0E0F;
SET @pl1= _tis620 0x101112131415161718191A1B1C1D1E1F;
SET @pl2= _tis620 0x202122232425262728292A2B2C2D2E2F;
SET @pl3= _tis620 0x303132333435363738393A3B3C3D3E3F;
SET @pl4= _tis620 0x404142434445464748494A4B4C4D4E4F;
SET @pl5= _tis620 0x505152535455565758595A5B5C5D5E5F;
SET @pl6= _tis620 0x606162636465666768696A6B6C6D6E6F;
SET @pl7= _tis620 0x707172737475767778797A7B7C7D7E7F;
SET @pl8= _tis620 0x808182838485868788898A8B8C8D8E8F;
SET @pl9= _tis620 0x909192939495969798999A9B9C9D9E9F;
SET @plA= _tis620 0xA0A1A2A3A4A5A6A7A8A9AAABACADAEAF;
SET @plB= _tis620 0xB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF;
SET @plC= _tis620 0xC0C1C2C3C4C5C6C7C8C9CACBCCCDCECF;
SET @plD= _tis620 0xD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF;
SET @plE= _tis620 0xE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF;
SET @plF= _tis620 0xF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF;
SELECT hex(@u0:=convert(@pl0 using utf8));
SELECT hex(@u1:=convert(@pl1 using utf8));
SELECT hex(@u2:=convert(@pl2 using utf8));
SELECT hex(@u3:=convert(@pl3 using utf8));
SELECT hex(@u4:=convert(@pl4 using utf8));
SELECT hex(@u5:=convert(@pl5 using utf8));
SELECT hex(@u6:=convert(@pl6 using utf8));
SELECT hex(@u7:=convert(@pl7 using utf8));
SELECT hex(@u8:=convert(@pl8 using utf8));
SELECT hex(@u9:=convert(@pl9 using utf8));
SELECT hex(@uA:=convert(@plA using utf8));
SELECT hex(@uB:=convert(@plB using utf8));
SELECT hex(@uC:=convert(@plC using utf8));
SELECT hex(@uD:=convert(@plD using utf8));
SELECT hex(@uE:=convert(@plE using utf8));
SELECT hex(@uF:=convert(@plF using utf8));
SELECT hex(convert(@u0 USING tis620));
SELECT hex(convert(@u1 USING tis620));
SELECT hex(convert(@u2 USING tis620));
SELECT hex(convert(@u3 USING tis620));
SELECT hex(convert(@u4 USING tis620));
SELECT hex(convert(@u5 USING tis620));
SELECT hex(convert(@u6 USING tis620));
SELECT hex(convert(@u7 USING tis620));
SELECT hex(convert(@u8 USING tis620));
SELECT hex(convert(@u9 USING tis620));
SELECT hex(convert(@uA USING tis620));
SELECT hex(convert(@uB USING tis620));
SELECT hex(convert(@uC USING tis620));
SELECT hex(convert(@uD USING tis620));
SELECT hex(convert(@uE USING tis620));
SELECT hex(convert(@uF USING tis620));

View File

@ -69,6 +69,35 @@ select * from t1 where a like "%abcd%";
select * from t1 where a like "%abc\d%";
drop table t1;
#
# More LIKE test: bug#2619
#
select 'AA' like 'AA';
select 'AA' like 'A%A';
select 'AA' like 'A%%A';
select 'AA' like 'AA%';
select 'AA' like '%AA%';
select 'AA' like '%A';
select 'AA' like '%AA';
select 'AA' like 'A%A%';
select 'AA' like '_%_%';
select 'AA' like '%A%A';
select 'AAA'like 'A%A%A';
select 'AZ' like 'AZ';
select 'AZ' like 'A%Z';
select 'AZ' like 'A%%Z';
select 'AZ' like 'AZ%';
select 'AZ' like '%AZ%';
select 'AZ' like '%Z';
select 'AZ' like '%AZ';
select 'AZ' like 'A%Z%';
select 'AZ' like '_%_%';
select 'AZ' like '%A%Z';
select 'AZ' like 'A_';
select 'AZ' like '_Z';
select 'AMZ'like 'A%M%Z';
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ucs2);
INSERT INTO t1 VALUES ('ÆÙ×Á'),('æÙ×Á'),('Æù×Á'),('ÆÙ÷Á'),('ÆÙ×á'),('æù÷á');
INSERT INTO t1 VALUES ('ÆÙ×ÁÐÒÏÌÄÖ'),('æÙ×ÁÐÒÏÌÄÖ'),('Æù×ÁÐÒÏÌÄÖ'),('ÆÙ÷ÁÐÒÏÌÄÖ');
@ -93,6 +122,12 @@ SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630025';
SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630061005F';
DROP TABLE t1;
#
# Check that INSERT works fine.
# This invokes charpos() function.
select insert(_ucs2 0x006100620063,10,2,_ucs2 0x006400650066);
select insert(_ucs2 0x006100620063,1,2,_ucs2 0x006400650066);
######################################################
#
@ -192,3 +227,59 @@ DROP TABLE t1;
#
########################################################
# Bug #2390
# Check alignment for constants
#
SELECT HEX(_ucs2 0x0);
SELECT HEX(_ucs2 0x01);
SELECT HEX(_ucs2 0x012);
SELECT HEX(_ucs2 0x0123);
SELECT HEX(_ucs2 0x01234);
SELECT HEX(_ucs2 0x012345);
SELECT HEX(_ucs2 0x0123456);
SELECT HEX(_ucs2 0x01234567);
SELECT HEX(_ucs2 0x012345678);
SELECT HEX(_ucs2 0x0123456789);
SELECT HEX(_ucs2 0x0123456789A);
SELECT HEX(_ucs2 0x0123456789AB);
SELECT HEX(_ucs2 0x0123456789ABC);
SELECT HEX(_ucs2 0x0123456789ABCD);
SELECT HEX(_ucs2 0x0123456789ABCDE);
SELECT HEX(_ucs2 0x0123456789ABCDEF);
#
# Check alignment for from-binary-conversion with CAST and CONVERT
#
SELECT hex(cast(0xAA as char character set ucs2));
SELECT hex(convert(0xAA using ucs2));
#
# Check alignment for string types
#
CREATE TABLE t1 (a char(10) character set ucs2);
INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
SELECT HEX(a) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a varchar(10) character set ucs2);
INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
SELECT HEX(a) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a text character set ucs2);
INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
SELECT HEX(a) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a mediumtext character set ucs2);
INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
SELECT HEX(a) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a longtext character set ucs2);
INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
SELECT HEX(a) FROM t1;
DROP TABLE t1;
-- the same should be also done with enum and set

View File

@ -2,6 +2,9 @@
# Tests with the utf8 character set
#
--disable_warnings
drop table if exists t1;
--enable_warnings
set names utf8;
select left(_utf8 0xD0B0D0B1D0B2,1);
@ -35,3 +38,63 @@ select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%');
#
#select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD091,_utf8 '%');
#
#
# Bug 2367: INSERT() behaviour is different for different charsets.
#
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
#
# CREATE ... SELECT
#
create table t1 select date_format("2004-01-19 10:10:10", "%Y-%m-%d");
show create table t1;
select * from t1;
drop table t1;
#
# Bug #2366 Wrong utf8 behaviour when data is trancated
#
set names koi8r;
create table t1 (s1 char(1) character set utf8);
insert into t1 values (_koi8r'ÁÂ');
select s1,hex(s1),char_length(s1),octet_length(s1) from t1;
drop table t1;
create table t1 (s1 tinytext character set utf8);
insert into t1 select repeat('a',300);
insert into t1 select repeat('Ñ',300);
insert into t1 select repeat('aÑ',300);
insert into t1 select repeat('Ña',300);
insert into t1 select repeat('ÑÑ',300);
select hex(s1) from t1;
select length(s1),char_length(s1) from t1;
drop table t1;
create table t1 (s1 text character set utf8);
insert into t1 select repeat('a',66000);
insert into t1 select repeat('Ñ',66000);
insert into t1 select repeat('aÑ',66000);
insert into t1 select repeat('Ña',66000);
insert into t1 select repeat('ÑÑ',66000);
select length(s1),char_length(s1) from t1;
drop table t1;
#
# Bug #2368 Multibyte charsets do not check that incoming data is well-formed
#
create table t1 (s1 char(10) character set utf8);
insert into t1 values (0x41FF);
select hex(s1) from t1;
drop table t1;
create table t1 (s1 varchar(10) character set utf8);
insert into t1 values (0x41FF);
select hex(s1) from t1;
drop table t1;
create table t1 (s1 text character set utf8);
insert into t1 values (0x41FF);
select hex(s1) from t1;
drop table t1;

View File

@ -2,9 +2,9 @@
# Test of date format functions
#
--disable-warnings
--disable_warnings
drop table if exists t1;
--enable-warnings
--enable_warnings
SHOW GLOBAL VARIABLES LIKE "%_format%";
SHOW SESSION VARIABLES LIKE "%_format%";

Some files were not shown because too many files have changed in this diff Show More