From 1430a2a44319aa5ca1fa1b4e626fca7cec1243ad Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 1 Mar 2005 19:05:48 -0800 Subject: [PATCH 01/44] Make sure that the filename for temporary tables is built with fn_format() so that extra slashes are handled in tmpdir. (Bug #8497) sql/ha_heap.cc: use constants instead of magic integers on fn_format() calls sql/sql_select.cc: Construct filename for temporary tables using fn_format() to get consistent filenames. mysql-test/t/temp_table.test: Add new regression test mysql-test/r/temp_table.result: Add new test results --- mysql-test/r/temp_table.result | 9 +++++++++ mysql-test/t/temp_table-master.opt | 1 + mysql-test/t/temp_table.test | 9 +++++++++ sql/ha_heap.cc | 6 ++++-- sql/sql_select.cc | 6 ++++-- 5 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 mysql-test/t/temp_table-master.opt diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result index 10c0a2e3652..f08fe6ddd0f 100644 --- a/mysql-test/r/temp_table.result +++ b/mysql-test/r/temp_table.result @@ -97,3 +97,12 @@ Variable_name Value Created_tmp_disk_tables 0 Created_tmp_tables 1 drop table t1; +create table t1 (a int, b int, index(a), index(b)); +create table t2 (c int auto_increment, d varchar(255), primary key (c)); +insert into t1 values (3,1),(3,2); +insert into t2 values (NULL, 'foo'), (NULL, 'bar'); +select d, c from t1 left join t2 on b = c where a = 3 order by d; +d c +bar 2 +foo 1 +drop table t1, t2; diff --git a/mysql-test/t/temp_table-master.opt b/mysql-test/t/temp_table-master.opt new file mode 100644 index 00000000000..026d3d4640c --- /dev/null +++ b/mysql-test/t/temp_table-master.opt @@ -0,0 +1 @@ +--tmpdir=$MYSQL_TEST_DIR/var//tmp diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test index 74276c7668c..3e60917783a 100644 --- a/mysql-test/t/temp_table.test +++ b/mysql-test/t/temp_table.test @@ -89,3 +89,12 @@ flush status; select * from t1 group by d; show status like "created_tmp%tables"; drop table t1; + +# Bug #8497: tmpdir with extra slashes would cause failures +# +create table t1 (a int, b int, index(a), index(b)); +create table t2 (c int auto_increment, d varchar(255), primary key (c)); +insert into t1 values (3,1),(3,2); +insert into t2 values (NULL, 'foo'), (NULL, 'bar'); +select d, c from t1 left join t2 on b = c where a = 3 order by d; +drop table t1, t2; diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc index 3c2249ce281..c7c466c019d 100644 --- a/sql/ha_heap.cc +++ b/sql/ha_heap.cc @@ -408,7 +408,8 @@ THR_LOCK_DATA **ha_heap::store_lock(THD *thd, int ha_heap::delete_table(const char *name) { char buff[FN_REFLEN]; - int error= heap_delete_table(fn_format(buff,name,"","",4+2)); + int error= heap_delete_table(fn_format(buff,name,"","", + MY_REPLACE_EXT|MY_UNPACK_FILENAME)); return error == ENOENT ? 0 : error; } @@ -521,7 +522,8 @@ int ha_heap::create(const char *name, TABLE *table_arg, create_info->auto_increment_value - 1 : 0); hp_create_info.max_table_size=current_thd->variables.max_heap_table_size; max_rows = (ha_rows) (hp_create_info.max_table_size / mem_per_row); - error= heap_create(fn_format(buff,name,"","",4+2), + error= heap_create(fn_format(buff,name,"","", + MY_REPLACE_EXT|MY_UNPACK_FILENAME), table_arg->keys,keydef, table_arg->reclength, (ulong) ((table_arg->max_rows < max_rows && table_arg->max_rows) ? diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 05314097ca3..3f763e5134a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4880,12 +4880,14 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, temp_pool_slot = bitmap_set_next(&temp_pool); if (temp_pool_slot != MY_BIT_NONE) // we got a slot - sprintf(path, "%s%s_%lx_%i", mysql_tmpdir, tmp_file_prefix, + sprintf(path, "%s_%lx_%i", tmp_file_prefix, current_pid, temp_pool_slot); else // if we run out of slots or we are not using tempool - sprintf(path,"%s%s%lx_%lx_%x",mysql_tmpdir,tmp_file_prefix,current_pid, + sprintf(path,"%s%lx_%lx_%x", tmp_file_prefix,current_pid, thd->thread_id, thd->tmp_table++); + fn_format(path, path, mysql_tmpdir, "", MY_REPLACE_EXT|MY_UNPACK_FILENAME); + if (lower_case_table_names) my_casedn_str(files_charset_info, path); From 7dc31480deeba1d722bd9701921d3f042c3e7f51 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 Mar 2005 17:33:06 -0800 Subject: [PATCH 02/44] Change mysql prompt while inside a multiline comment. (Bug #9186) client/mysql.cc: Change prompt to "/*> " when inside a multiline comment. --- client/mysql.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/mysql.cc b/client/mysql.cc index 46bfc7d880f..39d970da629 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -936,7 +936,8 @@ static int read_lines(bool execute_commands) } else { - char *prompt= (char*) (glob_buffer.is_empty() ? construct_prompt() : + char *prompt= (char*) (ml_comment ? " /*> " : + glob_buffer.is_empty() ? construct_prompt() : !in_string ? " -> " : in_string == '\'' ? " '> " : (in_string == '`' ? From a48bccf44edee2f877087e083365e72b20967253 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 5 May 2005 04:56:30 -0700 Subject: [PATCH 03/44] Fix option handling of ./BUILD/compile-* to not try and pass options to configure. It was already changed not to support additional options, but now it was trying to pass all of the options to ./configure. (Bug #8648) BUILD/FINISH.sh: Remove obsolete code that took arguments to the build scripts and passed them to configure -- now the only options supported are those handled within BUILD/SETUP.sh. --- BUILD/FINISH.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/BUILD/FINISH.sh b/BUILD/FINISH.sh index 094eb8275d6..143db3e0692 100644 --- a/BUILD/FINISH.sh +++ b/BUILD/FINISH.sh @@ -2,12 +2,6 @@ cflags="$c_warnings $extra_flags" cxxflags="$cxx_warnings $base_cxxflags $extra_flags" extra_configs="$extra_configs $local_infile_configs" configure="./configure $base_configs $extra_configs" -for arg -do - # Escape special characters so they don't confuse eval - configure="$configure "`echo "$arg" | \ - sed -e 's,\([^a-zA-Z0-9_.=-]\),\\\\\1,g'` -done commands="\ $make -k clean || true From af5596b32e650287f84650a9dda8a5170a23b6d4 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 5 May 2005 17:17:57 +0200 Subject: [PATCH 04/44] Bug #9721 net_write_timeout not used on Windows Added an extra parameter to all calls to timeout(). 1 means we want to set the write timeout 0 means we wnat to set the read timeout viossl.c: Add which parameter to ssl timeout routine vio_priv.h: Added which parameter to vio_ignore_timeout and vio_ssl_timeout violite.h: Add which parameter to vio_timeout sigs net_serv.cc: Use proper which code in call to vio_timeout to set the proper timeout viosocket.c: Set the appropriate timeout in vio_timeout vio/viosocket.c: Set the appropriate timeout in vio_timeout sql/net_serv.cc: Use proper which code in call to vio_timeout to set the proper timeout include/violite.h: Add which parameter to vio_timeout sigs vio/vio_priv.h: Added which parameter to vio_ignore_timeout and vio_ssl_timeout vio/viossl.c: Add which parameter to ssl timeout routine BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + include/violite.h | 6 +++--- sql/net_serv.cc | 4 ++-- vio/vio_priv.h | 4 ++-- vio/viosocket.c | 9 +++++++-- vio/viossl.c | 3 ++- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 1b33d659cfd..b77de4dbb49 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -195,6 +195,7 @@ ram@mysql.r18.ru ram@ram.(none) ramil@mysql.com ranger@regul.home.lan +rburnett@bk-internal.mysql.com rburnett@build.mysql.com reggie@bob.(none) reggie@mdk10.(none) diff --git a/include/violite.h b/include/violite.h index b89b01f95f4..4b644051dd2 100644 --- a/include/violite.h +++ b/include/violite.h @@ -81,7 +81,7 @@ my_bool vio_peer_addr(Vio* vio, char *buf, uint16 *port); /* Remotes in_addr */ void vio_in_addr(Vio *vio, struct in_addr *in); my_bool vio_poll_read(Vio *vio,uint timeout); -void vio_timeout(Vio *vio,uint timeout); +void vio_timeout(Vio *vio,uint which, uint timeout); #ifdef HAVE_OPENSSL #include @@ -149,7 +149,7 @@ int vio_close_shared_memory(Vio * vio); #define vio_close(vio) ((vio)->vioclose)(vio) #define vio_peer_addr(vio, buf, prt) (vio)->peer_addr(vio, buf, prt) #define vio_in_addr(vio, in) (vio)->in_addr(vio, in) -#define vio_timeout(vio, seconds) (vio)->timeout(vio, seconds) +#define vio_timeout(vio, which, seconds) (vio)->timeout(vio, which, seconds) #endif /* defined(HAVE_VIO) && !defined(DONT_MAP_VIO) */ /* This enumerator is used in parser - should be always visible */ @@ -189,7 +189,7 @@ struct st_vio void (*in_addr)(Vio*, struct in_addr*); my_bool (*should_retry)(Vio*); int (*vioclose)(Vio*); - void (*timeout)(Vio*, unsigned int timeout); + void (*timeout)(Vio*, unsigned int which, unsigned int timeout); void *ssl_arg; #ifdef HAVE_SMEM HANDLE handle_file_map; diff --git a/sql/net_serv.cc b/sql/net_serv.cc index c8b2e28ec52..bd4505a3d7f 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -491,7 +491,7 @@ net_real_write(NET *net,const char *packet,ulong len) thr_alarm(&alarmed,(uint) net->write_timeout,&alarm_buff); #else alarmed=0; - vio_timeout(net->vio, net->write_timeout); + vio_timeout(net->vio, 1, net->write_timeout); #endif /* NO_ALARM */ pos=(char*) packet; end=pos+len; @@ -684,7 +684,7 @@ my_real_read(NET *net, ulong *complen) if (net_blocking) thr_alarm(&alarmed,net->read_timeout,&alarm_buff); #else - vio_timeout(net->vio, net->read_timeout); + vio_timeout(net->vio, 0, net->read_timeout); #endif /* NO_ALARM */ pos = net->buff + net->where_b; /* net->packet -4 */ diff --git a/vio/vio_priv.h b/vio/vio_priv.h index 9a925a2c4c9..3a75a08021d 100644 --- a/vio/vio_priv.h +++ b/vio/vio_priv.h @@ -23,7 +23,7 @@ #include #include -void vio_ignore_timeout(Vio *vio, uint timeout); +void vio_ignore_timeout(Vio *vio, uint which, uint timeout); #ifdef HAVE_OPENSSL #include "my_net.h" /* needed because of struct in_addr */ @@ -31,7 +31,7 @@ void vio_ignore_timeout(Vio *vio, uint timeout); void vio_ssl_delete(Vio* vio); int vio_ssl_read(Vio *vio,gptr buf, int size); int vio_ssl_write(Vio *vio,const gptr buf,int size); -void vio_ssl_timeout(Vio *vio, uint timeout); +void vio_ssl_timeout(Vio *vio, uint which, uint timeout); /* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible. */ int vio_ssl_fastsend(Vio *vio); diff --git a/vio/viosocket.c b/vio/viosocket.c index 77922594469..b6aa793f57b 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -318,11 +318,16 @@ my_bool vio_poll_read(Vio *vio,uint timeout) void vio_timeout(Vio *vio __attribute__((unused)), - uint timeout __attribute__((unused))) + uint which __attribute__((unused)), + uint timeout __attribute__((unused))) { #ifdef __WIN__ ulong wait_timeout= (ulong) timeout * 1000; - (void) setsockopt(vio->sd, SOL_SOCKET, SO_RCVTIMEO, (char*) &wait_timeout, + if (which == 0) + (void) setsockopt(vio->sd, SOL_SOCKET, SO_RCVTIMEO, (char*) &wait_timeout, + sizeof(wait_timeout)); + else + (void) setsockopt(vio->sd, SOL_SOCKET, SO_SNDTIMEO, (char*) &wait_timeout, sizeof(wait_timeout)); #endif /* __WIN__ */ } diff --git a/vio/viossl.c b/vio/viossl.c index 07713c83763..773d444063b 100644 --- a/vio/viossl.c +++ b/vio/viossl.c @@ -421,7 +421,8 @@ int vio_ssl_blocking(Vio * vio __attribute__((unused)), void vio_ssl_timeout(Vio *vio __attribute__((unused)), - uint timeout __attribute__((unused))) + uint which __attribute__((unused)), + uint timeout __attribute__((unused))) { /* Not yet implemented (non critical) */ } From 09ca059e4a5a7ffb982fa68e82bdec71091c5269 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 5 May 2005 17:48:50 +0200 Subject: [PATCH 05/44] Bug #10245 VC++ compiler error with mysql.cc Only print the read line version if we are on a platform that supports readline mysql.cc: Add #ifdef to only print readline version if we are on a platform that supports readline client/mysql.cc: Add #ifdef to only print readline version if we are on a platform that supports readline BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + client/mysql.cc | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 1b33d659cfd..b77de4dbb49 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -195,6 +195,7 @@ ram@mysql.r18.ru ram@ram.(none) ramil@mysql.com ranger@regul.home.lan +rburnett@bk-internal.mysql.com rburnett@build.mysql.com reggie@bob.(none) reggie@mdk10.(none) diff --git a/client/mysql.cc b/client/mysql.cc index f27db0de8d8..cbcffb180c3 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -698,9 +698,15 @@ static void usage(int version) const char* readline= "readline"; #endif +#ifdef HAVE_READLINE printf("%s Ver %s Distrib %s, for %s (%s) using %s %s\n", my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE, readline, rl_library_version); +#else + printf("%s Ver %s Distrib %s, for %s (%s)", my_progname, VER, + MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); +#endif + if (version) return; printf("\ From ab54e167052bb03f7f25cb071ee75f4f26caf68f Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2005 11:39:30 +0300 Subject: [PATCH 06/44] Fixes while reviewing new code Added option --count to mysqlshow (to show number of rows) Fixed possible core dump in information schema client/client_priv.h: --count for mysqlshow client/mysqlshow.c: Added option --count to be used when the user want's number of rows per table in the output (We shouldn't use count(*) as default as this can be a slow operation) mysys/my_thr_init.c: Correct comment sql/ha_berkeley.cc: Remove not used variable sql/ha_berkeley.h: Remove not used variable sql/ha_innodb.cc: Remove not used function sql/ha_ndbcluster.cc: false -> FALSE true -> TRUE sql/handler.cc: Added and fixed comments Remove 'strange' code to remove compiler warnings (better to do things like this with attribute) sql/item.cc: false -> FALSE sql/item_cmpfunc.cc: Fixed indentation sql/item_cmpfunc.h: marked BETWEEN as a bool function sql/item_func.cc: Simple optimzation sql/key.cc: Removed wrong code sql/log.cc: Check result from open_index_file() sql/mysql_priv.h: Simplyfy some test of netware sql/mysqld.cc: Fixed indentation Check result form open_index_file() Simplify code with IF_NETWARE() sql/opt_range.cc: false -> FALSE true -> TRUE Fixed indentation sql/opt_sum.cc: Fixed comments sql/sp_head.cc: Simple optimzation Move variable declarations to begining of blocks sql/sql_acl.cc: Fix long lines Rename xx -> column Move declaration to beginning of block sql/sql_parse.cc: Removed comment sql/sql_select.cc: Indentation fixes sql/sql_show.cc: Fixed reference outside of array (possible core dump) sql/sql_table.cc: Simplify code Combine common code sql/sql_test.cc: false -> FALSE sql/sql_trigger.cc: false -> false true -> TRUE sql/sql_yacc.yy: Simpler test sql/unireg.cc: Added comment --- client/client_priv.h | 6 +- client/mysqlshow.c | 65 +++++++++++++--------- mysys/my_thr_init.c | 11 ++-- sql/ha_berkeley.cc | 4 +- sql/ha_berkeley.h | 1 - sql/ha_innodb.cc | 12 ---- sql/ha_ndbcluster.cc | 36 ++++++------ sql/handler.cc | 28 ++++------ sql/item.cc | 4 +- sql/item_cmpfunc.cc | 3 +- sql/item_cmpfunc.h | 1 + sql/item_func.cc | 119 +++++++++++++++++++--------------------- sql/key.cc | 6 -- sql/log.cc | 8 +-- sql/mysql_priv.h | 5 ++ sql/mysqld.cc | 52 +++++++++--------- sql/opt_range.cc | 19 ++++--- sql/opt_sum.cc | 10 ++-- sql/sp_head.cc | 33 +++++------ sql/sql_acl.cc | 39 +++++++------ sql/sql_parse.cc | 2 +- sql/sql_select.cc | 2 + sql/sql_show.cc | 6 +- sql/sql_table.cc | 128 ++++++++++++++++++++++--------------------- sql/sql_test.cc | 2 +- sql/sql_trigger.cc | 2 +- sql/sql_yacc.yy | 3 +- sql/unireg.cc | 1 + 28 files changed, 301 insertions(+), 307 deletions(-) diff --git a/client/client_priv.h b/client/client_priv.h index 95f4d105156..8d25bddc286 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -45,9 +45,9 @@ enum options_client OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH, OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS, OPT_START_POSITION, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME, - OPT_SIGINT_IGNORE, OPT_HEXBLOB, OPT_ORDER_BY_PRIMARY + OPT_SIGINT_IGNORE, OPT_HEXBLOB, OPT_ORDER_BY_PRIMARY, OPT_COUNT, #ifdef HAVE_NDBCLUSTER_DB - ,OPT_NDBCLUSTER,OPT_NDB_CONNECTSTRING + OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, #endif - ,OPT_IGNORE_TABLE + OPT_IGNORE_TABLE }; diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 5631d296a54..85c8f123082 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -28,7 +28,7 @@ #include static my_string host=0,opt_password=0,user=0; -static my_bool opt_show_keys= 0, opt_compress= 0, opt_status= 0, +static my_bool opt_show_keys= 0, opt_compress= 0, opt_count=0, opt_status= 0, tty_password= 0, opt_table_type= 0; static uint opt_verbose=0; static char *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME; @@ -71,8 +71,7 @@ int main(int argc, char **argv) char *pos= argv[argc-1], *to; for (to= pos ; *pos ; pos++, to++) { - switch (*pos) - { + switch (*pos) { case '*': *pos= '%'; first_argument_uses_wildcards= 1; @@ -163,6 +162,10 @@ static struct my_option my_long_options[] = {"default-character-set", OPT_DEFAULT_CHARSET, "Set the default character set.", (gptr*) &default_charset, (gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"count", OPT_COUNT, + "Show number of rows per table (may be slow for not MyISAM tables)", + (gptr*) &opt_count, (gptr*) &opt_count, 0, GET_BOOL, NO_ARG, 0, 0, 0, + 0, 0, 0}, {"compress", 'C', "Use compression in server/client protocol.", (gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -308,6 +311,14 @@ get_options(int *argc,char ***argv) if (tty_password) opt_password=get_tty_password(NullS); + if (opt_count) + { + /* + We need to set verbose to 2 as we need to change the output to include + the number-of-rows column + */ + opt_verbose= 2; + } return; } @@ -322,7 +333,7 @@ list_dbs(MYSQL *mysql,const char *wild) char query[255]; MYSQL_FIELD *field; MYSQL_RES *result; - MYSQL_ROW row, trow, rrow; + MYSQL_ROW row, rrow; if (!(result=mysql_list_dbs(mysql,wild))) { @@ -352,11 +363,6 @@ list_dbs(MYSQL *mysql,const char *wild) if (opt_verbose) { - /* - * Original code by MG16373; Slightly modified by Monty. - * Print now the count of tables and rows for each database. - */ - if (!(mysql_select_db(mysql,row[0]))) { MYSQL_RES *tresult = mysql_list_tables(mysql,(char*)NULL); @@ -366,6 +372,8 @@ list_dbs(MYSQL *mysql,const char *wild) rowcount = 0; if (opt_verbose > 1) { + /* Print the count of tables and rows for each database */ + MYSQL_ROW trow; while ((trow = mysql_fetch_row(tresult))) { sprintf(query,"SELECT COUNT(*) FROM `%s`",trow[0]); @@ -487,10 +495,6 @@ list_tables(MYSQL *mysql,const char *db,const char *table) while ((row = mysql_fetch_row(result))) { - /* - * Modified by MG16373 - * Print now the count of rows for each table. - */ counter++; if (opt_verbose > 0) { @@ -510,6 +514,7 @@ list_tables(MYSQL *mysql,const char *db,const char *table) if (opt_verbose > 1) { + /* Print the count of rows for each table */ sprintf(query,"SELECT COUNT(*) FROM `%s`",row[0]); if (!(mysql_query(mysql,query))) { @@ -574,7 +579,7 @@ list_table_status(MYSQL *mysql,const char *db,const char *wild) MYSQL_RES *result; MYSQL_ROW row; - end=strxmov(query,"show table status from ",db,NullS); + end=strxmov(query,"show table status from `",db,"`",NullS); if (wild && wild[0]) strxmov(end," like '",wild,"'",NullS); if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql))) @@ -600,8 +605,8 @@ list_table_status(MYSQL *mysql,const char *db,const char *wild) } /* -** list fields uses field interface as an example of how to parse -** a MYSQL FIELD + list fields uses field interface as an example of how to parse + a MYSQL FIELD */ static int @@ -612,6 +617,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table, MYSQL_RES *result; MYSQL_ROW row; ulong rows; + LINT_INIT(rows); if (mysql_select_db(mysql,db)) { @@ -619,16 +625,20 @@ list_fields(MYSQL *mysql,const char *db,const char *table, mysql_error(mysql)); return 1; } - sprintf(query,"select count(*) from `%s`", table); - if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql))) + + if (opt_count) { - fprintf(stderr,"%s: Cannot get record count for db: %s, table: %s: %s\n", - my_progname,db,table,mysql_error(mysql)); - return 1; + sprintf(query,"select count(*) from `%s`", table); + if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql))) + { + fprintf(stderr,"%s: Cannot get record count for db: %s, table: %s: %s\n", + my_progname,db,table,mysql_error(mysql)); + return 1; + } + row= mysql_fetch_row(result); + rows= (ulong) strtoull(row[0], (char**) 0, 10); + mysql_free_result(result); } - row = mysql_fetch_row(result); - rows = (ulong) strtoull(row[0], (char**) 0, 10); - mysql_free_result(result); end=strmov(strmov(strmov(query,"show /*!32332 FULL */ columns from `"),table),"`"); if (wild && wild[0]) @@ -640,8 +650,9 @@ list_fields(MYSQL *mysql,const char *db,const char *table, return 1; } - printf("Database: %s Table: %s Rows: %lu", db, table, rows); - + printf("Database: %s Table: %s", db, table); + if (opt_count) + printf(" Rows: %lu", rows); if (wild && wild[0]) printf(" Wildcard: %s",wild); putchar('\n'); @@ -675,7 +686,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table, /***************************************************************************** -** General functions to print a nice ascii-table from data + General functions to print a nice ascii-table from data *****************************************************************************/ static void diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 878e1f6bfc6..4d23d01cd82 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -67,12 +67,11 @@ my_bool my_thread_global_init(void) /* Set mutex type to "fast" a.k.a "adaptive" - The mutex kind determines what happens if a thread attempts to lock - a mutex it already owns with pthread_mutex_lock(3). If the mutex - is of the ``fast'' kind, pthread_mutex_lock(3) simply suspends - the calling thread forever. If the mutex is of the ``error checking'' - kind, pthread_mutex_lock(3) returns immediately with the error - code EDEADLK. + In this case the thread may steal the mutex from some other thread + that is waiting for the same mutex. This will save us some + context switches but may cause a thread to 'starve forever' while + waiting for the mutex (not likely if the code within the mutex is + short). */ pthread_mutexattr_init(&my_fast_mutexattr); pthread_mutexattr_settype(&my_fast_mutexattr, diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 04d81b2f95a..725674946ee 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -2012,9 +2012,7 @@ THR_LOCK_DATA **ha_berkeley::store_lock(THD *thd, THR_LOCK_DATA **to, lock_type <= TL_WRITE) && !thd->in_lock_tables) lock_type = TL_WRITE_ALLOW_WRITE; - lock.type=lock_type; - lock_on_read= ((table->reginfo.lock_type > TL_WRITE_ALLOW_READ) ? DB_RMW : - 0); + lock.type= lock_type; } *to++= &lock; return to; diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h index 10e61455867..1d49c3be0e9 100644 --- a/sql/ha_berkeley.h +++ b/sql/ha_berkeley.h @@ -57,7 +57,6 @@ class ha_berkeley: public handler ulong alloced_rec_buff_length; ulong changed_rows; uint primary_key,last_dup_key, hidden_primary_key, version; - u_int32_t lock_on_read; bool key_read, using_ignore; bool fix_rec_buff_for_blob(ulong length); byte current_ident[BDB_HIDDEN_PRIMARY_KEY_LENGTH]; diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 4217b694f06..72ebba4e49e 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -2450,18 +2450,6 @@ set_field_in_record_to_null( record[null_offset] = record[null_offset] | field->null_bit; } -/****************************************************************** -Resets SQL NULL bits in a record to zero. */ -inline -void -reset_null_bits( -/*============*/ - TABLE* table, /* in: MySQL table object */ - char* record) /* in: a row in MySQL format */ -{ - bzero(record, table->s->null_bytes); -} - extern "C" { /***************************************************************** InnoDB uses this function to compare two data fields for which the data type diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index b61dbd1792c..da46b185664 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -1,4 +1,4 @@ - /* Copyright (C) 2000-2003 MySQL AB +/* 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 @@ -1227,7 +1227,7 @@ static void shrink_varchar(Field* field, const byte* & ptr, char* buf) if (ptr[1] == 0) { buf[0]= ptr[0]; } else { - DBUG_ASSERT(false); + DBUG_ASSERT(FALSE); buf[0]= 255; } memmove(buf + 1, ptr + 2, pack_len - 1); @@ -1773,7 +1773,7 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op, if (p.bound_type == -1) { DBUG_PRINT("error", ("key %d unknown flag %d", j, p.key->flag)); - DBUG_ASSERT(false); + DBUG_ASSERT(FALSE); // Stop setting bounds but continue with what we have op->end_of_bound(range_no); DBUG_RETURN(0); @@ -1850,7 +1850,7 @@ int ha_ndbcluster::ordered_index_scan(const key_range *start_key, if (m_active_cursor == 0) { - restart= false; + restart= FALSE; NdbOperation::LockMode lm= (NdbOperation::LockMode)get_ndb_lock_type(m_lock.type); if (!(op= trans->getNdbIndexScanOperation((NDBINDEX *) @@ -1860,7 +1860,7 @@ int ha_ndbcluster::ordered_index_scan(const key_range *start_key, ERR_RETURN(trans->getNdbError()); m_active_cursor= op; } else { - restart= true; + restart= TRUE; op= (NdbIndexScanOperation*)m_active_cursor; DBUG_ASSERT(op->getSorted() == sorted); @@ -2741,7 +2741,7 @@ int ha_ndbcluster::close_scan() m_ops_pending= 0; } - cursor->close(m_force_send, true); + cursor->close(m_force_send, TRUE); m_active_cursor= m_multi_cursor= NULL; DBUG_RETURN(0); } @@ -5554,7 +5554,7 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p, /** * blobs can't be batched currently */ - m_disable_multi_read= true; + m_disable_multi_read= TRUE; DBUG_RETURN(handler::read_multi_range_first(found_range_p, ranges, range_count, @@ -5562,7 +5562,7 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p, buffer)); } - m_disable_multi_read= false; + m_disable_multi_read= FALSE; /** * Copy arguments into member variables @@ -5610,7 +5610,7 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p, !op->readTuple(lm) && !set_primary_key(op, multi_range_curr->start_key.key) && !define_read_attrs(curr, op) && - (op->setAbortOption(AO_IgnoreError), true)) + (op->setAbortOption(AO_IgnoreError), TRUE)) curr += reclength; else ERR_RETURN(op ? op->getNdbError() : m_active_trans->getNdbError()); @@ -5625,7 +5625,7 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p, !op->readTuple(lm) && !set_index_key(op, key_info, multi_range_curr->start_key.key) && !define_read_attrs(curr, op) && - (op->setAbortOption(AO_IgnoreError), true)) + (op->setAbortOption(AO_IgnoreError), TRUE)) curr += reclength; else ERR_RETURN(op ? op->getNdbError() : m_active_trans->getNdbError()); @@ -5660,7 +5660,7 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p, end_of_buffer -= reclength; } else if ((scanOp= m_active_trans->getNdbIndexScanOperation(idx, tab)) - &&!scanOp->readTuples(lm, 0, parallelism, sorted, false, true) + &&!scanOp->readTuples(lm, 0, parallelism, sorted, FALSE, TRUE) &&!generate_scan_filter(m_cond_stack, scanOp) &&!define_read_attrs(end_of_buffer-reclength, scanOp)) { @@ -5807,11 +5807,11 @@ ha_ndbcluster::read_multi_range_next(KEY_MULTI_RANGE ** multi_range_found_p) continue; } - DBUG_ASSERT(false); // Should only get here via goto's + DBUG_ASSERT(FALSE); // Should only get here via goto's close_scan: if (res == 1) { - m_multi_cursor->close(false, true); + m_multi_cursor->close(FALSE, TRUE); m_active_cursor= m_multi_cursor= 0; DBUG_MULTI_RANGE(8); continue; @@ -6997,7 +6997,7 @@ int ha_ndbcluster::build_scan_filter_group(Ndb_cond* &cond, NdbScanFilter *filter) { uint level=0; - bool negated= false; + bool negated= FALSE; DBUG_ENTER("build_scan_filter_group"); do @@ -7013,7 +7013,7 @@ ha_ndbcluster::build_scan_filter_group(Ndb_cond* &cond, NdbScanFilter *filter) if ((negated) ? filter->begin(NdbScanFilter::NAND) : filter->begin(NdbScanFilter::AND) == -1) DBUG_RETURN(1); - negated= false; + negated= FALSE; cond= cond->next; break; } @@ -7024,19 +7024,19 @@ ha_ndbcluster::build_scan_filter_group(Ndb_cond* &cond, NdbScanFilter *filter) if ((negated) ? filter->begin(NdbScanFilter::NOR) : filter->begin(NdbScanFilter::OR) == -1) DBUG_RETURN(1); - negated= false; + negated= FALSE; cond= cond->next; break; } case(Item_func::NOT_FUNC): { cond= cond->next; - negated= true; + negated= TRUE; break; } default: if (build_scan_filter_predicate(cond, filter, negated)) DBUG_RETURN(1); - negated= false; + negated= FALSE; break; } break; diff --git a/sql/handler.cc b/sql/handler.cc index 7318de1c503..a34b3bd8aac 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -366,11 +366,11 @@ int ha_init() if (opt_bin_log) { - if (!(*ht= binlog_init())) + if (!(*ht= binlog_init())) // Always succeed { - mysql_bin_log.close(LOG_CLOSE_INDEX); - opt_bin_log= 0; - error= 1; + mysql_bin_log.close(LOG_CLOSE_INDEX); // Never used + opt_bin_log= 0; // Never used + error= 1; // Never used } else ha_was_inited_ok(ht++); @@ -2417,6 +2417,7 @@ TYPELIB *ha_known_exts(void) return &known_extensions; } + #ifdef HAVE_REPLICATION /* Reports to table handlers up to which position we have sent the binlog @@ -2424,19 +2425,16 @@ TYPELIB *ha_known_exts(void) SYNOPSIS ha_repl_report_sent_binlog() + thd thread doing the binlog communication to the slave + log_file_name binlog file name + end_offse t the offset in the binlog file up to which we sent the + contents to the slave NOTES Only works for InnoDB at the moment RETURN VALUE Always 0 (= success) - - PARAMETERS - THD *thd in: thread doing the binlog communication to - the slave - char *log_file_name in: binlog file name - my_off_t end_offset in: the offset in the binlog file up to - which we sent the contents to the slave */ int ha_repl_report_sent_binlog(THD *thd, char *log_file_name, @@ -2445,17 +2443,17 @@ int ha_repl_report_sent_binlog(THD *thd, char *log_file_name, #ifdef HAVE_INNOBASE_DB return innobase_repl_report_sent_binlog(thd,log_file_name,end_offset); #else - /* remove warnings about unused parameters */ - thd=thd; log_file_name=log_file_name; end_offset=end_offset; return 0; #endif } + /* Reports to table handlers that we stop replication to a specific slave SYNOPSIS ha_repl_report_replication_stop() + thd thread doing the binlog communication to the slave NOTES Does nothing at the moment @@ -2464,14 +2462,10 @@ int ha_repl_report_sent_binlog(THD *thd, char *log_file_name, Always 0 (= success) PARAMETERS - THD *thd in: thread doing the binlog communication to - the slave */ int ha_repl_report_replication_stop(THD *thd) { - thd = thd; - return 0; } #endif /* HAVE_REPLICATION */ diff --git a/sql/item.cc b/sql/item.cc index 7264f8b2d68..d190fbdade8 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -498,10 +498,10 @@ bool Item_field::collect_item_field_processor(byte *arg) while ((curr_item= item_list_it++)) { if (curr_item->eq(this, 1)) - DBUG_RETURN(false); /* Already in the set. */ + DBUG_RETURN(FALSE); /* Already in the set. */ } item_list->push_back(this); - DBUG_RETURN(false); + DBUG_RETURN(FALSE); } diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 66354560756..e72d1a48395 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1708,8 +1708,7 @@ my_decimal *Item_func_coalesce::val_decimal(my_decimal *decimal_value) void Item_func_coalesce::fix_length_and_dec() { agg_result_type(&cached_result_type, args, arg_count); - switch (cached_result_type) - { + switch (cached_result_type) { case STRING_RESULT: count_only_length(); decimals= NOT_FIXED_DEC; diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index e917e13c5aa..1ed46e87497 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -410,6 +410,7 @@ public: const char *func_name() const { return "between"; } void fix_length_and_dec(); void print(String *str); + bool is_bool_func() { return 1; } CHARSET_INFO *compare_collation() { return cmp_collation.collation; } }; diff --git a/sql/item_func.cc b/sql/item_func.cc index c2afc2fd685..c4e09232141 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -4583,29 +4583,40 @@ Item_func_sp::func_name() const Field * Item_func_sp::sp_result_field(void) const { - Field *field= 0; - THD *thd= current_thd; + Field *field; DBUG_ENTER("Item_func_sp::sp_result_field"); - if (m_sp) + + if (!m_sp) { - if (dummy_table->s == NULL) + if (!(m_sp= sp_find_function(current_thd, m_name, TRUE))) { - char *empty_name= (char *) ""; - TABLE_SHARE *share; - dummy_table->s= share= &dummy_table->share_not_to_be_used; - dummy_table->alias = empty_name; - dummy_table->maybe_null = maybe_null; - dummy_table->in_use= current_thd; - share->table_cache_key = empty_name; - share->table_name = empty_name; - share->table_name = empty_name; + my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str); + DBUG_RETURN(0); } - field= m_sp->make_field(max_length, name, dummy_table); } - DBUG_RETURN(field); + if (!dummy_table->s) + { + char *empty_name= (char *) ""; + TABLE_SHARE *share; + dummy_table->s= share= &dummy_table->share_not_to_be_used; + dummy_table->alias = empty_name; + dummy_table->maybe_null = maybe_null; + dummy_table->in_use= current_thd; + share->table_cache_key = empty_name; + share->table_name = empty_name; + } + DBUG_RETURN(m_sp->make_field(max_length, name, dummy_table)); } +/* + Execute function & store value in field + + RETURN + 0 value <> NULL + 1 value = NULL or error +*/ + int Item_func_sp::execute(Field **flp) { @@ -4625,7 +4636,7 @@ Item_func_sp::execute(Field **flp) f->null_bit= 1; } it->save_in_field(f, 1); - return f->is_null(); + return null_value= f->is_null(); } @@ -4640,12 +4651,13 @@ Item_func_sp::execute(Item **itp) st_sp_security_context save_ctx; #endif - if (! m_sp) - m_sp= sp_find_function(thd, m_name, TRUE); // cache only if (! m_sp) { - my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str); - DBUG_RETURN(-1); + if (!(m_sp= sp_find_function(thd, m_name, TRUE))) + { + my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str); + DBUG_RETURN(-1); + } } old_client_capabilites= thd->client_capabilities; @@ -4692,15 +4704,12 @@ Item_func_sp::make_field(Send_field *tmp_field) { Field *field; DBUG_ENTER("Item_func_sp::make_field"); - if (! m_sp) - m_sp= sp_find_function(current_thd, m_name, TRUE); // cache only if ((field= sp_result_field())) { field->make_field(tmp_field); delete field; DBUG_VOID_RETURN; } - my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str); init_make_field(tmp_field, MYSQL_TYPE_VARCHAR); DBUG_VOID_RETURN; } @@ -4709,20 +4718,17 @@ Item_func_sp::make_field(Send_field *tmp_field) enum enum_field_types Item_func_sp::field_type() const { - Field *field= 0; + Field *field; DBUG_ENTER("Item_func_sp::field_type"); if (result_field) DBUG_RETURN(result_field->type()); - if (! m_sp) - m_sp= sp_find_function(current_thd, m_name, TRUE); // cache only if ((field= sp_result_field())) { enum_field_types result= field->type(); delete field; DBUG_RETURN(result); } - my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str); DBUG_RETURN(MYSQL_TYPE_VARCHAR); } @@ -4730,28 +4736,25 @@ Item_func_sp::field_type() const Item_result Item_func_sp::result_type() const { - Field *field= 0; + Field *field; DBUG_ENTER("Item_func_sp::result_type"); DBUG_PRINT("info", ("m_sp = %p", m_sp)); if (result_field) DBUG_RETURN(result_field->result_type()); - if (! m_sp) - m_sp= sp_find_function(current_thd, m_name, TRUE); // cache only if ((field= sp_result_field())) { Item_result result= field->result_type(); delete field; DBUG_RETURN(result); } - my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str); DBUG_RETURN(STRING_RESULT); } void Item_func_sp::fix_length_and_dec() { - Field *field= result_field; + Field *field; DBUG_ENTER("Item_func_sp::fix_length_and_dec"); if (result_field) @@ -4761,37 +4764,26 @@ Item_func_sp::fix_length_and_dec() DBUG_VOID_RETURN; } - if (! m_sp) - m_sp= sp_find_function(current_thd, m_name, TRUE); // cache only - if (! m_sp) - { - my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str); - } - else - { - if (!field) - field= sp_result_field(); - - decimals= field->decimals(); - max_length= field->representation_length(); + if (!(field= sp_result_field())) + DBUG_VOID_RETURN; + decimals= field->decimals(); + max_length= field->representation_length(); - switch (field->result_type()) { - case STRING_RESULT: - maybe_null= 1; - case REAL_RESULT: - case INT_RESULT: - case DECIMAL_RESULT: - break; - case ROW_RESULT: - default: - // This case should never be chosen - DBUG_ASSERT(0); - break; - } - - if (field != result_field) - delete field; + switch (field->result_type()) { + case STRING_RESULT: + maybe_null= 1; + break; + case REAL_RESULT: + case INT_RESULT: + case DECIMAL_RESULT: + break; + case ROW_RESULT: + default: + // This case should never be chosen + DBUG_ASSERT(0); + break; } + delete field; DBUG_VOID_RETURN; } @@ -4799,11 +4791,10 @@ Item_func_sp::fix_length_and_dec() longlong Item_func_found_rows::val_int() { DBUG_ASSERT(fixed == 1); - THD *thd= current_thd; - - return thd->found_rows(); + return current_thd->found_rows(); } + Field * Item_func_sp::tmp_table_field(TABLE *t_arg) { diff --git a/sql/key.cc b/sql/key.cc index 3299c3db8f8..4bd71d2fa47 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -197,12 +197,6 @@ void key_restore(byte *to_record, byte *from_key, KEY *key_info, (key_part->null_bit == 128), field->bit_ofs, field->bit_len); } - else - { - clr_rec_bits(to_record + key_part->null_offset + - (key_part->null_bit == 128), - field->bit_ofs, field->bit_len); - } } if (key_part->key_part_flag & HA_BLOB_PART) { diff --git a/sql/log.cc b/sql/log.cc index fc74223d7b6..91428cf41be 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -956,9 +956,9 @@ bool MYSQL_LOG::reset_logs(THD* thd) my_delete(index_file_name, MYF(MY_WME)); // Reset (open will update) if (!thd->slave_thread) need_start_event=1; - open_index_file(index_file_name, 0); - open(save_name, save_log_type, 0, - io_cache_type, no_auto_events, max_size, 0); + if (!open_index_file(index_file_name, 0)) + open(save_name, save_log_type, 0, + io_cache_type, no_auto_events, max_size, 0); my_free((gptr) save_name, MYF(0)); err: @@ -1589,7 +1589,7 @@ bool MYSQL_LOG::write(Log_event *event_info) present event could be about a non-transactional table, but still we need to write to the binlog cache in that case to handle updates to mixed trans/non-trans table types the best possible in binlogging) - - or if the event asks for it (cache_stmt == true). + - or if the event asks for it (cache_stmt == TRUE). */ if (opt_using_transactions && thd) { diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 06c946114eb..850b84bef98 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -183,6 +183,11 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset; #else #define IF_INNOBASE_DB(A, B) (B) #endif +#ifdef __NETWARE__ +#define IF_NETWARE(A,B) (A) +#else +#define IF_NETWARE(A,B) (B) +#endif #if defined(__WIN__) || defined(OS2) #define IF_WIN(A,B) (A) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 169c9e057b5..dc1d4688582 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2670,8 +2670,8 @@ static int init_server_components() Update log is removed since 5.0. But we still accept the option. The idea is if the user already uses the binlog and the update log, we completely ignore any option/variable related to the update log, like - if the update log did not exist. But if the user uses only the update log, - then we translate everything into binlog for him (with warnings). + if the update log did not exist. But if the user uses only the update + log, then we translate everything into binlog for him (with warnings). Implementation of the above : - If mysqld is started with --log-update and --log-bin, ignore --log-update (print a warning), push a warning when SQL_LOG_UPDATE @@ -2685,11 +2685,11 @@ static int init_server_components() Note that we tell the user that --sql-bin-update-same is deprecated and does nothing, and we don't take into account if he used this option or - not; but internally we give this variable a value to have the behaviour we - want (i.e. have SQL_LOG_UPDATE influence SQL_LOG_BIN or not). + not; but internally we give this variable a value to have the behaviour + we want (i.e. have SQL_LOG_UPDATE influence SQL_LOG_BIN or not). As sql-bin-update-same, log-update and log-bin cannot be changed by the - user after starting the server (they are not variables), the user will not - later interfere with the settings we do here. + user after starting the server (they are not variables), the user will + not later interfere with the settings we do here. */ if (opt_bin_log) { @@ -2703,7 +2703,7 @@ version 5.0 and above. It is replaced by the binary log."); opt_bin_log= 1; if (opt_update_logname) { - // as opt_bin_log==0, no need to free opt_bin_logname + /* as opt_bin_log==0, no need to free opt_bin_logname */ if (!(opt_bin_logname= my_strdup(opt_update_logname, MYF(MY_WME)))) exit(EXIT_OUT_OF_MEMORY); sql_print_error("The update log is no longer supported by MySQL in \ @@ -2718,8 +2718,8 @@ with --log-bin instead."); } if (opt_log_slave_updates && !opt_bin_log) { - sql_print_warning("You need to use --log-bin to make " - "--log-slave-updates work."); + sql_print_warning("You need to use --log-bin to make " + "--log-slave-updates work."); unireg_abort(1); } @@ -2781,7 +2781,15 @@ server."); my_free(opt_bin_logname, MYF(MY_ALLOW_ZERO_PTR)); opt_bin_logname=my_strdup(buf, MYF(0)); } - mysql_bin_log.open_index_file(opt_binlog_index_name, ln); + if (mysql_bin_log.open_index_file(opt_binlog_index_name, ln)) + { + unireg_abort(1); + } + + /* + Used to specify which type of lock we need to use for queries of type + INSERT ... SELECT. This will change when we have row level logging. + */ using_update_log=1; } @@ -2790,10 +2798,10 @@ server."); sql_print_error("Can't init databases"); unireg_abort(1); } - tc_log= total_ha_2pc > 1 ? opt_bin_log ? - (TC_LOG *)&mysql_bin_log : - (TC_LOG *)&tc_log_mmap : - (TC_LOG *)&tc_log_dummy; + tc_log= (total_ha_2pc > 1 ? (opt_bin_log ? + (TC_LOG *) &mysql_bin_log : + (TC_LOG *) &tc_log_mmap) : + (TC_LOG *) &tc_log_dummy); if (tc_log->open(opt_bin_logname)) { @@ -2808,7 +2816,7 @@ server."); if (opt_bin_log && mysql_bin_log.open(opt_bin_logname, LOG_BIN, 0, WRITE_CACHE, 0, max_binlog_size, 0)) - unireg_abort(1); + unireg_abort(1); #ifdef HAVE_REPLICATION if (opt_bin_log && expire_logs_days) @@ -3567,11 +3575,8 @@ inline void kill_broken_server() (!opt_disable_networking && ip_sock == INVALID_SOCKET)) { select_thread_in_use = 0; -#ifdef __NETWARE__ - kill_server(MYSQL_KILL_SIGNAL); /* never returns */ -#else - kill_server((void*)MYSQL_KILL_SIGNAL); /* never returns */ -#endif /* __NETWARE__ */ + /* The following call will never return */ + kill_server(IF_NETWARE(MYSQL_KILL_SIGNAL, (void*) MYSQL_KILL_SIGNAL)); } } #define MAYBE_BROKEN_SYSCALL kill_broken_server(); @@ -4510,12 +4515,7 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite, ".", (gptr*) &innobase_fast_shutdown, (gptr*) &innobase_fast_shutdown, 0, GET_ULONG, OPT_ARG, 1, 0, -#ifndef __NETWARE__ - 2, -#else - 1, -#endif - 0, 0, 0}, + IF_NETWARE(1,2), 0, 0, 0}, {"innodb_file_per_table", OPT_INNODB_FILE_PER_TABLE, "Stores each InnoDB table to an .ibd file in the database dir.", (gptr*) &innobase_file_per_table, diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 95fe003770b..297e625d075 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -853,7 +853,7 @@ QUICK_ROR_INTERSECT_SELECT::QUICK_ROR_INTERSECT_SELECT(THD *thd_param, bool retrieve_full_rows, MEM_ROOT *parent_alloc) : cpk_quick(NULL), thd(thd_param), need_to_fetch_row(retrieve_full_rows), - scans_inited(false) + scans_inited(FALSE) { index= MAX_KEY; head= table; @@ -1022,7 +1022,7 @@ int QUICK_ROR_INTERSECT_SELECT::reset() DBUG_ENTER("QUICK_ROR_INTERSECT_SELECT::reset"); if (!scans_inited && init_ror_merged_scan(TRUE)) DBUG_RETURN(1); - scans_inited= true; + scans_inited= TRUE; List_iterator_fast it(quick_selects); QUICK_RANGE_SELECT *quick; while ((quick= it++)) @@ -1066,7 +1066,7 @@ QUICK_ROR_INTERSECT_SELECT::~QUICK_ROR_INTERSECT_SELECT() QUICK_ROR_UNION_SELECT::QUICK_ROR_UNION_SELECT(THD *thd_param, TABLE *table) - : thd(thd_param), scans_inited(false) + : thd(thd_param), scans_inited(FALSE) { index= MAX_KEY; head= table; @@ -1148,7 +1148,7 @@ int QUICK_ROR_UNION_SELECT::reset() if (quick->init_ror_merged_scan(FALSE)) DBUG_RETURN(1); } - scans_inited= true; + scans_inited= TRUE; } queue_remove_all(&queue); /* @@ -2677,7 +2677,7 @@ static bool ror_intersect_add(ROR_INTERSECT_INFO *info, { /* Don't add this scan if it doesn't improve selectivity. */ DBUG_PRINT("info", ("The scan doesn't improve selectivity.")); - DBUG_RETURN(false); + DBUG_RETURN(FALSE); } info->out_rows *= selectivity_mult; @@ -2865,7 +2865,7 @@ TRP_ROR_INTERSECT *get_best_ror_intersect(const PARAM *param, SEL_TREE *tree, while (cur_ror_scan != tree->ror_scans_end && !intersect->is_covering) { /* S= S + first(R); R= R - first(R); */ - if (!ror_intersect_add(intersect, *cur_ror_scan, false)) + if (!ror_intersect_add(intersect, *cur_ror_scan, FALSE)) { cur_ror_scan++; continue; @@ -8067,7 +8067,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min() } else { - /* Apply the constant equality conditions to the non-group select fields. */ + /* Apply the constant equality conditions to the non-group select fields */ if (key_infix_len > 0) { if ((result= file->index_read(record, group_prefix, real_prefix_len, @@ -8101,9 +8101,10 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min() */ if (!result) { - if(key_cmp(index_info->key_part, group_prefix, real_prefix_len)) + if (key_cmp(index_info->key_part, group_prefix, real_prefix_len)) key_restore(record, tmp_record, index_info, 0); - } else if (result == HA_ERR_KEY_NOT_FOUND) + } + else if (result == HA_ERR_KEY_NOT_FOUND) result= 0; /* There is a result in any case. */ } } diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index 134d3564ef8..ddeeb44c82b 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -313,7 +313,7 @@ int opt_sum_query(TABLE_LIST *tables, List &all_fields,COND *conds) removed_tables is != 0 if we have used MIN() or MAX(). */ if (removed_tables && used_tables != removed_tables) - const_result= 0; // We didn't remove all tables + const_result= 0; // We didn't remove all tables return const_result; } @@ -323,12 +323,14 @@ int opt_sum_query(TABLE_LIST *tables, List &all_fields,COND *conds) SYNOPSIS simple_pred() - func_item in: Predicate item + func_item Predicate item args out: Here we store the field followed by constants - inv_order out: Is set to 1 if the predicate is of the form 'const op field' + inv_order out: Is set to 1 if the predicate is of the form + 'const op field' RETURN - 0 func_item is a simple predicate: a field is compared with constants + 0 func_item is a simple predicate: a field is compared with + constants 1 Otherwise */ diff --git a/sql/sp_head.cc b/sql/sp_head.cc index ad14116a4c7..c488b9637d7 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -382,32 +382,33 @@ sp_head::create_typelib(List *src) return 0; result->type_lengths= (unsigned int *)(result->type_names + result->count+1); List_iterator it(*src); - String conv, *tmp; - uint32 dummy; - for (uint i=0; icount; i++) + String conv; + for (uint i=0; i < result->count; i++) { - tmp = it++; + uint32 dummy; + uint length; + String *tmp= it++; + if (String::needs_conversion(tmp->length(), tmp->charset(), cs, &dummy)) { uint cnv_errs; conv.copy(tmp->ptr(), tmp->length(), tmp->charset(), cs, &cnv_errs); - char *buf= (char*) alloc_root(mem_root,conv.length()+1); - memcpy(buf, conv.ptr(), conv.length()); - buf[conv.length()]= '\0'; - result->type_names[i]= buf; - result->type_lengths[i]= conv.length(); + + length= conv.length(); + result->type_names[i]= (char*) strmake_root(mem_root, conv.ptr(), + length); } - else { - result->type_names[i]= strdup_root(mem_root, tmp->c_ptr()); - result->type_lengths[i]= tmp->length(); + else + { + length= tmp->length(); + result->type_names[i]= strmake_root(mem_root, tmp->ptr(), length); } // Strip trailing spaces. - uint lengthsp= cs->cset->lengthsp(cs, result->type_names[i], - result->type_lengths[i]); - result->type_lengths[i]= lengthsp; - ((uchar *)result->type_names[i])[lengthsp]= '\0'; + length= cs->cset->lengthsp(cs, result->type_names[i], length); + result->type_lengths[i]= length; + ((uchar *)result->type_names[i])[length]= '\0'; } result->type_names[result->count]= 0; result->type_lengths[result->count]= 0; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index df19c6e55fd..0d95db3b052 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2173,10 +2173,14 @@ static int replace_column_table(GRANT_TABLE *g_t, KEY_PART_INFO *key_part= table->key_info->key_part; DBUG_ENTER("replace_column_table"); - table->field[0]->store(combo.host.str,combo.host.length, system_charset_info); - table->field[1]->store(db,(uint) strlen(db), system_charset_info); - table->field[2]->store(combo.user.str,combo.user.length, system_charset_info); - table->field[3]->store(table_name,(uint) strlen(table_name), system_charset_info); + table->field[0]->store(combo.host.str,combo.host.length, + system_charset_info); + table->field[1]->store(db,(uint) strlen(db), + system_charset_info); + table->field[2]->store(combo.user.str,combo.user.length, + system_charset_info); + table->field[3]->store(table_name,(uint) strlen(table_name), + system_charset_info); /* Get length of 3 first key parts */ key_prefix_length= (key_part[0].store_length + key_part[1].store_length + @@ -2188,17 +2192,17 @@ static int replace_column_table(GRANT_TABLE *g_t, /* first fix privileges for all columns in column list */ List_iterator iter(columns); - class LEX_COLUMN *xx; + class LEX_COLUMN *column; table->file->ha_index_init(0); - while ((xx=iter++)) + while ((column= iter++)) { - ulong privileges = xx->rights; + ulong privileges= column->rights; bool old_row_exists=0; byte user_key[MAX_KEY_LENGTH]; key_restore(table->record[0],key,table->key_info, key_prefix_length); - table->field[4]->store(xx->column.ptr(),xx->column.length(), + table->field[4]->store(column->column.ptr(), column->column.length(), system_charset_info); /* Get key for the first 4 columns */ key_copy(user_key, table->record[0], table->key_info, @@ -2213,15 +2217,15 @@ static int replace_column_table(GRANT_TABLE *g_t, { my_error(ER_NONEXISTING_TABLE_GRANT, MYF(0), combo.user.str, combo.host.str, - table_name); /* purecov: inspected */ - result= -1; /* purecov: inspected */ - continue; /* purecov: inspected */ + table_name); /* purecov: inspected */ + result= -1; /* purecov: inspected */ + continue; /* purecov: inspected */ } old_row_exists = 0; restore_record(table, s->default_values); // Get empty record key_restore(table->record[0],key,table->key_info, key_prefix_length); - table->field[4]->store(xx->column.ptr(),xx->column.length(), + table->field[4]->store(column->column.ptr(),column->column.length(), system_charset_info); } else @@ -2241,6 +2245,7 @@ static int replace_column_table(GRANT_TABLE *g_t, if (old_row_exists) { + GRANT_COLUMN *grant_column; if (privileges) error=table->file->update_row(table->record[1],table->record[0]); else @@ -2251,21 +2256,21 @@ static int replace_column_table(GRANT_TABLE *g_t, result= -1; /* purecov: inspected */ goto end; /* purecov: inspected */ } - GRANT_COLUMN *grant_column = column_hash_search(g_t, - xx->column.ptr(), - xx->column.length()); + grant_column= column_hash_search(g_t, column->column.ptr(), + column->column.length()); if (grant_column) // Should always be true - grant_column->rights = privileges; // Update hash + grant_column->rights= privileges; // Update hash } else // new grant { + GRANT_COLUMN *grant_column; if ((error=table->file->write_row(table->record[0]))) { table->file->print_error(error,MYF(0)); /* purecov: inspected */ result= -1; /* purecov: inspected */ goto end; /* purecov: inspected */ } - GRANT_COLUMN *grant_column = new GRANT_COLUMN(xx->column,privileges); + grant_column= new GRANT_COLUMN(column->column,privileges); my_hash_insert(&g_t->hash_columns,(byte*) grant_column); } } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 0cb3a1cbc11..8b8f303229a 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1051,7 +1051,7 @@ pthread_handler_decl(handle_one_connection,arg) /* now that we've called my_thread_init(), it is safe to call DBUG_* */ #if defined(__WIN__) - init_signals(); // IRENA; testing ? + init_signals(); #elif !defined(OS2) && !defined(__NETWARE__) sigset_t set; VOID(sigemptyset(&set)); // Get mask in use diff --git a/sql/sql_select.cc b/sql/sql_select.cc index fa774c6d89e..2ad30cd0675 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -11653,11 +11653,13 @@ cp_buffer_from_ref(THD *thd, TABLE_REF *ref) enum enum_check_fields save_count_cuted_fields= thd->count_cuted_fields; thd->count_cuted_fields= CHECK_FIELD_IGNORE; for (store_key **copy=ref->key_copy ; *copy ; copy++) + { if ((*copy)->copy()) { thd->count_cuted_fields= save_count_cuted_fields; return 1; // Something went wrong } + } thd->count_cuted_fields= save_count_cuted_fields; return 0; } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index d6027699257..bbd740249cd 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1600,6 +1600,8 @@ LEX_STRING *make_lex_string(THD *thd, LEX_STRING *lex_str, /* INFORMATION_SCHEMA name */ LEX_STRING information_schema_name= {(char*)"information_schema", 18}; + +/* This is only used internally, but we need it here as a forward reference */ extern ST_SCHEMA_TABLE schema_tables[]; typedef struct st_index_field_values @@ -1693,8 +1695,8 @@ bool uses_only_table_name_fields(Item *item, TABLE_LIST *table) CHARSET_INFO *cs= system_charset_info; ST_SCHEMA_TABLE *schema_table= table->schema_table; ST_FIELD_INFO *field_info= schema_table->fields_info; - const char *field_name1= field_info[schema_table->idx_field1].field_name; - const char *field_name2= field_info[schema_table->idx_field2].field_name; + const char *field_name1= schema_table->idx_field1 >= 0 ? field_info[schema_table->idx_field1].field_name : ""; + const char *field_name2= schema_table->idx_field2 >= 0 ? field_info[schema_table->idx_field2].field_name : ""; if (table->table != item_field->field->table || (cs->coll->strnncollsp(cs, (uchar *) field_name1, strlen(field_name1), (uchar *) item_field->field_name, diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 18c90d549ec..f6bdb595b2a 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -38,6 +38,7 @@ static int copy_data_between_tables(TABLE *from,TABLE *to, bool ignore, uint order_num, ORDER *order, ha_rows *copied,ha_rows *deleted); +static bool prepare_blob_field(THD *thd, create_field *sql_field); /* delete (drop) tables. @@ -700,21 +701,20 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, String conv, *tmp; for (uint i= 0; (tmp= it++); i++) { + uint lengthsp; if (String::needs_conversion(tmp->length(), tmp->charset(), cs, &dummy)) { uint cnv_errs; conv.copy(tmp->ptr(), tmp->length(), tmp->charset(), cs, &cnv_errs); - char *buf= (char*) sql_alloc(conv.length()+1); - memcpy(buf, conv.ptr(), conv.length()); - buf[conv.length()]= '\0'; - interval->type_names[i]= buf; + interval->type_names[i]= strmake_root(thd->mem_root, conv.ptr(), + conv.length()); interval->type_lengths[i]= conv.length(); } // Strip trailing spaces. - uint lengthsp= cs->cset->lengthsp(cs, interval->type_names[i], - interval->type_lengths[i]); + lengthsp= cs->cset->lengthsp(cs, interval->type_names[i], + interval->type_lengths[i]); interval->type_lengths[i]= lengthsp; ((uchar *)interval->type_names[i])[lengthsp]= '\0'; } @@ -781,37 +781,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, } sql_field->create_length_to_internal_length(); - if (sql_field->length > MAX_FIELD_VARCHARLENGTH && - !(sql_field->flags & BLOB_FLAG)) - { - /* Convert long VARCHAR columns to TEXT or BLOB */ - char warn_buff[MYSQL_ERRMSG_SIZE]; - - if (sql_field->def) - { - my_error(ER_TOO_BIG_FIELDLENGTH, MYF(0), sql_field->field_name, - MAX_FIELD_VARCHARLENGTH / sql_field->charset->mbmaxlen); - DBUG_RETURN(-1); - } - sql_field->sql_type= FIELD_TYPE_BLOB; - sql_field->flags|= BLOB_FLAG; - sprintf(warn_buff, ER(ER_AUTO_CONVERT), sql_field->field_name, - "VARCHAR", - (sql_field->charset == &my_charset_bin) ? "BLOB" : "TEXT"); - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_AUTO_CONVERT, - warn_buff); - } - - if ((sql_field->flags & BLOB_FLAG) && sql_field->length) - { - if (sql_field->sql_type == FIELD_TYPE_BLOB) - { - /* The user has given a length to the blob column */ - sql_field->sql_type= get_blob_type_from_length(sql_field->length); - sql_field->pack_length= calc_pack_length(sql_field->sql_type, 0); - } - sql_field->length= 0; // Probably from an item - } + if (prepare_blob_field(thd, sql_field)) + DBUG_RETURN(-1); if (!(sql_field->flags & NOT_NULL_FLAG)) null_fields++; @@ -1351,6 +1322,58 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, } +/* + Extend long VARCHAR fields to blob & prepare field if it's a blob + + SYNOPSIS + prepare_blob_field() + sql_field Field to check + + RETURN + 0 ok + 1 Error (sql_field can't be converted to blob) + In this case the error is given +*/ + +static bool prepare_blob_field(THD *thd, create_field *sql_field) +{ + DBUG_ENTER("prepare_blob_field"); + + if (sql_field->length > MAX_FIELD_VARCHARLENGTH && + !(sql_field->flags & BLOB_FLAG)) + { + /* Convert long VARCHAR columns to TEXT or BLOB */ + char warn_buff[MYSQL_ERRMSG_SIZE]; + + if (sql_field->def) + { + my_error(ER_TOO_BIG_FIELDLENGTH, MYF(0), sql_field->field_name, + MAX_FIELD_VARCHARLENGTH / sql_field->charset->mbmaxlen); + DBUG_RETURN(1); + } + sql_field->sql_type= FIELD_TYPE_BLOB; + sql_field->flags|= BLOB_FLAG; + sprintf(warn_buff, ER(ER_AUTO_CONVERT), sql_field->field_name, + "VARCHAR", + (sql_field->charset == &my_charset_bin) ? "BLOB" : "TEXT"); + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_AUTO_CONVERT, + warn_buff); + } + + if ((sql_field->flags & BLOB_FLAG) && sql_field->length) + { + if (sql_field->sql_type == FIELD_TYPE_BLOB) + { + /* The user has given a length to the blob column */ + sql_field->sql_type= get_blob_type_from_length(sql_field->length); + sql_field->pack_length= calc_pack_length(sql_field->sql_type, 0); + } + sql_field->length= 0; + } + DBUG_RETURN(0); +} + + /* Preparation of create_field for SP function return values. Based on code used in the inner loop of mysql_prepare_table() above @@ -1395,33 +1418,12 @@ void sp_prepare_create_field(THD *thd, create_field *sql_field) FIELDFLAG_TREAT_BIT_AS_CHAR; } sql_field->create_length_to_internal_length(); - - if (sql_field->length > MAX_FIELD_VARCHARLENGTH && - !(sql_field->flags & BLOB_FLAG)) - { - /* Convert long VARCHAR columns to TEXT or BLOB */ - char warn_buff[MYSQL_ERRMSG_SIZE]; - - sql_field->sql_type= FIELD_TYPE_BLOB; - sql_field->flags|= BLOB_FLAG; - sprintf(warn_buff, ER(ER_AUTO_CONVERT), sql_field->field_name, - "VARCHAR", - (sql_field->charset == &my_charset_bin) ? "BLOB" : "TEXT"); - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_AUTO_CONVERT, - warn_buff); - } - - if ((sql_field->flags & BLOB_FLAG) && sql_field->length) - { - if (sql_field->sql_type == FIELD_TYPE_BLOB) - { - /* The user has given a length to the blob column */ - sql_field->sql_type= get_blob_type_from_length(sql_field->length); - sql_field->pack_length= calc_pack_length(sql_field->sql_type, 0); - } - sql_field->length= 0; // Probably from an item - } + DBUG_ASSERT(sql_field->def == 0); + /* Can't go wrong as sql_field->def is not defined */ + (void) prepare_blob_field(thd, sql_field); } + + /* Create a table diff --git a/sql/sql_test.cc b/sql/sql_test.cc index c2cd0d59cc3..722568e7f53 100644 --- a/sql/sql_test.cc +++ b/sql/sql_test.cc @@ -183,7 +183,7 @@ TEST_join(JOIN *join) else if (tab->select->quick) { fprintf(DBUG_FILE, " quick select used:\n"); - tab->select->quick->dbug_dump(18, false); + tab->select->quick->dbug_dump(18, FALSE); } else VOID(fputs(" select used\n",DBUG_FILE)); diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 5b6f12eab52..680a80431c5 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -28,7 +28,7 @@ static File_option triggers_file_parameters[]= mysql_create_or_drop_trigger() thd - current thread context (including trigger definition in LEX) tables - table list containing one table for which trigger is created. - create - whenever we create (true) or drop (false) trigger + create - whenever we create (TRUE) or drop (FALSE) trigger NOTE This function is mainly responsible for opening and locking of table and diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 80bf409f7a4..8094d06c629 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1409,8 +1409,7 @@ create_function_tail: sp->m_returns_cs= new_field->charset; - if (new_field->sql_type == FIELD_TYPE_SET || - new_field->sql_type == FIELD_TYPE_ENUM) + if (new_field->interval_list.elements) { new_field->interval= sp->create_typelib(&new_field->interval_list); diff --git a/sql/unireg.cc b/sql/unireg.cc index 95a383e0f01..7ad4563d636 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -504,6 +504,7 @@ static bool pack_header(uchar *forminfo, enum db_type table_type, int2store(forminfo+280,22); /* Rows needed */ int2store(forminfo+282,null_fields); int2store(forminfo+284,com_length); + /* Up to forminfo+288 is free to use for additional information */ DBUG_RETURN(0); } /* pack_header */ From 8b49ccace4bff3348b9e5eea33473879335bb39f Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2005 10:43:29 +0200 Subject: [PATCH 07/44] Bug#10193 Invalid DataDir in config causes ndbd segfault ndb/src/kernel/error/ErrorReporter.cpp: print error and return error if unable to open the file for error reporting. --- ndb/src/kernel/error/ErrorReporter.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ndb/src/kernel/error/ErrorReporter.cpp b/ndb/src/kernel/error/ErrorReporter.cpp index 35cd3f099d9..7c77e7932ee 100644 --- a/ndb/src/kernel/error/ErrorReporter.cpp +++ b/ndb/src/kernel/error/ErrorReporter.cpp @@ -237,6 +237,11 @@ WriteMessage(ErrorCategory thrdType, int thrdMessageID, // Create a new file, and skip the first 69 bytes, // which are info about the current offset stream = fopen(theErrorFileName, "w"); + if(stream == NULL) + { + fprintf(stderr,"Unable to open error log file: %s\n", theErrorFileName); + return -1; + } fprintf(stream, "%s%u%s", "Current byte-offset of file-pointer is: ", 69, " \n\n\n"); From f547b03edbb3a078c9917184b7469cc324f99bfb Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2005 16:12:42 +0500 Subject: [PATCH 08/44] A fix (bug #7970: CONFIG_NR_CPUS not defined for kernel header percpu.h). include/my_global.h: A fix (bug #7970: CONFIG_NR_CPUS not defined for kernel header percpu.h). We don't need to manipulate HAVE_ATOMIC_XXX here as we test it in the configure. --- include/my_global.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/include/my_global.h b/include/my_global.h index bf6f3b52c4b..017cdea140a 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -214,18 +214,6 @@ C_MODE_START int __cxa_pure_virtual() {\ #define BAD_MEMCPY #endif -/* In Linux-alpha we have atomic.h if we are using gcc */ -#if defined(TARGET_OS_LINUX) && defined(__GNUC__) && defined(__alpha__) && (__GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95)) && !defined(HAVE_ATOMIC_ADD) -#define HAVE_ATOMIC_ADD -#define HAVE_ATOMIC_SUB -#endif - -/* In Linux-ia64 including atomic.h will give us an error */ -#if (defined(TARGET_OS_LINUX) && defined(__GNUC__) && (defined(__ia64__)||defined(__powerpc64__))) || !defined(THREAD) -#undef HAVE_ATOMIC_ADD -#undef HAVE_ATOMIC_SUB -#endif - #if defined(_lint) && !defined(lint) #define lint #endif From 4ef759c84ded2d3696c9254b66bb31ab593d5398 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2005 16:51:58 +0500 Subject: [PATCH 09/44] A fix (bug #5056: defaults-extra-file throws no error when file is inaccessible). mysys/default.c: A fix (bug #5056: defaults-extra-file throws no error when file is inaccessible). Return an error if we cannot read default file(s). --- mysys/default.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/mysys/default.c b/mysys/default.c index e3a0b8a20ad..5afefa5463d 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -152,10 +152,15 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv, } else if (defaults_extra_file) { - if (search_default_file(func, func_ctx, NullS, - defaults_extra_file) < 0) + if (search_default_file_with_ext(func, func_ctx, "", "", + defaults_extra_file, 0) < 0) goto err; /* Fatal error */ - + if (error > 0) + { + fprintf(stderr, "Could not open required defaults file: %s\n", + defaults_extra_file); + goto err; + } } } } @@ -526,7 +531,7 @@ static int search_default_file_with_ext(Process_option_func opt_handler, } #endif if (!(fp= my_fopen(name, O_RDONLY, MYF(0)))) - return 0; /* Ignore wrong files */ + return 1; /* Ignore wrong files */ while (fgets(buff, sizeof(buff) - 1, fp)) { From 779ac9cf9e92deb2e3a9d55e3718b7f069998726 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2005 15:08:10 +0200 Subject: [PATCH 10/44] Bug #9721 net_write_timeout not used on Windows viosocket.c: Use ?: syntax to simplify code for setting both timeouts vio/viosocket.c: Use ?: syntax to simplify code for setting both timeouts --- vio/viosocket.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/vio/viosocket.c b/vio/viosocket.c index b6aa793f57b..172d9127dc2 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -323,12 +323,9 @@ void vio_timeout(Vio *vio __attribute__((unused)), { #ifdef __WIN__ ulong wait_timeout= (ulong) timeout * 1000; - if (which == 0) - (void) setsockopt(vio->sd, SOL_SOCKET, SO_RCVTIMEO, (char*) &wait_timeout, - sizeof(wait_timeout)); - else - (void) setsockopt(vio->sd, SOL_SOCKET, SO_SNDTIMEO, (char*) &wait_timeout, - sizeof(wait_timeout)); + (void) setsockopt(vio->sd, SOL_SOCKET, + which ? SO_SNDTIMEO : SO_RCVTIMEO, (char*) &wait_timeout, + sizeof(wait_timeout)); #endif /* __WIN__ */ } From cdbf4939975a579179c3cdeb744416841d5416af Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2005 18:41:41 +0500 Subject: [PATCH 11/44] Bug#6505 Wrong sorting order: latin2_croatian_ci collation was fixed. --- mysql-test/r/ctype_latin2.result | Bin 6569 -> 6411 bytes mysql-test/t/ctype_latin2.test | 11 +++++++---- sql/share/charsets/latin2.xml | 32 +++++++++++++++---------------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/mysql-test/r/ctype_latin2.result b/mysql-test/r/ctype_latin2.result index 2876accaf72bef7fcf4830192431a3bcb02d497b..c2c021b076067245298cd64b5bf61e2667e7e93f 100644 GIT binary patch delta 660 zcmb7-Rc})P07gSdNH~E9{=vmJ_>gV*@G*4ghD*8ax>4wQ$E6z#D{e!E4|f^Pio3hJ zySuxM@WK-bFJDgbCFf*Cq=#pu2D5YJ$s5efS0H~NHaaFcD$Yo>t(0Vk%ksHQe~4+g zEU(w}yN#Uj_`)47+sXmc=Wuxp%Z_*3hBM7@dVHpxW|*Nyf^8)k{;)ri-`Bqck^J2X z{BH~jQi#G7p(w>DP6(ltpd_Lcr71&M!U!jVa+Ie66{$pJst`$4s!^R9)TEY7&C^=# z)*kH*XrFHDj_&FnwdEvAE*;cE4(SmG^nf~w*GawPlwJ`nw+`!wj_Q~m>xrJ~8FiIF zJtb0KU1%VWj_ZV;>je$fl}74DjJ#T)MG9)Y_Uk^4l|&QybXsThT5kw6m8G*fr}Mg? zw|b}d`am-!(_GzYAzQn2Nw@TgSoP3iEz<^V(M__nnK=2iTw8TRKWM2GUDg#{)ir(A z7k$+?S}B#*>PZ{*qOH<&UEgV^-dds6+NPbX(hk}O=s-t0;h-~p=u1EP6JP)X8N^_Q zFqB~oX9Ob|MLMGy!&t_V!FVPxkx5Ku3RB5s8q=A2(|a++mUY0w@sRJpcdz delta 718 zcmXBNOHLbM5Jh2PC%`Gf%RoW`4h%tJP`CZS9{R;XvIrE3ffv98$*W+9SP46#I=9dF ztJI_W+`JB69-GYDyPN!%@@aeqK0}|8&)8>k-R(Cy@z2y}<}>$M_$+-^KAVqDzmeDE zHF-^5lh@=mc}@S<53#!ODwnr7Yz`j#OF0p;8$Q5=#75RW2 zQiT#bqFRT99aDuGtVb0ZU?)_eA$Cd?8ewNtp)vM@Ds+$iqzX;2bE?pk^0(fvw$Kdw hO% - 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F - 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 46 48 49 4A 4B 4C 4D 4E 4F 50 51 52 - 53 54 55 56 58 59 5A 5B 5C 5D 5E 5B 5C 5D 5E 5F - 60 41 42 43 46 48 49 4A 4B 4C 4D 4E 4F 50 51 52 - 53 54 55 56 58 59 5A 5B 5C 5D 5E 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 57 8B 8C 8D 5F 8F - 90 91 92 93 94 95 96 97 98 99 57 9B 9C 9D 5F 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - 41 41 41 41 5C 5B 45 43 44 45 45 45 49 49 49 49 - 47 4E 4F 4F 4F 4F 5D D7 D8 55 55 55 59 59 DE DF - 41 41 41 41 5C 5B 45 43 44 45 45 45 49 49 49 49 - 47 4E 4F 4F 4F 4F 5D F7 D8 55 55 55 59 59 DE FF +00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F +10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F +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 43 44 48 4B 4D 4E 4F 50 52 53 54 56 57 59 +5B 5C 5D 5F 62 64 66 67 68 69 6B C6 C7 C8 C9 CA +CB 41 43 44 48 4B 4D 4E 4F 50 52 53 54 56 57 59 +5B 5C 5D 5F 62 64 66 67 68 69 6B CC CD CE CF D0 +D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 +E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 +F1 41 F2 54 F3 54 5F F4 F5 61 5F 62 6B F6 8E 6B +F7 41 F8 54 F9 54 5F FA FB 61 5F 62 6B FC 8E 6B +5D 41 41 41 41 54 47 44 46 4B 4B 4B 4B 50 50 48 +4A 57 57 59 59 59 59 FD 5D 64 64 64 64 69 62 5F +5D 41 41 41 41 54 47 44 46 4B 4B 4B 4B 50 50 48 +4A 57 57 59 59 59 59 FE 5D 64 64 64 64 69 62 FF From 079910b6f1bc7cbb1a9425bf0e49775e4c41d365 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2005 14:42:28 +0100 Subject: [PATCH 12/44] Bug#6616 MySQL server 100% CPU if FLUSH TABLES WITH READ LOCK + INSERT Infinite loop caused by missing update to thd version. sql/sql_base.cc: Bug#6616 thd version needs to be updated before reopening tables to prevent an infinite loop. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + sql/sql_base.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index bf0dfb9e31d..5a34dbbb1d8 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -9,6 +9,7 @@ acurtis@pcgem.rdg.cyberkinetica.com ahlentz@co3064164-a.rochd1.qld.optusnet.com.au akishkin@work.mysql.com antony@ltantony.dsl-verizon.net +antony@ltantony.mysql.com antony@ltantony.rdg.cyberkinetica.homeunix.net arjen@bitbike.com arjen@co3064164-a.bitbike.com diff --git a/sql/sql_base.cc b/sql/sql_base.cc index ddc81053357..c8eb2338294 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1265,6 +1265,7 @@ bool wait_for_tables(THD *thd) { /* Now we can open all tables without any interference */ thd->proc_info="Reopen tables"; + thd->version= refresh_version; result=reopen_tables(thd,0,0); } pthread_mutex_unlock(&LOCK_open); From f1def25a89e3dc2ed191335e9d5f7843de245e0a Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2005 19:04:58 +0500 Subject: [PATCH 13/44] Trimmed fix for bug #9546 (Crashing with huge decimals) mysql-test/r/type_newdecimal.result: test result fixed mysql-test/t/type_newdecimal.test: test case added sql/my_decimal.cc: error message fixed strings/decimal.c: do_add function fixed --- mysql-test/r/type_newdecimal.result | 11 +++++++++++ mysql-test/t/type_newdecimal.test | 6 ++++++ sql/my_decimal.cc | 6 +++--- strings/decimal.c | 8 +++++++- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index 6702676fa35..840073aed29 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -846,3 +846,14 @@ set sql_mode=''; select 0/0; 0/0 NULL +select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 as x; +x +999999999999999999999999999999999999999999999999999999999999999999999999999999999 +Warnings: +Error 1292 Truncated incorrect DECIMAL value: '' +select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 1 as x; +x +NULL +Warnings: +Error 1292 Truncated incorrect DECIMAL value: '' +Error 1292 Truncated incorrect DECIMAL value: '' diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index 19230c02743..75f35ba0796 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -876,3 +876,9 @@ select 10.3330000000000/12.34500000; set sql_mode=''; select 0/0; + +# +# bug #9546 +# +select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 as x; +select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 1 as x; diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc index 14c15cdc4ef..f188d27ff78 100644 --- a/sql/my_decimal.cc +++ b/sql/my_decimal.cc @@ -43,9 +43,9 @@ int decimal_operation_results(int result) break; case E_DEC_OVERFLOW: push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR, - ER_WARN_DATA_OUT_OF_RANGE, - ER(ER_WARN_DATA_OUT_OF_RANGE), - "", (long)-1); + ER_TRUNCATED_WRONG_VALUE, + ER(ER_TRUNCATED_WRONG_VALUE), + "DECIMAL", ""); break; case E_DEC_DIV_ZERO: push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR, diff --git a/strings/decimal.c b/strings/decimal.c index 4b7dc8803ee..b06a50fc86b 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1612,13 +1612,19 @@ static int do_add(decimal_t *from1, decimal_t *from2, decimal_t *to) x=intg1 > intg2 ? from1->buf[0] : intg2 > intg1 ? from2->buf[0] : from1->buf[0] + from2->buf[0] ; - if (unlikely(x > DIG_MASK*9)) /* yes, there is */ + if (unlikely(x > DIG_MAX-1)) /* yes, there is */ { intg0++; to->buf[0]=0; /* safety */ } FIX_INTG_FRAC_ERROR(to->len, intg0, frac0, error); + if (unlikely(error == E_DEC_OVERFLOW)) + { + max_decimal(to->len * DIG_PER_DEC1, 0, to); + return error; + } + buf0=to->buf+intg0+frac0; to->sign=from1->sign; From 1586eea57340cd1a202845775f285ce6acdb9c08 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2005 17:32:46 +0300 Subject: [PATCH 14/44] Fixed bugs 9820, 9799 and 9800. mysql-test/r/select.result: Added test cases for bugs 9799, 9800 and 9820 mysql-test/t/select.test: Added test cases for bugs 9799, 9800 and 9820 --- mysql-test/r/select.result | 21 +++++++++++++++++++++ mysql-test/t/select.test | 27 +++++++++++++++++++++++++++ sql/item_sum.cc | 7 ++++++- 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index ff45eff68da..fd67903a576 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2455,3 +2455,24 @@ a select x.a, y.a, z.a from ( (t1 x inner join t2 y on x.a=y.a) inner join t2 z on y.a=z.a) WHERE x.a=1; a a a drop table t1,t2; +create table t1 (s1 varchar(5)); +insert into t1 values ('Wall'); +select min(s1) from t1 group by s1 with rollup; +min(s1) +Wall +Wall +drop table t1; +create table t1 (s1 int) engine=myisam; +insert into t1 values (0); +select avg(distinct s1) from t1 group by s1 with rollup; +avg(distinct s1) +0.0000 +0.0000 +drop table t1; +create table t1 (s1 int); +insert into t1 values (null),(1); +select distinct avg(s1) as x from t1 group by s1 with rollup; +x +NULL +1.0000 +drop table t1; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index a92c8ffdc66..64f6674181c 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -2029,3 +2029,30 @@ select t1.a from (t1 inner join t2 on t1.a=t2.a) where t2.a=1; select t1.a from ((t1 inner join t2 on t1.a=t2.a)) where t2.a=1; select x.a, y.a, z.a from ( (t1 x inner join t2 y on x.a=y.a) inner join t2 z on y.a=z.a) WHERE x.a=1; drop table t1,t2; + +# +# Bug#9820 +# + +create table t1 (s1 varchar(5)); +insert into t1 values ('Wall'); +select min(s1) from t1 group by s1 with rollup; +drop table t1; + +# +# Bug#9799 +# + +create table t1 (s1 int) engine=myisam; +insert into t1 values (0); +select avg(distinct s1) from t1 group by s1 with rollup; +drop table t1; + +# +# Bug#9800 +# + +create table t1 (s1 int); +insert into t1 values (null),(1); +select distinct avg(s1) as x from t1 group by s1 with rollup; +drop table t1; diff --git a/sql/item_sum.cc b/sql/item_sum.cc index a7bc08ea170..76bf8189a0e 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -240,6 +240,8 @@ Item_sum_hybrid::Item_sum_hybrid(THD *thd, Item_sum_hybrid *item) case REAL_RESULT: sum= item->sum; break; + case STRING_RESULT: // This can happen with ROLLUP. Note that the value is already + break; // copied at function call. case ROW_RESULT: default: DBUG_ASSERT(0); @@ -585,7 +587,10 @@ bool Item_sum_distinct::setup(THD *thd) DBUG_ENTER("Item_sum_distinct::setup"); - DBUG_ASSERT(tree == 0); /* setup can not be called twice */ + /* + Setup can be called twice for ROLLUP items. This is a bug. + Please add DBUG_ASSERT(tree == 0) here when it's fixed. + */ /* Virtual table and the tree are created anew on each re-execution of From f98913819bffa336adb737b19b8bc22cae0c68e6 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2005 20:06:25 +0500 Subject: [PATCH 15/44] Fix for bug #10004 (Decimal operation crashes server) mysql-test/r/type_newdecimal.result: test result fixed mysql-test/t/type_newdecimal.test: test case added strings/decimal.c: old code didn't work when both decimals had zero before the decimal point --- mysql-test/r/type_newdecimal.result | 3 +++ mysql-test/t/type_newdecimal.test | 5 +++++ strings/decimal.c | 20 ++++++++++++-------- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index 6702676fa35..c63b2d2bb0c 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -846,3 +846,6 @@ set sql_mode=''; select 0/0; 0/0 NULL +select 0.190287977636363637 + 0.040372670 * 0 - 0; +0.190287977636363637 + 0.040372670 * 0 - 0 +0.190287977636363637 diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index 19230c02743..4564fa12d68 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -876,3 +876,8 @@ select 10.3330000000000/12.34500000; set sql_mode=''; select 0/0; + +# +# Bug #10004 +# +select 0.190287977636363637 + 0.040372670 * 0 - 0; diff --git a/strings/decimal.c b/strings/decimal.c index 4b7dc8803ee..7ce7bdb22ee 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1703,19 +1703,23 @@ static int do_sub(decimal_t *from1, decimal_t *from2, decimal_t *to) carry=1; else if (intg2 == intg1) { - while (unlikely(stop1[frac1-1] == 0)) - frac1--; - while (unlikely(stop2[frac2-1] == 0)) - frac2--; - while (buf1 < stop1+frac1 && buf2 < stop2+frac2 && *buf1 == *buf2) + dec1 *end1= stop1 + (frac1 - 1); + dec1 *end2= stop2 + (frac2 - 1); + while (unlikely((buf1 <= end1) && (*end1 == 0))) + end1--; + while (unlikely((buf2 <= end2) && (*end2 == 0))) + end2--; + frac1= (end1 - stop1) + 1; + frac2= (end2 - stop2) + 1; + while (buf1 <=end1 && buf2 <= end2 && *buf1 == *buf2) buf1++, buf2++; - if (buf1 < stop1+frac1) - if (buf2 < stop2+frac2) + if (buf1 <= end1) + if (buf2 <= end2) carry= *buf2 > *buf1; else carry= 0; else - if (buf2 < stop2+frac2) + if (buf2 <= end2) carry=1; else /* short-circuit everything: from1 == from2 */ { From a67043dbd812c2cf4da0950d1b12bf91ee3af14d Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2005 20:11:00 +0500 Subject: [PATCH 16/44] Bug#6611: wrong sorting order. Adding cp1250_croatian_ci collation. --- sql/share/charsets/Index.xml | 3 +++ sql/share/charsets/cp1250.xml | 25 +++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/sql/share/charsets/Index.xml b/sql/share/charsets/Index.xml index 74763b195a8..a41ea80564a 100644 --- a/sql/share/charsets/Index.xml +++ b/sql/share/charsets/Index.xml @@ -367,6 +367,9 @@ To make maintaining easier please: Slovenian Sorbian + + Croatian + compiled diff --git a/sql/share/charsets/cp1250.xml b/sql/share/charsets/cp1250.xml index 8e7102b6737..1e62e64ad5a 100644 --- a/sql/share/charsets/cp1250.xml +++ b/sql/share/charsets/cp1250.xml @@ -57,7 +57,7 @@ 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 81 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 A1 A2 B3 A4 B9 A6 DF A8 A9 BA AB AC AD AE BF + A0 A1 A2 B3 A4 B9 A6 A7 A8 A9 BA AB AC AD AE BF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BE BD BE BF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF @@ -82,7 +82,7 @@ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 A3 B4 B5 B6 B7 B8 A5 AA BB BC BD BC AF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE A7 + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF @@ -132,6 +132,27 @@ + + +00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F +10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F +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 43 44 48 4B 4D 4E 4F 50 52 53 54 56 57 59 +5B 5C 5D 5F 62 64 66 67 68 69 6B 90 91 92 93 94 +95 41 43 44 48 4B 4D 4E 4F 50 52 53 54 56 57 59 +5B 5C 5D 5F 62 64 66 67 68 69 6B 96 97 98 99 9A +9B 9C 9E 9F A0 A1 A2 A3 A4 A5 60 A6 5F 62 6C 6B +A7 A8 A9 AA AB AC AD AE AF B0 60 B1 5F 62 6C 6B +B2 B3 B4 54 B5 41 B6 B7 B8 B9 5F BA BB BC BD 6B +BE BF C0 54 C1 C2 C3 C4 C5 41 5F C6 54 C7 54 6B +5D 41 41 41 41 54 47 44 46 4B 4B 4B 4B 50 50 48 +4A 57 57 59 59 59 59 C8 5D 64 64 64 64 69 62 5F +5D 41 41 41 41 54 47 44 46 4B 4B 4B 4B 50 50 48 +4A 57 57 59 59 59 59 C9 5D 64 64 64 64 69 62 FF + + + From a56921bbe041bbe28e0e5d4ede1681f1e5448c06 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2005 20:11:01 +0500 Subject: [PATCH 17/44] fix for bug #4082: Integer lengths cause truncation with DISTINCT CONCAT and InnoDB --- mysql-test/r/create.result | 8 ++++---- mysql-test/r/innodb.result | 6 ++++++ mysql-test/r/type_float.result | 2 +- mysql-test/t/innodb.test | 9 +++++++++ sql/item.cc | 2 +- 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 92c825f547d..123fdbd90bd 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -413,7 +413,7 @@ explain t2; Field Type Null Key Default Extra a int(11) YES NULL b bigint(11) 0 -c bigint(10) 0 +c bigint(11) 0 d date YES NULL e char(1) f datetime YES NULL @@ -432,11 +432,11 @@ Table Create Table t2 CREATE TABLE `t2` ( `ifnull(a,a)` tinyint(4) default NULL, `ifnull(b,b)` smallint(6) default NULL, - `ifnull(c,c)` mediumint(9) default NULL, + `ifnull(c,c)` mediumint(8) default NULL, `ifnull(d,d)` int(11) default NULL, `ifnull(e,e)` bigint(20) default NULL, - `ifnull(f,f)` float(3,2) default NULL, - `ifnull(g,g)` double(4,3) default NULL, + `ifnull(f,f)` float(24,2) default NULL, + `ifnull(g,g)` double(53,3) default NULL, `ifnull(h,h)` decimal(5,4) default NULL, `ifnull(i,i)` year(4) default NULL, `ifnull(j,j)` date default NULL, diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 6117b0a9a00..a8af3f5f658 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1637,3 +1637,9 @@ ERROR 42S21: Duplicate column name 'c1' alter table t1 add key (c1,c1,c2); ERROR 42S21: Duplicate column name 'c1' drop table t1; +create table t1(a int(1) , b int(1)) engine=innodb; +insert into t1 values ('1111', '3333'); +select distinct concat(a, b) from t1; +concat(a, b) +11113333 +drop table t1; diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index 0906df8f621..319a957498b 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -92,7 +92,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `col1` double default NULL, - `col2` double(22,5) default NULL, + `col2` double(53,5) default NULL, `col3` double default NULL, `col4` double default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 7501889127a..4e18cfb224b 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -1168,3 +1168,12 @@ alter table t1 add key (c1,c2,c1); --error 1060 alter table t1 add key (c1,c1,c2); drop table t1; + +# +# Bug #4082: integer truncation +# + +create table t1(a int(1) , b int(1)) engine=innodb; +insert into t1 values ('1111', '3333'); +select distinct concat(a, b) from t1; +drop table t1; diff --git a/sql/item.cc b/sql/item.cc index 211e165cc6b..6c1506e10e8 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -554,7 +554,7 @@ void Item_field::set_field(Field *field_par) { field=result_field=field_par; // for easy coding with fields maybe_null=field->maybe_null(); - max_length=field_par->field_length; + max_length=field_par->max_length(); decimals= field->decimals(); table_name=field_par->table_name; field_name=field_par->field_name; From c90926e055034da93c7b96b68e7fbb95b89179a2 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2005 20:54:38 +0500 Subject: [PATCH 18/44] Fix FC3 yaSSL compilation problem. This fix is about WL#2286 - Compile MySQL w/YASSL support extra/yassl/include/yassl_int.hpp: Use instance as static class member to fix FC compilation problem. extra/yassl/src/yassl_int.cpp: Remove local static variable, use static class member instead. extra/yassl/taocrypt/include/integer.hpp: Use instance as static class member to fix FC compilation problem. extra/yassl/taocrypt/src/integer.cpp: Remove local static variable, use static class member instead. --- extra/yassl/include/yassl_int.hpp | 2 ++ extra/yassl/src/yassl_int.cpp | 9 +++++---- extra/yassl/taocrypt/include/integer.hpp | 4 ++++ extra/yassl/taocrypt/src/integer.cpp | 7 ++++--- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/extra/yassl/include/yassl_int.hpp b/extra/yassl/include/yassl_int.hpp index fa13baf1ac2..02895d3897b 100644 --- a/extra/yassl/include/yassl_int.hpp +++ b/extra/yassl/include/yassl_int.hpp @@ -122,6 +122,7 @@ public: friend sslFactory& GetSSL_Factory(); // singleton creator private: + static sslFactory instance; sslFactory(const sslFactory&); // hide copy sslFactory& operator=(const sslFactory&); // and assign }; @@ -208,6 +209,7 @@ public: private: Sessions(const Sessions&); // hide copy Sessions& operator=(const Sessions&); // and assign + static Sessions instance; }; diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp index 4cc2b85fccc..c552cfa7189 100644 --- a/extra/yassl/src/yassl_int.cpp +++ b/extra/yassl/src/yassl_int.cpp @@ -1346,17 +1346,18 @@ SSL_SESSION::~SSL_SESSION() } +Sessions Sessions::instance; // simple singleton + Sessions& GetSessions() { - static Sessions instance; // simple singleton - return instance; + return Sessions::instance; } +sslFactory sslFactory::instance; sslFactory& GetSSL_Factory() { - static sslFactory instance; // simple singleton - return instance; + return sslFactory::instance; } diff --git a/extra/yassl/taocrypt/include/integer.hpp b/extra/yassl/taocrypt/include/integer.hpp index 1706b4c0eea..94383f8061d 100644 --- a/extra/yassl/taocrypt/include/integer.hpp +++ b/extra/yassl/taocrypt/include/integer.hpp @@ -258,6 +258,10 @@ private: Integer(word value, unsigned int length); + static const Integer zero; + static const Integer one; + static const Integer two; + int PositiveCompare(const Integer& t) const; friend void PositiveAdd(Integer& sum, const Integer& a, const Integer& b); friend void PositiveSubtract(Integer& diff, const Integer& a, diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp index c95170722ae..9be0a25b363 100644 --- a/extra/yassl/taocrypt/src/integer.cpp +++ b/extra/yassl/taocrypt/src/integer.cpp @@ -2844,23 +2844,24 @@ unsigned int Integer::Encode(byte* output, unsigned int outputLen, } +const Integer Integer::zero(1,2); + const Integer &Integer::Zero() { - static const Integer zero; return zero; } +const Integer Integer::one(1,2); const Integer &Integer::One() { - static const Integer one(1,2); return one; } +const Integer Integer::two(1,2); const Integer &Integer::Two() { - static const Integer two(2,2); return two; } From fb760acf62b613d27abca22024701f6e3b78145c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2005 20:14:22 +0000 Subject: [PATCH 19/44] Fix for bug#8998: information_schema: Table SCHEMATA should report default collations DEFAULT_COLLTION_NAME field is added to SCHEMATA table mysql-test/r/information_schema.result: Fix for bug#8998: information_schema: Table SCHEMATA should report default collations sql/sql_show.cc: Fix for bug#8998: information_schema: Table SCHEMATA should report default collations --- mysql-test/r/information_schema.result | 6 +++--- sql/sql_show.cc | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index c53779582f1..26ebf492eb2 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -4,9 +4,9 @@ skip_show_database OFF grant select, update, execute on test.* to mysqltest_2@localhost; grant select, update on test.* to mysqltest_1@localhost; select * from information_schema.SCHEMATA where schema_name > 'm'; -CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME SQL_PATH -NULL mysql latin1 NULL -NULL test latin1 NULL +CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH +NULL mysql latin1 latin1_swedish_ci NULL +NULL test latin1 latin1_swedish_ci NULL select schema_name from information_schema.schemata; schema_name information_schema diff --git a/sql/sql_show.cc b/sql/sql_show.cc index cf0050a774b..9e89687c60d 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2000,11 +2000,12 @@ err: bool store_schema_shemata(THD* thd, TABLE *table, const char *db_name, - const char* cs_name) + CHARSET_INFO *cs) { restore_record(table, s->default_values); table->field[1]->store(db_name, strlen(db_name), system_charset_info); - table->field[2]->store(cs_name, strlen(cs_name), system_charset_info); + table->field[2]->store(cs->csname, strlen(cs->csname), system_charset_info); + table->field[3]->store(cs->name, strlen(cs->name), system_charset_info); return schema_table_store_record(thd, table); } @@ -2035,7 +2036,7 @@ int fill_schema_shemata(THD *thd, TABLE_LIST *tables, COND *cond) if (with_i_schema) // information schema name is always first in list { if (store_schema_shemata(thd, table, file_name, - system_charset_info->csname)) + system_charset_info)) DBUG_RETURN(1); with_i_schema= 0; continue; @@ -2060,7 +2061,7 @@ int fill_schema_shemata(THD *thd, TABLE_LIST *tables, COND *cond) strmov(path+length, MY_DB_OPT_FILE); load_db_opt(thd, path, &create); if (store_schema_shemata(thd, table, file_name, - create.default_table_charset->csname)) + create.default_table_charset)) DBUG_RETURN(1); } } @@ -3482,6 +3483,7 @@ ST_FIELD_INFO schema_fields_info[]= {"CATALOG_NAME", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0}, {"SCHEMA_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Database"}, {"DEFAULT_CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 0, 0}, + {"DEFAULT_COLLATION_NAME", 64, MYSQL_TYPE_STRING, 0, 0, 0}, {"SQL_PATH", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0}, {0, 0, MYSQL_TYPE_STRING, 0, 0, 0} }; From bc6457fc369dcd7f02daa5b02e8a740cd698d926 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 00:53:36 +0200 Subject: [PATCH 20/44] - added some required CXXFLAGS to BUILD/compile-dist to allow the distribution build to pass without unresolved symbols BUILD/compile-dist: - added some required CXXFLAGS to allow the distribution build to pass --- BUILD/compile-dist | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/BUILD/compile-dist b/BUILD/compile-dist index ef6302f0d9c..4fa3c0a8624 100755 --- a/BUILD/compile-dist +++ b/BUILD/compile-dist @@ -18,12 +18,17 @@ autoconf # Default to gcc for CC and CXX if test -z "$CXX" ; then export CXX=gcc + # Set some required compile options + if test -z "$CXXFLAGS" ; then + export CXXFLAGS=""-felide-constructors -fno-exceptions -fno-rtti"" + fi fi if test -z "$CC" ; then export CC=gcc fi + # Use ccache, if available if ccache -V > /dev/null 2>&1 then From 8ec23d0efcfd48b19746f19934256d216caf0f8f Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 01:25:20 +0200 Subject: [PATCH 21/44] - typo fix in BUILD/compile-dist BUILD/compile-dist: - typo fix --- BUILD/compile-dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD/compile-dist b/BUILD/compile-dist index 4fa3c0a8624..51afd104491 100755 --- a/BUILD/compile-dist +++ b/BUILD/compile-dist @@ -20,7 +20,7 @@ if test -z "$CXX" ; then export CXX=gcc # Set some required compile options if test -z "$CXXFLAGS" ; then - export CXXFLAGS=""-felide-constructors -fno-exceptions -fno-rtti"" + export CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti" fi fi From 52db68ca481bd55daafd53220eeb0c5308df67b7 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 12:11:05 +0500 Subject: [PATCH 22/44] Small fix for the test mysql-test/t/type_newdecimal.test: these lines work differently in ps-protocol mode so should always work in normal here --- mysql-test/t/type_newdecimal.test | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index 0a152cb339e..7b33a46ae96 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -880,9 +880,10 @@ select 0/0; # # bug #9546 # +--disable_ps_protocol select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 as x; select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 1 as x; - +--enable_ps_protocol # # Bug #10004 # From aa0c40a33bffc2a82bf200e54c5d8b1234d59acf Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 10:56:03 +0200 Subject: [PATCH 23/44] ndb - bug#8928 ndb/src/kernel/blocks/dbdict/Dbdict.cpp: same number of lh3distrbits for all frags --- ndb/src/kernel/blocks/dbdict/Dbdict.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index 184db794057..0c4d20ca248 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -4043,12 +4043,14 @@ calcLHbits(Uint32 * lhPageBits, Uint32 * lhDistrBits, tmp <<= 1; distrBits++; }//while +#ifdef ndb_classical_lhdistrbits if (tmp != totalFragments) { tmp >>= 1; if ((fid >= (totalFragments - tmp)) && (fid < (tmp - 1))) { distrBits--; }//if }//if +#endif * lhPageBits = pageBits; * lhDistrBits = distrBits; From 1570873c6b6e0b5a7529105c0e5b76c4f662c43d Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 11:35:14 +0200 Subject: [PATCH 24/44] [backport of 4.1, because 4.0 autobuild now hits the same problem; when merging just use "ul"] In configure.in, don't remove $AVAILABLE_LANGUAGES_ERRORS_RULES at end because config.status may later need this file (if it does not find it it won't incorporate dependencies of errmsg.sys in sql/share/Makefile). In sql/share/Makefile.am using "all:" leads to double-"all:" in Makefile. configure.in: Don't remove $AVAILABLE_LANGUAGES_ERRORS_RULES at end of configure.in because config.status may later need this file (if it does not find it it won't incorporate dependencies of errmsg.sys in sql/share/Makefile :( ) sql/share/Makefile.am: using "all:" leads to double-"all:" in Makefile (counting the auto-generated); all-local is the standard way to : BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + configure.in | 1 - sql/share/Makefile.am | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 5a34dbbb1d8..967f8c7cb47 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -30,6 +30,7 @@ dellis@goetia.(none) dlenev@brandersnatch.localdomain dlenev@build.mysql.com dlenev@mysql.com +gbichot@production.mysql.com gbichot@quadxeon.mysql.com gerberb@ou800.zenez.com gluh@gluh.(none) diff --git a/configure.in b/configure.in index 8b1b6a99039..938f2f5776f 100644 --- a/configure.in +++ b/configure.in @@ -2720,7 +2720,6 @@ AC_OUTPUT(Makefile extra/Makefile mysys/Makefile isam/Makefile dnl test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h ]) -rm -f $AVAILABLE_LANGUAGES_ERRORS_RULES echo echo "MySQL has a Web site at http://www.mysql.com/ which carries details on the" echo "latest release, upcoming features, and other information to make your" diff --git a/sql/share/Makefile.am b/sql/share/Makefile.am index 5ca3dce4e04..33c3f9a7edd 100644 --- a/sql/share/Makefile.am +++ b/sql/share/Makefile.am @@ -25,7 +25,7 @@ dist-hook: $(INSTALL_DATA) $(srcdir)/charsets/README $(distdir)/charsets $(INSTALL_DATA) $(srcdir)/charsets/Index $(distdir)/charsets -all: @AVAILABLE_LANGUAGES_ERRORS@ +all-local: @AVAILABLE_LANGUAGES_ERRORS@ # this is ugly, but portable @AVAILABLE_LANGUAGES_ERRORS_RULES@ From 77cb61d2cfc58e4af70aa57b98b882056529e93b Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 14:41:00 +0500 Subject: [PATCH 25/44] Fix for bug #9527 (negative zero is a nonsence) strings/decimal.c: added the check to make sure we don't ge -0.00 --- strings/decimal.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/strings/decimal.c b/strings/decimal.c index 7459b2f7dda..3fa06132cf1 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1924,6 +1924,17 @@ int decimal_mul(decimal_t *from1, decimal_t *from2, decimal_t *to) for (; carry; buf0--) ADD(*buf0, *buf0, 0, carry); } + + /* Now we have to check for -0.000 case */ + if (to->sign) + { + dec1 *buf= to->buf; + dec1 *end= to->buf + intg0 + frac0; + for (; (buf Date: Sat, 7 May 2005 14:52:03 +0500 Subject: [PATCH 26/44] Test case added for bug #9527 (negative zero is a nonsence) mysql-test/r/type_newdecimal.result: test result fixed mysql-test/t/type_newdecimal.test: test case added --- mysql-test/r/type_newdecimal.result | 3 +++ mysql-test/t/type_newdecimal.test | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index a922ed04826..86c905b83a2 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -860,3 +860,6 @@ Error 1292 Truncated incorrect DECIMAL value: '' select 0.190287977636363637 + 0.040372670 * 0 - 0; 0.190287977636363637 + 0.040372670 * 0 - 0 0.190287977636363637 +select -0.123 * 0; +-0.123 * 0 +0.000 diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index 7b33a46ae96..5ceb704eaf7 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -888,3 +888,7 @@ select 9999999999999999999999999999999999999999999999999999999999999999999999999 # Bug #10004 # select 0.190287977636363637 + 0.040372670 * 0 - 0; +# +# Bug #9527 +# +select -0.123 * 0; From e4c24674433f699e8fa082abd3df0d13f5529e1f Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 12:17:54 +0000 Subject: [PATCH 27/44] Fix for bug#9897: Views: 'Check Table' crashes MySQL, with a view and a table in the statement thd->lex->derived_tables should be zero(it may be changed if we open a view) mysql-test/r/check.result: Fix for bug#9897: Views: 'Check Table' crashes MySQL, with a view and a table in the statement mysql-test/t/check.test: Fix for bug#9897: Views: 'Check Table' crashes MySQL, with a view and a table in the statement sql/sql_table.cc: Fix for bug#9897: Views: 'Check Table' crashes MySQL, with a view and a table in the statement --- mysql-test/r/check.result | 9 +++++++++ mysql-test/t/check.test | 12 ++++++++++++ sql/sql_table.cc | 7 +++++++ 3 files changed, 28 insertions(+) diff --git a/mysql-test/r/check.result b/mysql-test/r/check.result index ecaa13642bd..4c565f4f1b1 100644 --- a/mysql-test/r/check.result +++ b/mysql-test/r/check.result @@ -5,3 +5,12 @@ insert into t1 values (200000); Table Op Msg_type Msg_text test.t1 check status OK drop table t1; +Create table t1(f1 int); +Create table t2(f1 int); +Create view v1 as Select * from t1; +Check Table v1,t2; +Table Op Msg_type Msg_text +test.v1 check status OK +test.t2 check status OK +drop view v1; +drop table t1, t2; diff --git a/mysql-test/t/check.test b/mysql-test/t/check.test index bc61aea2d66..c502655818d 100644 --- a/mysql-test/t/check.test +++ b/mysql-test/t/check.test @@ -22,3 +22,15 @@ connection con1; reap; drop table t1; +# +# Bug #9897 Views: 'Check Table' crashes MySQL, with a view and a table +# in the statement +# + +connection default; +Create table t1(f1 int); +Create table t2(f1 int); +Create view v1 as Select * from t1; +Check Table v1,t2; +drop view v1; +drop table t1, t2; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 38944e3117d..be0a36bf041 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2342,6 +2342,13 @@ send_result_message: } close_thread_tables(thd); table->table=0; // For query cache + /* + thd->lex->derived_tables may be set to non zero value if we open + a view. It is necessary to clear thd->lex->derived_tables flag + to prevent processing of derived tables during next open_and_lock_tables + if next table is a real table. + */ + thd->lex->derived_tables= 0; if (protocol->write()) goto err; } From bb42494438aa33eba06506724fea1a1485979b1f Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 13:31:37 +0100 Subject: [PATCH 28/44] Bug#9725 - "disapearing query/hang" and "unknown error" with "on duplicate key update" INSERT IGNORE...UPDATE causes break in protocol or unknown error message. Fix so that protocol doesn't break by properly ignoring dups. mysql-test/r/insert_update.result: Test for Bug#9725 mysql-test/t/insert_update.test: Test for Bug#9725 sql/sql_insert.cc: Ignore the failure in update_row when IGNORE is set. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + mysql-test/r/insert_update.result | 13 +++++++++++++ mysql-test/t/insert_update.test | 12 ++++++++++++ sql/sql_insert.cc | 4 ++++ 4 files changed, 30 insertions(+) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 5049352c8d4..1323f7a72f1 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -13,6 +13,7 @@ administrador@light.hegel.local ahlentz@co3064164-a.rochd1.qld.optusnet.com.au akishkin@work.mysql.com antony@ltantony.dsl-verizon.net +antony@ltantony.mysql.com antony@ltantony.rdg.cyberkinetica.com antony@ltantony.rdg.cyberkinetica.homeunix.net arjen@bitbike.com diff --git a/mysql-test/r/insert_update.result b/mysql-test/r/insert_update.result index ff7ec1ba73f..f78372541f2 100644 --- a/mysql-test/r/insert_update.result +++ b/mysql-test/r/insert_update.result @@ -167,3 +167,16 @@ a b c VALUES(a) 2 1 11 NULL DROP TABLE t1; DROP TABLE t2; +create table t1 (a int not null unique); +insert into t1 values (1),(2); +insert ignore into t1 select 1 on duplicate key update a=2; +select * from t1; +a +1 +2 +insert ignore into t1 select a from t1 on duplicate key update a=a+1 ; +select * from t1; +a +1 +3 +drop table t1; diff --git a/mysql-test/t/insert_update.test b/mysql-test/t/insert_update.test index 188de8a5379..0fa366586b3 100644 --- a/mysql-test/t/insert_update.test +++ b/mysql-test/t/insert_update.test @@ -80,3 +80,15 @@ INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a); SELECT *, VALUES(a) FROM t1; DROP TABLE t1; DROP TABLE t2; + +# +# Bug#9725 - "disapearing query/hang" and "unknown error" with "on duplicate key update" +# INSERT INGORE...UPDATE gives bad error or breaks protocol. +# +create table t1 (a int not null unique); +insert into t1 values (1),(2); +insert ignore into t1 select 1 on duplicate key update a=2; +select * from t1; +insert ignore into t1 select a from t1 on duplicate key update a=a+1 ; +select * from t1; +drop table t1; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 3ced5921076..a3a42ce385d 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -632,7 +632,11 @@ int write_record(TABLE *table,COPY_INFO *info) if (fill_record(*info->update_fields, *info->update_values, 0)) goto err; if ((error=table->file->update_row(table->record[1],table->record[0]))) + { + if ((error == HA_ERR_FOUND_DUPP_KEY) && info->ignore) + break; goto err; + } info->updated++; break; } From 76f63c975dde623e4d5e88ced4720d3d76fc2da8 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 13:51:29 +0100 Subject: [PATCH 29/44] Bug#9666 - Can't use 'DEFAULT FALSE' for column of type bool Fix bug by moving TRUE/FALSE in with other literals. mysql-test/r/create.result: Test for Bug#9666 mysql-test/t/create.test: Test for Bug#9666 sql/sql_yacc.yy: Move TRUE/FALSE in with other literals. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + mysql-test/r/create.result | 11 +++++++++++ mysql-test/t/create.test | 11 +++++++++++ sql/sql_yacc.yy | 6 ++---- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 5049352c8d4..1323f7a72f1 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -13,6 +13,7 @@ administrador@light.hegel.local ahlentz@co3064164-a.rochd1.qld.optusnet.com.au akishkin@work.mysql.com antony@ltantony.dsl-verizon.net +antony@ltantony.mysql.com antony@ltantony.rdg.cyberkinetica.com antony@ltantony.rdg.cyberkinetica.homeunix.net arjen@bitbike.com diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 92c825f547d..ac4f711e4d0 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -552,3 +552,14 @@ NULL 1 Test 0 NULL 1 drop table t1, t2, t3; +create table t1 (b bool not null default false); +create table t2 (b bool not null default true); +insert into t1 values (); +insert into t2 values (); +select * from t1; +b +0 +select * from t2; +b +1 +drop table t1,t2; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 6f222eedec1..ce85e530569 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -449,3 +449,14 @@ INSERT INTO t2 VALUES ('5000000001', 'proc01', '20031029090650', '2003-10-29 13: CREATE TABLE t3 SELECT t1.dsc,COUNT(DISTINCT t2.id) AS countOfRuns FROM t1 LEFT JOIN t2 ON (t1.id=t2.id) GROUP BY t1.id; SELECT * FROM t3; drop table t1, t2, t3; + +# +# Bug#9666: Can't use 'DEFAULT FALSE' for column of type bool +# +create table t1 (b bool not null default false); +create table t2 (b bool not null default true); +insert into t1 values (); +insert into t2 values (); +select * from t1; +select * from t2; +drop table t1,t2; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 594077dd4f3..73845f7d645 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2959,8 +2959,6 @@ simple_expr: { $$= new Item_func_export_set($3, $5, $7, $9); } | EXPORT_SET '(' expr ',' expr ',' expr ',' expr ',' expr ')' { $$= new Item_func_export_set($3, $5, $7, $9, $11); } - | FALSE_SYM - { $$= new Item_int((char*) "FALSE",0,1); } | FORMAT_SYM '(' expr ',' NUM ')' { $$= new Item_func_format($3,atoi($5.str)); } | FROM_UNIXTIME '(' expr ')' @@ -3108,8 +3106,6 @@ simple_expr: { $$= new Item_func_trim($5,$3); } | TRUNCATE_SYM '(' expr ',' expr ')' { $$= new Item_func_round($3,$5,1); } - | TRUE_SYM - { $$= new Item_int((char*) "TRUE",1,1); } | UDA_CHAR_SUM '(' udf_expr_list ')' { if ($3 != NULL) @@ -4892,6 +4888,8 @@ literal: | NUM_literal { $$ = $1; } | NULL_SYM { $$ = new Item_null(); Lex->next_state=MY_LEX_OPERATOR_OR_IDENT;} + | FALSE_SYM { $$= new Item_int((char*) "FALSE",0,1); } + | TRUE_SYM { $$= new Item_int((char*) "TRUE",1,1); } | HEX_NUM { $$ = new Item_varbinary($1.str,$1.length);} | UNDERSCORE_CHARSET HEX_NUM { From bd58e3e59cfa4dd03feb515b38858ba05820284c Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 13:55:46 +0000 Subject: [PATCH 30/44] Fix for bug #9838: INFORMATION_SCHEMA.COLUMNS columns of granted views missing sql/sql_acl.cc: Fix for bug #9838: INFORMATION_SCHEMA.COLUMNS columns of granted views missing -increase grant_version in acl_init, mysql_table_grant -table privileges should be taken into account when we calculate column grants sql/sql_show.cc: Fix for bug #9838: INFORMATION_SCHEMA.COLUMNS columns of granted views missing use 'base_name', 'file_name' because 'tables->db', 'tables->tables' could be invalid in case of view(derived tables). --- mysql-test/r/information_schema.result | 18 +++++++++++++----- mysql-test/t/information_schema.test | 19 ++++++++++++++----- sql/sql_acl.cc | 10 +++++----- sql/sql_show.cc | 4 ++-- 4 files changed, 34 insertions(+), 17 deletions(-) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 26ebf492eb2..0aa5e759207 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -3,6 +3,8 @@ Variable_name Value skip_show_database OFF grant select, update, execute on test.* to mysqltest_2@localhost; grant select, update on test.* to mysqltest_1@localhost; +create user mysqltest_3@localhost; +create user mysqltest_3; select * from information_schema.SCHEMATA where schema_name > 'm'; CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH NULL mysql latin1 latin1_swedish_ci NULL @@ -154,7 +156,9 @@ NULL mysqltest t1 a 1 NULL YES int NULL NULL 11 0 NULL NULL int(11) select,ins show columns from mysqltest.t1 where field like "%a%"; Field Type Null Key Default Extra a int(11) YES NULL +create view mysqltest.v1 (c) as select a from mysqltest.t1; grant select (a) on mysqltest.t1 to mysqltest_2@localhost; +grant select on mysqltest.v1 to mysqltest_3; select table_name, column_name, privileges from information_schema.columns where table_schema = 'mysqltest' and table_name = 't1'; table_name column_name privileges @@ -163,7 +167,11 @@ show columns from mysqltest.t1; Field Type Null Key Default Extra a int(11) YES NULL b varchar(30) YES MUL NULL -drop view v1; +select table_name, column_name, privileges from information_schema.columns +where table_schema = 'mysqltest' and table_name = 'v1'; +table_name column_name privileges +v1 c select +drop view v1, mysqltest.v1; drop tables mysqltest.t4, mysqltest.t1, t2, t3; drop database mysqltest; select * from information_schema.CHARACTER_SETS @@ -376,10 +384,10 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRAN 'mysqltest_1'@'localhost' NULL test t1 a INSERT NO 'mysqltest_1'@'localhost' NULL test t1 a UPDATE NO 'mysqltest_1'@'localhost' NULL test t1 a REFERENCES NO -delete from mysql.user where user='mysqltest_1' or user='mysqltest_2'; -delete from mysql.db where user='mysqltest_1' or user='mysqltest_2'; -delete from mysql.tables_priv where user='mysqltest_1' or user='mysqltest_2'; -delete from mysql.columns_priv where user='mysqltest_1' or user='mysqltest_2'; +delete from mysql.user where user like 'mysqltest%'; +delete from mysql.db where user like 'mysqltest%'; +delete from mysql.tables_priv where user like 'mysqltest%'; +delete from mysql.columns_priv where user like 'mysqltest%'; flush privileges; drop table t1; create table t1 (a int null, primary key(a)); diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index b4cc118c62f..1739604372a 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -7,6 +7,9 @@ show variables where variable_name like "skip_show_database"; grant select, update, execute on test.* to mysqltest_2@localhost; grant select, update on test.* to mysqltest_1@localhost; +create user mysqltest_3@localhost; +create user mysqltest_3; + select * from information_schema.SCHEMATA where schema_name > 'm'; select schema_name from information_schema.schemata; @@ -53,15 +56,21 @@ select * from information_schema.COLUMNS where table_name="t1" and column_name= "a"; show columns from mysqltest.t1 where field like "%a%"; +create view mysqltest.v1 (c) as select a from mysqltest.t1; grant select (a) on mysqltest.t1 to mysqltest_2@localhost; +grant select on mysqltest.v1 to mysqltest_3; connect (user3,localhost,mysqltest_2,,); connection user3; select table_name, column_name, privileges from information_schema.columns where table_schema = 'mysqltest' and table_name = 't1'; show columns from mysqltest.t1; +connect (user4,localhost,mysqltest_3,,mysqltest); +connection user4; +select table_name, column_name, privileges from information_schema.columns +where table_schema = 'mysqltest' and table_name = 'v1'; connection default; -drop view v1; +drop view v1, mysqltest.v1; drop tables mysqltest.t4, mysqltest.t1, t2, t3; drop database mysqltest; @@ -176,10 +185,10 @@ select * from information_schema.USER_PRIVILEGES where grantee like '%mysqltest_ select * from information_schema.SCHEMA_PRIVILEGES where grantee like '%mysqltest_1%'; select * from information_schema.TABLE_PRIVILEGES where grantee like '%mysqltest_1%'; select * from information_schema.COLUMN_PRIVILEGES where grantee like '%mysqltest_1%'; -delete from mysql.user where user='mysqltest_1' or user='mysqltest_2'; -delete from mysql.db where user='mysqltest_1' or user='mysqltest_2'; -delete from mysql.tables_priv where user='mysqltest_1' or user='mysqltest_2'; -delete from mysql.columns_priv where user='mysqltest_1' or user='mysqltest_2'; +delete from mysql.user where user like 'mysqltest%'; +delete from mysql.db where user like 'mysqltest%'; +delete from mysql.tables_priv where user like 'mysqltest%'; +delete from mysql.columns_priv where user like 'mysqltest%'; flush privileges; drop table t1; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index c0bbc4d481a..ca9ba7611e6 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -63,8 +63,7 @@ static bool allow_all_hosts=1; static HASH acl_check_hosts, column_priv_hash, proc_priv_hash; static DYNAMIC_ARRAY acl_wild_hosts; static hash_filo *acl_cache; -static uint grant_version=0; -static uint priv_version=0; /* Version of priv tables. incremented by acl_init */ +static uint grant_version=0; /* Version of priv tables. incremented by acl_init */ static ulong get_access(TABLE *form,uint fieldnr, uint *next_field=0); static int acl_compare(ACL_ACCESS *a,ACL_ACCESS *b); static ulong get_sort(uint count,...); @@ -153,7 +152,7 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables) DBUG_RETURN(0); /* purecov: tested */ } - priv_version++; /* Privileges updated */ + grant_version++; /* Privileges updated */ mysql_proc_table_exists= 1; // Assume mysql.proc exists /* @@ -2721,6 +2720,7 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list, rw_wrlock(&LOCK_grant); MEM_ROOT *old_root= thd->mem_root; thd->mem_root= &memex; + grant_version++; while ((Str = str_list++)) { @@ -3689,9 +3689,9 @@ ulong get_column_grant(THD *thd, GRANT_INFO *grant, grant_column= column_hash_search(grant_table, field_name, (uint) strlen(field_name)); if (!grant_column) - priv= grant->privilege; + priv= (grant->privilege | grant_table->privs); else - priv= grant->privilege | grant_column->rights; + priv= (grant->privilege | grant_table->privs | grant_column->rights); } rw_unlock(&LOCK_grant); return priv; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index f48a8d67d54..ceb98740298 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2303,8 +2303,8 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, uint col_access; check_access(thd,SELECT_ACL | EXTRA_ACL, base_name, &tables->grant.privilege, 0, 0); - col_access= get_column_grant(thd, &tables->grant, tables->db, - tables->table_name, + col_access= get_column_grant(thd, &tables->grant, + base_name, file_name, field->field_name) & COL_ACLS; if (lex->orig_sql_command != SQLCOM_SHOW_FIELDS && !col_access) continue; From e584559febc18f045b74e1e13e58c88eba92c76a Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 07:50:04 -0700 Subject: [PATCH 31/44] Backport fix for escaping multibyte characters. (Bug #9864) libmysql/libmysql.c: Backport fix for escaping multibyte characters from 4.1 --- libmysql/libmysql.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 47f28e296b2..1e6a54455c4 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -3228,6 +3228,23 @@ mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to, from--; continue; } + /* + If the next character appears to begin a multi-byte character, we + escape that first byte of that apparent multi-byte character. (The + character just looks like a multi-byte character -- if it were actually + a multi-byte character, it would have been passed through in the test + above.) + + Without this check, we can create a problem by converting an invalid + multi-byte character into a valid one. For example, 0xbf27 is not + a valid GBK character, but 0xbf5c is. (0x27 = ', 0x5c = \) + */ + if (use_mb_flag && (l= my_mbcharlen(charset_info, *from)) > 1) + { + *to++= '\\'; + *to++= *from; + continue; + } #endif switch (*from) { case 0: /* Must be escaped for 'mysql' */ @@ -3300,6 +3317,23 @@ mysql_odbc_escape_string(MYSQL *mysql, from--; continue; } + /* + If the next character appears to begin a multi-byte character, we + escape that first byte of that apparent multi-byte character. (The + character just looks like a multi-byte character -- if it were actually + a multi-byte character, it would have been passed through in the test + above.) + + Without this check, we can create a problem by converting an invalid + multi-byte character into a valid one. For example, 0xbf27 is not + a valid GBK character, but 0xbf5c is. (0x27 = ', 0x5c = \) + */ + if (use_mb_flag && (l= my_mbcharlen(mysql->charset, *from)) > 1) + { + *to++= '\\'; + *to++= *from; + continue; + } } #endif switch (*from) { From 6cc34bf22209c13fc7d63f841c49d4a5891d2052 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 15:14:34 +0000 Subject: [PATCH 32/44] Fix for bug#10261: INFORMATION_SCHEMA.COLUMNS, incomplete result for non root user I_S table columns information is available for any user mysql-test/r/information_schema.result: Fix for bug#10261: INFORMATION_SCHEMA.COLUMNS, incomplete result for non root user mysql-test/t/information_schema.test: Fix for bug#10261: INFORMATION_SCHEMA.COLUMNS, incomplete result for non root user sql/sql_show.cc: Fix for bug#10261: INFORMATION_SCHEMA.COLUMNS, incomplete result for non root user --- mysql-test/r/information_schema.result | 14 ++++++++++++++ mysql-test/t/information_schema.test | 13 +++++++++++++ sql/sql_show.cc | 10 ++++++++-- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 0aa5e759207..6c8e7a9cf8b 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -734,3 +734,17 @@ x_real NULL NULL x_float NULL NULL x_double_precision NULL NULL drop table t1; +create user mysqltest_4@localhost; +SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS +where COLUMN_NAME='TABLE_NAME'; +TABLE_NAME COLUMN_NAME PRIVILEGES +TABLES TABLE_NAME select +COLUMNS TABLE_NAME select +STATISTICS TABLE_NAME select +VIEWS TABLE_NAME select +TABLE_PRIVILEGES TABLE_NAME select +COLUMN_PRIVILEGES TABLE_NAME select +TABLE_CONSTRAINTS TABLE_NAME select +KEY_COLUMN_USAGE TABLE_NAME select +delete from mysql.user where user='mysqltest_4'; +flush privileges; diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 1739604372a..3e322ad2f5b 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -473,3 +473,16 @@ SELECT COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME= 't1'; drop table t1; + +# +# Bug#10261 INFORMATION_SCHEMA.COLUMNS, incomplete result for non root user +# + +create user mysqltest_4@localhost; +connect (user4,localhost,mysqltest_4,,); +connection user4; +SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS +where COLUMN_NAME='TABLE_NAME'; +connection default; +delete from mysql.user where user='mysqltest_4'; +flush privileges; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index ceb98740298..a90756e38db 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2306,7 +2306,8 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, col_access= get_column_grant(thd, &tables->grant, base_name, file_name, field->field_name) & COL_ACLS; - if (lex->orig_sql_command != SQLCOM_SHOW_FIELDS && !col_access) + if (lex->orig_sql_command != SQLCOM_SHOW_FIELDS && + !tables->schema_table && !col_access) continue; for (uint bitnr=0; col_access ; col_access>>=1,bitnr++) { @@ -2319,7 +2320,12 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, #else *end= 0; #endif - table->field[17]->store(tmp+1,end == tmp ? 0 : (uint) (end-tmp-1), cs); + if (tables->schema_table) // any user has 'select' privilege on all + // I_S table columns + table->field[17]->store(grant_types.type_names[0], + strlen(grant_types.type_names[0]), cs); + else + table->field[17]->store(tmp+1,end == tmp ? 0 : (uint) (end-tmp-1), cs); table->field[1]->store(base_name, strlen(base_name), cs); table->field[2]->store(file_name, strlen(file_name), cs); From a1355f91bbbadde04db6ed8ca8e3298e2cd8f45b Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 20:25:59 +0500 Subject: [PATCH 33/44] Fix for embedded server to compile sql/sql_show.cc: operations with grant_tables should be #ifdef-ed --- sql/sql_show.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index a90756e38db..9e3f82f9fd6 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2317,9 +2317,6 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, end=strmov(end,grant_types.type_names[bitnr]); } } -#else - *end= 0; -#endif if (tables->schema_table) // any user has 'select' privilege on all // I_S table columns table->field[17]->store(grant_types.type_names[0], @@ -2327,6 +2324,9 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, else table->field[17]->store(tmp+1,end == tmp ? 0 : (uint) (end-tmp-1), cs); +#else + *end= 0; +#endif table->field[1]->store(base_name, strlen(base_name), cs); table->field[2]->store(file_name, strlen(file_name), cs); table->field[3]->store(field->field_name, strlen(field->field_name), From 3cd4b7a99b9b2a984cc3786c503aa5b5ea93d3bb Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 08:25:59 -0700 Subject: [PATCH 34/44] Fix tests after merge mysql-test/r/create.result: Update result mysql-test/r/type_ranges.result: Update result mysql-test/t/archive.test: Rewrite path for embedded server testing --- mysql-test/r/create.result | 2 +- mysql-test/r/type_ranges.result | 2 +- mysql-test/t/archive.test | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index fc7fee8f997..61de9c52765 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -429,7 +429,7 @@ explain t2; Field Type Null Key Default Extra a int(11) YES NULL b bigint(11) NO 0 -c bigint(10) NO 0 +c bigint(11) NO 0 d date YES NULL e varchar(1) NO f datetime YES NULL diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result index 3b07464c8f4..b30e41f00d3 100644 --- a/mysql-test/r/type_ranges.result +++ b/mysql-test/r/type_ranges.result @@ -270,7 +270,7 @@ drop table t2; create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, 'a' as t2, repeat('a',256) as t3, binary repeat('b',256) as t4, repeat('a',4096) as t5, binary repeat('b',4096) as t6, '' as t7, binary '' as t8 from t1; show full columns from t2; Field Type Collation Null Key Default Extra Privileges Comment -auto int(6) unsigned NULL NO PRI 0 # +auto bigint(12) unsigned NULL NO PRI 0 # t1 bigint(1) NULL NO 0 # t2 varchar(1) latin1_swedish_ci NO # t3 varchar(256) latin1_swedish_ci NO # diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test index 9d25524da5f..51334fa62bc 100644 --- a/mysql-test/t/archive.test +++ b/mysql-test/t/archive.test @@ -1296,6 +1296,8 @@ select fld1,fld3 from t2 where fld1 like "25050_"; create table t3 engine=archive select * from t2; select * from t3 where fld3='bonfire'; select count(*) from t3; +# Clean up path in error message +--replace_result $MYSQL_TEST_DIR . /var/master-data/ / rename table t3 to t4; select * from t4 where fld3='bonfire'; select count(*) from t4; From 81a895f72c75a9588d98d9dcf0082f8c0dc83a46 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 18:06:02 +0200 Subject: [PATCH 35/44] Corrections to test "sp", stored procedure "fib" (see entry 9937 in the bug DB). mysql-test/r/sp.result: Correct the result file for the changed test. mysql-test/t/sp.test: 1) Correct the "fib" stored procedure and its initial data to be mathematical correct: fib(0) = 0 2) Do a small run of "fib" first, that is not likely to hit a memory limit (see entry 9937 in the bug DB). BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + mysql-test/r/sp.result | 16 ++++++++++++---- mysql-test/t/sp.test | 18 +++++++++++++++--- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index c75f6010605..01726f15985 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -115,6 +115,7 @@ jcole@sarvik.tfr.cafe.ee jcole@tetra.spaceapes.com jimw@mysql.com joerg@mysql.com +joerg@trift-lap.fambruehe jon@gigan. jonas@mysql.com joreland@bk-internal.mysql.com diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 815683172f6..0cc16448625 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -1404,11 +1404,10 @@ show procedure status like '%p%'| Db Name Type Definer Modified Created Security_type Comment drop table if exists fib| create table fib ( f bigint unsigned not null )| -insert into fib values (1), (1)| drop procedure if exists fib| create procedure fib(n int unsigned) begin -if n > 0 then +if n > 1 then begin declare x, y bigint unsigned; declare c cursor for select f from fib order by f desc limit 2; @@ -1421,9 +1420,20 @@ call fib(n-1); end; end if; end| +insert into fib values (0), (1)| +call fib(3)| +select * from fib order by f asc| +f +0 +1 +1 +2 +delete from fib| +insert into fib values (0), (1)| call fib(20)| select * from fib order by f asc| f +0 1 1 2 @@ -1444,8 +1454,6 @@ f 2584 4181 6765 -10946 -17711 drop table fib| drop procedure fib| drop procedure if exists bar| diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 77fe5ab7601..b4066df1666 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -1634,8 +1634,6 @@ drop table if exists fib| --enable_warnings create table fib ( f bigint unsigned not null )| -insert into fib values (1), (1)| - # We deliberately do it the awkward way, fetching the last two # values from the table, in order to exercise various statements # and table accesses at each turn. @@ -1644,7 +1642,7 @@ drop procedure if exists fib| --enable_warnings create procedure fib(n int unsigned) begin - if n > 0 then + if n > 1 then begin declare x, y bigint unsigned; declare c cursor for select f from fib order by f desc limit 2; @@ -1659,6 +1657,20 @@ begin end if; end| +# Minimum test: recursion of 3 levels + +insert into fib values (0), (1)| + +call fib(3)| + +select * from fib order by f asc| + +delete from fib| + +# Original test: 20 levels (may run into memory limits!) + +insert into fib values (0), (1)| + call fib(20)| select * from fib order by f asc| From 8222d259aa02bb19e03f9cfa3b0914b1176c27f6 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 22:04:10 +0200 Subject: [PATCH 36/44] - Windows compile fix for ha_blackhole.cc - use #include "mysql_priv.h" instead of #include sql/ha_blackhole.cc: - Windows compile fix - use #include "mysql_priv.h" instead of #include --- sql/ha_blackhole.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/ha_blackhole.cc b/sql/ha_blackhole.cc index e34d5d723a4..7c6e7cb56b6 100644 --- a/sql/ha_blackhole.cc +++ b/sql/ha_blackhole.cc @@ -19,7 +19,7 @@ #pragma implementation // gcc: Class implementation #endif -#include +#include "mysql_priv.h" #ifdef HAVE_BLACKHOLE_DB #include "ha_blackhole.h" From 7aa73081df14ba172456289d7f2201587bc24792 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 22:04:52 +0200 Subject: [PATCH 37/44] bug#9813: Post review fixes --- ndb/src/ndbapi/Ndb.cpp | 11 ++++++----- sql/ha_ndbcluster.cc | 4 ++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ndb/src/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp index 9d520d5eac9..1ae1030e463 100644 --- a/ndb/src/ndbapi/Ndb.cpp +++ b/ndb/src/ndbapi/Ndb.cpp @@ -730,7 +730,7 @@ Ndb::getAutoIncrementValue(const char* aTableName, Uint32 cacheSize) DBUG_RETURN(~(Uint64)0); const NdbTableImpl *table= info->m_table_impl; Uint64 tupleId = getTupleIdFromNdb(table->m_tableId, cacheSize); - DBUG_PRINT("info", ("value %u", tupleId)); + DBUG_PRINT("info", ("value %ul", (ulong) tupleId)); DBUG_RETURN(tupleId); } @@ -742,7 +742,7 @@ Ndb::getAutoIncrementValue(const NdbDictionary::Table * aTable, Uint32 cacheSize DBUG_RETURN(~(Uint64)0); const NdbTableImpl* table = & NdbTableImpl::getImpl(*aTable); Uint64 tupleId = getTupleIdFromNdb(table->m_tableId, cacheSize); - DBUG_PRINT("info", ("value %u", tupleId)); + DBUG_PRINT("info", ("value %ul", (ulong) tupleId)); DBUG_RETURN(tupleId); } @@ -762,7 +762,8 @@ Ndb::getTupleIdFromNdb(Uint32 aTableId, Uint32 cacheSize) if ( theFirstTupleId[aTableId] != theLastTupleId[aTableId] ) { theFirstTupleId[aTableId]++; - DBUG_PRINT("info", ("next cached value %u", theFirstTupleId[aTableId])); + DBUG_PRINT("info", ("next cached value %ul", + (ulong) theFirstTupleId[aTableId])); DBUG_RETURN(theFirstTupleId[aTableId]); } else // theFirstTupleId == theLastTupleId @@ -783,7 +784,7 @@ Ndb::readAutoIncrementValue(const char* aTableName) DBUG_RETURN(~(Uint64)0); } Uint64 tupleId = readTupleIdFromNdb(table->m_tableId); - DBUG_PRINT("info", ("value %u", tupleId)); + DBUG_PRINT("info", ("value %ul", (ulong) tupleId)); DBUG_RETURN(tupleId); } @@ -795,7 +796,7 @@ Ndb::readAutoIncrementValue(const NdbDictionary::Table * aTable) DBUG_RETURN(~(Uint64)0); const NdbTableImpl* table = & NdbTableImpl::getImpl(*aTable); Uint64 tupleId = readTupleIdFromNdb(table->m_tableId); - DBUG_PRINT("info", ("value %u", tupleId)); + DBUG_PRINT("info", ("value %ul", (ulong) tupleId)); DBUG_RETURN(tupleId); } diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index a1166641f7d..53706b4a9ba 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -3003,8 +3003,10 @@ void ha_ndbcluster::start_bulk_insert(ha_rows rows) m_rows_inserted= (ha_rows) 0; if (rows == (ha_rows) 0) + { /* We don't know how many will be inserted, guess */ m_rows_to_insert= m_autoincrement_prefetch; + } else m_rows_to_insert= rows; @@ -4021,8 +4023,10 @@ longlong ha_ndbcluster::get_auto_increment() Ndb *ndb= get_ndb(); if (m_rows_inserted > m_rows_to_insert) + { /* We guessed too low */ m_rows_to_insert+= m_autoincrement_prefetch; + } int cache_size= (int) (m_rows_to_insert - m_rows_inserted < m_autoincrement_prefetch) ? From 0410766f3d91085601d5d520200acf39287cb878 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 22:41:30 +0200 Subject: [PATCH 38/44] Removed double cond_push --- sql/ha_ndbcluster.cc | 30 ++++++++++++++++-------------- sql/sql_select.cc | 13 ++++--------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index b61dbd1792c..4f947adfd07 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -6101,24 +6101,26 @@ const COND* ha_ndbcluster::cond_push(const COND *cond) { - Ndb_cond_stack *ndb_cond = new Ndb_cond_stack(); DBUG_ENTER("cond_push"); - DBUG_EXECUTE("where",print_where((COND *)cond, m_tabname);); - if (m_cond_stack) + if (cond) + { + Ndb_cond_stack *ndb_cond = new Ndb_cond_stack(); + DBUG_EXECUTE("where",print_where((COND *)cond, m_tabname);); + if (m_cond_stack) ndb_cond->next= m_cond_stack; - else - ndb_cond->next= NULL; - m_cond_stack= ndb_cond; - - if (serialize_cond(cond, ndb_cond)) - { + else + ndb_cond->next= NULL; + m_cond_stack= ndb_cond; + + if (serialize_cond(cond, ndb_cond)) + { DBUG_RETURN(NULL); + } + else + { + cond_pop(); + } } - else - { - cond_pop(); - } - DBUG_RETURN(cond); } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 32624bb3305..e7d33aff124 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -5403,10 +5403,12 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) tab->select_cond=sel->cond=tmp; if (thd->variables.engine_condition_pushdown) { + COND *push_cond= + make_cond_for_table(cond,current_map,current_map); tab->table->file->pushed_cond= NULL; /* Push condition to handler */ - if (!tab->table->file->cond_push(tmp)) - tab->table->file->pushed_cond= tmp; + if (!tab->table->file->cond_push(push_cond)) + tab->table->file->pushed_cond= push_cond; } } else @@ -5530,13 +5532,6 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) thd->memdup((gptr) sel, sizeof(SQL_SELECT)); tab->cache.select->cond=tmp; tab->cache.select->read_tables=join->const_table_map; - if (thd->variables.engine_condition_pushdown && - (!tab->table->file->pushed_cond)) - { - /* Push condition to handler */ - if (!tab->table->file->cond_push(tmp)) - tab->table->file->pushed_cond= tmp; - } } } } From 40eb77b72a67d5dceb9b074e8bc1a84135364661 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 8 May 2005 00:13:35 +0100 Subject: [PATCH 39/44] Bug#6925 Comment/*COMMENT*/is not a separator Ensure that whitespace is inserted after C-style comment if required. client/mysql.cc: Ensure that whitespace is inserted after C-style comment if required. --- client/mysql.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/mysql.cc b/client/mysql.cc index c3a3b3df6d4..e0ed85f2651 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1100,6 +1100,7 @@ static bool add_line(String &buffer,char *line,char *in_string, uchar inchar; char buff[80], *pos, *out; COMMANDS *com; + bool need_space= 0; if (!line[0] && buffer.is_empty()) return 0; @@ -1208,6 +1209,7 @@ static bool add_line(String &buffer,char *line,char *in_string, { pos++; *ml_comment= 0; + need_space= 1; } else { // Add found char to buffer @@ -1217,7 +1219,14 @@ static bool add_line(String &buffer,char *line,char *in_string, (inchar == '\'' || inchar == '"' || inchar == '`')) *in_string= (char) inchar; if (!*ml_comment) + { + if (need_space && !my_isspace(charset_info, (char)inchar)) + { + *out++= ' '; + need_space= 0; + } *out++= (char) inchar; + } } } if (out != line || !buffer.is_empty()) From 5d5931ba2c62099f1db394d8879aab3778810edb Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 8 May 2005 10:24:04 +0200 Subject: [PATCH 40/44] Added export symbols for workaround of bugs #8317,#9637 in PHP5 --- libmysql/libmysql.def | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libmysql/libmysql.def b/libmysql/libmysql.def index 5d88497e561..414ac4afd85 100644 --- a/libmysql/libmysql.def +++ b/libmysql/libmysql.def @@ -149,3 +149,6 @@ EXPORTS mysql_server_init mysql_server_end get_defaults_files + get_charset_by_csname + get_charsets_dir + charsets_dir From 1a4fd96bd576601bfea09a61a98ee45fee417513 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 8 May 2005 19:14:28 +0200 Subject: [PATCH 41/44] errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/czech/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/danish/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/dutch/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/english/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/estonian/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/french/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/german/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/greek/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/hungarian/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/italian/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/japanese/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/japanese-sjis/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/korean/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/norwegian/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/norwegian-ny/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/polish/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/portuguese/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/romanian/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/russian/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/serbian/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/slovak/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/spanish/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/swedish/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/ukrainian/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + 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-sjis/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 + 25 files changed, 25 insertions(+) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index ac7413062d6..2143d0f2492 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -162,6 +162,7 @@ mwagner@cash.mwagner.org mwagner@evoq.mwagner.org mwagner@here.mwagner.org mwagner@mysql.com +mwagner@ultrafly.mysql.com mwagner@work.mysql.com mydev@mysql.com mysql@home.(none) diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index 022a624c921..04f8fcc8dd4 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -331,3 +331,4 @@ character-set=latin2 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index 18ebe5712f8..384625f7112 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -322,3 +322,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index 54377b5949a..3f320dca750 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -331,3 +331,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 1ae4e79bf01..763c984866b 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -319,3 +319,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 5aab524e0d9..b7557a37670 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -324,3 +324,4 @@ character-set=latin7 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index bb2bd29171a..6f10a468e26 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -319,3 +319,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index 03e838dd805..c3d00ae06b4 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -332,3 +332,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index 87168431595..979091a566c 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -319,3 +319,4 @@ character-set=greek "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index af10c33ee2d..5d32c5b9cc2 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -324,3 +324,4 @@ character-set=latin2 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index cd66f15db5f..556b90511b0 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -319,3 +319,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/japanese-sjis/errmsg.txt b/sql/share/japanese-sjis/errmsg.txt index a06723727b7..1aa9ef74d5f 100644 --- a/sql/share/japanese-sjis/errmsg.txt +++ b/sql/share/japanese-sjis/errmsg.txt @@ -323,3 +323,4 @@ character-set=sjis "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index eaab58d8403..47adbf74b86 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -323,3 +323,4 @@ character-set=ujis "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 1cff50432e9..aeafef9d159 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -319,3 +319,4 @@ character-set=euckr "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index 27f7a18f029..3f60876348f 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -321,3 +321,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index 772f30e5d94..badeed1c0dd 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -321,3 +321,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 634a4d93f42..664a8e8e539 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -324,3 +324,4 @@ character-set=latin2 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 65d80918072..453c9dd5c18 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -321,3 +321,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 01c22f00119..0fcc2804326 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -324,3 +324,4 @@ character-set=latin2 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index 97d59cec074..1913fd3f1c1 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -324,3 +324,4 @@ character-set=koi8r "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index 06270f621e4..accf1926abb 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -312,3 +312,4 @@ character-set=cp1250 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 12c3eb2b6af..fafab0c2716 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -327,3 +327,4 @@ character-set=latin2 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index c5b4fd34eca..3af8e7b97d1 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -323,3 +323,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index ca863df7939..b552df08bf3 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -319,3 +319,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index b3859fb881c..9914846b1f8 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -325,3 +325,4 @@ character-set=koi8u "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + From 8b31c677a2d1bbfe7da7c53e2aad0ca0d8ef4220 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 8 May 2005 22:16:24 +0200 Subject: [PATCH 42/44] Fixes to compile with icc --- ndb/src/cw/cpcd/Process.cpp | 5 ++++- ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ndb/src/cw/cpcd/Process.cpp b/ndb/src/cw/cpcd/Process.cpp index 2509f34e882..b0ebbadb017 100644 --- a/ndb/src/cw/cpcd/Process.cpp +++ b/ndb/src/cw/cpcd/Process.cpp @@ -220,8 +220,11 @@ set_ulimit(const BaseString & pair){ if(!(list[1].trim() == "unlimited")){ value = atoi(list[1].c_str()); } - +#if defined(__INTEL_COMPILER) + struct rlimit64 rlp; +#else struct rlimit rlp; +#endif #define _RLIMIT_FIX(x) { res = getrlimit(x,&rlp); if(!res){ rlp.rlim_cur = value; res = setrlimit(x, &rlp); }} if(list[0].trim() == "c"){ diff --git a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp index f76440a462a..b3fc6e04d6c 100644 --- a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp +++ b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp @@ -799,7 +799,11 @@ AsyncFile::rmrfReq(Request * request, char * path, bool removePath){ request->error = errno; return; } +#if defined(__INTEL_COMPILER) + struct dirent64 * dp; +#else struct dirent * dp; +#endif while ((dp = readdir(dirp)) != NULL){ if ((strcmp(".", dp->d_name) != 0) && (strcmp("..", dp->d_name) != 0)) { BaseString::snprintf(path_add, (size_t)path_max_copy, "%s%s", From facce9257b40b0cb1290a97f8b3c56e4fa521399 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 8 May 2005 22:42:40 +0200 Subject: [PATCH 43/44] Removed call to cond_push for empty cond --- sql/ha_ndbcluster.cc | 29 +++++++++++++---------------- sql/sql_select.cc | 9 ++++++--- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index e175b2b95f9..372a178b59a 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -6106,24 +6106,21 @@ COND* ha_ndbcluster::cond_push(const COND *cond) { DBUG_ENTER("cond_push"); - if (cond) - { - Ndb_cond_stack *ndb_cond = new Ndb_cond_stack(); - DBUG_EXECUTE("where",print_where((COND *)cond, m_tabname);); - if (m_cond_stack) + Ndb_cond_stack *ndb_cond = new Ndb_cond_stack(); + DBUG_EXECUTE("where",print_where((COND *)cond, m_tabname);); + if (m_cond_stack) ndb_cond->next= m_cond_stack; - else - ndb_cond->next= NULL; - m_cond_stack= ndb_cond; - - if (serialize_cond(cond, ndb_cond)) - { + else + ndb_cond->next= NULL; + m_cond_stack= ndb_cond; + + if (serialize_cond(cond, ndb_cond)) + { DBUG_RETURN(NULL); - } - else - { - cond_pop(); - } + } + else + { + cond_pop(); } DBUG_RETURN(cond); } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 1503639669e..47c7de6eba7 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -5406,9 +5406,12 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) COND *push_cond= make_cond_for_table(cond,current_map,current_map); tab->table->file->pushed_cond= NULL; - /* Push condition to handler */ - if (!tab->table->file->cond_push(push_cond)) - tab->table->file->pushed_cond= push_cond; + if (push_cond) + { + /* Push condition to handler */ + if (!tab->table->file->cond_push(push_cond)) + tab->table->file->pushed_cond= push_cond; + } } } else From 67312e3d5c9eee997e31ed55d5a1554ebf546667 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 8 May 2005 23:02:50 +0200 Subject: [PATCH 44/44] make_binary_distribution.sh: - Remove vendor tag from package names. - Map standard OS names to user-friendly versions. scripts/make_binary_distribution.sh: - Remove vendor tag from package names. - Map standard OS names to user-friendly versions. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + scripts/make_binary_distribution.sh | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 01726f15985..311403f93e6 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -181,6 +181,7 @@ mwagner@cash.mwagner.org mwagner@evoq.mwagner.org mwagner@here.mwagner.org mwagner@mysql.com +mwagner@ultrafly.mysql.com mwagner@work.mysql.com mydev@mysql.com mysql@home.(none) diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 17a9be17108..6c0487aee40 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -294,6 +294,22 @@ if [ x$NDBCLUSTER = x1 ]; then rm -rf $BASE/ndb-stage fi +# Remove vendor from $system +system=`echo $system | sed -e 's/[a-z]*-\(.*\)/\1/g'` + +# Map OS names to "our" OS names (eg. darwin6.8 -> osx10.2) +system=`echo $system | sed -e 's/darwin6.*/osx10.2/g'` +system=`echo $system | sed -e 's/darwin7.*/osx10.3/g'` +system=`echo $system | sed -e 's/darwin8.*/osx10.4/g'` +system=`echo $system | sed -e 's/\(aix4.3\).*/\1/g'` +system=`echo $system | sed -e 's/\(aix5.1\).*/\1/g'` +system=`echo $system | sed -e 's/\(aix5.2\).*/\1/g'` +system=`echo $system | sed -e 's/\(aix5.3\).*/\1/g'` +system=`echo $system | sed -e 's/osf5.1b/tru64/g'` +system=`echo $system | sed -e 's/linux-gnu/linux/g'` +system=`echo $system | sed -e 's/solaris2.\([0-9]*\)/solaris\1/g'` +system=`echo $system | sed -e 's/sco3.2v\(.*\)/openserver\1/g'` + # Change the distribution to a long descriptive name NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version-$system-$machine$SUFFIX BASE2=$TMP/$NEW_NAME