From e2da9dba58db3dd0aeccadbf4c862d12f1a2c2d6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 4 Jun 2003 15:12:32 +0500 Subject: [PATCH 01/54] SCRUM simultaneously usable libraries unification of client structures include/mysql.h: Unification of MYSQL structure for client library and embedded library include/mysql_com.h: unification NET structure for client and embedded library BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + include/mysql.h | 14 ++++++++++---- include/mysql_com.h | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 6761a96b06b..c0505dbdd10 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -29,6 +29,7 @@ heikki@rescue. heikki@work.mysql.com hf@bison.(none) hf@bisonxp.(none) +hf@deer.(none) hf@deer.mysql.r18.ru hf@genie.(none) igor@hundin.mysql.fi diff --git a/include/mysql.h b/include/mysql.h index 67dc9ae08c9..65713257f0e 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -127,7 +127,7 @@ typedef struct st_mysql_data { unsigned int fields; MYSQL_ROWS *data; MEM_ROOT alloc; -#ifdef EMBEDDED_LIBRARY +#if !defined(CHECK_EMBEDDED_DIFFERENCES) || defined(EMBEDDED_LIBRARY) MYSQL_ROWS **prev_ptr; #endif } MYSQL_DATA; @@ -162,7 +162,7 @@ struct st_mysql_options { a read that is replication-aware */ my_bool no_master_reads; -#ifdef EMBEDDED_LIBRARY +#if !defined(CHECK_EMBEDDED_DIFFERENCES) || defined(EMBEDDED_LIBRARY) my_bool separate_thread; #endif char *shared_memory_base_name; @@ -174,7 +174,7 @@ enum mysql_option MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE, MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP,MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE, MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME -#ifdef EMBEDDED_LIBRARY +#if !defined(CHECK_EMBEDDED_DIFFERENCES) || defined(EMBEDDED_LIBRARY) , MYSQL_OPT_USE_RESULT #endif }; @@ -200,7 +200,7 @@ enum mysql_rpl_type }; -#ifndef EMBEDDED_LIBRARY +#if !defined(CHECK_EMBEDDED_DIFFERENCES) || !defined(EMBEDDED_LIBRARY) typedef struct st_mysql { @@ -245,6 +245,12 @@ typedef struct st_mysql struct st_mysql* last_used_con; LIST *stmts; /* list of all statements */ +#if !defined(CHECK_EMBEDDED_DIFFERENCES) + struct st_mysql_res *result; + void *thd; + unsigned int last_errno; + char *last_error; +#endif } MYSQL; #else diff --git a/include/mysql_com.h b/include/mysql_com.h index bbfb869927b..1af1ed36af6 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -125,7 +125,7 @@ typedef struct st_vio Vio; #define MAX_BLOB_WIDTH 8192 /* Default width for blob */ typedef struct st_net { -#ifndef EMBEDDED_LIBRARY +#if !defined(CHECK_EMBEDDED_DIFFERENCES) || !defined(EMBEDDED_LIBRARY) Vio* vio; unsigned char *buff,*buff_end,*write_pos,*read_pos; my_socket fd; /* For Perl DBI/dbd */ From ef726bbff367ab6c5aa735655d8ff6c3fdccdb7d Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 17 Jun 2003 21:32:31 +0500 Subject: [PATCH 02/54] SCRUM client capabilities included into libmysqld some API methods became "virtual" lots of duplicated code removed IMHO all the above made library's code way more pleasant to look at, didn't it? BitKeeper/deleted/.del-lib_vio.c~d779731a1e391220: Delete: libmysqld/lib_vio.c BitKeeper/etc/ignore: Added libmysqld/client.c libmysqld/client_settings.h libmysqld/libmysql.c libmysqld/pack.c to the ignore list client/mysqltest.c: we don't need this now include/mysql.h: MYSQL and related structures unified four methods made "virtual" relative wrappers added include/mysql_com.h: todo added include/mysql_embed.h: now we include implementations of Vio structure in libmysqld include/sql_common.h: declarations changed include/violite.h: implementation of Vio included in libmysqld libmysql/client_settings.h: changes to make this working with both client and embedded libmysql/libmysql.c: global variables and my_net_local_init moved to sql-common/pack.c libmysqld/Makefile.am: libmysql.c, client.c, pack.c symlinked and added to sources lib_vio.c removed libmysqld/examples/Makefile.am: now we need CLIENT_LIBS here libmysqld/lib_sql.cc: code duplications removed emb_advanced_command was made from simple_command libmysqld/libmysqld.c: duplicated code removed sql-common/client.c: code trimmed with new model of calling sql-common/pack.c: some code moved here from libmysql.c and protocol.cc sql/client_settings.h: we don't need mysql_use_result for mini_client sql/net_serv.cc: file included in embedded server sql/protocol.cc: code moved to sql-common/pack.c --- .bzrignore | 4 + client/mysqltest.c | 2 +- include/mysql.h | 26 +- include/mysql_com.h | 3 + include/mysql_embed.h | 4 +- include/sql_common.h | 5 +- include/violite.h | 4 +- libmysql/client_settings.h | 8 +- libmysql/libmysql.c | 56 +- libmysqld/Makefile.am | 14 +- libmysqld/examples/Makefile.am | 2 +- libmysqld/lib_sql.cc | 32 +- libmysqld/lib_vio.c | 236 ------ libmysqld/libmysqld.c | 1243 +------------------------------- sql-common/client.c | 68 +- sql-common/pack.c | 34 + sql/client_settings.h | 2 + sql/net_serv.cc | 19 +- sql/protocol.cc | 23 - 19 files changed, 217 insertions(+), 1568 deletions(-) delete mode 100644 libmysqld/lib_vio.c diff --git a/.bzrignore b/.bzrignore index 4e9ce4e41ab..35db3c5d5ba 100644 --- a/.bzrignore +++ b/.bzrignore @@ -622,3 +622,7 @@ vio/test-ssl vio/test-sslclient vio/test-sslserver vio/viotest-ssl +libmysqld/client.c +libmysqld/client_settings.h +libmysqld/libmysql.c +libmysqld/pack.c diff --git a/client/mysqltest.c b/client/mysqltest.c index 517c41c2b18..cc02d27940f 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -319,7 +319,7 @@ static uint out_length; static int eval_result = 0; /* Disable functions that only exist in MySQL 4.0 */ -#if MYSQL_VERSION_ID < 40000 || defined(EMBEDDED_LIBRARY) +#if MYSQL_VERSION_ID < 40000 void mysql_enable_rpl_parse(MYSQL* mysql __attribute__((unused))) {} void mysql_disable_rpl_parse(MYSQL* mysql __attribute__((unused))) {} int mysql_rpl_parse_enabled(MYSQL* mysql __attribute__((unused))) { return 1; } diff --git a/include/mysql.h b/include/mysql.h index 7e472a120b3..255570d3488 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -201,6 +201,7 @@ enum mysql_rpl_type MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN }; +struct st_mysql_methods; #if !defined(CHECK_EMBEDDED_DIFFERENCES) || !defined(EMBEDDED_LIBRARY) @@ -247,11 +248,13 @@ typedef struct st_mysql struct st_mysql* last_used_con; LIST *stmts; /* list of all statements */ + const struct st_mysql_methods *methods; #if !defined(CHECK_EMBEDDED_DIFFERENCES) struct st_mysql_res *result; void *thd; unsigned int last_errno; char *last_error; + char sqlstate[SQLSTATE_LENGTH+1]; /* Used by embedded server */ #endif } MYSQL; @@ -378,12 +381,10 @@ MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host, unsigned int port, const char *unix_socket, unsigned long clientflag); -void STDCALL mysql_close(MYSQL *sock); int STDCALL mysql_select_db(MYSQL *mysql, const char *db); int STDCALL mysql_query(MYSQL *mysql, const char *q); int STDCALL mysql_send_query(MYSQL *mysql, const char *q, unsigned long length); -my_bool STDCALL mysql_read_query_result(MYSQL *mysql); int STDCALL mysql_real_query(MYSQL *mysql, const char *q, unsigned long length); /* perform query on master */ @@ -444,8 +445,6 @@ MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild); MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table, const char *wild); MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql); -MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); -MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql); int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg); void STDCALL mysql_free_result(MYSQL_RES *result); @@ -566,6 +565,25 @@ typedef struct st_mysql_stmt } MYSQL_STMT; +#define mysql_close(sock) (*(sock)->methods->close)(sock) +#define mysql_read_query_result(mysql) (*(mysql)->methods->read_query_result)(mysql) +#define mysql_store_result(mysql) (*(mysql)->methods->store_result)(mysql) +#define mysql_use_result(mysql) (*(mysql)->methods->use_result)(mysql) + +typedef struct st_mysql_methods +{ + void STDCALL (*close)(MYSQL *sock); + my_bool STDCALL (*read_query_result)(MYSQL *mysql); + my_bool STDCALL (*advanced_command)(MYSQL *mysql, + enum enum_server_command command, + const char *header, + ulong header_length, + const char *arg, + ulong arg_length, my_bool skip_check); + MYSQL_RES * STDCALL (*store_result)(MYSQL *mysql); + MYSQL_RES * STDCALL (*use_result)(MYSQL *mysql); +} MYSQL_METHODS; + MYSQL_STMT * STDCALL mysql_prepare(MYSQL * mysql, const char *query, unsigned long length); int STDCALL mysql_execute(MYSQL_STMT * stmt); diff --git a/include/mysql_com.h b/include/mysql_com.h index 0624782c075..057045bd5a0 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -232,6 +232,9 @@ void my_net_local_init(NET *net); void net_end(NET *net); void net_clear(NET *net); my_bool net_realloc(NET *net, unsigned long length); + +/*HFTODO - should remove it + */ #ifndef EMBEDDED_LIBRARY my_bool net_flush(NET *net); #else diff --git a/include/mysql_embed.h b/include/mysql_embed.h index d48b0440660..ba71b2e93ea 100644 --- a/include/mysql_embed.h +++ b/include/mysql_embed.h @@ -19,11 +19,13 @@ #ifdef EMBEDDED_LIBRARY /* Things we don't need in the embedded version of MySQL */ +/*HFTODO +#undef HAVE_VIO - if we don't want client in embedded library +*/ #undef HAVE_PSTACK /* No stacktrace */ #undef HAVE_DLOPEN /* No udf functions */ #undef HAVE_OPENSSL -#undef HAVE_VIO #undef HAVE_ISAM #undef HAVE_SMEM /* No shared memory */ diff --git a/include/sql_common.h b/include/sql_common.h index 65283486fb4..11f432fb478 100644 --- a/include/sql_common.h +++ b/include/sql_common.h @@ -27,9 +27,6 @@ my_ulonglong net_field_length_ll(uchar **packet); MYSQL_FIELD *unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, my_bool default_value, uint server_capabilities); -my_bool advanced_command(MYSQL *mysql, enum enum_server_command command, - const char *header, ulong header_length, - const char *arg, ulong arg_length, my_bool skip_check); void free_rows(MYSQL_DATA *cur); MYSQL_DATA *read_rows (MYSQL *mysql,MYSQL_FIELD *fields, uint field_count); @@ -38,6 +35,8 @@ void fetch_lengths(ulong *to, MYSQL_ROW column, uint field_count); void free_old_query(MYSQL *mysql); void end_server(MYSQL *mysql); my_bool mysql_reconnect(MYSQL *mysql); +void mysql_read_default_options(struct st_mysql_options *options, + const char *filename,const char *group); #ifdef __cplusplus } #endif diff --git a/include/violite.h b/include/violite.h index 3b61fbf344e..eeb2cbd7185 100644 --- a/include/violite.h +++ b/include/violite.h @@ -220,7 +220,8 @@ enum SSL_type }; -#ifndef EMBEDDED_LIBRARY +/* HFTODO - hide this if we don't want client in embedded server + */ /* This structure is for every connection on both sides */ struct st_vio { @@ -263,5 +264,4 @@ struct st_vio #endif /* HAVE_SMEM */ #endif /* HAVE_VIO */ }; -#endif /* EMBEDDED_LIBRARY */ #endif /* vio_violite_h_ */ diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h index 47d5185b6ca..52606fe5316 100644 --- a/libmysql/client_settings.h +++ b/libmysql/client_settings.h @@ -15,7 +15,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -static my_bool mysql_client_init=0; extern uint mysql_port; extern my_string mysql_unix_port; @@ -35,7 +34,7 @@ char *shared_memory_base_name=0; const char *def_shared_memory_base_name=default_shared_memory_base_name; #endif -static my_bool org_my_init_done=0; +extern my_bool org_my_init_done; sig_handler pipe_sig_handler(int sig __attribute__((unused))); my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list); @@ -56,3 +55,8 @@ my_bool send_file_to_server(MYSQL *mysql, const char *filename); #define set_sigpipe(mysql) #define reset_sigpipe(mysql) #endif + +#define CLI_MYSQL_USE_RESULT cli_mysql_use_result + +MYSQL_RES * STDCALL cli_mysql_use_result(MYSQL *mysql); + diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 7e379ab63ba..4f19b7492e7 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -58,13 +58,20 @@ #endif #include +#include "client_settings.h" + +#ifdef EMBEDDED_LIBRARY +#ifdef net_flush +#undef net_flush +#endif + +my_bool net_flush(NET *net); + +#endif + uint mysql_port=0; my_string mysql_unix_port=0; -ulong net_buffer_length=8192; -ulong max_allowed_packet= 1024L*1024L*1024L; -ulong net_read_timeout= NET_READ_TIMEOUT; -ulong net_write_timeout= NET_WRITE_TIMEOUT; #define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG \ | CLIENT_LOCAL_FILES | CLIENT_TRANSACTIONS \ @@ -101,8 +108,9 @@ sig_handler pipe_sig_handler(int sig); static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to, const char *from, ulong length); my_bool stmt_close(MYSQL_STMT *stmt, my_bool skip_list); -static my_bool org_my_init_done=0; +my_bool org_my_init_done=0; +#ifndef EMBEDDED_LIBRARY int STDCALL mysql_server_init(int argc __attribute__((unused)), char **argv __attribute__((unused)), char **groups __attribute__((unused))) @@ -119,6 +127,7 @@ void STDCALL mysql_server_end() else mysql_thread_end(); } +#endif /*EMBEDDED_LIBRARY*/ my_bool STDCALL mysql_thread_init() { @@ -140,17 +149,6 @@ void STDCALL mysql_thread_end() Let the user specify that we don't want SIGPIPE; This doesn't however work with threaded applications as we can have multiple read in progress. */ - -#if !defined(__WIN__) && defined(SIGPIPE) && !defined(THREAD) -#define init_sigpipe_variables sig_return old_signal_handler=(sig_return) 0 -#define set_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) old_signal_handler=signal(SIGPIPE,pipe_sig_handler) -#define reset_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) signal(SIGPIPE,old_signal_handler); -#else -#define init_sigpipe_variables -#define set_sigpipe(mysql) -#define reset_sigpipe(mysql) -#endif - static MYSQL* spawn_init(MYSQL* parent, const char* host, unsigned int port, const char* user, @@ -846,8 +844,7 @@ STDCALL mysql_add_slave(MYSQL* mysql, const char* host, have to wait for the client (and will not wait more than 30 sec/packet). **************************************************************************/ -MYSQL_RES * STDCALL -mysql_use_result(MYSQL *mysql) +MYSQL_RES * STDCALL CLI_MYSQL_USE_RESULT(MYSQL *mysql) { MYSQL_RES *result; DBUG_ENTER("mysql_use_result"); @@ -1253,19 +1250,6 @@ uint STDCALL mysql_thread_safe(void) Some support functions ****************************************************************************/ -/* - Functions called my my_net_init() to set some application specific variables -*/ - -void my_net_local_init(NET *net) -{ - net->max_packet= (uint) net_buffer_length; - net->read_timeout= (uint) net_read_timeout; - net->write_timeout=(uint) net_write_timeout; - net->retry_count= 1; - net->max_packet_size= max(net_buffer_length, max_allowed_packet); -} - /* Add escape characters to a string (blob?) to make it suitable for a insert to should at least have place for length*2+1 chars @@ -1999,8 +1983,9 @@ static my_bool execute(MYSQL_STMT * stmt, char *packet, ulong length) mysql->last_used_con= mysql; int4store(buff, stmt->stmt_id); /* Send stmt id to server */ - if (advanced_command(mysql, COM_EXECUTE, buff, MYSQL_STMT_HEADER, packet, - length, 1) || + if ((*mysql->methods->advanced_command)(mysql, COM_EXECUTE, buff, + MYSQL_STMT_HEADER, packet, + length, 1) || mysql_read_query_result(mysql)) { set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate); @@ -2292,8 +2277,9 @@ mysql_send_long_data(MYSQL_STMT *stmt, uint param_number, Note that we don't get any ok packet from the server in this case This is intentional to save bandwidth. */ - if (advanced_command(mysql, COM_LONG_DATA, extra_data, - MYSQL_LONG_DATA_HEADER, data, length, 1)) + if ((*mysql->methods->advanced_command)(mysql, COM_LONG_DATA, extra_data, + MYSQL_LONG_DATA_HEADER, data, + length, 1)) { set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno, mysql->net.sqlstate); diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index 92fc588eda3..d87bf3c9b52 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -32,7 +32,7 @@ noinst_LIBRARIES = libmysqld_int.a pkglib_LIBRARIES = libmysqld.a SUBDIRS = . examples libmysqld_sources= libmysqld.c lib_sql.cc -libmysqlsources = errmsg.c get_password.c +libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c noinst_HEADERS = embedded_priv.h @@ -57,8 +57,6 @@ sqlsources = derror.cc field.cc field_conv.cc filesort.cc \ unireg.cc uniques.cc stacktrace.c sql_union.cc hash_filo.cc \ spatial.cc gstream.cc sql_help.cc -EXTRA_DIST = lib_vio.c - libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) libmysqld_a_SOURCES= @@ -74,7 +72,8 @@ INC_LIB= $(top_builddir)/regex/libregex.a \ $(top_builddir)/mysys/libmysys.a \ $(top_builddir)/strings/libmystrings.a \ $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/regex/libregex.a + $(top_builddir)/regex/libregex.a \ + $(top_builddir)/vio/libvio.a # # To make it easy for the end user to use the embedded library we @@ -115,11 +114,14 @@ link_sources: for f in $(libmysqlsources); do \ rm -f $(srcdir)/$$f; \ @LN_CP_F@ $(srcdir)/../libmysql/$$f $(srcdir)/$$f; \ - done + done; \ + @LN_CP_F@ $(srcdir)/../libmysql/client_settings.h $(srcdir)/client_settings.h; + clean-local: rm -f `echo $(sqlsources) $(libmysqlsources) | sed "s;\.lo;.c;g"` \ - $(top_srcdir)/linked_libmysqld_sources + $(top_srcdir)/linked_libmysqld_sources; \ + rm -f client_settings.h # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/libmysqld/examples/Makefile.am b/libmysqld/examples/Makefile.am index dbe4437fc8b..c2292a6b48d 100644 --- a/libmysqld/examples/Makefile.am +++ b/libmysqld/examples/Makefile.am @@ -10,7 +10,7 @@ link_sources: DEFS = -DEMBEDDED_LIBRARY INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include -I$(srcdir) \ -I$(top_srcdir) -I$(top_srcdir)/client $(openssl_includes) -LIBS = @LIBS@ @WRAPLIBS@ +LIBS = @LIBS@ @WRAPLIBS@ @CLIENT_LIBS@ LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @innodb_system_libs@ @bdb_libs_with_path@ @LIBDL@ $(CXXLDFLAGS) mysqltest_SOURCES = mysqltest.c diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index ecb2cb88a0d..6ba87d31268 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -47,9 +47,10 @@ static bool check_user(THD *thd, enum_server_command command, char * get_mysql_home(){ return mysql_home;}; char * get_mysql_real_data_home(){ return mysql_real_data_home;}; -my_bool simple_command(MYSQL *mysql,enum enum_server_command command, - const char *arg, - ulong length, my_bool skipp_check) +my_bool +emb_advanced_command(MYSQL *mysql, enum enum_server_command command, + const char *header, ulong header_length, + const char *arg, ulong arg_length, my_bool skip_check) { my_bool result= 1; THD *thd=(THD *) mysql->thd; @@ -67,9 +68,9 @@ my_bool simple_command(MYSQL *mysql,enum enum_server_command command, mysql->affected_rows= ~(my_ulonglong) 0; thd->store_globals(); // Fix if more than one connect - result= dispatch_command(command, thd, (char *) arg, length + 1); + result= dispatch_command(command, thd, (char *) arg, arg_length + 1); - if (!skipp_check) + if (!skip_check) result= thd->net.last_errno ? -1 : 0; mysql->last_error= thd->net.last_error; @@ -144,7 +145,6 @@ char **copy_arguments(int argc, char **argv) extern "C" { -ulong max_allowed_packet, net_buffer_length; char ** copy_arguments_ptr= 0; int STDCALL mysql_server_init(int argc, char **argv, char **groups) @@ -281,21 +281,6 @@ void STDCALL mysql_server_end() my_end(0); } -my_bool STDCALL mysql_thread_init() -{ -#ifdef THREAD - return my_thread_init(); -#else - return 0; -#endif -} - -void STDCALL mysql_thread_end() -{ -#ifdef THREAD - my_thread_end(); -#endif -} } /* extern "C" */ C_MODE_START @@ -454,11 +439,6 @@ send_eof(THD *thd, bool no_flush) { } -uint STDCALL mysql_warning_count(MYSQL *mysql) -{ - return ((THD *)mysql->thd)->total_warn_count; -} - void Protocol_simple::prepare_for_resend() { MYSQL_ROWS *cur; diff --git a/libmysqld/lib_vio.c b/libmysqld/lib_vio.c deleted file mode 100644 index 14c1366e5f9..00000000000 --- a/libmysqld/lib_vio.c +++ /dev/null @@ -1,236 +0,0 @@ -/* Copyright (C) 2000 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* - Note that we can't have assertion on file descriptors; The reason for - this is that during mysql shutdown, another thread can close a file - we are working on. In this case we should just return read errors from - the file descriptior. -*/ -#ifdef DUMMY - -#include -#include "mysql_embed.h" -#include "mysql.h" - -#ifndef HAVE_VIO /* is Vio enabled */ - -#include -#include -#include -#include -#include -#include - -#ifndef __WIN__ -#define HANDLE void * -#endif - -struct st_vio -{ - enum enum_vio_type type; /* Type of connection */ - void *dest_thd; - char *packets, **last_packet; - char *where_in_packet, *end_of_packet; - my_bool reading; - MEM_ROOT root; -}; - - -/* Initialize the communication buffer */ - -Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost) -{ - DBUG_ENTER("vio_new"); - Vio * vio; - - if ((vio= (Vio *) my_malloc(sizeof(*vio),MYF(MY_WME|MY_ZEROFILL)))) - { - init_alloc_root(&vio->root, 8192, 8192); - vio->root.min_malloc = sizeof(char *) + 4; - vio->last_packet = &vio->packets; - vio->type = type; - } - DBUG_RETURN(vio); -} - - -#ifdef __WIN__ - -Vio *vio_new_win32pipe(HANDLE hPipe) -{ - return (NULL); -} - -#endif - -void vio_delete(Vio * vio) -{ - DBUG_ENTER("vio_delete"); - if (vio) - { - if (vio->type != VIO_CLOSED) - vio_close(vio); - free_root(&vio->root, MYF(0)); - my_free((gptr) vio, MYF(0)); - } - DBUG_VOID_RETURN; -} - -void vio_reset(Vio *vio) -{ - DBUG_ENTER("vio_reset"); - free_root(&vio->root, MYF(MY_KEEP_PREALLOC)); - vio->packets = vio->where_in_packet = vio->end_of_packet = 0; - vio->last_packet = &vio->packets; - DBUG_VOID_RETURN; -} - -int vio_errno(Vio *vio __attribute__((unused))) -{ - return socket_errno; /* On Win32 this mapped to WSAGetLastError() */ -} - -int vio_read(Vio * vio, gptr buf, int size) -{ - vio->reading = 1; - if (vio->where_in_packet >= vio->end_of_packet) - { - DBUG_ASSERT(vio->packets); - vio->where_in_packet = vio->packets + sizeof(char *) + 4; - vio->end_of_packet = vio->where_in_packet + - uint4korr(vio->packets + sizeof(char *)); - vio->packets = *(char **)vio->packets; - } - if (vio->where_in_packet + size > vio->end_of_packet) - size = vio->end_of_packet - vio->where_in_packet; - memcpy(buf, vio->where_in_packet, size); - vio->where_in_packet += size; - return (size); -} - -int vio_write(Vio * vio, const gptr buf, int size) -{ - DBUG_ENTER("vio_write"); - char *packet; - if (vio->reading) - { - vio->reading = 0; - vio_reset(vio); - } - if ((packet = alloc_root(&vio->root, sizeof(char*) + 4 + size))) - { - *vio->last_packet = packet; - vio->last_packet = (char **)packet; - *((char **)packet) = 0; /* Set forward link to 0 */ - packet += sizeof(char *); - int4store(packet, size); - memcpy(packet + 4, buf, size); - } - else - size= -1; - DBUG_RETURN(size); -} - -int vio_blocking(Vio * vio, my_bool set_blocking_mode, my_bool *old_mode) -{ - return (0); -} - -my_bool -vio_is_blocking(Vio * vio) -{ - return(0); -} - -int vio_fastsend(Vio * vio) -{ - return(0); -} - -int vio_keepalive(Vio* vio, my_bool set_keep_alive) -{ - return (0); -} - - -my_bool -vio_should_retry(Vio * vio __attribute__((unused))) -{ - int en = socket_errno; - return (en == SOCKET_EAGAIN || en == SOCKET_EINTR || - en == SOCKET_EWOULDBLOCK); -} - - -int vio_close(Vio * vio) -{ - return(0); -} - - -const char *vio_description(Vio * vio) -{ - return "embedded vio"; -} - -enum enum_vio_type vio_type(Vio* vio) -{ - return VIO_CLOSED; -} - -my_socket vio_fd(Vio* vio) -{ - return 0; -} - - -my_bool vio_peer_addr(Vio * vio, char *buf, uint16 *port) -{ - return(0); -} - - -void vio_in_addr(Vio *vio, struct in_addr *in) -{ -} - -my_bool vio_poll_read(Vio *vio,uint timeout) -{ - return 0; -} - -int create_vio(NET *net, int separate_thread) -{ - Vio * v = net->vio; - if (!v) - { - v = vio_new(0, separate_thread ? VIO_CLOSED : VIO_TYPE_TCPIP, 0); - net->vio = v; - } - return !v; -} - -void set_thd(Vio *v, void *thd) -{ - if (v) - { - v -> dest_thd = thd; - } -} -#endif /* HAVE_VIO */ -#endif /* DUMMY */ - diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index a2d69b30c0d..efc3ee353e8 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -46,14 +46,6 @@ #define INADDR_NONE -1 #endif -static my_bool mysql_client_init=0; -uint mysql_port=0; -my_string mysql_unix_port=0; -const char *sql_protocol_names_lib[] = -{ "TCP", "SOCKET", "PIPE", "MEMORY",NullS }; -TYPELIB sql_protocol_typelib = {array_elements(sql_protocol_names_lib)-1,"", - sql_protocol_names_lib}; - #define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_TRANSACTIONS | CLIENT_PROTOCOL_41) #if defined(MSDOS) || defined(__WIN__) @@ -66,35 +58,16 @@ TYPELIB sql_protocol_typelib = {array_elements(sql_protocol_names_lib)-1,"", #define closesocket(A) close(A) #endif -void mysqld_once_init(void); -static void end_server(MYSQL *mysql); -static void append_wild(char *to,char *end,const char *wild); -static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to, - const char *from, ulong length); +void free_old_query(MYSQL *mysql); +my_bool +emb_advanced_command(MYSQL *mysql, enum enum_server_command command, + const char *header, ulong header_length, + const char *arg, ulong arg_length, my_bool skip_check); -#define init_sigpipe_variables -#define set_sigpipe(mysql) -#define reset_sigpipe(mysql) - -static void free_rows(MYSQL_DATA *cur) -{ - if (cur) - { - free_root(&cur->alloc,MYF(0)); - my_free((gptr) cur,MYF(0)); - } -} - -static void free_old_query(MYSQL *mysql) -{ - DBUG_ENTER("free_old_query"); - if (mysql->fields) - free_root(&mysql->field_alloc,MYF(0)); - init_alloc_root(&mysql->field_alloc,8192,0); /* Assume rowlength < 8192 */ - mysql->fields=0; - mysql->field_count=0; /* For API */ - DBUG_VOID_RETURN; -} +/*FROM client.c + */ +void mysql_read_default_options(struct st_mysql_options *options, + const char *filename,const char *group); #ifdef HAVE_GETPWUID struct passwd *getpwuid(uid_t); @@ -109,300 +82,17 @@ static my_bool is_NT(void) } #endif -/* -** Expand wildcard to a sql string -*/ - -static void -append_wild(char *to, char *end, const char *wild) -{ - end-=5; /* Some extra */ - if (wild && wild[0]) - { - to=strmov(to," like '"); - while (*wild && to < end) - { - if (*wild == '\\' || *wild == '\'') - *to++='\\'; - *to++= *wild++; - } - if (*wild) /* Too small buffer */ - *to++='%'; /* Nicer this way */ - to[0]='\''; - to[1]=0; - } -} - - - -/************************************************************************** -** Init debugging if MYSQL_DEBUG environment variable is found -**************************************************************************/ - -void STDCALL -mysql_debug(const char *debug) -{ -#ifndef DBUG_OFF - char *env; - if (_db_on_) - return; /* Already using debugging */ - if (debug) - { - DEBUGGER_ON; - DBUG_PUSH(debug); - } - else if ((env = getenv("MYSQL_DEBUG"))) - { - DEBUGGER_ON; - DBUG_PUSH(env); -#if !defined(_WINVER) && !defined(WINVER) - puts("\n-------------------------------------------------------"); - puts("MYSQL_DEBUG found. libmysql started with the following:"); - puts(env); - puts("-------------------------------------------------------\n"); -#else - { - char buff[80]; - strmov(strmov(buff,"libmysql: "),env); - MessageBox((HWND) 0,"Debugging variable MYSQL_DEBUG used",buff,MB_OK); - } -#endif - } -#endif -} - /************************************************************************** ** Shut down connection **************************************************************************/ -static void -end_server(MYSQL *mysql) +static void end_server(MYSQL *mysql) { DBUG_ENTER("end_server"); free_old_query(mysql); DBUG_VOID_RETURN; } -void STDCALL -mysql_free_result(MYSQL_RES *result) -{ - DBUG_ENTER("mysql_free_result"); - DBUG_PRINT("enter",("mysql_res: %lx",result)); - if (result) - { - free_rows(result->data); - if (result->fields) - free_root(&result->field_alloc,MYF(0)); - if (result->row) - my_free((gptr) result->row,MYF(0)); - my_free((gptr) result,MYF(0)); - } - DBUG_VOID_RETURN; -} - -/**************************************************************************** -** Get options from my.cnf -****************************************************************************/ - -static const char *default_options[]= -{ - "port","socket","compress","password","pipe", "timeout", "user", - "init-command", "host", "database", "debug", "return-found-rows", - "ssl-key" ,"ssl-cert" ,"ssl-ca" ,"ssl-capath", - "character-sets-dir", "default-character-set", "interactive-timeout", - "connect-timeout", "local-infile", "disable-local-infile", - "replication-probe", "enable-reads-from-master", "repl-parse-query", - "ssl-cipher","protocol", "shared_memory_base_name", - NullS -}; - -static TYPELIB option_types={array_elements(default_options)-1, - "options",default_options}; - -static int add_init_command(struct st_mysql_options *options, const char *cmd) -{ - char *tmp; - - if (!options->init_commands) - { - options->init_commands= (DYNAMIC_ARRAY*)my_malloc(sizeof(DYNAMIC_ARRAY), - MYF(MY_WME)); - init_dynamic_array(options->init_commands,sizeof(char*),0,5 CALLER_INFO); - } - - if (!(tmp= my_strdup(cmd,MYF(MY_WME))) || - insert_dynamic(options->init_commands, (gptr)&tmp)) - { - my_free(tmp, MYF(MY_ALLOW_ZERO_PTR)); - return 1; - } - - return 0; -} - -static void mysql_read_default_options(struct st_mysql_options *options, - const char *filename,const char *group) -{ - int argc; - char *argv_buff[1],**argv; - const char *groups[3]; - DBUG_ENTER("mysql_read_default_options"); - DBUG_PRINT("enter",("file: %s group: %s",filename,group ? group :"NULL")); - - argc=1; argv=argv_buff; argv_buff[0]= (char*) "client"; - groups[0]= (char*) "client"; groups[1]= (char*) group; groups[2]=0; - - load_defaults(filename, groups, &argc, &argv); - if (argc != 1) /* If some default option */ - { - char **option=argv; - while (*++option) - { - /* DBUG_PRINT("info",("option: %s",option[0])); */ - if (option[0][0] == '-' && option[0][1] == '-') - { - char *end=strcend(*option,'='); - char *opt_arg=0; - if (*end) - { - opt_arg=end+1; - *end=0; /* Remove '=' */ - } - /* Change all '_' in variable name to '-' */ - for (end= *option ; *(end= strcend(end,'_')) ; ) - *end= '-'; - switch (find_type(*option+2,&option_types,2)) { - case 1: /* port */ - if (opt_arg) - options->port=atoi(opt_arg); - break; - case 2: /* socket */ - if (opt_arg) - { - my_free(options->unix_socket,MYF(MY_ALLOW_ZERO_PTR)); - options->unix_socket=my_strdup(opt_arg,MYF(MY_WME)); - } - break; - case 3: /* compress */ - options->compress=1; - break; - case 4: /* password */ - if (opt_arg) - { - my_free(options->password,MYF(MY_ALLOW_ZERO_PTR)); - options->password=my_strdup(opt_arg,MYF(MY_WME)); - } - break; - case 5: /* pipe */ - options->protocol = MYSQL_PROTOCOL_PIPE; - break; - case 20: /* connect_timeout */ - case 6: /* timeout */ - if (opt_arg) - options->connect_timeout=atoi(opt_arg); - break; - case 7: /* user */ - if (opt_arg) - { - my_free(options->user,MYF(MY_ALLOW_ZERO_PTR)); - options->user=my_strdup(opt_arg,MYF(MY_WME)); - } - break; - case 8: /* init-command */ - add_init_command(options,opt_arg); - break; - case 9: /* host */ - if (opt_arg) - { - my_free(options->host,MYF(MY_ALLOW_ZERO_PTR)); - options->host=my_strdup(opt_arg,MYF(MY_WME)); - } - break; - case 10: /* database */ - if (opt_arg) - { - my_free(options->db,MYF(MY_ALLOW_ZERO_PTR)); - options->db=my_strdup(opt_arg,MYF(MY_WME)); - } - break; - case 11: /* debug */ - mysql_debug(opt_arg ? opt_arg : "d:t:o,/tmp/client.trace"); - break; - case 12: /* return-found-rows */ - options->client_flag|=CLIENT_FOUND_ROWS; - break; - case 13: /* Ignore SSL options */ - case 14: - case 15: - case 16: - case 26: - break; - case 17: /* charset-lib */ - my_free(options->charset_dir,MYF(MY_ALLOW_ZERO_PTR)); - options->charset_dir = my_strdup(opt_arg, MYF(MY_WME)); - break; - case 18: - my_free(options->charset_name,MYF(MY_ALLOW_ZERO_PTR)); - options->charset_name = my_strdup(opt_arg, MYF(MY_WME)); - break; - case 19: /* Interactive-timeout */ - case 21: /* client_local_files */ - case 22: - case 23: /* Replication options */ - case 24: - case 25: - case 27: /* Protocol */ - case 28: /* Shared memory */ - break; - default: - DBUG_PRINT("warning",("unknown option: %s",option[0])); - } - } - } - } - free_defaults(argv); - DBUG_VOID_RETURN; -} - - - -/**************************************************************************** -** Init MySQL structure or allocate one -****************************************************************************/ - -MYSQL * STDCALL -mysql_init(MYSQL *mysql) -{ - mysqld_once_init(); - if (!mysql) - { - if (!(mysql=(MYSQL*) my_malloc(sizeof(*mysql),MYF(MY_WME | MY_ZEROFILL)))) - return 0; - mysql->free_me=1; - } - else - bzero((char*) (mysql),sizeof(*(mysql))); - return mysql; -} - - -void mysqld_once_init() -{ - if (!mysql_client_init) - { - mysql_client_init=1; - - my_init(); /* Will init threads */ - init_client_errs(); - mysql_port = MYSQL_PORT; - mysql_debug(NullS); - } -#ifdef THREAD - else - my_thread_init(); /* Init if new thread */ -#endif -} - /************************************************************************** ** Connect to sql server ** If host == 0 then use localhost @@ -473,6 +163,20 @@ static inline int mysql_init_charset(MYSQL *mysql) ** before calling mysql_real_connect ! */ +static void STDCALL emb_mysql_close(MYSQL *mysql); +static my_bool STDCALL emb_mysql_read_query_result(MYSQL *mysql); +static MYSQL_RES * STDCALL emb_mysql_store_result(MYSQL *mysql); +static MYSQL_RES * STDCALL emb_mysql_use_result(MYSQL *mysql); + +static MYSQL_METHODS embedded_methods= +{ + emb_mysql_close, + emb_mysql_read_query_result, + emb_advanced_command, + emb_mysql_store_result, + emb_mysql_use_result, +}; + MYSQL * STDCALL mysql_real_connect(MYSQL *mysql,const char *host, const char *user, const char *passwd __attribute__((unused)), const char *db, @@ -485,6 +189,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, db ? db : "(Null)", user ? user : "(Null)")); + mysql->methods= &embedded_methods; + /* use default options */ if (mysql->options.my_cnf_file || mysql->options.my_cnf_group) { @@ -538,11 +244,9 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, } DBUG_PRINT("exit",("Mysql handler: %lx",mysql)); - reset_sigpipe(mysql); DBUG_RETURN(mysql); error: - reset_sigpipe(mysql); DBUG_PRINT("error",("message: %u (%s)",mysql->last_errno,mysql->last_error)); { /* Free alloced memory */ @@ -555,67 +259,12 @@ error: DBUG_RETURN(0); } - -/************************************************************************** -** Change user and database -**************************************************************************/ - -my_bool STDCALL mysql_change_user(MYSQL *mysql __attribute__((unused)), const char *user __attribute__((unused)), - const char *passwd __attribute__((unused)), const char *db __attribute__((unused))) -{ -#ifdef DUMMY - char buff[512],*pos=buff; - DBUG_ENTER("mysql_change_user"); - - if (!user) - user=""; - if (!passwd) - passwd=""; - - pos=strmov(pos,user)+1; - pos=scramble(pos, mysql->scramble_buff, passwd, - (my_bool) (mysql->protocol_version == 9)); - pos=strmov(pos+1,db ? db : ""); - if (simple_command(mysql,COM_CHANGE_USER, buff,(ulong) (pos-buff),0)) - DBUG_RETURN(1); - - my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR)); - my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR)); - - mysql->user= my_strdup(user,MYF(MY_WME)); - mysql->passwd=my_strdup(passwd,MYF(MY_WME)); - mysql->db= db ? my_strdup(db,MYF(MY_WME)) : 0; - DBUG_RETURN(0); -#endif - return 0; -} - - -/************************************************************************** -** Set current database -**************************************************************************/ - -int STDCALL -mysql_select_db(MYSQL *mysql, const char *db) -{ - int error; - DBUG_ENTER("mysql_select_db"); - DBUG_PRINT("enter",("db: '%s'",db)); - - if ((error=simple_command(mysql,COM_INIT_DB,db,(ulong) strlen(db),0))) - DBUG_RETURN(error); - DBUG_RETURN(0); -} - - /************************************************************************* ** Send a QUIT to the server and close the connection ** If handle is alloced by mysql connect free it. *************************************************************************/ -void STDCALL -mysql_close(MYSQL *mysql) +static void STDCALL emb_mysql_close(MYSQL *mysql) { DBUG_ENTER("mysql_close"); if (mysql) /* Some simple safety */ @@ -651,20 +300,7 @@ mysql_close(MYSQL *mysql) DBUG_VOID_RETURN; } - -/************************************************************************** -** Do a query. If query returned rows, free old rows. -** Read data by mysql_store_result or by repeat call of mysql_fetch_row -**************************************************************************/ - -int STDCALL -mysql_query(MYSQL *mysql, const char *query) -{ - return mysql_real_query(mysql,query, (ulong) strlen(query)); -} - -my_bool STDCALL -mysql_read_query_result(MYSQL *mysql) +static my_bool STDCALL emb_mysql_read_query_result(MYSQL *mysql) { if (mysql->last_errno) return -1; @@ -679,151 +315,11 @@ mysql_read_query_result(MYSQL *mysql) return 0; } -/**************************************************************************** -* A modified version of connect(). my_connect() allows you to specify -* a timeout value, in seconds, that we should wait until we -* derermine we can't connect to a particular host. If timeout is 0, -* my_connect() will behave exactly like connect(). -* -* Base version coded by Steve Bernacki, Jr. -*****************************************************************************/ - -my_bool my_connect(my_socket s, const struct sockaddr *name, uint namelen, - uint timeout) -{ -#if defined(__WIN__) || defined(OS2) - return connect(s, (struct sockaddr*) name, namelen) != 0; -#else - int flags, res, s_err; - SOCKOPT_OPTLEN_TYPE s_err_size = sizeof(uint); - fd_set sfds; - struct timeval tv; - time_t start_time, now_time; - - /* If they passed us a timeout of zero, we should behave - * exactly like the normal connect() call does. - */ - - if (timeout == 0) - return connect(s, (struct sockaddr*) name, namelen) != 0; - - flags = fcntl(s, F_GETFL, 0); /* Set socket to not block */ -#ifdef O_NONBLOCK - fcntl(s, F_SETFL, flags | O_NONBLOCK); /* and save the flags.. */ -#endif - - res = connect(s, (struct sockaddr*) name, namelen); - s_err = errno; /* Save the error... */ - fcntl(s, F_SETFL, flags); - if ((res != 0) && (s_err != EINPROGRESS)) - { - errno = s_err; /* Restore it */ - return(1); - } - if (res == 0) /* Connected quickly! */ - return(0); - - /* Otherwise, our connection is "in progress." We can use - * the select() call to wait up to a specified period of time - * for the connection to suceed. If select() returns 0 - * (after waiting howevermany seconds), our socket never became - * writable (host is probably unreachable.) Otherwise, if - * select() returns 1, then one of two conditions exist: - * - * 1. An error occured. We use getsockopt() to check for this. - * 2. The connection was set up sucessfully: getsockopt() will - * return 0 as an error. - * - * Thanks goes to Andrew Gierth - * who posted this method of timing out a connect() in - * comp.unix.programmer on August 15th, 1997. - */ - - FD_ZERO(&sfds); - FD_SET(s, &sfds); - /* - * select could be interrupted by a signal, and if it is, - * the timeout should be adjusted and the select restarted - * to work around OSes that don't restart select and - * implementations of select that don't adjust tv upon - * failure to reflect the time remaining - */ - start_time = time(NULL); - for (;;) - { - tv.tv_sec = (long) timeout; - tv.tv_usec = 0; - if ((res = select(s+1, NULL, &sfds, NULL, &tv)) >= 0) - break; - now_time=time(NULL); - timeout-= (uint) (now_time - start_time); - if (errno != EINTR || (int) timeout <= 0) - return 1; - } - - /* select() returned something more interesting than zero, let's - * see if we have any errors. If the next two statements pass, - * we've got an open socket! - */ - - s_err=0; - if (getsockopt(s, SOL_SOCKET, SO_ERROR, (char*) &s_err, &s_err_size) != 0) - return(1); - - if (s_err) - { /* getsockopt could succeed */ - errno = s_err; - return(1); /* but return an error... */ - } - return(0); /* It's all good! */ -#endif -} - -int STDCALL -mysql_send_query(MYSQL* mysql, const char* query, ulong length) -{ - DBUG_ENTER("mysql_send_query"); - - if (mysql->options.separate_thread) - { - return -1; - } - - mysql->result= NULL; - - free_old_query(mysql); /* Free old result */ - - DBUG_RETURN(simple_command(mysql, COM_QUERY, query, length, 1)); -} - -int STDCALL -mysql_real_query(MYSQL *mysql, const char *query, ulong length) -{ - DBUG_ENTER("mysql_real_query"); - DBUG_PRINT("enter",("handle: %lx",mysql)); - DBUG_PRINT("query",("Query = \"%s\"",query)); - - if (mysql->options.separate_thread) - { - return -1; - } - - mysql->result= NULL; - - free_old_query(mysql); /* Free old result */ - - if (simple_command(mysql, COM_QUERY, query, length, 1)) - DBUG_RETURN(-1); - - DBUG_RETURN(mysql_read_query_result(mysql)); -} - /************************************************************************** ** Alloc result struct for buffered results. All rows are read to buffer. ** mysql_data_seek may be used. **************************************************************************/ -MYSQL_RES * STDCALL -mysql_store_result(MYSQL *mysql) +static MYSQL_RES * STDCALL emb_mysql_store_result(MYSQL *mysql) { MYSQL_RES *result= mysql->result; if (!result) @@ -850,688 +346,11 @@ mysql_store_result(MYSQL *mysql) ** have to wait for the client (and will not wait more than 30 sec/packet). **************************************************************************/ -MYSQL_RES * STDCALL -mysql_use_result(MYSQL *mysql) +static MYSQL_RES * STDCALL emb_mysql_use_result(MYSQL *mysql) { DBUG_ENTER("mysql_use_result"); if (mysql->options.separate_thread) DBUG_RETURN(0); - DBUG_RETURN(mysql_store_result(mysql)); -} - -/************************************************************************** -** Return next field of the query results -**************************************************************************/ - -MYSQL_FIELD * STDCALL -mysql_fetch_field(MYSQL_RES *result) -{ - if (result->current_field >= result->field_count) - return(NULL); - return &result->fields[result->current_field++]; -} - - -/************************************************************************** -** Return next row of the query results -**************************************************************************/ - -MYSQL_ROW STDCALL -mysql_fetch_row(MYSQL_RES *res) -{ - DBUG_ENTER("mysql_fetch_row"); - { - MYSQL_ROW tmp; - if (!res->data_cursor) - { - DBUG_PRINT("info",("end of data")); - DBUG_RETURN(res->current_row=(MYSQL_ROW) NULL); - } - tmp = res->data_cursor->data; - res->data_cursor = res->data_cursor->next; - DBUG_RETURN(res->current_row=tmp); - } -} - - -/************************************************************************** -** Get column lengths of the current row -** If one uses mysql_use_result, res->lengths contains the length information, -** else the lengths are calculated from the offset between pointers. -**************************************************************************/ - -ulong * STDCALL -mysql_fetch_lengths(MYSQL_RES *res) -{ - ulong *lengths; - MYSQL_ROW column,end; - - if (!(column=res->current_row)) - return 0; /* Something is wrong */ - if (res->data) - { - lengths=res->lengths; - for (end=column+res->field_count; column != end ; column++,lengths++) - { - *lengths= *column ? strlen(*column) : 0; - } - } - return res->lengths; -} - -/************************************************************************** -** Move to a specific row and column -**************************************************************************/ - -void STDCALL -mysql_data_seek(MYSQL_RES *result, my_ulonglong row) -{ - MYSQL_ROWS *tmp=0; - DBUG_PRINT("info",("mysql_data_seek(%ld)",(long) row)); - if (result->data) - for (tmp=result->data->data; row-- && tmp ; tmp = tmp->next) ; - result->current_row=0; - result->data_cursor = tmp; -} - -/************************************************************************* -** put the row or field cursor one a position one got from mysql_row_tell() -** This doesn't restore any data. The next mysql_fetch_row or -** mysql_fetch_field will return the next row or field after the last used -*************************************************************************/ - -MYSQL_ROW_OFFSET STDCALL -mysql_row_seek(MYSQL_RES *result, MYSQL_ROW_OFFSET row) -{ - MYSQL_ROW_OFFSET return_value=result->data_cursor; - result->current_row= 0; - result->data_cursor= row; - return return_value; -} - - -MYSQL_FIELD_OFFSET STDCALL -mysql_field_seek(MYSQL_RES *result, MYSQL_FIELD_OFFSET field_offset) -{ - MYSQL_FIELD_OFFSET return_value=result->current_field; - result->current_field=field_offset; - return return_value; -} - -/***************************************************************************** -** List all databases -*****************************************************************************/ - -MYSQL_RES * STDCALL -mysql_list_dbs(MYSQL *mysql, const char *wild) -{ - char buff[255]; - DBUG_ENTER("mysql_list_dbs"); - - append_wild(strmov(buff,"show databases"),buff+sizeof(buff),wild); - if (mysql_query(mysql,buff)) - DBUG_RETURN(0); - DBUG_RETURN (mysql_store_result(mysql)); -} - - -/***************************************************************************** -** List all tables in a database -** If wild is given then only the tables matching wild is returned -*****************************************************************************/ - -MYSQL_RES * STDCALL -mysql_list_tables(MYSQL *mysql, const char *wild) -{ - char buff[255]; - DBUG_ENTER("mysql_list_tables"); - - append_wild(strmov(buff,"show tables"),buff+sizeof(buff),wild); - if (mysql_query(mysql,buff)) - DBUG_RETURN(0); - DBUG_RETURN (mysql_store_result(mysql)); -} - - -/************************************************************************** -** List all fields in a table -** If wild is given then only the fields matching wild is returned -** Instead of this use query: -** show fields in 'table' like "wild" -**************************************************************************/ - -MYSQL_RES * STDCALL -mysql_list_fields(MYSQL *mysql __attribute__((unused)), const char *table __attribute__((unused)), const char *wild __attribute__((unused))) -{ -#ifdef DUMMY - MYSQL_RES *result; - MYSQL_DATA *query; - char buff[257],*end; - DBUG_ENTER("mysql_list_fields"); - DBUG_PRINT("enter",("table: '%s' wild: '%s'",table,wild ? wild : "")); - - LINT_INIT(query); - - end=strmake(strmake(buff, table,128)+1,wild ? wild : "",128); - if (simple_command(mysql,COM_FIELD_LIST,buff,(uint) (end-buff),1) || - !(query = read_rows(mysql,(MYSQL_FIELD*) 0,6))) - DBUG_RETURN(NULL); - - free_old_query(mysql); - if (!(result = (MYSQL_RES *) my_malloc(sizeof(MYSQL_RES), - MYF(MY_WME | MY_ZEROFILL)))) - { - free_rows(query); - DBUG_RETURN(NULL); - } - result->field_alloc=mysql->field_alloc; - mysql->fields=0; - result->field_count = (uint) query->rows; - result->fields= unpack_fields(query,&result->field_alloc, - result->field_count,1, - (my_bool) test(mysql->server_capabilities & - CLIENT_LONG_FLAG)); - result->eof=1; - DBUG_RETURN(result); -#endif - return 0; -} - -/* List all running processes (threads) in server */ -MYSQL_RES * STDCALL -mysql_list_processes(MYSQL *mysql) -{ -#ifdef DUMMY - MYSQL_DATA *fields; - uint field_count; - uchar *pos; - DBUG_ENTER("mysql_list_processes"); - - LINT_INIT(fields); - if (simple_command(mysql,COM_PROCESS_INFO,"",0,0)) - DBUG_RETURN(0); - free_old_query(mysql); - pos=(uchar*) mysql->net.read_pos; - field_count=(uint) net_field_length(&pos); - if (!(fields = read_rows(mysql,(MYSQL_FIELD*) 0,5))) - DBUG_RETURN(NULL); - if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc,field_count,0, - (my_bool) test(mysql->server_capabilities & - CLIENT_LONG_FLAG)))) - DBUG_RETURN(0); - mysql->status=MYSQL_STATUS_GET_RESULT; - mysql->field_count=field_count; - DBUG_RETURN(mysql_store_result(mysql)); -#endif /*DUMMY*/ - return 0; -} - - -int STDCALL -mysql_create_db(MYSQL *mysql, const char *db) -{ - DBUG_ENTER("mysql_createdb"); - DBUG_PRINT("enter",("db: %s",db)); - DBUG_RETURN(simple_command(mysql,COM_CREATE_DB,db, (ulong) strlen(db),0)); -} - - -int STDCALL -mysql_drop_db(MYSQL *mysql, const char *db) -{ - DBUG_ENTER("mysql_drop_db"); - DBUG_PRINT("enter",("db: %s",db)); - DBUG_RETURN(simple_command(mysql,COM_DROP_DB,db,(ulong) strlen(db),0)); -} - - -int STDCALL -mysql_shutdown(MYSQL *mysql) -{ - DBUG_ENTER("mysql_shutdown"); - DBUG_RETURN(simple_command(mysql,COM_SHUTDOWN,"",0,0)); -} - - -int STDCALL -mysql_refresh(MYSQL *mysql,uint options) -{ - uchar bits[1]; - DBUG_ENTER("mysql_refresh"); - bits[0]= (uchar) options; - DBUG_RETURN(simple_command(mysql,COM_REFRESH,(char*) bits,1,0)); -} - -int STDCALL -mysql_kill(MYSQL *mysql,ulong pid) -{ - char buff[12]; - DBUG_ENTER("mysql_kill"); - int4store(buff,pid); - DBUG_RETURN(simple_command(mysql,COM_PROCESS_KILL,buff,4,0)); -} - - -int STDCALL -mysql_dump_debug_info(MYSQL *mysql) -{ - DBUG_ENTER("mysql_dump_debug_info"); - DBUG_RETURN(simple_command(mysql,COM_DEBUG,"",0,0)); -} - -const char * STDCALL -mysql_stat(MYSQL *mysql) -{ -#ifdef DUMMY - DBUG_ENTER("mysql_stat"); - if (simple_command(mysql,COM_STATISTICS,"",0,0)) - return mysql->last_error; - mysql->net.read_pos[mysql->packet_length]=0; /* End of stat string */ - if (!mysql->net.read_pos[0]) - { - mysql->net.last_errno=CR_WRONG_HOST_INFO; - strmov(mysql->sqlstate, unknown_sqlstate); - strmov(mysql->net.last_error, ER(mysql->net.last_errno)); - return mysql->net.last_error; - } - DBUG_RETURN((char*) mysql->net.read_pos); -#endif - return (char *)mysql; -} - - -int STDCALL -mysql_ping(MYSQL *mysql) -{ - DBUG_ENTER("mysql_ping"); - DBUG_RETURN(simple_command(mysql,COM_PING,"",0,0)); -} - - -const char * STDCALL -mysql_get_server_info(MYSQL *mysql __attribute__((unused))) -{ - return MYSQL_SERVER_VERSION; -} - - -ulong STDCALL -mysql_get_server_version(MYSQL *mysql __attribute__((unused))) -{ - return MYSQL_VERSION_ID; -} - -const char * STDCALL -mysql_get_host_info(MYSQL *mysql __attribute__((unused))) -{ - return "localhost"; -} - - -uint STDCALL -mysql_get_proto_info(MYSQL *mysql __attribute__((unused))) -{ - return PROTOCOL_VERSION; -} - -const char * STDCALL -mysql_get_client_info(void) -{ - return MYSQL_SERVER_VERSION; -} - - -int STDCALL -mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg) -{ - DBUG_ENTER("mysql_option"); - DBUG_PRINT("enter",("option: %d",(int) option)); - switch (option) { - case MYSQL_OPT_CONNECT_TIMEOUT: - mysql->options.connect_timeout= *(uint*) arg; - break; - case MYSQL_OPT_COMPRESS: - mysql->options.compress=1; /* Remember for connect */ - break; - case MYSQL_OPT_USE_RESULT: - mysql->options.separate_thread=1; /* Use separate thread for query execution*/ - break; - case MYSQL_OPT_NAMED_PIPE: - mysql->options.protocol=MYSQL_PROTOCOL_PIPE; /* Force named pipe */ - break; - case MYSQL_OPT_LOCAL_INFILE: /* Allow LOAD DATA LOCAL ?*/ - if (!arg || test(*(uint*) arg)) - mysql->options.client_flag|= CLIENT_LOCAL_FILES; - else - mysql->options.client_flag&= ~CLIENT_LOCAL_FILES; - break; - case MYSQL_INIT_COMMAND: - add_init_command(&mysql->options,arg); - break; - case MYSQL_READ_DEFAULT_FILE: - my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR)); - mysql->options.my_cnf_file=my_strdup(arg,MYF(MY_WME)); - break; - case MYSQL_READ_DEFAULT_GROUP: - my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR)); - mysql->options.my_cnf_group=my_strdup(arg,MYF(MY_WME)); - break; - case MYSQL_SET_CHARSET_DIR: - my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR)); - mysql->options.charset_dir=my_strdup(arg,MYF(MY_WME)); - break; - case MYSQL_SET_CHARSET_NAME: - my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR)); - mysql->options.charset_name=my_strdup(arg,MYF(MY_WME)); - break; - case MYSQL_OPT_PROTOCOL: - mysql->options.protocol= *(uint*) arg; - break; - case MYSQL_SHARED_MEMORY_BASE_NAME: - break; - default: - DBUG_RETURN(-1); - } - DBUG_RETURN(0); -} - -/**************************************************************************** -** Functions to get information from the MySQL structure -** These are functions to make shared libraries more usable. -****************************************************************************/ - -/* MYSQL_RES */ -my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res) -{ - return res->row_count; -} - -unsigned int STDCALL mysql_num_fields(MYSQL_RES *res) -{ - return res->field_count; -} - -my_bool STDCALL mysql_eof(MYSQL_RES *res) -{ - return res->eof; -} - -MYSQL_FIELD * STDCALL mysql_fetch_field_direct(MYSQL_RES *res,uint fieldnr) -{ - return &(res)->fields[fieldnr]; -} - -MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res) -{ - return (res)->fields; -} - -MYSQL_ROWS * STDCALL mysql_row_tell(MYSQL_RES *res) -{ - return res->data_cursor; -} - -uint STDCALL mysql_field_tell(MYSQL_RES *res) -{ - return (res)->current_field; -} - -/* MYSQL */ - -unsigned int STDCALL mysql_field_count(MYSQL *mysql) -{ - return mysql->field_count; -} - -my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql) -{ - return mysql->affected_rows; -} - -my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql) -{ - return mysql->insert_id; -} - -uint STDCALL mysql_errno(MYSQL *mysql) -{ - return mysql->last_errno; -} - -const char *STDCALL mysql_sqlstate(MYSQL *mysql) -{ - return mysql->sqlstate; -} - -const char * STDCALL mysql_error(MYSQL *mysql) -{ - return mysql->last_error; -} - -const char *STDCALL mysql_info(MYSQL *mysql __attribute__((unused))) -{ -#ifdef DUMMY - return (mysql)->info; -#endif - return 0; -} - -ulong STDCALL mysql_thread_id(MYSQL *mysql __attribute__((unused))) -{ -#ifdef DUMMY - return (mysql)->thread_id; -#endif - return 0; -} - -const char * STDCALL mysql_character_set_name(MYSQL *mysql) -{ - return mysql->charset->name; -} - - -uint STDCALL mysql_thread_safe(void) -{ -#ifdef THREAD - return 1; -#else - return 0; -#endif -} - -MYSQL_RES *STDCALL mysql_warnings(MYSQL *mysql) -{ - uint warning_count; - DBUG_ENTER("mysql_warnings"); - /* Save warning count as mysql_real_query may change this */ - warning_count= mysql_warning_count(mysql); - if (mysql_real_query(mysql, "SHOW WARNINGS", 13)) - DBUG_RETURN(0); - DBUG_RETURN(mysql_store_result(mysql)); -} - -/**************************************************************************** -** Some support functions -****************************************************************************/ - -/* -** Add escape characters to a string (blob?) to make it suitable for a insert -** to should at least have place for length*2+1 chars -** Returns the length of the to string -*/ - -ulong STDCALL -mysql_escape_string(char *to,const char *from,ulong length) -{ - return mysql_sub_escape_string(default_charset_info,to,from,length); -} - -ulong STDCALL -mysql_real_escape_string(MYSQL *mysql, char *to,const char *from, - ulong length) -{ - return mysql_sub_escape_string(mysql->charset,to,from,length); -} - - -static ulong -mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to, - const char *from, ulong length) -{ - const char *to_start=to; - const char *end; -#ifdef USE_MB - my_bool use_mb_flag=use_mb(charset_info); -#endif - for (end=from+length; from != end ; from++) - { -#ifdef USE_MB - int l; - if (use_mb_flag && (l = my_ismbchar(charset_info, from, end))) - { - while (l--) - *to++ = *from++; - from--; - continue; - } -#endif - switch (*from) { - case 0: /* Must be escaped for 'mysql' */ - *to++= '\\'; - *to++= '0'; - break; - case '\n': /* Must be escaped for logs */ - *to++= '\\'; - *to++= 'n'; - break; - case '\r': - *to++= '\\'; - *to++= 'r'; - break; - case '\\': - *to++= '\\'; - *to++= '\\'; - break; - case '\'': - *to++= '\\'; - *to++= '\''; - break; - case '"': /* Better safe than sorry */ - *to++= '\\'; - *to++= '"'; - break; - case '\032': /* This gives problems on Win32 */ - *to++= '\\'; - *to++= 'Z'; - break; - default: - *to++= *from; - } - } - *to=0; - return (ulong) (to-to_start); -} - - -char * STDCALL -mysql_odbc_escape_string(MYSQL *mysql, - char *to, ulong to_length, - const char *from, ulong from_length, - void *param, - char * (*extend_buffer) - (void *, char *, ulong *)) -{ - char *to_end=to+to_length-5; - const char *end; -#ifdef USE_MB - my_bool use_mb_flag=use_mb(mysql->charset); -#endif - - for (end=from+from_length; from != end ; from++) - { - if (to >= to_end) - { - to_length = (ulong) (end-from)+512; /* We want this much more */ - if (!(to=(*extend_buffer)(param, to, &to_length))) - return to; - to_end=to+to_length-5; - } -#ifdef USE_MB - { - int l; - if (use_mb_flag && (l = my_ismbchar(mysql->charset, from, end))) - { - while (l--) - *to++ = *from++; - from--; - continue; - } - } -#endif - switch (*from) { - case 0: /* Must be escaped for 'mysql' */ - *to++= '\\'; - *to++= '0'; - break; - case '\n': /* Must be escaped for logs */ - *to++= '\\'; - *to++= 'n'; - break; - case '\r': - *to++= '\\'; - *to++= 'r'; - break; - case '\\': - *to++= '\\'; - *to++= '\\'; - break; - case '\'': - *to++= '\\'; - *to++= '\''; - break; - case '"': /* Better safe than sorry */ - *to++= '\\'; - *to++= '"'; - break; - case '\032': /* This gives problems on Win32 */ - *to++= '\\'; - *to++= 'Z'; - break; - default: - *to++= *from; - } - } - return to; -} - -void STDCALL -myodbc_remove_escape(MYSQL *mysql,char *name) -{ - char *to; -#ifdef USE_MB - my_bool use_mb_flag=use_mb(mysql->charset); - char *end; - LINT_INIT(end); - if (use_mb_flag) - for (end=name; *end ; end++) ; -#endif - - for (to=name ; *name ; name++) - { -#ifdef USE_MB - int l; - if (use_mb_flag && (l = my_ismbchar( mysql->charset, name , end ) ) ) - { - while (l--) - *to++ = *name++; - name--; - continue; - } -#endif - if (*name == '\\' && name[1]) - name++; - *to++= *name; - } - *to=0; + DBUG_RETURN(emb_mysql_store_result(mysql)); } diff --git a/sql-common/client.c b/sql-common/client.c index 3c025d18bd6..207744a773f 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -40,6 +40,32 @@ #if defined(MYSQL_SERVER) || defined(HAVE_EXTERNAL_CLIENT) #include "mysql.h" + +#ifdef EMBEDDED_LIBRARY + +#ifdef MYSQL_SERVER +#undef MYSQL_SERVER +#endif + +#ifndef MYSQL_CLIENT +#define MYSQL_CLIENT +#endif + +#define CLI_MYSQL_REAL_CONNECT cli_mysql_real_connect + +#ifdef net_flush +#undef net_flush +#endif +my_bool net_flush(NET *net); + +#else /*EMBEDDED_LIBRARY*/ +#define CLI_MYSQL_REAL_CONNECT mysql_real_connect +#endif /*EMBEDDED_LIBRARY*/ + +#ifdef MYSQL_CLIENT +static my_bool mysql_client_init=0; +#endif + #if !defined(MYSQL_SERVER) && defined(__WIN__) || defined(_WIN32) || defined(_WIN64) #include #include @@ -563,8 +589,8 @@ void free_rows(MYSQL_DATA *cur) } } -my_bool -advanced_command(MYSQL *mysql, enum enum_server_command command, +static my_bool +cli_advanced_command(MYSQL *mysql, enum enum_server_command command, const char *header, ulong header_length, const char *arg, ulong arg_length, my_bool skip_check) { @@ -632,7 +658,9 @@ my_bool simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg, ulong length, my_bool skip_check) { - return advanced_command(mysql, command, NullS, 0, arg, length, skip_check); + return + (*mysql->methods->advanced_command)(mysql, command, + NullS, 0, arg, length, skip_check); } void free_old_query(MYSQL *mysql) @@ -747,8 +775,8 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd) return 0; } -static void mysql_read_default_options(struct st_mysql_options *options, - const char *filename,const char *group) +void mysql_read_default_options(struct st_mysql_options *options, + const char *filename,const char *group) { int argc; char *argv_buff[1],**argv; @@ -1428,10 +1456,23 @@ error: before calling mysql_real_connect ! */ -MYSQL * STDCALL -mysql_real_connect(MYSQL *mysql,const char *host, const char *user, - const char *passwd, const char *db, - uint port, const char *unix_socket,ulong client_flag) +static void STDCALL cli_mysql_close(MYSQL *mysql); +static my_bool STDCALL cli_mysql_read_query_result(MYSQL *mysql); +static MYSQL_RES * STDCALL cli_mysql_store_result(MYSQL *mysql); + +static MYSQL_METHODS client_methods= +{ + cli_mysql_close, + cli_mysql_read_query_result, + cli_advanced_command, + cli_mysql_store_result, + CLI_MYSQL_USE_RESULT +}; + +MYSQL * STDCALL +CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, + const char *passwd, const char *db, + uint port, const char *unix_socket,ulong client_flag) { #ifdef MYSQL_CLIENT char *charset_name; @@ -1466,6 +1507,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, user ? user : "(Null)")); /* Don't give sigpipe errors if the client doesn't want them */ + mysql->methods= &client_methods; set_sigpipe(mysql); net->vio = 0; /* If something goes wrong */ mysql->client_flag=0; /* For handshake */ @@ -2176,8 +2218,7 @@ mysql_ssl_free(MYSQL *mysql __attribute__((unused))) If handle is alloced by mysql connect free it. *************************************************************************/ -void STDCALL -mysql_close(MYSQL *mysql) +static void STDCALL cli_mysql_close(MYSQL *mysql) { DBUG_ENTER("mysql_close"); if (mysql) /* Some simple safety */ @@ -2259,7 +2300,7 @@ mysql_close(MYSQL *mysql) DBUG_VOID_RETURN; } -my_bool STDCALL mysql_read_query_result(MYSQL *mysql) +static my_bool STDCALL cli_mysql_read_query_result(MYSQL *mysql) { uchar *pos; ulong field_count; @@ -2378,8 +2419,7 @@ mysql_real_query(MYSQL *mysql, const char *query, ulong length) mysql_data_seek may be used. **************************************************************************/ -MYSQL_RES * STDCALL -mysql_store_result(MYSQL *mysql) +static MYSQL_RES * STDCALL cli_mysql_store_result(MYSQL *mysql) { MYSQL_RES *result; DBUG_ENTER("mysql_store_result"); diff --git a/sql-common/pack.c b/sql-common/pack.c index e363d600e20..16cc13eddbd 100644 --- a/sql-common/pack.c +++ b/sql-common/pack.c @@ -1,7 +1,28 @@ +/* Copyright (C) 2000-2003 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include #include #include +ulong net_buffer_length=8192; +ulong max_allowed_packet= 1024L*1024L*1024L; +ulong net_read_timeout= NET_READ_TIMEOUT; +ulong net_write_timeout= NET_WRITE_TIMEOUT; + /* Get the length of next field. Change parameter to point at fieldstart */ ulong STDCALL net_field_length(uchar **packet) { @@ -62,3 +83,16 @@ my_ulonglong net_field_length_ll(uchar **packet) #endif } +/* + Functions called my my_net_init() to set some application specific variables +*/ + +void my_net_local_init(NET *net) +{ + net->max_packet= (uint) net_buffer_length; + net->read_timeout= (uint) net_read_timeout; + net->write_timeout=(uint) net_write_timeout; + net->retry_count= 1; + net->max_packet_size= max(net_buffer_length, max_allowed_packet); +} + diff --git a/sql/client_settings.h b/sql/client_settings.h index 1963281d980..206f00ba3fe 100644 --- a/sql/client_settings.h +++ b/sql/client_settings.h @@ -32,3 +32,5 @@ extern ulong slave_net_timeout; #ifdef HAVE_SMEM #undef HAVE_SMEM #endif + +#define CLI_MYSQL_USE_RESULT NULL diff --git a/sql/net_serv.cc b/sql/net_serv.cc index eb4d76bbf6e..370c046c660 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -30,7 +30,10 @@ 3 byte length & 1 byte package-number. */ -#ifndef EMBEDDED_LIBRARY +/* + HFTODO this must be hidden if we don't want client capabilities in + embedded library + */ #ifdef __WIN__ #include #endif @@ -46,6 +49,19 @@ #include #include +#ifdef EMBEDDED_LIBRARY + +#ifdef net_flush +#undef net_flush +#endif + +extern "C" { +my_bool net_flush(NET *net); +} + +#endif /*EMBEDDED_LIBRARY */ + + /* The following handles the differences when this is linked between the client and the server. @@ -959,5 +975,4 @@ my_net_read(NET *net) return len; } -#endif /* EMBEDDED_LIBRARY */ diff --git a/sql/protocol.cc b/sql/protocol.cc index 10fe2c1725e..62573da54f9 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -236,29 +236,6 @@ net_printf(THD *thd, uint errcode, ...) DBUG_VOID_RETURN; } -/* - Function called by my_net_init() to set some check variables -*/ - -#ifndef EMBEDDED_LIBRARY -extern "C" { -void my_net_local_init(NET *net) -{ - net->max_packet= (uint) global_system_variables.net_buffer_length; - net->read_timeout= (uint) global_system_variables.net_read_timeout; - net->write_timeout=(uint) global_system_variables.net_write_timeout; - net->retry_count= (uint) global_system_variables.net_retry_count; - net->max_packet_size= max(global_system_variables.net_buffer_length, - global_system_variables.max_allowed_packet); -} -} - -#else /* EMBEDDED_LIBRARY */ -void my_net_local_init(NET *net __attribute__(unused)) -{ -} -#endif /* EMBEDDED_LIBRARY */ - /* Return ok to the client. From 4c7431dc906cd5e5dba8515ec63107b590708898 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 18 Jun 2003 10:34:09 +0500 Subject: [PATCH 03/54] Last part of resolving conflicts after pull Some intersections with Monty encountered libmysql/client_settings.h: We don't need the trick with macroses since Monty moved cli_mysql_use_result into sql-common/client.c libmysql/libmysql.c: mysql_use_result moved in sql-common/client.c sql-common/client.c: code simplified with the moving of mysql_use_result here sql/client_settings.h: we don't need this #define anymore sql/sql_client.cc: this function was moved to sql-common/pack.c by me i think the pack.c is the better place for it --- libmysql/client_settings.h | 4 --- libmysql/libmysql.c | 53 +------------------------------------- sql-common/client.c | 10 +++---- sql/client_settings.h | 1 - sql/sql_client.cc | 2 ++ 5 files changed, 6 insertions(+), 64 deletions(-) diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h index d4e8be84c48..43f341c7b1c 100644 --- a/libmysql/client_settings.h +++ b/libmysql/client_settings.h @@ -41,7 +41,3 @@ my_bool send_file_to_server(MYSQL *mysql, const char *filename); #define reset_sigpipe(mysql) #endif -#define CLI_MYSQL_USE_RESULT cli_mysql_use_result - -MYSQL_RES * STDCALL cli_mysql_use_result(MYSQL *mysql); - diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index e380ceb2d19..495647bf302 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -69,10 +69,6 @@ my_bool net_flush(NET *net); #endif - -uint mysql_port=0; -my_string mysql_unix_port=0; - #if defined(MSDOS) || defined(__WIN__) /* socket_errno is defined in my_global.h for all platforms */ #define perror(A) @@ -141,6 +137,7 @@ void mysql_once_init(void) #endif } +#ifndef EMBEDDED_LIBRARY int STDCALL mysql_server_init(int argc __attribute__((unused)), char **argv __attribute__((unused)), char **groups __attribute__((unused))) @@ -841,54 +838,6 @@ STDCALL mysql_add_slave(MYSQL* mysql, const char* host, return 0; } -/************************************************************************** - Alloc struct for use with unbuffered reads. Data is fetched by domand - when calling to mysql_fetch_row. - mysql_data_seek is a noop. - - No other queries may be specified with the same MYSQL handle. - There shouldn't be much processing per row because mysql server shouldn't - have to wait for the client (and will not wait more than 30 sec/packet). -**************************************************************************/ - -MYSQL_RES * STDCALL CLI_MYSQL_USE_RESULT(MYSQL *mysql) -{ - MYSQL_RES *result; - DBUG_ENTER("mysql_use_result"); - - mysql = mysql->last_used_con; - - if (!mysql->fields) - DBUG_RETURN(0); - if (mysql->status != MYSQL_STATUS_GET_RESULT) - { - strmov(mysql->net.sqlstate, unknown_sqlstate); - strmov(mysql->net.last_error, - ER(mysql->net.last_errno=CR_COMMANDS_OUT_OF_SYNC)); - DBUG_RETURN(0); - } - if (!(result=(MYSQL_RES*) my_malloc(sizeof(*result)+ - sizeof(ulong)*mysql->field_count, - MYF(MY_WME | MY_ZEROFILL)))) - DBUG_RETURN(0); - result->lengths=(ulong*) (result+1); - if (!(result->row=(MYSQL_ROW) - my_malloc(sizeof(result->row[0])*(mysql->field_count+1), MYF(MY_WME)))) - { /* Ptrs: to one row */ - my_free((gptr) result,MYF(0)); - DBUG_RETURN(0); - } - result->fields= mysql->fields; - result->field_alloc= mysql->field_alloc; - result->field_count= mysql->field_count; - result->current_field=0; - result->handle= mysql; - result->current_row= 0; - mysql->fields=0; /* fields is now in result */ - mysql->status=MYSQL_STATUS_USE_RESULT; - DBUG_RETURN(result); /* Data is read to be fetched */ -} - /************************************************************************** Return next field of the query results **************************************************************************/ diff --git a/sql-common/client.c b/sql-common/client.c index b70aed2d2c2..7d82ff0d209 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -60,10 +60,6 @@ my_bool net_flush(NET *net); #define CLI_MYSQL_REAL_CONNECT mysql_real_connect #endif /*EMBEDDED_LIBRARY*/ -#ifdef MYSQL_CLIENT -static my_bool mysql_client_init=0; -#endif - #if !defined(MYSQL_SERVER) && (defined(__WIN__) || defined(_WIN32) || defined(_WIN64)) #include @@ -1441,6 +1437,7 @@ error: static void STDCALL cli_mysql_close(MYSQL *mysql); static my_bool STDCALL cli_mysql_read_query_result(MYSQL *mysql); static MYSQL_RES * STDCALL cli_mysql_store_result(MYSQL *mysql); +static MYSQL_RES * STDCALL cli_mysql_use_result(MYSQL *mysql); static MYSQL_METHODS client_methods= { @@ -1448,7 +1445,7 @@ static MYSQL_METHODS client_methods= cli_mysql_read_query_result, cli_advanced_command, cli_mysql_store_result, - CLI_MYSQL_USE_RESULT + cli_mysql_use_result }; MYSQL * STDCALL @@ -2378,8 +2375,7 @@ static MYSQL_RES * STDCALL cli_mysql_store_result(MYSQL *mysql) have to wait for the client (and will not wait more than 30 sec/packet). **************************************************************************/ -MYSQL_RES * STDCALL -mysql_use_result(MYSQL *mysql) +static MYSQL_RES * STDCALL cli_mysql_use_result(MYSQL *mysql) { MYSQL_RES *result; DBUG_ENTER("mysql_use_result"); diff --git a/sql/client_settings.h b/sql/client_settings.h index 5a16fdd1c2f..b357e52ec9d 100644 --- a/sql/client_settings.h +++ b/sql/client_settings.h @@ -30,6 +30,5 @@ #define mysql_slave_send_query(A, B, C) 1 #define mysql_rpl_probe(mysql) 0 #undef HAVE_SMEM -#define CLI_MYSQL_USE_RESULT NULL #undef _CUSTOMCONFIG_ diff --git a/sql/sql_client.cc b/sql/sql_client.cc index 464596f0734..a6a8a6305ed 100644 --- a/sql/sql_client.cc +++ b/sql/sql_client.cc @@ -20,6 +20,7 @@ #include +#ifdef CLEAN_DUP /* Function called by my_net_init() to set some check variables */ @@ -37,6 +38,7 @@ void my_net_local_init(NET *net) #endif } } +#endif /*CLEAN_DUP*/ extern "C" { void mysql_once_init(void) From 13e8bf67fc63280f76023fab73c373f33e363bfc Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 18 Jun 2003 15:58:57 +0500 Subject: [PATCH 04/54] SCRUM including client code into embedded server code to guess what library to use added net_field_length moved to pack.c include/mysql.h: typedefinitions moved for suitability mysql_option.methods_to_use added include/mysql_com.h: net_store_length declaration libmysql/libmysql.c: net_store_length moved to sql-common/pack.c libmysqld/libmysqld.c: added code to guess whether to use remote or embedded connection sql-common/client.c: options checking added sql-common/pack.c: net_store_length implementation moved here sql/protocol.cc: net_store_length moved to sql-common/pack.c --- include/mysql.h | 21 ++++++++++++--------- include/mysql_com.h | 1 + libmysql/libmysql.c | 33 --------------------------------- libmysqld/libmysqld.c | 14 +++++++++++++- sql-common/client.c | 5 +++++ sql-common/pack.c | 27 +++++++++++++++++++++++++++ sql/protocol.cc | 34 ---------------------------------- 7 files changed, 58 insertions(+), 77 deletions(-) diff --git a/include/mysql.h b/include/mysql.h index 81e50525614..a6bdb39e5ec 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -134,6 +134,17 @@ typedef struct st_mysql_data { #endif } MYSQL_DATA; +enum mysql_option +{ + MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE, + MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP, + MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE, + MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT, + MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT, + MYSQL_OPT_USE_REMOTE_CONNECTION, MYSQL_OPT_USE_EMBEDDED_CONNECTION, + MYSQL_OPT_GUESS_CONNECTION +}; + struct st_mysql_options { unsigned int connect_timeout, read_timeout, write_timeout; unsigned int port, protocol; @@ -168,15 +179,7 @@ struct st_mysql_options { #if !defined(CHECK_EMBEDDED_DIFFERENCES) || defined(EMBEDDED_LIBRARY) my_bool separate_thread; #endif -}; - -enum mysql_option -{ - MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE, - MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP, - MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE, - MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT, - MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT + enum mysql_option methods_to_use; }; enum mysql_status diff --git a/include/mysql_com.h b/include/mysql_com.h index c480273f3e9..a89569c451e 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -341,6 +341,7 @@ void my_thread_end(void); #ifdef _global_h ulong STDCALL net_field_length(uchar **packet); my_ulonglong net_field_length_ll(uchar **packet); +char *net_store_length(char *pkg, ulonglong length); #endif #ifdef __cplusplus diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 495647bf302..1a5e91045ae 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1730,39 +1730,6 @@ static void store_param_type(NET *net, uint type) net->write_pos+=2; } -/* - Store the length of parameter data - (Same function as in sql/net_pkg.cc) -*/ - -char * -net_store_length(char *pkg, ulong length) -{ - uchar *packet=(uchar*) pkg; - if (length < 251) - { - *packet=(uchar) length; - return (char*) packet+1; - } - /* 251 is reserved for NULL */ - if (length < 65536L) - { - *packet++=252; - int2store(packet,(uint) length); - return (char*) packet+2; - } - if (length < 16777216L) - { - *packet++=253; - int3store(packet,(ulong) length); - return (char*) packet+3; - } - *packet++=254; - int8store(packet, (ulonglong) length); - return (char*) packet+9; -} - - /**************************************************************************** Functions to store parameter data from a prepared statement. diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index efc3ee353e8..5b738f7f95b 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -68,6 +68,10 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command, */ void mysql_read_default_options(struct st_mysql_options *options, const char *filename,const char *group); +MYSQL * STDCALL +cli_mysql_real_connect(MYSQL *mysql,const char *host, const char *user, + const char *passwd, const char *db, + uint port, const char *unix_socket,ulong client_flag); #ifdef HAVE_GETPWUID struct passwd *getpwuid(uid_t); @@ -179,7 +183,7 @@ static MYSQL_METHODS embedded_methods= MYSQL * STDCALL mysql_real_connect(MYSQL *mysql,const char *host, const char *user, - const char *passwd __attribute__((unused)), const char *db, + const char *passwd, const char *db, uint port, const char *unix_socket,ulong client_flag) { char *db_name; @@ -189,6 +193,14 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, db ? db : "(Null)", user ? user : "(Null)")); + if (mysql->options.methods_to_use == MYSQL_OPT_USE_REMOTE_CONNECTION) + cli_mysql_real_connect(mysql, host, user, + passwd, db, port, unix_socket, client_flag); + if ((mysql->options.methods_to_use == MYSQL_OPT_GUESS_CONNECTION) && + host && strcmp(host,LOCAL_HOST)) + cli_mysql_real_connect(mysql, host, user, + passwd, db, port, unix_socket, client_flag); + mysql->methods= &embedded_methods; /* use default options */ diff --git a/sql-common/client.c b/sql-common/client.c index 7d82ff0d209..8a6f3ed1e3d 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1303,6 +1303,7 @@ mysql_init(MYSQL *mysql) #ifdef HAVE_SMEM mysql->options.shared_memory_base_name= (char*) def_shared_memory_base_name; #endif + mysql->options.methods_to_use= MYSQL_OPT_GUESS_CONNECTION; return mysql; } @@ -2512,6 +2513,10 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg) my_free(mysql->options.shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); mysql->options.shared_memory_base_name=my_strdup(arg,MYF(MY_WME)); #endif + case MYSQL_OPT_USE_REMOTE_CONNECTION: + case MYSQL_OPT_USE_EMBEDDED_CONNECTION: + case MYSQL_OPT_GUESS_CONNECTION: + mysql->options.methods_to_use= option; break; default: DBUG_RETURN(1); diff --git a/sql-common/pack.c b/sql-common/pack.c index 16cc13eddbd..43e0098bf29 100644 --- a/sql-common/pack.c +++ b/sql-common/pack.c @@ -96,3 +96,30 @@ void my_net_local_init(NET *net) net->max_packet_size= max(net_buffer_length, max_allowed_packet); } +char * +net_store_length(char *pkg, ulonglong length) +{ + uchar *packet=(uchar*) pkg; + if (length < LL(251)) + { + *packet=(uchar) length; + return (char*) packet+1; + } + /* 251 is reserved for NULL */ + if (length < LL(65536)) + { + *packet++=252; + int2store(packet,(uint) length); + return (char*) packet+2; + } + if (length < LL(16777216)) + { + *packet++=253; + int3store(packet,(ulong) length); + return (char*) packet+3; + } + *packet++=254; + int8store(packet,length); + return (char*) packet+8; +} + diff --git a/sql/protocol.cc b/sql/protocol.cc index da363a478fd..3933cd08d40 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -349,40 +349,6 @@ send_eof(THD *thd, bool no_flush) } #endif /* EMBEDDED_LIBRARY */ - -/**************************************************************************** - Store a field length in logical packet - This is used to code the string length for normal protocol -****************************************************************************/ - -char * -net_store_length(char *pkg, ulonglong length) -{ - uchar *packet=(uchar*) pkg; - if (length < LL(251)) - { - *packet=(uchar) length; - return (char*) packet+1; - } - /* 251 is reserved for NULL */ - if (length < LL(65536)) - { - *packet++=252; - int2store(packet,(uint) length); - return (char*) packet+2; - } - if (length < LL(16777216)) - { - *packet++=253; - int3store(packet,(ulong) length); - return (char*) packet+3; - } - *packet++=254; - int8store(packet,length); - return (char*) packet+8; -} - - /* Faster net_store_length when we know length is a 32 bit integer */ From cc0904178b3972a7c9fba37bd98c9bbb576be1e9 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Jun 2003 16:38:21 +0500 Subject: [PATCH 05/54] SCRUM client code added to the embedded library some fixes include/mysql.h: test code removed simple_command is the macrodefinition now libmysqld/embedded_priv.h: this declaration obsolete libmysqld/lib_sql.cc: errors stored in the same place for embedded and client libraries now sql-common/client.c: we don't need that ugly wrapper --- include/mysql.h | 35 +++-------------------------------- libmysqld/embedded_priv.h | 2 -- libmysqld/lib_sql.cc | 3 ++- sql-common/client.c | 9 --------- 4 files changed, 5 insertions(+), 44 deletions(-) diff --git a/include/mysql.h b/include/mysql.h index a6bdb39e5ec..e4f1d283899 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -204,8 +204,6 @@ enum mysql_rpl_type struct st_mysql_methods; -#if !defined(CHECK_EMBEDDED_DIFFERENCES) || !defined(EMBEDDED_LIBRARY) - typedef struct st_mysql { NET net; /* Communication parameters */ @@ -250,40 +248,13 @@ typedef struct st_mysql LIST *stmts; /* list of all statements */ const struct st_mysql_methods *methods; -#if !defined(CHECK_EMBEDDED_DIFFERENCES) struct st_mysql_res *result; void *thd; unsigned int last_errno; char *last_error; char sqlstate[SQLSTATE_LENGTH+1]; /* Used by embedded server */ -#endif } MYSQL; -#else - -struct st_mysql_res; - -typedef struct st_mysql -{ - struct st_mysql_res *result; - void *thd; - struct charset_info_st *charset; - unsigned int server_language; - MYSQL_FIELD *fields; - MEM_ROOT field_alloc; - my_ulonglong affected_rows; - unsigned int field_count; - struct st_mysql_options options; - enum mysql_status status; - my_bool free_me; /* If free in mysql_close */ - my_ulonglong insert_id; /* id if insert on table with NEXTNR */ - unsigned int last_errno; - char *last_error; /* Used by embedded server */ - char sqlstate[SQLSTATE_LENGTH+1]; /* Used by embedded server */ -} MYSQL; - -#endif - typedef struct st_mysql_res { my_ulonglong row_count; MYSQL_FIELD *fields; @@ -638,9 +609,9 @@ int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB); They are not for general usage */ -my_bool -simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg, - unsigned long length, my_bool skip_check); +#define simple_command(mysql, command, arg, length, skip_check) \ + (*(mysql)->methods->advanced_command)(mysql, command, \ + NullS, 0, arg, length, skip_check) unsigned long net_safe_read(MYSQL* mysql); void mysql_once_init(void); diff --git a/libmysqld/embedded_priv.h b/libmysqld/embedded_priv.h index abbebec2aaa..dfc06e38ab2 100644 --- a/libmysqld/embedded_priv.h +++ b/libmysqld/embedded_priv.h @@ -26,6 +26,4 @@ C_MODE_START extern void lib_connection_phase(NET *net, int phase); extern void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db); extern void *create_embedded_thd(int client_flag, char *db); -extern my_bool simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg, - ulong length, my_bool skipp_check); C_MODE_END diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 6ba87d31268..73d5ca72654 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -74,7 +74,8 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command, result= thd->net.last_errno ? -1 : 0; mysql->last_error= thd->net.last_error; - mysql->last_errno= thd->net.last_errno; + mysql->net.last_errno= thd->net.last_errno; + mysql->warning_count= ((THD*)mysql->thd)->total_warn_count; return result; } diff --git a/sql-common/client.c b/sql-common/client.c index 8a6f3ed1e3d..0ce693f90eb 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -658,15 +658,6 @@ end: return result; } -my_bool -simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg, - ulong length, my_bool skip_check) -{ - return - (*mysql->methods->advanced_command)(mysql, command, - NullS, 0, arg, length, skip_check); -} - void free_old_query(MYSQL *mysql) { DBUG_ENTER("free_old_query"); From 14fd42e13ff008247ede01c48780539f23931e2d Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 4 Jul 2003 11:40:10 +0500 Subject: [PATCH 06/54] SCRUM Including client code into embedded library Code trimming (fixes of comments etc) include/mysql_com.h: Comment fixed include/mysql_embed.h: comment fixed include/violite.h: comment fixed libmysql/libmysql.c: #undef should work anyway libmysqld/libmysqld.c: comment fixed sql-common/client.c: #undef should work anyway sql/net_serv.cc: #undef should work anyway --- include/mysql_com.h | 4 +--- include/mysql_embed.h | 4 +--- include/violite.h | 3 +-- libmysql/libmysql.c | 4 ---- libmysqld/libmysqld.c | 3 +-- sql-common/client.c | 4 ---- sql/net_serv.cc | 2 -- 7 files changed, 4 insertions(+), 20 deletions(-) diff --git a/include/mysql_com.h b/include/mysql_com.h index a89569c451e..ab6330dbe53 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -234,9 +234,7 @@ void net_end(NET *net); void net_clear(NET *net); my_bool net_realloc(NET *net, unsigned long length); -/*HFTODO - should remove it - */ -#ifndef EMBEDDED_LIBRARY +#ifndef EMBEDDED_LIBRARY /* To be removed by HF */ my_bool net_flush(NET *net); #else #define net_flush(A) diff --git a/include/mysql_embed.h b/include/mysql_embed.h index ba71b2e93ea..7a169d4133e 100644 --- a/include/mysql_embed.h +++ b/include/mysql_embed.h @@ -19,9 +19,7 @@ #ifdef EMBEDDED_LIBRARY /* Things we don't need in the embedded version of MySQL */ -/*HFTODO -#undef HAVE_VIO - if we don't want client in embedded library -*/ +/* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */ #undef HAVE_PSTACK /* No stacktrace */ #undef HAVE_DLOPEN /* No udf functions */ diff --git a/include/violite.h b/include/violite.h index eeb2cbd7185..9205f5b799a 100644 --- a/include/violite.h +++ b/include/violite.h @@ -220,8 +220,7 @@ enum SSL_type }; -/* HFTODO - hide this if we don't want client in embedded server - */ +/* HFTODO - hide this if we don't want client in embedded server */ /* This structure is for every connection on both sides */ struct st_vio { diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 1a5e91045ae..39cff002e45 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -61,12 +61,8 @@ #include "client_settings.h" #ifdef EMBEDDED_LIBRARY -#ifdef net_flush #undef net_flush -#endif - my_bool net_flush(NET *net); - #endif #if defined(MSDOS) || defined(__WIN__) diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index 5b738f7f95b..6a71bb28150 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -64,8 +64,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command, const char *header, ulong header_length, const char *arg, ulong arg_length, my_bool skip_check); -/*FROM client.c - */ +/* From client.c */ void mysql_read_default_options(struct st_mysql_options *options, const char *filename,const char *group); MYSQL * STDCALL diff --git a/sql-common/client.c b/sql-common/client.c index 0ce693f90eb..f1e9f79c8e5 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -41,9 +41,7 @@ #ifdef EMBEDDED_LIBRARY -#ifdef MYSQL_SERVER #undef MYSQL_SERVER -#endif #ifndef MYSQL_CLIENT #define MYSQL_CLIENT @@ -51,9 +49,7 @@ #define CLI_MYSQL_REAL_CONNECT cli_mysql_real_connect -#ifdef net_flush #undef net_flush -#endif my_bool net_flush(NET *net); #else /*EMBEDDED_LIBRARY*/ diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 370c046c660..3f73825b2d8 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -51,9 +51,7 @@ #ifdef EMBEDDED_LIBRARY -#ifdef net_flush #undef net_flush -#endif extern "C" { my_bool net_flush(NET *net); From aa1b02400e9915643f240960587006e20b286074 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 6 Jul 2003 17:12:45 +0200 Subject: [PATCH 07/54] renamed enum Item_cast as it's not a 'class Item' child --- sql/item_create.cc | 2 +- sql/item_create.h | 2 +- sql/item_func.h | 2 +- sql/sql_yacc.yy | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sql/item_create.cc b/sql/item_create.cc index 90f42cee959..125c8de2275 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -470,7 +470,7 @@ Item *create_load_file(Item* a) } -Item *create_func_cast(Item *a, Item_cast cast_type, CHARSET_INFO *cs) +Item *create_func_cast(Item *a, Cast_target cast_type, CHARSET_INFO *cs) { Item *res; LINT_INIT(res); diff --git a/sql/item_create.h b/sql/item_create.h index 4151f59a87f..5646afb991e 100644 --- a/sql/item_create.h +++ b/sql/item_create.h @@ -28,7 +28,7 @@ Item *create_func_bit_length(Item* a); Item *create_func_coercibility(Item* a); Item *create_func_ceiling(Item* a); Item *create_func_char_length(Item* a); -Item *create_func_cast(Item *a, Item_cast cast_type, CHARSET_INFO *cs); +Item *create_func_cast(Item *a, Cast_target cast_type, CHARSET_INFO *cs); Item *create_func_connection_id(void); Item *create_func_conv(Item* a, Item *b, Item *c); Item *create_func_cos(Item* a); diff --git a/sql/item_func.h b/sql/item_func.h index 6a08d961bc3..33b7de5d32c 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1081,7 +1081,7 @@ public: /* For type casts */ -enum Item_cast +enum Cast_target { ITEM_CAST_BINARY, ITEM_CAST_SIGNED_INT, ITEM_CAST_UNSIGNED_INT, ITEM_CAST_DATE, ITEM_CAST_TIME, ITEM_CAST_DATETIME, ITEM_CAST_CHAR diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 6072be28dca..7a16cb4fc56 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -74,7 +74,7 @@ inline Item *or_or_concat(THD *thd, Item* A, Item* B) enum row_type row_type; enum ha_rkey_function ha_rkey_mode; enum enum_tx_isolation tx_isolation; - enum Item_cast cast_type; + enum Cast_target cast_type; enum Item_udftype udf_type; CHARSET_INFO *charset; thr_lock_type lock_type; From 90091dee465cef6cd50ef85ed9dd67b06a0edfd2 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 14 Jul 2003 16:38:51 +0500 Subject: [PATCH 08/54] Some mistakes fixed libmysql/libmysql.c: was removed by mistake during merging libmysqld/Makefile.am: link should be removed first libmysqld/libmysqld.c: We don't need this line here sql-common/pack.c: Function was moved to old place sql/sql_client.cc: we do need this function --- libmysql/libmysql.c | 20 ++++++++++++++++++++ libmysqld/Makefile.am | 1 + libmysqld/libmysqld.c | 1 - sql-common/pack.c | 18 ------------------ sql/sql_client.cc | 2 -- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 39cff002e45..d3dc5af0f9c 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -60,6 +60,12 @@ #include #include "client_settings.h" +ulong net_buffer_length=8192; +ulong max_allowed_packet= 1024L*1024L*1024L; +ulong net_read_timeout= NET_READ_TIMEOUT; +ulong net_write_timeout= NET_WRITE_TIMEOUT; + + #ifdef EMBEDDED_LIBRARY #undef net_flush my_bool net_flush(NET *net); @@ -150,6 +156,7 @@ void STDCALL mysql_server_end() else mysql_thread_end(); } + #endif /*EMBEDDED_LIBRARY*/ my_bool STDCALL mysql_thread_init() @@ -1225,6 +1232,19 @@ uint STDCALL mysql_thread_safe(void) Some support functions ****************************************************************************/ +/* + Functions called my my_net_init() to set some application specific variables +*/ + +void my_net_local_init(NET *net) +{ + net->max_packet= (uint) net_buffer_length; + net->read_timeout= (uint) net_read_timeout; + net->write_timeout=(uint) net_write_timeout; + net->retry_count= 1; + net->max_packet_size= max(net_buffer_length, max_allowed_packet); +} + /* Add escape characters to a string (blob?) to make it suitable for a insert to should at least have place for length*2+1 chars diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index d87bf3c9b52..e61e7833451 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -115,6 +115,7 @@ link_sources: rm -f $(srcdir)/$$f; \ @LN_CP_F@ $(srcdir)/../libmysql/$$f $(srcdir)/$$f; \ done; \ + rm -f $(srcdir)/client_settings.h; \ @LN_CP_F@ $(srcdir)/../libmysql/client_settings.h $(srcdir)/client_settings.h; diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index 16be7d884fa..0a096a88889 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -46,7 +46,6 @@ #define INADDR_NONE -1 #endif -const char *not_error_sqlstate= "00000"; #define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_TRANSACTIONS | CLIENT_PROTOCOL_41) #if defined(MSDOS) || defined(__WIN__) diff --git a/sql-common/pack.c b/sql-common/pack.c index 43e0098bf29..e31e596ae7a 100644 --- a/sql-common/pack.c +++ b/sql-common/pack.c @@ -18,11 +18,6 @@ #include #include -ulong net_buffer_length=8192; -ulong max_allowed_packet= 1024L*1024L*1024L; -ulong net_read_timeout= NET_READ_TIMEOUT; -ulong net_write_timeout= NET_WRITE_TIMEOUT; - /* Get the length of next field. Change parameter to point at fieldstart */ ulong STDCALL net_field_length(uchar **packet) { @@ -83,19 +78,6 @@ my_ulonglong net_field_length_ll(uchar **packet) #endif } -/* - Functions called my my_net_init() to set some application specific variables -*/ - -void my_net_local_init(NET *net) -{ - net->max_packet= (uint) net_buffer_length; - net->read_timeout= (uint) net_read_timeout; - net->write_timeout=(uint) net_write_timeout; - net->retry_count= 1; - net->max_packet_size= max(net_buffer_length, max_allowed_packet); -} - char * net_store_length(char *pkg, ulonglong length) { diff --git a/sql/sql_client.cc b/sql/sql_client.cc index 4b0f3f930f3..1ae9a23a924 100644 --- a/sql/sql_client.cc +++ b/sql/sql_client.cc @@ -20,7 +20,6 @@ #include "mysql_priv.h" -#ifdef CLEAN_DUP /* Function called by my_net_init() to set some check variables */ @@ -38,7 +37,6 @@ void my_net_local_init(NET *net) #endif } } -#endif /*CLEAN_DUP*/ extern "C" { void mysql_once_init(void) From ac392bb27b149ed6c6f22966511faea72747eb74 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 Jul 2003 15:20:22 +0200 Subject: [PATCH 09/54] cut&paste fixed --- sql/sql_select.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_select.h b/sql/sql_select.h index 7de9007369e..76960876158 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -259,7 +259,7 @@ class JOIN :public Sql_alloc bool rollup_init(); bool rollup_make_fields(List &all_fields, List &fields, Item_sum ***func); - int JOIN::rollup_send_data(uint idx); + int rollup_send_data(uint idx); }; From a975548b53bde25032c6d381bba7dd9872111124 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 18 Jul 2003 12:42:35 +0500 Subject: [PATCH 10/54] Some fixes in CASE. Test suit was extended to conver various arguments mixes. --- mysql-test/r/case.result | 46 ++++++++++++++++++++++++++++++++++++++-- mysql-test/t/case.test | 39 +++++++++++++++++++++++++++++++++- sql/item_cmpfunc.cc | 5 ++--- 3 files changed, 84 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result index 04627a7a493..08f148f94c0 100644 --- a/mysql-test/r/case.result +++ b/mysql-test/r/case.result @@ -10,10 +10,10 @@ CASE "c" when "a" then 1 when "b" then 2 ELSE 3 END 3 select CASE BINARY "b" when "a" then 1 when "B" then 2 WHEN "b" then "ok" END; CASE BINARY "b" when "a" then 1 when "B" then 2 WHEN "b" then "ok" END -0 +ok select CASE "b" when "a" then 1 when binary "B" then 2 WHEN "b" then "ok" END; CASE "b" when "a" then 1 when binary "B" then 2 WHEN "b" then "ok" END -0 +ok select CASE concat("a","b") when concat("ab","") then "a" when "b" then "b" end; CASE concat("a","b") when concat("ab","") then "a" when "b" then "b" end a @@ -72,6 +72,48 @@ yellow green drop table t1; SET NAMES latin1; +CREATE TABLE t1 SELECT +CASE WHEN 1 THEN _latin1'a' COLLATE latin1_danish_ci ELSE _latin1'a' END AS c1, +CASE WHEN 1 THEN _latin1'a' ELSE _latin1'a' COLLATE latin1_danish_ci END AS c2, +CASE WHEN 1 THEN 'a' ELSE 1 END AS c3, +CASE WHEN 1 THEN 1 ELSE 'a' END AS c4, +CASE WHEN 1 THEN 'a' ELSE 1.0 END AS c5, +CASE WHEN 1 THEN 1.0 ELSE 'a' END AS c6, +CASE WHEN 1 THEN 1 ELSE 1.0 END AS c7, +CASE WHEN 1 THEN 1.0 ELSE 1 END AS c8 +; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` char(1) character set latin1 collate latin1_danish_ci default NULL, + `c2` char(1) character set latin1 collate latin1_danish_ci default NULL, + `c3` char(1) default NULL, + `c4` char(1) default NULL, + `c5` char(3) default NULL, + `c6` char(3) default NULL, + `c7` double(3,1) default NULL, + `c8` double(3,1) default NULL +) TYPE=MyISAM CHARSET=latin1 +DROP TABLE t1; +SELECT CASE +WHEN 1 +THEN _latin1'a' COLLATE latin1_danish_ci +ELSE _latin1'a' COLLATE latin1_swedish_ci +END; +ERROR HY000: Illegal mix of collations (latin1_danish_ci,EXPLICIT) and (latin1_swedish_ci,EXPLICIT) for operation 'case' +SELECT CASE _latin1'a' COLLATE latin1_general_ci +WHEN _latin1'a' COLLATE latin1_danish_ci THEN 1 +WHEN _latin1'a' COLLATE latin1_swedish_ci THEN 2 +END; +ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_danish_ci,EXPLICIT), (latin1_swedish_ci,EXPLICIT) for operation 'case' +SELECT +CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'A' THEN '1' ELSE 2 END, +CASE _latin1'a' COLLATE latin1_bin WHEN _latin1'A' THEN '1' ELSE 2 END, +CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_swedish_ci THEN '1' ELSE 2 END, +CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END +; +CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'A' THEN '1' ELSE 2 END CASE _latin1'a' COLLATE latin1_bin WHEN _latin1'A' THEN '1' ELSE 2 END CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_swedish_ci THEN '1' ELSE 2 END CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END +1 2 1 2 CREATE TABLE t1 SELECT COALESCE(_latin1'a',_latin2'a'); ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'coalesce' CREATE TABLE t1 SELECT COALESCE('a' COLLATE latin1_swedish_ci,'b' COLLATE latin1_bin); diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test index 0249a8eefba..8aa17061174 100644 --- a/mysql-test/t/case.test +++ b/mysql-test/t/case.test @@ -42,6 +42,44 @@ insert into t1 values (1,1,'orange'),(1,2,'large'),(2,1,'yellow'),(2,2,'medium') select max(case col when 1 then val else null end) as color from t1 group by row; drop table t1; +SET NAMES latin1; + +# +# CASE and argument types/collations aggregation into result +# +CREATE TABLE t1 SELECT + CASE WHEN 1 THEN _latin1'a' COLLATE latin1_danish_ci ELSE _latin1'a' END AS c1, + CASE WHEN 1 THEN _latin1'a' ELSE _latin1'a' COLLATE latin1_danish_ci END AS c2, + CASE WHEN 1 THEN 'a' ELSE 1 END AS c3, + CASE WHEN 1 THEN 1 ELSE 'a' END AS c4, + CASE WHEN 1 THEN 'a' ELSE 1.0 END AS c5, + CASE WHEN 1 THEN 1.0 ELSE 'a' END AS c6, + CASE WHEN 1 THEN 1 ELSE 1.0 END AS c7, + CASE WHEN 1 THEN 1.0 ELSE 1 END AS c8 +; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--error 1265 +SELECT CASE + WHEN 1 + THEN _latin1'a' COLLATE latin1_danish_ci + ELSE _latin1'a' COLLATE latin1_swedish_ci + END; + +--error 1268 +SELECT CASE _latin1'a' COLLATE latin1_general_ci + WHEN _latin1'a' COLLATE latin1_danish_ci THEN 1 + WHEN _latin1'a' COLLATE latin1_swedish_ci THEN 2 + END; + +SELECT +CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'A' THEN '1' ELSE 2 END, +CASE _latin1'a' COLLATE latin1_bin WHEN _latin1'A' THEN '1' ELSE 2 END, +CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_swedish_ci THEN '1' ELSE 2 END, +CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END +; + # # COALESCE is a CASE abbrevation: # @@ -52,7 +90,6 @@ drop table t1; # # Check COALESCE argument types aggregation -SET NAMES latin1; --error 1265 CREATE TABLE t1 SELECT COALESCE(_latin1'a',_latin2'a'); --error 1265 diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 1f1b449e9a7..b73499942a3 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -892,7 +892,7 @@ Item *Item_func_case::find_item(String *str) } if ((tmp=args[i]->val_str(str))) // If not null { - if (sortcmp(tmp,first_expr_str,&my_charset_bin)==0) + if (sortcmp(tmp,first_expr_str,cmp_collation.collation)==0) return args[i+1]; } break; @@ -1027,7 +1027,7 @@ void Item_func_case::fix_length_and_dec() { agg[0]= args[first_expr_num]; for (nagg= 0; nagg < ncases/2 ; nagg++) - agg[nagg+1]= args[nagg]; + agg[nagg+1]= args[nagg*2]; nagg++; agg_cmp_type(&cmp_type, agg, nagg); if ((cmp_type == STRING_RESULT) && @@ -1040,7 +1040,6 @@ void Item_func_case::fix_length_and_dec() max_length=0; decimals=0; - cached_result_type = args[1]->result_type(); for (uint i=0 ; i < ncases ; i+=2) { set_if_bigger(max_length,args[i+1]->max_length); From f4e07b861e886db5893f92238fba20346262c06b Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 18 Jul 2003 13:11:47 +0500 Subject: [PATCH 11/54] CASE optimization --- sql/item_cmpfunc.cc | 58 +++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index b73499942a3..cb7c2cb0198 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -863,58 +863,60 @@ Item *Item_func_case::find_item(String *str) String *first_expr_str,*tmp; longlong first_expr_int; double first_expr_real; - bool int_used, real_used,str_used; - int_used=real_used=str_used=0; - + /* These will be initialized later */ LINT_INIT(first_expr_str); LINT_INIT(first_expr_int); LINT_INIT(first_expr_real); + if (first_expr_num != -1) + { + switch (cmp_type) + { + case STRING_RESULT: + // We can't use 'str' here as this may be overwritten + if (!(first_expr_str= args[first_expr_num]->val_str(&str_value))) + return else_expr_num != -1 ? args[else_expr_num] : 0; // Impossible + break; + case INT_RESULT: + first_expr_int= args[first_expr_num]->val_int(); + if (args[first_expr_num]->null_value) + return else_expr_num != -1 ? args[else_expr_num] : 0; + break; + case REAL_RESULT: + first_expr_real= args[first_expr_num]->val(); + if (args[first_expr_num]->null_value) + return else_expr_num != -1 ? args[else_expr_num] : 0; + break; + case ROW_RESULT: + default: + // This case should never be choosen + DBUG_ASSERT(0); + break; + } + } + // Compare every WHEN argument with it and return the first match for (uint i=0 ; i < ncases ; i+=2) { if (first_expr_num == -1) { - // No expression between CASE and first WHEN + // No expression between CASE and the first WHEN if (args[i]->val_int()) return args[i+1]; continue; } - switch (args[i]->result_type()) { + switch (cmp_type) { case STRING_RESULT: - if (!str_used) - { - str_used=1; - // We can't use 'str' here as this may be overwritten - if (!(first_expr_str= args[first_expr_num]->val_str(&str_value))) - return else_expr_num != -1 ? args[else_expr_num] : 0; // Impossible - } if ((tmp=args[i]->val_str(str))) // If not null - { if (sortcmp(tmp,first_expr_str,cmp_collation.collation)==0) return args[i+1]; - } break; case INT_RESULT: - if (!int_used) - { - int_used=1; - first_expr_int= args[first_expr_num]->val_int(); - if (args[first_expr_num]->null_value) - return else_expr_num != -1 ? args[else_expr_num] : 0; - } if (args[i]->val_int()==first_expr_int && !args[i]->null_value) return args[i+1]; break; case REAL_RESULT: - if (!real_used) - { - real_used=1; - first_expr_real= args[first_expr_num]->val(); - if (args[first_expr_num]->null_value) - return else_expr_num != -1 ? args[else_expr_num] : 0; - } if (args[i]->val()==first_expr_real && !args[i]->null_value) return args[i+1]; break; From ee1440848feb047661e7a91d7694c5452156c376 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 18 Jul 2003 13:28:38 +0500 Subject: [PATCH 12/54] Scrum task 425: Added --verbose option for --help --- sql/mysqld.cc | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 709ba036f7e..ef2fb78ef80 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -225,6 +225,12 @@ const char *localhost= "localhost", *delayed_user= "DELAYED"; #endif bool opt_large_files= sizeof(my_off_t) > 4; + +/* + Used with --help for detailed option +*/ +bool opt_verbose= 0; + arg_cmp_func Arg_comparator::comparator_matrix[4][2] = {{&Arg_comparator::compare_string, &Arg_comparator::compare_e_string}, {&Arg_comparator::compare_real, &Arg_comparator::compare_e_real}, @@ -3638,6 +3644,9 @@ Disable with --skip-bdb (will save memory).", #endif /* End HAVE_INNOBASE_DB */ {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"verbose", 'v', "Used with --help option for detailed help", + (gptr*) &opt_verbose, (gptr*) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, + 0, 0}, {"init-file", OPT_INIT_FILE, "Read SQL commands from this file at startup.", (gptr*) &opt_init_file, (gptr*) &opt_init_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -3973,8 +3982,6 @@ replicating a LOAD DATA INFILE command.", 0, 0, 0, 0, 0, 0}, {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"version", 'v', "Synonym for option -V.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, - 0, 0, 0, 0}, {"log-warnings", 'W', "Log some not critical warnings to the log file.", (gptr*) &global_system_variables.log_warnings, (gptr*) &max_system_variables.log_warnings, 0, GET_BOOL, NO_ARG, 0, 0, 0, @@ -4573,6 +4580,10 @@ and you are welcome to modify and redistribute it under the GPL license\n\ Starts the MySQL server\n"); printf("Usage: %s [OPTIONS]\n", my_progname); + if (!opt_verbose) + puts("\nFor more help options (several pages), use mysqld --verbose --help\n"); + else + { #ifdef __WIN__ puts("NT and Win32 specific options:\n\ --install Install the default service (NT)\n\ @@ -4596,7 +4607,8 @@ Starts the MySQL server\n"); puts("\n\ To see what values a running MySQL server is using, type\n\ -'mysqladmin variables' instead of 'mysqld --help'."); +'mysqladmin variables' instead of 'mysqld --verbose --help'.\n"); + } } @@ -4871,6 +4883,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), #endif #include case 'v': + usage(); + exit(0); case 'V': print_version(); exit(0); From 687863c093f0f01f54770b10fdd40f554e21a6f8 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 18 Jul 2003 14:03:54 +0500 Subject: [PATCH 13/54] IN now aggregates all argument types for comparison --- mysql-test/r/func_in.result | 21 +++++++++++++++++++++ mysql-test/t/func_in.test | 8 ++++++++ sql/item_cmpfunc.cc | 7 ++++--- sql/item_cmpfunc.h | 1 + 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index 4b15c44fdb1..a197371b345 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -143,3 +143,24 @@ select * from t1 where 'a' in (a,b,c collate latin1_bin); a b c a c c drop table t1; +select '1.0' in (1,2); +'1.0' in (1,2) +1 +select 1 in ('1.0',2); +1 in ('1.0',2) +1 +select 1 in (1,'2.0'); +1 in (1,'2.0') +1 +select 1 in ('1.0',2.0); +1 in ('1.0',2.0) +1 +select 1 in (1.0,'2.0'); +1 in (1.0,'2.0') +1 +select 1 in ('1.1',2); +1 in ('1.1',2) +0 +select 1 in ('1.1',2.0); +1 in ('1.1',2.0) +0 diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index dca068f368a..105612bf238 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -73,3 +73,11 @@ select * from t1 where 'a' collate latin1_general_ci in (a,b,c); select * from t1 where 'a' collate latin1_bin in (a,b,c); select * from t1 where 'a' in (a,b,c collate latin1_bin); drop table t1; + +select '1.0' in (1,2); +select 1 in ('1.0',2); +select 1 in (1,'2.0'); +select 1 in ('1.0',2.0); +select 1 in (1.0,'2.0'); +select 1 in ('1.1',2); +select 1 in ('1.1',2.0); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index cb7c2cb0198..78ec253c7a2 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1405,7 +1405,8 @@ void Item_func_in::fix_length_and_dec() Item **arg, **arg_end; uint const_itm= 1; - if ((args[0]->result_type() == STRING_RESULT) && + agg_cmp_type(&cmp_type, args, arg_count); + if ((cmp_type == STRING_RESULT) && (agg_arg_collations_for_comparison(cmp_collation, args, arg_count))) return; @@ -1418,7 +1419,7 @@ void Item_func_in::fix_length_and_dec() */ if (const_itm && !nulls_in_row()) { - switch (args[0]->result_type()) { + switch (cmp_type) { case STRING_RESULT: uint i; array=new in_string(arg_count-1,(qsort2_cmp) srtcmp_in, @@ -1452,7 +1453,7 @@ void Item_func_in::fix_length_and_dec() else { in_item= cmp_item::get_comparator(args[0]); - if (args[0]->result_type() == STRING_RESULT) + if (cmp_type == STRING_RESULT) in_item->cmp_charset= cmp_collation.collation; } maybe_null= args[0]->maybe_null; diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index a9fba76a7b8..25cc97d60bf 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -611,6 +611,7 @@ public: class Item_func_in :public Item_int_func { + Item_result cmp_type; in_vector *array; cmp_item *in_item; bool have_null; From 00e8a411510604f1dd9a9bdbf82b76423757dc69 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 18 Jul 2003 15:50:40 +0500 Subject: [PATCH 14/54] All functions now use the same function to aggregate comparison and result types --- mysql-test/r/null.result | 2 +- sql/item_cmpfunc.cc | 89 ++++++++++++++++++---------------------- 2 files changed, 42 insertions(+), 49 deletions(-) diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index fd621d06c2b..0dd9754d0c5 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -7,7 +7,7 @@ select 1 | NULL,1 & NULL,1+NULL,1-NULL; NULL NULL NULL NULL select NULL=NULL,NULL<>NULL,IFNULL(NULL,1.1)+0,IFNULL(NULL,1) | 0; NULL=NULL NULL<>NULL IFNULL(NULL,1.1)+0 IFNULL(NULL,1) | 0 -NULL NULL 1 1 +NULL NULL 1.1 1 select strcmp("a",NULL),(1 +static Item_result item_store_type(Item_result a,Item_result b) +{ + if (a == STRING_RESULT || b == STRING_RESULT) + return STRING_RESULT; + else if (a == REAL_RESULT || b == REAL_RESULT) + return REAL_RESULT; + else + return INT_RESULT; +} + +static void agg_result_type(Item_result *type, Item **items, uint nitems) +{ + uint i; + type[0]= items[0]->result_type(); + for (i=1 ; i < nitems ; i++) + type[0]= item_store_type(type[0], items[i]->result_type()); +} + +static void agg_cmp_type(Item_result *type, Item **items, uint nitems) +{ + uint i; + type[0]= items[0]->result_type(); + for (i=1 ; i < nitems ; i++) + type[0]= item_cmp_type(type[0], items[i]->result_type()); +} + static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fname) { my_error(ER_CANT_AGGREGATE_2COLLATIONS,MYF(0), @@ -556,10 +582,7 @@ void Item_func_between::fix_length_and_dec() */ if (!args[0] || !args[1] || !args[2]) return; - cmp_type=item_cmp_type(args[0]->result_type(), - item_cmp_type(args[1]->result_type(), - args[2]->result_type())); - + agg_cmp_type(&cmp_type, args, 3); if (cmp_type == STRING_RESULT && agg_arg_collations_for_comparison(cmp_collation, args, 3)) return; @@ -650,28 +673,17 @@ longlong Item_func_between::val_int() return 0; } -static Item_result item_store_type(Item_result a,Item_result b) -{ - if (a == STRING_RESULT || b == STRING_RESULT) - return STRING_RESULT; - else if (a == REAL_RESULT || b == REAL_RESULT) - return REAL_RESULT; - else - return INT_RESULT; -} - void Item_func_ifnull::fix_length_and_dec() { maybe_null=args[1]->maybe_null; max_length=max(args[0]->max_length,args[1]->max_length); decimals=max(args[0]->decimals,args[1]->decimals); - if ((cached_result_type=item_store_type(args[0]->result_type(), - args[1]->result_type())) != - REAL_RESULT) - decimals= 0; + agg_result_type(&cached_result_type, args, 2); if (cached_result_type == STRING_RESULT) agg_arg_collations(collation, args, arg_count); + else if (cached_result_type != REAL_RESULT) + decimals= 0; } @@ -744,19 +756,18 @@ Item_func_if::fix_length_and_dec() cached_result_type= arg1_type; set_charset(args[1]->charset()); } - else if (arg1_type == STRING_RESULT || arg2_type == STRING_RESULT) - { - cached_result_type = STRING_RESULT; - if (agg_arg_collations(collation, args+1, 2)) - return; - } else { - set_charset(&my_charset_bin); // Number - if (arg1_type == REAL_RESULT || arg2_type == REAL_RESULT) - cached_result_type = REAL_RESULT; + agg_result_type(&cached_result_type, args+1, 2); + if (cached_result_type == STRING_RESULT) + { + if (agg_arg_collations(collation, args+1, 2)) + return; + } else - cached_result_type=arg1_type; // Should be INT_RESULT + { + set_charset(&my_charset_bin); // Number + } } } @@ -800,7 +811,7 @@ Item_func_nullif::fix_length_and_dec() { max_length=args[0]->max_length; decimals=args[0]->decimals; - cached_result_type=args[0]->result_type(); + agg_result_type(&cached_result_type, args, 2); } } @@ -984,22 +995,6 @@ double Item_func_case::val() return res; } -static void agg_result_type(Item_result *type, Item **items, uint nitems) -{ - uint i; - type[0]= items[0]->result_type(); - for (i=1 ; i < nitems ; i++) - type[0]= item_store_type(type[0], items[i]->result_type()); -} - -static void agg_cmp_type(Item_result *type, Item **items, uint nitems) -{ - uint i; - type[0]= items[0]->result_type(); - for (i=1 ; i < nitems ; i++) - type[0]= item_cmp_type(type[0], items[i]->result_type()); -} - void Item_func_case::fix_length_and_dec() { Item **agg; @@ -1109,13 +1104,11 @@ void Item_func_coalesce::fix_length_and_dec() { max_length= 0; decimals= 0; - cached_result_type = args[0]->result_type(); + agg_result_type(&cached_result_type, args, arg_count); for (uint i=0 ; i < arg_count ; i++) { set_if_bigger(max_length,args[i]->max_length); set_if_bigger(decimals,args[i]->decimals); - cached_result_type=item_store_type(cached_result_type, - args[i]->result_type()); } if (cached_result_type == STRING_RESULT) agg_arg_collations(collation, args, arg_count); From d17b3e967d517ad290eec9cd0d59dd47f4887e08 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 18 Jul 2003 16:26:35 +0500 Subject: [PATCH 15/54] SCRUM Including client code into embedded library fixes libmysql/libmysql.c: We should call this way libmysqld/lib_sql.cc: Necessary initializations added libmysqld/libmysqld.c: mysql_close can't be "virtual" mysqltest.c calls mysql_close before mysql_connect sql-common/client.c: We have to redo fetch_lengths to count lengths looking at '\0' in string. It works slower, but is correct for both client and embedded libraries --- libmysql/libmysql.c | 2 +- libmysqld/lib_sql.cc | 3 +++ libmysqld/libmysqld.c | 12 +++++++++--- sql-common/client.c | 25 +++++-------------------- 4 files changed, 18 insertions(+), 24 deletions(-) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 4051ed15db5..a90fb2f1205 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -3388,7 +3388,7 @@ my_bool STDCALL mysql_stmt_reset(MYSQL_STMT *stmt) mysql= stmt->mysql->last_used_con; int4store(buff, stmt->stmt_id); /* Send stmt id to server */ - if (advanced_command(mysql, COM_RESET_STMT,buff,MYSQL_STMT_HEADER,0,0,1)) + if ((*mysql->methods->advanced_command)(mysql, COM_RESET_STMT,buff,MYSQL_STMT_HEADER,0,0,1)) { set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno, mysql->net.sqlstate); diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 73d5ca72654..f7b69b51d46 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -38,6 +38,7 @@ static char inited, org_my_init_done; C_MODE_START #include #include "errmsg.h" +#include static int check_connections1(THD * thd); static int check_connections2(THD * thd); @@ -66,8 +67,10 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command, /* Clear result variables */ thd->clear_error(); mysql->affected_rows= ~(my_ulonglong) 0; + mysql->field_count= 0; thd->store_globals(); // Fix if more than one connect + free_old_query(mysql); result= dispatch_command(command, thd, (char *) arg, arg_length + 1); if (!skip_check) diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index 0a096a88889..b6278ab3c0b 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -72,6 +72,8 @@ cli_mysql_real_connect(MYSQL *mysql,const char *host, const char *user, const char *passwd, const char *db, uint port, const char *unix_socket,ulong client_flag); +void STDCALL cli_mysql_close(MYSQL *mysql); + #ifdef HAVE_GETPWUID struct passwd *getpwuid(uid_t); char* getlogin(void); @@ -166,14 +168,12 @@ static inline int mysql_init_charset(MYSQL *mysql) ** before calling mysql_real_connect ! */ -static void STDCALL emb_mysql_close(MYSQL *mysql); static my_bool STDCALL emb_mysql_read_query_result(MYSQL *mysql); static MYSQL_RES * STDCALL emb_mysql_store_result(MYSQL *mysql); static MYSQL_RES * STDCALL emb_mysql_use_result(MYSQL *mysql); static MYSQL_METHODS embedded_methods= { - emb_mysql_close, emb_mysql_read_query_result, emb_advanced_command, emb_mysql_store_result, @@ -276,9 +276,15 @@ error: ** If handle is alloced by mysql connect free it. *************************************************************************/ -static void STDCALL emb_mysql_close(MYSQL *mysql) +void STDCALL mysql_close(MYSQL *mysql) { DBUG_ENTER("mysql_close"); + if (mysql->methods != &embedded_methods) + { + cli_mysql_close(mysql); + DBUG_VOID_RETURN; + } + if (mysql) /* Some simple safety */ { my_free(mysql->options.user,MYF(MY_ALLOW_ZERO_PTR)); diff --git a/sql-common/client.c b/sql-common/client.c index ea0d079511f..7c0de2dba73 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -48,12 +48,14 @@ #endif #define CLI_MYSQL_REAL_CONNECT cli_mysql_real_connect +#define CLI_MYSQL_CLOSE cli_mysql_close #undef net_flush my_bool net_flush(NET *net); #else /*EMBEDDED_LIBRARY*/ #define CLI_MYSQL_REAL_CONNECT mysql_real_connect +#define CLI_MYSQL_CLOSE mysql_close #endif /*EMBEDDED_LIBRARY*/ #if !defined(MYSQL_SERVER) && (defined(__WIN__) || defined(_WIN32) || defined(_WIN64)) @@ -965,26 +967,11 @@ void mysql_read_default_options(struct st_mysql_options *options, void fetch_lengths(ulong *to, MYSQL_ROW column, uint field_count) { - ulong *prev_length; - byte *start=0; MYSQL_ROW end; - - prev_length=0; /* Keep gcc happy */ - for (end=column + field_count + 1 ; column != end ; column++, to++) - { - if (!*column) - { - *to= 0; /* Null */ - continue; - } - if (start) /* Found end of prev string */ - *prev_length= (ulong) (*column-start-1); - start= *column; - prev_length= to; - } + for (end=column + field_count; column != end ; column++, to++) + *to= *column ? strlen(*column) : 0; } - /*************************************************************************** Change field rows to field structs ***************************************************************************/ @@ -1422,14 +1409,12 @@ error: before calling mysql_real_connect ! */ -static void STDCALL cli_mysql_close(MYSQL *mysql); static my_bool STDCALL cli_mysql_read_query_result(MYSQL *mysql); static MYSQL_RES * STDCALL cli_mysql_store_result(MYSQL *mysql); static MYSQL_RES * STDCALL cli_mysql_use_result(MYSQL *mysql); static MYSQL_METHODS client_methods= { - cli_mysql_close, cli_mysql_read_query_result, cli_advanced_command, cli_mysql_store_result, @@ -2140,7 +2125,7 @@ static void mysql_close_free(MYSQL *mysql) } -static void STDCALL cli_mysql_close(MYSQL *mysql) +void STDCALL CLI_MYSQL_CLOSE(MYSQL *mysql) { DBUG_ENTER("mysql_close"); if (mysql) /* Some simple safety */ From bc3dc272f7773ba8d9d071e25bbd4539c97502a3 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 19 Jul 2003 23:19:19 -0500 Subject: [PATCH 16/54] errmsg.txt: fix typo sql/share/english/errmsg.txt: fix typo --- sql/share/english/errmsg.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 57336647f2a..11ae2c89019 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -179,7 +179,7 @@ "You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column", "Key '%-.64s' doesn't exist in table '%-.64s'", "Can't open table", -"The storage enginge for the table doesn't support %s", +"The storage engine for the table doesn't support %s", "You are not allowed to execute this command in a transaction", "Got error %d during COMMIT", "Got error %d during ROLLBACK", From c1ed639cb654cc12f2971d840a541c0d9fa80327 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 20 Jul 2003 12:26:18 +0200 Subject: [PATCH 17/54] bug #715: SELECT YEAR+0 FROM foobar is parsed as 'SELECT' 'YEAR' '+0' => syntax error mysql-test/r/bigint.result: test results updated mysql-test/r/type_decimal.result: test results updated mysql-test/t/bigint.test: new tests added mysql-test/t/type_decimal.test: error numbers updated sql/item.h: round(9999999999999999999) fixed sql/sql_yacc.yy: bug #715: SELECT YEAR+0 FROM foobar is parsed as 'SELECT' 'YEAR' '+0' => syntax error unary '+' added --- mysql-test/r/bigint.result | 7 ++++-- mysql-test/r/type_decimal.result | 6 ++--- mysql-test/t/bigint.test | 2 ++ mysql-test/t/type_decimal.test | 6 ++--- mysys/charset.c | 5 ++--- sql/item.h | 2 +- sql/item_func.cc | 3 ++- sql/sql_lex.cc | 38 ++++++-------------------------- sql/sql_yacc.yy | 7 +++--- 9 files changed, 28 insertions(+), 48 deletions(-) diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index 12dc146ba2b..93214ae8479 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -1,12 +1,12 @@ drop table if exists t1; select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296; -0 256 00000000000000065536 2147483647 -2147483648 2147483648 +4294967296 +0 256 00000000000000065536 2147483647 -2147483648 2147483648 4294967296 0 256 65536 2147483647 -2147483648 2147483648 4294967296 select 9223372036854775807,-009223372036854775808; 9223372036854775807 -009223372036854775808 9223372036854775807 -9223372036854775808 select +9999999999999999999,-9999999999999999999; -+9999999999999999999 -9999999999999999999 +9999999999999999999 -9999999999999999999 9999999999999999999 -10000000000000000000 select cast(9223372036854775808 as unsigned)+1; cast(9223372036854775808 as unsigned)+1 @@ -14,6 +14,9 @@ cast(9223372036854775808 as unsigned)+1 select 9223372036854775808+1; 9223372036854775808+1 9223372036854775809 +select -(0-3),round(-(0-3)), round(9999999999999999999); +-(0-3) round(-(0-3)) round(9999999999999999999) +3 3 10000000000000000000 create table t1 (a bigint unsigned not null, primary key(a)); insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE); select * from t1; diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result index 57df0c67ac9..b31ef73742d 100644 --- a/mysql-test/r/type_decimal.result +++ b/mysql-test/r/type_decimal.result @@ -436,8 +436,8 @@ a 99999999999 drop table t1; CREATE TABLE t1 (a_dec DECIMAL(-1,0)); -ERROR 42000: Too big column length for column 'a_dec' (max = 255). Use BLOB instead +ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '-1,0))' at line 1 CREATE TABLE t1 (a_dec DECIMAL(-2,1)); -ERROR 42000: Too big column length for column 'a_dec' (max = 255). Use BLOB instead +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 '-2,1))' at line 1 CREATE TABLE t1 (a_dec DECIMAL(-1,1)); -ERROR 42000: Too big column length for column 'a_dec' (max = 255). Use BLOB instead +ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '-1,1))' at line 1 diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test index 060d45c29a4..9ac44c8ba0a 100644 --- a/mysql-test/t/bigint.test +++ b/mysql-test/t/bigint.test @@ -13,6 +13,8 @@ select 9223372036854775807,-009223372036854775808; select +9999999999999999999,-9999999999999999999; select cast(9223372036854775808 as unsigned)+1; select 9223372036854775808+1; +select -(0-3),round(-(0-3)), round(9999999999999999999); + # # In 3.23 we have to disable the test of column to bigint as # this fails on AIX powerpc (the resolution for double is not good enough) diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test index 8653c06a644..acbc738995f 100644 --- a/mysql-test/t/type_decimal.test +++ b/mysql-test/t/type_decimal.test @@ -237,9 +237,9 @@ drop table t1; # Test of wrong decimal type # ---error 1074 +--error 1064 CREATE TABLE t1 (a_dec DECIMAL(-1,0)); ---error 1074 +--error 1064 CREATE TABLE t1 (a_dec DECIMAL(-2,1)); ---error 1074 +--error 1064 CREATE TABLE t1 (a_dec DECIMAL(-1,1)); diff --git a/mysys/charset.c b/mysys/charset.c index 7dab1a38325..7a82f8780a0 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -63,7 +63,7 @@ static void init_state_maps(CHARSET_INFO *cs) uint i; uchar *state_map= cs->state_map; uchar *ident_map= cs->ident_map; - + /* Fill state_map with states to get a faster parser */ for (i=0; i < 256 ; i++) { @@ -76,13 +76,12 @@ static void init_state_maps(CHARSET_INFO *cs) state_map[i]=(uchar) MY_LEX_IDENT; #endif else if (!my_isgraph(cs,i)) - state_map[i]=(uchar) MY_LEX_SKIP; + state_map[i]=(uchar) MY_LEX_SKIP; else state_map[i]=(uchar) MY_LEX_CHAR; } state_map[(uchar)'_']=state_map[(uchar)'$']=(uchar) MY_LEX_IDENT; state_map[(uchar)'\'']=(uchar) MY_LEX_STRING; - state_map[(uchar)'-']=state_map[(uchar)'+']=(uchar) MY_LEX_SIGNED_NUMBER; state_map[(uchar)'.']=(uchar) MY_LEX_REAL_OR_POINT; state_map[(uchar)'>']=state_map[(uchar)'=']=state_map[(uchar)'!']= (uchar) MY_LEX_CMP_OP; state_map[(uchar)'<']= (uchar) MY_LEX_LONG_CMP_OP; diff --git a/sql/item.h b/sql/item.h index 57061221878..450cb396787 100644 --- a/sql/item.h +++ b/sql/item.h @@ -374,7 +374,7 @@ public: Item_uint(const char *str_arg, uint length) : Item_int(str_arg, (longlong) strtoull(str_arg,(char**) 0,10), length) {} Item_uint(uint32 i) :Item_int((longlong) i, 10) {} - double val() { return ulonglong2double(value); } + double val() { return ulonglong2double((ulonglong)value); } String *val_str(String*); Item *new_item() { return new Item_uint(name,max_length); } bool fix_fields(THD *thd, struct st_table_list *list, Item **item) diff --git a/sql/item_func.cc b/sql/item_func.cc index ea3c3980a50..9ecc062d645 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -597,7 +597,8 @@ void Item_func_neg::fix_length_and_dec() { decimals=args[0]->decimals; max_length=args[0]->max_length; - hybrid_type= args[0]->result_type() == INT_RESULT ? INT_RESULT : REAL_RESULT; + hybrid_type= args[0]->result_type() == INT_RESULT && !args[0]->unsigned_flag ? + INT_RESULT : REAL_RESULT; } double Item_func_abs::val() diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 425890ab446..16ebd758639 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -455,6 +455,13 @@ int yylex(void *arg, void *yythd) } case MY_LEX_CHAR: // Unknown or single char token case MY_LEX_SKIP: // This should not happen + if (c == '-' && yyPeek() == '-' && + (my_isspace(cs,yyPeek2()) || + my_iscntrl(cs,yyPeek2()))) + { + state=MY_LEX_COMMENT; + break; + } yylval->lex_str.str=(char*) (lex->ptr=lex->tok_start);// Set to first chr yylval->lex_str.length=1; c=yyGet(); @@ -694,37 +701,6 @@ int yylex(void *arg, void *yythd) lex->next_state= MY_LEX_START; return(IDENT); } - case MY_LEX_SIGNED_NUMBER: // Incomplete signed number - if (prev_state == MY_LEX_OPERATOR_OR_IDENT) - { - if (c == '-' && yyPeek() == '-' && - (my_isspace(cs,yyPeek2()) || - my_iscntrl(cs,yyPeek2()))) - state=MY_LEX_COMMENT; - else - state= MY_LEX_CHAR; // Must be operator - break; - } - if (!my_isdigit(cs,c=yyGet()) || yyPeek() == 'x') - { - if (c != '.') - { - if (c == '-' && my_isspace(cs,yyPeek())) - state= MY_LEX_COMMENT; - else - state= MY_LEX_CHAR; // Return sign as single char - break; - } - yyUnget(); // Fix for next loop - } - while (my_isdigit(cs,c=yyGet())) ; // Incomplete real or int number - if ((c == 'e' || c == 'E') && - (yyPeek() == '+' || yyPeek() == '-' || my_isdigit(cs,yyPeek()))) - { // Real number - yyUnget(); - c= '.'; // Fool next test - } - // fall through case MY_LEX_INT_OR_REAL: // Compleat int or incompleat real if (c != '.') { // Found complete integer number. diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index ba0489c7585..709181af7fa 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2294,7 +2294,8 @@ simple_expr: YYABORT; } | sum_expr - | '-' expr %prec NEG { $$= new Item_func_neg($2); } + | '+' expr %prec NEG { $$= $2; } + | '-' expr %prec NEG { $$= new Item_func_neg($2); } | '~' expr %prec NEG { $$= new Item_func_bit_neg($2); } | NOT expr %prec NEG { $$= new Item_func_not($2); } | '!' expr %prec NEG { $$= new Item_func_not($2); } @@ -4138,7 +4139,7 @@ literal: Lex->next_state=MY_LEX_OPERATOR_OR_IDENT;} | HEX_NUM { $$ = new Item_varbinary($1.str,$1.length);} | UNDERSCORE_CHARSET HEX_NUM - { + { Item *tmp= new Item_varbinary($2.str,$2.length); String *str= tmp ? tmp->val_str((String*) 0) : (String*) 0; $$ = new Item_string(str ? str->ptr() : "", str ? str->length() : 0, @@ -4310,8 +4311,6 @@ ident: LEX *lex= Lex; $$.str= lex->thd->strmake($1.str,$1.length); $$.length=$1.length; - if (lex->next_state != MY_LEX_END) - lex->next_state= MY_LEX_OPERATOR_OR_IDENT; } ; From de13ae26e1394d8dbfe47d137723a13ca47f03c9 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 20 Jul 2003 07:00:00 -0500 Subject: [PATCH 18/54] Fix test results affected by error message edit. mysql-test/r/bdb.result: Fix test result affected by error message edit. mysql-test/r/innodb.result: Fix test result affected by error message edit. mysql-test/r/isam.result: Fix test result affected by error message edit. mysql-test/r/repair_part1.result: Fix test result affected by error message edit. --- mysql-test/r/bdb.result | 2 +- mysql-test/r/innodb.result | 6 +++--- mysql-test/r/isam.result | 6 +++--- mysql-test/r/repair_part1.result | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result index b0566011996..fd2f7b7e49b 100644 --- a/mysql-test/r/bdb.result +++ b/mysql-test/r/bdb.result @@ -203,7 +203,7 @@ a 2 check table t1; Table Op Msg_type Msg_text -test.t1 check error The storage enginge for the table doesn't support check +test.t1 check error The storage engine for the table doesn't support check drop table t1; create table t1 (a int,b varchar(20)) type=bdb; insert into t1 values (1,""), (2,"testing"); diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 4d5a6094ec3..f80f9644e5a 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -156,7 +156,7 @@ level id parent_id 1 1007 101 optimize table t1; Table Op Msg_type Msg_text -test.t1 optimize error The storage enginge for the table doesn't support optimize +test.t1 optimize error The storage engine for the table doesn't support optimize show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 0 PRIMARY 1 id A # NULL NULL BTREE @@ -180,7 +180,7 @@ create table t1 (a int) type=innodb; insert into t1 values (1), (2); optimize table t1; Table Op Msg_type Msg_text -test.t1 optimize error The storage enginge for the table doesn't support optimize +test.t1 optimize error The storage engine for the table doesn't support optimize delete from t1 where a = 1; select * from t1; a @@ -712,7 +712,7 @@ world 2 hello 1 optimize table t1; Table Op Msg_type Msg_text -test.t1 optimize error The storage enginge for the table doesn't support optimize +test.t1 optimize error The storage engine for the table doesn't support optimize show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 0 PRIMARY 1 a A 2 NULL NULL BTREE diff --git a/mysql-test/r/isam.result b/mysql-test/r/isam.result index 5ac54668443..b83185b0c01 100644 --- a/mysql-test/r/isam.result +++ b/mysql-test/r/isam.result @@ -57,14 +57,14 @@ test.t1 optimize status OK check table t1,t2; Table Op Msg_type Msg_text test.t1 check status OK -test.t2 check error The storage enginge for the table doesn't support check +test.t2 check error The storage engine for the table doesn't support check repair table t1,t2; Table Op Msg_type Msg_text test.t1 repair status OK -test.t2 repair error The storage enginge for the table doesn't support repair +test.t2 repair error The storage engine for the table doesn't support repair check table t2,t1; Table Op Msg_type Msg_text -test.t2 check error The storage enginge for the table doesn't support check +test.t2 check error The storage engine for the table doesn't support check test.t1 check status OK lock tables t1 write; check table t2,t1; diff --git a/mysql-test/r/repair_part1.result b/mysql-test/r/repair_part1.result index eb46622dcc1..27dfdac24f0 100644 --- a/mysql-test/r/repair_part1.result +++ b/mysql-test/r/repair_part1.result @@ -7,7 +7,7 @@ test.t1 repair status OK alter table t1 TYPE=HEAP; repair table t1 use_frm; Table Op Msg_type Msg_text -test.t1 repair error The storage enginge for the table doesn't support repair +test.t1 repair error The storage engine for the table doesn't support repair drop table t1; repair table t1 use_frm; Table Op Msg_type Msg_text From a4dbcfd6814ad51e15d293f21494207506809838 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 21 Jul 2003 00:32:35 +0200 Subject: [PATCH 19/54] absurd (and syntaxically incorrect) column definition corrected --- mysql-test/r/innodb.result | 2 +- mysql-test/t/innodb.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 4d5a6094ec3..07ae9ed7520 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1289,7 +1289,7 @@ a b 111 100 drop table t1; CREATE TABLE t1 (col1 int(1))TYPE=InnoDB; -CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP(+0),INDEX stamp_idx +CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx (stamp))TYPE=InnoDB; insert into t1 values (1),(2),(3); insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ); diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 17df79a69fa..635a15baa41 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -868,7 +868,7 @@ drop table t1; CREATE TABLE t1 (col1 int(1))TYPE=InnoDB; -CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP(+0),INDEX stamp_idx +CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx (stamp))TYPE=InnoDB; insert into t1 values (1),(2),(3); insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ); From f22517e4eca9b00049bb9cf9176c9d3489dfe94e Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 21 Jul 2003 00:13:22 -0700 Subject: [PATCH 20/54] Enable warnings by default for single value list inserts also when the client protocol is >= 4.1 tests/client_test.c: test for timestamp bug (BR #819) sql/sql_insert.cc: Enable warnings by default for single value list protocol mysql-test/t/warnings.test: Updated test for single value list insert warning mysql-test/r/warnings.result: Updated warnings results --- INSTALL-WIN-SOURCE | 2 +- mysql-test/r/warnings.result | 3 ++ mysql-test/t/warnings.test | 1 + sql/sql_insert.cc | 4 +- tests/client_test.c | 91 ++++++++++++++++++++++++++++++++++-- 5 files changed, 95 insertions(+), 6 deletions(-) diff --git a/INSTALL-WIN-SOURCE b/INSTALL-WIN-SOURCE index bce093633f5..78a8f0e5d5a 100755 --- a/INSTALL-WIN-SOURCE +++ b/INSTALL-WIN-SOURCE @@ -92,7 +92,7 @@ To build the latest Windows source package from the current BitKeeper source tree, use the following instructions. Please note that this procedure must be performed on a system running a Unix or Unix-like operating system. (The procedure -is know to work well on Linux, for example. +is know to work well on Linux), for example. - Clone the BitKeeper source tree for MySQL (version 4.1 or above, as desired). For more information how to clone diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index d84c284d7b4..4e526d85d90 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -90,6 +90,9 @@ Warning 1263 Data truncated for column 'b' at row 2 Warning 1263 Data truncated for column 'b' at row 3 Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 4 Warning 1263 Data truncated for column 'b' at row 4 +insert into t2(b) values('mysqlab'); +Warnings: +Warning 1263 Data truncated for column 'b' at row 1 drop table t1, t2; create table t1(a char(10)); alter table t1 add b char; diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test index 6374fbf83ac..6991f9d9b2f 100644 --- a/mysql-test/t/warnings.test +++ b/mysql-test/t/warnings.test @@ -51,6 +51,7 @@ update t1 set c='mysql ab' where c='test'; update t1 set d=c; create table t2(a tinyint NOT NULL, b char(3)); insert into t2 select b,c from t1; +insert into t2(b) values('mysqlab'); drop table t1, t2; # diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 947205949f1..e2a7c517688 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -231,7 +231,9 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, info.update_fields=&update_fields; info.update_values=&update_values; // Don't count warnings for simple inserts - if (values_list.elements > 1 || (thd->options & OPTION_WARNINGS)) + if ((thd->client_capabilities & CLIENT_PROTOCOL_41) || + values_list.elements > 1 || + (thd->options & OPTION_WARNINGS)) thd->count_cuted_fields = 1; thd->cuted_fields = 0L; table->next_number_field=table->found_next_number_field; diff --git a/tests/client_test.c b/tests/client_test.c index 2741da1bbba..6ee7487ac45 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -176,7 +176,7 @@ static void client_connect() int rc; myheader_r("client_connect"); - fprintf(stdout, "\n Establishing a connection ..."); + fprintf(stdout, "\n Establishing a connection to '%s' ...", opt_host); if (!(mysql = mysql_init(NULL))) { @@ -3729,7 +3729,7 @@ static void test_stmt_close() fprintf(stdout, "\n Establishing a test connection ..."); if (!(lmysql = mysql_init(NULL))) { - myerror("mysql_init() failed"); + myerror("mysql_init() failed"); exit(0); } if (!(mysql_real_connect(lmysql,opt_host,opt_user, @@ -6071,7 +6071,7 @@ static void test_prepare_grant() fprintf(stdout, "\n Establishing a test connection ..."); if (!(lmysql = mysql_init(NULL))) { - myerror("mysql_init() failed"); + myerror("mysql_init() failed"); exit(0); } if (!(mysql_real_connect(lmysql,opt_host,"test_grant", @@ -6460,7 +6460,7 @@ static void test_drop_temp() fprintf(stdout, "\n Establishing a test connection ..."); if (!(lmysql = mysql_init(NULL))) { - myerror("mysql_init() failed"); + myerror("mysql_init() failed"); exit(0); } @@ -7160,6 +7160,11 @@ static void test_mem_overun() rc = mysql_real_query(mysql, buffer, length); myquery(rc); + + rc = mysql_query(mysql,"select * from t_mem_overun"); + myquery(rc); + + myassert(1 == my_process_result(mysql)); stmt = mysql_prepare(mysql, "select * from t_mem_overun",30); mystmt_init(stmt); @@ -7456,6 +7461,83 @@ static void test_sqlmode() mysql_stmt_close(stmt); } +/* + test for timestamp handling +*/ +static void test_ts() +{ + MYSQL_STMT *stmt; + MYSQL_BIND bind[2]; + MYSQL_TIME ts; + char strts[30]; + long length; + int rc; + + myheader("test_ts"); + + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_ts"); + myquery(rc); + + rc= mysql_query(mysql,"CREATE TABLE test_ts(a TIMESTAMP)"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + stmt = mysql_prepare(mysql,"INSERT INTO test_ts VALUES(?),(?)",40); + mystmt_init(stmt); + + ts.year= 2003; + ts.month= 07; + ts.day= 12; + ts.hour= 21; + ts.minute= 07; + ts.second= 46; + length= (long)(strmov(strts,"2003-07-12 21:07:46") - strts); + + bind[0].buffer_type= MYSQL_TYPE_STRING; + bind[0].buffer= (char *)strts; + bind[0].buffer_length= sizeof(strts); + bind[0].is_null= 0; + bind[0].length= &length; + + bind[1].buffer_type= MYSQL_TYPE_TIMESTAMP; + bind[1].buffer= (char *)&ts; + bind[1].buffer_length= sizeof(ts); + bind[1].is_null= 0; + bind[1].length= 0; + + rc = mysql_bind_param(stmt, bind); + mystmt(stmt,rc); + + rc = mysql_execute(stmt); + mystmt(stmt,rc); + + mysql_stmt_close(stmt); + + verify_col_data("test_ts","a","2003-07-12 21:07:46"); + + stmt = mysql_prepare(mysql,"SELECT a FROM test_ts WHERE a >= ?",50); + mystmt_init(stmt); + + rc = mysql_bind_param(stmt, bind); + mystmt(stmt,rc); + + rc = mysql_execute(stmt); + mystmt(stmt,rc); + + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} + /* Read and parse arguments and MySQL options from my.cnf @@ -7703,6 +7785,7 @@ int main(int argc, char **argv) test_fetch_offset(); /* to test mysql_fetch_column with offset */ test_fetch_column(); /* to test mysql_fetch_column */ test_sqlmode(); /* test for SQL_MODE */ + test_ts(); /* test for timestamp BR#819 */ end_time= time((time_t *)0); total_time+= difftime(end_time, start_time); From 53f4626105137f8c3cdb83e911f39f67116e0bfa Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 21 Jul 2003 16:19:00 +0500 Subject: [PATCH 21/54] Another fix for "client code in embedded library" include/mysql.h: mysql_close isn't virtual nown --- include/mysql.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/mysql.h b/include/mysql.h index e4e449efce9..58391d615d2 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -537,14 +537,12 @@ typedef struct st_mysql_stmt } MYSQL_STMT; -#define mysql_close(sock) (*(sock)->methods->close)(sock) #define mysql_read_query_result(mysql) (*(mysql)->methods->read_query_result)(mysql) #define mysql_store_result(mysql) (*(mysql)->methods->store_result)(mysql) #define mysql_use_result(mysql) (*(mysql)->methods->use_result)(mysql) typedef struct st_mysql_methods { - void STDCALL (*close)(MYSQL *sock); my_bool STDCALL (*read_query_result)(MYSQL *mysql); my_bool STDCALL (*advanced_command)(MYSQL *mysql, enum enum_server_command command, @@ -590,6 +588,8 @@ MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_seek(MYSQL_STMT *stmt, MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_tell(MYSQL_STMT *stmt); void STDCALL mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong offset); my_ulonglong STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt); +void STDCALL mysql_close(MYSQL *sock); + /* status return codes */ #define MYSQL_NO_DATA 100 From d1db6208537a93a90a26d07a4a5ae65bda969e51 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 21 Jul 2003 19:37:18 +0300 Subject: [PATCH 22/54] undo one row warning instead use sql_warnings=1 sql/sql_insert.cc: Undo warnings for single row inserts mysql-test/t/warnings.test: undo one row warning instead use sql_warnings=1 mysql-test/r/warnings.result: Fix result file --- mysql-test/r/warnings.result | 3 +++ mysql-test/t/warnings.test | 3 +++ sql/sql_insert.cc | 4 +--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index 4e526d85d90..0ad165a861a 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -91,8 +91,11 @@ Warning 1263 Data truncated for column 'b' at row 3 Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 4 Warning 1263 Data truncated for column 'b' at row 4 insert into t2(b) values('mysqlab'); +set sql_warnings=1; +insert into t2(b) values('mysqlab'); Warnings: Warning 1263 Data truncated for column 'b' at row 1 +set sql_warnings=0; drop table t1, t2; create table t1(a char(10)); alter table t1 add b char; diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test index 6991f9d9b2f..41aa02e925f 100644 --- a/mysql-test/t/warnings.test +++ b/mysql-test/t/warnings.test @@ -52,6 +52,9 @@ update t1 set d=c; create table t2(a tinyint NOT NULL, b char(3)); insert into t2 select b,c from t1; insert into t2(b) values('mysqlab'); +set sql_warnings=1; +insert into t2(b) values('mysqlab'); +set sql_warnings=0; drop table t1, t2; # diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index e2a7c517688..947205949f1 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -231,9 +231,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, info.update_fields=&update_fields; info.update_values=&update_values; // Don't count warnings for simple inserts - if ((thd->client_capabilities & CLIENT_PROTOCOL_41) || - values_list.elements > 1 || - (thd->options & OPTION_WARNINGS)) + if (values_list.elements > 1 || (thd->options & OPTION_WARNINGS)) thd->count_cuted_fields = 1; thd->cuted_fields = 0L; table->next_number_field=table->found_next_number_field; From d951272de1585cc3d6303297f4b0d53bf7b233b5 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 21 Jul 2003 12:23:41 -0500 Subject: [PATCH 23/54] INSTALL-WIN-SOURCE: tweak INSTALL-WIN-SOURCE: tweak --- INSTALL-WIN-SOURCE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL-WIN-SOURCE b/INSTALL-WIN-SOURCE index 78a8f0e5d5a..969eb91f5b1 100755 --- a/INSTALL-WIN-SOURCE +++ b/INSTALL-WIN-SOURCE @@ -92,7 +92,7 @@ To build the latest Windows source package from the current BitKeeper source tree, use the following instructions. Please note that this procedure must be performed on a system running a Unix or Unix-like operating system. (The procedure -is know to work well on Linux), for example. +is known to work well on Linux, for example.) - Clone the BitKeeper source tree for MySQL (version 4.1 or above, as desired). For more information how to clone From 491cdf396fe45d1246e5ab664e0d4192244f89fd Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 21 Jul 2003 21:13:52 +0200 Subject: [PATCH 24/54] gen_lex_hash sigsegv fixed --- sql/gen_lex_hash.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index 1c6f124aac7..ae46bcc9ea5 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -89,6 +89,7 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Output version information and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; struct hash_lex_struct @@ -101,8 +102,8 @@ struct hash_lex_struct }; int ithis; }; - -hash_lex_struct *get_hash_struct_by_len(hash_lex_struct **root_by_len, + +hash_lex_struct *get_hash_struct_by_len(hash_lex_struct **root_by_len, int len, int *max_len) { if (*max_len Date: Tue, 22 Jul 2003 22:00:51 +0200 Subject: [PATCH 25/54] wild_compare fun: bug in GRANT db_pattern.* ... --- mysql-test/r/grant2.result | 24 ++++++++++++++++++++++++ mysql-test/t/grant2.test | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 mysql-test/r/grant2.result create mode 100644 mysql-test/t/grant2.test diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result new file mode 100644 index 00000000000..1586375c7d8 --- /dev/null +++ b/mysql-test/r/grant2.result @@ -0,0 +1,24 @@ +delete from mysql.user where user like 'mysqltest\_%'; +delete from mysql.db where user like 'mysqltest\_%'; +flush privileges; +grant all privileges on `my\_%`.* to mysqltest_1@localhost with grant option; +select current_user(); +current_user() +mysqltest_1@localhost +grant all privileges on `my\_1`.* to mysqltest_9@localhost with grant option; +ERROR 42000: Access denied for user: 'mysqltest_1@localhost' to database 'my\_1' +grant all privileges on `my_%`.* to mysqltest_2@localhost with grant option; +select current_user(); +current_user() +mysqltest_2@localhost +grant all privileges on `mysql`.* to mysqltest_3@localhost with grant option; +select current_user(); +current_user() +mysqltest_3@localhost +show grants for mysqltest_3@localhost; +Grants for mysqltest_3@localhost +GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost' +GRANT ALL PRIVILEGES ON `mysql`.* TO 'mysqltest_3'@'localhost' WITH GRANT OPTION +delete from mysql.user where user like 'mysqltest\_%'; +delete from mysql.db where user like 'mysqltest\_%'; +flush privileges; diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test new file mode 100644 index 00000000000..d1535fa17a9 --- /dev/null +++ b/mysql-test/t/grant2.test @@ -0,0 +1,37 @@ +# +# GRANT tests that require several connections +# (usually it's GRANT, reconnect as another user, try something) +# + + +# +# wild_compare fun +# + +delete from mysql.user where user like 'mysqltest\_%'; +delete from mysql.db where user like 'mysqltest\_%'; +flush privileges; +grant all privileges on `my\_%`.* to mysqltest_1@localhost with grant option; +connect (user1,localhost,mysqltest_1,,); +connection user1; +select current_user(); +--error 1044 +grant all privileges on `my\_1`.* to mysqltest_9@localhost with grant option; +grant all privileges on `my_%`.* to mysqltest_2@localhost with grant option; +disconnect user1; +connect (user2,localhost,mysqltest_2,,); +connection user2; +select current_user(); +grant all privileges on `mysql`.* to mysqltest_3@localhost with grant option; +disconnect user2; +connect (user3,localhost,mysqltest_3,,); +connection user3; +select current_user(); +show grants for mysqltest_3@localhost; +disconnect user3; +connect (root,localhost,root,,); +connection root; +delete from mysql.user where user like 'mysqltest\_%'; +delete from mysql.db where user like 'mysqltest\_%'; +flush privileges; + From 1cf4eea19d870f9e6fe147ec36b7df0eef1514cf Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Jul 2003 22:21:23 +0200 Subject: [PATCH 26/54] now GRANT db.* ... compares patterns correctly to prevent privilege escalation --- include/my_sys.h | 2 +- mysql-test/r/grant2.result | 25 +++++++-------- mysql-test/t/grant2.test | 18 ++++------- mysys/mf_wcomp.c | 65 ++++++++++++++++++++++++++------------ mysys/mf_wfile.c | 4 +-- sql/sql_acl.cc | 10 +++--- sql/sql_acl.h | 2 +- sql/sql_base.cc | 2 +- sql/sql_db.cc | 14 ++++---- sql/sql_parse.cc | 4 +-- sql/sql_show.cc | 8 ++--- sql/sql_yacc.yy | 1 - 12 files changed, 85 insertions(+), 70 deletions(-) diff --git a/include/my_sys.h b/include/my_sys.h index 7ea9f63a50f..e4125a2e7e6 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -627,7 +627,7 @@ extern my_string my_path(my_string to,const char *progname, const char *own_pathname_part); extern my_string my_load_path(my_string to, const char *path, const char *own_path_prefix); -extern int wild_compare(const char *str,const char *wildstr); +extern int wild_compare(const char *str,const char *wildstr,pbool str_is_pattern); extern WF_PACK *wf_comp(my_string str); extern int wf_test(struct wild_file_pack *wf_pack,const char *name); extern void wf_end(struct wild_file_pack *buffer); diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result index 1586375c7d8..d49b9daee85 100644 --- a/mysql-test/r/grant2.result +++ b/mysql-test/r/grant2.result @@ -5,20 +5,19 @@ grant all privileges on `my\_%`.* to mysqltest_1@localhost with grant option; select current_user(); current_user() mysqltest_1@localhost -grant all privileges on `my\_1`.* to mysqltest_9@localhost with grant option; -ERROR 42000: Access denied for user: 'mysqltest_1@localhost' to database 'my\_1' -grant all privileges on `my_%`.* to mysqltest_2@localhost with grant option; -select current_user(); -current_user() -mysqltest_2@localhost -grant all privileges on `mysql`.* to mysqltest_3@localhost with grant option; -select current_user(); -current_user() -mysqltest_3@localhost +grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option; +grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option; +ERROR 42000: Access denied for user: 'mysqltest_1@localhost' to database 'my_%' +show grants for mysqltest_1@localhost; +Grants for mysqltest_1@localhost +GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' +GRANT ALL PRIVILEGES ON `my\_%`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION +show grants for mysqltest_2@localhost; +Grants for mysqltest_2@localhost +GRANT USAGE ON *.* TO 'mysqltest_2'@'localhost' +GRANT ALL PRIVILEGES ON `my\_1`.* TO 'mysqltest_2'@'localhost' WITH GRANT OPTION show grants for mysqltest_3@localhost; -Grants for mysqltest_3@localhost -GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost' -GRANT ALL PRIVILEGES ON `mysql`.* TO 'mysqltest_3'@'localhost' WITH GRANT OPTION +ERROR 42000: There is no such grant defined for user 'mysqltest_3' on host 'localhost' delete from mysql.user where user like 'mysqltest\_%'; delete from mysql.db where user like 'mysqltest\_%'; flush privileges; diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test index d1535fa17a9..3fbe2b0fe58 100644 --- a/mysql-test/t/grant2.test +++ b/mysql-test/t/grant2.test @@ -15,22 +15,16 @@ grant all privileges on `my\_%`.* to mysqltest_1@localhost with grant option; connect (user1,localhost,mysqltest_1,,); connection user1; select current_user(); +grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option; --error 1044 -grant all privileges on `my\_1`.* to mysqltest_9@localhost with grant option; -grant all privileges on `my_%`.* to mysqltest_2@localhost with grant option; +grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option; disconnect user1; -connect (user2,localhost,mysqltest_2,,); -connection user2; -select current_user(); -grant all privileges on `mysql`.* to mysqltest_3@localhost with grant option; -disconnect user2; -connect (user3,localhost,mysqltest_3,,); -connection user3; -select current_user(); -show grants for mysqltest_3@localhost; -disconnect user3; connect (root,localhost,root,,); connection root; +show grants for mysqltest_1@localhost; +show grants for mysqltest_2@localhost; +--error 1141 +show grants for mysqltest_3@localhost; delete from mysql.user where user like 'mysqltest\_%'; delete from mysql.db where user like 'mysqltest\_%'; flush privileges; diff --git a/mysys/mf_wcomp.c b/mysys/mf_wcomp.c index bdcfb0501d8..62a5a02eaea 100644 --- a/mysys/mf_wcomp.c +++ b/mysys/mf_wcomp.c @@ -23,11 +23,12 @@ char wild_many='*'; char wild_one='?'; -char wild_prefix=0; +char wild_prefix=0; /* QQ this can potentially cause a SIGSEGV */ -int wild_compare(register const char *str, register const char *wildstr) +int wild_compare(register const char *str, register const char *wildstr, + pbool str_is_pattern) { - reg3 int flag; + char cmp; DBUG_ENTER("wild_compare"); while (*wildstr) @@ -35,33 +36,55 @@ int wild_compare(register const char *str, register const char *wildstr) while (*wildstr && *wildstr != wild_many && *wildstr != wild_one) { if (*wildstr == wild_prefix && wildstr[1]) + { wildstr++; - if (*wildstr++ != *str++) DBUG_RETURN(1); + if (str_is_pattern && *str++ != wild_prefix) + DBUG_RETURN(1); + } + if (*wildstr++ != *str++) + DBUG_RETURN(1); } - if (! *wildstr ) DBUG_RETURN (*str != 0); + if (! *wildstr ) + DBUG_RETURN(*str != 0); if (*wildstr++ == wild_one) { - if (! *str++) DBUG_RETURN (1); /* One char; skipp */ + if (! *str || (str_is_pattern && *str == wild_many)) + DBUG_RETURN(1); /* One char; skipp */ + if (*str++ == wild_prefix && str_is_pattern && *str) + str++; } else { /* Found '*' */ - if (!*wildstr) DBUG_RETURN(0); /* '*' as last char: OK */ - flag=(*wildstr != wild_many && *wildstr != wild_one); - do + while (str_is_pattern && *str == wild_many) + str++; + for (; *wildstr == wild_many || *wildstr == wild_one; wildstr++) + if (*wildstr == wild_many) + { + while (str_is_pattern && *str == wild_many) + str++; + } + else + { + if (str_is_pattern && *str == wild_prefix && str[1]) + str+=2; + else if (! *str++) + DBUG_RETURN (1); + } + if (!*wildstr) + DBUG_RETURN(0); /* '*' as last char: OK */ + if ((cmp= *wildstr) == wild_prefix && wildstr[1] && !str_is_pattern) + cmp=wildstr[1]; + for(;;str++) { - if (flag) - { - char cmp; - if ((cmp= *wildstr) == wild_prefix && wildstr[1]) - cmp=wildstr[1]; - while (*str && *str != cmp) - str++; - if (!*str) DBUG_RETURN (1); - } - if (wild_compare(str,wildstr) == 0) DBUG_RETURN (0); - } while (*str++ && wildstr[0] != wild_many); + while (*str && *str != cmp) + str++; + if (!*str) + DBUG_RETURN (1); + if (wild_compare(str,wildstr,str_is_pattern) == 0) + DBUG_RETURN (0); + } DBUG_RETURN(1); } } - DBUG_RETURN (*str != '\0'); + DBUG_RETURN (*str != 0); } /* wild_compare */ diff --git a/mysys/mf_wfile.c b/mysys/mf_wfile.c index 3c10de1f238..b964d7ee494 100644 --- a/mysys/mf_wfile.c +++ b/mysys/mf_wfile.c @@ -99,7 +99,7 @@ int wf_test(register WF_PACK *wf_pack, register const char *name) not_pos=wf_pack->not_pos; for (i=0 ; i < not_pos; i++) - if (wild_compare(name,wf_pack->wild[i]) == 0) + if (wild_compare(name,wf_pack->wild[i],0) == 0) goto found; if (i) DBUG_RETURN(1); /* No-match */ @@ -108,7 +108,7 @@ found: /* Test that it isn't in not-list */ for (i=not_pos ; i < wf_pack->wilds; i++) - if (wild_compare(name,wf_pack->wild[i]) == 0) + if (wild_compare(name,wf_pack->wild[i],0) == 0) DBUG_RETURN(1); DBUG_RETURN(0); } /* wf_test */ diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 1bdca7167e8..5034aaf9bd6 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -877,7 +877,7 @@ static void acl_insert_db(const char *user, const char *host, const char *db, *****************************************************************************/ ulong acl_get(const char *host, const char *ip, const char *bin_ip, - const char *user, const char *db) + const char *user, const char *db, my_bool db_is_pattern) { ulong host_access,db_access; uint i,key_length; @@ -911,7 +911,7 @@ ulong acl_get(const char *host, const char *ip, const char *bin_ip, { if (compare_hostname(&acl_db->host,host,ip)) { - if (!acl_db->db || !wild_compare(db,acl_db->db)) + if (!acl_db->db || !wild_compare(db,acl_db->db,db_is_pattern)) { db_access=acl_db->access; if (acl_db->host.hostname) @@ -933,7 +933,7 @@ ulong acl_get(const char *host, const char *ip, const char *bin_ip, ACL_HOST *acl_host=dynamic_element(&acl_hosts,i,ACL_HOST*); if (compare_hostname(&acl_host->host,host,ip)) { - if (!acl_host->db || !wild_compare(db,acl_host->db)) + if (!acl_host->db || !wild_compare(db,acl_host->db,db_is_pattern)) { host_access=acl_host->access; // Fully specified. Take it break; @@ -1271,7 +1271,7 @@ static bool compare_hostname(const acl_host_and_ip *host, const char *hostname, return (!host->hostname || (hostname && !wild_case_compare(&my_charset_latin1, hostname,host->hostname)) || - (ip && !wild_compare(ip,host->hostname))); + (ip && !wild_compare(ip,host->hostname,0))); } @@ -1331,7 +1331,7 @@ static bool test_if_create_new_users(THD *thd) tl.db= (char*) "mysql"; tl.real_name= (char*) "user"; db_access=acl_get(thd->host, thd->ip, (char*) &thd->remote.sin_addr, - thd->priv_user, tl.db); + thd->priv_user, tl.db, 0); if (!(db_access & INSERT_ACL)) { if (check_grant(thd,INSERT_ACL,&tl,0,1)) diff --git a/sql/sql_acl.h b/sql/sql_acl.h index e6c6771253c..ca976f43999 100644 --- a/sql/sql_acl.h +++ b/sql/sql_acl.h @@ -134,7 +134,7 @@ my_bool acl_init(THD *thd, bool dont_read_acl_tables); void acl_reload(THD *thd); void acl_free(bool end=0); ulong acl_get(const char *host, const char *ip, const char *bin_ip, - const char *user, const char *db); + const char *user, const char *db, my_bool db_is_pattern); ulong acl_getroot(THD *thd, const char *host, const char *ip, const char *user, const char *password,const char *scramble, char **priv_user, char *priv_host, diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 641ab46e5e0..43368fe5433 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -148,7 +148,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild) if (wild) { strxmov(name,entry->table_cache_key,".",entry->real_name,NullS); - if (wild_compare(name,wild)) + if (wild_compare(name,wild,0)) continue; } diff --git a/sql/sql_db.cc b/sql/sql_db.cc index f8cf1eee0c5..844fd05aefa 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -591,7 +591,7 @@ bool mysql_change_db(THD *thd, const char *name) db_access=DB_ACLS; else db_access= (acl_get(thd->host,thd->ip,(char*) &thd->remote.sin_addr, - thd->priv_user,dbname) | + thd->priv_user,dbname,0) | thd->master_access); if (!(db_access & DB_ACLS) && (!grant_option || check_grant_db(thd,dbname))) { @@ -625,8 +625,8 @@ bool mysql_change_db(THD *thd, const char *name) strmov(path+unpack_dirname(path,path), MY_DB_OPT_FILE); load_db_opt(thd, path, &create); - thd->db_charset= create.table_charset ? - create.table_charset : + thd->db_charset= create.table_charset ? + create.table_charset : global_system_variables.character_set_database; thd->variables.character_set_database= thd->db_charset; DBUG_RETURN(0); @@ -644,18 +644,18 @@ int mysqld_show_create_db(THD *thd, char *dbname, uint create_options = create_info ? create_info->options : 0; Protocol *protocol=thd->protocol; DBUG_ENTER("mysql_show_create_db"); - + if (check_db_name(dbname)) { net_printf(thd,ER_WRONG_DB_NAME, dbname); DBUG_RETURN(1); } - + if (test_all_bits(thd->master_access,DB_ACLS)) db_access=DB_ACLS; else db_access= (acl_get(thd->host,thd->ip,(char*) &thd->remote.sin_addr, - thd->priv_user,dbname) | + thd->priv_user,dbname,0) | thd->master_access); if (!(db_access & DB_ACLS) && (!grant_option || check_grant_db(thd,dbname))) { @@ -669,7 +669,7 @@ int mysqld_show_create_db(THD *thd, char *dbname, dbname); DBUG_RETURN(1); } - + (void) sprintf(path,"%s/%s",mysql_data_home, dbname); length=unpack_dirname(path,path); // Convert if not unix found_libchar= 0; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 9e670a97e92..820bf3d73cc 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3254,7 +3254,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv, if (!(thd->master_access & SELECT_ACL) && (db && (!thd->db || strcmp(db,thd->db)))) db_access=acl_get(thd->host, thd->ip, (char*) &thd->remote.sin_addr, - thd->priv_user, db); /* purecov: inspected */ + thd->priv_user, db, test(want_access & GRANT_ACL)); *save_priv=thd->master_access | db_access; DBUG_RETURN(FALSE); } @@ -3274,7 +3274,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv, if (db && (!thd->db || strcmp(db,thd->db))) db_access=acl_get(thd->host, thd->ip, (char*) &thd->remote.sin_addr, - thd->priv_user, db); /* purecov: inspected */ + thd->priv_user, db, test(want_access & GRANT_ACL)); else db_access=thd->db_access; // Remove SHOW attribute and access rights we already have diff --git a/sql/sql_show.cc b/sql/sql_show.cc index e8cb59e387e..9084269f486 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -75,7 +75,7 @@ mysqld_show_dbs(THD *thd,const char *wild) { if (thd->master_access & (DB_ACLS | SHOW_DB_ACL) || acl_get(thd->host, thd->ip, (char*) &thd->remote.sin_addr, - thd->priv_user, file_name) || + thd->priv_user, file_name,0) || (grant_option && !check_grant_db(thd, file_name))) { protocol->prepare_for_resend(); @@ -415,7 +415,7 @@ mysql_find_files(THD *thd,List *files, const char *db,const char *path, #endif { if (file->name[0] == '.' || !MY_S_ISDIR(file->mystat.st_mode) || - (wild && wild_compare(file->name,wild))) + (wild && wild_compare(file->name,wild,0))) continue; } } @@ -433,7 +433,7 @@ mysql_find_files(THD *thd,List *files, const char *db,const char *path, if (wild_case_compare(system_charset_info,file->name,wild)) continue; } - else if (wild_compare(file->name,wild)) + else if (wild_compare(file->name,wild,0)) continue; } } @@ -1031,7 +1031,7 @@ store_create_info(THD *thd, TABLE *table, String *packet) my_bool limited_mysql_mode= (thd->variables.sql_mode & (MODE_NO_FIELD_OPTIONS | MODE_MYSQL323 | MODE_MYSQL40)) != 0; - + DBUG_ENTER("store_create_info"); DBUG_PRINT("enter",("table: %s",table->real_name)); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 709181af7fa..a5ac04dc775 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -547,7 +547,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token SUBJECT_SYM %token CIPHER_SYM -%token HELP %token BEFORE_SYM %left SET_VAR %left OR_OR_CONCAT OR From 38aa6d1c15e350e22ffbe041bc7fdf7ba5b5414b Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Jul 2003 18:58:30 -0400 Subject: [PATCH 27/54] fixed bug 663 and WL 1052 (sql_mode is safe for mysqldump) --- client/mysqldump.c | 13 +++++++++++++ mysql-test/r/auto_increment.result | 25 +++++++++++++++++++++++++ mysql-test/t/auto_increment.test | 14 ++++++++++++++ sql/field_conv.cc | 3 +++ sql/handler.cc | 5 ++++- sql/mysql_priv.h | 1 + sql/mysqld.cc | 2 +- sql/sql_base.cc | 9 ++++++++- sql/sql_insert.cc | 1 + sql/table.h | 1 + 10 files changed, 71 insertions(+), 3 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 82737836485..4eb6d74cdf1 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -352,6 +352,11 @@ static void write_header(FILE *sql_file, char *db_name) mysql_get_server_info(&mysql_connection)); if (!opt_set_names) fprintf(sql_file,"\n/*!40101 SET NAMES %s*/;\n",default_charset); + fprintf(md_result_file,"\ +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n\ +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n\ +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;\n\ +"); } return; } /* write_header */ @@ -361,6 +366,14 @@ static void write_footer(FILE *sql_file) { if (opt_xml) fprintf(sql_file,""); + else + { + fprintf(md_result_file,"\n +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;\n\ +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;\n\ +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;\n\ +"); + } fputs("\n", sql_file); } /* write_footer */ diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result index 19f8ffa84d4..99e5e596fd3 100644 --- a/mysql-test/r/auto_increment.result +++ b/mysql-test/r/auto_increment.result @@ -150,3 +150,28 @@ select last_insert_id(); last_insert_id() 0 drop table t1; +drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' +create table t1(a int auto_increment,b int null,primary key(a)); +SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO; +insert into t1(a,b)values(NULL,1); +insert into t1(a,b)values(200,2); +insert into t1(a,b)values(0,3); +insert into t1(b)values(4); +SET SQL_MODE=''; +insert into t1(a,b)values(NULL,5); +insert into t1(a,b)values(300,6); +insert into t1(a,b)values(0,7); +insert into t1(b)values(8); +select * from t1; +a b +1 1 +200 2 +0 3 +201 4 +202 5 +300 6 +301 7 +302 8 +drop table t1; diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test index 189320a8dcb..e187d42625e 100644 --- a/mysql-test/t/auto_increment.test +++ b/mysql-test/t/auto_increment.test @@ -106,3 +106,17 @@ select last_insert_id(); drop table t1; +drop table if exists t1; +create table t1(a int auto_increment,b int null,primary key(a)); +SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO; +insert into t1(a,b)values(NULL,1); +insert into t1(a,b)values(200,2); +insert into t1(a,b)values(0,3); +insert into t1(b)values(4); +SET SQL_MODE=''; +insert into t1(a,b)values(NULL,5); +insert into t1(a,b)values(300,6); +insert into t1(a,b)values(0,7); +insert into t1(b)values(8); +select * from t1; +drop table t1; diff --git a/sql/field_conv.cc b/sql/field_conv.cc index ec2488f520a..6e4d96ad5af 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -172,7 +172,10 @@ set_field_to_null_with_conversions(Field *field, bool no_conversions) } field->reset(); if (field == field->table->next_number_field) + { + field->table->auto_increment_field_is_null= true; return 0; // field is set in handler.cc + } if (current_thd->count_cuted_fields) { field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,ER_WARN_NULL_TO_NOTNULL); diff --git a/sql/handler.cc b/sql/handler.cc index 150a0d5329e..7f4b63e7551 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -697,7 +697,10 @@ void handler::update_auto_increment() longlong nr; THD *thd; DBUG_ENTER("update_auto_increment"); - if (table->next_number_field->val_int() != 0) + if (table->auto_increment_field_is_null) + table->auto_increment_field_is_null= false; + else if (table->next_number_field->val_int() != 0 || + current_thd->variables.sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO) { auto_increment_column_changed=0; DBUG_VOID_RETURN; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 5ad2cc56b8c..205617a910e 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -221,6 +221,7 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset; #define MODE_MYSQL323 32768 #define MODE_MYSQL40 65536 #define MODE_ANSI (MODE_MYSQL40*2) +#define MODE_NO_AUTO_VALUE_ON_ZERO (MODE_ANSI*2) #define RAID_BLOCK_SIZE 1024 diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 0a3985c3ee9..78c02df0daf 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -212,7 +212,7 @@ const char *sql_mode_names[] = "?", "ONLY_FULL_GROUP_BY", "NO_UNSIGNED_SUBTRACTION", "POSTGRESQL", "ORACLE", "MSSQL", "DB2", "SAPDB", "NO_KEY_OPTIONS", "NO_TABLE_OPTIONS", "NO_FIELD_OPTIONS", "MYSQL323", "MYSQL40", "ANSI", - NullS + "NO_AUTO_VALUE_ON_ZERO", NullS }; TYPELIB sql_mode_typelib= { array_elements(sql_mode_names)-1,"", sql_mode_names }; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 641ab46e5e0..a7798588d59 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2245,7 +2245,11 @@ fill_record(List &fields,List &values, bool ignore_errors) while ((field=(Item_field*) f++)) { value=v++; - if (value->save_in_field(field->field, 0) > 0 && !ignore_errors) + Field *rfield= field->field; + TABLE *table= rfield->table; + if (rfield==table->next_number_field) + table->auto_increment_field_is_null= false; + if (value->save_in_field(rfield, 0) > 0 && !ignore_errors) DBUG_RETURN(1); } DBUG_RETURN(0); @@ -2263,6 +2267,9 @@ fill_record(Field **ptr,List &values, bool ignore_errors) while ((field = *ptr++)) { value=v++; + TABLE *table= field->table; + if (field==table->next_number_field) + table->auto_increment_field_is_null= false; if (value->save_in_field(field, 0) == 1 && !ignore_errors) DBUG_RETURN(1); } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 091de9d406f..10f1a2587b4 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -253,6 +253,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, else bulk_insert=0; + table->auto_increment_field_is_null= true; while ((values= its++)) { if (fields.elements || !value_count) diff --git a/sql/table.h b/sql/table.h index 3132e72fb2f..8137f47aa1f 100644 --- a/sql/table.h +++ b/sql/table.h @@ -116,6 +116,7 @@ struct st_table { my_bool crashed; my_bool is_view; my_bool no_keyread; + my_bool auto_increment_field_is_null; Field *next_number_field, /* Set if next_number is activated */ *found_next_number_field, /* Set on open */ *rowid_field; From 41e77ddf657bd14a14ab7b48a4b2f8bad12b0d69 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Jul 2003 15:23:20 +0500 Subject: [PATCH 28/54] SCRUM - adding client into embedded server error handling fixed fetch_lengths made to work differently in embedded and client cases include/mysql.h: removed 'embedded' error containers - they're unnecessary now added declarations for fetch_lengths to be 'virtual' include/sql_common.h: fetch_lengths declaration removed libmysql/libmysql.c: implementations for fetch_lengths to be 'virtual' added libmysqld/lib_sql.cc: error informations now is moved from thd->net to mysql-net libmysqld/libmysqld.c: error data is in mysql->net now sql-common/client.c: we have to return old fetch_lengths implementation for 'client' case sql/protocol.cc: handling of sqlstate for embedded library added --- include/mysql.h | 5 ++--- include/sql_common.h | 1 - libmysql/libmysql.c | 5 ++++- libmysqld/lib_sql.cc | 10 +++++++--- libmysqld/libmysqld.c | 35 +++++++++++++++++++++++++++-------- sql-common/client.c | 29 +++++++++++++++++++++++------ sql/protocol.cc | 2 ++ 7 files changed, 65 insertions(+), 22 deletions(-) diff --git a/include/mysql.h b/include/mysql.h index 58391d615d2..719cf800234 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -250,9 +250,6 @@ typedef struct st_mysql const struct st_mysql_methods *methods; struct st_mysql_res *result; void *thd; - unsigned int last_errno; - char *last_error; - char sqlstate[SQLSTATE_LENGTH+1]; /* Used by embedded server */ } MYSQL; typedef struct st_mysql_res { @@ -267,6 +264,7 @@ typedef struct st_mysql_res { MYSQL_ROW row; /* If unbuffered read */ MYSQL_ROW current_row; /* buffer to current row */ my_bool eof; /* Used by mysql_fetch_row */ + const struct st_mysql_methods *methods; } MYSQL_RES; #define MAX_MYSQL_MANAGER_ERR 256 @@ -552,6 +550,7 @@ typedef struct st_mysql_methods ulong arg_length, my_bool skip_check); MYSQL_RES * STDCALL (*store_result)(MYSQL *mysql); MYSQL_RES * STDCALL (*use_result)(MYSQL *mysql); + void STDCALL (*fetch_lengths)(ulong *to, MYSQL_ROW column, uint field_count); } MYSQL_METHODS; MYSQL_STMT * STDCALL mysql_prepare(MYSQL * mysql, const char *query, diff --git a/include/sql_common.h b/include/sql_common.h index cd1d2331d96..9fea46be298 100644 --- a/include/sql_common.h +++ b/include/sql_common.h @@ -31,7 +31,6 @@ void free_rows(MYSQL_DATA *cur); MYSQL_DATA *read_rows (MYSQL *mysql,MYSQL_FIELD *fields, uint field_count); my_bool mysql_autenticate(MYSQL *mysql, const char *passwd); -void fetch_lengths(ulong *to, MYSQL_ROW column, uint field_count); void free_old_query(MYSQL *mysql); void end_server(MYSQL *mysql); my_bool mysql_reconnect(MYSQL *mysql); diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index a90fb2f1205..d75f217585d 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -868,7 +868,7 @@ mysql_fetch_lengths(MYSQL_RES *res) if (!(column=res->current_row)) return 0; /* Something is wrong */ if (res->data) - fetch_lengths(res->lengths, column, res->field_count); + (*res->methods->fetch_lengths)(res->lengths, column, res->field_count); return res->lengths; } @@ -979,6 +979,7 @@ mysql_list_fields(MYSQL *mysql, const char *table, const char *wild) free_rows(query); DBUG_RETURN(NULL); } + result->methods= mysql->methods; result->field_alloc=mysql->field_alloc; mysql->fields=0; result->field_count = (uint) query->rows; @@ -1704,6 +1705,7 @@ mysql_prepare_result(MYSQL_STMT *stmt) MYF(MY_WME | MY_ZEROFILL)))) return 0; + result->methods= stmt->mysql->methods; result->eof=1; /* Marker for buffered */ result->fields= stmt->fields; result->field_count= stmt->field_count; @@ -3193,6 +3195,7 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt) set_stmt_error(stmt, CR_OUT_OF_MEMORY, unknown_sqlstate); DBUG_RETURN(1); } + result->methods= mysql->methods; stmt->result_buffered= 1; if (!(result->data= read_binary_rows(stmt))) { diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index f7b69b51d46..6d7b71c61be 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -76,8 +76,13 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command, if (!skip_check) result= thd->net.last_errno ? -1 : 0; - mysql->last_error= thd->net.last_error; - mysql->net.last_errno= thd->net.last_errno; + if ((mysql->net.last_errno= thd->net.last_errno)) + { + memcpy(mysql->net.last_error, thd->net.last_error, + sizeof(mysql->net.last_error)); + memcpy(mysql->net.sqlstate, thd->net.sqlstate, + sizeof(mysql->net.sqlstate)); + } mysql->warning_count= ((THD*)mysql->thd)->total_warn_count; return result; } @@ -292,7 +297,6 @@ void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db) { THD *thd = (THD *)mysql->thd; thd->mysql= mysql; - mysql->last_error= thd->net.last_error; } void *create_embedded_thd(int client_flag, char *db) diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index b6278ab3c0b..357c13c5826 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -144,25 +144,42 @@ static inline int mysql_init_charset(MYSQL *mysql) if (!mysql->charset) { - mysql->last_errno=CR_CANT_READ_CHARSET; - strmov(mysql->sqlstate, "HY0000"); + mysql->net.last_errno=CR_CANT_READ_CHARSET; + strmov(mysql->net.sqlstate, "HY0000"); if (mysql->options.charset_dir) - sprintf(mysql->last_error,ER(mysql->last_errno), + sprintf(mysql->net.last_error,ER(mysql->net.last_errno), charset_name ? charset_name : "unknown", mysql->options.charset_dir); else { char cs_dir_name[FN_REFLEN]; get_charsets_dir(cs_dir_name); - sprintf(mysql->last_error,ER(mysql->last_errno), + sprintf(mysql->net.last_error,ER(mysql->net.last_errno), charset_name ? charset_name : "unknown", cs_dir_name); } - return mysql->last_errno; + return mysql->net.last_errno; } return 0; } +/************************************************************************** + Get column lengths of the current row + If one uses mysql_use_result, res->lengths contains the length information, + else the lengths are calculated from the offset between pointers. +**************************************************************************/ + +static void emb_fetch_lengths(ulong *to, MYSQL_ROW column, uint field_count) +{ + MYSQL_ROW end; + + for (end=column + field_count; column != end ; column++,to++) + { + *to= *column ? strlen(*column) : 0; + } +} + + /* ** Note that the mysql argument must be initialized with mysql_init() ** before calling mysql_real_connect ! @@ -178,6 +195,7 @@ static MYSQL_METHODS embedded_methods= emb_advanced_command, emb_mysql_store_result, emb_mysql_use_result, + emb_fetch_lengths }; MYSQL * STDCALL @@ -259,7 +277,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, DBUG_RETURN(mysql); error: - DBUG_PRINT("error",("message: %u (%s)",mysql->last_errno,mysql->last_error)); + DBUG_PRINT("error",("message: %u (%s)",mysql->net.last_errno,mysql->net.last_error)); { /* Free alloced memory */ my_bool free_me=mysql->free_me; @@ -320,7 +338,7 @@ void STDCALL mysql_close(MYSQL *mysql) static my_bool STDCALL emb_mysql_read_query_result(MYSQL *mysql) { - if (mysql->last_errno) + if (mysql->net.last_errno) return -1; if (mysql->field_count) @@ -342,7 +360,8 @@ static MYSQL_RES * STDCALL emb_mysql_store_result(MYSQL *mysql) MYSQL_RES *result= mysql->result; if (!result) return 0; - + + result->methods= mysql->methods; mysql->result= NULL; *result->data->prev_ptr= 0; result->eof= 1; diff --git a/sql-common/client.c b/sql-common/client.c index 7c0de2dba73..58d82b5b801 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -965,11 +965,25 @@ void mysql_read_default_options(struct st_mysql_options *options, else the lengths are calculated from the offset between pointers. **************************************************************************/ -void fetch_lengths(ulong *to, MYSQL_ROW column, uint field_count) +static void cli_fetch_lengths(ulong *to, MYSQL_ROW column, uint field_count) { + ulong *prev_length; + byte *start=0; MYSQL_ROW end; - for (end=column + field_count; column != end ; column++, to++) - *to= *column ? strlen(*column) : 0; + + prev_length=0; /* Keep gcc happy */ + for (end=column + field_count + 1 ; column != end ; column++, to++) + { + if (!*column) + { + *to= 0; /* Null */ + continue; + } + if (start) /* Found end of prev string */ + *prev_length= (ulong) (*column-start-1); + start= *column; + prev_length= to; + } } /*************************************************************************** @@ -999,7 +1013,7 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, for (row=data->data; row ; row = row->next,field++) { uchar *pos; - fetch_lengths(&lengths[0], row->data, default_value ? 8 : 7); + cli_fetch_lengths(&lengths[0], row->data, default_value ? 8 : 7); field->catalog = strdup_root(alloc,(char*) row->data[0]); field->db = strdup_root(alloc,(char*) row->data[1]); field->table = strdup_root(alloc,(char*) row->data[2]); @@ -1040,7 +1054,7 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, /* old protocol, for backward compatibility */ for (row=data->data; row ; row = row->next,field++) { - fetch_lengths(&lengths[0], row->data, default_value ? 6 : 5); + cli_fetch_lengths(&lengths[0], row->data, default_value ? 6 : 5); field->org_table= field->table= strdup_root(alloc,(char*) row->data[0]); field->name= strdup_root(alloc,(char*) row->data[1]); field->length= (uint) uint3korr(row->data[2]); @@ -1418,7 +1432,8 @@ static MYSQL_METHODS client_methods= cli_mysql_read_query_result, cli_advanced_command, cli_mysql_store_result, - cli_mysql_use_result + cli_mysql_use_result, + cli_fetch_lengths }; MYSQL * STDCALL @@ -2320,6 +2335,7 @@ static MYSQL_RES * STDCALL cli_mysql_store_result(MYSQL *mysql) strmov(mysql->net.last_error, ER(mysql->net.last_errno)); DBUG_RETURN(0); } + result->methods= mysql->methods; result->eof=1; /* Marker for buffered */ result->lengths=(ulong*) (result+1); if (!(result->data=read_rows(mysql,mysql->fields,mysql->field_count))) @@ -2370,6 +2386,7 @@ static MYSQL_RES * STDCALL cli_mysql_use_result(MYSQL *mysql) MYF(MY_WME | MY_ZEROFILL)))) DBUG_RETURN(0); result->lengths=(ulong*) (result+1); + result->methods= mysql->methods; if (!(result->row=(MYSQL_ROW) my_malloc(sizeof(result->row[0])*(mysql->field_count+1), MYF(MY_WME)))) { /* Ptrs: to one row */ diff --git a/sql/protocol.cc b/sql/protocol.cc index b695409ec61..e90aa7585e2 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -83,6 +83,7 @@ void send_error(THD *thd, uint sql_errno, const char *err) #ifdef EMBEDDED_LIBRARY net->last_errno= sql_errno; strmake(net->last_error, err, sizeof(net->last_error)-1); + strmov(net->sqlstate, mysql_errno_to_sqlstate(sql_errno)); #else if (net->vio == 0) @@ -230,6 +231,7 @@ net_printf(THD *thd, uint errcode, ...) #else net->last_errno= errcode; strmake(net->last_error, text_pos, length); + strmake(net->sqlstate, mysql_errno_to_sqlstate(errcode), SQLSTATE_LENGTH); #endif thd->is_fatal_error=0; // Error message is given DBUG_VOID_RETURN; From dae34fb60f81802853961efad3edfa3427215680 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Jul 2003 15:46:46 +0200 Subject: [PATCH 29/54] On Feb 4th, 2003, Monty said he would push my patch to print replicate-do-table and other replicate-*-table options in SHOW SLAVE STATUS. Seems like it had not been done, so I push it now: there's 4 new columns to SHOW SLAVE STATUS. mysql-test/r/rpl000015.result: Result update (more columns) mysql-test/r/rpl_empty_master_crash.result: Result update (more columns) mysql-test/r/rpl_flush_log_loop.result: Result update (more columns) mysql-test/r/rpl_log.result: Result update (more columns) mysql-test/r/rpl_log_pos.result: Result update (more columns) mysql-test/r/rpl_redirect.result: Result update (more columns) mysql-test/r/rpl_replicate_do.result: Result update (more columns) mysql-test/r/rpl_rotate_logs.result: Result update (more columns) mysql-test/t/rpl_replicate_do.test: Result update (more columns) sql/slave.cc: Print replicate_*_table options in SHOW SLAVE STATUS sql/slave.h: two functions to make a string of replicate_*_table lists. --- mysql-test/r/rpl000015.result | 14 ++--- mysql-test/r/rpl_empty_master_crash.result | 2 +- mysql-test/r/rpl_flush_log_loop.result | 4 +- mysql-test/r/rpl_log.result | 4 +- mysql-test/r/rpl_log_pos.result | 16 +++--- mysql-test/r/rpl_redirect.result | 2 +- mysql-test/r/rpl_replicate_do.result | 3 ++ mysql-test/r/rpl_rotate_logs.result | 12 ++--- mysql-test/t/rpl_replicate_do.test | 4 ++ sql/slave.cc | 63 ++++++++++++++++++++++ sql/slave.h | 2 + 11 files changed, 99 insertions(+), 27 deletions(-) diff --git a/mysql-test/r/rpl000015.result b/mysql-test/r/rpl000015.result index 349365e17ad..047f1ac5044 100644 --- a/mysql-test/r/rpl000015.result +++ b/mysql-test/r/rpl000015.result @@ -4,20 +4,20 @@ File Position Binlog_do_db Binlog_ignore_db master-bin.000001 79 reset slave; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space change master to master_host='127.0.0.1'; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 test MASTER_PORT 7 4 slave-relay-bin.000001 4 No No 0 0 0 4 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 test MASTER_PORT 7 4 slave-relay-bin.000001 4 No No 0 0 0 4 change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=MASTER_PORT; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 7 4 slave-relay-bin.000001 4 No No 0 0 0 4 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 7 4 slave-relay-bin.000001 4 No No 0 0 0 4 start slave; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 7 master-bin.000001 79 slave-relay-bin.000001 123 master-bin.000001 Yes Yes 0 0 79 123 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 7 master-bin.000001 79 slave-relay-bin.000001 123 master-bin.000001 Yes Yes 0 0 79 123 drop table if exists t1; create table t1 (n int); insert into t1 values (10),(45),(90); diff --git a/mysql-test/r/rpl_empty_master_crash.result b/mysql-test/r/rpl_empty_master_crash.result index 39ab1c2d9b4..6aac1cbfc91 100644 --- a/mysql-test/r/rpl_empty_master_crash.result +++ b/mysql-test/r/rpl_empty_master_crash.result @@ -5,7 +5,7 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space load table t1 from master; ERROR 08S01: Error connecting to master: Master is not configured load table t1 from master; diff --git a/mysql-test/r/rpl_flush_log_loop.result b/mysql-test/r/rpl_flush_log_loop.result index 98d661e9af2..954ab107123 100644 --- a/mysql-test/r/rpl_flush_log_loop.result +++ b/mysql-test/r/rpl_flush_log_loop.result @@ -13,5 +13,5 @@ master_password='',master_port=SLAVE_PORT; start slave; flush logs; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 79 relay-log.000001 122 slave-bin.000001 Yes Yes 0 0 79 122 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 79 relay-log.000001 122 slave-bin.000001 Yes Yes 0 0 79 122 diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result index df2ef4e3d8a..050e9274a99 100644 --- a/mysql-test/r/rpl_log.result +++ b/mysql-test/r/rpl_log.result @@ -92,7 +92,7 @@ slave-bin.000002 4 Query 1 110 use `test`; create table t1 (n int) slave-bin.000002 62 Query 1 168 use `test`; insert into t1 values (1) slave-bin.000002 122 Query 1 228 use `test`; drop table t1 show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.000002 276 slave-relay-bin.000002 1531 master-bin.000002 Yes Yes 0 0 276 1535 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.000002 276 slave-relay-bin.000002 1531 master-bin.000002 Yes Yes 0 0 276 1535 show binlog events in 'slave-bin.000005' from 4; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log diff --git a/mysql-test/r/rpl_log_pos.result b/mysql-test/r/rpl_log_pos.result index fa38e42ae73..b42e7ff5dc4 100644 --- a/mysql-test/r/rpl_log_pos.result +++ b/mysql-test/r/rpl_log_pos.result @@ -8,26 +8,26 @@ show master status; File Position Binlog_do_db Binlog_ignore_db master-bin.000001 79 show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 127 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 127 stop slave; change master to master_log_pos=73; start slave; stop slave; change master to master_log_pos=73; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 73 4 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 73 4 start slave; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 4 master-bin.000001 No Yes 0 0 73 4 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 4 master-bin.000001 No Yes 0 0 73 4 stop slave; change master to master_log_pos=173; start slave; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.000001 173 slave-relay-bin.000001 4 master-bin.000001 No Yes 0 0 173 4 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.000001 173 slave-relay-bin.000001 4 master-bin.000001 No Yes 0 0 173 4 show master status; File Position Binlog_do_db Binlog_ignore_db master-bin.000001 79 diff --git a/mysql-test/r/rpl_redirect.result b/mysql-test/r/rpl_redirect.result index 3807479fb54..79ff6685706 100644 --- a/mysql-test/r/rpl_redirect.result +++ b/mysql-test/r/rpl_redirect.result @@ -5,7 +5,7 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; SHOW SLAVE STATUS; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space SHOW SLAVE HOSTS; Server_id Host Port Rpl_recovery_rank Master_id 2 127.0.0.1 SLAVE_PORT 2 1 diff --git a/mysql-test/r/rpl_replicate_do.result b/mysql-test/r/rpl_replicate_do.result index a91a0a2b819..4d740cafbd0 100644 --- a/mysql-test/r/rpl_replicate_do.result +++ b/mysql-test/r/rpl_replicate_do.result @@ -26,3 +26,6 @@ n select * from t11; ERROR 42S02: Table 'test.t11' doesn't exist drop table if exists t1,t2,t11; +show slave status; +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.000001 1281 slave-relay-bin.000002 1325 master-bin.000001 Yes Yes test.t1 0 0 1281 1329 diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result index c3c83947578..753edebea60 100644 --- a/mysql-test/r/rpl_rotate_logs.result +++ b/mysql-test/r/rpl_rotate_logs.result @@ -15,8 +15,8 @@ insert into temp_table values ("testing temporary tables"); create table t1 (s text); insert into t1 values('Could not break slave'),('Tried hard'); show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 60 master-bin.000001 417 slave-relay-bin.000001 461 master-bin.000001 Yes Yes 0 0 417 461 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 60 master-bin.000001 417 slave-relay-bin.000001 461 master-bin.000001 Yes Yes 0 0 417 461 select * from t1; s Could not break slave @@ -56,8 +56,8 @@ Log_name master-bin.000003 insert into t2 values (65); show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 60 master-bin.000003 290 slave-relay-bin.000001 1088 master-bin.000003 Yes Yes 0 0 290 1088 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 60 master-bin.000003 290 slave-relay-bin.000001 1088 master-bin.000003 Yes Yes 0 0 290 1088 select * from t2; m 34 @@ -82,8 +82,8 @@ select * from t4; a testing temporary tables part 2 show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 60 master-bin.000006 838 slave-relay-bin.000001 8067 master-bin.000006 Yes Yes 0 0 838 8067 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 60 master-bin.000006 838 slave-relay-bin.000001 8067 master-bin.000006 Yes Yes 0 0 838 8067 lock tables t3 read; select count(*) from t3 where n >= 4; count(*) diff --git a/mysql-test/t/rpl_replicate_do.test b/mysql-test/t/rpl_replicate_do.test index dcb3c5034fd..a1ce8d8a645 100644 --- a/mysql-test/t/rpl_replicate_do.test +++ b/mysql-test/t/rpl_replicate_do.test @@ -31,3 +31,7 @@ drop table if exists t1,t2,t11; save_master_pos; connection slave; sync_with_master; +# show slave status, just to see of it prints replicate-do-table +--replace_result $MASTER_MYPORT MASTER_PORT +show slave status; + diff --git a/sql/slave.cc b/sql/slave.cc index c45c11f8bef..37979576b73 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1565,6 +1565,48 @@ int register_slave_on_master(MYSQL* mysql) } +/* + Builds a String from a HASH of TABLE_RULE_ENT. Cannot be used for any other + hash, as it assumes that the hash entries are TABLE_RULE_ENT. + + SYNOPSIS + table_rule_ent_hash_to_str() + s pointer to the String to fill + h pointer to the HASH to read + + RETURN VALUES + none +*/ + +void table_rule_ent_hash_to_str(String* s, HASH* h) +{ + s->length(0); + for (uint i=0 ; i < h->records ; i++) + { + TABLE_RULE_ENT* e= (TABLE_RULE_ENT*) hash_element(h, i); + if (s->length()) + s->append(','); + s->append(e->db,e->key_len); + } +} + +/* + Mostly the same thing as above +*/ + +void table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a) +{ + s->length(0); + for (uint i=0 ; i < a->elements ; i++) + { + TABLE_RULE_ENT* e; + get_dynamic(a, (gptr)&e, i); + if (s->length()) + s->append(','); + s->append(e->db,e->key_len); + } +} + int show_master_info(THD* thd, MASTER_INFO* mi) { // TODO: fix this for multi-master @@ -1594,6 +1636,10 @@ int show_master_info(THD* thd, MASTER_INFO* mi) field_list.push_back(new Item_empty_string("Slave_SQL_Running", 3)); field_list.push_back(new Item_empty_string("Replicate_do_db", 20)); field_list.push_back(new Item_empty_string("Replicate_ignore_db", 20)); + field_list.push_back(new Item_empty_string("Replicate_do_table", 20)); + field_list.push_back(new Item_empty_string("Replicate_ignore_table", 23)); + field_list.push_back(new Item_empty_string("Replicate_wild_do_table", 24)); + field_list.push_back(new Item_empty_string("Replicate_wild_ignore_table", 28)); field_list.push_back(new Item_return_int("Last_errno", 4, MYSQL_TYPE_LONG)); field_list.push_back(new Item_empty_string("Last_error", 20)); field_list.push_back(new Item_return_int("Skip_counter", 10, @@ -1626,6 +1672,23 @@ int show_master_info(THD* thd, MASTER_INFO* mi) protocol->store(mi->rli.slave_running ? "Yes":"No", &my_charset_bin); protocol->store(&replicate_do_db); protocol->store(&replicate_ignore_db); + /* + We can't directly use some protocol->store for + replicate_*_table, + as Protocol doesn't know the TABLE_RULE_ENT struct. + We first build Strings and then pass them to protocol->store. + */ + char buf[256]; + String tmp(buf, sizeof(buf), &my_charset_bin); + table_rule_ent_hash_to_str(&tmp, &replicate_do_table); + protocol->store(&tmp); + table_rule_ent_hash_to_str(&tmp, &replicate_ignore_table); + protocol->store(&tmp); + table_rule_ent_dynamic_array_to_str(&tmp, &replicate_wild_do_table); + protocol->store(&tmp); + table_rule_ent_dynamic_array_to_str(&tmp, &replicate_wild_ignore_table); + protocol->store(&tmp); + protocol->store((uint32) mi->rli.last_slave_errno); protocol->store(mi->rli.last_slave_error, &my_charset_bin); protocol->store((uint32) mi->rli.slave_skip_counter); diff --git a/sql/slave.h b/sql/slave.h index 429456eb0bb..668fff52d08 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -398,6 +398,8 @@ int mysql_table_dump(THD* thd, const char* db, int fetch_master_table(THD* thd, const char* db_name, const char* table_name, MASTER_INFO* mi, MYSQL* mysql); +void table_rule_ent_hash_to_str(String* s, HASH* h); +void table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a); int show_master_info(THD* thd, MASTER_INFO* mi); int show_binlog_info(THD* thd); From 3be8c60c25aa7660ccb373a50fbc8c4748ec2ab4 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Jul 2003 16:48:45 +0200 Subject: [PATCH 30/54] temporary modification of rpl_loaddata.test until 4.0 is merged in 4.1. This is to avoid a test failure, which is fixed in 4.0 in ChangeSet@1.1455.34.1, 2003-06-10 23:29:49+02:00, guilhem@mysql.com by making RESET SLAVE reset the error. mysql-test/r/rpl_loaddata.result: temporary modification until 4.0 is merged in 4.1 mysql-test/t/rpl_loaddata.test: temporary modification until 4.0 is merged in 4.1 --- mysql-test/r/rpl_loaddata.result | 4 ---- mysql-test/t/rpl_loaddata.test | 25 ++++++++++++++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result index f4b003d6cc3..ec9011d573f 100644 --- a/mysql-test/r/rpl_loaddata.result +++ b/mysql-test/r/rpl_loaddata.result @@ -24,7 +24,3 @@ drop table t2; drop table t3; create table t1(a int, b int, unique(b)); insert into t1 values(1,10); -load data infile '../../std_data/rpl_loaddata.dat' into table t1; -show status like 'slave_running'; -Variable_name Value -Slave_running OFF diff --git a/mysql-test/t/rpl_loaddata.test b/mysql-test/t/rpl_loaddata.test index dc4eadda192..b540c3907e9 100644 --- a/mysql-test/t/rpl_loaddata.test +++ b/mysql-test/t/rpl_loaddata.test @@ -37,14 +37,21 @@ connection slave; sync_with_master; insert into t1 values(1,10); -connection master; -load data infile '../../std_data/rpl_loaddata.dat' into table t1; -save_master_pos; -connection slave; -# don't sync_with_master because the slave SQL thread should be stopped because -# of the error so MASTER_POS_WAIT() will not return; just sleep and hope the -# slave SQL thread will have had time to stop. +# NOTE UNTIL MERGE 4.0 INTO 4.1 +# Below we generate an error, but this error shows up in SHOW SLAVE STATUS +# in the next test. In 4.0 this is fixed (RESET SLAVE resets the error), but it +# has not been merged into 4.1 yet. So for the moment, I comment all lines +# below, to not generate the error, so that the test suite passes. +# When you do the 4.0 -> 4.1 merge, please remove this note and re-enable the +# error generation, by deleting the '#' characters below, and update the result. +# The changeset to merge in 4.1 is +# ChangeSet@1.1455.34.1, 2003-06-10 23:29:49+02:00, guilhem@mysql.com -sleep 1; -show status like 'slave_running'; +#connection master; +#load data infile '../../std_data/rpl_loaddata.dat' into table t1; + +#save_master_pos; +#connection slave; +# The SQL slave thread should be stopped now. +#wait_for_slave_to_stop; From af8d09ff476494e262354cebed5dd9462877d75e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Jul 2003 18:50:18 +0400 Subject: [PATCH 31/54] Fix security bug. mysqld server without ssl support was completly ignorant about ssl_type attribute sql/sql_acl.cc: Now acl_getroot() honors ssl_type attribute even if we compile without openssl BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + sql/sql_acl.cc | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 794edcdd968..58286f16f5c 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -20,6 +20,7 @@ bk@admin.bk bk@mysql.r18.ru carsten@tsort.bitbybit.dk davida@isil.mysql.com +dlenev@mysql.com gluh@gluh.(none) gluh@gluh.mysql.r18.ru greg@mysql.com diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 1bdca7167e8..51c05ccbf33 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -590,7 +590,6 @@ ulong acl_getroot(THD *thd, const char *host, const char *ip, const char *user, /* OK. User found and password checked continue validation */ -#ifdef HAVE_OPENSSL { Vio *vio=thd->net.vio; /* @@ -604,6 +603,7 @@ ulong acl_getroot(THD *thd, const char *host, const char *ip, const char *user, case SSL_TYPE_NONE: /* SSL is not required to connect */ user_access=acl_user->access; break; +#ifdef HAVE_OPENSSL case SSL_TYPE_ANY: /* Any kind of SSL is good enough */ if (vio_type(vio) == VIO_TYPE_SSL) user_access=acl_user->access; @@ -686,11 +686,17 @@ ulong acl_getroot(THD *thd, const char *host, const char *ip, const char *user, free(ptr); } break; +#else /* HAVE_OPENSSL */ + default: + /* + If we don't have SSL but SSL is required for this user the + authentication should fail. + */ + break; +#endif /* HAVE_OPENSSL */ } } -#else /* HAVE_OPENSSL */ - user_access=acl_user->access; -#endif /* HAVE_OPENSSL */ + *mqh=acl_user->user_resource; if (!acl_user->user) *priv_user=(char*) ""; // Change to anonymous user /* purecov: inspected */ From 3a8d1c3cd0ca081882a97c252e3a9ecebc36a8fb Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 24 Jul 2003 12:43:57 -0500 Subject: [PATCH 32/54] Print accounts in error messages as 'user'@'host' rather than 'user@host'. The latter is misleading because differs from the syntax used for GRANT/REVOKE. Fix up test result affected by error message edits. mysql-test/r/grant_cache.result: Fix up test result to match error message edit. sql/share/czech/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/danish/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/dutch/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/english/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/estonian/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/french/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/german/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/greek/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/hungarian/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/italian/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/japanese/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/korean/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/norwegian-ny/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/norwegian/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/polish/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/portuguese/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/romanian/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/russian/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/serbian/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/slovak/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/spanish/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/swedish/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. sql/share/ukrainian/errmsg.txt: Print user@host in syntax actually used for GRANT/REVOKE. --- mysql-test/r/grant_cache.result | 10 +++++----- sql/share/czech/errmsg.txt | 10 +++++----- sql/share/danish/errmsg.txt | 10 +++++----- sql/share/dutch/errmsg.txt | 10 +++++----- sql/share/english/errmsg.txt | 10 +++++----- sql/share/estonian/errmsg.txt | 10 +++++----- sql/share/french/errmsg.txt | 10 +++++----- sql/share/german/errmsg.txt | 10 +++++----- sql/share/greek/errmsg.txt | 10 +++++----- sql/share/hungarian/errmsg.txt | 10 +++++----- sql/share/italian/errmsg.txt | 10 +++++----- sql/share/japanese/errmsg.txt | 10 +++++----- sql/share/korean/errmsg.txt | 10 +++++----- sql/share/norwegian-ny/errmsg.txt | 10 +++++----- sql/share/norwegian/errmsg.txt | 10 +++++----- sql/share/polish/errmsg.txt | 10 +++++----- sql/share/portuguese/errmsg.txt | 10 +++++----- sql/share/romanian/errmsg.txt | 10 +++++----- sql/share/russian/errmsg.txt | 10 +++++----- sql/share/serbian/errmsg.txt | 10 +++++----- sql/share/slovak/errmsg.txt | 10 +++++----- sql/share/spanish/errmsg.txt | 10 +++++----- sql/share/swedish/errmsg.txt | 10 +++++----- sql/share/ukrainian/errmsg.txt | 10 +++++----- 24 files changed, 120 insertions(+), 120 deletions(-) diff --git a/mysql-test/r/grant_cache.result b/mysql-test/r/grant_cache.result index c8ae0b4d9b3..3edaa003b60 100644 --- a/mysql-test/r/grant_cache.result +++ b/mysql-test/r/grant_cache.result @@ -84,7 +84,7 @@ a b c a 1 1 1 test.t1 2 2 2 test.t1 select * from t2; -ERROR 42000: select command denied to user: 'mysqltest_2@localhost' for table 't2' +ERROR 42000: select command denied to user: 'mysqltest_2'@'localhost' for table 't2' show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 6 @@ -98,17 +98,17 @@ select "user3"; user3 user3 select * from t1; -ERROR 42000: select command denied to user: 'mysqltest_3@localhost' for column 'b' in table 't1' +ERROR 42000: select command denied to user: 'mysqltest_3'@'localhost' for column 'b' in table 't1' select a from t1; a 1 2 select c from t1; -ERROR 42000: SELECT command denied to user: 'mysqltest_3@localhost' for column 'c' in table 't1' +ERROR 42000: SELECT command denied to user: 'mysqltest_3'@'localhost' for column 'c' in table 't1' select * from t2; -ERROR 42000: select command denied to user: 'mysqltest_3@localhost' for table 't2' +ERROR 42000: select command denied to user: 'mysqltest_3'@'localhost' for table 't2' select mysqltest.t1.c from test.t1,mysqltest.t1; -ERROR 42000: SELECT command denied to user: 'mysqltest_3@localhost' for column 'c' in table 't1' +ERROR 42000: SELECT command denied to user: 'mysqltest_3'@'localhost' for column 'c' in table 't1' show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 6 diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index 6f42243ba2b..18f0a4a1193 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -54,8 +54,8 @@ v/* "M-Bálo prostoru/pamìti pro thread", "Nemohu zjistit jm-Béno stroje pro Va¹i adresu", "Chyba p-Bøi ustavování spojení", -"P-Bøístup pro u¾ivatele '%-.32s@%-.64s' k databázi '%-.64s' není povolen", -"P-Bøístup pro u¾ivatele '%-.32s@%-.64s' (s heslem %s)", +"P-Bøístup pro u¾ivatele '%-.32s'@'%-.64s' k databázi '%-.64s' není povolen", +"P-Bøístup pro u¾ivatele '%-.32s'@'%-.64s' (s heslem %s)", "Nebyla vybr-Bána ¾ádná databáze", "Nezn-Bámý pøíkaz", "Sloupec '%-.64s' nem-Bù¾e být null", @@ -152,8 +152,8 @@ v/* "Regul-Bární výraz vrátil chybu '%-.64s'", "Pokud nen-Bí ¾ádná GROUP BY klauzule, není dovoleno souèasné pou¾ití GROUP polo¾ek (MIN(),MAX(),COUNT()...) s ne GROUP polo¾kami", "Neexistuje odpov-Bídající grant pro u¾ivatele '%-.32s' na stroji '%-.64s'", -"%-.16s p-Bøíkaz nepøístupný pro u¾ivatele: '%-.32s@%-.64s' pro tabulku '%-.64s'", -"%-.16s p-Bøíkaz nepøístupný pro u¾ivatele: '%-.32s@%-.64s' pro sloupec '%-.64s' v tabulce '%-.64s'", +"%-.16s p-Bøíkaz nepøístupný pro u¾ivatele: '%-.32s'@'%-.64s' pro tabulku '%-.64s'", +"%-.16s p-Bøíkaz nepøístupný pro u¾ivatele: '%-.32s'@'%-.64s' pro sloupec '%-.64s' v tabulce '%-.64s'", "Neplatn-Bý pøíkaz GRANT/REVOKE. Prosím, pøeètìte si v manuálu, jaká privilegia je mo¾né pou¾ít.", "Argument p-Bøíkazu GRANT u¾ivatel nebo stroj je pøíli¹ dlouhý", "Tabulka '%-.64s.%s' neexistuje", @@ -221,7 +221,7 @@ v/* "DROP DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock", "Wrong arguments to %s", -"%-.32s@%-.64s is not allowed to create new users", +"'%-.32s'@'%-.64s' is not allowed to create new users", "Incorrect table definition; all MERGE tables must be in the same database", "Deadlock found when trying to get lock; Try restarting transaction", "The used table type doesn't support FULLTEXT indexes", diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index 25a5020a30f..9366e71e7c9 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -48,8 +48,8 @@ "Udgået for tråde/hukommelse", "Kan ikke få værtsnavn for din adresse", "Forkert håndtryk (handshake)", -"Adgang nægtet bruger: '%-.32s@%-.64s' til databasen '%-.64s'", -"Adgang nægtet bruger: '%-.32s@%-.64s' (Bruger adgangskode: %s)", +"Adgang nægtet bruger: '%-.32s'@'%-.64s' til databasen '%-.64s'", +"Adgang nægtet bruger: '%-.32s'@'%-.64s' (Bruger adgangskode: %s)", "Ingen database valgt", "Ukendt kommando", "Kolonne '%-.64s' kan ikke være NULL", @@ -146,8 +146,8 @@ "Fik fejl '%-.64s' fra regexp", "Sammenblanding af GROUP kolonner (MIN(),MAX(),COUNT()...) uden GROUP kolonner er ikke tilladt, hvis der ikke er noget GROUP BY prædikat", "Denne tilladelse findes ikke for brugeren '%-.32s' på vært '%-.64s'", -"%-.16s-kommandoen er ikke tilladt for brugeren '%-.32s@%-.64s' for tabellen '%-.64s'", -"%-.16s-kommandoen er ikke tilladt for brugeren '%-.32s@%-.64s' for kolonne '%-.64s' in tabellen '%-.64s'", +"%-.16s-kommandoen er ikke tilladt for brugeren '%-.32s'@'%-.64s' for tabellen '%-.64s'", +"%-.16s-kommandoen er ikke tilladt for brugeren '%-.32s'@'%-.64s' for kolonne '%-.64s' in tabellen '%-.64s'", "Forkert GRANT/REVOKE kommando. Se i brugervejledningen hvilke privilegier der kan specificeres.", "Værts- eller brugernavn for langt til GRANT", "Tabellen '%-.64s.%-.64s' eksisterer ikke", @@ -215,7 +215,7 @@ "DROP DATABASE er ikke tilladt mens en tråd holder på globalt read lock", "CREATE DATABASE er ikke tilladt mens en tråd holder på globalt read lock", "Wrong arguments to %s", -"%-.32s@%-.64s is not allowed to create new users", +"'%-.32s'@'%-.64s' is not allowed to create new users", "Incorrect table definition; all MERGE tables must be in the same database", "Deadlock found when trying to get lock; Try restarting transaction", "The used table type doesn't support FULLTEXT indexes", diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index 6aba93c246c..c43b84f1674 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -56,8 +56,8 @@ "Geen thread geheugen meer; controleer of mysqld of andere processen al het beschikbare geheugen gebruikt. Zo niet, dan moet u wellicht 'ulimit' gebruiken om mysqld toe te laten meer geheugen te benutten, of u kunt extra swap ruimte toevoegen", "Kan de hostname niet krijgen van uw adres", "Verkeerde handshake", -"Toegang geweigerd voor gebruiker: '%-.32s@%-.64s' naar database '%-.64s'", -"Toegang geweigerd voor gebruiker: '%-.32s@%-.64s' (Wachtwoord gebruikt: %s)", +"Toegang geweigerd voor gebruiker: '%-.32s'@'%-.64s' naar database '%-.64s'", +"Toegang geweigerd voor gebruiker: '%-.32s'@'%-.64s' (Wachtwoord gebruikt: %s)", "Geen database geselecteerd", "Onbekend commando", "Kolom '%-.64s' kan niet null zijn", @@ -154,8 +154,8 @@ "Fout '%-.64s' ontvangen van regexp", "Het mixen van GROUP kolommen (MIN(),MAX(),COUNT()...) met no-GROUP kolommen is foutief indien er geen GROUP BY clausule is", "Deze toegang (GRANT) is niet toegekend voor gebruiker '%-.32s' op host '%-.64s'", -"%-.16s commando geweigerd voor gebruiker: '%-.32s@%-.64s' voor tabel '%-.64s'", -"%-.16s commando geweigerd voor gebruiker: '%-.32s@%-.64s' voor kolom '%-.64s' in tabel '%-.64s'", +"%-.16s commando geweigerd voor gebruiker: '%-.32s'@'%-.64s' voor tabel '%-.64s'", +"%-.16s commando geweigerd voor gebruiker: '%-.32s'@'%-.64s' voor kolom '%-.64s' in tabel '%-.64s'", "Foutief GRANT/REVOKE commando. Raadpleeg de handleiding welke priveleges gebruikt kunnen worden.", "De host of gebruiker parameter voor GRANT is te lang", "Tabel '%-.64s.%s' bestaat niet", @@ -223,7 +223,7 @@ "DROP DATABASE niet toegestaan terwijl thread een globale 'read lock' bezit", "CREATE DATABASE niet toegestaan terwijl thread een globale 'read lock' bezit", "Foutieve parameters voor %s", -"%-.32s@%-.64s mag geen nieuwe gebruikers creeren", +"'%-.32s'@'%-.64s' mag geen nieuwe gebruikers creeren", "Incorrecte tabel definitie; alle MERGE tabellen moeten tot dezelfde database behoren", "Deadlock gevonden tijdens lock-aanvraag poging; Probeer herstart van de transactie", "Het gebruikte tabel type ondersteund geen FULLTEXT indexen", diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 11ae2c89019..606c1a902a2 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -45,8 +45,8 @@ "Out of memory; Check if mysqld or some other process uses all available memory. If not you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space", "Can't get hostname for your address", "Bad handshake", -"Access denied for user: '%-.32s@%-.64s' to database '%-.64s'", -"Access denied for user: '%-.32s@%-.64s' (Using password: %s)", +"Access denied for user: '%-.32s'@'%-.64s' to database '%-.64s'", +"Access denied for user: '%-.32s'@'%-.64s' (Using password: %s)", "No Database Selected", "Unknown command", "Column '%-.64s' cannot be null", @@ -143,8 +143,8 @@ "Got error '%-.64s' from regexp", "Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if there is no GROUP BY clause", "There is no such grant defined for user '%-.32s' on host '%-.64s'", -"%-.16s command denied to user: '%-.32s@%-.64s' for table '%-.64s'", -"%-.16s command denied to user: '%-.32s@%-.64s' for column '%-.64s' in table '%-.64s'", +"%-.16s command denied to user: '%-.32s'@'%-.64s' for table '%-.64s'", +"%-.16s command denied to user: '%-.32s'@'%-.64s' for column '%-.64s' in table '%-.64s'", "Illegal GRANT/REVOKE command. Please consult the manual which privileges can be used", "The host or user argument to GRANT is too long", "Table '%-.64s.%-.64s' doesn't exist", @@ -212,7 +212,7 @@ "DROP DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock", "Wrong arguments to %s", -"%-.32s@%-.64s is not allowed to create new users", +"'%-.32s'@'%-.64s' is not allowed to create new users", "Incorrect table definition; all MERGE tables must be in the same database", "Deadlock found when trying to get lock; Try restarting transaction", "The used table type doesn't support FULLTEXT indexes", diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 94e19fc6e9d..f453cc72f88 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -50,8 +50,8 @@ "Mälu sai otsa. Võimalik, et aitab swap-i lisamine või käsu 'ulimit' abil MySQL-le rohkema mälu kasutamise lubamine", "Ei suuda lahendada IP aadressi masina nimeks", "Väär handshake", -"Ligipääs keelatud kasutajale '%-.32s@%-.64s' andmebaasile '%-.64s'", -"Ligipääs keelatud kasutajale '%-.32s@%-.64s' (kasutab parooli: %s)", +"Ligipääs keelatud kasutajale '%-.32s'@'%-.64s' andmebaasile '%-.64s'", +"Ligipääs keelatud kasutajale '%-.32s'@'%-.64s' (kasutab parooli: %s)", "Andmebaasi ei ole valitud", "Tundmatu käsk", "Tulp '%-.64s' ei saa omada nullväärtust", @@ -148,8 +148,8 @@ "regexp tagastas vea '%-.64s'", "GROUP tulpade (MIN(),MAX(),COUNT()...) kooskasutamine tavaliste tulpadega ilma GROUP BY klauslita ei ole lubatud", "Sellist õigust ei ole defineeritud kasutajale '%-.32s' masinast '%-.64s'", -"%-.16s käsk ei ole lubatud kasutajale '%-.32s@%-.64s' tabelis '%-.64s'", -"%-.16s käsk ei ole lubatud kasutajale '%-.32s@%-.64s' tulbale '%-.64s' tabelis '%-.64s'", +"%-.16s käsk ei ole lubatud kasutajale '%-.32s'@'%-.64s' tabelis '%-.64s'", +"%-.16s käsk ei ole lubatud kasutajale '%-.32s'@'%-.64s' tulbale '%-.64s' tabelis '%-.64s'", "Vigane GRANT/REVOKE käsk. Tutvu kasutajajuhendiga", "Masina või kasutaja nimi GRANT lauses on liiga pikk", "Tabelit '%-.64s.%-.64s' ei eksisteeri", @@ -217,7 +217,7 @@ "DROP DATABASE ei ole lubatud kui lõim omab globaalset READ lukku", "CREATE DATABASE ei ole lubatud kui lõim omab globaalset READ lukku", "Vigased parameetrid %s-le", -"Kasutajal %-.32s@%-.64s ei ole lubatud luua uusi kasutajaid", +"Kasutajal '%-.32s'@'%-.64s' ei ole lubatud luua uusi kasutajaid", "Vigane tabelimääratlus; kõik MERGE tabeli liikmed peavad asuma samas andmebaasis", "Lukustamisel tekkis tupik (deadlock); alusta transaktsiooni otsast", "Antud tabelitüüp ei toeta FULLTEXT indekseid", diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index dd062cc074a..ae9f91312fa 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -45,8 +45,8 @@ "Manque de 'threads'/mémoire", "Ne peut obtenir de hostname pour votre adresse", "Mauvais 'handshake'", -"Accès refusé pour l'utilisateur: '%-.32s@%-.64s'. Base '%-.64s'", -"Accès refusé pour l'utilisateur: '%-.32s@%-.64s' (mot de passe: %s)", +"Accès refusé pour l'utilisateur: '%-.32s'@'@%-.64s'. Base '%-.64s'", +"Accès refusé pour l'utilisateur: '%-.32s'@'@%-.64s' (mot de passe: %s)", "Aucune base n'a été sélectionnée", "Commande inconnue", "Le champ '%-.64s' ne peut être vide (null)", @@ -143,8 +143,8 @@ "Erreur '%-.64s' provenant de regexp", "Mélanger les colonnes GROUP (MIN(),MAX(),COUNT()...) avec des colonnes normales est interdit s'il n'y a pas de clause GROUP BY", "Un tel droit n'est pas défini pour l'utilisateur '%-.32s' sur l'hôte '%-.64s'", -"La commande '%-.16s' est interdite à l'utilisateur: '%-.32s@%-.64s' sur la table '%-.64s'", -"La commande '%-.16s' est interdite à l'utilisateur: '%-.32s@%-.64s' sur la colonne '%-.64s' de la table '%-.64s'", +"La commande '%-.16s' est interdite à l'utilisateur: '%-.32s'@'@%-.64s' sur la table '%-.64s'", +"La commande '%-.16s' est interdite à l'utilisateur: '%-.32s'@'@%-.64s' sur la colonne '%-.64s' de la table '%-.64s'", "Commande GRANT/REVOKE incorrecte. Consultez le manuel.", "L'hôte ou l'utilisateur donné en argument à GRANT est trop long", "La table '%-.64s.%s' n'existe pas", @@ -212,7 +212,7 @@ "DROP DATABASE n'est pas autorisée pendant qu'une tâche possède un verrou global en lecture", "CREATE DATABASE n'est pas autorisée pendant qu'une tâche possède un verrou global en lecture", "Mauvais arguments à %s", -"%-.32s@%-.64s n'est pas autorisé à créer de nouveaux utilisateurs", +"'%-.32s'@'%-.64s' n'est pas autorisé à créer de nouveaux utilisateurs", "Définition de table incorrecte; toutes les tables MERGE doivent être dans la même base de donnée", "Deadlock découvert en essayant d'obtenir les verrous : essayez de redémarrer la transaction", "Le type de table utilisé ne supporte pas les index FULLTEXT", diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index e7cdf3f6f0d..9d5a2d29ca3 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -54,8 +54,8 @@ "Zuwenig Speicher.", "Kann Hostname für diese Adresse nicht erhalten.", "Schlechter Handshake.", -"Keine Zugriffsberechtigung für Benutzer: '%-.32s@%-.64s' für Datenbank '%-.64s'.", -"Keine Zugriffsberechtigung für Benutzer: '%-.32s@%-.64s'. (Verwendetes Passwort: %-.64s)", +"Keine Zugriffsberechtigung für Benutzer: '%-.32s'@'%-.64s' für Datenbank '%-.64s'.", +"Keine Zugriffsberechtigung für Benutzer: '%-.32s'@'%-.64s'. (Verwendetes Passwort: %-.64s)", "Keine Datenbank ausgewählt.", "Unbekannter Befehl.", "Feld '%-.64s' kann nicht NULL sein.", @@ -152,8 +152,8 @@ "Fehler '%-.64s' von regexp", "Das Vermischen von GROUP Spalten (MIN(),MAX(),COUNT()...) mit Nicht-GROUP Spalten ist nicht erlaubt, sofern keine GROUP BY Klausel vorhanden ist.", "Keine solche Berechtigung für User '%-.32s' auf Host '%-.64s'", -"%-.16s Befehl nicht erlaubt für User: '%-.32s@%-.64s' für Tabelle '%-.64s'", -"%-.16s Befehl nicht erlaubt für User: '%-.32s@%-.64s' in Spalte '%-.64s' in Tabelle '%-.64s'", +"%-.16s Befehl nicht erlaubt für User: '%-.32s'@'%-.64s' für Tabelle '%-.64s'", +"%-.16s Befehl nicht erlaubt für User: '%-.32s'@'%-.64s' in Spalte '%-.64s' in Tabelle '%-.64s'", "Unzulässiger GRANT/REVOKE Befehl. Weiteres zum Thema Berechtigungen im Manual.", "Das Host oder User Argument für GRANT ist zu lang", "Tabelle '%-.64s.%-.64s' existiert nicht", @@ -221,7 +221,7 @@ "Solange ein globaler Read LOCK gesetzt ist, ist DROP DATABASE nicht zulässig.", "Solange ein globaler Read LOCK gesetzt ist, ist CREATE DATABASE nicht zulässig.", "Falsche Argumente für %s", -"%-.32s@%-.64s is nicht berechtigt neue Benutzer hinzuzufügen.", +"'%-.32s'@'%-.64s' is nicht berechtigt neue Benutzer hinzuzufügen.", "Falsche Tabellendefinition; sämtliche MERGE-Tabellen müssen in derselben Datenbank sein.", "Beim Versuch einen Lock anzufordern ist ein Deadlock aufgetreten. Es wird versucht die Transaktion erneut zu starten.", "Der verwendete Tabellentyp unterstützt keinen FULLTEXT-Index.", diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index ef423ae2758..dbfb605dac2 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -45,8 +45,8 @@ "Ðñüâëçìá ìå ôç äéáèÝóéìç ìíÞìç (Out of thread space/memory)", "Äåí Ýãéíå ãíùóôü ôï hostname ãéá ôçí address óáò", "Ç áíáãíþñéóç (handshake) äåí Ýãéíå óùóôÜ", -"Äåí åðéôÝñåôáé ç ðñüóâáóç óôï ÷ñÞóôç: '%-.32s@%-.64s' óôç âÜóç äåäïìÝíùí '%-.64s'", -"Äåí åðéôÝñåôáé ç ðñüóâáóç óôï ÷ñÞóôç: '%-.32s@%-.64s' (÷ñÞóç password: %s)", +"Äåí åðéôÝñåôáé ç ðñüóâáóç óôï ÷ñÞóôç: '%-.32s'@'%-.64s' óôç âÜóç äåäïìÝíùí '%-.64s'", +"Äåí åðéôÝñåôáé ç ðñüóâáóç óôï ÷ñÞóôç: '%-.32s'@'%-.64s' (÷ñÞóç password: %s)", "Äåí åðéëÝ÷èçêå âÜóç äåäïìÝíùí", "Áãíùóôç åíôïëÞ", "Ôï ðåäßï '%-.64s' äåí ìðïñåß íá åßíáé êåíü (null)", @@ -143,8 +143,8 @@ "Got error '%-.64s' from regexp", "Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if there is no GROUP BY clause", "There is no such grant defined for user '%-.32s' on host '%-.64s'", -"%-.16s command denied to user: '%-.32s@%-.64s' for table '%-.64s'", -"%-.16s command denied to user: '%-.32s@%-.64s' for column '%-.64s' in table '%-.64s'", +"%-.16s command denied to user: '%-.32s'@'%-.64s' for table '%-.64s'", +"%-.16s command denied to user: '%-.32s'@'%-.64s' for column '%-.64s' in table '%-.64s'", "Illegal GRANT/REVOKE command. Please consult the manual which privileges can be used.", "The host or user argument to GRANT is too long", "Table '%-.64s.%-.64s' doesn't exist", @@ -212,7 +212,7 @@ "DROP DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock", "Wrong arguments to %s", -"%-.32s@%-.64s is not allowed to create new users", +"'%-.32s'@'%-.64s' is not allowed to create new users", "Incorrect table definition; all MERGE tables must be in the same database", "Deadlock found when trying to get lock; Try restarting transaction", "The used table type doesn't support FULLTEXT indexes", diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index 6b27cdc2551..a06f679e81c 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -47,8 +47,8 @@ "Elfogyott a thread-memoria", "A gepnev nem allapithato meg a cimbol", "A kapcsolatfelvetel nem sikerult (Bad handshake)", -"A(z) '%-.32s@%-.64s' felhasznalo szamara tiltott eleres az '%-.64s' adabazishoz.", -"A(z) '%-.32s@%-.64s' felhasznalo szamara tiltott eleres. (Hasznalja a jelszot: %s)", +"A(z) '%-.32s'@'%-.64s' felhasznalo szamara tiltott eleres az '%-.64s' adabazishoz.", +"A(z) '%-.32s'@'%-.64s' felhasznalo szamara tiltott eleres. (Hasznalja a jelszot: %s)", "Nincs kivalasztott adatbazis", "Ervenytelen parancs", "A(z) '%-.64s' oszlop erteke nem lehet nulla", @@ -145,8 +145,8 @@ "'%-.64s' hiba a regularis kifejezes hasznalata soran (regexp)", "A GROUP mezok (MIN(),MAX(),COUNT()...) kevert hasznalata nem lehetseges GROUP BY hivatkozas nelkul", "A '%-.32s' felhasznalonak nincs ilyen joga a '%-.64s' host-on", -"%-.16s parancs a '%-.32s@%-.64s' felhasznalo szamara nem engedelyezett a '%-.64s' tablaban", -"%-.16s parancs a '%-.32s@%-.64s' felhasznalo szamara nem engedelyezett a '%-.64s' mezo eseten a '%-.64s' tablaban", +"%-.16s parancs a '%-.32s'@'%-.64s' felhasznalo szamara nem engedelyezett a '%-.64s' tablaban", +"%-.16s parancs a '%-.32s'@'%-.64s' felhasznalo szamara nem engedelyezett a '%-.64s' mezo eseten a '%-.64s' tablaban", "Ervenytelen GRANT/REVOKE parancs. Kerem, nezze meg a kezikonyvben, milyen jogok lehetsegesek", "A host vagy felhasznalo argumentuma tul hosszu a GRANT parancsban", "A '%-.64s.%s' tabla nem letezik", @@ -214,7 +214,7 @@ "DROP DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock", "Wrong arguments to %s", -"%-.32s@%-.64s is not allowed to create new users", +"'%-.32s'@'%-.64s' is not allowed to create new users", "Incorrect table definition; all MERGE tables must be in the same database", "Deadlock found when trying to get lock; Try restarting transaction", "The used table type doesn't support FULLTEXT indexes", diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index 8b0598f64b5..48f77490892 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -45,8 +45,8 @@ "Fine dello spazio/memoria per i thread", "Impossibile risalire al nome dell'host dall'indirizzo (risoluzione inversa)", "Negoziazione impossibile", -"Accesso non consentito per l'utente: '%-.32s@%-.64s' al database '%-.64s'", -"Accesso non consentito per l'utente: '%-.32s@%-.64s' (Password: %s)", +"Accesso non consentito per l'utente: '%-.32s'@'%-.64s' al database '%-.64s'", +"Accesso non consentito per l'utente: '%-.32s'@'%-.64s' (Password: %s)", "Nessun database selezionato", "Comando sconosciuto", "La colonna '%-.64s' non puo` essere nulla", @@ -143,8 +143,8 @@ "Errore '%-.64s' da regexp", "Il mescolare funzioni di aggregazione (MIN(),MAX(),COUNT()...) e non e` illegale se non c'e` una clausula GROUP BY", "GRANT non definita per l'utente '%-.32s' dalla macchina '%-.64s'", -"Comando %-.16s negato per l'utente: '%-.32s@%-.64s' sulla tabella '%-.64s'", -"Comando %-.16s negato per l'utente: '%-.32s@%-.64s' sulla colonna '%-.64s' della tabella '%-.64s'", +"Comando %-.16s negato per l'utente: '%-.32s'@'%-.64s' sulla tabella '%-.64s'", +"Comando %-.16s negato per l'utente: '%-.32s'@'%-.64s' sulla colonna '%-.64s' della tabella '%-.64s'", "Comando GRANT/REVOKE illegale. Prego consultare il manuale per sapere quali privilegi possono essere usati.", "L'argomento host o utente per la GRANT e` troppo lungo", "La tabella '%-.64s.%s' non esiste", @@ -212,7 +212,7 @@ "DROP DATABASE non e' permesso mentre il thread ha un lock globale di lettura", "CREATE DATABASE non e' permesso mentre il thread ha un lock globale di lettura", "Argomenti errati a %s", -"A %-.32s@%-.64s non e' permesso creare nuovi utenti", +"A '%-.32s'@'%-.64s' non e' permesso creare nuovi utenti", "Definizione della tabella errata; tutte le tabelle di tipo MERGE devono essere nello stesso database", "Trovato deadlock durante il lock; Provare a far ripartire la transazione", "La tabella usata non supporta gli indici FULLTEXT", diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index 011d6a1faac..80af8a87c94 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -47,8 +47,8 @@ "Out of memory; mysqld ¤«¤½¤Î¾¤Î¥×¥í¥»¥¹¤¬¥á¥â¥ê¡¼¤òÁ´¤Æ»È¤Ã¤Æ¤¤¤ë¤«³Îǧ¤·¤Æ¤¯¤À¤µ¤¤. ¥á¥â¥ê¡¼¤ò»È¤¤ÀڤäƤ¤¤Ê¤¤¾ì¹ç¡¢'ulimit' ¤òÀßÄꤷ¤Æ mysqld ¤Î¥á¥â¥ê¡¼»ÈÍѸ³¦Î̤ò¿¤¯¤¹¤ë¤«¡¢swap space ¤òÁý¤ä¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤", "¤½¤Î address ¤Î hostname ¤¬°ú¤±¤Þ¤»¤ó.", "Bad handshake", -"¥æ¡¼¥¶¡¼ '%-.32s@%-.64s' ¤Î '%-.64s' ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ø¤Î¥¢¥¯¥»¥¹¤òµñÈݤ·¤Þ¤¹", -"¥æ¡¼¥¶¡¼ '%-.32s@%-.64s' ¤òµñÈݤ·¤Þ¤¹.(Using password: %s)", +"¥æ¡¼¥¶¡¼ '%-.32s'@'%-.64s' ¤Î '%-.64s' ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ø¤Î¥¢¥¯¥»¥¹¤òµñÈݤ·¤Þ¤¹", +"¥æ¡¼¥¶¡¼ '%-.32s'@'%-.64s' ¤òµñÈݤ·¤Þ¤¹.(Using password: %s)", "¥Ç¡¼¥¿¥Ù¡¼¥¹¤¬ÁªÂò¤µ¤ì¤Æ¤¤¤Þ¤»¤ó.", "¤½¤Î¥³¥Þ¥ó¥É¤Ï²¿¡©", "Column '%-.64s' ¤Ï null ¤Ë¤Ï¤Ç¤­¤Ê¤¤¤Î¤Ç¤¹", @@ -145,8 +145,8 @@ "Got error '%-.64s' from regexp", "Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if there is no GROUP BY clause", "¥æ¡¼¥¶¡¼ '%-.32s' (¥Û¥¹¥È '%-.64s' ¤Î¥æ¡¼¥¶¡¼) ¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó", -"¥³¥Þ¥ó¥É %-.16s ¤Ï ¥æ¡¼¥¶¡¼ '%-.32s@%-.64s' ,¥Æ¡¼¥Ö¥ë '%-.64s' ¤ËÂФ·¤Æµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó", -"¥³¥Þ¥ó¥É %-.16s ¤Ï ¥æ¡¼¥¶¡¼ '%-.32s@%-.64s'\n ¥«¥é¥à '%-.64s' ¥Æ¡¼¥Ö¥ë '%-.64s' ¤ËÂФ·¤Æµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó", +"¥³¥Þ¥ó¥É %-.16s ¤Ï ¥æ¡¼¥¶¡¼ '%-.32s'@'%-.64s' ,¥Æ¡¼¥Ö¥ë '%-.64s' ¤ËÂФ·¤Æµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó", +"¥³¥Þ¥ó¥É %-.16s ¤Ï ¥æ¡¼¥¶¡¼ '%-.32s'@'%-.64s'\n ¥«¥é¥à '%-.64s' ¥Æ¡¼¥Ö¥ë '%-.64s' ¤ËÂФ·¤Æµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó", "Illegal GRANT/REVOKE command. Please consult the manual which privleges can be used.", "The host or user argument to GRANT is too long", "Table '%-.64s.%s' doesn't exist", @@ -214,7 +214,7 @@ "DROP DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock", "Wrong arguments to %s", -"%-.32s@%-.64s is not allowed to create new users", +"'%-.32s'@'%-.64s' is not allowed to create new users", "Incorrect table definition; all MERGE tables must be in the same database", "Deadlock found when trying to get lock; Try restarting transaction", "The used table type doesn't support FULLTEXT indexes", diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index be7fee7cb45..4c654819495 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -45,8 +45,8 @@ "Out of memory; mysqld³ª ¶Ç´Ù¸¥ ÇÁ·Î¼¼¼­¿¡¼­ »ç¿ë°¡´ÉÇÑ ¸Þ¸ð¸®¸¦ »ç¿ëÇÑÁö äũÇϽÿÀ. ¸¸¾à ±×·¸Áö ¾Ê´Ù¸é ulimit ¸í·ÉÀ» ÀÌ¿¿ëÇÏ¿© ´õ¸¹Àº ¸Þ¸ð¸®¸¦ »ç¿ëÇÒ ¼ö ÀÖµµ·Ï Çϰųª ½º¿Ò ½ºÆÐÀ̽º¸¦ Áõ°¡½ÃŰ½Ã¿À", "´ç½ÅÀÇ ÄÄÇ»ÅÍÀÇ È£½ºÆ®À̸§À» ¾òÀ» ¼ö ¾øÀ¾´Ï´Ù.", "Bad handshake", -"'%-.32s@%-.64s' »ç¿ëÀÚ´Â '%-.64s' µ¥ÀÌŸº£À̽º¿¡ Á¢±ÙÀÌ °ÅºÎ µÇ¾ú½À´Ï´Ù.", -"'%-.32s@%-.64s' »ç¿ëÀÚ´Â Á¢±ÙÀÌ °ÅºÎ µÇ¾ú½À´Ï´Ù. (Using password: %s)", +"'%-.32s'@'%-.64s' »ç¿ëÀÚ´Â '%-.64s' µ¥ÀÌŸº£À̽º¿¡ Á¢±ÙÀÌ °ÅºÎ µÇ¾ú½À´Ï´Ù.", +"'%-.32s'@'%-.64s' »ç¿ëÀÚ´Â Á¢±ÙÀÌ °ÅºÎ µÇ¾ú½À´Ï´Ù. (Using password: %s)", "¼±ÅÃµÈ µ¥ÀÌŸº£À̽º°¡ ¾ø½À´Ï´Ù.", "¸í·É¾î°¡ ¹ºÁö ¸ð¸£°Ú¾î¿ä...", "Ä®·³ '%-.64s'´Â ³Î(Null)ÀÌ µÇ¸é ¾ÈµË´Ï´Ù. ", @@ -143,8 +143,8 @@ "regexp¿¡¼­ '%-.64s'°¡ ³µ½À´Ï´Ù.", "Mixing of GROUP Ä®·³s (MIN(),MAX(),COUNT()...) with no GROUP Ä®·³s is illegal if there is no GROUP BY clause", "»ç¿ëÀÚ '%-.32s' (È£½ºÆ® '%-.64s')¸¦ À§ÇÏ¿© Á¤ÀÇµÈ ±×·± ½ÂÀÎÀº ¾ø½À´Ï´Ù.", -"'%-.16s' ¸í·ÉÀº ´ÙÀ½ »ç¿ëÀÚ¿¡°Ô °ÅºÎµÇ¾ú½À´Ï´Ù. : '%-.32s@%-.64s' for Å×À̺í '%-.64s'", -"'%-.16s' ¸í·ÉÀº ´ÙÀ½ »ç¿ëÀÚ¿¡°Ô °ÅºÎµÇ¾ú½À´Ï´Ù. : '%-.32s@%-.64s' for Ä®·³ '%-.64s' in Å×À̺í '%-.64s'", +"'%-.16s' ¸í·ÉÀº ´ÙÀ½ »ç¿ëÀÚ¿¡°Ô °ÅºÎµÇ¾ú½À´Ï´Ù. : '%-.32s'@'%-.64s' for Å×À̺í '%-.64s'", +"'%-.16s' ¸í·ÉÀº ´ÙÀ½ »ç¿ëÀÚ¿¡°Ô °ÅºÎµÇ¾ú½À´Ï´Ù. : '%-.32s'@'%-.64s' for Ä®·³ '%-.64s' in Å×À̺í '%-.64s'", "À߸øµÈ GRANT/REVOKE ¸í·É. ¾î¶² ±Ç¸®¿Í ½ÂÀÎÀÌ »ç¿ëµÇ¾î Áú ¼ö ÀÖ´ÂÁö ¸Þ´º¾óÀ» º¸½Ã¿À.", "½ÂÀÎ(GRANT)À» À§ÇÏ¿© »ç¿ëÇÑ »ç¿ëÀÚ³ª È£½ºÆ®ÀÇ °ªµéÀÌ ³Ê¹« ±é´Ï´Ù.", "Å×À̺í '%-.64s.%s' ´Â Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.", @@ -212,7 +212,7 @@ "DROP DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock", "Wrong arguments to %s", -"%-.32s@%-.64s is not allowed to create new users", +"'%-.32s'@'%-.64s' is not allowed to create new users", "Incorrect table definition; all MERGE tables must be in the same database", "Deadlock found when trying to get lock; Try restarting transaction", "The used table type doesn't support FULLTEXT indexes", diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index 96c11871502..7b4075ccb66 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -47,8 +47,8 @@ "Tomt for tråd plass/minne", "Kan ikkje få tak i vertsnavn for di adresse", "Feil handtrykk (handshake)", -"Tilgang ikkje tillate for brukar: '%-.32s@%-.64s' til databasen '%-.64s' nekta", -"Tilgang ikke tillate for brukar: '%-.32s@%-.64s' (Brukar passord: %s)", +"Tilgang ikkje tillate for brukar: '%-.32s'@'%-.64s' til databasen '%-.64s' nekta", +"Tilgang ikke tillate for brukar: '%-.32s'@'%-.64s' (Brukar passord: %s)", "Ingen database vald", "Ukjent kommando", "Kolonne '%-.64s' kan ikkje vere null", @@ -145,8 +145,8 @@ "Got error '%-.64s' from regexp", "Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if there is no GROUP BY clause", "There is no such grant defined for user '%-.32s' on host '%-.64s'", -"%-.16s command denied to user: '%-.32s@%-.64s' for table '%-.64s'", -"%-.16s command denied to user: '%-.32s@%-.64s' for column '%-.64s' in table '%-.64s'", +"%-.16s command denied to user: '%-.32s'@'%-.64s' for table '%-.64s'", +"%-.16s command denied to user: '%-.32s'@'%-.64s' for column '%-.64s' in table '%-.64s'", "Illegal GRANT/REVOKE command. Please consult the manual which privleges can be used.", "The host or user argument to GRANT is too long", "Table '%-.64s.%s' doesn't exist", @@ -214,7 +214,7 @@ "DROP DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock", "Wrong arguments to %s", -"%-.32s@%-.64s is not allowed to create new users", +"'%-.32s'@'%-.64s' is not allowed to create new users", "Incorrect table definition; all MERGE tables must be in the same database", "Deadlock found when trying to get lock; Try restarting transaction", "The used table type doesn't support FULLTEXT indexes", diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index c505d512e9e..d4bd7115e86 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -47,8 +47,8 @@ "Tomt for tråd plass/minne", "Kan ikke få tak i vertsnavn for din adresse", "Feil håndtrykk (handshake)", -"Tilgang nektet for bruker: '%-.32s@%-.64s' til databasen '%-.64s' nektet", -"Tilgang nektet for bruker: '%-.32s@%-.64s' (Bruker passord: %s)", +"Tilgang nektet for bruker: '%-.32s'@'%-.64s' til databasen '%-.64s' nektet", +"Tilgang nektet for bruker: '%-.32s'@'%-.64s' (Bruker passord: %s)", "Ingen database valgt", "Ukjent kommando", "Kolonne '%-.64s' kan ikke vere null", @@ -145,8 +145,8 @@ "Got error '%-.64s' from regexp", "Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if there is no GROUP BY clause", "There is no such grant defined for user '%-.32s' on host '%-.64s'", -"%-.16s command denied to user: '%-.32s@%-.64s' for table '%-.64s'", -"%-.16s command denied to user: '%-.32s@%-.64s' for column '%-.64s' in table '%-.64s'", +"%-.16s command denied to user: '%-.32s'@'%-.64s' for table '%-.64s'", +"%-.16s command denied to user: '%-.32s'@'%-.64s' for column '%-.64s' in table '%-.64s'", "Illegal GRANT/REVOKE command. Please consult the manual which privleges can be used.", "The host or user argument to GRANT is too long", "Table '%-.64s.%s' doesn't exist", @@ -214,7 +214,7 @@ "DROP DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock", "Wrong arguments to %s", -"%-.32s@%-.64s is not allowed to create new users", +"'%-.32s'@'%-.64s' is not allowed to create new users", "Incorrect table definition; all MERGE tables must be in the same database", "Deadlock found when trying to get lock; Try restarting transaction", "The used table type doesn't support FULLTEXT indexes", diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 33b2fbdb8a8..7066783850b 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -49,8 +49,8 @@ "Zbyt ma³o miejsca/pamiêci dla w?tku", "Nie mo¿na otrzymaæ nazwy hosta dla twojego adresu", "Z³y uchwyt(handshake)", -"Access denied for user: '%-.32s@%-.64s' to database '%-.64s'", -"Access denied for user: '%-.32s@%-.64s' (Using password: %s)", +"Access denied for user: '%-.32s'@'%-.64s' to database '%-.64s'", +"Access denied for user: '%-.32s'@'%-.64s' (Using password: %s)", "Nie wybrano ¿adnej bazy danych", "Nieznana komenda", "Kolumna '%-.64s' nie mo¿e byæ null", @@ -147,8 +147,8 @@ "Got error '%-.64s' from regexp", "Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if there is no GROUP BY clause", "There is no such grant defined for user '%-.32s' on host '%-.64s'", -"%-.16s command denied to user: '%-.32s@%-.64s' for table '%-.64s'", -"%-.16s command denied to user: '%-.32s@%-.64s' for column '%-.64s' in table '%-.64s'", +"%-.16s command denied to user: '%-.32s'@'%-.64s' for table '%-.64s'", +"%-.16s command denied to user: '%-.32s'@'%-.64s' for column '%-.64s' in table '%-.64s'", "Illegal GRANT/REVOKE command. Please consult the manual which privleges can be used.", "The host or user argument to GRANT is too long", "Table '%-.64s.%s' doesn't exist", @@ -216,7 +216,7 @@ "DROP DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock", "Wrong arguments to %s", -"%-.32s@%-.64s is not allowed to create new users", +"'%-.32s'@'%-.64s' is not allowed to create new users", "Incorrect table definition; all MERGE tables must be in the same database", "Deadlock found when trying to get lock; Try restarting transaction", "The used table type doesn't support FULLTEXT indexes", diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index e8a3205ec5d..aa44f09ed0e 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -45,8 +45,8 @@ "Sem memória. Verifique se o mysqld ou algum outro processo está usando toda memória disponível. Se não, você pode ter que usar 'ulimit' para permitir ao mysqld usar mais memória ou você pode adicionar mais área de 'swap'", "Não pode obter nome do 'host' para seu endereço", "Negociação de acesso falhou", -"Acesso negado para o usuário '%-.32s@%-.64s' ao banco de dados '%-.64s'", -"Acesso negado para o usuário '%-.32s@%-.64s' (senha usada: %s)", +"Acesso negado para o usuário '%-.32s'@'%-.64s' ao banco de dados '%-.64s'", +"Acesso negado para o usuário '%-.32s'@'%-.64s' (senha usada: %s)", "Nenhum banco de dados foi selecionado", "Comando desconhecido", "Coluna '%-.64s' não pode ser vazia", @@ -143,8 +143,8 @@ "Obteve erro '%-.64s' em regexp", "Mistura de colunas agrupadas (com MIN(), MAX(), COUNT(), ...) com colunas não agrupadas é ilegal, se não existir uma cláusula de agrupamento (cláusula GROUP BY)", "Não existe tal permissão (grant) definida para o usuário '%-.32s' no 'host' '%-.64s'", -"Comando '%-.16s' negado para o usuário '%-.32s@%-.64s' na tabela '%-.64s'", -"Comando '%-.16s' negado para o usuário '%-.32s@%-.64s' na coluna '%-.64s', na tabela '%-.64s'", +"Comando '%-.16s' negado para o usuário '%-.32s'@'%-.64s' na tabela '%-.64s'", +"Comando '%-.16s' negado para o usuário '%-.32s'@'%-.64s' na coluna '%-.64s', na tabela '%-.64s'", "Comando GRANT/REVOKE ilegal. Por favor consulte no manual quais privilégios podem ser usados.", "Argumento de 'host' ou de usuário para o GRANT é longo demais", "Tabela '%-.64s.%-.64s' não existe", @@ -212,7 +212,7 @@ "DROP DATABASE não permitido enquanto uma 'thread' está mantendo um travamento global de leitura", "CREATE DATABASE não permitido enquanto uma 'thread' está mantendo um travamento global de leitura", "Argumentos errados para %s", -"Não é permitido a %-.32s@%-.64s criar novos usuários", +"Não é permitido a '%-.32s'@'%-.64s' criar novos usuários", "Definição incorreta da tabela. Todas as tabelas contidas na junção devem estar no mesmo banco de dados.", "Encontrado um travamento fatal (deadlock) quando tentava obter uma trava. Tente reiniciar a transação.", "O tipo de tabela utilizado não suporta índices de texto completo (fulltext indexes)", diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 6602b5d430c..e13711f054e 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -49,8 +49,8 @@ "Out of memory; Verifica daca mysqld sau vreun alt proces foloseste toate memoria disponbila. Altfel, trebuie sa folosesi 'ulimit' ca sa permiti lui memoria disponbila. Altfel, trebuie sa folosesi 'ulimit' ca sa permiti lui mysqld sa foloseasca mai multa memorie ori adauga mai mult spatiu pentru swap (swap space)", "Nu pot sa obtin hostname-ul adresei tale", "Prost inceput de conectie (bad handshake)", -"Acces interzis pentru utilizatorul: '%-.32s@%-.64s' la baza de date '%-.64s'", -"Acces interzis pentru utilizatorul: '%-.32s@%-.64s' (Folosind parola: %s)", +"Acces interzis pentru utilizatorul: '%-.32s'@'%-.64s' la baza de date '%-.64s'", +"Acces interzis pentru utilizatorul: '%-.32s'@'%-.64s' (Folosind parola: %s)", "Nici o baza de data nu a fost selectata inca", "Comanda invalida", "Coloana '%-.64s' nu poate sa fie null", @@ -147,8 +147,8 @@ "Eroarea '%-.64s' obtinuta din expresia regulara (regexp)", "Amestecarea de coloane GROUP (MIN(),MAX(),COUNT()...) fara coloane GROUP este ilegala daca nu exista o clauza GROUP BY", "Nu exista un astfel de grant definit pentru utilzatorul '%-.32s' de pe host-ul '%-.64s'", -"Comanda %-.16s interzisa utilizatorului: '%-.32s@%-.64s' pentru tabela '%-.64s'", -"Comanda %-.16s interzisa utilizatorului: '%-.32s@%-.64s' pentru coloana '%-.64s' in tabela '%-.64s'", +"Comanda %-.16s interzisa utilizatorului: '%-.32s'@'%-.64s' pentru tabela '%-.64s'", +"Comanda %-.16s interzisa utilizatorului: '%-.32s'@'%-.64s' pentru coloana '%-.64s' in tabela '%-.64s'", "Comanda GRANT/REVOKE ilegala. Consultati manualul in privinta privilegiilor ce pot fi folosite.", "Argumentul host-ului sau utilizatorului pentru GRANT e prea lung", "Tabela '%-.64s.%-.64s' nu exista", @@ -216,7 +216,7 @@ "DROP DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock", "Wrong arguments to %s", -"%-.32s@%-.64s is not allowed to create new users", +"'%-.32s'@'%-.64s' is not allowed to create new users", "Incorrect table definition; all MERGE tables must be in the same database", "Deadlock found when trying to get lock; Try restarting transaction", "The used table type doesn't support FULLTEXT indexes", diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index 70ff979bfdf..e0394941851 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -47,8 +47,8 @@ "îÅÄÏÓÔÁÔÏÞÎÏ ÐÁÍÑÔÉ; ÕÄÏÓÔÏ×ÅÒØÔÅÓØ, ÞÔÏ mysqld ÉÌÉ ËÁËÏÊ-ÌÉÂÏ ÄÒÕÇÏÊ ÐÒÏÃÅÓÓ ÎÅ ÚÁÎÉÍÁÅÔ ×ÓÀ ÄÏÓÔÕÐÎÕÀ ÐÁÍÑÔØ. åÓÌÉ ÎÅÔ, ÔÏ ×Ù ÍÏÖÅÔÅ ÉÓÐÏÌØÚÏ×ÁÔØ ulimit, ÞÔÏÂÙ ×ÙÄÅÌÉÔØ ÄÌÑ mysqld ÂÏÌØÛÅ ÐÁÍÑÔÉ, ÉÌÉ Õ×ÅÌÉÞÉÔØ ÏÂßÅÍ ÆÁÊÌÁ ÐÏÄËÁÞËÉ", "îÅ×ÏÚÍÏÖÎÏ ÐÏÌÕÞÉÔØ ÉÍÑ ÈÏÓÔÁ ÄÌÑ ×ÁÛÅÇÏ ÁÄÒÅÓÁ", "îÅËÏÒÒÅËÔÎÏÅ ÐÒÉ×ÅÔÓÔ×ÉÅ", -"äÌÑ ÐÏÌØÚÏ×ÁÔÅÌÑ '%-.32s@%-.64s' ÄÏÓÔÕÐ Ë ÂÁÚÅ ÄÁÎÎÙÈ '%-.64s' ÚÁËÒÙÔ", -"äÏÓÔÕÐ ÚÁËÒÙÔ ÄÌÑ ÐÏÌØÚÏ×ÁÔÅÌÑ '%-.32s@%-.64s' (ÂÙÌ ÉÓÐÏÌØÚÏ×ÁÎ ÐÁÒÏÌØ: %s)", +"äÌÑ ÐÏÌØÚÏ×ÁÔÅÌÑ '%-.32s'@'%-.64s' ÄÏÓÔÕÐ Ë ÂÁÚÅ ÄÁÎÎÙÈ '%-.64s' ÚÁËÒÙÔ", +"äÏÓÔÕÐ ÚÁËÒÙÔ ÄÌÑ ÐÏÌØÚÏ×ÁÔÅÌÑ '%-.32s'@'%-.64s' (ÂÙÌ ÉÓÐÏÌØÚÏ×ÁÎ ÐÁÒÏÌØ: %s)", "âÁÚÁ ÄÁÎÎÙÈ ÎÅ ×ÙÂÒÁÎÁ", "îÅÉÚ×ÅÓÔÎÁÑ ËÏÍÁÎÄÁ ËÏÍÍÕÎÉËÁÃÉÏÎÎÏÇÏ ÐÒÏÔÏËÏÌÁ", "óÔÏÌÂÅà '%-.64s' ÎÅ ÍÏÖÅÔ ÐÒÉÎÉÍÁÔØ ×ÅÌÉÞÉÎÕ NULL", @@ -145,8 +145,8 @@ "ðÏÌÕÞÅÎÁ ÏÛÉÂËÁ '%-.64s' ÏÔ ÒÅÇÕÌÑÒÎÏÇÏ ×ÙÒÁÖÅÎÉÑ", "ïÄÎÏ×ÒÅÍÅÎÎÏÅ ÉÓÐÏÌØÚÏ×ÁÎÉÅ ÓÇÒÕÐÐÉÒÏ×ÁÎÎÙÈ (GROUP) ÓÔÏÌÂÃÏ× (MIN(),MAX(),COUNT(),...) Ó ÎÅÓÇÒÕÐÐÉÒÏ×ÁÎÎÙÍÉ ÓÔÏÌÂÃÁÍÉ Ñ×ÌÑÅÔÓÑ ÎÅËÏÒÒÅËÔÎÙÍ, ÅÓÌÉ × ×ÙÒÁÖÅÎÉÉ ÅÓÔØ GROUP BY", "ôÁËÉÅ ÐÒÁ×Á ÎÅ ÏÐÒÅÄÅÌÅÎÙ ÄÌÑ ÐÏÌØÚÏ×ÁÔÅÌÑ '%-.32s' ÎÁ ÈÏÓÔÅ '%-.64s'", -"ëÏÍÁÎÄÁ %-.16s ÚÁÐÒÅÝÅÎÁ ÐÏÌØÚÏ×ÁÔÅÌÀ '%-.32s@%-.64s' ÄÌÑ ÔÁÂÌÉÃÙ '%-.64s'", -"ëÏÍÁÎÄÁ %-.16s ÚÁÐÒÅÝÅÎÁ ÐÏÌØÚÏ×ÁÔÅÌÀ '%-.32s@%-.64s' ÄÌÑ ÓÔÏÌÂÃÁ '%-.64s' × ÔÁÂÌÉÃÅ '%-.64s'", +"ëÏÍÁÎÄÁ %-.16s ÚÁÐÒÅÝÅÎÁ ÐÏÌØÚÏ×ÁÔÅÌÀ '%-.32s'@'%-.64s' ÄÌÑ ÔÁÂÌÉÃÙ '%-.64s'", +"ëÏÍÁÎÄÁ %-.16s ÚÁÐÒÅÝÅÎÁ ÐÏÌØÚÏ×ÁÔÅÌÀ '%-.32s'@'%-.64s' ÄÌÑ ÓÔÏÌÂÃÁ '%-.64s' × ÔÁÂÌÉÃÅ '%-.64s'", "îÅ×ÅÒÎÁÑ ËÏÍÁÎÄÁ GRANT ÉÌÉ REVOKE. ïÂÒÁÔÉÔÅÓØ Ë ÄÏËÕÍÅÎÔÁÃÉÉ, ÞÔÏÂÙ ×ÙÑÓÎÉÔØ, ËÁËÉÅ ÐÒÉ×ÉÌÅÇÉÉ ÍÏÖÎÏ ÉÓÐÏÌØÚÏ×ÁÔØ", "óÌÉÛËÏÍ ÄÌÉÎÎÏÅ ÉÍÑ ÐÏÌØÚÏ×ÁÔÅÌÑ/ÈÏÓÔÁ ÄÌÑ GRANT", "ôÁÂÌÉÃÁ '%-.64s.%-.64s' ÎÅ ÓÕÝÅÓÔ×ÕÅÔ", @@ -214,7 +214,7 @@ "îÅ ÄÏÐÕÓËÁÅÔÓÑ DROP DATABASE, ÐÏËÁ ÐÏÔÏË ÄÅÒÖÉÔ ÇÌÏÂÁÌØÎÕÀ ÂÌÏËÉÒÏ×ËÕ ÞÔÅÎÉÑ", "îÅ ÄÏÐÕÓËÁÅÔÓÑ CREATE DATABASE, ÐÏËÁ ÐÏÔÏË ÄÅÒÖÉÔ ÇÌÏÂÁÌØÎÕÀ ÂÌÏËÉÒÏ×ËÕ ÞÔÅÎÉÑ", "îÅ×ÅÒÎÙÅ ÐÁÒÁÍÅÔÒÙ ÄÌÑ %s", -"%-.32s@%-.64s ÎÅ ÒÁÚÒÅÛÁÅÔÓÑ ÓÏÚÄÁ×ÁÔØ ÎÏ×ÙÈ ÐÏÌØÚÏ×ÁÔÅÌÅÊ", +"'%-.32s'@'%-.64s' ÎÅ ÒÁÚÒÅÛÁÅÔÓÑ ÓÏÚÄÁ×ÁÔØ ÎÏ×ÙÈ ÐÏÌØÚÏ×ÁÔÅÌÅÊ", "îÅ×ÅÒÎÏÅ ÏÐÒÅÄÅÌÅÎÉÅ ÔÁÂÌÉÃÙ; ÷ÓÅ ÔÁÂÌÉÃÙ × MERGE ÄÏÌÖÎÙ ÐÒÉÎÁÄÌÅÖÁÔØ ÏÄÎÏÊ É ÔÏÊ ÖÅ ÂÁÚÅ ÄÁÎÎÙÈ", "÷ÏÚÎÉËÌÁ ÔÕÐÉËÏ×ÁÑ ÓÉÔÕÁÃÉÑ × ÐÒÏÃÅÓÓÅ ÐÏÌÕÞÅÎÉÑ ÂÌÏËÉÒÏ×ËÉ; ðÏÐÒÏÂÕÊÔÅ ÐÅÒÅÚÁÐÕÓÔÉÔØ ÔÒÁÎÚÁËÃÉÀ", "éÓÐÏÌØÚÕÅÍÙÊ ÔÉÐ ÔÁÂÌÉà ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔ ÐÏÌÎÏÔÅËÓÔÏ×ÙÈ ÉÎÄÅËÓÏ×", diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index f4ea3ac3c82..1b07e0d2234 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -51,8 +51,8 @@ "Nema memorije; Proverite da li MySQL server ili neki drugi proces koristi svu slobodnu memoriju. (UNIX: Ako ne, probajte da upotrebite 'ulimit' komandu da biste dozvolili daemon-u da koristi više memorije ili probajte da dodate više swap memorije)", "Ne mogu da dobijem ime host-a za vašu IP adresu", "Loš poèetak komunikacije (handshake)", -"Pristup je zabranjen korisniku '%-.32s@%-.64s' za bazu '%-.64s'", -"Pristup je zabranjen korisniku '%-.32s@%-.64s' (koristi lozinku: '%s')", +"Pristup je zabranjen korisniku '%-.32s'@'%-.64s' za bazu '%-.64s'", +"Pristup je zabranjen korisniku '%-.32s'@'%-.64s' (koristi lozinku: '%s')", "Ni jedna baza nije selektovana", "Nepoznata komanda", "Kolona '%-.64s' ne može biti NULL", @@ -149,8 +149,8 @@ "Funkcija regexp je vratila grešku '%-.64s'", "Upotreba agregatnih funkcija (MIN(),MAX(),COUNT()...) bez 'GROUP' kolona je pogrešna ako ne postoji 'GROUP BY' iskaz", "Ne postoji odobrenje za pristup korisniku '%-.32s' na host-u '%-.64s'", -"%-.16s komanda zabranjena za korisnika '%-.32s@%-.64s' za tabelu '%-.64s'", -"%-.16s komanda zabranjena za korisnika '%-.32s@%-.64s' za kolonu '%-.64s' iz tabele '%-.64s'", +"%-.16s komanda zabranjena za korisnika '%-.32s'@'%-.64s' za tabelu '%-.64s'", +"%-.16s komanda zabranjena za korisnika '%-.32s'@'%-.64s' za kolonu '%-.64s' iz tabele '%-.64s'", "Pogrešna 'GRANT' odnosno 'REVOKE' komanda. Molim Vas pogledajte u priruèniku koje vrednosti mogu biti upotrebljene.", "Argument 'host' ili 'korisnik' prosleðen komandi 'GRANT' je predugaèak", "Tabela '%-.64s.%-.64s' ne postoji", @@ -218,7 +218,7 @@ "Komanda 'DROP DATABASE' nije dozvoljena dok thread globalno zakljuèava èitanje podataka", "Komanda 'CREATE DATABASE' nije dozvoljena dok thread globalno zakljuèava èitanje podataka", "Pogrešni argumenti prosleðeni na %s", -"Korisniku %-.32s@%-.64s nije dozvoljeno da kreira nove korisnike", +"Korisniku '%-.32s'@'%-.64s' nije dozvoljeno da kreira nove korisnike", "Pogrešna definicija tabele; sve 'MERGE' tabele moraju biti u istoj bazi podataka", "Unakrsno zakljuèavanje pronaðeno kada sam pokušao da dobijem pravo na zakljuèavanje; Probajte da restartujete transakciju", "Upotrebljeni tip tabele ne podržava 'FULLTEXT' indekse", diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 2ba4f2f0548..a812e5841e2 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -53,8 +53,8 @@ "Málo miesta-pamäti pre vlákno", "Nemô¾em zisti» meno hostiteµa pre va¹u adresu", "Chyba pri nadväzovaní spojenia", -"Zakázaný prístup pre u¾ívateµa: '%-.32s@%-.64s' k databázi '%-.64s'", -"Zakázaný prístup pre u¾ívateµa: '%-.32s@%-.64s' (pou¾itie hesla: %s)", +"Zakázaný prístup pre u¾ívateµa: '%-.32s'@'%-.64s' k databázi '%-.64s'", +"Zakázaný prístup pre u¾ívateµa: '%-.32s'@'%-.64s' (pou¾itie hesla: %s)", "Nebola vybraná databáza", "Neznámy príkaz", "Pole '%-.64s' nemô¾e by» null", @@ -151,8 +151,8 @@ "Got error '%-.64s' from regexp", "Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if there is no GROUP BY clause", "There is no such grant defined for user '%-.32s' on host '%-.64s'", -"%-.16s command denied to user: '%-.32s@%-.64s' for table '%-.64s'", -"%-.16s command denied to user: '%-.32s@%-.64s' for column '%-.64s' in table '%-.64s'", +"%-.16s command denied to user: '%-.32s'@'%-.64s' for table '%-.64s'", +"%-.16s command denied to user: '%-.32s'@'%-.64s' for column '%-.64s' in table '%-.64s'", "Illegal GRANT/REVOKE command. Please consult the manual which privleges can be used.", "The host or user argument to GRANT is too long", "Table '%-.64s.%s' doesn't exist", @@ -220,7 +220,7 @@ "DROP DATABASE not allowed while thread is holding global read lock", "CREATE DATABASE not allowed while thread is holding global read lock", "Wrong arguments to %s", -"%-.32s@%-.64s is not allowed to create new users", +"'%-.32s'@'%-.64s' is not allowed to create new users", "Incorrect table definition; all MERGE tables must be in the same database", "Deadlock found when trying to get lock; Try restarting transaction", "The used table type doesn't support FULLTEXT indexes", diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index c7f8d51dee9..e586e7777c1 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -46,8 +46,8 @@ "Memoria/espacio de tranpaso insuficiente", "No puedo obtener el nombre de maquina de tu direccion", "Protocolo erroneo", -"Acceso negado para usuario: '%-.32s@%-.64s' para la base de datos '%-.64s'", -"Acceso negado para usuario: '%-.32s@%-.64s' (Usando clave: %s)", +"Acceso negado para usuario: '%-.32s'@'%-.64s' para la base de datos '%-.64s'", +"Acceso negado para usuario: '%-.32s'@'%-.64s' (Usando clave: %s)", "Base de datos no seleccionada", "Comando desconocido", "La columna '%-.64s' no puede ser nula", @@ -144,8 +144,8 @@ "Obtenido error '%-.64s' de regexp", "Mezcla de columnas GROUP (MIN(),MAX(),COUNT()...) con no GROUP columnas es ilegal si no hat la clausula GROUP BY", "No existe permiso definido para usuario '%-.32s' en el servidor '%-.64s'", -"%-.16s comando negado para usuario: '%-.32s@%-.64s' para tabla '%-.64s'", -"%-.16s comando negado para usuario: '%-.32s@%-.64s' para columna '%-.64s' en la tabla '%-.64s'", +"%-.16s comando negado para usuario: '%-.32s'@'%-.64s' para tabla '%-.64s'", +"%-.16s comando negado para usuario: '%-.32s'@'%-.64s' para columna '%-.64s' en la tabla '%-.64s'", "Ilegal comando GRANT/REVOKE. Por favor consulte el manual para cuales permisos pueden ser usados.", "El argumento para servidor o usuario para GRANT es demasiado grande", "Tabla '%-.64s.%s' no existe", @@ -213,7 +213,7 @@ "DROP DATABASE no permitido mientras un thread está ejerciendo un bloqueo de lectura global", "CREATE DATABASE no permitido mientras un thread está ejerciendo un bloqueo de lectura global", "Wrong arguments to %s", -"%-.32s@%-.64s is not allowed to create new users", +"'%-.32s'@'%-.64s' is not allowed to create new users", "Incorrect table definition; all MERGE tables must be in the same database", "Deadlock found when trying to get lock; Try restarting transaction", "The used table type doesn't support FULLTEXT indexes", diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index 0d51cb4b543..8029ab0d435 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -45,8 +45,8 @@ "Fick slut på minnet. Kontrollera om mysqld eller någon annan process använder allt tillgängligt minne. Om inte, försök använda 'ulimit' eller allokera mera swap", "Kan inte hitta 'hostname' för din adress", "Fel vid initiering av kommunikationen med klienten", -"Användare '%-.32s@%-.64s' är ej berättigad att använda databasen %-.64s", -"Användare '%-.32s@%-.64s' är ej berättigad att logga in (Använder lösen: %s)", +"Användare '%-.32s'@'%-.64s' är ej berättigad att använda databasen %-.64s", +"Användare '%-.32s'@'%-.64s' är ej berättigad att logga in (Använder lösen: %s)", "Ingen databas i användning", "Okänt commando", "Kolumn '%-.64s' får inte vara NULL", @@ -143,8 +143,8 @@ "Fick fel '%-.64s' från REGEXP", "Man får ha både GROUP-kolumner (MIN(),MAX(),COUNT()...) och fält i en fråga om man inte har en GROUP BY-del", "Det finns inget privilegium definierat för användare '%-.32s' på '%-.64s'", -"%-.16s ej tillåtet för '%-.32s@%-.64s' för tabell '%-.64s'", -"%-.16s ej tillåtet för '%-.32s@%-.64s' för kolumn '%-.64s' i tabell '%-.64s'", +"%-.16s ej tillåtet för '%-.32s'@'%-.64s' för tabell '%-.64s'", +"%-.16s ej tillåtet för '%-.32s'@'%-.64s' för kolumn '%-.64s' i tabell '%-.64s'", "Felaktigt GRANT-privilegium använt", "Felaktigt maskinnamn eller användarnamn använt med GRANT", "Det finns ingen tabell som heter '%-.64s.%s'", @@ -212,7 +212,7 @@ "DROP DATABASE är inte tillåtet när man har ett globalt läslås", "CREATE DATABASE är inte tillåtet när man har ett globalt läslås", "Felaktiga argument till %s", -"%-.32s@%-.64s har inte rättighet att skapa nya användare", +"'%-.32s'@'%-.64s' har inte rättighet att skapa nya användare", "Felaktig tabelldefinition; alla tabeller i en MERGE-tabell måste vara i samma databas", "Fick 'DEADLOCK' vid låsförsök av block/rad. Försök att starta om transaktionen", "Tabelltypen har inte hantering av FULLTEXT-index", diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index 4e22dbfcf3e..d4ffae6e5ae 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -50,8 +50,8 @@ "âÒÁË ÐÁÍ'ÑÔ¦; ðÅÒÅצÒÔÅ ÞÉ mysqld ÁÂÏ ÑË¦ÓØ ¦ÎÛ¦ ÐÒÏÃÅÓÉ ×ÉËÏÒÉÓÔÏ×ÕÀÔØ ÕÓÀ ÄÏÓÔÕÐÎÕ ÐÁÍ'ÑÔØ. ñË Î¦, ÔÏ ×É ÍÏÖÅÔÅ ÓËÏÒÉÓÔÁÔÉÓÑ 'ulimit', ÁÂÉ ÄÏÚ×ÏÌÉÔÉ mysqld ×ÉËÏÒÉÓÔÏ×Õ×ÁÔÉ Â¦ÌØÛÅ ÐÁÍ'ÑÔ¦ ÁÂÏ ×É ÍÏÖÅÔÅ ÄÏÄÁÔÉ Â¦ÌØÛŠͦÓÃÑ Ð¦Ä Ó×ÁÐ", "îÅ ÍÏÖÕ ×ÉÚÎÁÞÉÔÉ ¦Í'Ñ ÈÏÓÔÕ ÄÌÑ ×ÁÛϧ ÁÄÒÅÓÉ", "îÅצÒÎÁ ÕÓÔÁÎÏ×ËÁ Ú×'ÑÚËÕ", -"äÏÓÔÕÐ ÚÁÂÏÒÏÎÅÎÏ ÄÌÑ ËÏÒÉÓÔÕ×ÁÞÁ: '%-.32s@%-.64s' ÄÏ ÂÁÚÉ ÄÁÎÎÉÈ '%-.64s'", -"äÏÓÔÕÐ ÚÁÂÏÒÏÎÅÎÏ ÄÌÑ ËÏÒÉÓÔÕ×ÁÞÁ: '%-.32s@%-.64s' (÷ÉËÏÒÉÓÔÁÎÏ ÐÁÒÏÌØ: %s)", +"äÏÓÔÕÐ ÚÁÂÏÒÏÎÅÎÏ ÄÌÑ ËÏÒÉÓÔÕ×ÁÞÁ: '%-.32s'@'%-.64s' ÄÏ ÂÁÚÉ ÄÁÎÎÉÈ '%-.64s'", +"äÏÓÔÕÐ ÚÁÂÏÒÏÎÅÎÏ ÄÌÑ ËÏÒÉÓÔÕ×ÁÞÁ: '%-.32s'@'%-.64s' (÷ÉËÏÒÉÓÔÁÎÏ ÐÁÒÏÌØ: %s)", "âÁÚÕ ÄÁÎÎÉÈ ÎÅ ×ÉÂÒÁÎÏ", "îÅצÄÏÍÁ ËÏÍÁÎÄÁ", "óÔÏ×ÂÅÃØ '%-.64s' ÎÅ ÍÏÖÅ ÂÕÔÉ ÎÕÌØÏ×ÉÍ", @@ -148,8 +148,8 @@ "ïÔÒÉÍÁÎÏ ÐÏÍÉÌËÕ '%-.64s' ×¦Ä ÒÅÇÕÌÑÒÎÏÇÏ ×ÉÒÁÚÕ", "úͦÛÕ×ÁÎÎÑ GROUP ÓÔÏ×ÂÃ¦× (MIN(),MAX(),COUNT()...) Ú ÎÅ GROUP ÓÔÏ×ÂÃÑÍÉ ¤ ÚÁÂÏÒÏÎÅÎÉÍ, ÑËÝÏ ÎÅ ÍÁ¤ GROUP BY", "ðÏ×ÎÏ×ÁÖÅÎØ ÎÅ ×ÉÚÎÁÞÅÎÏ ÄÌÑ ËÏÒÉÓÔÕ×ÁÞÁ '%-.32s' Ú ÈÏÓÔÕ '%-.64s'", -"%-.16s ËÏÍÁÎÄÁ ÚÁÂÏÒÏÎÅÎÁ ËÏÒÉÓÔÕ×ÁÞÕ: '%-.32s@%-.64s' Õ ÔÁÂÌÉæ '%-.64s'", -"%-.16s ËÏÍÁÎÄÁ ÚÁÂÏÒÏÎÅÎÁ ËÏÒÉÓÔÕ×ÁÞÕ: '%-.32s@%-.64s' ÄÌÑ ÓÔÏ×ÂÃÑ '%-.64s' Õ ÔÁÂÌÉæ '%-.64s'", +"%-.16s ËÏÍÁÎÄÁ ÚÁÂÏÒÏÎÅÎÁ ËÏÒÉÓÔÕ×ÁÞÕ: '%-.32s'@'%-.64s' Õ ÔÁÂÌÉæ '%-.64s'", +"%-.16s ËÏÍÁÎÄÁ ÚÁÂÏÒÏÎÅÎÁ ËÏÒÉÓÔÕ×ÁÞÕ: '%-.32s'@'%-.64s' ÄÌÑ ÓÔÏ×ÂÃÑ '%-.64s' Õ ÔÁÂÌÉæ '%-.64s'", "èÉÂÎÁ GRANT/REVOKE ËÏÍÁÎÄÁ. ðÒÏÞÉÔÁÊÔÅ ÄÏËÕÍÅÎÔÁæÀ ÓÔÏÓÏ×ÎÏ ÔÏÇÏ, Ñ˦ ÐÒÁ×Á ÍÏÖÎÁ ×ÉËÏÒÉÓÔÏ×Õ×ÁÔÉ.", "áÒÇÕÍÅÎÔ host ÁÂÏ user ÄÌÑ GRANT ÚÁÄÏ×ÇÉÊ", "ôÁÂÌÉÃÑ '%-.64s.%-.64s' ÎÅ ¦ÓÎÕ¤", @@ -217,7 +217,7 @@ "DROP DATABASE ÎÅ ÄÏÚ×ÏÌÅÎÏ ÄÏËÉ Ç¦ÌËÁ ÐÅÒÅÂÕ×Á¤ Ð¦Ä ÚÁÇÁÌØÎÉÍ ÂÌÏËÕ×ÁÎÎÑÍ ÞÉÔÁÎÎÑ", "CREATE DATABASE ÎÅ ÄÏÚ×ÏÌÅÎÏ ÄÏËÉ Ç¦ÌËÁ ÐÅÒÅÂÕ×Á¤ Ð¦Ä ÚÁÇÁÌØÎÉÍ ÂÌÏËÕ×ÁÎÎÑÍ ÞÉÔÁÎÎÑ", "èÉÂÎÉÊ ÁÒÇÕÍÅÎÔ ÄÌÑ %s", -"ëÏÒÉÓÔÕ×ÁÞÕ %-.32s@%-.64s ÎÅ ÄÏÚ×ÏÌÅÎÏ ÓÔ×ÏÒÀ×ÁÔÉ ÎÏ×ÉÈ ËÏÒÉÓÔÕ×ÁÞ¦×", +"ëÏÒÉÓÔÕ×ÁÞÕ '%-.32s'@'%-.64s' ÎÅ ÄÏÚ×ÏÌÅÎÏ ÓÔ×ÏÒÀ×ÁÔÉ ÎÏ×ÉÈ ËÏÒÉÓÔÕ×ÁÞ¦×", "Incorrect table definition; all MERGE tables must be in the same database", "Deadlock found when trying to get lock; Try restarting transaction", "÷ÉËÏÒÉÓÔÁÎÉÊ ÔÉÐ ÔÁÂÌÉæ ΊЦÄÔÒÉÍÕ¤ FULLTEXT ¦ÎÄÅËÓ¦×", From 13325ee789c6f8a16dcf94675b8edf2c8c2b1bea Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 25 Jul 2003 11:03:57 +0500 Subject: [PATCH 33/54] Bug#909: mysqld --verbose --help != mysqld --help --verbose Proposed fix for bug#909 --- sql/mysqld.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index bdbbdd18baf..f44d589d9b2 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -229,6 +229,7 @@ bool opt_large_files= sizeof(my_off_t) > 4; /* Used with --help for detailed option */ +bool opt_help= 0; bool opt_verbose= 0; arg_cmp_func Arg_comparator::comparator_matrix[4][2] = @@ -3642,8 +3643,9 @@ Disable with --skip-bdb (will save memory).", "Percentage of dirty pages allowed in bufferpool.", (gptr*) &srv_max_buf_pool_modified_pct, (gptr*) &srv_max_buf_pool_modified_pct, 0, GET_ULONG, REQUIRED_ARG, 90, 0, 100, 0, 0, 0}, #endif /* End HAVE_INNOBASE_DB */ - {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, - 0, 0, 0, 0, 0}, + {"help", '?', "Display this help and exit.", + (gptr*) &opt_help, (gptr*) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, + 0, 0}, {"verbose", 'v', "Used with --help option for detailed help", (gptr*) &opt_verbose, (gptr*) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -4882,16 +4884,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; #endif #include - case 'v': - usage(); - exit(0); case 'V': print_version(); exit(0); - case 'I': - case '?': - usage(); - exit(0); case 'T': test_flags= argument ? (uint) atoi(argument) : 0; test_flags&= ~TEST_NO_THREADS; @@ -5365,6 +5360,11 @@ static void get_options(int argc,char **argv) exit(ho_error); } + if (opt_verbose || opt_help) + { + usage(); + exit(0); + } #if defined(HAVE_BROKEN_REALPATH) my_use_symdir=0; my_disable_symlinks=1; From 65a12f457d785c14fc75ff48e58ec5d86cfb6b6e Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 26 Jul 2003 23:14:09 +0200 Subject: [PATCH 34/54] My changes to test rpl_insert_id in 4.0 about replication of foreign_key_checks have in fact no effect, because in 4.0 the slave always runs with --skip-innodb. In 4.1, mysqld accepts option --innodb which can override --skip-innodb. So I add this option to the test. When the updated test (using InnoDB tables) from 4.0 will be merged into 4.1, with this good .opt file, we'll have a meaningful test in 4.1. Until then, the test in 4.1 will pass but be useless. And in 4.0, it will stay useless forever. ("it" = the part of the test which tests replication of foreign_key_checks) BitKeeper/deleted/.del-rpl_insert_id-slave.opt~ba10e66ea50b556: Delete: mysql-test/rpl_insert_id-slave.opt --- mysql-test/t/rpl_insert_id-slave.opt | 1 + 1 file changed, 1 insertion(+) create mode 100644 mysql-test/t/rpl_insert_id-slave.opt diff --git a/mysql-test/t/rpl_insert_id-slave.opt b/mysql-test/t/rpl_insert_id-slave.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/t/rpl_insert_id-slave.opt @@ -0,0 +1 @@ +--innodb From c4747440001aa9a0fc911418cd0bd3ab9be6c5b1 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 27 Jul 2003 10:17:04 +0200 Subject: [PATCH 35/54] ulong is not portable --- include/mysql.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/mysql.h b/include/mysql.h index 719cf800234..8e8ffc2b788 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -542,15 +542,15 @@ typedef struct st_mysql_stmt typedef struct st_mysql_methods { my_bool STDCALL (*read_query_result)(MYSQL *mysql); - my_bool STDCALL (*advanced_command)(MYSQL *mysql, + my_bool STDCALL (*advanced_command)(MYSQL *mysql, enum enum_server_command command, - const char *header, - ulong header_length, - const char *arg, - ulong arg_length, my_bool skip_check); + const char *header, + unsigned long header_length, + const char *arg, + unsigned long arg_length, my_bool skip_check); MYSQL_RES * STDCALL (*store_result)(MYSQL *mysql); MYSQL_RES * STDCALL (*use_result)(MYSQL *mysql); - void STDCALL (*fetch_lengths)(ulong *to, MYSQL_ROW column, uint field_count); + void STDCALL (*fetch_lengths)(unsigned long *to, MYSQL_ROW column, uint field_count); } MYSQL_METHODS; MYSQL_STMT * STDCALL mysql_prepare(MYSQL * mysql, const char *query, From 673a1d8044203bd7de779b08811d471fac5f05f8 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 27 Jul 2003 10:26:29 +0200 Subject: [PATCH 36/54] 'mysqld --verbose' should not print help screen --- sql/mysqld.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f44d589d9b2..8ddcbdc572f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5360,7 +5360,7 @@ static void get_options(int argc,char **argv) exit(ho_error); } - if (opt_verbose || opt_help) + if (opt_help) { usage(); exit(0); From a56959a5b6b5e04e86b03e33fd4eb664322f9342 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 28 Jul 2003 10:57:46 -0400 Subject: [PATCH 37/54] changed for AUTO_VALUE_ON_ZERO mysql-test/r/auto_increment.result: added test for AUTO_VALUE_ON_ZERO mysql-test/t/auto_increment.test: added test for AUTO_VALUE_ON_ZERO --- mysql-test/r/auto_increment.result | 87 +++++++++++++++++++++++++----- mysql-test/t/auto_increment.test | 31 ++++++++--- sql/field_conv.cc | 2 +- sql/handler.cc | 9 ++-- sql/sql_base.cc | 8 +-- sql/sql_insert.cc | 1 - sql/table.h | 2 +- 7 files changed, 111 insertions(+), 29 deletions(-) diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result index 99e5e596fd3..03cfcc50e17 100644 --- a/mysql-test/r/auto_increment.result +++ b/mysql-test/r/auto_increment.result @@ -150,28 +150,91 @@ select last_insert_id(); last_insert_id() 0 drop table t1; -drop table if exists t1; -Warnings: -Note 1051 Unknown table 't1' create table t1(a int auto_increment,b int null,primary key(a)); SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO; insert into t1(a,b)values(NULL,1); insert into t1(a,b)values(200,2); insert into t1(a,b)values(0,3); insert into t1(b)values(4); -SET SQL_MODE=''; -insert into t1(a,b)values(NULL,5); -insert into t1(a,b)values(300,6); -insert into t1(a,b)values(0,7); -insert into t1(b)values(8); -select * from t1; +insert into t1(b)values(5); +insert into t1(b)values(6); +insert into t1(b)values(7); +select * from t1 order by b; a b 1 1 200 2 0 3 201 4 202 5 -300 6 -301 7 -302 8 +203 6 +204 7 +delete from t1 where a=0; +update t1 set a=0 where b=5; +select * from t1 order by b; +a b +1 1 +200 2 +201 4 +0 5 +203 6 +204 7 +delete from t1 where a=0; +update t1 set a=NULL where b=6; +Warnings: +Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 4 +update t1 set a=300 where b=7; +SET SQL_MODE=''; +insert into t1(a,b)values(NULL,8); +insert into t1(a,b)values(400,9); +insert into t1(a,b)values(0,10); +insert into t1(b)values(11); +insert into t1(b)values(12); +insert into t1(b)values(13); +insert into t1(b)values(14); +select * from t1 order by b; +a b +1 1 +200 2 +201 4 +0 6 +300 7 +301 8 +400 9 +401 10 +402 11 +403 12 +404 13 +405 14 +delete from t1 where a=0; +update t1 set a=0 where b=12; +select * from t1 order by b; +a b +1 1 +200 2 +201 4 +300 7 +301 8 +400 9 +401 10 +402 11 +0 12 +404 13 +405 14 +delete from t1 where a=0; +update t1 set a=NULL where b=13; +Warnings: +Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 9 +update t1 set a=500 where b=14; +select * from t1 order by b; +a b +1 1 +200 2 +201 4 +300 7 +301 8 +400 9 +401 10 +402 11 +0 13 +500 14 drop table t1; diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test index e187d42625e..b46993ec6dd 100644 --- a/mysql-test/t/auto_increment.test +++ b/mysql-test/t/auto_increment.test @@ -106,17 +106,36 @@ select last_insert_id(); drop table t1; -drop table if exists t1; create table t1(a int auto_increment,b int null,primary key(a)); SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO; insert into t1(a,b)values(NULL,1); insert into t1(a,b)values(200,2); insert into t1(a,b)values(0,3); insert into t1(b)values(4); +insert into t1(b)values(5); +insert into t1(b)values(6); +insert into t1(b)values(7); +select * from t1 order by b; +delete from t1 where a=0; +update t1 set a=0 where b=5; +select * from t1 order by b; +delete from t1 where a=0; +update t1 set a=NULL where b=6; +update t1 set a=300 where b=7; SET SQL_MODE=''; -insert into t1(a,b)values(NULL,5); -insert into t1(a,b)values(300,6); -insert into t1(a,b)values(0,7); -insert into t1(b)values(8); -select * from t1; +insert into t1(a,b)values(NULL,8); +insert into t1(a,b)values(400,9); +insert into t1(a,b)values(0,10); +insert into t1(b)values(11); +insert into t1(b)values(12); +insert into t1(b)values(13); +insert into t1(b)values(14); +select * from t1 order by b; +delete from t1 where a=0; +update t1 set a=0 where b=12; +select * from t1 order by b; +delete from t1 where a=0; +update t1 set a=NULL where b=13; +update t1 set a=500 where b=14; +select * from t1 order by b; drop table t1; diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 40e423a5aca..44e30afb880 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -173,7 +173,7 @@ set_field_to_null_with_conversions(Field *field, bool no_conversions) field->reset(); if (field == field->table->next_number_field) { - field->table->auto_increment_field_is_null= true; + field->table->auto_increment_field_not_null= false; return 0; // field is set in handler.cc } if (current_thd->count_cuted_fields) diff --git a/sql/handler.cc b/sql/handler.cc index 7f4b63e7551..90fd754a4c5 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -697,14 +697,15 @@ void handler::update_auto_increment() longlong nr; THD *thd; DBUG_ENTER("update_auto_increment"); - if (table->auto_increment_field_is_null) - table->auto_increment_field_is_null= false; - else if (table->next_number_field->val_int() != 0 || - current_thd->variables.sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO) + if (table->next_number_field->val_int() != 0 || + table->auto_increment_field_not_null && + current_thd->variables.sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO) { + table->auto_increment_field_not_null= false; auto_increment_column_changed=0; DBUG_VOID_RETURN; } + table->auto_increment_field_not_null= false; thd=current_thd; if ((nr=thd->next_insert_id)) thd->next_insert_id=0; // Clear after use diff --git a/sql/sql_base.cc b/sql/sql_base.cc index a7798588d59..dbb29cf53e3 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2247,8 +2247,8 @@ fill_record(List &fields,List &values, bool ignore_errors) value=v++; Field *rfield= field->field; TABLE *table= rfield->table; - if (rfield==table->next_number_field) - table->auto_increment_field_is_null= false; + if (rfield == table->next_number_field) + table->auto_increment_field_not_null= true; if (value->save_in_field(rfield, 0) > 0 && !ignore_errors) DBUG_RETURN(1); } @@ -2268,8 +2268,8 @@ fill_record(Field **ptr,List &values, bool ignore_errors) { value=v++; TABLE *table= field->table; - if (field==table->next_number_field) - table->auto_increment_field_is_null= false; + if (field == table->next_number_field) + table->auto_increment_field_not_null= true; if (value->save_in_field(field, 0) == 1 && !ignore_errors) DBUG_RETURN(1); } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index bddaffd3f4f..947205949f1 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -253,7 +253,6 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, else bulk_insert=0; - table->auto_increment_field_is_null= true; while ((values= its++)) { if (fields.elements || !value_count) diff --git a/sql/table.h b/sql/table.h index 8137f47aa1f..1831c834de6 100644 --- a/sql/table.h +++ b/sql/table.h @@ -116,7 +116,7 @@ struct st_table { my_bool crashed; my_bool is_view; my_bool no_keyread; - my_bool auto_increment_field_is_null; + my_bool auto_increment_field_not_null; Field *next_number_field, /* Set if next_number is activated */ *found_next_number_field, /* Set on open */ *rowid_field; From 683e3ef018122cc3b011cb2572af76fc96d94355 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 28 Jul 2003 16:58:51 +0200 Subject: [PATCH 38/54] test results fixed --- mysql-test/r/grant2.result | 2 +- mysql-test/t/grant2.test | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result index d49b9daee85..0b127188586 100644 --- a/mysql-test/r/grant2.result +++ b/mysql-test/r/grant2.result @@ -7,7 +7,7 @@ current_user() mysqltest_1@localhost grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option; grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option; -ERROR 42000: Access denied for user: 'mysqltest_1@localhost' to database 'my_%' +ERROR 42000: Access denied for user: 'mysqltest_1'@'localhost' to database 'my_%' show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test index 3fbe2b0fe58..148c4d3da21 100644 --- a/mysql-test/t/grant2.test +++ b/mysql-test/t/grant2.test @@ -19,8 +19,7 @@ grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option; --error 1044 grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option; disconnect user1; -connect (root,localhost,root,,); -connection root; +connection default; show grants for mysqltest_1@localhost; show grants for mysqltest_2@localhost; --error 1141 From 329e063774537c14348a46c162afec79fc94d589 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 28 Jul 2003 16:58:52 +0200 Subject: [PATCH 39/54] bugs #701 and #783 - old .frm files were read in incorrectly in 4.1 (each field was assigned a charset, BLOBs were converted to TEXT) --- sql/field.h | 5 +++-- sql/table.cc | 10 ++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/sql/field.h b/sql/field.h index 5df7d554c35..79c45a99a43 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1132,7 +1132,7 @@ bool test_if_int(const char *str, int length, const char *int_end, */ #define FIELDFLAG_DECIMAL 1 -#define FIELDFLAG_BINARY 1 // Shares same flag +#define FIELDFLAG_BINARY 1 // Shares same flag #define FIELDFLAG_NUMBER 2 #define FIELDFLAG_ZEROFILL 4 #define FIELDFLAG_PACK 120 // Bits used for packing @@ -1163,7 +1163,8 @@ bool test_if_int(const char *str, int length, const char *int_end, #define f_packtype(x) (((x) >> FIELDFLAG_PACK_SHIFT) & 15) #define f_decimals(x) ((uint8) (((x) >> FIELDFLAG_DEC_SHIFT) & FIELDFLAG_MAX_DEC)) #define f_is_alpha(x) (!f_is_num(x)) -#define f_is_enum(x) ((x) & FIELDFLAG_INTERVAL) +#define f_is_binary(x) ((x) & FIELDFLAG_BINARY) // 4.0- compatibility +#define f_is_enum(x) ((x) & FIELDFLAG_INTERVAL) #define f_is_bitfield(x) ((x) & FIELDFLAG_BITFIELD) #define f_is_blob(x) (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == FIELDFLAG_BLOB) #define f_is_geom(x) ((x) & FIELDFLAG_GEOM) diff --git a/sql/table.cc b/sql/table.cc index 0fc2a09f749..1cee0587f17 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -138,7 +138,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, outparam->raid_chunks= head[42]; outparam->raid_chunksize= uint4korr(head+43); if (!(outparam->table_charset=get_charset((uint) head[38],MYF(0)))) - outparam->table_charset=NULL; // QQ display error message? + outparam->table_charset=default_charset_info; // QQ display error message? null_field_first=1; } outparam->db_record_offset=1; @@ -398,8 +398,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, if (!strpos[14]) charset= &my_charset_bin; else if (!(charset=get_charset((uint) strpos[14], MYF(0)))) - charset= (outparam->table_charset ? outparam->table_charset: - default_charset_info); + charset= outparam->table_charset; } if (!comment_length) { @@ -423,8 +422,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, /* old frm file */ field_type= (enum_field_types) f_packtype(pack_flag); - charset=(outparam->table_charset ? outparam->table_charset : - default_charset_info); + charset=f_is_binary(pack_flag) ? &my_charset_bin : outparam->table_charset; bzero((char*) &comment, sizeof(comment)); } *field_ptr=reg_field= @@ -599,7 +597,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, } keyinfo->usable_key_parts=usable_parts; // Filesort } - if (primary_key < MAX_KEY && + if (primary_key < MAX_KEY && (outparam->keys_in_use & ((key_map) 1 << primary_key))) { outparam->primary_key=primary_key; From 4ef2a4306d2d5930fbf0e1080d856e886948cdc3 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 28 Jul 2003 20:16:11 +0500 Subject: [PATCH 40/54] Fix for #886 sql-common/client.c: SOCKET_EINTR is handled differently working in replication --- sql-common/client.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sql-common/client.c b/sql-common/client.c index 58d82b5b801..f9219e5418d 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -547,6 +547,10 @@ net_safe_read(MYSQL *mysql) { DBUG_PRINT("error",("Wrong connection or packet. fd: %s len: %d", vio_description(net->vio),len)); +#ifdef MYSQL_SERVER + if (socket_errno == SOCKET_EINTR) + return (packet_error); +#endif /*MYSQL_SERVER*/ end_server(mysql); net->last_errno=(net->last_errno == ER_NET_PACKET_TOO_LARGE ? CR_NET_PACKET_TOO_LARGE: From 37ddcebad2df1bad985a07274f20e1a878dbacbf Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 28 Jul 2003 18:28:44 +0300 Subject: [PATCH 41/54] tabe & query hashes made case insensitive (BUG#933) mysql-test/r/query_cache.result: fixed charecter sets new case sensetive test mysql-test/t/query_cache.test: fixed charecter sets new case sensetive test sql/sql_cache.cc: query & table comparision should be case insensitive --- mysql-test/r/query_cache.result | 34 +++++++++++++++++++++------------ mysql-test/t/query_cache.test | 14 ++++++++++++-- sql/sql_cache.cc | 4 ++-- 3 files changed, 36 insertions(+), 16 deletions(-) diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index 3b3e52d8240..68ddb5a377b 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -374,22 +374,23 @@ drop database mysqltest; show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 -create table t1 (a char(1) not null); -insert into t1 values("á"); +create table t1 (a char(1) not null collate koi8r_general_ci); +insert into t1 values(_koi8r"á"); +set CHARACTER SET koi8r; select * from t1; a á set CHARACTER SET cp1251_koi8; select * from t1; a -á +À set CHARACTER SET DEFAULT; show status like "Qcache_queries_in_cache"; Variable_name Value -Qcache_queries_in_cache 1 +Qcache_queries_in_cache 2 show status like "Qcache_hits"; Variable_name Value -Qcache_hits 5 +Qcache_hits 4 drop table t1; create database if not exists mysqltest; create table mysqltest.t1 (i int not null); @@ -415,7 +416,7 @@ Variable_name Value Qcache_queries_in_cache 2 show status like "Qcache_hits"; Variable_name Value -Qcache_hits 7 +Qcache_hits 6 drop database mysqltest; drop table t1; create table t1 (i int not null); @@ -429,7 +430,7 @@ FOUND_ROWS() 4 show status like "Qcache_hits"; Variable_name Value -Qcache_hits 7 +Qcache_hits 6 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 @@ -441,7 +442,7 @@ FOUND_ROWS() 1 show status like "Qcache_hits"; Variable_name Value -Qcache_hits 7 +Qcache_hits 6 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 @@ -454,7 +455,7 @@ FOUND_ROWS() 4 show status like "Qcache_hits"; Variable_name Value -Qcache_hits 8 +Qcache_hits 7 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 @@ -466,7 +467,7 @@ FOUND_ROWS() 1 show status like "Qcache_hits"; Variable_name Value -Qcache_hits 9 +Qcache_hits 8 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 @@ -535,7 +536,7 @@ a 3 show status like "Qcache_hits"; Variable_name Value -Qcache_hits 12 +Qcache_hits 11 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 @@ -552,7 +553,7 @@ a 3 show status like "Qcache_hits"; Variable_name Value -Qcache_hits 13 +Qcache_hits 12 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 @@ -561,6 +562,15 @@ set GLOBAL query_cache_min_res_unit=default; show global variables like "query_cache_min_res_unit"; Variable_name Value query_cache_min_res_unit 4096 +create table t1 (a int not null); +insert into t1 values (1); +select "aaa" from t1; +aaa +aaa +select "AAA" from t1; +AAA +AAA +drop table t1; create table t1 (a int); set GLOBAL query_cache_size=1000; show global variables like "query_cache_size"; diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index 929146ba97a..6261260115c 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -260,8 +260,9 @@ show status like "Qcache_queries_in_cache"; # # Charset convertion (cp1251_koi8 always present) # -create table t1 (a char(1) not null); -insert into t1 values("á"); +create table t1 (a char(1) not null collate koi8r_general_ci); +insert into t1 values(_koi8r"á"); +set CHARACTER SET koi8r; select * from t1; set CHARACTER SET cp1251_koi8; select * from t1; @@ -368,6 +369,15 @@ drop table t2; set GLOBAL query_cache_min_res_unit=default; show global variables like "query_cache_min_res_unit"; +# +# Case sensitive test +# +create table t1 (a int not null); +insert into t1 values (1); +select "aaa" from t1; +select "AAA" from t1; +drop table t1; + # # Test of query cache resizing # diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index ac6471e794c..767a1a46dcc 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1422,10 +1422,10 @@ ulong Query_cache::init_cache() DUMP(this); - VOID(hash_init(&queries,system_charset_info,def_query_hash_size, 0, 0, + VOID(hash_init(&queries, &my_charset_bin, def_query_hash_size, 0, 0, query_cache_query_get_key, 0, 0)); #ifndef FN_NO_CASE_SENCE - VOID(hash_init(&tables,system_charset_info,def_table_hash_size, 0, 0, + VOID(hash_init(&tables, &my_charset_bin, def_table_hash_size, 0, 0, query_cache_table_get_key, 0, 0)); #else // windows, OS/2 or other case insensitive file names work around From 0db8648a1a98fc376668459095b53f85bddba8fc Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 Jul 2003 00:40:50 +0200 Subject: [PATCH 42/54] logging_ok: Logging to logging@openlogging.org accepted README.1st: new file - Readme for Windows distribution BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + Docs/README.1st | 62 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100755 Docs/README.1st diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 58286f16f5c..bc24761c7f9 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -25,6 +25,7 @@ gluh@gluh.(none) gluh@gluh.mysql.r18.ru greg@mysql.com guilhem@mysql.com +gweir@build.mysql.com gweir@work.mysql.com heikki@donna.mysql.fi heikki@hundin.mysql.fi diff --git a/Docs/README.1st b/Docs/README.1st new file mode 100755 index 00000000000..a6da0680924 --- /dev/null +++ b/Docs/README.1st @@ -0,0 +1,62 @@ +This ALPHA build of MySQL 4.1 for the Windows platform does not come with +an installer. A full-featured installer is being developed for +the 4.1 series, and it is scheduled to be released with MySQL 4.1 BETA. + +** FRESH INSTALL ** + +To install MySQL 4.1 as a 'fresh' install, unzip this archive to a directory +of your choice (we suggest 'c:\', which will cause MySQL to be installed in +a directory named 'mysql' in 'c:\'). You should then follow the directions +in the user manual for starting/stopping MySQL: + +(Windows 9x/ME) http://www.mysql.com/doc/en/Win95_start.html +(Windows NT/2000/XP) http://www.mysql.com/doc/en/NT_start.html + +** UPGRADE INSTALL ** + +To install MySQL 4.1 as an upgrade to your current MySQL version, you need +to perform the following steps: + +* Backup your original install (always a good idea!) +* Unzip this archive to a separate directory from your currently + installed MySQL database (or don't unpack the 'Data' subdirectory + when unzipping this archive, otherwise your databases will be over- + written). + +* Shutdown all mysql server processes/services +* Remove the Win32 Service (if appropriate for your OS): + + c:\mysql\bin\mysqld-nt --remove + +* Exit 'WinMySQLAdmin' (if it is running). +* If you unzipped this archive into a separate directory, copy all of the + directories and their contents from the location where you unzipped this + archive, excluding the 'data' directory, to the location + where your current MySQL server is installed. +* Start the MySQL server with the '--skip-grant-tables' option (assuming + your MySQL server is installed in 'c:\mysql'): + + c:\mysql\bin\mysqld-opt --skip-grant-tables + +* Execute the 'mysql_fix_privilege_tables.sql' script in the 'scripts + directory: + + c:\mysql\bin\mysql < c:\mysql\scripts\mysql_fix_privilege_tables.sql + +* Stop the server + + c:\mysql\bin\mysqladmin -u root shutdown + +* Re-install the Win32 service (if required): + + c:\mysql\bin\mysqld-nt --install + +* Re-start the server or service as normal. + +** Further Questions ** + +You can find further information about running MySQL on Windows in the +manual that ships in the 'Doc' subdirectory, or at: + +http://www.mysql.com/doc/en/Windows.html + From 0792c1c8243d8b340a343586d0ea6bb8427691f6 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 Jul 2003 13:00:32 +0300 Subject: [PATCH 43/54] count HAVING clause elements with select list elements, because agregate function can be present in it (BUG#922) removerd unused loop_id mysql-test/r/subselect.result: test of BUG#922 mysql-test/t/subselect.test: test of BUG#922 sql/item.cc: removerd unused loop_id we need count HAVING clause elements, because agregate function can be present in it sql/item.h: removerd unused loop_id sql/item_subselect.cc: new name of field sql/sql_derived.cc: new name of field sql/sql_lex.cc: new name of field sql/sql_lex.h: new name of field sql/sql_select.cc: new name of field sql/sql_union.cc: new name of field --- mysql-test/r/subselect.result | 7 +++++++ mysql-test/t/subselect.test | 13 ++++++++++++- sql/item.cc | 13 ++++++++----- sql/item.h | 1 - sql/item_subselect.cc | 2 +- sql/sql_derived.cc | 3 ++- sql/sql_lex.cc | 2 +- sql/sql_lex.h | 8 ++++++-- sql/sql_select.cc | 3 ++- sql/sql_union.cc | 3 ++- 10 files changed, 41 insertions(+), 14 deletions(-) diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index bba86ff8891..f0cf2fa6be2 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -1225,3 +1225,10 @@ a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 an 2 2 1 2 drop table t1,t2,t3; +create table t1 (s1 int); +create table t2 (s1 int); +insert into t1 values (1); +insert into t2 values (1); +select * from t1 where exists (select s1 from t2 having max(t2.s1)=t1.s1); +s1 +drop table t1,t2; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 66d8dd2bc32..f4b0cd5ca23 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -807,6 +807,7 @@ INSERT INTO t1 VALUES("2f6161e879db43c1a5b82c21ddc49089", "Default", "System", " INSERT INTO t1 VALUES("c373e9f5ad0791724315444553544200", "AddDocumentTest", "admin", "2003-06-09 10:51:25", "Movie Reviews", "0", "2003-06-09 10:51:25", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL); SELECT 'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1'); drop table t1; + # # alloc_group_fields() working # @@ -817,4 +818,14 @@ insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10); insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1); insert into t3 values (3,3), (2,2), (1,1); select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3; -drop table t1,t2,t3;s +drop table t1,t2,t3; + +# +# aggregate functions in HAVING test +# +create table t1 (s1 int); +create table t2 (s1 int); +insert into t1 values (1); +insert into t2 values (1); +select * from t1 where exists (select s1 from t2 having max(t2.s1)=t1.s1); +drop table t1,t2; diff --git a/sql/item.cc b/sql/item.cc index 072dec4e6a6..74c64dffe98 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -49,15 +49,19 @@ Item::Item(): THD *thd= current_thd; next= thd->free_list; // Put in free list thd->free_list= this; - loop_id= 0; /* Item constructor can be called during execution other tnen SQL_COM command => we should check thd->lex.current_select on zero (thd->lex can be uninitialised) */ - if (thd->lex.current_select && - thd->lex.current_select->parsing_place == SELECT_LEX_NODE::SELECT_LIST) - thd->lex.current_select->select_items++; + if (thd->lex.current_select) + { + SELECT_LEX_NODE::enum_parsing_place place= + thd->lex.current_select->parsing_place; + if (place == SELECT_LEX_NODE::SELECT_LIST || + place == SELECT_LEX_NODE::IN_HAVING) + thd->lex.current_select->select_n_having_items++; + } } /* @@ -66,7 +70,6 @@ Item::Item(): tables */ Item::Item(THD *thd, Item &item): - loop_id(0), str_value(item.str_value), name(item.name), max_length(item.max_length), diff --git a/sql/item.h b/sql/item.h index 450cb396787..9df6532a637 100644 --- a/sql/item.h +++ b/sql/item.h @@ -83,7 +83,6 @@ public: }; class Item { - uint loop_id; /* Used to find selfrefering loops */ Item(const Item &); /* Prevent use of these */ void operator=(Item &); public: diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index cd78edfee7b..15ad64e44be 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -508,7 +508,7 @@ void Item_in_subselect::single_value_transformer(THD *thd, { sl->item_list.push_back(item); setup_ref_array(thd, &sl->ref_pointer_array, - 1 + sl->select_items + + 1 + sl->select_n_having_items + sl->order_list.elements + sl->group_list.elements); // To prevent crash on Item_ref_null_helper destruction in case of error sl->ref_pointer_array[0]= 0; diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index c61e8f42343..9ed26bc4062 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -126,7 +126,8 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, item_list= select_cursor->item_list; select_cursor->with_wild= 0; if (setup_ref_array(thd, &select_cursor->ref_pointer_array, - (item_list.elements + select_cursor->select_items + + (item_list.elements + + select_cursor->select_n_having_items + select_cursor->order_list.elements + select_cursor->group_list.elements)) || setup_fields(thd, select_cursor->ref_pointer_array, first_table, diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 16ebd758639..cc163dc3757 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -959,7 +959,7 @@ void st_select_lex_node::init_select() order_list.next= (byte**) &order_list.first; select_limit= HA_POS_ERROR; offset_limit= 0; - select_items= 0; + select_n_having_items= 0; with_sum_func= 0; parsing_place= SELECT_LEX_NODE::NO_MATTER; } diff --git a/sql/sql_lex.h b/sql/sql_lex.h index faf7e16e54a..3b9f5906c21 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -205,8 +205,12 @@ public: ha_rows select_limit, offset_limit; /* LIMIT clause parameters */ // Arrays of pointers to top elements of all_fields list Item **ref_pointer_array; - - uint select_items; /* number of items in select_list */ + /* + number of items in select_list and HAVING clause used to get number + bigger then can be number of entries that will be added to all item + list during split_sum_func + */ + uint select_n_having_items; uint cond_count; /* number of arguments of and/or/xor in where/having */ enum_parsing_place parsing_place; /* where we are parsing expression */ bool with_sum_func; /* sum function indicator */ diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 0aa7e67a12b..7803e87572d 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -294,7 +294,8 @@ JOIN::prepare(Item ***rref_pointer_array, fields_list, &all_fields, wild_num))) || setup_ref_array(thd, rref_pointer_array, (fields_list.elements + - select_lex->select_items + + select_lex-> + select_n_having_items + og_num)) || setup_fields(thd, (*rref_pointer_array), tables_list, fields_list, 1, &all_fields, 1) || diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 724cc658b15..5f3fbadc99a 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -159,7 +159,8 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result, item_list= select_cursor->item_list; select_cursor->with_wild= 0; if (setup_ref_array(thd, &select_cursor->ref_pointer_array, - (item_list.elements + select_cursor->select_items + + (item_list.elements + + select_cursor->select_n_having_items + select_cursor->order_list.elements + select_cursor->group_list.elements)) || setup_fields(thd, select_cursor->ref_pointer_array, first_table, From 8d7b54b7c225bb3395ea8fa0692c6799032d7304 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 Jul 2003 17:12:14 +0500 Subject: [PATCH 44/54] A new separate error message: Unknown collation 'blablabla' --- include/mysqld_error.h | 3 ++- mysql-test/r/ctype_collate.result | 6 +++++- mysql-test/r/variables.result | 2 ++ mysql-test/t/ctype_collate.test | 7 ++++++- mysql-test/t/variables.test | 2 ++ sql/item_strfunc.cc | 8 +++++++- sql/set_var.cc | 2 +- sql/share/czech/errmsg.txt | 1 + sql/share/danish/errmsg.txt | 1 + sql/share/dutch/errmsg.txt | 1 + sql/share/english/errmsg.txt | 1 + sql/share/estonian/errmsg.txt | 1 + sql/share/french/errmsg.txt | 1 + sql/share/german/errmsg.txt | 1 + sql/share/greek/errmsg.txt | 1 + sql/share/hungarian/errmsg.txt | 1 + sql/share/italian/errmsg.txt | 1 + sql/share/japanese/errmsg.txt | 1 + sql/share/korean/errmsg.txt | 1 + sql/share/norwegian-ny/errmsg.txt | 1 + sql/share/norwegian/errmsg.txt | 1 + sql/share/polish/errmsg.txt | 1 + sql/share/portuguese/errmsg.txt | 1 + sql/share/romanian/errmsg.txt | 1 + sql/share/russian/errmsg.txt | 1 + sql/share/serbian/errmsg.txt | 1 + sql/share/slovak/errmsg.txt | 1 + sql/share/spanish/errmsg.txt | 1 + sql/share/swedish/errmsg.txt | 1 + sql/share/ukrainian/errmsg.txt | 1 + sql/sql_db.cc | 2 +- sql/sql_lex.cc | 2 +- sql/sql_yacc.yy | 2 +- 33 files changed, 51 insertions(+), 8 deletions(-) diff --git a/include/mysqld_error.h b/include/mysqld_error.h index 0468663239b..17ededfbb52 100644 --- a/include/mysqld_error.h +++ b/include/mysqld_error.h @@ -287,4 +287,5 @@ #define ER_CANT_AGGREGATE_3COLLATIONS 1268 #define ER_CANT_AGGREGATE_NCOLLATIONS 1269 #define ER_VARIABLE_IS_NOT_STRUCT 1270 -#define ER_ERROR_MESSAGES 271 +#define ER_UNKNOWN_COLLATION 1271 +#define ER_ERROR_MESSAGES 272 diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result index f895107239f..2c2eebc86fa 100644 --- a/mysql-test/r/ctype_collate.result +++ b/mysql-test/r/ctype_collate.result @@ -7,6 +7,10 @@ CREATE TABLE t2 ( latin1_f CHAR(32) CHARACTER SET latin1 COLLATE koi8r_general_ci NOT NULL ); ERROR 42000: COLLATION 'koi8r_general_ci' is not valid for CHARACTER SET 'latin1' +CREATE TABLE t2 ( +latin1_f CHAR(32) CHARACTER SET latin1 COLLATE some_non_existing_col NOT NULL +); +ERROR HY000: Unknown collation: 'some_non_existing_col' INSERT INTO t1 (latin1_f) VALUES (_latin1'A'); INSERT INTO t1 (latin1_f) VALUES (_latin1'a'); INSERT INTO t1 (latin1_f) VALUES (_latin1'AD'); @@ -482,7 +486,7 @@ y Z z SELECT DISTINCT latin1_f COLLATE koi8r FROM t1; -ERROR 42000: COLLATION 'koi8r' is not valid for CHARACTER SET 'latin1' +ERROR HY000: Unknown collation: 'koi8r' SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 4db791c993e..ead09cc6ed7 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -184,6 +184,8 @@ set GLOBAL table_type=DEFAULT; ERROR 42000: Variable 'table_type' doesn't have a default value set character_set_client=UNKNOWN_CHARACTER_SET; ERROR 42000: Unknown character set: 'UNKNOWN_CHARACTER_SET' +set collation_connection=UNKNOWN_COLLATION; +ERROR HY000: Unknown collation: 'UNKNOWN_COLLATION' set global autocommit=1; ERROR HY000: Variable 'autocommit' is a LOCAL variable and can't be used with SET GLOBAL select @@global.timestamp; diff --git a/mysql-test/t/ctype_collate.test b/mysql-test/t/ctype_collate.test index 0cf531156a9..3fd9df0c6ce 100644 --- a/mysql-test/t/ctype_collate.test +++ b/mysql-test/t/ctype_collate.test @@ -12,6 +12,11 @@ CREATE TABLE t2 ( latin1_f CHAR(32) CHARACTER SET latin1 COLLATE koi8r_general_ci NOT NULL ); +--error 1271 +CREATE TABLE t2 ( + latin1_f CHAR(32) CHARACTER SET latin1 COLLATE some_non_existing_col NOT NULL +); + INSERT INTO t1 (latin1_f) VALUES (_latin1'A'); INSERT INTO t1 (latin1_f) VALUES (_latin1'a'); @@ -93,7 +98,7 @@ SELECT DISTINCT latin1_f COLLATE latin1_swedish_ci FROM t1; SELECT DISTINCT latin1_f COLLATE latin1_german2_ci FROM t1; SELECT DISTINCT latin1_f COLLATE latin1_general_ci FROM t1; SELECT DISTINCT latin1_f COLLATE latin1_bin FROM t1; ---error 1251 +--error 1271 SELECT DISTINCT latin1_f COLLATE koi8r FROM t1; diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 7d4b25df0eb..16a192f1276 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -120,6 +120,8 @@ set SESSION query_cache_size=10000; set GLOBAL table_type=DEFAULT; --error 1115 set character_set_client=UNKNOWN_CHARACTER_SET; +--error 1271 +set collation_connection=UNKNOWN_COLLATION; --error 1228 set global autocommit=1; --error 1228 diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 4e35e90b429..b4f4df6968d 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2206,7 +2206,13 @@ void Item_func_set_collation::fix_length_and_dec() set_collation= get_charset_by_csname(args[0]->charset()->csname, MY_CS_BINSORT,MYF(0)); else - set_collation= get_charset_by_name(colname,MYF(0)); + { + if (!(set_collation= get_charset_by_name(colname,MYF(0)))) + { + my_error(ER_UNKNOWN_COLLATION, MYF(0), colname); + return; + } + } if (!set_collation || !my_charset_same(args[0]->charset(),set_collation)) { diff --git a/sql/set_var.cc b/sql/set_var.cc index cb6c875d513..6a6e010578f 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1240,7 +1240,7 @@ bool sys_var_collation::check(THD *thd, set_var *var) if (!(tmp=get_charset_by_name(res->c_ptr(),MYF(0)))) { - my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), res->c_ptr()); + my_error(ER_UNKNOWN_COLLATION, MYF(0), res->c_ptr()); return 1; } var->save_result.charset= tmp; // Save for update diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index 18f0a4a1193..b43c4b43b50 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -276,3 +276,4 @@ v/* "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index 9366e71e7c9..2eb9e6d2219 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -270,3 +270,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index c43b84f1674..2a663a176f8 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -278,3 +278,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 606c1a902a2..f4019d63055 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -272,3 +272,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index f453cc72f88..d3a38ede5bc 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -272,3 +272,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index ae9f91312fa..ccff24c5759 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -267,3 +267,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index 9d5a2d29ca3..52f3eb78c11 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -276,3 +276,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index dbfb605dac2..1ce052bdf22 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -267,3 +267,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index a06f679e81c..6143ea2a1c4 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -269,3 +269,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index 48f77490892..8164757d823 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -267,3 +267,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index 80af8a87c94..747d3611cc9 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -269,3 +269,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 4c654819495..93d86d32937 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -267,3 +267,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index 7b4075ccb66..e9319246fc6 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -269,3 +269,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index d4bd7115e86..edb5854db7e 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -269,3 +269,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 7066783850b..27b4d0d661f 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -271,3 +271,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index aa44f09ed0e..60ace09ab33 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -267,3 +267,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index e13711f054e..8824d64876a 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -271,3 +271,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index e0394941851..ddfc0a8f7de 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -269,3 +269,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index 1b07e0d2234..9e2a37e4053 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -263,3 +263,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index a812e5841e2..ed1d8cadb80 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -275,3 +275,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index e586e7777c1..5f3a2f38109 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -268,3 +268,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index 8029ab0d435..d108618834e 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -267,3 +267,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index d4ffae6e5ae..96b9f40feac 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -272,3 +272,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Unknown collation: '%-.64s'", diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 844fd05aefa..34e81402dd0 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -127,7 +127,7 @@ static bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create) { if (!(create->table_charset=get_charset_by_name(pos+1, MYF(0)))) { - sql_print_error(ER(ER_UNKNOWN_CHARACTER_SET),pos+1); + sql_print_error(ER(ER_UNKNOWN_COLLATION),pos+1); } } } diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 16ebd758639..350ae8dc1f5 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -552,7 +552,7 @@ int yylex(void *arg, void *yythd) /* Note: "SELECT _bla AS 'alias'" _bla should be considered as a IDENT if charset haven't been found. - So we don't use MYF(MY_WME) with get_charset_by_name to avoid + So we don't use MYF(MY_WME) with get_charset_by_csname to avoid producing an error. */ diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index a5ac04dc775..90c586dc2f1 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1410,7 +1410,7 @@ collation_name: { if (!($$=get_charset_by_name($1.str,MYF(0)))) { - net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,$1.str); + net_printf(YYTHD,ER_UNKNOWN_COLLATION,$1.str); YYABORT; } }; From ec1a433f087d09fd187d4a224394bfa87baa09ce Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 Jul 2003 17:39:39 +0500 Subject: [PATCH 45/54] Fixed that this sequence didn't produce an error as it should have: CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci, s2 CHAR(5) COLLATE latin1_swedish_ci); SELECT * FROM t1 WHERE s1 = s2; --- mysql-test/r/ctype_collate.result | 6 ++++++ mysql-test/t/ctype_collate.test | 8 ++++++++ sql/item_cmpfunc.cc | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result index 2c2eebc86fa..b865084b409 100644 --- a/mysql-test/r/ctype_collate.result +++ b/mysql-test/r/ctype_collate.result @@ -530,3 +530,9 @@ latin1 latin1_swedish_ci 3 1 SET CHARACTER SET 'DEFAULT'; ERROR 42000: Unknown character set: 'DEFAULT' DROP TABLE t1; +CREATE TABLE t1 +(s1 CHAR(5) COLLATE latin1_german1_ci, +s2 CHAR(5) COLLATE latin1_swedish_ci); +SELECT * FROM t1 WHERE s1 = s2; +ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '=' +DROP TABLE t1; diff --git a/mysql-test/t/ctype_collate.test b/mysql-test/t/ctype_collate.test index 3fd9df0c6ce..23039a4b116 100644 --- a/mysql-test/t/ctype_collate.test +++ b/mysql-test/t/ctype_collate.test @@ -148,3 +148,11 @@ SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; SET CHARACTER SET 'DEFAULT'; DROP TABLE t1; + +CREATE TABLE t1 +(s1 CHAR(5) COLLATE latin1_german1_ci, + s2 CHAR(5) COLLATE latin1_swedish_ci); +--error 1265 +SELECT * FROM t1 WHERE s1 = s2; +DROP TABLE t1; + \ No newline at end of file diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index f89b68d3879..d992b4d69d0 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -249,7 +249,8 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type) We must set cmp_charset here as we may be called from for an automatic generated item, like in natural join */ - if (cmp_collation.set((*a)->collation, (*b)->collation)) + if (cmp_collation.set((*a)->collation, (*b)->collation) || + cmp_collation.derivation == DERIVATION_NONE) { my_coll_agg_error((*a)->collation, (*b)->collation, owner->func_name()); return 1; From 668cd9729f8f1a35ebd6eb95bec9b612b7596f16 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 Jul 2003 16:59:46 +0300 Subject: [PATCH 46/54] prevented finding references in item_list for non-SELECT st_select_lex (fixed BUG#943) mysql-test/r/subselect.result: test for bug 943 mysql-test/t/subselect.test: test for bug 943 sql/item.cc: bool field changed with enum prevented finding references in item_list for non-SELECT st_select_lex sql/sql_lex.cc: bool field changed with enum sql/sql_lex.h: bool field changed with enum sql/sql_parse.cc: all subqueries and UNION parts marked as SELECT sql/sql_yacc.yy: bool field changed with enum PRIMARY SELECT command st_select_lex marked as SELECT --- mysql-test/r/subselect.result | 7 +++++++ mysql-test/t/subselect.test | 15 ++++++++++++++- sql/item.cc | 11 +++++++---- sql/sql_lex.cc | 3 ++- sql/sql_lex.h | 17 +++++++++++++++-- sql/sql_parse.cc | 2 ++ sql/sql_yacc.yy | 13 +++++++++---- 7 files changed, 56 insertions(+), 12 deletions(-) diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index bba86ff8891..7e07371c103 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -1225,3 +1225,10 @@ a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 an 2 2 1 2 drop table t1,t2,t3; +create table t1 (s1 int); +create table t2 (s1 int); +insert into t1 values (1); +insert into t2 values (1); +update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A); +ERROR 42S02: Unknown table 'x' in field list +DROP TABLE t1, t2; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 66d8dd2bc32..874bd008f94 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -817,4 +817,17 @@ insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10); insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1); insert into t3 values (3,3), (2,2), (1,1); select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3; -drop table t1,t2,t3;s +drop table t1,t2,t3; + +# +# update subquery with wrong field (to force name resolving +# in UPDATE name space) +# +create table t1 (s1 int); +create table t2 (s1 int); +insert into t1 values (1); +insert into t2 values (1); +-- error 1109 +update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A); +DROP TABLE t1, t2; + diff --git a/sql/item.cc b/sql/item.cc index 072dec4e6a6..db9708c9f21 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -862,7 +862,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) sl= sl->outer_select()) { table_list= (last= sl)->get_table_list(); - if (sl->insert_select && table_list) + if (sl->resolve_mode == SELECT_LEX::INSERT_MODE && table_list) { // it is primary INSERT st_select_lex => skip first table resolving table_list= table_list->next; @@ -871,7 +871,8 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) table_list, &where, 0)) != not_found_field) break; - if ((refer= find_item_in_list(this, sl->item_list, &counter, + if (sl->resolve_mode == SELECT_LEX::SELECT_MODE && + (refer= find_item_in_list(this, sl->item_list, &counter, REPORT_EXCEPT_NOT_FOUND)) != (Item **) not_found_item) break; @@ -1348,13 +1349,15 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) SELECT_LEX *last=0; for ( ; sl ; sl= sl->outer_select()) { - if ((ref= find_item_in_list(this, (last= sl)->item_list, + last= sl; + if (sl->resolve_mode == SELECT_LEX::SELECT_MODE && + (ref= find_item_in_list(this, sl->item_list, &counter, REPORT_EXCEPT_NOT_FOUND)) != (Item **)not_found_item) break; table_list= sl->get_table_list(); - if (sl->insert_select && table_list) + if (sl->resolve_mode == SELECT_LEX::INSERT_MODE && table_list) { // it is primary INSERT st_select_lex => skip first table resolving table_list= table_list->next; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 16ebd758639..65469800a54 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -986,7 +986,8 @@ void st_select_lex::init_query() join= 0; where= 0; olap= UNSPECIFIED_OLAP_TYPE; - insert_select= having_fix_field= 0; + having_fix_field= 0; + resolve_mode= NOMATTER_MODE; with_wild= 0; } diff --git a/sql/sql_lex.h b/sql/sql_lex.h index faf7e16e54a..f9c0aec2fbc 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -360,14 +360,27 @@ public: bool braces; /* SELECT ... UNION (SELECT ... ) <- this braces */ /* TRUE when having fix field called in processing of this SELECT */ bool having_fix_field; + /* - TRUE for primary st_select_lex structure of simple INSERT/REPLACE + SELECT for SELECT command st_select_lex. Used to privent scaning + item_list of non-SELECT st_select_lex (no sense find to finding + reference in it (all should be in tables, it is dangerouse due + to order of fix_fields calling for non-SELECTs commands (item list + can be not fix_fieldsd)). This value will be assigned for + primary select (sql_yac.yy) and for any subquery and + UNION SELECT (sql_parse.cc mysql_new_select()) + + + INSERT for primary st_select_lex structure of simple INSERT/REPLACE (used for name resolution, see Item_fiels & Item_ref fix_fields, FALSE for INSERT/REPLACE ... SELECT, because it's st_select_lex->table_list will be preprocessed (first table removed) before passing to handle_select) + + NOMATTER for other */ - bool insert_select; + enum {NOMATTER_MODE, SELECT_MODE, INSERT_MODE} resolve_mode; + void init_query(); void init_select(); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 820bf3d73cc..9a62607bf93 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3550,6 +3550,7 @@ mysql_new_select(LEX *lex, bool move_down) unit->link_prev= 0; unit->return_to= lex->current_select; select_lex->include_down(unit); + // TODO: assign resolve_mode for fake subquery after merging with new tree } else select_lex->include_neighbour(lex->current_select); @@ -3557,6 +3558,7 @@ mysql_new_select(LEX *lex, bool move_down) select_lex->master_unit()->global_parameters= select_lex; select_lex->include_global((st_select_lex_node**)&lex->all_selects_list); lex->current_select= select_lex; + select_lex->resolve_mode= SELECT_LEX::SELECT_MODE; return 0; } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index a5ac04dc775..38df3bf3a06 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1910,7 +1910,12 @@ opt_ignore_leaves: select: - select_init { Lex->sql_command=SQLCOM_SELECT; }; + select_init + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SELECT; + lex->select_lex.resolve_mode= SELECT_LEX::SELECT_MODE; + }; /* Need select_init2 for subselects. */ select_init: @@ -3401,7 +3406,7 @@ insert: lex->sql_command = SQLCOM_INSERT; /* for subselects */ lex->lock_option= (using_update_log) ? TL_READ_NO_INSERT : TL_READ; - lex->select_lex.insert_select= 1; + lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE; } insert_lock_option opt_ignore insert2 { @@ -3417,7 +3422,7 @@ replace: LEX *lex=Lex; lex->sql_command = SQLCOM_REPLACE; lex->duplicates= DUP_REPLACE; - lex->select_lex.insert_select= 1; + lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE; } replace_lock_option insert2 { @@ -3486,7 +3491,7 @@ insert_values: it is not simple select => table list will be preprocessed before passing to handle_select */ - lex->select_lex.insert_select= 0; + lex->select_lex.resolve_mode= SELECT_LEX::NOMATTER_MODE; lex->current_select->parsing_place= SELECT_LEX_NODE::SELECT_LIST; } select_options select_item_list From 9149ca11e6179987fd29a34629d2f0f5eef58340 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 Jul 2003 12:51:24 -0500 Subject: [PATCH 47/54] README.1st: Revise 4.1 Windows-install instructions. Docs/README.1st: Revise 4.1 Windows-install instructions. --- Docs/README.1st | 62 ++++++++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/Docs/README.1st b/Docs/README.1st index a6da0680924..980c043224a 100755 --- a/Docs/README.1st +++ b/Docs/README.1st @@ -1,6 +1,6 @@ -This ALPHA build of MySQL 4.1 for the Windows platform does not come with -an installer. A full-featured installer is being developed for -the 4.1 series, and it is scheduled to be released with MySQL 4.1 BETA. +This ALPHA build of MySQL 4.1 for the Windows platform does not come +with an installer. A full-featured installer is being developed for the +4.1 series, and it is scheduled to be released with MySQL 4.1 BETA. ** FRESH INSTALL ** @@ -14,49 +14,63 @@ in the user manual for starting/stopping MySQL: ** UPGRADE INSTALL ** -To install MySQL 4.1 as an upgrade to your current MySQL version, you need +To install MySQL 4.1 as an upgrade to your current version of MySQL, you need to perform the following steps: -* Backup your original install (always a good idea!) -* Unzip this archive to a separate directory from your currently - installed MySQL database (or don't unpack the 'Data' subdirectory - when unzipping this archive, otherwise your databases will be over- - written). +* Back up your original installation (always a good idea!) + +* Unzip the 4.1 archive to a directory that is different than where your + current MySQL installation is located. (Or, if you do unzip this + archive into the same location as your existing installation, do NOT + unpack the 'data' subdirectory. If you unpack the 'data' directory, + your existing databases will be overwritten.) -* Shutdown all mysql server processes/services -* Remove the Win32 Service (if appropriate for your OS): +* Shut down all MySQL server processes/services. + +* Remove the Win32 MySQL service (if appropriate for your OS): c:\mysql\bin\mysqld-nt --remove * Exit 'WinMySQLAdmin' (if it is running). -* If you unzipped this archive into a separate directory, copy all of the - directories and their contents from the location where you unzipped this - archive, excluding the 'data' directory, to the location - where your current MySQL server is installed. -* Start the MySQL server with the '--skip-grant-tables' option (assuming - your MySQL server is installed in 'c:\mysql'): + +* If you unzipped this archive into a directory different than that + of your existing MySQL installation, copy from the archive all its + directories and their contents EXCEPT the 'data' directory into the + existing installation. + +* Start the MySQL server with the '--skip-grant-tables' option. Assuming + your MySQL installation is located at 'c:\mysql', the command looks like + this: c:\mysql\bin\mysqld-opt --skip-grant-tables + + If your installation is located in some other directory, adjust the + pathname in that command (and in the following commands). -* Execute the 'mysql_fix_privilege_tables.sql' script in the 'scripts - directory: +* Execute the 'mysql_fix_privilege_tables.sql' script that is located in + the 'scripts' directory: - c:\mysql\bin\mysql < c:\mysql\scripts\mysql_fix_privilege_tables.sql + c:\mysql\bin\mysql -f mysql < c:\mysql\scripts\mysql_fix_privilege_tables.sql + + This script performs any actions necessary to convert your grant tables + to the current format. You may see some "duplicate column" warnings as + it runs; these can be ignored. -* Stop the server +* Stop the server: c:\mysql\bin\mysqladmin -u root shutdown -* Re-install the Win32 service (if required): +* Re-install the Win32 MySQL service (if required): c:\mysql\bin\mysqld-nt --install -* Re-start the server or service as normal. +* Re-start the server or service using your normal startup procedure. ** Further Questions ** You can find further information about running MySQL on Windows in the -manual that ships in the 'Doc' subdirectory, or at: +manual that ships in the 'Doc' subdirectory, or online at the MySQL AB +web site: http://www.mysql.com/doc/en/Windows.html From 0e3524dd887fd4e5091aeefbfe127abffc8cdeba Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 Jul 2003 02:01:53 -0700 Subject: [PATCH 48/54] Fix for timestamp issue (BR #819) tests/client_test.c: Updated test_ts() test (For BR# 819) --- sql/item.cc | 5 +++ tests/client_test.c | 78 ++++++++++++++++++++++++++++++--------------- 2 files changed, 58 insertions(+), 25 deletions(-) diff --git a/sql/item.cc b/sql/item.cc index 072dec4e6a6..de7bb2703ca 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -530,6 +530,11 @@ void Item_param::set_longdata(const char *str, ulong length) int Item_param::save_in_field(Field *field, bool no_conversions) { + THD *thd= current_thd; + + if (thd->command == COM_PREPARE) + return -1; + if (null_value) return (int) set_field_to_null(field); diff --git a/tests/client_test.c b/tests/client_test.c index 6ee7487ac45..6aeb865aa20 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -7467,24 +7467,26 @@ static void test_sqlmode() static void test_ts() { MYSQL_STMT *stmt; - MYSQL_BIND bind[2]; + MYSQL_BIND bind[6]; MYSQL_TIME ts; + MYSQL_RES *prep_res; char strts[30]; long length; - int rc; + int rc, field_count; + char name; myheader("test_ts"); rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_ts"); myquery(rc); - rc= mysql_query(mysql,"CREATE TABLE test_ts(a TIMESTAMP)"); + rc= mysql_query(mysql,"CREATE TABLE test_ts(a DATE, b TIME, c TIMESTAMP)"); myquery(rc); rc = mysql_commit(mysql); myquery(rc); - stmt = mysql_prepare(mysql,"INSERT INTO test_ts VALUES(?),(?)",40); + stmt = mysql_prepare(mysql,"INSERT INTO test_ts VALUES(?,?,?),(?,?,?)",50); mystmt_init(stmt); ts.year= 2003; @@ -7495,17 +7497,21 @@ static void test_ts() ts.second= 46; length= (long)(strmov(strts,"2003-07-12 21:07:46") - strts); - bind[0].buffer_type= MYSQL_TYPE_STRING; - bind[0].buffer= (char *)strts; - bind[0].buffer_length= sizeof(strts); + bind[0].buffer_type= MYSQL_TYPE_TIMESTAMP; + bind[0].buffer= (char *)&ts; + bind[0].buffer_length= sizeof(ts); bind[0].is_null= 0; - bind[0].length= &length; + bind[0].length= 0; - bind[1].buffer_type= MYSQL_TYPE_TIMESTAMP; - bind[1].buffer= (char *)&ts; - bind[1].buffer_length= sizeof(ts); - bind[1].is_null= 0; - bind[1].length= 0; + bind[2]= bind[1]= bind[0]; + + bind[3].buffer_type= MYSQL_TYPE_STRING; + bind[3].buffer= (char *)strts; + bind[3].buffer_length= sizeof(strts); + bind[3].is_null= 0; + bind[3].length= &length; + + bind[5]= bind[4]= bind[3]; rc = mysql_bind_param(stmt, bind); mystmt(stmt,rc); @@ -7515,27 +7521,49 @@ static void test_ts() mysql_stmt_close(stmt); - verify_col_data("test_ts","a","2003-07-12 21:07:46"); + verify_col_data("test_ts","a","2003-07-12"); + verify_col_data("test_ts","b","21:07:46"); + verify_col_data("test_ts","c","2003-07-12 21:07:46"); - stmt = mysql_prepare(mysql,"SELECT a FROM test_ts WHERE a >= ?",50); + stmt = mysql_prepare(mysql,"SELECT * FROM test_ts",50); mystmt_init(stmt); - rc = mysql_bind_param(stmt, bind); - mystmt(stmt,rc); + prep_res = mysql_prepare_result(stmt); + mytest(prep_res); rc = mysql_execute(stmt); mystmt(stmt,rc); - rc = mysql_fetch(stmt); - mystmt(stmt,rc); - - rc = mysql_fetch(stmt); - mystmt(stmt,rc); - - rc = mysql_fetch(stmt); - myassert(rc == MYSQL_NO_DATA); + myassert( 2== my_process_stmt_result(stmt)); + field_count= mysql_num_fields(prep_res); + mysql_free_result(prep_res); mysql_stmt_close(stmt); + + for (name= 'a'; field_count--; name++) + { + int row_count= 0; + + sprintf(query,"SELECT a,b,c FROM test_ts WHERE %c=?",name); + length= (long)(strmov(query,query)- query); + + fprintf(stdout,"\n %s", query); + stmt = mysql_prepare(mysql, query, length); + mystmt_init(stmt); + + rc = mysql_bind_param(stmt, bind); + mystmt(stmt,rc); + + rc = mysql_execute(stmt); + mystmt(stmt,rc); + + while (mysql_fetch(stmt) == 0) + row_count++; + + fprintf(stdout, "\n returned '%d' rows", row_count); + myassert(row_count == 2); + mysql_stmt_close(stmt); + } } From 53e4153de12d9288d55294826dbf30e4ce508224 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 Jul 2003 14:15:25 +0500 Subject: [PATCH 49/54] Derivation attribute was not processed correctly by MAX/MIN in some cases: SELECT coercibility(max(s1)) from t1; Subselect collation and derivation was not processed correctly: create table a select (select s1 from t1); select * from t1 where s1 = (select s2 from t1); --- mysql-test/r/func_group.result | 6 ++++++ mysql-test/r/subselect.result | 13 +++++++++++++ mysql-test/t/func_group.test | 5 +++++ mysql-test/t/subselect.test | 13 ++++++++++++- sql/item.cc | 2 +- sql/item_subselect.cc | 2 ++ sql/item_sum.cc | 2 +- 7 files changed, 40 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 26ef391024e..8fad9d16dc2 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -612,3 +612,9 @@ select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = Case When Count(*) < MAX_REQ Then 1 Else 0 End 1 drop table t1; +create table t1 (a char(10)); +insert into t1 values ('a'),('b'),('c'); +select coercibility(max(a)) from t1; +coercibility(max(a)) +3 +drop table t1; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index bba86ff8891..7f2cb29dd4c 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -1225,3 +1225,16 @@ a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 an 2 2 1 2 drop table t1,t2,t3; +create table t1 (a char(10) character set koi8r collate koi8r_bin); +create table t2 select (select a from t1); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `(select a from t1)` char(10) character set koi8r collate koi8r_bin default NULL +) TYPE=MyISAM CHARSET=latin1 +drop table t1,t2; +CREATE TABLE t1 +(s1 CHAR(5) COLLATE latin1_german1_ci, +s2 CHAR(5) COLLATE latin1_swedish_ci); +SELECT * FROM t1 WHERE s1 = (SELECT s2 FROM t1); +ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '=' diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index fed19cbe07c..8a43716d854 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -355,3 +355,8 @@ insert into t1 values (1, 3); select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ; select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ; drop table t1; + +create table t1 (a char(10)); +insert into t1 values ('a'),('b'),('c'); +select coercibility(max(a)) from t1; +drop table t1; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 66d8dd2bc32..e7c63098cab 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -817,4 +817,15 @@ insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10); insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1); insert into t3 values (3,3), (2,2), (1,1); select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3; -drop table t1,t2,t3;s +drop table t1,t2,t3; + +create table t1 (a char(10) character set koi8r collate koi8r_bin); +create table t2 select (select a from t1); +show create table t2; +drop table t1,t2; + +CREATE TABLE t1 +(s1 CHAR(5) COLLATE latin1_german1_ci, + s2 CHAR(5) COLLATE latin1_swedish_ci); +--error 1265 +SELECT * FROM t1 WHERE s1 = (SELECT s2 FROM t1); diff --git a/sql/item.cc b/sql/item.cc index 072dec4e6a6..ee8b77881cb 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1442,7 +1442,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) max_length= (*ref)->max_length; maybe_null= (*ref)->maybe_null; decimals= (*ref)->decimals; - set_charset((*ref)->charset()); + collation.set((*ref)->collation); with_sum_func= (*ref)->with_sum_func; fixed= 1; diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index cd78edfee7b..26f8313159f 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -759,6 +759,7 @@ static Item_result set_row(SELECT_LEX *select_lex, Item * item, if (!(row[i]= Item_cache::get_cache(res_type))) return STRING_RESULT; // we should return something row[i]->set_len_n_dec(sel_item->max_length, sel_item->decimals); + row[i]->collation.set(sel_item->collation); } } if (select_lex->item_list.elements > 1) @@ -770,6 +771,7 @@ void subselect_single_select_engine::fix_length_and_dec(Item_cache **row) { DBUG_ASSERT(row || select_lex->item_list.elements==1); res_type= set_row(select_lex, item, row, &maybe_null); + item->collation.set(row[0]->collation); if (cols() != 1) maybe_null= 0; } diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 8d3d0de466a..aa146926eb5 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -199,7 +199,7 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) decimals=item->decimals; maybe_null=item->maybe_null; unsigned_flag=item->unsigned_flag; - set_charset(item->charset()); + collation.set(item->collation); result_field=0; null_value=1; fix_length_and_dec(); From 4ee94d21f35ef40a3d950f5970190b7ffe12d8be Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 Jul 2003 17:51:42 +0500 Subject: [PATCH 50/54] Database name and national characters fixes. --- mysql-test/r/ctype_recoding.result | 14 ++++++++++++++ mysql-test/t/ctype_recoding.test | 11 +++++++++++ sql/sql_parse.cc | 19 +++++++++++++++---- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result index 23a90be1306..b89a90cc6ba 100644 --- a/mysql-test/r/ctype_recoding.result +++ b/mysql-test/r/ctype_recoding.result @@ -42,3 +42,17 @@ Field Type Null Key Default Extra SET CHARACTER SET koi8r; DROP TABLE ÔÁÂÌÉÃÁ; SET CHARACTER SET default; +SET CHARACTER SET koi8r; +CREATE DATABASE ÔÅÓÔ; +USE ÔÅÓÔ; +SHOW TABLES; +Tables_in_ÔÅÓÔ +SHOW TABLES IN ÔÅÓÔ; +Tables_in_ÔÅÓÔ +SET CHARACTER SET cp1251; +SHOW TABLES; +Tables_in_òåñò +SHOW TABLES IN òåñò; +Tables_in_òåñò +SET CHARACTER SET koi8r; +DROP DATABASE ÔÅÓÔ; diff --git a/mysql-test/t/ctype_recoding.test b/mysql-test/t/ctype_recoding.test index 68526806166..8fa31b1f17b 100644 --- a/mysql-test/t/ctype_recoding.test +++ b/mysql-test/t/ctype_recoding.test @@ -27,3 +27,14 @@ SHOW FIELDS FROM таблица; SET CHARACTER SET koi8r; DROP TABLE ÔÁÂÌÉÃÁ; SET CHARACTER SET default; + +SET CHARACTER SET koi8r; +CREATE DATABASE ÔÅÓÔ; +USE ÔÅÓÔ; +SHOW TABLES; +SHOW TABLES IN ÔÅÓÔ; +SET CHARACTER SET cp1251; +SHOW TABLES; +SHOW TABLES IN òåñò; +SET CHARACTER SET koi8r; +DROP DATABASE ÔÅÓÔ; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 820bf3d73cc..720017f399f 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -549,6 +549,7 @@ check_connections(THD *thd) char *end, *user, *passwd, *db; char prepared_scramble[SCRAMBLE41_LENGTH+4]; /* Buffer for scramble&hash */ ACL_USER* cached_user=NULL; /* Initialise to NULL for first stage */ + String convdb; DBUG_PRINT("info",("New connection received on %s", vio_description(net->vio))); @@ -724,7 +725,12 @@ check_connections(THD *thd) db=0; using_password= test(passwd[0]); if (thd->client_capabilities & CLIENT_CONNECT_WITH_DB) + { db=strend(passwd)+1; + convdb.copy(db, strlen(db), + thd->variables.character_set_client, system_charset_info); + db= convdb.c_ptr(); + } /* We can get only old hash at this point */ if (using_password && strlen(passwd) != SCRAMBLE_LENGTH) @@ -1125,10 +1131,15 @@ bool dispatch_command(enum enum_server_command command, THD *thd, thd->lex.select_lex.options=0; // We store status here switch (command) { case COM_INIT_DB: - statistic_increment(com_stat[SQLCOM_CHANGE_DB],&LOCK_status); - if (!mysql_change_db(thd,packet)) - mysql_log.write(thd,command,"%s",thd->db); - break; + { + String convname; + statistic_increment(com_stat[SQLCOM_CHANGE_DB],&LOCK_status); + convname.copy(packet, strlen(packet), + thd->variables.character_set_client, system_charset_info); + if (!mysql_change_db(thd,convname.c_ptr())) + mysql_log.write(thd,command,"%s",thd->db); + break; + } #ifndef EMBEDDED_LIBRARY case COM_REGISTER_SLAVE: { From 79fea68bd7da9735fdbb9d6e4c40879d0e72ff70 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Jul 2003 08:33:59 +0500 Subject: [PATCH 51/54] cp1251.xml: Upper/lower case translation bug for letter 't' fix. sql/share/charsets/cp1251.xml: Upper/lower case translation bug for letter 't' fix. --- sql/share/charsets/cp1251.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sql/share/charsets/cp1251.xml b/sql/share/charsets/cp1251.xml index 795022cc179..94774cca0f1 100644 --- a/sql/share/charsets/cp1251.xml +++ b/sql/share/charsets/cp1251.xml @@ -34,9 +34,9 @@ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 90 83 82 83 84 85 86 87 88 89 9A 8B 9C 9D 9E 9F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A2 A2 BC A4 B4 A6 A7 B8 A9 BA AB AC AD AE BF @@ -56,9 +56,9 @@ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F 80 81 82 81 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 80 91 92 93 94 95 96 97 98 99 8A 9B 8C 9D 8E 8F A0 A1 A1 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF From 7fc417047d6165bcd93dfcd88554bb4d068a7320 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 1 Aug 2003 18:49:30 +0400 Subject: [PATCH 52/54] added disable_query_log to fulltext2.test mysql-test/r/fulltext2.result: result updated mysql-test/t/fulltext2.test: test is now more silent BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + mysql-test/r/fulltext2.result | 765 ---------------------------------- mysql-test/t/fulltext2.test | 2 + 3 files changed, 3 insertions(+), 765 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index bc24761c7f9..c8d953324f0 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -53,6 +53,7 @@ jcole@sarvik.tfr.cafe.ee jcole@tetra.spaceapes.com jorge@linux.jorge.mysql.com kaj@work.mysql.com +kostja@oak.local lenz@kallisto.mysql.com lenz@mysql.com miguel@hegel.(none) diff --git a/mysql-test/r/fulltext2.result b/mysql-test/r/fulltext2.result index 8086faadba4..a35be210ece 100644 --- a/mysql-test/r/fulltext2.result +++ b/mysql-test/r/fulltext2.result @@ -4,771 +4,6 @@ i int(10) unsigned not null auto_increment primary key, a varchar(255) not null, FULLTEXT KEY (a) ) TYPE=MyISAM; -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaaxxx'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaazzz'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); -insert t1 (a) values ('aaayyy'); repair table t1 quick; Table Op Msg_type Msg_text test.t1 repair status OK diff --git a/mysql-test/t/fulltext2.test b/mysql-test/t/fulltext2.test index 2c0d352a870..b739d60e3b3 100644 --- a/mysql-test/t/fulltext2.test +++ b/mysql-test/t/fulltext2.test @@ -17,6 +17,7 @@ CREATE TABLE t1 ( ) TYPE=MyISAM; # two-level entry, second-level tree with depth 2 +--disable_query_log let $1=260; while ($1) { @@ -39,6 +40,7 @@ while ($1) eval insert t1 (a) values ('aaayyy'); dec $1; } +--enable_query_log # converting to two-level repair table t1 quick; From e56fcb4221b85930f118ea43962972352777bdfd Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 1 Aug 2003 19:04:35 +0300 Subject: [PATCH 53/54] merge fix --- mysql-test/t/subselect.test | 2 -- 1 file changed, 2 deletions(-) diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index c6cc82e5f92..1d7da94d455 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -820,8 +820,6 @@ insert into t3 values (3,3), (2,2), (1,1); select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3; drop table t1,t2,t3; -drop table t1; - # # aggregate functions in HAVING test # From a7eb7a78ddc49c32f0d651eb83d1d34a0e8b6756 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 2 Aug 2003 17:23:39 +0200 Subject: [PATCH 54/54] There were two wrong calls to tables_ok() in MySQL 4.0 (BUG#980), which are fixed now. In 4.1 there are 3 calls; 2 of them will be fixed when there is a merge; here I fix the 3rd, new one. --- sql/sql_acl.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 51c05ccbf33..f89341a18dd 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -3221,8 +3221,17 @@ int open_grant_tables(THD *thd, TABLE_LIST *tables) GRANT and REVOKE are applied the slave in/exclusion rules as they are some kind of updates to the mysql.% tables. */ - if (thd->slave_thread && table_rules_on && !tables_ok(0, tables)) - DBUG_RETURN(1); + if (thd->slave_thread && table_rules_on) + { + /* + The tables must be marked "updating" so that tables_ok() takes them into + account in tests. + */ + tables[0].updating=tables[1].updating=tables[2].updating=tables[3].updating=1; + if (!tables_ok(0, tables)) + DBUG_RETURN(1); + tables[0].updating=tables[1].updating=tables[2].updating=tables[3].updating=0; + } #endif if (open_and_lock_tables(thd, tables))