Merging mysql-next-mr-merge to mysql-next-mr.

This commit is contained in:
Alexander Barkov 2009-10-21 15:48:22 +05:00
commit 344ddc85fa
84 changed files with 8980 additions and 646 deletions

View File

@ -80,5 +80,6 @@ enum options_client
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT, OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE, OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE,
OPT_WRITE_BINLOG, OPT_DUMP_DATE, OPT_WRITE_BINLOG, OPT_DUMP_DATE,
OPT_INIT_COMMAND,
OPT_MAX_CLIENT_OPTION OPT_MAX_CLIENT_OPTION
}; };

View File

@ -155,7 +155,8 @@ static char * opt_mysql_unix_port=0;
static int connect_flag=CLIENT_INTERACTIVE; static int connect_flag=CLIENT_INTERACTIVE;
static char *current_host,*current_db,*current_user=0,*opt_password=0, static char *current_host,*current_db,*current_user=0,*opt_password=0,
*current_prompt=0, *delimiter_str= 0, *current_prompt=0, *delimiter_str= 0,
*default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME; *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME,
*opt_init_command= 0;
static char *histfile; static char *histfile;
static char *histfile_tmp; static char *histfile_tmp;
static String glob_buffer,old_buffer; static String glob_buffer,old_buffer;
@ -1384,6 +1385,10 @@ static struct my_option my_long_options[] =
{"ignore-spaces", 'i', "Ignore space after function names.", {"ignore-spaces", 'i', "Ignore space after function names.",
(uchar**) &ignore_spaces, (uchar**) &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0, (uchar**) &ignore_spaces, (uchar**) &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0}, 0, 0, 0, 0},
{"init-command", OPT_INIT_COMMAND,
"SQL Command to execute when connecting to MySQL server. Will automatically be re-executed when reconnecting.",
(uchar**) &opt_init_command, (uchar**) &opt_init_command, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.", {"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.",
(uchar**) &opt_local_infile, (uchar**) &opt_local_infile,
(uchar**) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, (uchar**) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
@ -4203,6 +4208,8 @@ sql_real_connect(char *host,char *database,char *user,char *password,
mysql_close(&mysql); mysql_close(&mysql);
} }
mysql_init(&mysql); mysql_init(&mysql);
if (opt_init_command)
mysql_options(&mysql, MYSQL_INIT_COMMAND, opt_init_command);
if (opt_connect_timeout) if (opt_connect_timeout)
{ {
uint timeout=opt_connect_timeout; uint timeout=opt_connect_timeout;

View File

@ -29,8 +29,8 @@ ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/include/mysqld_error.h
--header_file=${PROJECT_SOURCE_DIR}/include/mysqld_error.h --header_file=${PROJECT_SOURCE_DIR}/include/mysqld_error.h
--name_file=${PROJECT_SOURCE_DIR}/include/mysqld_ername.h --name_file=${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
--state_file=${PROJECT_SOURCE_DIR}/include/sql_state.h --state_file=${PROJECT_SOURCE_DIR}/include/sql_state.h
--in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt --in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg-utf8.txt
DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt) DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg-utf8.txt)
ADD_CUSTOM_TARGET(GenError ADD_CUSTOM_TARGET(GenError
ALL ALL

View File

@ -30,7 +30,7 @@ DIST_SUBDIRS = yassl
# NOTE Built files should depend on their sources to avoid # NOTE Built files should depend on their sources to avoid
# the built files being rebuilt in source dist # the built files being rebuilt in source dist
$(top_builddir)/include/mysqld_error.h: comp_err.c \ $(top_builddir)/include/mysqld_error.h: comp_err.c \
$(top_srcdir)/sql/share/errmsg.txt $(top_srcdir)/sql/share/errmsg-utf8.txt
$(MAKE) $(AM_MAKEFLAGS) comp_err$(EXEEXT) $(MAKE) $(AM_MAKEFLAGS) comp_err$(EXEEXT)
$(top_builddir)/extra/comp_err$(EXEEXT) \ $(top_builddir)/extra/comp_err$(EXEEXT) \
--charset=$(top_srcdir)/sql/share/charsets \ --charset=$(top_srcdir)/sql/share/charsets \
@ -38,7 +38,7 @@ $(top_builddir)/include/mysqld_error.h: comp_err.c \
--header_file=$(top_builddir)/include/mysqld_error.h \ --header_file=$(top_builddir)/include/mysqld_error.h \
--name_file=$(top_builddir)/include/mysqld_ername.h \ --name_file=$(top_builddir)/include/mysqld_ername.h \
--state_file=$(top_builddir)/include/sql_state.h \ --state_file=$(top_builddir)/include/sql_state.h \
--in_file=$(top_srcdir)/sql/share/errmsg.txt --in_file=$(top_srcdir)/sql/share/errmsg-utf8.txt
$(top_builddir)/include/mysqld_ername.h: $(top_builddir)/include/mysqld_error.h $(top_builddir)/include/mysqld_ername.h: $(top_builddir)/include/mysqld_error.h
$(top_builddir)/include/sql_state.h: $(top_builddir)/include/mysqld_error.h $(top_builddir)/include/sql_state.h: $(top_builddir)/include/mysqld_error.h

View File

@ -39,7 +39,7 @@ static char *OUTFILE= (char*) "errmsg.sys";
static char *HEADERFILE= (char*) "mysqld_error.h"; static char *HEADERFILE= (char*) "mysqld_error.h";
static char *NAMEFILE= (char*) "mysqld_ername.h"; static char *NAMEFILE= (char*) "mysqld_ername.h";
static char *STATEFILE= (char*) "sql_state.h"; static char *STATEFILE= (char*) "sql_state.h";
static char *TXTFILE= (char*) "../sql/share/errmsg.txt"; static char *TXTFILE= (char*) "../sql/share/errmsg-utf8.txt";
static char *DATADIRECTORY= (char*) "../sql/share/"; static char *DATADIRECTORY= (char*) "../sql/share/";
#ifndef DBUG_OFF #ifndef DBUG_OFF
static char *default_dbug_option= (char*) "d:t:O,/tmp/comp_err.trace"; static char *default_dbug_option= (char*) "d:t:O,/tmp/comp_err.trace";

View File

@ -477,6 +477,9 @@ uint my_charset_repertoire(CHARSET_INFO *cs);
my_bool my_charset_is_ascii_compatible(CHARSET_INFO *cs); my_bool my_charset_is_ascii_compatible(CHARSET_INFO *cs);
extern size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n,
const char* fmt, va_list ap);
#define _MY_U 01 /* Upper case */ #define _MY_U 01 /* Upper case */
#define _MY_L 02 /* Lower case */ #define _MY_L 02 /* Lower case */
#define _MY_NMR 04 /* Numeral (digit) */ #define _MY_NMR 04 /* Numeral (digit) */

View File

@ -410,6 +410,7 @@ C_MODE_END
#ifndef stdin #ifndef stdin
#include <stdio.h> #include <stdio.h>
#endif #endif
#include <stdarg.h>
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif #endif

View File

@ -53,8 +53,8 @@ typedef struct st_HA_KEYSEG /* Key-portion */
uint16 bit_pos; /* Position to bit part */ uint16 bit_pos; /* Position to bit part */
uint16 flag; uint16 flag;
uint16 length; /* Keylength */ uint16 length; /* Keylength */
uint16 language;
uint8 type; /* Type of key (for sort) */ uint8 type; /* Type of key (for sort) */
uint8 language;
uint8 null_bit; /* bitmask to test for NULL */ uint8 null_bit; /* bitmask to test for NULL */
uint8 bit_start,bit_end; /* if bit field */ uint8 bit_start,bit_end; /* if bit field */
uint8 bit_length; /* Length of bit part */ uint8 bit_length; /* Length of bit part */

View File

@ -241,8 +241,9 @@ extern uint my_large_page_size;
#endif #endif
/* charsets */ /* charsets */
#define MY_ALL_CHARSETS_SIZE 2048
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *default_charset_info; extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *default_charset_info;
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *all_charsets[256]; extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *all_charsets[MY_ALL_CHARSETS_SIZE];
extern CHARSET_INFO compiled_charsets[]; extern CHARSET_INFO compiled_charsets[];
/* statistics */ /* statistics */
@ -668,6 +669,7 @@ extern void my_osmaperr(unsigned long last_error);
extern void TERMINATE(FILE *file, uint flag); extern void TERMINATE(FILE *file, uint flag);
#endif #endif
extern void init_glob_errs(void); extern void init_glob_errs(void);
extern const char** get_global_errmsgs();
extern void wait_for_free_space(const char *filename, int errors); extern void wait_for_free_space(const char *filename, int errors);
extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags); extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags); extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
@ -681,7 +683,8 @@ extern void my_error _VARARGS((int nr,myf MyFlags, ...));
extern void my_printf_error _VARARGS((uint my_err, const char *format, extern void my_printf_error _VARARGS((uint my_err, const char *format,
myf MyFlags, ...)) myf MyFlags, ...))
ATTRIBUTE_FORMAT(printf, 2, 4); ATTRIBUTE_FORMAT(printf, 2, 4);
extern int my_error_register(const char **errmsgs, int first, int last); extern int my_error_register(const char** (*get_errmsgs) (),
int first, int last);
extern const char **my_error_unregister(int first, int last); extern const char **my_error_unregister(int first, int last);
extern void my_message(uint my_err, const char *str,myf MyFlags); extern void my_message(uint my_err, const char *str,myf MyFlags);
extern void my_message_no_curses(uint my_err, const char *str,myf MyFlags); extern void my_message_no_curses(uint my_err, const char *str,myf MyFlags);

View File

@ -162,7 +162,7 @@ typedef struct st_mi_create_info
ulonglong data_file_length; ulonglong data_file_length;
ulonglong key_file_length; ulonglong key_file_length;
uint old_options; uint old_options;
uint8 language; uint16 language;
my_bool with_auto_increment; my_bool with_auto_increment;
} MI_CREATE_INFO; } MI_CREATE_INFO;
@ -410,7 +410,7 @@ typedef struct st_mi_check_param
uint out_flag,warning_printed,error_printed,verbose; uint out_flag,warning_printed,error_printed,verbose;
uint opt_sort_key,total_files,max_level; uint opt_sort_key,total_files,max_level;
uint testflag, key_cache_block_size; uint testflag, key_cache_block_size;
uint8 language; uint16 language;
my_bool using_global_keycache, opt_lock_memory, opt_follow_links; my_bool using_global_keycache, opt_lock_memory, opt_follow_links;
my_bool retry_repair, force_sort; my_bool retry_repair, force_sort;
char temp_filename[FN_REFLEN],*isam_file_name; char temp_filename[FN_REFLEN],*isam_file_name;

View File

@ -219,6 +219,10 @@ const char *client_errors[]=
}; };
#endif #endif
const char** get_client_errmsgs()
{
return client_errors;
}
/* /*
Register client error messages for use with my_error(). Register client error messages for use with my_error().
@ -232,7 +236,7 @@ const char *client_errors[]=
void init_client_errs(void) void init_client_errs(void)
{ {
(void) my_error_register(client_errors, CR_ERROR_FIRST, CR_ERROR_LAST); (void) my_error_register(get_client_errmsgs, CR_ERROR_FIRST, CR_ERROR_LAST);
} }

View File

@ -1090,6 +1090,9 @@ net_send_eof(THD *thd, uint server_status, uint statement_warn_count)
bool net_send_error_packet(THD *thd, uint sql_errno, const char *err, bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
const char *sqlstate) const char *sqlstate)
{ {
uint error;
uchar converted_err[MYSQL_ERRMSG_SIZE];
uint32 converted_err_len;
MYSQL_DATA *data= thd->cur_data; MYSQL_DATA *data= thd->cur_data;
struct embedded_query_result *ei; struct embedded_query_result *ei;
@ -1104,7 +1107,12 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
ei= data->embedded_info; ei= data->embedded_info;
ei->last_errno= sql_errno; ei->last_errno= sql_errno;
strmake(ei->info, err, sizeof(ei->info)-1); converted_err_len= convert_error_message((char*)converted_err,
sizeof(converted_err),
thd->variables.character_set_results,
err, strlen(err),
system_charset_info, &error);
strmake(ei->info, (const char*) converted_err, sizeof(ei->info)-1);
strmov(ei->sqlstate, sqlstate); strmov(ei->sqlstate, sqlstate);
ei->server_status= thd->server_status; ei->server_status= thd->server_status;
thd->cur_data= 0; thd->cur_data= 0;

View File

@ -39,7 +39,7 @@ sub fix_charset_dir {
sub fix_language { sub fix_language {
my ($self, $config, $group_name, $group)= @_; my ($self, $config, $group_name, $group)= @_;
return my_find_dir($self->get_basedir($group), return my_find_dir($self->get_basedir($group),
\@share_locations, "english"); \@share_locations);
} }
sub fix_datadir { sub fix_datadir {
@ -197,7 +197,7 @@ my @mysqld_rules=
{ 'basedir' => sub { return shift->{ARGS}->{basedir}; } }, { 'basedir' => sub { return shift->{ARGS}->{basedir}; } },
{ 'tmpdir' => \&fix_tmpdir }, { 'tmpdir' => \&fix_tmpdir },
{ 'character-sets-dir' => \&fix_charset_dir }, { 'character-sets-dir' => \&fix_charset_dir },
{ 'language' => \&fix_language }, { 'lc-messages-dir' => \&fix_language },
{ 'datadir' => \&fix_datadir }, { 'datadir' => \&fix_datadir },
{ 'pid-file' => \&fix_pidfile }, { 'pid-file' => \&fix_pidfile },
{ '#host' => \&fix_host }, { '#host' => \&fix_host },

View File

@ -67,11 +67,11 @@ is( $config->value('client', 'host'),
ok ( $config->value("mysqld.1", 'character-sets-dir') =~ /$basedir.*charsets$/, ok ( $config->value("mysqld.1", 'character-sets-dir') =~ /$basedir.*charsets$/,
"'character-sets-dir' generated"); "'character-sets-dir' generated");
ok ( $config->value("mysqld.1", 'language') =~ /$basedir.*english$/, ok ( $config->value("mysqld.1", 'lc-messages-dir') =~ /$basedir.*share$/,
"'language' generated"); "'lc-messages-dir' generated");
ok ( $config->value("ENV", 'MASTER_MY_PORT') =~ /\d/, ok ( $config->value("ENV", 'MASTER_MY_PORT') =~ /\d/,
"'language' generated"); "'lc-messages-dir' generated");
my $gen2_cnf= "$dir/gen2.cnf"; my $gen2_cnf= "$dir/gen2.cnf";
open(OUT, ">", $gen2_cnf) or die; open(OUT, ">", $gen2_cnf) or die;

View File

@ -957,12 +957,12 @@ sub command_line_setup {
} }
# Look for language files and charsetsdir, use same share # Look for language files and charsetsdir, use same share
$path_language= mtr_path_exists("$basedir/share/mysql/english", $path_language= mtr_path_exists("$basedir/share/mysql",
"$basedir/sql/share/english", "$basedir/sql/share",
"$basedir/share/english"); "$basedir/share");
my $path_share= dirname($path_language); my $path_share= $path_language;
$path_charsetsdir= mtr_path_exists("$path_share/charsets"); $path_charsetsdir= mtr_path_exists("$path_share/charsets");
if (using_extern()) if (using_extern())
@ -1434,7 +1434,7 @@ sub collect_mysqld_features {
mtr_init_args(\$args); mtr_init_args(\$args);
mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--datadir=%s", mixed_path($tmpdir)); mtr_add_arg($args, "--datadir=%s", mixed_path($tmpdir));
mtr_add_arg($args, "--language=%s", $path_language); mtr_add_arg($args, "--lc-messages-dir=%s", $path_language);
mtr_add_arg($args, "--skip-grant-tables"); mtr_add_arg($args, "--skip-grant-tables");
mtr_add_arg($args, "--verbose"); mtr_add_arg($args, "--verbose");
mtr_add_arg($args, "--help"); mtr_add_arg($args, "--help");
@ -2702,7 +2702,7 @@ sub mysql_install_db {
my $install_datadir= $datadir || $mysqld->value('datadir'); my $install_datadir= $datadir || $mysqld->value('datadir');
my $install_basedir= $mysqld->value('basedir'); my $install_basedir= $mysqld->value('basedir');
my $install_lang= $mysqld->value('language'); my $install_lang= $mysqld->value('lc-messages-dir');
my $install_chsdir= $mysqld->value('character-sets-dir'); my $install_chsdir= $mysqld->value('character-sets-dir');
mtr_report("Installing system database..."); mtr_report("Installing system database...");
@ -2725,7 +2725,7 @@ sub mysql_install_db {
$path_vardir_trace); $path_vardir_trace);
} }
mtr_add_arg($args, "--language=%s", $install_lang); mtr_add_arg($args, "--lc-messages-dir=%s", $install_lang);
mtr_add_arg($args, "--character-sets-dir=%s", $install_chsdir); mtr_add_arg($args, "--character-sets-dir=%s", $install_chsdir);
# If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g., # If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g.,

View File

@ -47,11 +47,11 @@ insert into t1 values (0x01,0x01);
select * from t1 where a=b; select * from t1 where a=b;
a b a b
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '' Warning 1292 Truncated incorrect DOUBLE value: '\x01'
select * from t1 where a=b and b=0x01; select * from t1 where a=b and b=0x01;
a b a b
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '' Warning 1292 Truncated incorrect DOUBLE value: '\x01'
drop table if exists t1; drop table if exists t1;
CREATE TABLE t1 (b int(2) zerofill, c int(2) zerofill); CREATE TABLE t1 (b int(2) zerofill, c int(2) zerofill);
INSERT INTO t1 (b,c) VALUES (1,2), (1,1), (2,2); INSERT INTO t1 (b,c) VALUES (1,2), (1,1), (2,2);

View File

@ -0,0 +1,32 @@
Start of 5.4 tests
CREATE TABLE t1(f1 INT);
SET lc_messages=ru_RU;
SHOW VARIABLES LIKE 'lc_messages';
Variable_name Value
lc_messages ru_RU
CREATE TABLE t1(f1 INT);
ERROR 42S01: \0422\0430\0431\043B\0438\0446\0430 't1' \0443\0436\0435 \0441\0443\0449\0435\0441\0442\0432\0443\0435\0442
SET NAMES utf8;
CREATE TABLE t1(f1 INT);
ERROR 42S01: Таблица 't1' уже существует
SHOW VARIABLES LIKE 'lc_messages';
Variable_name Value
lc_messages en_US
CREATE TABLE t1(f1 INT);
ERROR 42S01: Table 't1' already exists
SHOW GLOBAL VARIABLES LIKE 'lc_messages';
Variable_name Value
lc_messages en_US
SET GLOBAL lc_messages=ru_RU;
SHOW GLOBAL VARIABLES LIKE 'lc_messages';
Variable_name Value
lc_messages ru_RU
SET GLOBAL lc_messages=en_US;
DROP TABLE t1;
drop table `ק`;
ERROR 42S02: Unknown table 'ק'
SET lc_messages=cs_CZ;
SET NAMES UTF8;
USE nonexistant;
ERROR 42000: Nezn-Bámá databáze 'nonexistant'
End of 5.4 tests

Binary file not shown.

View File

@ -162,10 +162,10 @@ Field Type Null Key Default Extra
DROP TABLE t1; DROP TABLE t1;
SET NAMES binary; SET NAMES binary;
CREATE TABLE `goodÐÌÏÈÏ` (a int); CREATE TABLE `goodÐÌÏÈÏ` (a int);
ERROR HY000: Invalid utf8 character string: 'ÐÌÏÈÏ' ERROR HY000: Invalid utf8 character string: 'good\xD0\xCC\xCF\xC8\xCF'
SET NAMES utf8; SET NAMES utf8;
CREATE TABLE `goodÐÌÏÈÏ` (a int); CREATE TABLE `goodÐÌÏÈÏ` (a int);
ERROR HY000: Invalid utf8 character string: 'ÐÌÏÈÏ' ERROR HY000: Invalid utf8 character string: 'good\xD0\xCC\xCF\xC8\xCF'
set names latin1; set names latin1;
create table t1 (a char(10) character set koi8r, b text character set koi8r); create table t1 (a char(10) character set koi8r, b text character set koi8r);
insert into t1 values ('test','test'); insert into t1 values ('test','test');

View File

@ -19,7 +19,7 @@ col2 VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL,
UNIQUE KEY key1 USING HASH (col1, col2)) ENGINE=MEMORY; UNIQUE KEY key1 USING HASH (col1, col2)) ENGINE=MEMORY;
INSERT INTO t1 VALUES('A', 'A'), ('B', 'B'), ('C', 'C'); INSERT INTO t1 VALUES('A', 'A'), ('B', 'B'), ('C', 'C');
INSERT INTO t1 VALUES('A ', 'A '); INSERT INTO t1 VALUES('A ', 'A ');
ERROR 23000: Duplicate entry '' for key 'key1' ERROR 23000: Duplicate entry 'A -A ' for key 'key1'
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
c1 CHAR(255) CHARACTER SET UCS2 COLLATE UCS2_BIN NOT NULL, c1 CHAR(255) CHARACTER SET UCS2 COLLATE UCS2_BIN NOT NULL,

View File

@ -363,9 +363,9 @@ create table t1 (c varchar(30) character set utf8, unique(c(10)));
insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z'); insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
insert into t1 values ('aaaaaaaaaa'); insert into t1 values ('aaaaaaaaaa');
insert into t1 values ('aaaaaaaaaaa'); insert into t1 values ('aaaaaaaaaaa');
ERROR 23000: Duplicate entry 'aaaaaaaaaaa' for key 'c' ERROR 23000: Duplicate entry 'aaaaaaaaaa' for key 'c'
insert into t1 values ('aaaaaaaaaaaa'); insert into t1 values ('aaaaaaaaaaaa');
ERROR 23000: Duplicate entry 'aaaaaaaaaaaa' for key 'c' ERROR 23000: Duplicate entry 'aaaaaaaaaa' for key 'c'
insert into t1 values (repeat('b',20)); insert into t1 values (repeat('b',20));
select c c1 from t1 where c='1'; select c c1 from t1 where c='1';
c1 c1
@ -396,9 +396,9 @@ create table t1 (c varchar(30) character set utf8, unique(c(10))) engine=innodb;
insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z'); insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
insert into t1 values ('aaaaaaaaaa'); insert into t1 values ('aaaaaaaaaa');
insert into t1 values ('aaaaaaaaaaa'); insert into t1 values ('aaaaaaaaaaa');
ERROR 23000: Duplicate entry 'aaaaaaaaaaa' for key 'c' ERROR 23000: Duplicate entry 'aaaaaaaaaa' for key 'c'
insert into t1 values ('aaaaaaaaaaaa'); insert into t1 values ('aaaaaaaaaaaa');
ERROR 23000: Duplicate entry 'aaaaaaaaaaaa' for key 'c' ERROR 23000: Duplicate entry 'aaaaaaaaaa' for key 'c'
insert into t1 values (repeat('b',20)); insert into t1 values (repeat('b',20));
select c c1 from t1 where c='1'; select c c1 from t1 where c='1';
c1 c1
@ -430,19 +430,19 @@ insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
insert into t1 values ('a'); insert into t1 values ('a');
insert into t1 values ('aa'); insert into t1 values ('aa');
insert into t1 values ('aaa'); insert into t1 values ('aaa');
ERROR 23000: Duplicate entry 'aaa' for key 'c' ERROR 23000: Duplicate entry 'aa' for key 'c'
insert into t1 values ('b'); insert into t1 values ('b');
insert into t1 values ('bb'); insert into t1 values ('bb');
insert into t1 values ('bbb'); insert into t1 values ('bbb');
ERROR 23000: Duplicate entry 'bbb' for key 'c' ERROR 23000: Duplicate entry 'bb' for key 'c'
insert into t1 values ('а'); insert into t1 values ('а');
insert into t1 values ('аа'); insert into t1 values ('аа');
insert into t1 values ('ааа'); insert into t1 values ('ааа');
ERROR 23000: Duplicate entry 'ааа' for key 'c' ERROR 23000: Duplicate entry 'аа' for key 'c'
insert into t1 values ('б'); insert into t1 values ('б');
insert into t1 values ('бб'); insert into t1 values ('бб');
insert into t1 values ('ббб'); insert into t1 values ('ббб');
ERROR 23000: Duplicate entry 'ббб' for key 'c' ERROR 23000: Duplicate entry 'бб' for key 'c'
insert into t1 values ('ꪪ'); insert into t1 values ('ꪪ');
insert into t1 values ('ꪪꪪ'); insert into t1 values ('ꪪꪪ');
insert into t1 values ('ꪪꪪꪪ'); insert into t1 values ('ꪪꪪꪪ');
@ -453,19 +453,19 @@ insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
insert into t1 values ('a'); insert into t1 values ('a');
insert into t1 values ('aa'); insert into t1 values ('aa');
insert into t1 values ('aaa'); insert into t1 values ('aaa');
ERROR 23000: Duplicate entry 'aaa' for key 'c' ERROR 23000: Duplicate entry 'aa' for key 'c'
insert into t1 values ('b'); insert into t1 values ('b');
insert into t1 values ('bb'); insert into t1 values ('bb');
insert into t1 values ('bbb'); insert into t1 values ('bbb');
ERROR 23000: Duplicate entry 'bbb' for key 'c' ERROR 23000: Duplicate entry 'bb' for key 'c'
insert into t1 values ('а'); insert into t1 values ('а');
insert into t1 values ('аа'); insert into t1 values ('аа');
insert into t1 values ('ааа'); insert into t1 values ('ааа');
ERROR 23000: Duplicate entry 'ааа' for key 'c' ERROR 23000: Duplicate entry 'аа' for key 'c'
insert into t1 values ('б'); insert into t1 values ('б');
insert into t1 values ('бб'); insert into t1 values ('бб');
insert into t1 values ('ббб'); insert into t1 values ('ббб');
ERROR 23000: Duplicate entry 'ббб' for key 'c' ERROR 23000: Duplicate entry 'бб' for key 'c'
insert into t1 values ('ꪪ'); insert into t1 values ('ꪪ');
insert into t1 values ('ꪪꪪ'); insert into t1 values ('ꪪꪪ');
insert into t1 values ('ꪪꪪꪪ'); insert into t1 values ('ꪪꪪꪪ');
@ -483,14 +483,14 @@ t1 CREATE TABLE `t1` (
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa'); insert into t1 values ('aa');
ERROR 23000: Duplicate entry 'aa' for key 'a' ERROR 23000: Duplicate entry 'a' for key 'a'
insert into t1 values ('aaa'); insert into t1 values ('aaa');
ERROR 23000: Duplicate entry 'aaa' for key 'a' ERROR 23000: Duplicate entry 'a' for key 'a'
insert into t1 values ('б'); insert into t1 values ('б');
insert into t1 values ('бб'); insert into t1 values ('бб');
ERROR 23000: Duplicate entry 'бÐ' for key 'a' ERROR 23000: Duplicate entry 'б' for key 'a'
insert into t1 values ('ббб'); insert into t1 values ('ббб');
ERROR 23000: Duplicate entry 'бÐ' for key 'a' ERROR 23000: Duplicate entry 'б' for key 'a'
select c as c_all from t1 order by c; select c as c_all from t1 order by c;
c_all c_all
a a
@ -519,14 +519,14 @@ t1 CREATE TABLE `t1` (
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa'); insert into t1 values ('aa');
ERROR 23000: Duplicate entry 'aa' for key 'a' ERROR 23000: Duplicate entry 'a' for key 'a'
insert into t1 values ('aaa'); insert into t1 values ('aaa');
ERROR 23000: Duplicate entry 'aaa' for key 'a' ERROR 23000: Duplicate entry 'a' for key 'a'
insert into t1 values ('б'); insert into t1 values ('б');
insert into t1 values ('бб'); insert into t1 values ('бб');
ERROR 23000: Duplicate entry 'бÐ' for key 'a' ERROR 23000: Duplicate entry 'б' for key 'a'
insert into t1 values ('ббб'); insert into t1 values ('ббб');
ERROR 23000: Duplicate entry 'бÐ' for key 'a' ERROR 23000: Duplicate entry 'б' for key 'a'
select c as c_all from t1 order by c; select c as c_all from t1 order by c;
c_all c_all
a a
@ -549,14 +549,14 @@ unique key a (c(1))
) engine=innodb; ) engine=innodb;
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa'); insert into t1 values ('aa');
ERROR 23000: Duplicate entry 'aa' for key 'a' ERROR 23000: Duplicate entry 'a' for key 'a'
insert into t1 values ('aaa'); insert into t1 values ('aaa');
ERROR 23000: Duplicate entry 'aaa' for key 'a' ERROR 23000: Duplicate entry 'a' for key 'a'
insert into t1 values ('б'); insert into t1 values ('б');
insert into t1 values ('бб'); insert into t1 values ('бб');
ERROR 23000: Duplicate entry 'бÐ' for key 'a' ERROR 23000: Duplicate entry 'б' for key 'a'
insert into t1 values ('ббб'); insert into t1 values ('ббб');
ERROR 23000: Duplicate entry 'бÐ' for key 'a' ERROR 23000: Duplicate entry 'б' for key 'a'
select c as c_all from t1 order by c; select c as c_all from t1 order by c;
c_all c_all
a a
@ -577,9 +577,9 @@ create table t1 (c varchar(30) character set utf8 collate utf8_bin, unique(c(10)
insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z'); insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
insert into t1 values ('aaaaaaaaaa'); insert into t1 values ('aaaaaaaaaa');
insert into t1 values ('aaaaaaaaaaa'); insert into t1 values ('aaaaaaaaaaa');
ERROR 23000: Duplicate entry 'aaaaaaaaaaa' for key 'c' ERROR 23000: Duplicate entry 'aaaaaaaaaa' for key 'c'
insert into t1 values ('aaaaaaaaaaaa'); insert into t1 values ('aaaaaaaaaaaa');
ERROR 23000: Duplicate entry 'aaaaaaaaaaaa' for key 'c' ERROR 23000: Duplicate entry 'aaaaaaaaaa' for key 'c'
insert into t1 values (repeat('b',20)); insert into t1 values (repeat('b',20));
select c c1 from t1 where c='1'; select c c1 from t1 where c='1';
c1 c1
@ -611,19 +611,19 @@ insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
insert into t1 values ('a'); insert into t1 values ('a');
insert into t1 values ('aa'); insert into t1 values ('aa');
insert into t1 values ('aaa'); insert into t1 values ('aaa');
ERROR 23000: Duplicate entry 'aaa' for key 'c' ERROR 23000: Duplicate entry 'aa' for key 'c'
insert into t1 values ('b'); insert into t1 values ('b');
insert into t1 values ('bb'); insert into t1 values ('bb');
insert into t1 values ('bbb'); insert into t1 values ('bbb');
ERROR 23000: Duplicate entry 'bbb' for key 'c' ERROR 23000: Duplicate entry 'bb' for key 'c'
insert into t1 values ('а'); insert into t1 values ('а');
insert into t1 values ('аа'); insert into t1 values ('аа');
insert into t1 values ('ааа'); insert into t1 values ('ааа');
ERROR 23000: Duplicate entry 'ааа' for key 'c' ERROR 23000: Duplicate entry 'аа' for key 'c'
insert into t1 values ('б'); insert into t1 values ('б');
insert into t1 values ('бб'); insert into t1 values ('бб');
insert into t1 values ('ббб'); insert into t1 values ('ббб');
ERROR 23000: Duplicate entry 'ббб' for key 'c' ERROR 23000: Duplicate entry 'бб' for key 'c'
insert into t1 values ('ꪪ'); insert into t1 values ('ꪪ');
insert into t1 values ('ꪪꪪ'); insert into t1 values ('ꪪꪪ');
insert into t1 values ('ꪪꪪꪪ'); insert into t1 values ('ꪪꪪꪪ');
@ -641,14 +641,14 @@ t1 CREATE TABLE `t1` (
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa'); insert into t1 values ('aa');
ERROR 23000: Duplicate entry 'aa' for key 'a' ERROR 23000: Duplicate entry 'a' for key 'a'
insert into t1 values ('aaa'); insert into t1 values ('aaa');
ERROR 23000: Duplicate entry 'aaa' for key 'a' ERROR 23000: Duplicate entry 'a' for key 'a'
insert into t1 values ('б'); insert into t1 values ('б');
insert into t1 values ('бб'); insert into t1 values ('бб');
ERROR 23000: Duplicate entry 'бÐ' for key 'a' ERROR 23000: Duplicate entry 'б' for key 'a'
insert into t1 values ('ббб'); insert into t1 values ('ббб');
ERROR 23000: Duplicate entry 'бÐ' for key 'a' ERROR 23000: Duplicate entry 'б' for key 'a'
select c as c_all from t1 order by c; select c as c_all from t1 order by c;
c_all c_all
a a
@ -677,14 +677,14 @@ t1 CREATE TABLE `t1` (
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa'); insert into t1 values ('aa');
ERROR 23000: Duplicate entry 'aa' for key 'a' ERROR 23000: Duplicate entry 'a' for key 'a'
insert into t1 values ('aaa'); insert into t1 values ('aaa');
ERROR 23000: Duplicate entry 'aaa' for key 'a' ERROR 23000: Duplicate entry 'a' for key 'a'
insert into t1 values ('б'); insert into t1 values ('б');
insert into t1 values ('бб'); insert into t1 values ('бб');
ERROR 23000: Duplicate entry 'бÐ' for key 'a' ERROR 23000: Duplicate entry 'б' for key 'a'
insert into t1 values ('ббб'); insert into t1 values ('ббб');
ERROR 23000: Duplicate entry 'бÐ' for key 'a' ERROR 23000: Duplicate entry 'б' for key 'a'
select c as c_all from t1 order by c; select c as c_all from t1 order by c;
c_all c_all
a a
@ -707,14 +707,14 @@ unique key a (c(1))
) engine=innodb; ) engine=innodb;
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa'); insert into t1 values ('aa');
ERROR 23000: Duplicate entry 'aa' for key 'a' ERROR 23000: Duplicate entry 'a' for key 'a'
insert into t1 values ('aaa'); insert into t1 values ('aaa');
ERROR 23000: Duplicate entry 'aaa' for key 'a' ERROR 23000: Duplicate entry 'a' for key 'a'
insert into t1 values ('б'); insert into t1 values ('б');
insert into t1 values ('бб'); insert into t1 values ('бб');
ERROR 23000: Duplicate entry 'бÐ' for key 'a' ERROR 23000: Duplicate entry 'б' for key 'a'
insert into t1 values ('ббб'); insert into t1 values ('ббб');
ERROR 23000: Duplicate entry 'бÐ' for key 'a' ERROR 23000: Duplicate entry 'б' for key 'a'
select c as c_all from t1 order by c; select c as c_all from t1 order by c;
c_all c_all
a a

View File

@ -55,3 +55,32 @@ Error 1054 Unknown column 'b' in 'field list'
INSERT INTO t1 SELECT b FROM t1; INSERT INTO t1 SELECT b FROM t1;
ERROR 42S22: Unknown column 'b' in 'field list' ERROR 42S22: Unknown column 'b' in 'field list'
DROP TABLE t1; DROP TABLE t1;
SET NAMES utf8;
SET sql_quote_show_create= _binary x'5452C39C45';
ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TR\xC3\x9CE'
SET sql_quote_show_create= _utf8 x'5452C39C45';
ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TRÜE'
SET sql_quote_show_create=_latin1 x'5452DC45';
ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TRÜE'
SET sql_quote_show_create='TRÜE';
ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TRÜE'
SET sql_quote_show_create=TRÜE;
ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TRÜE'
SET NAMES latin1;
SET sql_quote_show_create= _binary x'5452C39C45';
ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TR\xC3\x9CE'
SET sql_quote_show_create= _utf8 x'5452C39C45';
ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TRÜE'
SET sql_quote_show_create=_latin1 x'5452DC45';
ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TRÜE'
SET sql_quote_show_create='TR.E';
ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TR.E'
SET sql_quote_show_create=TR.E;
ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'E'
SET NAMES binary;
SET sql_quote_show_create= _binary x'5452C39C45';
ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TR\xC3\x9CE'
SET sql_quote_show_create= _utf8 x'5452C39C45';
ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TRÜE'
SET sql_quote_show_create=_latin1 x'5452DC45';
ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TRÜE'

View File

@ -16,7 +16,7 @@ DROP EVENT Lower_case;
SET NAMES cp1251; SET NAMES cp1251;
CREATE EVENT äîëåí_ðåãèñòúð_1251 ON SCHEDULE EVERY 1 YEAR DO SELECT 100; CREATE EVENT äîëåí_ðåãèñòúð_1251 ON SCHEDULE EVERY 1 YEAR DO SELECT 100;
CREATE EVENT ÄîËåÍ_ðåãèñòúð_1251 ON SCHEDULE EVERY 2 YEAR DO SELECT 200; CREATE EVENT ÄîËåÍ_ðåãèñòúð_1251 ON SCHEDULE EVERY 2 YEAR DO SELECT 200;
ERROR HY000: Event 'ДоЛеН_регистър_1251' already exists ERROR HY000: Event 'ÄîËåÍ_ðåãèñòúð_1251' already exists
DROP EVENT ÄîËåÍ_ðåãèñòúð_1251; DROP EVENT ÄîËåÍ_ðåãèñòúð_1251;
SET NAMES utf8; SET NAMES utf8;
CREATE EVENT долен_региÑ<C2B8>ÑÑŠÑ€_уÑÑ„8 ON SCHEDULE EVERY 3 YEAR DO SELECT 300; CREATE EVENT долен_региÑ<C2B8>ÑÑŠÑ€_уÑÑ„8 ON SCHEDULE EVERY 3 YEAR DO SELECT 300;

View File

@ -2725,7 +2725,7 @@ create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb;
create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb; create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb;
insert into t1 values (0x41),(0x4120),(0x4100); insert into t1 values (0x41),(0x4120),(0x4100);
insert into t2 values (0x41),(0x4120),(0x4100); insert into t2 values (0x41),(0x4120),(0x4100);
ERROR 23000: Duplicate entry 'A' for key 'PRIMARY' ERROR 23000: Duplicate entry 'A\x00' for key 'PRIMARY'
insert into t2 values (0x41),(0x4120); insert into t2 values (0x41),(0x4120);
insert into t3 values (0x41),(0x4120),(0x4100); insert into t3 values (0x41),(0x4120),(0x4100);
ERROR 23000: Duplicate entry 'A ' for key 'PRIMARY' ERROR 23000: Duplicate entry 'A ' for key 'PRIMARY'

View File

@ -251,13 +251,13 @@ insert t1 values ('cccc', 'tttt'),
(0xD0B1212223D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1212223D0B1D0B1D0B1D0B1), (0xD0B1212223D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1212223D0B1D0B1D0B1D0B1),
(0xD0B1222123D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1222123D0B1D0B1D0B1D0B1); (0xD0B1222123D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1222123D0B1D0B1D0B1D0B1);
insert t1 (c) values ('cc22'); insert t1 (c) values ('cc22');
ERROR 23000: Duplicate entry 'cc22' for key 'c' ERROR 23000: Duplicate entry 'cc' for key 'c'
insert t1 (t) values ('ttt22'); insert t1 (t) values ('ttt22');
ERROR 23000: Duplicate entry 'ttt22' for key 't' ERROR 23000: Duplicate entry 'ttt' for key 't'
insert t1 (c) values (0xD0B1212322D0B1D0B1D0B1D0B1D0B1); insert t1 (c) values (0xD0B1212322D0B1D0B1D0B1D0B1D0B1);
ERROR 23000: Duplicate entry 'б!#"Ð' for key 'c' ERROR 23000: Duplicate entry '\0431!' for key 'c'
insert t1 (t) values (0xD0B1D0B1212322D0B1D0B1D0B1D0B1); insert t1 (t) values (0xD0B1D0B1212322D0B1D0B1D0B1D0B1);
ERROR 23000: Duplicate entry 'бб!#"б' for key 't' ERROR 23000: Duplicate entry '\0431\0431!' for key 't'
select c from t1 where c='cccc'; select c from t1 where c='cccc';
c c
cccc cccc

View File

@ -0,0 +1,79 @@
drop table if exists t1, t2;
create table t1 (a int, b varchar(64));
-- Load a static XML file
load xml infile '../../std_data/loadxml.dat' into table t1
rows identified by '<row>';
select * from t1 order by a;
a b
1 b1
2 b2
3 b3
11 b11
111 b111
112 b112 & < > " ' &unknown; -- check entities
212 b212
213 b213
214 b214
215 b215
216 &bb b;
delete from t1;
-- Load a static XML file with 'IGNORE num ROWS'
load xml infile '../../std_data/loadxml.dat' into table t1
rows identified by '<row>' ignore 4 rows;
select * from t1 order by a;
a b
111 b111
112 b112 & < > " ' &unknown; -- check entities
212 b212
213 b213
214 b214
215 b215
216 &bb b;
-- Check 'mysqldump --xml' + 'LOAD XML' round trip
delete from t1;
load xml infile 'MYSQLTEST_VARDIR/tmp/loadxml-dump.xml' into table t1 rows identified by '<row>';;
select * from t1 order by a;
a b
111 b111
112 b112 & < > " ' &unknown; -- check entities
212 b212
213 b213
214 b214
215 b215
216 &bb b;
--Check that default row tag is '<row>
delete from t1;
load xml infile 'MYSQLTEST_VARDIR/tmp/loadxml-dump.xml' into table t1;;
select * from t1 order by a;
a b
111 b111
112 b112 & < > " ' &unknown; -- check entities
212 b212
213 b213
214 b214
215 b215
216 &bb b;
-- Check that 'xml' is not a keyword
select 1 as xml;
xml
1
create table t2(fl text);
LOAD XML LOCAL INFILE "$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" INTO TABLE t2 ROWS IDENTIFIED BY '<person>';;
show processlist;
Id User Host db Command Time State Info
# root localhost test Query # NULL show processlist
# root localhost test Query # Reading from net LOAD XML LOCAL INFILE "$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" INTO TABLE t2 ROWS IDENTIFIED BY '<p
drop table t1;
drop table t2;
create table t1 (
id int(11) not null,
text text,
primary key (id)
) engine=MyISAM default charset=latin1;
load xml infile '../../std_data/loadxml2.dat' into table t1;
select * from t1;
id text
1 line1
line2
line3
drop table t1;

View File

@ -207,6 +207,8 @@ Warning (Code 1286): Unknown table engine 'nonexistent2'
Warning (Code 1266): Using storage engine MyISAM for table 't2' Warning (Code 1266): Using storage engine MyISAM for table 't2'
Error (Code 1050): Table 't2' already exists Error (Code 1050): Table 't2' already exists
drop tables t1, t2; drop tables t1, t2;
Variable_name Value
lc_messages ru_RU
<TABLE BORDER=1><TR><TH>&lt;</TH></TR><TR><TD>&lt; &amp; &gt;</TD></TR></TABLE>create table t1 (a char(5)); <TABLE BORDER=1><TR><TH>&lt;</TH></TR><TR><TD>&lt; &amp; &gt;</TD></TR></TABLE>create table t1 (a char(5));
insert into t1 values ('\0b\0'); insert into t1 values ('\0b\0');
a a

View File

@ -2332,21 +2332,21 @@ DECLARE céèçà foo CONDITION FOR SQLSTATE '12345';
SIGNAL céèçà SET MYSQL_ERRNO = 1000; SIGNAL céèçà SET MYSQL_ERRNO = 1000;
end $$ end $$
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 '©Ã¨Ã§Ã  foo CONDITION FOR SQLSTATE '12345'; 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 '©Ã¨Ã§Ã  foo CONDITION FOR SQLSTATE '12345';
SIGNAL céèçà SET MYSQL_ERRNO = 1' at line 3 SIGNAL céèçà SET ' at line 3
create procedure test_signal() create procedure test_signal()
begin begin
DECLARE "céèçà" CONDITION FOR SQLSTATE '12345'; DECLARE "céèçà" CONDITION FOR SQLSTATE '12345';
SIGNAL "céèçà" SET MYSQL_ERRNO = 1000; SIGNAL "céèçà" SET MYSQL_ERRNO = 1000;
end $$ end $$
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 '"céèçà" CONDITION FOR SQLSTATE '12345'; 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 '"céèçà" CONDITION FOR SQLSTATE '12345';
SIGNAL "céèçà" SET MYSQL_ERRNO =' at line 3 SIGNAL "céèçà" S' at line 3
create procedure test_signal() create procedure test_signal()
begin begin
DECLARE 'céèçà' CONDITION FOR SQLSTATE '12345'; DECLARE 'céèçà' CONDITION FOR SQLSTATE '12345';
SIGNAL 'céèçà' SET MYSQL_ERRNO = 1000; SIGNAL 'céèçà' SET MYSQL_ERRNO = 1000;
end $$ end $$
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 ''céèçà' CONDITION FOR SQLSTATE '12345'; 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 ''céèçà' CONDITION FOR SQLSTATE '12345';
SIGNAL 'céèçà' SET MYSQL_ERRNO =' at line 3 SIGNAL 'céèçà' S' at line 3
create procedure test_signal() create procedure test_signal()
begin begin
DECLARE `céèçà` CONDITION FOR SQLSTATE '12345'; DECLARE `céèçà` CONDITION FOR SQLSTATE '12345';

View File

@ -47,7 +47,7 @@ create table t1 (s1 binary(2) primary key);
insert into t1 values (0x01); insert into t1 values (0x01);
insert into t1 values (0x0120); insert into t1 values (0x0120);
insert into t1 values (0x0100); insert into t1 values (0x0100);
ERROR 23000: Duplicate entry '' for key 'PRIMARY' ERROR 23000: Duplicate entry '\x01\x00' for key 'PRIMARY'
select hex(s1) from t1 order by s1; select hex(s1) from t1 order by s1;
hex(s1) hex(s1)
0100 0100

View File

@ -71,7 +71,7 @@ hex(a)
1 1
1 1
alter table t1 add unique (a); alter table t1 add unique (a);
ERROR 23000: Duplicate entry '' for key 'a' ERROR 23000: Duplicate entry '\x00' for key 'a'
drop table t1; drop table t1;
create table t1 (a bit(2)); create table t1 (a bit(2));
insert into t1 values (b'00'), (b'01'), (b'10'), (b'100'); insert into t1 values (b'00'), (b'01'), (b'10'), (b'100');

View File

@ -864,7 +864,7 @@ select @@query_prealloc_size = @test;
@@query_prealloc_size = @test @@query_prealloc_size = @test
1 1
set global sql_mode=repeat('a',80); set global sql_mode=repeat('a',80);
ERROR 42000: Variable 'sql_mode' can't be set to the value of 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' ERROR 42000: Variable 'sql_mode' can't be set to the value of 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
End of 4.1 tests End of 4.1 tests
create table t1 (a int); create table t1 (a int);
select a into @x from t1; select a into @x from t1;
@ -1176,18 +1176,18 @@ ERROR HY000: Variable 'init_file' is a read only variable
SET @@global.init_file= 'x'; SET @@global.init_file= 'x';
ERROR HY000: Variable 'init_file' is a read only variable ERROR HY000: Variable 'init_file' is a read only variable
# #
SHOW VARIABLES like 'language'; SHOW VARIABLES like 'lc_messages_dir';
Variable_name Value Variable_name Value
language # lc_messages_dir #
SELECT @@session.language; SELECT @@session.lc_messages_dir;
ERROR HY000: Variable 'language' is a GLOBAL variable ERROR HY000: Variable 'lc_messages_dir' is a GLOBAL variable
SELECT @@global.language; SELECT @@global.lc_messages_dir;
@@global.language @@global.lc_messages_dir
# #
SET @@session.language= 'x'; SET @@session.lc_messages_dir= 'x';
ERROR HY000: Variable 'language' is a read only variable ERROR HY000: Variable 'lc_messages_dir' is a read only variable
SET @@global.language= 'x'; SET @@global.lc_messages_dir= 'x';
ERROR HY000: Variable 'language' is a read only variable ERROR HY000: Variable 'lc_messages_dir' is a read only variable
# #
SHOW VARIABLES like 'large_page_size'; SHOW VARIABLES like 'large_page_size';
Variable_name Value Variable_name Value

View File

@ -35,7 +35,7 @@ Warning 1366 Incorrect integer value: 'hej' for column 'a' at row 1
insert into t1 values ("hej"),("då"); insert into t1 values ("hej"),("då");
Warnings: Warnings:
Warning 1366 Incorrect integer value: 'hej' for column 'a' at row 1 Warning 1366 Incorrect integer value: 'hej' for column 'a' at row 1
Warning 1366 Incorrect integer value: 'd?' for column 'a' at row 2 Warning 1366 Incorrect integer value: 'då' for column 'a' at row 2
set SQL_WARNINGS=1; set SQL_WARNINGS=1;
insert into t1 values ("hej"); insert into t1 values ("hej");
Warnings: Warnings:
@ -43,7 +43,7 @@ Warning 1366 Incorrect integer value: 'hej' for column 'a' at row 1
insert into t1 values ("hej"),("då"); insert into t1 values ("hej"),("då");
Warnings: Warnings:
Warning 1366 Incorrect integer value: 'hej' for column 'a' at row 1 Warning 1366 Incorrect integer value: 'hej' for column 'a' at row 1
Warning 1366 Incorrect integer value: 'd?' for column 'a' at row 2 Warning 1366 Incorrect integer value: 'då' for column 'a' at row 2
drop table t1; drop table t1;
set SQL_WARNINGS=0; set SQL_WARNINGS=0;
drop temporary table if exists not_exists; drop temporary table if exists not_exists;

View File

@ -1,23 +1,29 @@
<charsets> <charsets>
<charset name="utf8"> <charset name="utf8">
<collation name="utf8_test_ci" id="240"> <collation name="utf8_test_ci" id="353">
<rules> <rules>
<reset>a</reset> <reset>a</reset>
<s>b</s> <s>b</s>
</rules> </rules>
</collation> </collation>
<collation name="utf8_maxuserid_ci" id="2047">
<rules>
<reset>a</reset>
<s>b</s>
</rules>
</collation>
</charset> </charset>
<charset name="ucs2"> <charset name="ucs2">
<collation name="ucs2_test_ci" id="241"> <collation name="ucs2_test_ci" id="358">
<rules> <rules>
<reset>a</reset> <reset>a</reset>
<s>b</s> <s>b</s>
</rules> </rules>
</collation> </collation>
<collation name="ucs2_vn_ci" id="242"> <collation name="ucs2_vn_ci" id="359">
<!-- Vietnamese experimental collation --> <!-- Vietnamese experimental collation -->
<rules> <rules>
<reset>A</reset> <reset>A</reset>

View File

@ -0,0 +1,64 @@
<?xml version="1.0"?>
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="test">
<table_structure name="t1">
<field Field="a" Type="int(11)" Null="YES" Key="" Extra="" />
<field Field="b" Type="varchar(128)" Null="YES" Key="" Extra="" />
<options Name="t1" Engine="MyISAM" Version="10" Row_format="Dynamic" Rows="3" Avg_row_length="20" Data_length="60" Max_data_length="281474976710655" Index_length="1024" Data_free="0" Create_time="2007-02-09 09:08:36" Update_time="2007-02-09 09:08:54" Collation="latin1_swedish_ci" Create_options="" Comment="" />
</table_structure>
<table_data name="t1">
<row>
<field name="a">1</field>
<field name="b">b1</field>
</row>
<row>
<field name="a">2</field>
<field name="b">b2</field>
</row>
<row>
<field name="a">3</field>
<field name="b">b3</field>
</row>
<row>
<field name="a">11</field>
<field name="b">b11</field>
</row>
<!-- Check field values as tags -->
<row>
<a>111</a>
<b>b111</b>
</row>
<row>
<a>112</a>
<b>b112 &amp; &lt; &gt; &quot; &apos; &unknown; -- check entities</b>
</row>
<!-- Check field values in attributes -->
<row a=212 b="b212"></row>
<!-- Bug#29752 Linefeeds break LOAD XML INFILE -->
<!-- Check varios combinations of TAB and NL -->
<row
a=213 b="b213">
</row>
<row
a=214
b="b214">
</row>
<row a=215 b="b215"></row>
<row a=216 b="&bb
b;"></row>
<!-- End of bug#29752 -->
</table_data>
</database>
</mysqldump>

View File

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="test_of_xml_import">
<table_structure name="t1">
<field Field="id" Type="int(11)" Null="NO" Key="PRI" Extra="" />
<field Field="text" Type="text" Null="YES" Key="" Extra="" />
<key Table="t1" Non_unique="0" Key_name="PRIMARY" Seq_in_index="1" Column_name="id" Collation="A" Cardinality="1" Null="" Index_type="BTREE" Comment="" Index_Comment="" />
<options Name="t1" Engine="MyISAM" Version="10" Row_format="Dynamic" Rows="1" Avg_row_length="32" Data_length="32" Max_data_length="281474976710655" Index_length="2048" Data_free="0" Create_time="2009-06-18 10:02:37" Update_time="2009-06-18 10:02:43" Collation="latin1_swedish_ci" Create_options="" Comment="" />
</table_structure>
<table_data name="t1">
<row>
<field name="id">1</field>
<field name="text">line1
line2
line3</field>
</row>
</table_data>
</database>
</mysqldump>

View File

@ -2123,10 +2123,10 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '' Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '-1' Warning 1292 Truncated incorrect DOUBLE value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_binary_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_binary_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -2140,10 +2140,10 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '' Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '-1' Warning 1292 Truncated incorrect DOUBLE value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
DROP VIEW v1; DROP VIEW v1;
@ -2186,7 +2186,7 @@ IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_char_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_char_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -2201,7 +2201,7 @@ IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1; DROP VIEW v1;
@ -3409,13 +3409,13 @@ NULL NULL 1
-3333.33 -3333.3333 28 -3333.33 -3333.3333 28
Warnings: Warnings:
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1292 Truncated incorrect DECIMAL value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '-1' Warning 1292 Truncated incorrect DECIMAL value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal(37,2)) AS `CAST(my_binary_30 AS DECIMAL(37,2))`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal(37,2)) AS `CAST(my_binary_30 AS DECIMAL(37,2))`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -3431,13 +3431,13 @@ NULL NULL 1
-3333.33 -3333.3333 28 -3333.33 -3333.3333 28
Warnings: Warnings:
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1292 Truncated incorrect DECIMAL value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '-1' Warning 1292 Truncated incorrect DECIMAL value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
DROP VIEW v1; DROP VIEW v1;
@ -3495,7 +3495,7 @@ Warning 1292 Truncated incorrect DECIMAL value: ' '
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -3515,7 +3515,7 @@ Warning 1292 Truncated incorrect DECIMAL value: ' '
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
DROP VIEW v1; DROP VIEW v1;

View File

@ -2124,10 +2124,10 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '' Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '-1' Warning 1292 Truncated incorrect DOUBLE value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_binary_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_binary_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -2141,10 +2141,10 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '' Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '-1' Warning 1292 Truncated incorrect DOUBLE value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
DROP VIEW v1; DROP VIEW v1;
@ -2187,7 +2187,7 @@ IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_char_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_char_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -2202,7 +2202,7 @@ IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1; DROP VIEW v1;
@ -3410,13 +3410,13 @@ NULL NULL 1
-3333.33 -3333.3333 28 -3333.33 -3333.3333 28
Warnings: Warnings:
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1292 Truncated incorrect DECIMAL value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '-1' Warning 1292 Truncated incorrect DECIMAL value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal(37,2)) AS `CAST(my_binary_30 AS DECIMAL(37,2))`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal(37,2)) AS `CAST(my_binary_30 AS DECIMAL(37,2))`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -3432,13 +3432,13 @@ NULL NULL 1
-3333.33 -3333.3333 28 -3333.33 -3333.3333 28
Warnings: Warnings:
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1292 Truncated incorrect DECIMAL value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '-1' Warning 1292 Truncated incorrect DECIMAL value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
DROP VIEW v1; DROP VIEW v1;
@ -3496,7 +3496,7 @@ Warning 1292 Truncated incorrect DECIMAL value: ' '
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -3516,7 +3516,7 @@ Warning 1292 Truncated incorrect DECIMAL value: ' '
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
DROP VIEW v1; DROP VIEW v1;

View File

@ -2124,10 +2124,10 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '' Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '-1' Warning 1292 Truncated incorrect DOUBLE value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_binary_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_binary_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -2141,10 +2141,10 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '' Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '-1' Warning 1292 Truncated incorrect DOUBLE value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
DROP VIEW v1; DROP VIEW v1;
@ -2187,7 +2187,7 @@ IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_char_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_char_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -2202,7 +2202,7 @@ IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1; DROP VIEW v1;
@ -3410,13 +3410,13 @@ NULL NULL 1
-3333.33 -3333.3333 28 -3333.33 -3333.3333 28
Warnings: Warnings:
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1292 Truncated incorrect DECIMAL value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '-1' Warning 1292 Truncated incorrect DECIMAL value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal(37,2)) AS `CAST(my_binary_30 AS DECIMAL(37,2))`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal(37,2)) AS `CAST(my_binary_30 AS DECIMAL(37,2))`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -3432,13 +3432,13 @@ NULL NULL 1
-3333.33 -3333.3333 28 -3333.33 -3333.3333 28
Warnings: Warnings:
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1292 Truncated incorrect DECIMAL value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '-1' Warning 1292 Truncated incorrect DECIMAL value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
DROP VIEW v1; DROP VIEW v1;
@ -3496,7 +3496,7 @@ Warning 1292 Truncated incorrect DECIMAL value: ' '
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -3516,7 +3516,7 @@ Warning 1292 Truncated incorrect DECIMAL value: ' '
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
DROP VIEW v1; DROP VIEW v1;

View File

@ -2123,10 +2123,10 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '' Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '-1' Warning 1292 Truncated incorrect DOUBLE value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_binary_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_binary_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_binary_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -2140,10 +2140,10 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '' Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: '-1' Warning 1292 Truncated incorrect DOUBLE value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
DROP VIEW v1; DROP VIEW v1;
@ -2186,7 +2186,7 @@ IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_char_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_char_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -2201,7 +2201,7 @@ IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1; DROP VIEW v1;
@ -3409,13 +3409,13 @@ NULL NULL 1
-3333.33 -3333.3333 28 -3333.33 -3333.3333 28
Warnings: Warnings:
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1292 Truncated incorrect DECIMAL value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '-1' Warning 1292 Truncated incorrect DECIMAL value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal(37,2)) AS `CAST(my_binary_30 AS DECIMAL(37,2))`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal(37,2)) AS `CAST(my_binary_30 AS DECIMAL(37,2))`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -3431,13 +3431,13 @@ NULL NULL 1
-3333.33 -3333.3333 28 -3333.33 -3333.3333 28
Warnings: Warnings:
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1292 Truncated incorrect DECIMAL value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '-1' Warning 1292 Truncated incorrect DECIMAL value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
DROP VIEW v1; DROP VIEW v1;
@ -3495,7 +3495,7 @@ Warning 1292 Truncated incorrect DECIMAL value: ' '
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@ -3515,7 +3515,7 @@ Warning 1292 Truncated incorrect DECIMAL value: ' '
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
DROP VIEW v1; DROP VIEW v1;

View File

@ -682,7 +682,7 @@ create table t1 (a int primary key, b varchar(1000) not null, unique key (b))
engine=ndb charset=utf8; engine=ndb charset=utf8;
insert into t1 values (1, repeat(_utf8 0xe288ab6474, 200)); insert into t1 values (1, repeat(_utf8 0xe288ab6474, 200));
insert into t1 values (2, repeat(_utf8 0xe288ab6474, 200)); insert into t1 values (2, repeat(_utf8 0xe288ab6474, 200));
ERROR 23000: Duplicate entry '∫dt∫dt∫dt∫dt∫dt∫dt∫dt∫dt∫dt∫dt∫dt∫dt∫d' for key 'b' ERROR 23000: Duplicate entry '\222Bdt\222Bdt\222Bdt\222Bdt\222Bdt\222Bdt\222Bdt\222Bdt\222Bdt\222Bdt\222Bdt\222Bdt\222Bd' for key 'b'
select a, sha1(b) from t1; select a, sha1(b) from t1;
a sha1(b) a sha1(b)
1 08f5d02c8b8bc244f275bdfc22c42c5cab0d9d7d 1 08f5d02c8b8bc244f275bdfc22c42c5cab0d9d7d

View File

@ -0,0 +1,47 @@
--echo Start of 5.4 tests
#
# ls_messages
#
CREATE TABLE t1(f1 INT);
connect (con1,localhost,root,,test);
connection con1;
SET lc_messages=ru_RU;
SHOW VARIABLES LIKE 'lc_messages';
--error ER_TABLE_EXISTS_ERROR
CREATE TABLE t1(f1 INT);
SET NAMES utf8;
--error ER_TABLE_EXISTS_ERROR
CREATE TABLE t1(f1 INT);
connection default;
SHOW VARIABLES LIKE 'lc_messages';
--error ER_TABLE_EXISTS_ERROR
CREATE TABLE t1(f1 INT);
SHOW GLOBAL VARIABLES LIKE 'lc_messages';
SET GLOBAL lc_messages=ru_RU;
SHOW GLOBAL VARIABLES LIKE 'lc_messages';
SET GLOBAL lc_messages=en_US;
disconnect con1;
DROP TABLE t1;
#
# Bug#1406 Tablename in Errormessage not in default characterset
#
--error ER_BAD_TABLE_ERROR
drop table `ק`;
#
# Bug#14602 Error messages not returned in character_set_results
#
connect (con1,localhost,root,,test);
connection con1;
SET lc_messages=cs_CZ;
SET NAMES UTF8;
--error ER_BAD_DB_ERROR
USE nonexistant;
disconnect con1;
connection default;
--echo End of 5.4 tests

View File

@ -49,6 +49,7 @@ DROP TABLE t1;
# #
# Vietnamese experimental collation # Vietnamese experimental collation
# #
--echo Vietnamese experimental collation
show collation like 'ucs2_vn_ci'; show collation like 'ucs2_vn_ci';
create table t1 (c1 char(1) character set ucs2 collate ucs2_vn_ci); create table t1 (c1 char(1) character set ucs2 collate ucs2_vn_ci);
@ -91,3 +92,28 @@ drop table t1;
set names latin1; set names latin1;
show collation like 'latin1_test'; show collation like 'latin1_test';
select "foo" = "foo " collate latin1_test; select "foo" = "foo " collate latin1_test;
-- echo The following tests check that two-byte collation IDs work
# The file ../std-data/Index.xml has a number of collations with high IDs.
# Test that the "ID" column in I_S and SHOW queries can handle two bytes
select * from information_schema.collations where id>256 order by id;
show collation like '%test%';
# Test that two-byte collation ID is correctly transfered to the client side.
show collation like 'ucs2_vn_ci';
create table t1 (c1 char(1) character set ucs2 collate ucs2_vn_ci);
insert into t1 values (0x0061);
--enable_metadata
set @@character_set_results=NULL;
select * from t1;
--disable_metadata
drop table t1;
#
# Check maximum collation ID (2047 as of MySQL-6.0.9)
#
CREATE TABLE t1 (s1 char(10) character set utf8 collate utf8_maxuserid_ci);
INSERT INTO t1 VALUES ('a'),('b');
SELECT * FROM t1 WHERE s1='a' ORDER BY BINARY s1;
DROP TABLE t1;

View File

@ -67,3 +67,38 @@ SHOW ERRORS;
INSERT INTO t1 SELECT b FROM t1; INSERT INTO t1 SELECT b FROM t1;
DROP TABLE t1; DROP TABLE t1;
# End of 5.0 tests # End of 5.0 tests
#
# testing the value encoding in the error messages of set_var
#
SET NAMES utf8;
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create= _binary x'5452C39C45';
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create= _utf8 x'5452C39C45';
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create=_latin1 x'5452DC45';
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create='TRÜE';
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create=TRÜE;
SET NAMES latin1;
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create= _binary x'5452C39C45';
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create= _utf8 x'5452C39C45';
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create=_latin1 x'5452DC45';
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create='TR.E';
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create=TR.E;
SET NAMES binary;
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create= _binary x'5452C39C45';
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create= _utf8 x'5452C39C45';
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create=_latin1 x'5452DC45';

107
mysql-test/t/loadxml.test Normal file
View File

@ -0,0 +1,107 @@
#
# Tests for "LOAD XML" - a contributed patch from Erik Wetterberg.
#
# Running the $MYSQL_DUMP tool against an embedded server does not work.
--source include/not_embedded.inc
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
create table t1 (a int, b varchar(64));
--echo -- Load a static XML file
load xml infile '../../std_data/loadxml.dat' into table t1
rows identified by '<row>';
select * from t1 order by a;
delete from t1;
--echo -- Load a static XML file with 'IGNORE num ROWS'
load xml infile '../../std_data/loadxml.dat' into table t1
rows identified by '<row>' ignore 4 rows;
select * from t1 order by a;
--echo -- Check 'mysqldump --xml' + 'LOAD XML' round trip
--exec $MYSQL_DUMP --xml test t1 > "$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" 2>&1
delete from t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval load xml infile '$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml' into table t1 rows identified by '<row>';
select * from t1 order by a;
--echo --Check that default row tag is '<row>
delete from t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval load xml infile '$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml' into table t1;
select * from t1 order by a;
--echo -- Check that 'xml' is not a keyword
select 1 as xml;
#
# Bug #42520 killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
#
--disable_query_log
delete from t1;
insert into t1 values (1, '12345678900987654321'), (2, 'asdfghjkl;asdfghjkl;');
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
--exec $MYSQL_DUMP --xml test t1 > "$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" 2>&1
--enable_query_log
connect (addconroot, localhost, root,,);
connection addconroot;
create table t2(fl text);
--let $PSEUDO_THREAD_ID=`select @@pseudo_thread_id `
--send LOAD XML LOCAL INFILE "$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" INTO TABLE t2 ROWS IDENTIFIED BY '<person>';
sleep 3;
connection default;
--replace_column 1 # 3 localhost 6 #
show processlist;
--disable_query_log
--eval kill $PSEUDO_THREAD_ID
--enable_query_log
disconnect addconroot;
#
# Clean up
#
remove_file $MYSQLTEST_VARDIR/tmp/loadxml-dump.xml;
drop table t1;
drop table t2;
#
# Bug #36750 LOAD XML doesn't understand new line (feed) characters in multi line text fields
#
create table t1 (
id int(11) not null,
text text,
primary key (id)
) engine=MyISAM default charset=latin1;
load xml infile '../../std_data/loadxml2.dat' into table t1;
select * from t1;
drop table t1;

View File

@ -382,6 +382,11 @@ remove_file $MYSQLTEST_VARDIR/tmp/bug31060.sql;
drop tables t1, t2; drop tables t1, t2;
#
# mysql client with 'init-command' option
#
--exec $MYSQL --init-command="SET lc_messages=ru_RU" -e "SHOW VARIABLES LIKE 'lc_messages';"
# #
# Bug #27884: mysql --html does not quote HTML special characters in output # Bug #27884: mysql --html does not quote HTML special characters in output
# #

View File

@ -948,15 +948,15 @@ SET @@global.init_file= 'x';
# #
--echo # --echo #
--replace_column 2 # --replace_column 2 #
SHOW VARIABLES like 'language'; SHOW VARIABLES like 'lc_messages_dir';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR --error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.language; SELECT @@session.lc_messages_dir;
--replace_column 1 # --replace_column 1 #
SELECT @@global.language; SELECT @@global.lc_messages_dir;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR --error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@session.language= 'x'; SET @@session.lc_messages_dir= 'x';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR --error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.language= 'x'; SET @@global.lc_messages_dir= 'x';
# #
--echo # --echo #
--replace_column 2 # --replace_column 2 #

View File

@ -42,7 +42,7 @@ get_collation_number_internal(const char *name)
{ {
CHARSET_INFO **cs; CHARSET_INFO **cs;
for (cs= all_charsets; for (cs= all_charsets;
cs < all_charsets+array_elements(all_charsets)-1 ; cs < all_charsets + array_elements(all_charsets);
cs++) cs++)
{ {
if ( cs[0] && cs[0]->name && if ( cs[0] && cs[0]->name &&
@ -387,7 +387,7 @@ char *get_charsets_dir(char *buf)
DBUG_RETURN(res); DBUG_RETURN(res);
} }
CHARSET_INFO *all_charsets[256]={NULL}; CHARSET_INFO *all_charsets[MY_ALL_CHARSETS_SIZE]={NULL};
CHARSET_INFO *default_charset_info = &my_charset_latin1; CHARSET_INFO *default_charset_info = &my_charset_latin1;
void add_compiled_collation(CHARSET_INFO *cs) void add_compiled_collation(CHARSET_INFO *cs)
@ -429,7 +429,7 @@ static my_bool init_available_charsets(myf myflags)
/* Copy compiled charsets */ /* Copy compiled charsets */
for (cs=all_charsets; for (cs=all_charsets;
cs < all_charsets+array_elements(all_charsets)-1 ; cs < all_charsets + array_elements(all_charsets);
cs++) cs++)
{ {
if (*cs) if (*cs)
@ -469,7 +469,7 @@ uint get_charset_number(const char *charset_name, uint cs_flags)
init_available_charsets(MYF(0)); init_available_charsets(MYF(0));
for (cs= all_charsets; for (cs= all_charsets;
cs < all_charsets+array_elements(all_charsets)-1 ; cs < all_charsets + array_elements(all_charsets);
cs++) cs++)
{ {
if ( cs[0] && cs[0]->csname && (cs[0]->state & cs_flags) && if ( cs[0] && cs[0]->csname && (cs[0]->state & cs_flags) &&
@ -543,7 +543,7 @@ CHARSET_INFO *get_charset(uint cs_number, myf flags)
(void) init_available_charsets(MYF(0)); /* If it isn't initialized */ (void) init_available_charsets(MYF(0)); /* If it isn't initialized */
if (!cs_number || cs_number >= array_elements(all_charsets)-1) if (!cs_number || cs_number > array_elements(all_charsets))
return NULL; return NULL;
cs=get_internal_charset(cs_number, flags); cs=get_internal_charset(cs_number, flags);

View File

@ -106,3 +106,8 @@ void wait_for_free_space(const char *filename, int errors)
MY_WAIT_GIVE_USER_A_MESSAGE * MY_WAIT_FOR_USER_TO_FIX_PANIC ); MY_WAIT_GIVE_USER_A_MESSAGE * MY_WAIT_FOR_USER_TO_FIX_PANIC );
VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC)); VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
} }
const char **get_global_errmsgs()
{
return globerrs;
}

View File

@ -48,11 +48,11 @@
*/ */
static struct my_err_head static struct my_err_head
{ {
struct my_err_head *meh_next; /* chain link */ struct my_err_head *meh_next; /* chain link */
const char **meh_errmsgs; /* error messages array */ const char** (*get_errmsgs) (); /* returns error message format */
int meh_first; /* error number matching array slot 0 */ int meh_first; /* error number matching array slot 0 */
int meh_last; /* error number matching last slot */ int meh_last; /* error number matching last slot */
} my_errmsgs_globerrs = {NULL, globerrs, EE_ERROR_FIRST, EE_ERROR_LAST}; } my_errmsgs_globerrs = {NULL, get_global_errmsgs, EE_ERROR_FIRST, EE_ERROR_LAST};
static struct my_err_head *my_errmsgs_list= &my_errmsgs_globerrs; static struct my_err_head *my_errmsgs_list= &my_errmsgs_globerrs;
@ -84,12 +84,13 @@ void my_error(int nr, myf MyFlags, ...)
/* get the error message string. Default, if NULL or empty string (""). */ /* get the error message string. Default, if NULL or empty string (""). */
if (! (format= (meh_p && (nr >= meh_p->meh_first)) ? if (! (format= (meh_p && (nr >= meh_p->meh_first)) ?
meh_p->meh_errmsgs[nr - meh_p->meh_first] : NULL) || ! *format) meh_p->get_errmsgs()[nr - meh_p->meh_first] : NULL) || ! *format)
(void) my_snprintf (ebuff, sizeof(ebuff), "Unknown error %d", nr); (void) my_snprintf (ebuff, sizeof(ebuff), "Unknown error %d", nr);
else else
{ {
va_start(args,MyFlags); va_start(args,MyFlags);
(void) my_vsnprintf (ebuff, sizeof(ebuff), format, args); (void) my_vsnprintf_ex(&my_charset_utf8_general_ci, ebuff,
sizeof(ebuff), format, args);
va_end(args); va_end(args);
} }
(*error_handler_hook)(nr, ebuff, MyFlags); (*error_handler_hook)(nr, ebuff, MyFlags);
@ -117,7 +118,8 @@ void my_printf_error(uint error, const char *format, myf MyFlags, ...)
error, MyFlags, errno, format)); error, MyFlags, errno, format));
va_start(args,MyFlags); va_start(args,MyFlags);
(void) my_vsnprintf (ebuff, sizeof(ebuff), format, args); (void) my_vsnprintf_ex(&my_charset_utf8_general_ci, ebuff,
sizeof(ebuff), format, args);
va_end(args); va_end(args);
(*error_handler_hook)(error, ebuff, MyFlags); (*error_handler_hook)(error, ebuff, MyFlags);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
@ -161,7 +163,7 @@ void my_message(uint error, const char *str, register myf MyFlags)
!= 0 Error != 0 Error
*/ */
int my_error_register(const char **errmsgs, int first, int last) int my_error_register(const char** (*get_errmsgs) (), int first, int last)
{ {
struct my_err_head *meh_p; struct my_err_head *meh_p;
struct my_err_head **search_meh_pp; struct my_err_head **search_meh_pp;
@ -170,7 +172,7 @@ int my_error_register(const char **errmsgs, int first, int last)
if (! (meh_p= (struct my_err_head*) my_malloc(sizeof(struct my_err_head), if (! (meh_p= (struct my_err_head*) my_malloc(sizeof(struct my_err_head),
MYF(MY_WME)))) MYF(MY_WME))))
return 1; return 1;
meh_p->meh_errmsgs= errmsgs; meh_p->get_errmsgs= get_errmsgs;
meh_p->meh_first= first; meh_p->meh_first= first;
meh_p->meh_last= last; meh_p->meh_last= last;
@ -241,7 +243,7 @@ const char **my_error_unregister(int first, int last)
*search_meh_pp= meh_p->meh_next; *search_meh_pp= meh_p->meh_next;
/* Save the return value and free the header. */ /* Save the return value and free the header. */
errmsgs= meh_p->meh_errmsgs; errmsgs= meh_p->get_errmsgs();
my_free((uchar*) meh_p, MYF(0)); my_free((uchar*) meh_p, MYF(0));
return errmsgs; return errmsgs;

View File

@ -313,7 +313,7 @@ then
cannot_find_file "$langdir/errmsg.sys" cannot_find_file "$langdir/errmsg.sys"
exit 1 exit 1
fi fi
mysqld_opt="--language=$langdir" mysqld_opt="--lc-messages-dir=$langdir/.."
fi fi
# Try to determine the hostname # Try to determine the hostname

View File

@ -8,8 +8,8 @@ then
fi fi
FILE=/tmp/add.$$ FILE=/tmp/add.$$
tail -$1 share/english/errmsg.txt > $FILE tail -$1 share/english/errmsg-utf8.txt > $FILE
for i in `ls share/*/errmsg.txt | grep -v english` for i in `ls share/*/errmsg-utf8.txt | grep -v english`
do do
cat $FILE >> $i cat $FILE >> $i
done done

View File

@ -24,10 +24,15 @@
#include "mysql_priv.h" #include "mysql_priv.h"
#include "mysys_err.h" #include "mysys_err.h"
static bool read_texts(const char *file_name,const char ***point,
uint error_messages);
static void init_myfunc_errs(void); static void init_myfunc_errs(void);
const char **get_server_errmsgs()
{
return CURRENT_THD_ERRMSGS;
}
/** /**
Read messages from errorfile. Read messages from errorfile.
@ -54,7 +59,8 @@ bool init_errmessage(void)
errmsgs= my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST); errmsgs= my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST);
/* Read messages from file. */ /* Read messages from file. */
if (read_texts(ERRMSG_FILE, &errmsgs, ER_ERROR_LAST - ER_ERROR_FIRST + 1) && if (read_texts(ERRMSG_FILE, my_default_lc_messages->errmsgs->language,
&errmsgs, ER_ERROR_LAST - ER_ERROR_FIRST + 1) &&
!errmsgs) !errmsgs)
{ {
if (!(errmsgs= (const char**) my_malloc((ER_ERROR_LAST-ER_ERROR_FIRST+1)* if (!(errmsgs= (const char**) my_malloc((ER_ERROR_LAST-ER_ERROR_FIRST+1)*
@ -65,13 +71,13 @@ bool init_errmessage(void)
} }
/* Register messages for use with my_error(). */ /* Register messages for use with my_error(). */
if (my_error_register(errmsgs, ER_ERROR_FIRST, ER_ERROR_LAST)) if (my_error_register(get_server_errmsgs, ER_ERROR_FIRST, ER_ERROR_LAST))
{ {
x_free((uchar*) errmsgs); x_free((uchar*) errmsgs);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
errmesg= errmsgs; /* Init global variabel */ DEFAULT_ERRMSGS= errmsgs; /* Init global variable */
init_myfunc_errs(); /* Init myfunc messages */ init_myfunc_errs(); /* Init myfunc messages */
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
@ -81,19 +87,17 @@ bool init_errmessage(void)
Read text from packed textfile in language-directory. Read text from packed textfile in language-directory.
If we can't read messagefile then it's panic- we can't continue. If we can't read messagefile then it's panic- we can't continue.
@todo
Convert the character set to server system character set
*/ */
static bool read_texts(const char *file_name,const char ***point, bool read_texts(const char *file_name, const char *language,
uint error_messages) const char ***point, uint error_messages)
{ {
register uint i; register uint i;
uint count,funktpos,textcount; uint count,funktpos,textcount;
size_t length; size_t length;
File file; File file;
char name[FN_REFLEN]; char name[FN_REFLEN];
char lang_path[FN_REFLEN];
uchar *buff; uchar *buff;
uchar head[32],*pos; uchar head[32],*pos;
const char *errmsg; const char *errmsg;
@ -101,10 +105,26 @@ static bool read_texts(const char *file_name,const char ***point,
LINT_INIT(buff); LINT_INIT(buff);
funktpos=0; funktpos=0;
if ((file=my_open(fn_format(name,file_name,language,"",4), convert_dirname(lang_path, language, NullS);
(void) my_load_path(lang_path, lang_path, lc_messages_dir);
if ((file=my_open(fn_format(name,file_name,
lang_path, "", 4),
O_RDONLY | O_SHARE | O_BINARY, O_RDONLY | O_SHARE | O_BINARY,
MYF(0))) < 0) MYF(0))) < 0)
goto err; /* purecov: inspected */ {
/*
Trying pre-5.4 sematics of the --language parameter.
It included the language-specific part, e.g.:
--language=/path/to/english/
*/
if ((file= my_open(fn_format(name, file_name, lc_messages_dir, "", 4),
O_RDONLY | O_SHARE | O_BINARY,
MYF(0))) < 0)
goto err;
sql_print_error("An old style --language value with language specific part detected: %s", lc_messages_dir);
sql_print_error("Use --lc-messages-dir without language specific part instead.");
}
funktpos=1; funktpos=1;
if (my_read(file,(uchar*) head,32,MYF(MY_NABP))) goto err; if (my_read(file,(uchar*) head,32,MYF(MY_NABP))) goto err;
@ -113,21 +133,7 @@ static bool read_texts(const char *file_name,const char ***point,
goto err; /* purecov: inspected */ goto err; /* purecov: inspected */
textcount=head[4]; textcount=head[4];
if (!head[30]) error_message_charset_info= system_charset_info;
{
sql_print_error("Character set information not found in '%s'. \
Please install the latest version of this file.",name);
goto err1;
}
/* TODO: Convert the character set to server system character set */
if (!get_charset(head[30],MYF(MY_WME)))
{
sql_print_error("Character set #%d is not supported for messagefile '%s'",
(int)head[30],name);
goto err1;
}
length=uint2korr(head+6); count=uint2korr(head+8); length=uint2korr(head+6); count=uint2korr(head+8);
if (count < error_messages) if (count < error_messages)
@ -180,7 +186,6 @@ err:
break; break;
} }
sql_print_error(errmsg, name); sql_print_error(errmsg, name);
err1:
if (file != FERR) if (file != FERR)
VOID(my_close(file,MYF(MY_WME))); VOID(my_close(file,MYF(MY_WME)));
DBUG_RETURN(1); DBUG_RETURN(1);

View File

@ -1109,13 +1109,11 @@ int Field_num::check_int(CHARSET_INFO *cs, const char *str, int length,
/* Test if we get an empty string or wrong integer */ /* Test if we get an empty string or wrong integer */
if (str == int_end || error == MY_ERRNO_EDOM) if (str == int_end || error == MY_ERRNO_EDOM)
{ {
char buff[128]; ErrConvString err(str, length, cs);
String tmp(buff, (uint32) sizeof(buff), system_charset_info);
tmp.copy(str, length, system_charset_info);
push_warning_printf(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD), ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"integer", tmp.c_ptr(), field_name, "integer", err.ptr(), field_name,
(ulong) table->in_use->warning_info->current_row_for_warning()); (ulong) table->in_use->warning_info->current_row_for_warning());
return 1; return 1;
} }
@ -2674,14 +2672,11 @@ int Field_new_decimal::store(const char *from, uint length,
&decimal_value)) && &decimal_value)) &&
table->in_use->abort_on_warning) table->in_use->abort_on_warning)
{ {
/* Because "from" is not NUL-terminated and we use %s in the ER() */ ErrConvString errmsg(from, length, &my_charset_bin);
String from_as_str;
from_as_str.copy(from, length, &my_charset_bin);
push_warning_printf(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD), ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"decimal", from_as_str.c_ptr(), field_name, "decimal", errmsg.ptr(), field_name,
(ulong) table->in_use->warning_info->current_row_for_warning()); (ulong) table->in_use->warning_info->current_row_for_warning());
DBUG_RETURN(err); DBUG_RETURN(err);
@ -2697,18 +2692,15 @@ int Field_new_decimal::store(const char *from, uint length,
break; break;
case E_DEC_BAD_NUM: case E_DEC_BAD_NUM:
{ {
/* Because "from" is not NUL-terminated and we use %s in the ER() */ ErrConvString errmsg(from, length, &my_charset_bin);
String from_as_str; push_warning_printf(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN,
from_as_str.copy(from, length, &my_charset_bin); ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
push_warning_printf(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN, "decimal", errmsg.ptr(), field_name,
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, (ulong) table->in_use->warning_info->
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD), current_row_for_warning());
"decimal", from_as_str.c_ptr(), field_name, my_decimal_set_zero(&decimal_value);
(ulong) table->in_use->warning_info->current_row_for_warning()); break;
my_decimal_set_zero(&decimal_value);
break;
} }
} }
@ -4569,10 +4561,11 @@ warn:
char buf[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE]; char buf[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
String tmp(buf, sizeof(buf), &my_charset_latin1), *str; String tmp(buf, sizeof(buf), &my_charset_latin1), *str;
str= val_str(&tmp, 0); str= val_str(&tmp, 0);
ErrConvString err(str);
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE, ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE), "INTEGER", ER(ER_TRUNCATED_WRONG_VALUE), "INTEGER",
str->c_ptr()); err.ptr());
} }
return res; return res;
} }
@ -6359,7 +6352,6 @@ check_string_copy_error(Field_str *field,
return FALSE; return FALSE;
convert_to_printable(tmp, sizeof(tmp), pos, (end - pos), cs, 6); convert_to_printable(tmp, sizeof(tmp), pos, (end - pos), cs, 6);
push_warning_printf(thd, push_warning_printf(thd,
MYSQL_ERROR::WARN_LEVEL_WARN, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
@ -6610,13 +6602,11 @@ double Field_string::val_real(void)
!check_if_only_end_space(cs, end, !check_if_only_end_space(cs, end,
(char*) ptr + field_length)))) (char*) ptr + field_length))))
{ {
char buf[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE]; ErrConvString err((char*) ptr, field_length, cs);
String tmp(buf, sizeof(buf), cs);
tmp.copy((char*) ptr, field_length, cs);
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE, ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE), ER(ER_TRUNCATED_WRONG_VALUE), "DOUBLE",
"DOUBLE", tmp.c_ptr()); err.ptr());
} }
return result; return result;
} }
@ -6636,13 +6626,11 @@ longlong Field_string::val_int(void)
!check_if_only_end_space(cs, end, !check_if_only_end_space(cs, end,
(char*) ptr + field_length)))) (char*) ptr + field_length))))
{ {
char buf[LONGLONG_TO_STRING_CONVERSION_BUFFER_SIZE]; ErrConvString err((char*) ptr, field_length, cs);
String tmp(buf, sizeof(buf), cs);
tmp.copy((char*) ptr, field_length, cs);
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE, ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE), ER(ER_TRUNCATED_WRONG_VALUE),
"INTEGER", tmp.c_ptr()); "INTEGER", err.ptr());
} }
return result; return result;
} }
@ -6674,14 +6662,11 @@ my_decimal *Field_string::val_decimal(my_decimal *decimal_value)
charset(), decimal_value); charset(), decimal_value);
if (!table->in_use->no_errors && err) if (!table->in_use->no_errors && err)
{ {
char buf[DECIMAL_TO_STRING_CONVERSION_BUFFER_SIZE]; ErrConvString errmsg((char*) ptr, field_length, charset());
CHARSET_INFO *cs= charset();
String tmp(buf, sizeof(buf), cs);
tmp.copy((char*) ptr, field_length, cs);
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE, ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE), ER(ER_TRUNCATED_WRONG_VALUE),
"DECIMAL", tmp.c_ptr()); "DECIMAL", errmsg.ptr());
} }
return decimal_value; return decimal_value;

View File

@ -283,6 +283,15 @@ handler *get_ha_partition(partition_info *part_info)
#endif #endif
const char **handler_errmsgs;
const char **get_handler_errmsgs()
{
return handler_errmsgs;
}
/** /**
Register handler error messages for use with my_error(). Register handler error messages for use with my_error().
@ -294,61 +303,61 @@ handler *get_ha_partition(partition_info *part_info)
int ha_init_errors(void) int ha_init_errors(void)
{ {
#define SETMSG(nr, msg) errmsgs[(nr) - HA_ERR_FIRST]= (msg) #define SETMSG(nr, msg) handler_errmsgs[(nr) - HA_ERR_FIRST]= (msg)
const char **errmsgs; const char **errmsgs;
/* Allocate a pointer array for the error message strings. */ /* Allocate a pointer array for the error message strings. */
/* Zerofill it to avoid uninitialized gaps. */ /* Zerofill it to avoid uninitialized gaps. */
if (! (errmsgs= (const char**) my_malloc(HA_ERR_ERRORS * sizeof(char*), if (! (handler_errmsgs= (const char**) my_malloc(HA_ERR_ERRORS * sizeof(char*),
MYF(MY_WME | MY_ZEROFILL)))) MYF(MY_WME | MY_ZEROFILL))))
return 1; return 1;
/* Set the dedicated error messages. */ /* Set the dedicated error messages. */
SETMSG(HA_ERR_KEY_NOT_FOUND, ER(ER_KEY_NOT_FOUND)); SETMSG(HA_ERR_KEY_NOT_FOUND, ER_DEFAULT(ER_KEY_NOT_FOUND));
SETMSG(HA_ERR_FOUND_DUPP_KEY, ER(ER_DUP_KEY)); SETMSG(HA_ERR_FOUND_DUPP_KEY, ER_DEFAULT(ER_DUP_KEY));
SETMSG(HA_ERR_RECORD_CHANGED, "Update wich is recoverable"); SETMSG(HA_ERR_RECORD_CHANGED, "Update wich is recoverable");
SETMSG(HA_ERR_WRONG_INDEX, "Wrong index given to function"); SETMSG(HA_ERR_WRONG_INDEX, "Wrong index given to function");
SETMSG(HA_ERR_CRASHED, ER(ER_NOT_KEYFILE)); SETMSG(HA_ERR_CRASHED, ER_DEFAULT(ER_NOT_KEYFILE));
SETMSG(HA_ERR_WRONG_IN_RECORD, ER(ER_CRASHED_ON_USAGE)); SETMSG(HA_ERR_WRONG_IN_RECORD, ER_DEFAULT(ER_CRASHED_ON_USAGE));
SETMSG(HA_ERR_OUT_OF_MEM, "Table handler out of memory"); SETMSG(HA_ERR_OUT_OF_MEM, "Table handler out of memory");
SETMSG(HA_ERR_NOT_A_TABLE, "Incorrect file format '%.64s'"); SETMSG(HA_ERR_NOT_A_TABLE, "Incorrect file format '%.64s'");
SETMSG(HA_ERR_WRONG_COMMAND, "Command not supported"); SETMSG(HA_ERR_WRONG_COMMAND, "Command not supported");
SETMSG(HA_ERR_OLD_FILE, ER(ER_OLD_KEYFILE)); SETMSG(HA_ERR_OLD_FILE, ER_DEFAULT(ER_OLD_KEYFILE));
SETMSG(HA_ERR_NO_ACTIVE_RECORD, "No record read in update"); SETMSG(HA_ERR_NO_ACTIVE_RECORD, "No record read in update");
SETMSG(HA_ERR_RECORD_DELETED, "Intern record deleted"); SETMSG(HA_ERR_RECORD_DELETED, "Intern record deleted");
SETMSG(HA_ERR_RECORD_FILE_FULL, ER(ER_RECORD_FILE_FULL)); SETMSG(HA_ERR_RECORD_FILE_FULL, ER_DEFAULT(ER_RECORD_FILE_FULL));
SETMSG(HA_ERR_INDEX_FILE_FULL, "No more room in index file '%.64s'"); SETMSG(HA_ERR_INDEX_FILE_FULL, "No more room in index file '%.64s'");
SETMSG(HA_ERR_END_OF_FILE, "End in next/prev/first/last"); SETMSG(HA_ERR_END_OF_FILE, "End in next/prev/first/last");
SETMSG(HA_ERR_UNSUPPORTED, ER(ER_ILLEGAL_HA)); SETMSG(HA_ERR_UNSUPPORTED, ER_DEFAULT(ER_ILLEGAL_HA));
SETMSG(HA_ERR_TO_BIG_ROW, "Too big row"); SETMSG(HA_ERR_TO_BIG_ROW, "Too big row");
SETMSG(HA_WRONG_CREATE_OPTION, "Wrong create option"); SETMSG(HA_WRONG_CREATE_OPTION, "Wrong create option");
SETMSG(HA_ERR_FOUND_DUPP_UNIQUE, ER(ER_DUP_UNIQUE)); SETMSG(HA_ERR_FOUND_DUPP_UNIQUE, ER_DEFAULT(ER_DUP_UNIQUE));
SETMSG(HA_ERR_UNKNOWN_CHARSET, "Can't open charset"); SETMSG(HA_ERR_UNKNOWN_CHARSET, "Can't open charset");
SETMSG(HA_ERR_WRONG_MRG_TABLE_DEF, ER(ER_WRONG_MRG_TABLE)); SETMSG(HA_ERR_WRONG_MRG_TABLE_DEF, ER_DEFAULT(ER_WRONG_MRG_TABLE));
SETMSG(HA_ERR_CRASHED_ON_REPAIR, ER(ER_CRASHED_ON_REPAIR)); SETMSG(HA_ERR_CRASHED_ON_REPAIR, ER_DEFAULT(ER_CRASHED_ON_REPAIR));
SETMSG(HA_ERR_CRASHED_ON_USAGE, ER(ER_CRASHED_ON_USAGE)); SETMSG(HA_ERR_CRASHED_ON_USAGE, ER_DEFAULT(ER_CRASHED_ON_USAGE));
SETMSG(HA_ERR_LOCK_WAIT_TIMEOUT, ER(ER_LOCK_WAIT_TIMEOUT)); SETMSG(HA_ERR_LOCK_WAIT_TIMEOUT, ER_DEFAULT(ER_LOCK_WAIT_TIMEOUT));
SETMSG(HA_ERR_LOCK_TABLE_FULL, ER(ER_LOCK_TABLE_FULL)); SETMSG(HA_ERR_LOCK_TABLE_FULL, ER_DEFAULT(ER_LOCK_TABLE_FULL));
SETMSG(HA_ERR_READ_ONLY_TRANSACTION, ER(ER_READ_ONLY_TRANSACTION)); SETMSG(HA_ERR_READ_ONLY_TRANSACTION, ER_DEFAULT(ER_READ_ONLY_TRANSACTION));
SETMSG(HA_ERR_LOCK_DEADLOCK, ER(ER_LOCK_DEADLOCK)); SETMSG(HA_ERR_LOCK_DEADLOCK, ER_DEFAULT(ER_LOCK_DEADLOCK));
SETMSG(HA_ERR_CANNOT_ADD_FOREIGN, ER(ER_CANNOT_ADD_FOREIGN)); SETMSG(HA_ERR_CANNOT_ADD_FOREIGN, ER_DEFAULT(ER_CANNOT_ADD_FOREIGN));
SETMSG(HA_ERR_NO_REFERENCED_ROW, ER(ER_NO_REFERENCED_ROW_2)); SETMSG(HA_ERR_NO_REFERENCED_ROW, ER_DEFAULT(ER_NO_REFERENCED_ROW_2));
SETMSG(HA_ERR_ROW_IS_REFERENCED, ER(ER_ROW_IS_REFERENCED_2)); SETMSG(HA_ERR_ROW_IS_REFERENCED, ER_DEFAULT(ER_ROW_IS_REFERENCED_2));
SETMSG(HA_ERR_NO_SAVEPOINT, "No savepoint with that name"); SETMSG(HA_ERR_NO_SAVEPOINT, "No savepoint with that name");
SETMSG(HA_ERR_NON_UNIQUE_BLOCK_SIZE, "Non unique key block size"); SETMSG(HA_ERR_NON_UNIQUE_BLOCK_SIZE, "Non unique key block size");
SETMSG(HA_ERR_NO_SUCH_TABLE, "No such table: '%.64s'"); SETMSG(HA_ERR_NO_SUCH_TABLE, "No such table: '%.64s'");
SETMSG(HA_ERR_TABLE_EXIST, ER(ER_TABLE_EXISTS_ERROR)); SETMSG(HA_ERR_TABLE_EXIST, ER_DEFAULT(ER_TABLE_EXISTS_ERROR));
SETMSG(HA_ERR_NO_CONNECTION, "Could not connect to storage engine"); SETMSG(HA_ERR_NO_CONNECTION, "Could not connect to storage engine");
SETMSG(HA_ERR_TABLE_DEF_CHANGED, ER(ER_TABLE_DEF_CHANGED)); SETMSG(HA_ERR_TABLE_DEF_CHANGED, ER_DEFAULT(ER_TABLE_DEF_CHANGED));
SETMSG(HA_ERR_FOREIGN_DUPLICATE_KEY, "FK constraint would lead to duplicate key"); SETMSG(HA_ERR_FOREIGN_DUPLICATE_KEY, "FK constraint would lead to duplicate key");
SETMSG(HA_ERR_TABLE_NEEDS_UPGRADE, ER(ER_TABLE_NEEDS_UPGRADE)); SETMSG(HA_ERR_TABLE_NEEDS_UPGRADE, ER_DEFAULT(ER_TABLE_NEEDS_UPGRADE));
SETMSG(HA_ERR_TABLE_READONLY, ER(ER_OPEN_AS_READONLY)); SETMSG(HA_ERR_TABLE_READONLY, ER_DEFAULT(ER_OPEN_AS_READONLY));
SETMSG(HA_ERR_AUTOINC_READ_FAILED, ER(ER_AUTOINC_READ_FAILED)); SETMSG(HA_ERR_AUTOINC_READ_FAILED, ER_DEFAULT(ER_AUTOINC_READ_FAILED));
SETMSG(HA_ERR_AUTOINC_ERANGE, ER(ER_WARN_DATA_OUT_OF_RANGE)); SETMSG(HA_ERR_AUTOINC_ERANGE, ER_DEFAULT(ER_WARN_DATA_OUT_OF_RANGE));
SETMSG(HA_ERR_TOO_MANY_CONCURRENT_TRXS, ER(ER_TOO_MANY_CONCURRENT_TRXS)); SETMSG(HA_ERR_TOO_MANY_CONCURRENT_TRXS, ER_DEFAULT(ER_TOO_MANY_CONCURRENT_TRXS));
/* Register the error messages for use with my_error(). */ /* Register the error messages for use with my_error(). */
return my_error_register(errmsgs, HA_ERR_FIRST, HA_ERR_LAST); return my_error_register(get_handler_errmsgs, HA_ERR_FIRST, HA_ERR_LAST);
} }

View File

@ -264,10 +264,11 @@ my_decimal *Item::val_decimal_from_string(my_decimal *decimal_value)
res->ptr(), res->length(), res->charset(), res->ptr(), res->length(), res->charset(),
decimal_value) & E_DEC_BAD_NUM) decimal_value) & E_DEC_BAD_NUM)
{ {
ErrConvString err(res);
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE, ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE), "DECIMAL", ER(ER_TRUNCATED_WRONG_VALUE), "DECIMAL",
str_value.c_ptr()); err.ptr());
} }
return decimal_value; return decimal_value;
} }
@ -2456,6 +2457,7 @@ double_from_string_with_check (CHARSET_INFO *cs, const char *cptr, char *end)
tmp= my_strntod(cs, (char*) cptr, end - cptr, &end, &error); tmp= my_strntod(cs, (char*) cptr, end - cptr, &end, &error);
if (error || (end != org_end && !check_if_only_end_space(cs, end, org_end))) if (error || (end != org_end && !check_if_only_end_space(cs, end, org_end)))
{ {
ErrConvString err(cptr, cs);
/* /*
We can use str_value.ptr() here as Item_string is gurantee to put an We can use str_value.ptr() here as Item_string is gurantee to put an
end \0 here. end \0 here.
@ -2463,7 +2465,7 @@ double_from_string_with_check (CHARSET_INFO *cs, const char *cptr, char *end)
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE, ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE), "DOUBLE", ER(ER_TRUNCATED_WRONG_VALUE), "DOUBLE",
cptr); err.ptr());
} }
return tmp; return tmp;
} }
@ -2493,10 +2495,11 @@ longlong_from_string_with_check (CHARSET_INFO *cs, const char *cptr, char *end)
(err > 0 || (err > 0 ||
(end != org_end && !check_if_only_end_space(cs, end, org_end)))) (end != org_end && !check_if_only_end_space(cs, end, org_end))))
{ {
ErrConvString err(cptr, cs);
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE, ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE), "INTEGER", ER(ER_TRUNCATED_WRONG_VALUE), "INTEGER",
cptr); err.ptr());
} }
return tmp; return tmp;
} }

View File

@ -2493,10 +2493,11 @@ String *Item_char_typecast::val_str(String *str)
str_value= *res; // Not malloced string str_value= *res; // Not malloced string
res= &str_value; res= &str_value;
} }
ErrConvString err(res);
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE, ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE), char_type, ER(ER_TRUNCATED_WRONG_VALUE), char_type,
res->c_ptr_safe()); err.ptr());
res->length((uint) length); res->length((uint) length);
} }
else if (cast_cs == &my_charset_bin && res->length() < (uint) cast_length) else if (cast_cs == &my_charset_bin && res->length() < (uint) cast_length)

View File

@ -349,10 +349,29 @@ void key_unpack(String *to,TABLE *table,uint idx)
} }
if ((field=key_part->field)) if ((field=key_part->field))
{ {
CHARSET_INFO *cs= field->charset();
field->val_str(&tmp); field->val_str(&tmp);
if (cs->mbmaxlen > 1 &&
table->field[key_part->fieldnr - 1]->field_length !=
key_part->length)
{
/*
Prefix key, multi-byte charset.
For the columns of type CHAR(N), the above val_str()
call will return exactly "key_part->length" bytes,
which can break a multi-byte characters in the middle.
Align, returning not more than "char_length" characters.
*/
uint charpos, char_length= key_part->length / cs->mbmaxlen;
if ((charpos= my_charpos(cs, tmp.ptr(),
tmp.ptr() + tmp.length(),
char_length)) < tmp.length())
tmp.length(charpos);
}
if (key_part->length < field->pack_length()) if (key_part->length < field->pack_length())
tmp.length(min(tmp.length(),key_part->length)); tmp.length(min(tmp.length(),key_part->length));
to->append(tmp); ErrConvString err(&tmp);
to->append(err.ptr());
} }
else else
to->append(STRING_WITH_LEN("???")); to->append(STRING_WITH_LEN("???"));

View File

@ -607,6 +607,7 @@ static SYMBOL symbols[] = {
{ "X509", SYM(X509_SYM)}, { "X509", SYM(X509_SYM)},
{ "XOR", SYM(XOR)}, { "XOR", SYM(XOR)},
{ "XA", SYM(XA_SYM)}, { "XA", SYM(XA_SYM)},
{ "XML", SYM(XML_SYM)}, /* LOAD XML Arnold/Erik */
{ "YEAR", SYM(YEAR_SYM)}, { "YEAR", SYM(YEAR_SYM)},
{ "YEAR_MONTH", SYM(YEAR_MONTH_SYM)}, { "YEAR_MONTH", SYM(YEAR_MONTH_SYM)},
{ "ZEROFILL", SYM(ZEROFILL)}, { "ZEROFILL", SYM(ZEROFILL)},

View File

@ -144,6 +144,14 @@ enum Derivation
}; };
typedef struct my_locale_errmsgs
{
const char *language;
const char **errmsgs;
} MY_LOCALE_ERRMSGS;
extern char err_shared_dir[];
typedef struct my_locale_st typedef struct my_locale_st
{ {
uint number; uint number;
@ -159,6 +167,7 @@ typedef struct my_locale_st
uint decimal_point; uint decimal_point;
uint thousand_sep; uint thousand_sep;
const char *grouping; const char *grouping;
MY_LOCALE_ERRMSGS *errmsgs;
#ifdef __cplusplus #ifdef __cplusplus
my_locale_st(uint number_par, my_locale_st(uint number_par,
const char *name_par, const char *descr_par, bool is_ascii_par, const char *name_par, const char *descr_par, bool is_ascii_par,
@ -166,7 +175,7 @@ typedef struct my_locale_st
TYPELIB *day_names_par, TYPELIB *ab_day_names_par, TYPELIB *day_names_par, TYPELIB *ab_day_names_par,
uint max_month_name_length_par, uint max_day_name_length_par, uint max_month_name_length_par, uint max_day_name_length_par,
uint decimal_point_par, uint thousand_sep_par, uint decimal_point_par, uint thousand_sep_par,
const char *grouping_par) : const char *grouping_par, MY_LOCALE_ERRMSGS *errmsgs_par) :
number(number_par), number(number_par),
name(name_par), description(descr_par), is_ascii(is_ascii_par), name(name_par), description(descr_par), is_ascii(is_ascii_par),
month_names(month_names_par), ab_month_names(ab_month_names_par), month_names(month_names_par), ab_month_names(ab_month_names_par),
@ -175,18 +184,22 @@ typedef struct my_locale_st
max_day_name_length(max_day_name_length_par), max_day_name_length(max_day_name_length_par),
decimal_point(decimal_point_par), decimal_point(decimal_point_par),
thousand_sep(thousand_sep_par), thousand_sep(thousand_sep_par),
grouping(grouping_par) grouping(grouping_par),
errmsgs(errmsgs_par)
{} {}
#endif #endif
} MY_LOCALE; } MY_LOCALE;
extern MY_LOCALE my_locale_en_US; extern MY_LOCALE my_locale_en_US;
extern MY_LOCALE *my_locales[]; extern MY_LOCALE *my_locales[];
extern MY_LOCALE *my_default_lc_messages;
extern MY_LOCALE *my_default_lc_time_names; extern MY_LOCALE *my_default_lc_time_names;
MY_LOCALE *my_locale_by_name(const char *name); MY_LOCALE *my_locale_by_name(const char *name);
MY_LOCALE *my_locale_by_number(uint number); MY_LOCALE *my_locale_by_number(uint number);
void cleanup_errmsgs(void);
/*************************************************************************/ /*************************************************************************/
/** /**
@ -1841,6 +1854,8 @@ extern "C" int key_rec_cmp(void *key_info, uchar *a, uchar *b);
bool init_errmessage(void); bool init_errmessage(void);
#endif /* MYSQL_SERVER */ #endif /* MYSQL_SERVER */
void sql_perror(const char *message); void sql_perror(const char *message);
bool read_texts(const char *file_name, const char *language,
const char ***point, uint error_messages);
bool fn_format_relative_to_data_home(char * to, const char *name, bool fn_format_relative_to_data_home(char * to, const char *name,
const char *dir, const char *extension); const char *dir, const char *extension);
@ -1933,7 +1948,7 @@ extern Gt_creator gt_creator;
extern Lt_creator lt_creator; extern Lt_creator lt_creator;
extern Ge_creator ge_creator; extern Ge_creator ge_creator;
extern Le_creator le_creator; extern Le_creator le_creator;
extern char language[FN_REFLEN]; extern char lc_messages_dir[FN_REFLEN];
#endif /* MYSQL_SERVER */ #endif /* MYSQL_SERVER */
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS #if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
extern MYSQL_PLUGIN_IMPORT char reg_ext[FN_EXTLEN]; extern MYSQL_PLUGIN_IMPORT char reg_ext[FN_EXTLEN];
@ -2045,7 +2060,7 @@ extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open, LOCK_lock_db,
LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone, LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
LOCK_slave_list, LOCK_active_mi, LOCK_manager, LOCK_global_read_lock, LOCK_slave_list, LOCK_active_mi, LOCK_manager, LOCK_global_read_lock,
LOCK_global_system_variables, LOCK_user_conn, LOCK_global_system_variables, LOCK_user_conn,
LOCK_prepared_stmt_count, LOCK_prepared_stmt_count, LOCK_error_messages,
LOCK_bytes_sent, LOCK_bytes_received, LOCK_connection_count; LOCK_bytes_sent, LOCK_bytes_received, LOCK_connection_count;
extern MYSQL_PLUGIN_IMPORT pthread_mutex_t LOCK_thread_count; extern MYSQL_PLUGIN_IMPORT pthread_mutex_t LOCK_thread_count;
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL

View File

@ -400,9 +400,10 @@ static const char *optimizer_switch_str="index_merge=on,index_merge_union=on,"
"index_merge_sort_union=on," "index_merge_sort_union=on,"
"index_merge_intersection=on"; "index_merge_intersection=on";
static char *mysqld_user, *mysqld_chroot, *log_error_file_ptr; static char *mysqld_user, *mysqld_chroot, *log_error_file_ptr;
static char *opt_init_slave, *language_ptr, *opt_init_connect; static char *opt_init_slave, *lc_messages_dir_ptr, *opt_init_connect;
static char *default_character_set_name; static char *default_character_set_name;
static char *character_set_filesystem_name; static char *character_set_filesystem_name;
static char *lc_messages;
static char *lc_time_names_name; static char *lc_time_names_name;
static char *my_bind_addr_str; static char *my_bind_addr_str;
static char *default_collation_name; static char *default_collation_name;
@ -579,9 +580,11 @@ char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], system_time_zone[30];
char *default_tz_name; char *default_tz_name;
char log_error_file[FN_REFLEN], glob_hostname[FN_REFLEN]; char log_error_file[FN_REFLEN], glob_hostname[FN_REFLEN];
char mysql_real_data_home[FN_REFLEN], char mysql_real_data_home[FN_REFLEN],
language[FN_REFLEN], reg_ext[FN_EXTLEN], mysql_charsets_dir[FN_REFLEN], lc_messages_dir[FN_REFLEN], reg_ext[FN_EXTLEN],
mysql_charsets_dir[FN_REFLEN],
*opt_init_file, *opt_tc_log_file, *opt_init_file, *opt_tc_log_file,
def_ft_boolean_syntax[sizeof(ft_boolean_syntax)]; def_ft_boolean_syntax[sizeof(ft_boolean_syntax)];
char err_shared_dir[FN_REFLEN];
char mysql_unpacked_real_data_home[FN_REFLEN]; char mysql_unpacked_real_data_home[FN_REFLEN];
int mysql_unpacked_real_data_home_len; int mysql_unpacked_real_data_home_len;
uint reg_ext_length; uint reg_ext_length;
@ -594,7 +597,6 @@ uint mysql_data_home_len;
char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home; char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home;
char server_version[SERVER_VERSION_LENGTH]; char server_version[SERVER_VERSION_LENGTH];
char *mysqld_unix_port, *opt_mysql_tmpdir; char *mysqld_unix_port, *opt_mysql_tmpdir;
const char **errmesg; /**< Error messages */
const char *myisam_recover_options_str="OFF"; const char *myisam_recover_options_str="OFF";
const char *myisam_stats_method_str="nulls_unequal"; const char *myisam_stats_method_str="nulls_unequal";
@ -634,6 +636,7 @@ CHARSET_INFO *national_charset_info, *table_alias_charset;
CHARSET_INFO *character_set_filesystem; CHARSET_INFO *character_set_filesystem;
CHARSET_INFO *error_message_charset_info; CHARSET_INFO *error_message_charset_info;
MY_LOCALE *my_default_lc_messages;
MY_LOCALE *my_default_lc_time_names; MY_LOCALE *my_default_lc_time_names;
SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen, have_query_cache; SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen, have_query_cache;
@ -652,7 +655,7 @@ pthread_mutex_t LOCK_mysql_create_db, LOCK_Acl, LOCK_open, LOCK_thread_count,
LOCK_crypt, LOCK_bytes_sent, LOCK_bytes_received, LOCK_crypt, LOCK_bytes_sent, LOCK_bytes_received,
LOCK_global_system_variables, LOCK_global_system_variables,
LOCK_user_conn, LOCK_slave_list, LOCK_active_mi, LOCK_user_conn, LOCK_slave_list, LOCK_active_mi,
LOCK_connection_count; LOCK_connection_count, LOCK_error_messages;
/** /**
The below lock protects access to two global server variables: The below lock protects access to two global server variables:
max_prepared_stmt_count and prepared_stmt_count. These variables max_prepared_stmt_count and prepared_stmt_count. These variables
@ -1150,9 +1153,9 @@ static void __cdecl kill_server(int sig_ptr)
if (sig != 0) // 0 is not a valid signal number if (sig != 0) // 0 is not a valid signal number
my_sigset(sig, SIG_IGN); /* purify inspected */ my_sigset(sig, SIG_IGN); /* purify inspected */
if (sig == MYSQL_KILL_SIGNAL || sig == 0) if (sig == MYSQL_KILL_SIGNAL || sig == 0)
sql_print_information(ER(ER_NORMAL_SHUTDOWN),my_progname); sql_print_information(ER_DEFAULT(ER_NORMAL_SHUTDOWN),my_progname);
else else
sql_print_error(ER(ER_GOT_SIGNAL),my_progname,sig); /* purecov: inspected */ sql_print_error(ER_DEFAULT(ER_GOT_SIGNAL),my_progname,sig); /* purecov: inspected */
#if defined(HAVE_SMEM) && defined(__WIN__) #if defined(HAVE_SMEM) && defined(__WIN__)
/* /*
@ -1362,12 +1365,11 @@ void clean_up(bool print_message)
if (!opt_bootstrap) if (!opt_bootstrap)
(void) my_delete(pidfile_name,MYF(0)); // This may not always exist (void) my_delete(pidfile_name,MYF(0)); // This may not always exist
#endif #endif
if (print_message && errmesg && server_start_time) if (print_message && /*errmesg &&*/ server_start_time)
sql_print_information(ER(ER_SHUTDOWN_COMPLETE),my_progname); sql_print_information(ER_DEFAULT(ER_SHUTDOWN_COMPLETE),my_progname);
cleanup_errmsgs();
thread_scheduler.end(); thread_scheduler.end();
finish_client_errs(); finish_client_errs();
my_free((uchar*) my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST),
MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
DBUG_PRINT("quit", ("Error messages freed")); DBUG_PRINT("quit", ("Error messages freed"));
/* Tell main we are ready */ /* Tell main we are ready */
logger.cleanup_end(); logger.cleanup_end();
@ -1451,6 +1453,7 @@ static void clean_up_mutexes()
(void) pthread_mutex_destroy(&LOCK_global_read_lock); (void) pthread_mutex_destroy(&LOCK_global_read_lock);
(void) pthread_mutex_destroy(&LOCK_uuid_generator); (void) pthread_mutex_destroy(&LOCK_uuid_generator);
(void) pthread_mutex_destroy(&LOCK_prepared_stmt_count); (void) pthread_mutex_destroy(&LOCK_prepared_stmt_count);
(void) pthread_mutex_destroy(&LOCK_error_messages);
(void) pthread_cond_destroy(&COND_thread_count); (void) pthread_cond_destroy(&COND_thread_count);
(void) pthread_cond_destroy(&COND_refresh); (void) pthread_cond_destroy(&COND_refresh);
(void) pthread_cond_destroy(&COND_global_read_lock); (void) pthread_cond_destroy(&COND_global_read_lock);
@ -1823,7 +1826,7 @@ void close_connection(THD *thd, uint errcode, bool lock)
DBUG_PRINT("enter",("fd: %s error: '%s'", DBUG_PRINT("enter",("fd: %s error: '%s'",
thd->net.vio ? vio_description(thd->net.vio) : thd->net.vio ? vio_description(thd->net.vio) :
"(not connected)", "(not connected)",
errcode ? ER(errcode) : "")); errcode ? ER_DEFAULT(errcode) : ""));
if (lock) if (lock)
(void) pthread_mutex_lock(&LOCK_thread_count); (void) pthread_mutex_lock(&LOCK_thread_count);
thd->killed= THD::KILL_CONNECTION; thd->killed= THD::KILL_CONNECTION;
@ -1831,7 +1834,7 @@ void close_connection(THD *thd, uint errcode, bool lock)
{ {
if (errcode) if (errcode)
net_send_error(thd, errcode, net_send_error(thd, errcode,
ER(errcode), NULL); /* purecov: inspected */ ER_DEFAULT(errcode), NULL); /* purecov: inspected */
vio_close(vio); /* vio is freed in delete thd */ vio_close(vio); /* vio is freed in delete thd */
} }
if (lock) if (lock)
@ -3364,6 +3367,13 @@ static int init_common_variables(const char *conf_file_name, int argc,
open_files_limit= files; open_files_limit= files;
} }
unireg_init(opt_specialflag); /* Set up extern variabels */ unireg_init(opt_specialflag); /* Set up extern variabels */
if (!(my_default_lc_messages=
my_locale_by_name(lc_messages)))
{
sql_print_error("Unknown locale: '%s'", lc_messages);
return 1;
}
global_system_variables.lc_messages= my_default_lc_messages;
if (init_errmessage()) /* Read error messages from file */ if (init_errmessage()) /* Read error messages from file */
return 1; return 1;
init_client_errs(); init_client_errs();
@ -3414,12 +3424,12 @@ static int init_common_variables(const char *conf_file_name, int argc,
default_collation= get_charset_by_name(default_collation_name, MYF(0)); default_collation= get_charset_by_name(default_collation_name, MYF(0));
if (!default_collation) if (!default_collation)
{ {
sql_print_error(ER(ER_UNKNOWN_COLLATION), default_collation_name); sql_print_error(ER_DEFAULT(ER_UNKNOWN_COLLATION), default_collation_name);
return 1; return 1;
} }
if (!my_charset_same(default_charset_info, default_collation)) if (!my_charset_same(default_charset_info, default_collation))
{ {
sql_print_error(ER(ER_COLLATION_CHARSET_MISMATCH), sql_print_error(ER_DEFAULT(ER_COLLATION_CHARSET_MISMATCH),
default_collation_name, default_collation_name,
default_charset_info->csname); default_charset_info->csname);
return 1; return 1;
@ -3573,6 +3583,7 @@ static int init_thread_environment()
(void) my_rwlock_init(&LOCK_system_variables_hash, NULL); (void) my_rwlock_init(&LOCK_system_variables_hash, NULL);
(void) pthread_mutex_init(&LOCK_global_read_lock, MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_global_read_lock, MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_prepared_stmt_count, MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_prepared_stmt_count, MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_error_messages, MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_uuid_generator, MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_uuid_generator, MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_connection_count, MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_connection_count, MY_MUTEX_INIT_FAST);
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
@ -3980,8 +3991,8 @@ server.");
} }
/* if the errmsg.sys is not loaded, terminate to maintain behaviour */ /* if the errmsg.sys is not loaded, terminate to maintain behaviour */
if (!errmesg[0][0]) if (!DEFAULT_ERRMSGS[0][0])
unireg_abort(1); unireg_abort(1);
/* We have to initialize the storage engines before CSV logging */ /* We have to initialize the storage engines before CSV logging */
if (ha_init()) if (ha_init())
@ -4495,7 +4506,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
create_shutdown_thread(); create_shutdown_thread();
start_handle_manager(); start_handle_manager();
sql_print_information(ER(ER_STARTUP),my_progname,server_version, sql_print_information(ER_DEFAULT(ER_STARTUP),my_progname,server_version,
((unix_sock == INVALID_SOCKET) ? (char*) "" ((unix_sock == INVALID_SOCKET) ? (char*) ""
: mysqld_unix_port), : mysqld_unix_port),
mysqld_port, mysqld_port,
@ -5656,6 +5667,7 @@ enum options_mysqld
OPT_DEFAULT_COLLATION, OPT_DEFAULT_COLLATION,
OPT_CHARACTER_SET_CLIENT_HANDSHAKE, OPT_CHARACTER_SET_CLIENT_HANDSHAKE,
OPT_CHARACTER_SET_FILESYSTEM, OPT_CHARACTER_SET_FILESYSTEM,
OPT_LC_ERROR_MESSAGES,
OPT_LC_TIME_NAMES, OPT_LC_TIME_NAMES,
OPT_INIT_CONNECT, OPT_INIT_CONNECT,
OPT_INIT_SLAVE, OPT_INIT_SLAVE,
@ -5927,9 +5939,17 @@ Disable with --skip-super-large-pages.",
(uchar**) &opt_init_slave, (uchar**) &opt_init_slave, 0, GET_STR_ALLOC, (uchar**) &opt_init_slave, (uchar**) &opt_init_slave, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"language", 'L', {"language", 'L',
"Client error messages in given language. May be given as a full path.", "Client error messages in given language. May be given as a full path. "
(uchar**) &language_ptr, (uchar**) &language_ptr, 0, GET_STR, REQUIRED_ARG, "Deprecated. Use --lc-messages-dir instead.",
0, 0, 0, 0, 0, 0}, (uchar**) &lc_messages_dir_ptr, (uchar**) &lc_messages_dir_ptr, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"lc-messages-dir", 'L',
"Directory where error messages are.", (uchar**) &lc_messages_dir_ptr,
(uchar**) &lc_messages_dir_ptr, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"lc-messages", OPT_LC_ERROR_MESSAGES,
"Set the language used for the error messages.",
(uchar**) &lc_messages, (uchar**) &lc_messages, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0 },
{"lc-time-names", OPT_LC_TIME_NAMES, {"lc-time-names", OPT_LC_TIME_NAMES,
"Set the language used for the month names and the days of the week.", "Set the language used for the month names and the days of the week.",
(uchar**) &lc_time_names_name, (uchar**) &lc_time_names_name,
@ -7655,7 +7675,6 @@ static int mysql_init_variables(void)
max_used_connections= slow_launch_threads = 0; max_used_connections= slow_launch_threads = 0;
mysqld_user= mysqld_chroot= opt_init_file= opt_bin_logname = 0; mysqld_user= mysqld_chroot= opt_init_file= opt_bin_logname = 0;
prepared_stmt_count= 0; prepared_stmt_count= 0;
errmesg= 0;
mysqld_unix_port= opt_mysql_tmpdir= my_bind_addr_str= NullS; mysqld_unix_port= opt_mysql_tmpdir= my_bind_addr_str= NullS;
bzero((uchar*) &mysql_tmpdir_list, sizeof(mysql_tmpdir_list)); bzero((uchar*) &mysql_tmpdir_list, sizeof(mysql_tmpdir_list));
bzero((char *) &global_status_var, sizeof(global_status_var)); bzero((char *) &global_status_var, sizeof(global_status_var));
@ -7688,7 +7707,7 @@ static int mysql_init_variables(void)
mysql_home_ptr= mysql_home; mysql_home_ptr= mysql_home;
pidfile_name_ptr= pidfile_name; pidfile_name_ptr= pidfile_name;
log_error_file_ptr= log_error_file; log_error_file_ptr= log_error_file;
language_ptr= language; lc_messages_dir_ptr= lc_messages_dir;
mysql_data_home= mysql_real_data_home; mysql_data_home= mysql_real_data_home;
thd_startup_options= (OPTION_AUTO_IS_NULL | OPTION_BIN_LOG | thd_startup_options= (OPTION_AUTO_IS_NULL | OPTION_BIN_LOG |
OPTION_QUOTE_SHOW_CREATE | OPTION_SQL_NOTES); OPTION_QUOTE_SHOW_CREATE | OPTION_SQL_NOTES);
@ -7713,7 +7732,6 @@ static int mysql_init_variables(void)
multi_keycache_init(); multi_keycache_init();
/* Set directory paths */ /* Set directory paths */
strmake(language, LANGUAGE, sizeof(language)-1);
strmake(mysql_real_data_home, get_relative_path(MYSQL_DATADIR), strmake(mysql_real_data_home, get_relative_path(MYSQL_DATADIR),
sizeof(mysql_real_data_home)-1); sizeof(mysql_real_data_home)-1);
mysql_data_home_buff[0]=FN_CURLIB; // all paths are relative from here mysql_data_home_buff[0]=FN_CURLIB; // all paths are relative from here
@ -7736,6 +7754,7 @@ static int mysql_init_variables(void)
default_collation_name= compiled_default_collation_name; default_collation_name= compiled_default_collation_name;
sys_charset_system.value= (char*) system_charset_info->csname; sys_charset_system.value= (char*) system_charset_info->csname;
character_set_filesystem_name= (char*) "binary"; character_set_filesystem_name= (char*) "binary";
lc_messages= (char*) "en_US";
lc_time_names_name= (char*) "en_US"; lc_time_names_name= (char*) "en_US";
/* Set default values for some option variables */ /* Set default values for some option variables */
default_storage_engine_str= (char*) "MyISAM"; default_storage_engine_str= (char*) "MyISAM";
@ -7898,7 +7917,7 @@ mysqld_get_one_option(int optid,
sql_print_warning("Ignoring user change to '%s' because the user was set to '%s' earlier on the command line\n", argument, mysqld_user); sql_print_warning("Ignoring user change to '%s' because the user was set to '%s' earlier on the command line\n", argument, mysqld_user);
break; break;
case 'L': case 'L':
strmake(language, argument, sizeof(language)-1); strmake(lc_messages_dir, argument, sizeof(lc_messages_dir)-1);
break; break;
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
case OPT_SLAVE_SKIP_ERRORS: case OPT_SLAVE_SKIP_ERRORS:
@ -8660,7 +8679,7 @@ static int fix_paths(void)
--mysql_unpacked_real_data_home_len; --mysql_unpacked_real_data_home_len;
convert_dirname(language,language,NullS); convert_dirname(lc_messages_dir, lc_messages_dir, NullS);
(void) my_load_path(mysql_home,mysql_home,""); // Resolve current dir (void) my_load_path(mysql_home,mysql_home,""); // Resolve current dir
(void) my_load_path(mysql_real_data_home,mysql_real_data_home,mysql_home); (void) my_load_path(mysql_real_data_home,mysql_real_data_home,mysql_home);
(void) my_load_path(pidfile_name,pidfile_name,mysql_real_data_home); (void) my_load_path(pidfile_name,pidfile_name,mysql_real_data_home);
@ -8674,7 +8693,7 @@ static int fix_paths(void)
else else
strxnmov(buff,sizeof(buff)-1,mysql_home,sharedir,NullS); strxnmov(buff,sizeof(buff)-1,mysql_home,sharedir,NullS);
convert_dirname(buff,buff,NullS); convert_dirname(buff,buff,NullS);
(void) my_load_path(language,language,buff); (void) my_load_path(lc_messages_dir, lc_messages_dir, buff);
/* If --character-sets-dir isn't given, use shared library dir */ /* If --character-sets-dir isn't given, use shared library dir */
if (charsets_dir != mysql_charsets_dir) if (charsets_dir != mysql_charsets_dir)

View File

@ -380,6 +380,9 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
/* /*
buff[]: sql_errno:2 + ('#':1 + SQLSTATE_LENGTH:5) + MYSQL_ERRMSG_SIZE:512 buff[]: sql_errno:2 + ('#':1 + SQLSTATE_LENGTH:5) + MYSQL_ERRMSG_SIZE:512
*/ */
uint error;
uchar converted_err[MYSQL_ERRMSG_SIZE];
uint32 converted_err_len;
uchar buff[2+1+SQLSTATE_LENGTH+MYSQL_ERRMSG_SIZE], *pos; uchar buff[2+1+SQLSTATE_LENGTH+MYSQL_ERRMSG_SIZE], *pos;
DBUG_ENTER("send_error_packet"); DBUG_ENTER("send_error_packet");
@ -404,7 +407,12 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
buff[2]= '#'; buff[2]= '#';
pos= (uchar*) strmov((char*) buff+3, sqlstate); pos= (uchar*) strmov((char*) buff+3, sqlstate);
} }
length= (uint) (strmake((char*) pos, err, MYSQL_ERRMSG_SIZE-1) - converted_err_len= convert_error_message((char*)converted_err,
sizeof(converted_err),
thd->variables.character_set_results,
err, strlen(err),
system_charset_info, &error);
length= (uint) (strmake((char*) pos, (char*)converted_err, MYSQL_ERRMSG_SIZE) -
(char*) buff); (char*) buff);
err= (char*) buff; err= (char*) buff;
} }

View File

@ -302,9 +302,6 @@ static sys_var_key_cache_long sys_key_cache_division_limit(&vars, "key_cache_div
static sys_var_key_cache_long sys_key_cache_age_threshold(&vars, "key_cache_age_threshold", static sys_var_key_cache_long sys_key_cache_age_threshold(&vars, "key_cache_age_threshold",
offsetof(KEY_CACHE, offsetof(KEY_CACHE,
param_age_threshold)); param_age_threshold));
static sys_var_const sys_language(&vars, "language",
OPT_GLOBAL, SHOW_CHAR,
(uchar*) language);
static sys_var_const sys_large_files_support(&vars, "large_files_support", static sys_var_const sys_large_files_support(&vars, "large_files_support",
OPT_GLOBAL, SHOW_BOOL, OPT_GLOBAL, SHOW_BOOL,
(uchar*) &opt_large_files); (uchar*) &opt_large_files);
@ -314,6 +311,9 @@ static sys_var_const sys_large_page_size(&vars, "large_page_size",
static sys_var_const sys_large_pages(&vars, "large_pages", static sys_var_const sys_large_pages(&vars, "large_pages",
OPT_GLOBAL, SHOW_MY_BOOL, OPT_GLOBAL, SHOW_MY_BOOL,
(uchar*) &opt_large_pages); (uchar*) &opt_large_pages);
static sys_var_const sys_language(&vars, "lc_messages_dir",
OPT_GLOBAL, SHOW_CHAR,
(uchar*) lc_messages_dir);
static sys_var_bool_ptr sys_local_infile(&vars, "local_infile", static sys_var_bool_ptr sys_local_infile(&vars, "local_infile",
&opt_local_infile); &opt_local_infile);
#ifdef HAVE_MLOCKALL #ifdef HAVE_MLOCKALL
@ -792,6 +792,9 @@ sys_last_insert_id(&vars, "last_insert_id",
static sys_var_last_insert_id static sys_var_last_insert_id
sys_identity(&vars, "identity", sys_var::SESSION_VARIABLE_IN_BINLOG); sys_identity(&vars, "identity", sys_var::SESSION_VARIABLE_IN_BINLOG);
static sys_var_thd_lc_messages
sys_lc_messages(&vars, "lc_messages", sys_var::NOT_IN_BINLOG);
static sys_var_thd_lc_time_names static sys_var_thd_lc_time_names
sys_lc_time_names(&vars, "lc_time_names", sys_var::SESSION_VARIABLE_IN_BINLOG); sys_lc_time_names(&vars, "lc_time_names", sys_var::SESSION_VARIABLE_IN_BINLOG);
@ -913,8 +916,10 @@ bool sys_var_str::check(THD *thd, set_var *var)
return 0; return 0;
if ((res=(*check_func)(thd, var)) < 0) if ((res=(*check_func)(thd, var)) < 0)
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), {
name, var->value->str_value.ptr()); ErrConvString err(&var->value->str_value);
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, err.ptr());
}
return res; return res;
} }
@ -1804,7 +1809,13 @@ bool sys_var::check_enum(THD *thd, set_var *var, const TYPELIB *enum_names)
(ulong) find_type(enum_names, res->ptr(), (ulong) find_type(enum_names, res->ptr(),
res->length(),1)-1)) < 0) res->length(),1)-1)) < 0)
{ {
value= res ? res->c_ptr() : "NULL"; if (res)
{
ErrConvString err(res);
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, err.ptr());
return 1;
}
value= "NULL";
goto err; goto err;
} }
} }
@ -1857,8 +1868,9 @@ bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names)
&not_used)); &not_used));
if (error_len) if (error_len)
{ {
strmake(buff, error, min(sizeof(buff) - 1, error_len)); ErrConvString err(error, error_len, res->charset());
goto err; my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, err.ptr());
return 1;
} }
} }
else else
@ -2006,7 +2018,8 @@ bool sys_var_thd_date_time_format::check(THD *thd, set_var *var)
if (!(format= date_time_format_make(date_time_type, if (!(format= date_time_format_make(date_time_type,
res->ptr(), res->length()))) res->ptr(), res->length())))
{ {
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, res->c_ptr()); ErrConvString err(res);
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, err.ptr());
return 1; return 1;
} }
@ -2110,7 +2123,8 @@ bool sys_var_collation::check(THD *thd, set_var *var)
} }
if (!(tmp=get_charset_by_name(res->c_ptr(),MYF(0)))) if (!(tmp=get_charset_by_name(res->c_ptr(),MYF(0))))
{ {
my_error(ER_UNKNOWN_COLLATION, MYF(0), res->c_ptr()); ErrConvString err(res);
my_error(ER_UNKNOWN_COLLATION, MYF(0), err.ptr());
return 1; return 1;
} }
} }
@ -2150,7 +2164,8 @@ bool sys_var_character_set::check(THD *thd, set_var *var)
else if (!(tmp=get_charset_by_csname(res->c_ptr(),MY_CS_PRIMARY,MYF(0))) && else if (!(tmp=get_charset_by_csname(res->c_ptr(),MY_CS_PRIMARY,MYF(0))) &&
!(tmp=get_old_charset_by_name(res->c_ptr()))) !(tmp=get_old_charset_by_name(res->c_ptr())))
{ {
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), res->c_ptr()); ErrConvString err(res);
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), err.ptr());
return 1; return 1;
} }
} }
@ -2912,7 +2927,7 @@ bool sys_var_thd_ulong_session_readonly::check(THD *thd, set_var *var)
} }
bool sys_var_thd_lc_time_names::check(THD *thd, set_var *var) static MY_LOCALE *check_locale(THD *thd, const char *name, set_var *var)
{ {
MY_LOCALE *locale_match; MY_LOCALE *locale_match;
@ -2923,27 +2938,37 @@ bool sys_var_thd_lc_time_names::check(THD *thd, set_var *var)
char buf[20]; char buf[20];
int10_to_str((int) var->value->val_int(), buf, -10); int10_to_str((int) var->value->val_int(), buf, -10);
my_printf_error(ER_UNKNOWN_LOCALE, ER(ER_UNKNOWN_LOCALE), MYF(0), buf); my_printf_error(ER_UNKNOWN_LOCALE, ER(ER_UNKNOWN_LOCALE), MYF(0), buf);
return 1; return 0;
} }
} }
else // STRING_RESULT else // STRING_RESULT
{ {
char buff[6]; char buff[6];
String str(buff, sizeof(buff), &my_charset_latin1), *res; String str(buff, sizeof(buff), system_charset_info), *res;
if (!(res=var->value->val_str(&str))) if (!(res=var->value->val_str(&str)))
{ {
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL"); my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL");
return 1; return 0;
} }
const char *locale_str= res->c_ptr(); const char *locale_str= res->c_ptr();
if (!(locale_match= my_locale_by_name(locale_str))) if (!(locale_match= my_locale_by_name(locale_str)))
{ {
my_printf_error(ER_UNKNOWN_LOCALE, ER(ER_UNKNOWN_LOCALE), MYF(0), locale_str); my_printf_error(ER_UNKNOWN_LOCALE, ER(ER_UNKNOWN_LOCALE),
return 1; MYF(0), locale_str);
return 0;
} }
} }
var->save_result.locale_value= locale_match; return var->save_result.locale_value= locale_match;
}
bool sys_var_thd_lc::check(THD *thd, set_var *var)
{
MY_LOCALE *locale_match;
if (!(locale_match= check_locale(thd, name, var)))
return 1;
return 0; return 0;
} }
@ -2975,6 +3000,56 @@ void sys_var_thd_lc_time_names::set_default(THD *thd, enum_var_type type)
thd->variables.lc_time_names= global_system_variables.lc_time_names; thd->variables.lc_time_names= global_system_variables.lc_time_names;
} }
bool sys_var_thd_lc_messages::update(THD *thd, set_var *var)
{
MY_LOCALE *locale= var->save_result.locale_value;
if (!locale->errmsgs->errmsgs)
{
pthread_mutex_lock(&LOCK_error_messages);
if (!locale->errmsgs->errmsgs &&
read_texts(ERRMSG_FILE, locale->errmsgs->language,
&locale->errmsgs->errmsgs,
ER_ERROR_LAST - ER_ERROR_FIRST + 1))
{
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_UNKNOWN_ERROR,
"Can't process error message file for locale '%s'",
locale->name);
pthread_mutex_unlock(&LOCK_error_messages);
return 0;
}
pthread_mutex_unlock(&LOCK_error_messages);
}
if (var->type == OPT_GLOBAL)
global_system_variables.lc_messages= locale;
else
thd->variables.lc_messages= locale;
return 0;
}
uchar *sys_var_thd_lc_messages::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
return type == OPT_GLOBAL ?
(uchar *) global_system_variables.lc_messages->name :
(uchar *) thd->variables.lc_messages->name;
}
void sys_var_thd_lc_messages::set_default(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
global_system_variables.lc_messages= my_default_lc_messages;
else
thd->variables.lc_messages= global_system_variables.lc_messages;
}
/* /*
Handling of microseoncds given as seconds.part_seconds Handling of microseoncds given as seconds.part_seconds
@ -3996,8 +4071,9 @@ bool sys_var_thd_optimizer_switch::check(THD *thd, set_var *var)
&error, &error_len, &not_used); &error, &error_len, &not_used);
if (error_len) if (error_len)
{ {
strmake(buff, error, min(sizeof(buff) - 1, error_len)); ErrConvString err(error, error_len, res->charset());
goto err; my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, err.ptr());
return TRUE;
} }
return FALSE; return FALSE;
err: err:

View File

@ -1216,11 +1216,12 @@ public:
}; };
class sys_var_thd_lc_time_names :public sys_var_thd
class sys_var_thd_lc: public sys_var_thd
{ {
public: public:
sys_var_thd_lc_time_names(sys_var_chain *chain, const char *name_arg, sys_var_thd_lc(sys_var_chain *chain, const char *name_arg,
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG) Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
: sys_var_thd(name_arg, NULL, binlog_status_arg) : sys_var_thd(name_arg, NULL, binlog_status_arg)
{ {
#if MYSQL_VERSION_ID < 50000 #if MYSQL_VERSION_ID < 50000
@ -1235,11 +1236,35 @@ public:
return ((type != STRING_RESULT) && (type != INT_RESULT)); return ((type != STRING_RESULT) && (type != INT_RESULT));
} }
bool check_default(enum_var_type type) { return 0; } bool check_default(enum_var_type type) { return 0; }
};
class sys_var_thd_lc_time_names :public sys_var_thd_lc
{
public:
sys_var_thd_lc_time_names(sys_var_chain *chain_arg, const char *name_arg,
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
: sys_var_thd_lc(chain_arg, name_arg, binlog_status_arg)
{}
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
virtual void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
}; };
class sys_var_thd_lc_messages :public sys_var_thd_lc
{
public:
sys_var_thd_lc_messages(sys_var_chain *chain_arg, const char *name_arg,
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
: sys_var_thd_lc(chain_arg, name_arg, binlog_status_arg)
{}
bool update(THD *thd, set_var *var);
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
void set_default(THD *thd, enum_var_type type);
};
#ifdef HAVE_EVENT_SCHEDULER #ifdef HAVE_EVENT_SCHEDULER
class sys_var_event_scheduler :public sys_var_long_ptr class sys_var_event_scheduler :public sys_var_long_ptr
{ {
@ -1322,8 +1347,8 @@ public:
{ {
Item_field *item= (Item_field*) value_arg; Item_field *item= (Item_field*) value_arg;
if (!(value=new Item_string(item->field_name, if (!(value=new Item_string(item->field_name,
(uint) strlen(item->field_name), (uint) strlen(item->field_name),
item->collation.collation))) system_charset_info)))
value=value_arg; /* Give error message later */ value=value_arg; /* Give error message later */
} }
else else

View File

@ -15,7 +15,7 @@
## Process this file with automake to create Makefile.in ## Process this file with automake to create Makefile.in
EXTRA_DIST= errmsg.txt EXTRA_DIST= errmsg-utf8.txt
dist-hook: dist-hook:
for dir in charsets @AVAILABLE_LANGUAGES@; do \ for dir in charsets @AVAILABLE_LANGUAGES@; do \
@ -31,7 +31,7 @@ all-local: english/errmsg.sys
# Use the english errmsg.sys as a flag that all errmsg.sys needs to be # Use the english errmsg.sys as a flag that all errmsg.sys needs to be
# created. Normally these are created by extra/Makefile # created. Normally these are created by extra/Makefile
english/errmsg.sys: errmsg.txt english/errmsg.sys: errmsg-utf8.txt
rm -f $(top_builddir)/include/mysqld_error.h rm -f $(top_builddir)/include/mysqld_error.h
(cd $(top_builddir)/extra && $(MAKE)) (cd $(top_builddir)/extra && $(MAKE))
@ -43,8 +43,8 @@ install-data-local:
$(DESTDIR)$(pkgdatadir)/$$lang/errmsg.sys; \ $(DESTDIR)$(pkgdatadir)/$$lang/errmsg.sys; \
done done
$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/charsets $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/charsets
$(INSTALL_DATA) $(srcdir)/errmsg.txt \ $(INSTALL_DATA) $(srcdir)/errmsg-utf8.txt \
$(DESTDIR)$(pkgdatadir)/errmsg.txt; \ $(DESTDIR)$(pkgdatadir)/errmsg-utf8.txt; \
$(INSTALL_DATA) $(srcdir)/charsets/README $(DESTDIR)$(pkgdatadir)/charsets/README $(INSTALL_DATA) $(srcdir)/charsets/README $(DESTDIR)$(pkgdatadir)/charsets/README
$(INSTALL_DATA) $(srcdir)/charsets/*.xml $(DESTDIR)$(pkgdatadir)/charsets $(INSTALL_DATA) $(srcdir)/charsets/*.xml $(DESTDIR)$(pkgdatadir)/charsets

61
sql/share/errmsg-cnv.sh Normal file
View File

@ -0,0 +1,61 @@
#
# This shell script converts errmsg.txt
# from a mixed-charset format
# to utf8 format
# and writes the result to errmgs-utf8.txt
#
cat errmsg.txt | while IFS= ; read -r a
do
cs=""
var="${a#"${a%%[![:space:]]*}"}"
case $var in
cze*|hun*|pol*|rum*|slo*)
cs=latin2
;;
dan*|nla*|eng*|fre*|ger*|ita*|nor*|por*|spa*|swe*)
cs=latin1
;;
est*)
cs=latin7
;;
greek*)
cs=windows-1253
;;
jpn*)
cs=euc-jp
;;
jps*)
cs=shift-jis
;;
kor*)
cs=euc-kr
;;
serbian*)
cs=windows-1250
;;
rus*)
cs=koi8-r
;;
ukr*)
cs=koi8-u
;;
*)
echo $a
esac
if [ "x$cs" != "x" ]
then
b=`echo $a | iconv -f $cs -t utf-8` ; rc=$?
if [ "$rc" == "0" ]
then
echo "$b"
else
echo "# This message failed to convert from $cs, skipped"
fi
fi
done > errmsg-utf8.txt

6239
sql/share/errmsg-utf8.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1617,13 +1617,17 @@ bool select_result::check_simple_select() const
static String default_line_term("\n",default_charset_info); static String default_line_term("\n",default_charset_info);
static String default_escaped("\\",default_charset_info); static String default_escaped("\\",default_charset_info);
static String default_field_term("\t",default_charset_info); static String default_field_term("\t",default_charset_info);
static String default_xml_row_term("<row>", default_charset_info);
sql_exchange::sql_exchange(char *name,bool flag) sql_exchange::sql_exchange(char *name, bool flag,
enum enum_filetype filetype_arg)
:file_name(name), opt_enclosed(0), dumpfile(flag), skip_lines(0) :file_name(name), opt_enclosed(0), dumpfile(flag), skip_lines(0)
{ {
filetype= filetype_arg;
field_term= &default_field_term; field_term= &default_field_term;
enclosed= line_start= &my_empty_string; enclosed= line_start= &my_empty_string;
line_term= &default_line_term; line_term= filetype == FILETYPE_CSV ?
&default_line_term : &default_xml_row_term;
escaped= &default_escaped; escaped= &default_escaped;
cs= NULL; cs= NULL;
} }

View File

@ -89,6 +89,7 @@ enum enum_slave_exec_mode { SLAVE_EXEC_MODE_STRICT,
SLAVE_EXEC_MODE_LAST_BIT}; SLAVE_EXEC_MODE_LAST_BIT};
enum enum_mark_columns enum enum_mark_columns
{ MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE}; { MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE};
enum enum_filetype { FILETYPE_CSV, FILETYPE_XML };
extern char internal_table_name[2]; extern char internal_table_name[2];
extern char empty_c_string[1]; extern char empty_c_string[1];
@ -424,6 +425,8 @@ struct system_variables
CHARSET_INFO *collation_database; CHARSET_INFO *collation_database;
CHARSET_INFO *collation_connection; CHARSET_INFO *collation_connection;
/* Error messages */
MY_LOCALE *lc_messages;
/* Locale Support */ /* Locale Support */
MY_LOCALE *lc_time_names; MY_LOCALE *lc_time_names;
@ -2369,13 +2372,15 @@ my_eof(THD *thd)
class sql_exchange :public Sql_alloc class sql_exchange :public Sql_alloc
{ {
public: public:
enum enum_filetype filetype; /* load XML, Added by Arnold & Erik */
char *file_name; char *file_name;
String *field_term,*enclosed,*line_term,*line_start,*escaped; String *field_term,*enclosed,*line_term,*line_start,*escaped;
bool opt_enclosed; bool opt_enclosed;
bool dumpfile; bool dumpfile;
ulong skip_lines; ulong skip_lines;
CHARSET_INFO *cs; CHARSET_INFO *cs;
sql_exchange(char *name,bool dumpfile_flag); sql_exchange(char *name, bool dumpfile_flag,
enum_filetype filetype_arg= FILETYPE_CSV);
bool escaped_given(void); bool escaped_given(void);
}; };

View File

@ -630,7 +630,8 @@ void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level,
DBUG_ASSERT(format != NULL); DBUG_ASSERT(format != NULL);
va_start(args,format); va_start(args,format);
my_vsnprintf(warning, sizeof(warning), format, args); my_vsnprintf_ex(&my_charset_utf8_general_ci, warning,
sizeof(warning), format, args);
va_end(args); va_end(args);
push_warning(thd, level, code, warning); push_warning(thd, level, code, warning);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
@ -712,3 +713,146 @@ bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
/**
Convert value for dispatch to error message(see WL#751).
@param to buffer for converted string
@param to_length size of the buffer
@param from string which should be converted
@param from_length string length
@param from_cs charset from convert
@retval
result string
*/
char *err_conv(char *buff, uint to_length, const char *from,
uint from_length, CHARSET_INFO *from_cs)
{
char *to= buff;
const char *from_start= from;
size_t res;
DBUG_ASSERT(to_length > 0);
to_length--;
if (from_cs == &my_charset_bin)
{
uchar char_code;
res= 0;
while (1)
{
if ((uint)(from - from_start) >= from_length ||
res >= to_length)
{
*to= 0;
break;
}
char_code= ((uchar) *from);
if (char_code >= 0x20 && char_code <= 0x7E)
{
*to++= char_code;
from++;
res++;
}
else
{
if (res + 4 >= to_length)
{
*to= 0;
break;
}
res+= my_snprintf(to, 5, "\\x%02X", (uint) char_code);
to+=4;
from++;
}
}
}
else
{
uint errors;
res= copy_and_convert(to, to_length, system_charset_info,
from, from_length, from_cs, &errors);
to[res]= 0;
}
return buff;
}
/**
Convert string for dispatch to client(see WL#751).
@param to buffer to convert
@param to_length buffer length
@param to_cs chraset to convert
@param from string from convert
@param from_length string length
@param from_cs charset from convert
@param errors count of errors during convertion
@retval
length of converted string
*/
uint32 convert_error_message(char *to, uint32 to_length, CHARSET_INFO *to_cs,
const char *from, uint32 from_length,
CHARSET_INFO *from_cs, uint *errors)
{
int cnvres;
my_wc_t wc;
const uchar *from_end= (const uchar*) from+from_length;
char *to_start= to;
uchar *to_end= (uchar*) to+to_length;
my_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc;
my_charset_conv_wc_mb wc_mb;
uint error_count= 0;
uint length;
DBUG_ASSERT(to_length > 0);
to_length--;
if (!to_cs || from_cs == to_cs || to_cs == &my_charset_bin)
{
length= min(to_length, from_length);
memmove(to, from, length);
to[length]= 0;
return length;
}
wc_mb= to_cs->cset->wc_mb;
while (1)
{
if ((cnvres= (*mb_wc)(from_cs, &wc, (uchar*) from, from_end)) > 0)
{
if (!wc)
break;
from+= cnvres;
}
else if (cnvres == MY_CS_ILSEQ)
{
wc= (ulong) (uchar) *from;
from+=1;
}
else
break;
if ((cnvres= (*wc_mb)(to_cs, wc, (uchar*) to, to_end)) > 0)
to+= cnvres;
else if (cnvres == MY_CS_ILUNI)
{
length= (wc <= 0xFFFF) ? 6/* '\1234' format*/ : 9 /* '\+123456' format*/;
if ((uchar*)(to + length) >= to_end)
break;
cnvres= my_snprintf(to, 9,
(wc <= 0xFFFF) ? "\\%04X" : "\\+%06X", (uint) wc);
to+= cnvres;
}
else
break;
}
*to= 0;
*errors= error_count;
return (uint32) (to - to_start);
}

View File

@ -516,11 +516,45 @@ private:
friend class Resignal_statement; friend class Resignal_statement;
}; };
extern char *err_conv(char *buff, uint to_length, const char *from,
uint from_length, CHARSET_INFO *from_cs);
class ErrConvString
{
char err_buffer[MYSQL_ERRMSG_SIZE];
public:
ErrConvString(String *str)
{
(void) err_conv(err_buffer, sizeof(err_buffer), str->ptr(),
str->length(), str->charset());
}
ErrConvString(const char *str, CHARSET_INFO* cs)
{
(void) err_conv(err_buffer, sizeof(err_buffer),
str, strlen(str), cs);
}
ErrConvString(const char *str, uint length, CHARSET_INFO* cs)
{
(void) err_conv(err_buffer, sizeof(err_buffer),
str, length, cs);
}
~ErrConvString() { };
char *ptr() { return err_buffer; }
};
void push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, void push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level,
uint code, const char *msg); uint code, const char *msg);
void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level, void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level,
uint code, const char *format, ...); uint code, const char *format, ...);
bool mysqld_show_warnings(THD *thd, ulong levels_to_show); bool mysqld_show_warnings(THD *thd, ulong levels_to_show);
uint32 convert_error_message(char *to, uint32 to_length, CHARSET_INFO *to_cs,
const char *from, uint32 from_length,
CHARSET_INFO *from_cs, uint *errors);
extern const LEX_STRING warning_level_names[]; extern const LEX_STRING warning_level_names[];

View File

@ -15,6 +15,8 @@
/* Copy data from a textfile to table */ /* Copy data from a textfile to table */
/* 2006-12 Erik Wetterberg : LOAD XML added */
#include "mysql_priv.h" #include "mysql_priv.h"
#include <my_dir.h> #include <my_dir.h>
#include <m_ctype.h> #include <m_ctype.h>
@ -23,6 +25,23 @@
#include "sp_head.h" #include "sp_head.h"
#include "sql_trigger.h" #include "sql_trigger.h"
class XML_TAG {
public:
int level;
String field;
String value;
XML_TAG(int l, String f, String v);
};
XML_TAG::XML_TAG(int l, String f, String v)
{
level= l;
field.append(f);
value.append(v);
}
class READ_INFO { class READ_INFO {
File file; File file;
uchar *buffer, /* Buffer for read text */ uchar *buffer, /* Buffer for read text */
@ -37,6 +56,7 @@ class READ_INFO {
bool need_end_io_cache; bool need_end_io_cache;
IO_CACHE cache; IO_CACHE cache;
NET *io_net; NET *io_net;
int level; /* for load xml */
public: public:
bool error,line_cuted,found_null,enclosed; bool error,line_cuted,found_null,enclosed;
@ -54,6 +74,12 @@ public:
char unescape(char chr); char unescape(char chr);
int terminator(char *ptr,uint length); int terminator(char *ptr,uint length);
bool find_start_of_fields(); bool find_start_of_fields();
/* load xml */
List<XML_TAG> taglist;
int read_value(int delim, String *val);
int read_xml();
int clear_level(int level);
/* /*
We need to force cache close before destructor is invoked to log We need to force cache close before destructor is invoked to log
the last read block the last read block
@ -82,6 +108,13 @@ static int read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
List<Item> &set_values, READ_INFO &read_info, List<Item> &set_values, READ_INFO &read_info,
String &enclosed, ulong skip_lines, String &enclosed, ulong skip_lines,
bool ignore_check_option_errors); bool ignore_check_option_errors);
static int read_xml_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
List<Item> &fields_vars, List<Item> &set_fields,
List<Item> &set_values, READ_INFO &read_info,
String &enclosed, ulong skip_lines,
bool ignore_check_option_errors);
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex, static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex,
const char* db_arg, const char* db_arg,
@ -393,7 +426,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
thd->count_cuted_fields= CHECK_FIELD_WARN; /* calc cuted fields */ thd->count_cuted_fields= CHECK_FIELD_WARN; /* calc cuted fields */
thd->cuted_fields=0L; thd->cuted_fields=0L;
/* Skip lines if there is a line terminator */ /* Skip lines if there is a line terminator */
if (ex->line_term->length()) if (ex->line_term->length() && ex->filetype != FILETYPE_XML)
{ {
/* ex->skip_lines needs to be preserved for logging */ /* ex->skip_lines needs to be preserved for logging */
while (skip_lines > 0) while (skip_lines > 0)
@ -424,7 +457,11 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
(MODE_STRICT_TRANS_TABLES | (MODE_STRICT_TRANS_TABLES |
MODE_STRICT_ALL_TABLES))); MODE_STRICT_ALL_TABLES)));
if (!field_term->length() && !enclosed->length()) if (ex->filetype == FILETYPE_XML) /* load xml */
error= read_xml_field(thd, info, table_list, fields_vars,
set_fields, set_values, read_info,
*(ex->line_term), skip_lines, ignore);
else if (!field_term->length() && !enclosed->length())
error= read_fixed_length(thd, info, table_list, fields_vars, error= read_fixed_length(thd, info, table_list, fields_vars,
set_fields, set_values, read_info, set_fields, set_values, read_info,
skip_lines, ignore); skip_lines, ignore);
@ -1005,6 +1042,171 @@ continue_loop:;
} }
/****************************************************************************
** Read rows in xml format
****************************************************************************/
static int
read_xml_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
List<Item> &fields_vars, List<Item> &set_fields,
List<Item> &set_values, READ_INFO &read_info,
String &row_tag, ulong skip_lines,
bool ignore_check_option_errors)
{
List_iterator_fast<Item> it(fields_vars);
Item *item;
TABLE *table= table_list->table;
bool no_trans_update_stmt;
CHARSET_INFO *cs= read_info.read_charset;
DBUG_ENTER("read_xml_field");
no_trans_update_stmt= !table->file->has_transactions();
for ( ; ; it.rewind())
{
if (thd->killed)
{
thd->send_kill_message();
DBUG_RETURN(1);
}
// read row tag and save values into tag list
if (read_info.read_xml())
break;
List_iterator_fast<XML_TAG> xmlit(read_info.taglist);
xmlit.rewind();
XML_TAG *tag= NULL;
#ifndef DBUG_OFF
DBUG_PRINT("read_xml_field", ("skip_lines=%d", (int) skip_lines));
while ((tag= xmlit++))
{
DBUG_PRINT("read_xml_field", ("got tag:%i '%s' '%s'",
tag->level, tag->field.c_ptr(),
tag->value.c_ptr()));
}
#endif
restore_record(table, s->default_values);
while ((item= it++))
{
/* If this line is to be skipped we don't want to fill field or var */
if (skip_lines)
continue;
/* find field in tag list */
xmlit.rewind();
tag= xmlit++;
while(tag && strcmp(tag->field.c_ptr(), item->name) != 0)
tag= xmlit++;
if (!tag) // found null
{
if (item->type() == Item::FIELD_ITEM)
{
Field *field= ((Item_field *) item)->field;
field->reset();
field->set_null();
if (field == table->next_number_field)
table->auto_increment_field_not_null= TRUE;
if (!field->maybe_null())
{
if (field->type() == FIELD_TYPE_TIMESTAMP)
((Field_timestamp *) field)->set_time();
else if (field != table->next_number_field)
field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_NULL_TO_NOTNULL, 1);
}
}
else
((Item_user_var_as_out_param *) item)->set_null_value(cs);
continue;
}
if (item->type() == Item::FIELD_ITEM)
{
Field *field= ((Item_field *)item)->field;
field->set_notnull();
if (field == table->next_number_field)
table->auto_increment_field_not_null= TRUE;
field->store((char *) tag->value.ptr(), tag->value.length(), cs);
}
else
((Item_user_var_as_out_param *) item)->set_value(
(char *) tag->value.ptr(),
tag->value.length(), cs);
}
if (read_info.error)
break;
if (skip_lines)
{
skip_lines--;
continue;
}
if (item)
{
/* Have not read any field, thus input file is simply ended */
if (item == fields_vars.head())
break;
for ( ; item; item= it++)
{
if (item->type() == Item::FIELD_ITEM)
{
/*
QQ: We probably should not throw warning for each field.
But how about intention to always have the same number
of warnings in THD::cuted_fields (and get rid of cuted_fields
in the end ?)
*/
thd->cuted_fields++;
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_TOO_FEW_RECORDS,
ER(ER_WARN_TOO_FEW_RECORDS),
thd->warning_info->current_row_for_warning());
}
else
((Item_user_var_as_out_param *)item)->set_null_value(cs);
}
}
if (thd->killed ||
fill_record_n_invoke_before_triggers(thd, set_fields, set_values,
ignore_check_option_errors,
table->triggers,
TRG_EVENT_INSERT))
DBUG_RETURN(1);
switch (table_list->view_check_option(thd,
ignore_check_option_errors)) {
case VIEW_CHECK_SKIP:
read_info.next_line();
goto continue_loop;
case VIEW_CHECK_ERROR:
DBUG_RETURN(-1);
}
if (write_record(thd, table, &info))
DBUG_RETURN(1);
/*
We don't need to reset auto-increment field since we are restoring
its default value at the beginning of each loop iteration.
*/
thd->transaction.stmt.modified_non_trans_table= no_trans_update_stmt;
thd->warning_info->inc_current_row_for_warning();
continue_loop:;
}
DBUG_RETURN(test(read_info.error) || thd->is_error());
} /* load xml end */
/* Unescape all escape characters, mark \N as null */ /* Unescape all escape characters, mark \N as null */
char char
@ -1043,6 +1245,7 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, CHARSET_INFO *cs,
field_term_length= field_term.length(); field_term_length= field_term.length();
line_term_ptr=(char*) line_term.ptr(); line_term_ptr=(char*) line_term.ptr();
line_term_length= line_term.length(); line_term_length= line_term.length();
level= 0; /* for load xml */
if (line_start.length() == 0) if (line_start.length() == 0)
{ {
line_start_ptr=0; line_start_ptr=0;
@ -1118,6 +1321,10 @@ READ_INFO::~READ_INFO()
my_free((uchar*) buffer,MYF(0)); my_free((uchar*) buffer,MYF(0));
error=1; error=1;
} }
List_iterator<XML_TAG> xmlit(taglist);
XML_TAG *t;
while ((t= xmlit++))
delete(t);
} }
@ -1450,3 +1657,319 @@ bool READ_INFO::find_start_of_fields()
} }
return 0; return 0;
} }
/*
Clear taglist from tags with a specified level
*/
int READ_INFO::clear_level(int level)
{
DBUG_ENTER("READ_INFO::read_xml clear_level");
List_iterator<XML_TAG> xmlit(taglist);
xmlit.rewind();
XML_TAG *tag;
while ((tag= xmlit++))
{
if(tag->level >= level)
{
xmlit.remove();
delete tag;
}
}
DBUG_RETURN(0);
}
/*
Convert an XML entity to Unicode value.
Return -1 on error;
*/
static int
my_xml_entity_to_char(const char *name, uint length)
{
if (length == 2)
{
if (!memcmp(name, "gt", length))
return '>';
if (!memcmp(name, "lt", length))
return '<';
}
else if (length == 3)
{
if (!memcmp(name, "amp", length))
return '&';
}
else if (length == 4)
{
if (!memcmp(name, "quot", length))
return '"';
if (!memcmp(name, "apos", length))
return '\'';
}
return -1;
}
/**
@brief Convert newline, linefeed, tab to space
@param chr character
@details According to the "XML 1.0" standard,
only space (#x20) characters, carriage returns,
line feeds or tabs are considered as spaces.
Convert all of them to space (#x20) for parsing simplicity.
*/
static int
my_tospace(int chr)
{
return (chr == '\t' || chr == '\r' || chr == '\n') ? ' ' : chr;
}
/*
Read an xml value: handle multibyte and xml escape
*/
int READ_INFO::read_value(int delim, String *val)
{
int chr;
String tmp;
for (chr= GET; my_tospace(chr) != delim && chr != my_b_EOF;)
{
#ifdef USE_MB
if (my_mbcharlen(read_charset, chr) > 1)
{
DBUG_PRINT("read_xml",("multi byte"));
int i, ml= my_mbcharlen(read_charset, chr);
for (i= 1; i < ml; i++)
{
val->append(chr);
/*
Don't use my_tospace() in the middle of a multi-byte character
TODO: check that the multi-byte sequence is valid.
*/
chr= GET;
if (chr == my_b_EOF)
return chr;
}
}
#endif
if(chr == '&')
{
tmp.length(0);
for (chr= my_tospace(GET) ; chr != ';' ; chr= my_tospace(GET))
{
if (chr == my_b_EOF)
return chr;
tmp.append(chr);
}
if ((chr= my_xml_entity_to_char(tmp.ptr(), tmp.length())) >= 0)
val->append(chr);
else
{
val->append('&');
val->append(tmp);
val->append(';');
}
}
else
val->append(chr);
chr= GET;
}
return my_tospace(chr);
}
/*
Read a record in xml format
tags and attributes are stored in taglist
when tag set in ROWS IDENTIFIED BY is closed, we are ready and return
*/
int READ_INFO::read_xml()
{
DBUG_ENTER("READ_INFO::read_xml");
int chr, chr2, chr3;
int delim= 0;
String tag, attribute, value;
bool in_tag= false;
tag.length(0);
attribute.length(0);
value.length(0);
for (chr= my_tospace(GET); chr != my_b_EOF ; )
{
switch(chr){
case '<': /* read tag */
/* TODO: check if this is a comment <!-- comment --> */
chr= my_tospace(GET);
if(chr == '!')
{
chr2= GET;
chr3= GET;
if(chr2 == '-' && chr3 == '-')
{
chr2= 0;
chr3= 0;
chr= my_tospace(GET);
while(chr != '>' || chr2 != '-' || chr3 != '-')
{
if(chr == '-')
{
chr3= chr2;
chr2= chr;
}
else if (chr2 == '-')
{
chr2= 0;
chr3= 0;
}
chr= my_tospace(GET);
if (chr == my_b_EOF)
goto found_eof;
}
break;
}
}
tag.length(0);
while(chr != '>' && chr != ' ' && chr != '/' && chr != my_b_EOF)
{
if(chr != delim) /* fix for the '<field name =' format */
tag.append(chr);
chr= my_tospace(GET);
}
// row tag should be in ROWS IDENTIFIED BY '<row>' - stored in line_term
if((tag.length() == line_term_length -2) &&
(strncmp(tag.c_ptr_safe(), line_term_ptr + 1, tag.length()) == 0))
{
DBUG_PRINT("read_xml", ("start-of-row: %i %s %s",
level,tag.c_ptr_safe(), line_term_ptr));
}
if(chr == ' ' || chr == '>')
{
level++;
clear_level(level + 1);
}
if (chr == ' ')
in_tag= true;
else
in_tag= false;
break;
case ' ': /* read attribute */
while(chr == ' ') /* skip blanks */
chr= my_tospace(GET);
if(!in_tag)
break;
while(chr != '=' && chr != '/' && chr != '>' && chr != my_b_EOF)
{
attribute.append(chr);
chr= my_tospace(GET);
}
break;
case '>': /* end tag - read tag value */
in_tag= false;
chr= read_value('<', &value);
if(chr == my_b_EOF)
goto found_eof;
/* save value to list */
if(tag.length() > 0 && value.length() > 0)
{
DBUG_PRINT("read_xml", ("lev:%i tag:%s val:%s",
level,tag.c_ptr_safe(), value.c_ptr_safe()));
taglist.push_front( new XML_TAG(level, tag, value));
}
tag.length(0);
value.length(0);
attribute.length(0);
break;
case '/': /* close tag */
level--;
chr= my_tospace(GET);
if(chr != '>') /* if this is an empty tag <tag /> */
tag.length(0); /* we should keep tag value */
while(chr != '>' && chr != my_b_EOF)
{
tag.append(chr);
chr= my_tospace(GET);
}
if((tag.length() == line_term_length -2) &&
(strncmp(tag.c_ptr_safe(), line_term_ptr + 1, tag.length()) == 0))
{
DBUG_PRINT("read_xml", ("found end-of-row %i %s",
level, tag.c_ptr_safe()));
DBUG_RETURN(0); //normal return
}
chr= my_tospace(GET);
break;
case '=': /* attribute name end - read the value */
//check for tag field and attribute name
if(!memcmp(tag.c_ptr_safe(), STRING_WITH_LEN("field")) &&
!memcmp(attribute.c_ptr_safe(), STRING_WITH_LEN("name")))
{
/*
this is format <field name="xx">xx</field>
where actual fieldname is in attribute
*/
delim= my_tospace(GET);
tag.length(0);
attribute.length(0);
chr= '<'; /* we pretend that it is a tag */
level--;
break;
}
//check for " or '
chr= GET;
if (chr == my_b_EOF)
goto found_eof;
if(chr == '"' || chr == '\'')
{
delim= chr;
}
else
{
delim= ' '; /* no delimiter, use space */
PUSH(chr);
}
chr= read_value(delim, &value);
if(attribute.length() > 0 && value.length() > 0)
{
DBUG_PRINT("read_xml", ("lev:%i att:%s val:%s\n",
level + 1,
attribute.c_ptr_safe(),
value.c_ptr_safe()));
taglist.push_front(new XML_TAG(level + 1, attribute, value));
}
attribute.length(0);
value.length(0);
if (chr != ' ')
chr= my_tospace(GET);
break;
default:
chr= my_tospace(GET);
} /* end switch */
} /* end while */
found_eof:
DBUG_PRINT("read_xml",("Found eof"));
eof= 1;
DBUG_RETURN(1);
}

File diff suppressed because it is too large Load Diff

View File

@ -7783,7 +7783,10 @@ bool check_string_char_length(LEX_STRING *str, const char *err_msg,
return FALSE; return FALSE;
if (!no_error) if (!no_error)
my_error(ER_WRONG_STRING_LENGTH, MYF(0), str->str, err_msg, max_char_length); {
ErrConvString err(str->str, str->length, cs);
my_error(ER_WRONG_STRING_LENGTH, MYF(0), err.ptr(), err_msg, max_char_length);
}
return TRUE; return TRUE;
} }

View File

@ -368,7 +368,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
if (report & REPORT_TO_USER) if (report & REPORT_TO_USER)
my_error(ER_UDF_NO_PATHS, MYF(0)); my_error(ER_UDF_NO_PATHS, MYF(0));
if (report & REPORT_TO_LOG) if (report & REPORT_TO_LOG)
sql_print_error("%s", ER(ER_UDF_NO_PATHS)); sql_print_error("%s", ER_DEFAULT(ER_UDF_NO_PATHS));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
/* If this dll is already loaded just increase ref_count. */ /* If this dll is already loaded just increase ref_count. */
@ -396,7 +396,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
if (report & REPORT_TO_USER) if (report & REPORT_TO_USER)
my_error(ER_CANT_OPEN_LIBRARY, MYF(0), dlpath, errno, errmsg); my_error(ER_CANT_OPEN_LIBRARY, MYF(0), dlpath, errno, errmsg);
if (report & REPORT_TO_LOG) if (report & REPORT_TO_LOG)
sql_print_error(ER(ER_CANT_OPEN_LIBRARY), dlpath, errno, errmsg); sql_print_error(ER_DEFAULT(ER_CANT_OPEN_LIBRARY), dlpath, errno, errmsg);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
/* Determine interface version */ /* Determine interface version */
@ -406,7 +406,8 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
if (report & REPORT_TO_USER) if (report & REPORT_TO_USER)
my_error(ER_CANT_FIND_DL_ENTRY, MYF(0), plugin_interface_version_sym); my_error(ER_CANT_FIND_DL_ENTRY, MYF(0), plugin_interface_version_sym);
if (report & REPORT_TO_LOG) if (report & REPORT_TO_LOG)
sql_print_error(ER(ER_CANT_FIND_DL_ENTRY), plugin_interface_version_sym); sql_print_error(ER_DEFAULT(ER_CANT_FIND_DL_ENTRY),
plugin_interface_version_sym);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
plugin_dl.version= *(int *)sym; plugin_dl.version= *(int *)sym;
@ -419,7 +420,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
my_error(ER_CANT_OPEN_LIBRARY, MYF(0), dlpath, 0, my_error(ER_CANT_OPEN_LIBRARY, MYF(0), dlpath, 0,
"plugin interface version mismatch"); "plugin interface version mismatch");
if (report & REPORT_TO_LOG) if (report & REPORT_TO_LOG)
sql_print_error(ER(ER_CANT_OPEN_LIBRARY), dlpath, 0, sql_print_error(ER_DEFAULT(ER_CANT_OPEN_LIBRARY), dlpath, 0,
"plugin interface version mismatch"); "plugin interface version mismatch");
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -430,7 +431,8 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
if (report & REPORT_TO_USER) if (report & REPORT_TO_USER)
my_error(ER_CANT_FIND_DL_ENTRY, MYF(0), plugin_declarations_sym); my_error(ER_CANT_FIND_DL_ENTRY, MYF(0), plugin_declarations_sym);
if (report & REPORT_TO_LOG) if (report & REPORT_TO_LOG)
sql_print_error(ER(ER_CANT_FIND_DL_ENTRY), plugin_declarations_sym); sql_print_error(ER_DEFAULT(ER_CANT_FIND_DL_ENTRY),
plugin_declarations_sym);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -450,7 +452,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
if (report & REPORT_TO_USER) if (report & REPORT_TO_USER)
my_error(ER_CANT_FIND_DL_ENTRY, MYF(0), sizeof_st_plugin_sym); my_error(ER_CANT_FIND_DL_ENTRY, MYF(0), sizeof_st_plugin_sym);
if (report & REPORT_TO_LOG) if (report & REPORT_TO_LOG)
sql_print_error(ER(ER_CANT_FIND_DL_ENTRY), sizeof_st_plugin_sym); sql_print_error(ER_DEFAULT(ER_CANT_FIND_DL_ENTRY), sizeof_st_plugin_sym);
DBUG_RETURN(0); DBUG_RETURN(0);
#else #else
/* /*
@ -475,7 +477,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
if (report & REPORT_TO_USER) if (report & REPORT_TO_USER)
my_error(ER_OUTOFMEMORY, MYF(0), plugin_dl.dl.length); my_error(ER_OUTOFMEMORY, MYF(0), plugin_dl.dl.length);
if (report & REPORT_TO_LOG) if (report & REPORT_TO_LOG)
sql_print_error(ER(ER_OUTOFMEMORY), plugin_dl.dl.length); sql_print_error(ER_DEFAULT(ER_OUTOFMEMORY), plugin_dl.dl.length);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
/* /*
@ -500,7 +502,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
if (report & REPORT_TO_USER) if (report & REPORT_TO_USER)
my_error(ER_OUTOFMEMORY, MYF(0), plugin_dl.dl.length); my_error(ER_OUTOFMEMORY, MYF(0), plugin_dl.dl.length);
if (report & REPORT_TO_LOG) if (report & REPORT_TO_LOG)
sql_print_error(ER(ER_OUTOFMEMORY), plugin_dl.dl.length); sql_print_error(ER_DEFAULT(ER_OUTOFMEMORY), plugin_dl.dl.length);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
plugin_dl.dl.length= copy_and_convert(plugin_dl.dl.str, plugin_dl.dl.length, plugin_dl.dl.length= copy_and_convert(plugin_dl.dl.str, plugin_dl.dl.length,
@ -514,7 +516,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
if (report & REPORT_TO_USER) if (report & REPORT_TO_USER)
my_error(ER_OUTOFMEMORY, MYF(0), sizeof(struct st_plugin_dl)); my_error(ER_OUTOFMEMORY, MYF(0), sizeof(struct st_plugin_dl));
if (report & REPORT_TO_LOG) if (report & REPORT_TO_LOG)
sql_print_error(ER(ER_OUTOFMEMORY), sizeof(struct st_plugin_dl)); sql_print_error(ER_DEFAULT(ER_OUTOFMEMORY), sizeof(struct st_plugin_dl));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
DBUG_RETURN(tmp); DBUG_RETURN(tmp);
@ -523,7 +525,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
if (report & REPORT_TO_USER) if (report & REPORT_TO_USER)
my_error(ER_FEATURE_DISABLED, MYF(0), "plugin", "HAVE_DLOPEN"); my_error(ER_FEATURE_DISABLED, MYF(0), "plugin", "HAVE_DLOPEN");
if (report & REPORT_TO_LOG) if (report & REPORT_TO_LOG)
sql_print_error(ER(ER_FEATURE_DISABLED), "plugin", "HAVE_DLOPEN"); sql_print_error(ER_DEFAULT(ER_FEATURE_DISABLED), "plugin", "HAVE_DLOPEN");
DBUG_RETURN(0); DBUG_RETURN(0);
#endif #endif
} }
@ -725,7 +727,7 @@ static bool plugin_add(MEM_ROOT *tmp_root,
if (report & REPORT_TO_USER) if (report & REPORT_TO_USER)
my_error(ER_UDF_EXISTS, MYF(0), name->str); my_error(ER_UDF_EXISTS, MYF(0), name->str);
if (report & REPORT_TO_LOG) if (report & REPORT_TO_LOG)
sql_print_error(ER(ER_UDF_EXISTS), name->str); sql_print_error(ER_DEFAULT(ER_UDF_EXISTS), name->str);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
/* Clear the whole struct to catch future extensions. */ /* Clear the whole struct to catch future extensions. */
@ -755,7 +757,7 @@ static bool plugin_add(MEM_ROOT *tmp_root,
if (report & REPORT_TO_USER) if (report & REPORT_TO_USER)
my_error(ER_CANT_OPEN_LIBRARY, MYF(0), dl->str, 0, buf); my_error(ER_CANT_OPEN_LIBRARY, MYF(0), dl->str, 0, buf);
if (report & REPORT_TO_LOG) if (report & REPORT_TO_LOG)
sql_print_error(ER(ER_CANT_OPEN_LIBRARY), dl->str, 0, buf); sql_print_error(ER_DEFAULT(ER_CANT_OPEN_LIBRARY), dl->str, 0, buf);
goto err; goto err;
} }
tmp.plugin= plugin; tmp.plugin= plugin;
@ -787,7 +789,7 @@ static bool plugin_add(MEM_ROOT *tmp_root,
if (report & REPORT_TO_USER) if (report & REPORT_TO_USER)
my_error(ER_CANT_FIND_DL_ENTRY, MYF(0), name->str); my_error(ER_CANT_FIND_DL_ENTRY, MYF(0), name->str);
if (report & REPORT_TO_LOG) if (report & REPORT_TO_LOG)
sql_print_error(ER(ER_CANT_FIND_DL_ENTRY), name->str); sql_print_error(ER_DEFAULT(ER_CANT_FIND_DL_ENTRY), name->str);
err: err:
plugin_dl_del(dl); plugin_dl_del(dl);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);

View File

@ -4010,7 +4010,9 @@ int fill_schema_charsets(THD *thd, TABLE_LIST *tables, COND *cond)
TABLE *table= tables->table; TABLE *table= tables->table;
CHARSET_INFO *scs= system_charset_info; CHARSET_INFO *scs= system_charset_info;
for (cs= all_charsets ; cs < all_charsets+255 ; cs++) for (cs= all_charsets ;
cs < all_charsets + array_elements(all_charsets) ;
cs++)
{ {
CHARSET_INFO *tmp_cs= cs[0]; CHARSET_INFO *tmp_cs= cs[0];
if (tmp_cs && (tmp_cs->state & MY_CS_PRIMARY) && if (tmp_cs && (tmp_cs->state & MY_CS_PRIMARY) &&
@ -4115,7 +4117,9 @@ int fill_schema_collation(THD *thd, TABLE_LIST *tables, COND *cond)
const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : NullS; const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : NullS;
TABLE *table= tables->table; TABLE *table= tables->table;
CHARSET_INFO *scs= system_charset_info; CHARSET_INFO *scs= system_charset_info;
for (cs= all_charsets ; cs < all_charsets+255 ; cs++ ) for (cs= all_charsets ;
cs < all_charsets + array_elements(all_charsets) ;
cs++ )
{ {
CHARSET_INFO **cl; CHARSET_INFO **cl;
CHARSET_INFO *tmp_cs= cs[0]; CHARSET_INFO *tmp_cs= cs[0];
@ -4123,7 +4127,9 @@ int fill_schema_collation(THD *thd, TABLE_LIST *tables, COND *cond)
(tmp_cs->state & MY_CS_HIDDEN) || (tmp_cs->state & MY_CS_HIDDEN) ||
!(tmp_cs->state & MY_CS_PRIMARY)) !(tmp_cs->state & MY_CS_PRIMARY))
continue; continue;
for (cl= all_charsets; cl < all_charsets+255 ;cl ++) for (cl= all_charsets;
cl < all_charsets + array_elements(all_charsets) ;
cl ++)
{ {
CHARSET_INFO *tmp_cl= cl[0]; CHARSET_INFO *tmp_cl= cl[0];
if (!tmp_cl || !(tmp_cl->state & MY_CS_AVAILABLE) || if (!tmp_cl || !(tmp_cl->state & MY_CS_AVAILABLE) ||
@ -4156,17 +4162,22 @@ int fill_schema_coll_charset_app(THD *thd, TABLE_LIST *tables, COND *cond)
CHARSET_INFO **cs; CHARSET_INFO **cs;
TABLE *table= tables->table; TABLE *table= tables->table;
CHARSET_INFO *scs= system_charset_info; CHARSET_INFO *scs= system_charset_info;
for (cs= all_charsets ; cs < all_charsets+255 ; cs++ ) for (cs= all_charsets ;
cs < all_charsets + array_elements(all_charsets) ;
cs++ )
{ {
CHARSET_INFO **cl; CHARSET_INFO **cl;
CHARSET_INFO *tmp_cs= cs[0]; CHARSET_INFO *tmp_cs= cs[0];
if (!tmp_cs || !(tmp_cs->state & MY_CS_AVAILABLE) || if (!tmp_cs || !(tmp_cs->state & MY_CS_AVAILABLE) ||
!(tmp_cs->state & MY_CS_PRIMARY)) !(tmp_cs->state & MY_CS_PRIMARY))
continue; continue;
for (cl= all_charsets; cl < all_charsets+255 ;cl ++) for (cl= all_charsets;
cl < all_charsets + array_elements(all_charsets) ;
cl ++)
{ {
CHARSET_INFO *tmp_cl= cl[0]; CHARSET_INFO *tmp_cl= cl[0];
if (!tmp_cl || !(tmp_cl->state & MY_CS_AVAILABLE) || if (!tmp_cl || !(tmp_cl->state & MY_CS_AVAILABLE) ||
(tmp_cl->state & MY_CS_HIDDEN) ||
!my_charset_same(tmp_cs,tmp_cl)) !my_charset_same(tmp_cs,tmp_cl))
continue; continue;
restore_record(table, s->default_values); restore_record(table, s->default_values);

View File

@ -2269,17 +2269,19 @@ bool check_duplicates_in_interval(const char *set_or_name,
tmp.count--; tmp.count--;
if (find_type2(&tmp, (const char*)*cur_value, *cur_length, cs)) if (find_type2(&tmp, (const char*)*cur_value, *cur_length, cs))
{ {
THD *thd= current_thd;
ErrConvString err(*cur_value, *cur_length, cs);
if ((current_thd->variables.sql_mode & if ((current_thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))) (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)))
{ {
my_error(ER_DUPLICATED_VALUE_IN_TYPE, MYF(0), my_error(ER_DUPLICATED_VALUE_IN_TYPE, MYF(0),
name,*cur_value,set_or_name); name, err.ptr(), set_or_name);
return 1; return 1;
} }
push_warning_printf(current_thd,MYSQL_ERROR::WARN_LEVEL_NOTE, push_warning_printf(thd,MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_DUPLICATED_VALUE_IN_TYPE, ER_DUPLICATED_VALUE_IN_TYPE,
ER(ER_DUPLICATED_VALUE_IN_TYPE), ER(ER_DUPLICATED_VALUE_IN_TYPE),
name,*cur_value,set_or_name); name, err.ptr(), set_or_name);
(*dup_val_count)++; (*dup_val_count)++;
} }
} }
@ -2665,7 +2667,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
interval->type_lengths[i], interval->type_lengths[i],
comma_buf, comma_length, NULL, 0)) comma_buf, comma_length, NULL, 0))
{ {
my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "set", tmp->ptr()); ErrConvString err(tmp->ptr(), tmp->length(), cs);
my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "set", err.ptr());
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
} }

View File

@ -132,10 +132,13 @@ void my_parse_error(const char *s)
Lex_input_stream *lip= & thd->m_parser_state->m_lip; Lex_input_stream *lip= & thd->m_parser_state->m_lip;
const char *yytext= lip->get_tok_start(); const char *yytext= lip->get_tok_start();
if (!yytext)
yytext= "";
/* Push an error into the error stack */ /* Push an error into the error stack */
ErrConvString err(yytext, thd->variables.character_set_client);
my_printf_error(ER_PARSE_ERROR, ER(ER_PARSE_ERROR), MYF(0), s, my_printf_error(ER_PARSE_ERROR, ER(ER_PARSE_ERROR), MYF(0), s,
(yytext ? yytext : ""), err.ptr(), lip->yylineno);
lip->yylineno);
} }
/** /**
@ -508,6 +511,7 @@ Item* handle_sql2003_note184_exception(THD *thd, Item* left, bool equal,
sp_head *sphead; sp_head *sphead;
struct p_elem_val *p_elem_value; struct p_elem_val *p_elem_value;
enum index_hint_type index_hint; enum index_hint_type index_hint;
enum enum_filetype filetype;
Diag_condition_item_name diag_condition_item_name; Diag_condition_item_name diag_condition_item_name;
} }
@ -1116,6 +1120,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token WRITE_SYM /* SQL-2003-N */ %token WRITE_SYM /* SQL-2003-N */
%token X509_SYM %token X509_SYM
%token XA_SYM %token XA_SYM
%token XML_SYM
%token XOR %token XOR
%token YEAR_MONTH_SYM %token YEAR_MONTH_SYM
%token YEAR_SYM /* SQL-2003-R */ %token YEAR_SYM /* SQL-2003-R */
@ -1309,7 +1314,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
prepare prepare_src execute deallocate prepare prepare_src execute deallocate
statement sp_suid statement sp_suid
sp_c_chistics sp_a_chistics sp_chistic sp_c_chistic xa sp_c_chistics sp_a_chistics sp_chistic sp_c_chistic xa
load_data opt_field_or_var_spec fields_or_vars opt_load_data_set_spec opt_field_or_var_spec fields_or_vars opt_load_data_set_spec
view_replace_or_algorithm view_replace view_replace_or_algorithm view_replace
view_algorithm view_or_trigger_or_sp_or_event view_algorithm view_or_trigger_or_sp_or_event
definer_tail no_definer_tail definer_tail no_definer_tail
@ -1338,6 +1343,7 @@ END_OF_INPUT
%type <spname> sp_name %type <spname> sp_name
%type <index_hint> index_hint_type %type <index_hint> index_hint_type
%type <num> index_hint_clause %type <num> index_hint_clause
%type <filetype> data_or_xml
%type <NONE> signal_stmt resignal_stmt %type <NONE> signal_stmt resignal_stmt
%type <diag_condition_item_name> signal_condition_information_item_name %type <diag_condition_item_name> signal_condition_information_item_name
@ -10663,18 +10669,44 @@ use:
/* import, export of files */ /* import, export of files */
load: load:
LOAD DATA_SYM LOAD data_or_xml
{ {
THD *thd= YYTHD; THD *thd= YYTHD;
LEX *lex= thd->lex; LEX *lex= thd->lex;
if (lex->sphead) if (lex->sphead)
{ {
my_error(ER_SP_BADSTATEMENT, MYF(0), "LOAD DATA"); my_error(ER_SP_BADSTATEMENT, MYF(0),
$2 == FILETYPE_CSV ? "LOAD DATA" : "LOAD XML");
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
load_data load_data_lock opt_local INFILE TEXT_STRING_filesystem
{
LEX *lex=Lex;
lex->sql_command= SQLCOM_LOAD;
lex->lock_option= $4;
lex->local_file= $5;
lex->duplicates= DUP_ERROR;
lex->ignore= 0;
if (!(lex->exchange= new sql_exchange($7.str, 0, $2)))
MYSQL_YYABORT;
}
opt_duplicate INTO TABLE_SYM table_ident
{
LEX *lex=Lex;
if (!Select->add_table_to_list(YYTHD, $12, NULL, TL_OPTION_UPDATING,
lex->lock_option))
MYSQL_YYABORT;
lex->field_list.empty();
lex->update_list.empty();
lex->value_list.empty();
}
opt_load_data_charset
{ Lex->exchange->cs= $14; }
opt_xml_rows_identified_by
opt_field_term opt_line_term opt_ignore_lines opt_field_or_var_spec
opt_load_data_set_spec
{} {}
| LOAD TABLE_SYM table_ident FROM MASTER_SYM | LOAD TABLE_SYM table_ident FROM MASTER_SYM
{ {
@ -10690,37 +10722,16 @@ load:
if (!Select->add_table_to_list(YYTHD, $3, NULL, TL_OPTION_UPDATING)) if (!Select->add_table_to_list(YYTHD, $3, NULL, TL_OPTION_UPDATING))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
; | LOAD DATA_SYM FROM MASTER_SYM
{
THD *thd= YYTHD;
LEX *lex= thd->lex;
load_data: if (lex->sphead)
load_data_lock opt_local INFILE TEXT_STRING_filesystem {
{ my_error(ER_SP_BADSTATEMENT, MYF(0), "LOAD DATA");
LEX *lex=Lex;
lex->sql_command= SQLCOM_LOAD;
lex->lock_option= $1;
lex->local_file= $2;
lex->duplicates= DUP_ERROR;
lex->ignore= 0;
if (!(lex->exchange= new sql_exchange($4.str, 0)))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
opt_duplicate INTO TABLE_SYM table_ident
{
LEX *lex=Lex;
if (!Select->add_table_to_list(YYTHD, $9, NULL, TL_OPTION_UPDATING,
lex->lock_option))
MYSQL_YYABORT;
lex->field_list.empty();
lex->update_list.empty();
lex->value_list.empty();
}
opt_load_data_charset
{ Lex->exchange->cs= $11; }
opt_field_term opt_line_term opt_ignore_lines opt_field_or_var_spec
opt_load_data_set_spec
{}
| FROM MASTER_SYM
{
Lex->sql_command = SQLCOM_LOAD_MASTER_DATA; Lex->sql_command = SQLCOM_LOAD_MASTER_DATA;
WARN_DEPRECATED(yythd, "6.0", "LOAD DATA FROM MASTER", WARN_DEPRECATED(yythd, "6.0", "LOAD DATA FROM MASTER",
"mysqldump or future " "mysqldump or future "
@ -10728,6 +10739,11 @@ load_data:
} }
; ;
data_or_xml:
DATA_SYM { $$= FILETYPE_CSV; }
| XML_SYM { $$= FILETYPE_XML; }
;
opt_local: opt_local:
/* empty */ { $$=0;} /* empty */ { $$=0;}
| LOCAL_SYM { $$=1;} | LOCAL_SYM { $$=1;}
@ -10814,15 +10830,26 @@ line_term:
} }
; ;
opt_xml_rows_identified_by:
/* empty */ { }
| ROWS_SYM IDENTIFIED_SYM BY text_string
{ Lex->exchange->line_term = $4; };
opt_ignore_lines: opt_ignore_lines:
/* empty */ /* empty */
| IGNORE_SYM NUM LINES | IGNORE_SYM NUM lines_or_rows
{ {
DBUG_ASSERT(Lex->exchange != 0); DBUG_ASSERT(Lex->exchange != 0);
Lex->exchange->skip_lines= atol($2.str); Lex->exchange->skip_lines= atol($2.str);
} }
; ;
lines_or_rows:
LINES { }
| ROWS_SYM { }
;
opt_field_or_var_spec: opt_field_or_var_spec:
/* empty */ {} /* empty */ {}
| '(' fields_or_vars ')' {} | '(' fields_or_vars ')' {}
@ -11451,8 +11478,9 @@ IDENT_sys:
$1.length, &dummy_error); $1.length, &dummy_error);
if (wlen < $1.length) if (wlen < $1.length)
{ {
ErrConvString err($1.str, $1.length, &my_charset_bin);
my_error(ER_INVALID_CHARACTER_STRING, MYF(0), my_error(ER_INVALID_CHARACTER_STRING, MYF(0),
cs->csname, $1.str + wlen); cs->csname, err.ptr());
MYSQL_YYABORT; MYSQL_YYABORT;
} }
$$= $1; $$= $1;
@ -11918,6 +11946,7 @@ keyword_sp:
| WEEK_SYM {} | WEEK_SYM {}
| WORK_SYM {} | WORK_SYM {}
| X509_SYM {} | X509_SYM {}
| XML_SYM {}
| YEAR_SYM {} | YEAR_SYM {}
; ;

View File

@ -725,7 +725,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
{ {
share->avg_row_length= uint4korr(head+34); share->avg_row_length= uint4korr(head+34);
share->row_type= (row_type) head[40]; share->row_type= (row_type) head[40];
share->table_charset= get_charset((uint) head[38],MYF(0)); share->table_charset= get_charset((((uint) head[41]) << 8) +
(uint) head[38],MYF(0));
share->null_field_first= 1; share->null_field_first= 1;
} }
if (!share->table_charset) if (!share->table_charset)
@ -1184,12 +1185,13 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
} }
else else
{ {
if (!strpos[14]) uint csid= strpos[14] + (((uint) strpos[11]) << 8);
if (!csid)
charset= &my_charset_bin; charset= &my_charset_bin;
else if (!(charset=get_charset((uint) strpos[14], MYF(0)))) else if (!(charset= get_charset(csid, MYF(0))))
{ {
error= 5; // Unknown or unavailable charset error= 5; // Unknown or unavailable charset
errarg= (int) strpos[14]; errarg= (int) csid;
goto err; goto err;
} }
} }
@ -2457,8 +2459,7 @@ File create_frm(THD *thd, const char *name, const char *db,
if ((file= my_create(name, CREATE_MODE, create_flags, MYF(0))) >= 0) if ((file= my_create(name, CREATE_MODE, create_flags, MYF(0))) >= 0)
{ {
uint key_length, tmp_key_length; uint key_length, tmp_key_length, tmp, csid;
uint tmp;
bzero((char*) fileinfo,64); bzero((char*) fileinfo,64);
/* header */ /* header */
fileinfo[0]=(uchar) 254; fileinfo[0]=(uchar) 254;
@ -2498,8 +2499,9 @@ File create_frm(THD *thd, const char *name, const char *db,
fileinfo[32]=0; // No filename anymore fileinfo[32]=0; // No filename anymore
fileinfo[33]=5; // Mark for 5.0 frm file fileinfo[33]=5; // Mark for 5.0 frm file
int4store(fileinfo+34,create_info->avg_row_length); int4store(fileinfo+34,create_info->avg_row_length);
fileinfo[38]= (create_info->default_table_charset ? csid= (create_info->default_table_charset ?
create_info->default_table_charset->number : 0); create_info->default_table_charset->number : 0);
fileinfo[38]= (uchar) csid;
/* /*
In future versions, we will store in fileinfo[39] the values of the In future versions, we will store in fileinfo[39] the values of the
TRANSACTIONAL and PAGE_CHECKSUM clauses of CREATE TABLE. TRANSACTIONAL and PAGE_CHECKSUM clauses of CREATE TABLE.
@ -2507,7 +2509,7 @@ File create_frm(THD *thd, const char *name, const char *db,
fileinfo[39]= 0; fileinfo[39]= 0;
fileinfo[40]= (uchar) create_info->row_type; fileinfo[40]= (uchar) create_info->row_type;
/* Next few bytes where for RAID support */ /* Next few bytes where for RAID support */
fileinfo[41]= 0; fileinfo[41]= (uchar) (csid >> 8);
fileinfo[42]= 0; fileinfo[42]= 0;
fileinfo[43]= 0; fileinfo[43]= 0;
fileinfo[44]= 0; fileinfo[44]= 0;

View File

@ -801,20 +801,27 @@ static bool pack_fields(File file, List<Create_field> &create_fields,
recpos= field->offset+1 + (uint) data_offset; recpos= field->offset+1 + (uint) data_offset;
int3store(buff+5,recpos); int3store(buff+5,recpos);
int2store(buff+8,field->pack_flag); int2store(buff+8,field->pack_flag);
int2store(buff+10,field->unireg_check); DBUG_ASSERT(field->unireg_check < 256);
buff[10]= (uchar) field->unireg_check;
buff[12]= (uchar) field->interval_id; buff[12]= (uchar) field->interval_id;
buff[13]= (uchar) field->sql_type; buff[13]= (uchar) field->sql_type;
if (field->sql_type == MYSQL_TYPE_GEOMETRY) if (field->sql_type == MYSQL_TYPE_GEOMETRY)
{ {
buff[11]= 0;
buff[14]= (uchar) field->geom_type; buff[14]= (uchar) field->geom_type;
#ifndef HAVE_SPATIAL #ifndef HAVE_SPATIAL
DBUG_ASSERT(0); // Should newer happen DBUG_ASSERT(0); // Should newer happen
#endif #endif
} }
else if (field->charset) else if (field->charset)
{
buff[11]= (uchar) (field->charset->number >> 8);
buff[14]= (uchar) field->charset->number; buff[14]= (uchar) field->charset->number;
}
else else
buff[14]= 0; // Numerical {
buff[11]= buff[14]= 0; // Numerical
}
int2store(buff+15, field->comment.length); int2store(buff+15, field->comment.length);
comment_length+= field->comment.length; comment_length+= field->comment.length;
set_if_bigger(int_count,field->interval_id); set_if_bigger(int_count,field->interval_id);

View File

@ -39,7 +39,11 @@
#define PLUGINDIR "lib/plugin" #define PLUGINDIR "lib/plugin"
#endif #endif
#define ER(X) errmesg[(X) - ER_ERROR_FIRST] #define CURRENT_THD_ERRMSGS current_thd->variables.lc_messages->errmsgs->errmsgs
#define DEFAULT_ERRMSGS my_default_lc_messages->errmsgs->errmsgs
#define ER(X) CURRENT_THD_ERRMSGS[(X) - ER_ERROR_FIRST]
#define ER_DEFAULT(X) DEFAULT_ERRMSGS[(X) - ER_ERROR_FIRST]
#define ER_SAFE(X) (((X) >= ER_ERROR_FIRST && (X) <= ER_ERROR_LAST) ? ER(X) : "Invalid error code") #define ER_SAFE(X) (((X) >= ER_ERROR_FIRST && (X) <= ER_ERROR_LAST) ? ER(X) : "Invalid error code")

View File

@ -30,8 +30,8 @@ const HA_KEYSEG ft_keysegs[FT_SEGS]={
0, /* Bit pos */ 0, /* Bit pos */
HA_VAR_LENGTH_PART | HA_PACK_KEY, /* flag */ HA_VAR_LENGTH_PART | HA_PACK_KEY, /* flag */
HA_FT_MAXBYTELEN, /* length */ HA_FT_MAXBYTELEN, /* length */
HA_KEYTYPE_VARTEXT2, /* type */
63, /* language (will be overwritten) */ 63, /* language (will be overwritten) */
HA_KEYTYPE_VARTEXT2, /* type */
0, /* null_bit */ 0, /* null_bit */
2, 0, 0 /* bit_start, bit_end, bit_length */ 2, 0, 0 /* bit_start, bit_end, bit_length */
}, },
@ -41,7 +41,7 @@ const HA_KEYSEG ft_keysegs[FT_SEGS]={
be packed in any way, otherwise w_search() won't be able to be packed in any way, otherwise w_search() won't be able to
update key entry 'in vivo' update key entry 'in vivo'
*/ */
0, 0, 0, 0, HA_NO_SORT, HA_FT_WLEN, HA_FT_WTYPE, 63, 0, 0, 0, 0 0, 0, 0, 0, HA_NO_SORT, HA_FT_WLEN, 63, HA_FT_WTYPE, 0, 0, 0, 0
} }
}; };

View File

@ -1130,10 +1130,10 @@ int mi_keyseg_write(File file, const HA_KEYSEG *keyseg)
ulong pos; ulong pos;
*ptr++= keyseg->type; *ptr++= keyseg->type;
*ptr++= keyseg->language; *ptr++= keyseg->language & 0xFF; /* Collation ID, low byte */
*ptr++= keyseg->null_bit; *ptr++= keyseg->null_bit;
*ptr++= keyseg->bit_start; *ptr++= keyseg->bit_start;
*ptr++= keyseg->bit_end; *ptr++= keyseg->language >> 8; /* Collation ID, high byte */
*ptr++= keyseg->bit_length; *ptr++= keyseg->bit_length;
mi_int2store(ptr,keyseg->flag); ptr+=2; mi_int2store(ptr,keyseg->flag); ptr+=2;
mi_int2store(ptr,keyseg->length); ptr+=2; mi_int2store(ptr,keyseg->length); ptr+=2;
@ -1152,12 +1152,13 @@ uchar *mi_keyseg_read(uchar *ptr, HA_KEYSEG *keyseg)
keyseg->language = *ptr++; keyseg->language = *ptr++;
keyseg->null_bit = *ptr++; keyseg->null_bit = *ptr++;
keyseg->bit_start = *ptr++; keyseg->bit_start = *ptr++;
keyseg->bit_end = *ptr++; keyseg->language += ((uint16) (*ptr++)) << 8;
keyseg->bit_length = *ptr++; keyseg->bit_length = *ptr++;
keyseg->flag = mi_uint2korr(ptr); ptr +=2; keyseg->flag = mi_uint2korr(ptr); ptr +=2;
keyseg->length = mi_uint2korr(ptr); ptr +=2; keyseg->length = mi_uint2korr(ptr); ptr +=2;
keyseg->start = mi_uint4korr(ptr); ptr +=4; keyseg->start = mi_uint4korr(ptr); ptr +=4;
keyseg->null_pos = mi_uint4korr(ptr); ptr +=4; keyseg->null_pos = mi_uint4korr(ptr); ptr +=4;
keyseg->bit_end= 0;
keyseg->charset=0; /* Will be filled in later */ keyseg->charset=0; /* Will be filled in later */
if (keyseg->null_bit) if (keyseg->null_bit)
/* We adjust bit_pos if null_bit is last in the byte */ /* We adjust bit_pos if null_bit is last in the byte */

View File

@ -23,7 +23,7 @@
#define ROW16_LEN 8 #define ROW16_LEN 8
#define MAX_BUF 64*1024 #define MAX_BUF 64*1024
static CHARSET_INFO all_charsets[256]; static CHARSET_INFO all_charsets[512];
void void
@ -63,7 +63,9 @@ print_array16(FILE *f, const char *set, const char *name, uint16 *a, int n)
static int get_charset_number(const char *charset_name) static int get_charset_number(const char *charset_name)
{ {
CHARSET_INFO *cs; CHARSET_INFO *cs;
for (cs= all_charsets; cs < all_charsets+255; ++cs) for (cs= all_charsets;
cs < all_charsets + array_elements(all_charsets);
cs++)
{ {
if ( cs->name && !strcmp(cs->name, charset_name)) if ( cs->name && !strcmp(cs->name, charset_name))
return cs->number; return cs->number;
@ -288,7 +290,9 @@ main(int argc, char **argv __attribute__((unused)))
sprintf(filename,"%s/%s",argv[1],"Index.xml"); sprintf(filename,"%s/%s",argv[1],"Index.xml");
my_read_charset_file(filename); my_read_charset_file(filename);
for (cs=all_charsets; cs < all_charsets+256; cs++) for (cs= all_charsets;
cs < all_charsets + array_elements(all_charsets);
cs++)
{ {
if (cs->number && !(cs->state & MY_CS_COMPILED)) if (cs->number && !(cs->state & MY_CS_COMPILED))
{ {
@ -313,7 +317,9 @@ main(int argc, char **argv __attribute__((unused)))
fprintf(f,"#include <m_ctype.h>\n\n"); fprintf(f,"#include <m_ctype.h>\n\n");
for (cs=all_charsets; cs < all_charsets+256; cs++) for (cs= all_charsets;
cs < all_charsets + array_elements(all_charsets);
cs++)
{ {
if (simple_cs_is_full(cs)) if (simple_cs_is_full(cs))
{ {
@ -330,7 +336,9 @@ main(int argc, char **argv __attribute__((unused)))
} }
fprintf(f,"CHARSET_INFO compiled_charsets[] = {\n"); fprintf(f,"CHARSET_INFO compiled_charsets[] = {\n");
for (cs=all_charsets; cs < all_charsets+256; cs++) for (cs= all_charsets;
cs < all_charsets + array_elements(all_charsets);
cs++)
{ {
if (simple_cs_is_full(cs)) if (simple_cs_is_full(cs))
{ {

View File

@ -18,61 +18,519 @@
#include <stdarg.h> #include <stdarg.h>
#include <m_ctype.h> #include <m_ctype.h>
/*
Limited snprintf() implementations
SYNOPSIS #define MAX_ARGS 32 /* max positional args count*/
my_vsnprintf() #define MAX_PRINT_INFO 32 /* max print position count */
to Store result here
n Store up to n-1 characters, followed by an end 0
fmt printf format
ap Arguments
IMPLEMENTION: #define LENGTH_ARG 1
Supports following formats: #define WIDTH_ARG 2
%#[l]d #define PREZERO_ARG 4
%#[l]u #define ESCAPED_ARG 8
%#[l]x
%#.#b Local format; note first # is ignored and second is REQUIRED typedef struct pos_arg_info ARGS_INFO;
%#.#s Note first # is ignored typedef struct print_info PRINT_INFO;
struct pos_arg_info
{
char arg_type; /* argument type */
uint have_longlong; /* used from integer values */
char *str_arg; /* string value of the arg */
longlong longlong_arg; /* integer value of the arg */
double double_arg; /* double value of the arg */
};
struct print_info
{
char arg_type; /* argument type */
size_t arg_idx; /* index of the positional arg */
size_t length; /* print width or arg index */
size_t width; /* print width or arg index */
uint flags;
const char *begin; /**/
const char *end; /**/
};
/**
Calculates print length or index of positional argument
@param fmt processed string
@param length print length or index of positional argument
@param pre_zero returns flags with PREZERO_ARG set if necessary
@retval
string position right after length digits
*/
static const char *get_length(const char *fmt, size_t *length, uint *pre_zero)
{
for (; my_isdigit(&my_charset_latin1, *fmt); fmt++)
{
*length= *length * 10 + (uint)(*fmt - '0');
if (!*length)
*pre_zero|= PREZERO_ARG; /* first digit was 0 */
}
return fmt;
}
/**
Calculates print width or index of positional argument
@param fmt processed string
@param width print width or index of positional argument
@retval
string position right after width digits
*/
static const char *get_width(const char *fmt, size_t *width)
{
for (; my_isdigit(&my_charset_latin1, *fmt); fmt++)
{
*width= *width * 10 + (uint)(*fmt - '0');
}
return fmt;
}
/**
Calculates print width or index of positional argument
@param fmt processed string
@param have_longlong TRUE if longlong is required
@retval
string position right after modifier symbol
*/
static const char *check_longlong(const char *fmt, uint *have_longlong)
{
*have_longlong= 0;
if (*fmt == 'l')
{
fmt++;
if (*fmt != 'l')
*have_longlong= (sizeof(long) == sizeof(longlong));
else
{
fmt++;
*have_longlong= 1;
}
}
else if (*fmt == 'z')
{
fmt++;
*have_longlong= (sizeof(size_t) == sizeof(longlong));
}
return fmt;
}
/**
Returns escaped string
@param cs string charset
@param to buffer where escaped string will be placed
@param end end of buffer
@param par string to escape
@param par_len string length
@param quote_char character for quoting
@retval
position in buffer which points on the end of escaped string
*/
static char *backtick_string(CHARSET_INFO *cs, char *to, char *end,
char *par, size_t par_len, char quote_char)
{
uint char_len;
char *start= to;
char *par_end= par + par_len;
size_t buff_length= (size_t) (end - to);
if (buff_length <= par_len)
goto err;
*start++= quote_char;
for ( ; par < par_end; par+= char_len)
{
uchar c= *(uchar *) par;
if (!(char_len= my_mbcharlen(cs, c)))
char_len= 1;
if (char_len == 1 && c == (uchar) quote_char )
{
if (start + 1 >= end)
goto err;
*start++= quote_char;
}
if (start + char_len >= end)
goto err;
start= strnmov(start, par, char_len);
}
RETURN if (start + 1 >= end)
goto err;
*start++= quote_char;
return start;
err:
*to='\0';
return to;
}
/**
Prints string argument
*/
static char *process_str_arg(CHARSET_INFO *cs, char *to, char *end,
size_t width, char *par, uint print_type)
{
int well_formed_error;
size_t plen, left_len= (size_t) (end - to) + 1;
if (!par)
par = (char*) "(null)";
plen= strnlen(par, width);
if (left_len <= plen)
plen = left_len - 1;
plen= cs->cset->well_formed_len(cs, par, par + plen,
width, &well_formed_error);
if (print_type & ESCAPED_ARG)
to= backtick_string(cs, to, end, par, plen, '`');
else
to= strnmov(to,par,plen);
return to;
}
/**
Prints binary argument
*/
static char *process_bin_arg(char *to, char *end, size_t width, char *par)
{
DBUG_ASSERT(to <= end);
if (to + width + 1 > end)
width= end - to - 1; /* sign doesn't matter */
memmove(to, par, width);
to+= width;
return to;
}
/**
Prints integer argument
*/
static char *process_int_arg(char *to, char *end, size_t length,
longlong par, char arg_type, uint print_type)
{
size_t res_length, to_length;
char *store_start= to, *store_end;
char buff[32];
if ((to_length= (size_t) (end-to)) < 16 || length)
store_start= buff;
if (arg_type == 'd')
store_end= int10_to_str(par, store_start, -10);
else if (arg_type == 'u')
store_end= int10_to_str(par, store_start, 10);
else if (arg_type == 'p')
{
store_start[0]= '0';
store_start[1]= 'x';
store_end= int2str(par, store_start + 2, 16, 0);
}
else
{
DBUG_ASSERT(arg_type == 'X' || arg_type =='x');
store_end= int2str(par, store_start, 16, (arg_type == 'X'));
}
if ((res_length= (size_t) (store_end - store_start)) > to_length)
return to; /* num doesn't fit in output */
/* If %#d syntax was used, we have to pre-zero/pre-space the string */
if (store_start == buff)
{
length= min(length, to_length);
if (res_length < length)
{
size_t diff= (length- res_length);
bfill(to, diff, (print_type & PREZERO_ARG) ? '0' : ' ');
to+= diff;
}
bmove(to, store_start, res_length);
}
to+= res_length;
return to;
}
/**
Procesed positional arguments.
@param cs string charset
@param to buffer where processed string will be place
@param end end of buffer
@param par format string
@param arg_index arg index of the first occurrence of positional arg
@param ap list of parameters
@retval
end of buffer where processed string is placed
*/
static char *process_args(CHARSET_INFO *cs, char *to, char *end,
const char* fmt, size_t arg_index, va_list ap)
{
ARGS_INFO args_arr[MAX_ARGS];
PRINT_INFO print_arr[MAX_PRINT_INFO];
uint idx= 0, arg_count= arg_index;
start:
/* Here we are at the beginning of positional argument, right after $ */
arg_index--;
print_arr[idx].flags= 0;
if (*fmt == '`')
{
print_arr[idx].flags|= ESCAPED_ARG;
fmt++;
}
if (*fmt == '-')
fmt++;
print_arr[idx].length= print_arr[idx].width= 0;
/* Get print length */
if (*fmt == '*')
{
fmt++;
fmt= get_length(fmt, &print_arr[idx].length, &print_arr[idx].flags);
print_arr[idx].length--;
DBUG_ASSERT(*fmt == '$' && print_arr[idx].length < MAX_ARGS);
args_arr[print_arr[idx].length].arg_type= 'd';
print_arr[idx].flags|= LENGTH_ARG;
arg_count= max(arg_count, print_arr[idx].length + 1);
fmt++;
}
else
fmt= get_length(fmt, &print_arr[idx].length, &print_arr[idx].flags);
if (*fmt == '.')
{
fmt++;
/* Get print width */
if (*fmt == '*')
{
fmt= get_width(fmt, &print_arr[idx].width);
print_arr[idx].width--;
DBUG_ASSERT(*fmt == '$' && print_arr[idx].width < MAX_ARGS);
args_arr[print_arr[idx].width].arg_type= 'd';
print_arr[idx].flags|= WIDTH_ARG;
arg_count= max(arg_count, print_arr[idx].width + 1);
fmt++;
}
else
fmt= get_width(fmt, &print_arr[idx].width);
}
else
print_arr[idx].width= SIZE_T_MAX;
fmt= check_longlong(fmt, &args_arr[arg_index].have_longlong);
if (*fmt == 'p')
args_arr[arg_index].have_longlong= (sizeof(void *) == sizeof(longlong));
args_arr[arg_index].arg_type= print_arr[idx].arg_type= *fmt;
print_arr[idx].arg_idx= arg_index;
print_arr[idx].begin= ++fmt;
while (*fmt && *fmt != '%')
fmt++;
if (!*fmt) /* End of format string */
{
uint i;
print_arr[idx].end= fmt;
/* Obtain parameters from the list */
for (i= 0 ; i < arg_count; i++)
{
switch (args_arr[i].arg_type) {
case 's':
case 'b':
args_arr[i].str_arg= va_arg(ap, char *);
break;
case 'f':
case 'g':
args_arr[i].double_arg= va_arg(ap, double);
break;
case 'd':
case 'u':
case 'x':
case 'X':
case 'p':
if (args_arr[i].have_longlong)
args_arr[i].longlong_arg= va_arg(ap,longlong);
else if (args_arr[i].arg_type == 'd')
args_arr[i].longlong_arg= va_arg(ap, int);
else
args_arr[i].longlong_arg= va_arg(ap, uint);
break;
case 'c':
args_arr[i].longlong_arg= va_arg(ap, int);
break;
default:
DBUG_ASSERT(0);
}
}
/* Print result string */
for (i= 0; i <= idx; i++)
{
uint width= 0, length= 0;
switch (print_arr[i].arg_type) {
case 's':
{
char *par= args_arr[print_arr[i].arg_idx].str_arg;
width= (print_arr[i].flags & WIDTH_ARG) ?
args_arr[print_arr[i].width].longlong_arg : print_arr[i].width;
to= process_str_arg(cs, to, end, width, par, print_arr[i].flags);
break;
}
case 'b':
{
char *par = args_arr[print_arr[i].arg_idx].str_arg;
width= (print_arr[i].flags & WIDTH_ARG) ?
args_arr[print_arr[i].width].longlong_arg : print_arr[i].width;
to= process_bin_arg(to, end, width, par);
break;
}
case 'c':
{
if (to == end)
break;
*to++= (char) args_arr[print_arr[i].arg_idx].longlong_arg;
break;
}
case 'd':
case 'u':
case 'x':
case 'X':
case 'p':
{
/* Integer parameter */
longlong larg;
length= (print_arr[i].flags & LENGTH_ARG) ?
args_arr[print_arr[i].length].longlong_arg : print_arr[i].length;
if (args_arr[print_arr[i].arg_idx].have_longlong)
larg = args_arr[print_arr[i].arg_idx].longlong_arg;
else if (print_arr[i].arg_type == 'd')
larg = (int) args_arr[print_arr[i].arg_idx].longlong_arg;
else
larg= (uint) args_arr[print_arr[i].arg_idx].longlong_arg;
to= process_int_arg(to, end, length, larg, print_arr[i].arg_type,
print_arr[i].flags);
break;
}
default:
break;
}
if (to == end)
break;
length= min(end - to , print_arr[i].end - print_arr[i].begin);
if (to + length < end)
length++;
to= strnmov(to, print_arr[i].begin, length);
}
DBUG_ASSERT(to <= end);
*to='\0'; /* End of errmessage */
return to;
}
else
{
/* Process next positional argument*/
DBUG_ASSERT(*fmt == '%');
print_arr[idx].end= fmt - 1;
idx++;
fmt++;
arg_index= 0;
fmt= get_width(fmt, &arg_index);
DBUG_ASSERT(*fmt == '$');
fmt++;
arg_count= max(arg_count, arg_index);
goto start;
}
DBUG_ASSERT(0);
return 0;
}
/**
Produces output string according to a format string
@param cs string charset
@param to buffer where processed string will be place
@param n size of buffer
@param par format string
@param ap list of parameters
@retval
length of result string length of result string
*/ */
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n,
const char* fmt, va_list ap)
{ {
char *start=to, *end=to+n-1; char *start=to, *end=to+n-1;
size_t length, width; size_t length, width;
uint pre_zero, have_long; uint print_type, have_longlong;
for (; *fmt ; fmt++) for (; *fmt ; fmt++)
{ {
if (*fmt != '%') if (*fmt != '%')
{ {
if (to == end) /* End of buffer */ if (to == end) /* End of buffer */
break; break;
*to++= *fmt; /* Copy ordinary char */ *to++= *fmt; /* Copy ordinary char */
continue; continue;
} }
fmt++; /* skip '%' */ fmt++; /* skip '%' */
/* Read max fill size (only used with %d and %u) */
if (*fmt == '-')
fmt++;
length= width= 0; length= width= 0;
pre_zero= have_long= 0; print_type= 0;
if (*fmt == '*')
/* Read max fill size (only used with %d and %u) */
if (my_isdigit(&my_charset_latin1, *fmt))
{ {
fmt++; fmt= get_length(fmt, &length, &print_type);
length= va_arg(ap, int); if (*fmt == '$')
{
to= process_args(cs, to, end, (fmt+1), length, ap);
return (size_t) (to - start);
}
} }
else else
for (; my_isdigit(&my_charset_latin1, *fmt); fmt++) {
if (*fmt == '`')
{ {
length= length * 10 + (uint)(*fmt - '0'); print_type|= ESCAPED_ARG;
if (!length) fmt++;
pre_zero= 1; /* first digit was 0 */
} }
if (*fmt == '-')
fmt++;
if (*fmt == '*')
{
fmt++;
length= va_arg(ap, int);
}
else
fmt= get_length(fmt, &length, &print_type);
}
if (*fmt == '.') if (*fmt == '.')
{ {
fmt++; fmt++;
@ -82,75 +540,41 @@ size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
width= va_arg(ap, int); width= va_arg(ap, int);
} }
else else
for (; my_isdigit(&my_charset_latin1, *fmt); fmt++) fmt= get_width(fmt, &width);
width= width * 10 + (uint)(*fmt - '0');
} }
else else
width= ~0; width= SIZE_T_MAX;
if (*fmt == 'l')
{ fmt= check_longlong(fmt, &have_longlong);
fmt++;
have_long= 1;
}
if (*fmt == 's') /* String parameter */ if (*fmt == 's') /* String parameter */
{ {
reg2 char *par = va_arg(ap, char *); reg2 char *par= va_arg(ap, char *);
size_t plen,left_len = (size_t) (end - to) + 1; to= process_str_arg(cs, to, end, width, par, print_type);
if (!par) par = (char*)"(null)";
plen= (uint) strnlen(par, width);
if (left_len <= plen)
plen = left_len - 1;
to=strnmov(to,par,plen);
continue; continue;
} }
else if (*fmt == 'b') /* Buffer parameter */ else if (*fmt == 'b') /* Buffer parameter */
{ {
char *par = va_arg(ap, char *); char *par = va_arg(ap, char *);
DBUG_ASSERT(to <= end); to= process_bin_arg(to, end, width, par);
if (to + abs(width) + 1 > end)
width= (uint) (end - to - 1); /* sign doesn't matter */
memmove(to, par, abs(width));
to+= width;
continue; continue;
} }
else if (*fmt == 'd' || *fmt == 'u'|| *fmt== 'x') /* Integer parameter */ else if (*fmt == 'd' || *fmt == 'u' || *fmt == 'x' || *fmt == 'X' ||
*fmt == 'p')
{ {
register long larg; /* Integer parameter */
size_t res_length, to_length; longlong larg;
char *store_start= to, *store_end; if (*fmt == 'p')
char buff[32]; have_longlong= (sizeof(void *) == sizeof(longlong));
if ((to_length= (size_t) (end-to)) < 16 || length) if (have_longlong)
store_start= buff; larg = va_arg(ap,longlong);
if (have_long) else if (*fmt == 'd')
larg = va_arg(ap, long); larg = va_arg(ap, int);
else else
if (*fmt == 'd') larg= va_arg(ap, uint);
larg = va_arg(ap, int);
else to= process_int_arg(to, end, length, larg, *fmt, print_type);
larg= (long) (uint) va_arg(ap, int);
if (*fmt == 'd')
store_end= int10_to_str(larg, store_start, -10);
else
if (*fmt== 'u')
store_end= int10_to_str(larg, store_start, 10);
else
store_end= int2str(larg, store_start, 16, 0);
if ((res_length= (size_t) (store_end - store_start)) > to_length)
break; /* num doesn't fit in output */
/* If %#d syntax was used, we have to pre-zero/pre-space the string */
if (store_start == buff)
{
length= min(length, to_length);
if (res_length < length)
{
size_t diff= (length- res_length);
bfill(to, diff, pre_zero ? '0' : ' ');
to+= diff;
}
bmove(to, store_start, res_length);
}
to+= res_length;
continue; continue;
} }
else if (*fmt == 'c') /* Character parameter */ else if (*fmt == 'c') /* Character parameter */
@ -174,6 +598,19 @@ size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
} }
/*
Limited snprintf() implementations
exported to plugins as a service, see the detailed documentation
around my_snprintf_service_st
*/
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
{
return my_vsnprintf_ex(&my_charset_latin1, to, n, fmt, ap);
}
size_t my_snprintf(char* to, size_t n, const char* fmt, ...) size_t my_snprintf(char* to, size_t n, const char* fmt, ...)
{ {
size_t result; size_t result;
@ -220,6 +657,18 @@ int main()
my_printf("Hex: %lx '%6lx'\n", 32, 65); my_printf("Hex: %lx '%6lx'\n", 32, 65);
my_printf("conn %ld to: '%-.64s' user: '%-.32s' host:\ my_printf("conn %ld to: '%-.64s' user: '%-.32s' host:\
`%-.64s' (%-.64s)", 1, 0,0,0,0); `%-.64s' (%-.64s)", 1, 0,0,0,0);
my_printf("Hello string %`s\n", "I am a string");
my_printf("Hello %05s\n", "TEST");
my_printf("My %1$`-.1s test\n", "QQQQ");
my_printf("My %1$s test done %2$s\n", "DDDD", "AAAA");
my_printf("My %1$s test %2$s, %1$-.3s\n", "DDDD", "CCCC");
my_printf("My %1$`-.4b test\n", "QQQQ");
my_printf("My %1$c test\n", 'X');
my_printf("My `%010d` test1 %4x test2 %4X\n", 10, 10, 10);
my_printf("My `%1$010d` test1 %2$4x test2 %2$4x\n", 10, 10);
my_printf("My %1$*02$d test\n", 10, 5);
my_printf("My %1$`s test %2$s, %1$`-.3s\n", "DDDD", "CCCC");
return 0; return 0;
} }
#endif #endif