From 7b97a7a41aaed30aff2a85c8ebe7b87e53d3105b Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 8 Nov 2002 21:32:18 +0200 Subject: [PATCH 001/220] fixed possible bug (call with incorrect parameters) sql/sql_select.cc: fixed possible bug --- sql/sql_select.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index b9162daadaa..f59eaab0408 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -7268,7 +7268,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, item_list.push_back(new Item_string(message,strlen(message), default_charset_info)); if (result->send_data(item_list)) - result->send_error(0,NullS); + join->error= 1; } else { @@ -7431,7 +7431,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, // For next iteration used_tables|=table->map; if (result->send_data(item_list)) - result->send_error(0,NullS); + join->error= 1; } } for (SELECT_LEX_UNIT *unit= join->select_lex->first_inner_unit(); From 4536b069238b0aa862bc3aa497b750c945eef736 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 27 Nov 2002 22:57:17 +0100 Subject: [PATCH 002/220] - Moved the init script from /etc/rc.d/init.d to /etc/init.d for better compatibility of the RPMs - added "restart" action to the mysql.server init script support-files/mysql.server.sh: - added "restart" action support-files/mysql.spec.sh: - moved init script from /etc/rc.d/init.d to /etc/init.d (the majority of Linux distributions now support this scheme as proposed by the LSB either directly or via a compatibility symlink) - relaxed the Perl requirements a bit - Use new "restart" init script action instead of starting and stopping separately - Be more flexible in activating the automatic bootup - use insserv (on older SuSE versions) or chkconfig (Red Hat, newer SuSE versions and others) to create the respective symlinks --- support-files/mysql.server.sh | 9 ++++- support-files/mysql.spec.sh | 63 ++++++++++++++++++++++++++--------- 2 files changed, 55 insertions(+), 17 deletions(-) diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh index 822e864dd77..a6468997b0f 100644 --- a/support-files/mysql.server.sh +++ b/support-files/mysql.server.sh @@ -173,9 +173,16 @@ case "$mode" in fi ;; + 'restart') + # Stop the service and regardless of whether it was + # running or not, start it again. + $0 stop + $0 start + ;; + *) # usage - echo "usage: $0 start|stop" + echo "Usage: $0 start|stop|restart" exit 1 ;; esac diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index dcff17dee03..978e04e3268 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -71,7 +71,7 @@ Este pacote cont %package bench Release: %{release} -Requires: %{name}-client MySQL-DBI-perl-bin perl +Requires: %{name}-client perl-DBI perl Summary: MySQL - Benchmarks and test system Group: Applications/Databases Summary(pt_BR): MySQL - Medições de desempenho @@ -269,7 +269,7 @@ RBR=$RPM_BUILD_ROOT MBD=$RPM_BUILD_DIR/mysql-%{mysql_version} # Ensure that needed directories exists -install -d $RBR/etc/{logrotate.d,rc.d/init.d} +install -d $RBR/etc/{logrotate.d,init.d} install -d $RBR/var/lib/mysql/mysql install -d $RBR/usr/share/{sql-bench,mysql-test} install -d $RBR%{_mandir} @@ -290,14 +290,20 @@ install -m644 $MBD/sql/mysqld.sym $RBR/usr/lib/mysql/mysqld.sym # Install logrotate and autostart install -m644 $MBD/support-files/mysql-log-rotate $RBR/etc/logrotate.d/mysql -install -m755 $MBD/support-files/mysql.server $RBR/etc/rc.d/init.d/mysql +install -m755 $MBD/support-files/mysql.server $RBR/etc/init.d/mysql # Create symbolic compatibility link safe_mysqld -> mysqld_safe # (safe_mysqld will be gone in MySQL 4.1) ln -sf ./mysqld_safe $RBR/usr/bin/safe_mysqld %pre -if test -x /etc/rc.d/init.d/mysql +# Shut down a previously installed server first +if test -x /etc/init.d/mysql +then + /etc/init.d/mysql stop > /dev/null 2>&1 + echo "Giving mysqld a couple of seconds to exit nicely" + sleep 5 +elif test -x /etc/rc.d/init.d/mysql then /etc/rc.d/init.d/mysql stop > /dev/null 2>&1 echo "Giving mysqld a couple of seconds to exit nicely" @@ -313,7 +319,15 @@ if test ! -d $mysql_datadir/mysql; then mkdir $mysql_datadir/mysql; fi if test ! -d $mysql_datadir/test; then mkdir $mysql_datadir/test; fi # Make MySQL start/shutdown automatically when the machine does it. -/sbin/chkconfig --add mysql +# use insserv for older SuSE Linux versions +if test -x /sbin/insserv +then + /sbin/insserv /etc/init.d/mysql +# use chkconfig on Red Hat and newer SuSE releases +elif test -x /sbin/chkconfig +then + /sbin/chkconfig --add mysql +fi # Create a MySQL user. Do not report any problems if it already # exists. This is redhat specific and should be handled more portable @@ -334,31 +348,37 @@ chown -R mysql $mysql_datadir chmod -R og-rw $mysql_datadir/mysql # Restart in the same way that mysqld will be started normally. -/etc/rc.d/init.d/mysql start +/etc/init.d/mysql start # Allow safe_mysqld to start mysqld and print a message before we exit sleep 2 %post Max # Restart mysqld, to use the new binary. -# There may be a better way to handle this. -/etc/rc.d/init.d/mysql stop > /dev/null 2>&1 -echo "Giving mysqld a couple of seconds to restart" -sleep 5 -/etc/rc.d/init.d/mysql start -sleep 2 +echo "Restarting mysqld." +/etc/init.d/mysql restart > /dev/null 2>&1 %preun if test $1 = 0 then - if test -x /etc/rc.d/init.d/mysql + # Stop MySQL before uninstalling it + if test -x /etc/init.d/mysql then - /etc/rc.d/init.d/mysql stop > /dev/null + /etc/init.d/mysql stop > /dev/null fi # Remove autostart of mysql - /sbin/chkconfig --del mysql + # for older SuSE Linux versions + if test -x /sbin/insserv + then + /sbin/insserv -r /etc/init.d/mysql + # use chkconfig on Red Hat and newer SuSE releases + elif test -x /sbin/chkconfig + then + /sbin/chkconfig --del mysql + fi fi + # We do not remove the mysql user since it may still own a lot of # database files. @@ -412,7 +432,7 @@ fi %attr(644, root, root) /usr/lib/mysql/mysqld.sym %attr(644, root, root) /etc/logrotate.d/mysql -%attr(755, root, root) /etc/rc.d/init.d/mysql +%attr(755, root, root) /etc/init.d/mysql %attr(755, root, root) /usr/share/mysql/ @@ -482,6 +502,17 @@ fi %changelog +* Wed Nov 27 2002 Lenz Grimmer + +- moved init script from /etc/rc.d/init.d to /etc/init.d (the majority of + Linux distributions now support this scheme as proposed by the LSB either + directly or via a compatibility symlink) +- Use new "restart" init script action instead of starting and stopping + separately +- Be more flexible in activating the automatic bootup - use insserv (on + older SuSE versions) or chkconfig (Red Hat, newer SuSE versions and + others) to create the respective symlinks + * Wed Sep 25 2002 Lenz Grimmer - MySQL-Max now requires MySQL >= 4.0 to avoid version mismatches From cf85a16cf48e20a319e2b26cdd7dc41ea0972528 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 5 Dec 2002 01:01:38 +0100 Subject: [PATCH 003/220] better fix for read_rows, same for read_one_row --- libmysql/libmysql.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 3c1353e0088..9db1e1c9ab9 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -939,7 +939,7 @@ static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, else { cur->data[field] = to; - if (to+len > end_to) + if (len > end_to - to) { free_rows(result); net->last_errno=CR_UNKNOWN_ERROR; @@ -980,7 +980,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) { uint field; ulong pkt_len,len; - uchar *pos,*prev_pos; + uchar *pos,*prev_pos, *end_pos; if ((pkt_len=(uint) net_safe_read(mysql)) == packet_error) return -1; @@ -988,6 +988,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) return 1; /* End of data */ prev_pos= 0; /* allowed to write at packet[-1] */ pos=mysql->net.read_pos; + end_pos=pos+pkt_len; for (field=0 ; field < fields ; field++) { if ((len=(ulong) net_field_length(&pos)) == NULL_LENGTH) @@ -997,6 +998,12 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) } else { + if (len > end_pos - pos) + { + mysql->net.last_errno=CR_UNKNOWN_ERROR; + strmov(mysql->net.last_error,ER(mysql->net.last_errno)); + return -1; + } row[field] = (char*) pos; pos+=len; *lengths++=len; From 446f877906f7cb7f1a4a65b185ca49d58f832121 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 5 Dec 2002 22:03:24 +0200 Subject: [PATCH 004/220] row0mysql.c, dict0dict.c, db0err.h, ha_innobase.cc: Heikki will merge to 4.0: Prevent listing the same column twice in an InnoDB index: that will cause index corruption when that col is UPDATEd sql/ha_innobase.cc: Heikki will merge to 4.0: Prevent listing the same column twice in an InnoDB index: that will cause index corruption when that col is UPDATEd innobase/include/db0err.h: Heikki will merge to 4.0: Prevent listing the same column twice in an InnoDB index: that will cause index corruption when that col is UPDATEd innobase/dict/dict0dict.c: Heikki will merge to 4.0: Prevent listing the same column twice in an InnoDB index: that will cause index corruption when that col is UPDATEd innobase/row/row0mysql.c: Heikki will merge to 4.0: Prevent listing the same column twice in an InnoDB index: that will cause index corruption when that col is UPDATEd --- innobase/dict/dict0dict.c | 21 ++++++++++++++++++++ innobase/include/db0err.h | 2 ++ innobase/row/row0mysql.c | 40 ++++++++++++++++++++++++++++++++------- sql/ha_innobase.cc | 6 +++++- 4 files changed, 61 insertions(+), 8 deletions(-) diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c index 65f40d345d8..eb9610a6e73 100644 --- a/innobase/dict/dict0dict.c +++ b/innobase/dict/dict0dict.c @@ -1033,6 +1033,7 @@ dict_index_add_to_cache( ulint n_ord; ibool success; ulint i; + ulint j; ut_ad(index); ut_ad(mutex_own(&(dict_sys->mutex))); @@ -1063,6 +1064,26 @@ dict_index_add_to_cache( return(FALSE); } + /* Check that the same column does not appear twice in the index. + InnoDB assumes this in its algorithms, e.g., update of an index + entry */ + + for (i = 0; i < dict_index_get_n_fields(index); i++) { + + for (j = 0; j < i; j++) { + if (dict_index_get_nth_field(index, j)->col + == dict_index_get_nth_field(index, i)->col) { + + fprintf(stderr, +"InnoDB: Error: column %s appears twice in index %s of table %s\n" +"InnoDB: This is not allowed in InnoDB.\n" +"InnoDB: UPDATE can cause such an index to become corrupt in InnoDB.\n", + dict_index_get_nth_field(index, i)->col->name, + index->name, table->name); + } + } + } + /* Build the cache internal representation of the index, containing also the added system fields */ diff --git a/innobase/include/db0err.h b/innobase/include/db0err.h index ddfbd5b7862..df74b06dfc0 100644 --- a/innobase/include/db0err.h +++ b/innobase/include/db0err.h @@ -42,6 +42,8 @@ Created 5/24/1996 Heikki Tuuri #define DB_CANNOT_ADD_CONSTRAINT 38 /* adding a foreign key constraint to a table failed */ +#define DB_COL_APPEARS_TWICE_IN_INDEX 40 + /* The following are partial failure codes */ #define DB_FAIL 1000 #define DB_OVERFLOW 1001 diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index 705ded785fc..325e931b455 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -1393,7 +1393,7 @@ int row_create_index_for_mysql( /*=======================*/ /* out: error number or DB_SUCCESS */ - dict_index_t* index, /* in: index defintion */ + dict_index_t* index, /* in: index definition */ trx_t* trx) /* in: transaction handle */ { ind_node_t* node; @@ -1402,11 +1402,14 @@ row_create_index_for_mysql( ulint namelen; ulint keywordlen; ulint err; + ulint i; + ulint j; + ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX)); ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(trx->mysql_thread_id == os_thread_get_curr_id()); - trx->op_info = "creating index"; + trx->op_info = (char *) "creating index"; trx_start_if_not_started(trx); @@ -1422,6 +1425,29 @@ row_create_index_for_mysql( return(DB_SUCCESS); } + /* Check that the same column does not appear twice in the index. + InnoDB assumes this in its algorithms, e.g., update of an index + entry */ + + for (i = 0; i < dict_index_get_n_fields(index); i++) { + for (j = 0; j < i; j++) { + if (0 == ut_strcmp( + dict_index_get_nth_field(index, j)->name, + dict_index_get_nth_field(index, i)->name)) { + + fprintf(stderr, +"InnoDB: Error: column %s appears twice in index %s\n" +"InnoDB: This is not allowed in InnoDB.\n", + dict_index_get_nth_field(index, i)->name, + index->name); + + err = DB_COL_APPEARS_TWICE_IN_INDEX; + + goto error_handling; + } + } + } + heap = mem_heap_create(512); trx->dict_operation = TRUE; @@ -1434,11 +1460,13 @@ row_create_index_for_mysql( SESS_COMM_EXECUTE, 0)); que_run_threads(thr); - err = trx->error_state; + err = trx->error_state; + que_graph_free((que_t*) que_node_get_parent(thr)); + +error_handling: if (err != DB_SUCCESS) { /* We have special error handling here */ - ut_a(err == DB_OUT_OF_FILE_SPACE); trx->error_state = DB_SUCCESS; @@ -1448,10 +1476,8 @@ row_create_index_for_mysql( trx->error_state = DB_SUCCESS; } - - que_graph_free((que_t*) que_node_get_parent(thr)); - trx->op_info = ""; + trx->op_info = (char *) ""; return((int) err); } diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index 2f79f8d6ba9..489c2fafd9b 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -233,10 +233,14 @@ convert_error_code_to_mysql( return(HA_ERR_ROW_IS_REFERENCED); - } else if (error == (int) DB_CANNOT_ADD_CONSTRAINT) { + } else if (error == (int) DB_CANNOT_ADD_CONSTRAINT) { return(HA_ERR_CANNOT_ADD_FOREIGN); + } else if (error == (int) DB_COL_APPEARS_TWICE_IN_INDEX) { + + return(HA_ERR_WRONG_TABLE_DEF); + } else if (error == (int) DB_OUT_OF_FILE_SPACE) { return(HA_ERR_RECORD_FILE_FULL); From c92d611d5447407820ebf3914a71b3a8ab265774 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 5 Dec 2002 22:09:51 +0200 Subject: [PATCH 005/220] row0mysql.c: Heikki will merge to 4.0: cleanup innobase/row/row0mysql.c: Heikki will merge to 4.0: cleanup --- innobase/row/row0mysql.c | 1 - 1 file changed, 1 deletion(-) diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index 325e931b455..f0aa413a64c 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -1405,7 +1405,6 @@ row_create_index_for_mysql( ulint i; ulint j; - ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX)); ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(trx->mysql_thread_id == os_thread_get_curr_id()); From a29ee10048e9bbe0f5251a36981b274ab72b8a25 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 5 Dec 2002 21:38:27 +0100 Subject: [PATCH 006/220] current_user() to return priv_user --- sql/item.h | 4 +++- sql/item_create.cc | 11 ++++++++++- sql/item_create.h | 1 + sql/lex.h | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/sql/item.h b/sql/item.h index ad68287a92c..05b906a66a6 100644 --- a/sql/item.h +++ b/sql/item.h @@ -267,6 +267,8 @@ public: } Item_string(const char *name_par,const char *str,uint length) { + if (!length) + length=strlen(str); str_value.set(str,length); max_length=length; name=(char*) name_par; @@ -286,7 +288,7 @@ public: String *const_string() { return &str_value; } inline void append(char *str,uint length) { str_value.append(str,length); } void print(String *str); - unsigned int size_of() { return sizeof(*this);} + unsigned int size_of() { return sizeof(*this);} }; diff --git a/sql/item_create.cc b/sql/item_create.cc index c5f53f0d040..1f0bad8eda3 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -291,6 +291,15 @@ Item *create_func_pow(Item* a, Item *b) return new Item_func_pow(a,b); } +Item *create_func_current_user() +{ + THD *thd=current_thd; + Item_string *res=new Item_string("CURRENT_USER()", thd->priv_user, 0); + res->append("@", 1); + res->append((char *)thd->host_or_ip, 0); + return res; +} + Item *create_func_quarter(Item* a) { return new Item_func_quarter(a); @@ -394,7 +403,7 @@ Item *create_func_ucase(Item* a) Item *create_func_version(void) { - return new Item_string(NullS,server_version, (uint) strlen(server_version)); + return new Item_string("VERSION()",server_version, 0); } Item *create_func_weekday(Item* a) diff --git a/sql/item_create.h b/sql/item_create.h index 28fbd61df8f..80ef57e436a 100644 --- a/sql/item_create.h +++ b/sql/item_create.h @@ -68,6 +68,7 @@ Item *create_func_period_add(Item* a, Item *b); Item *create_func_period_diff(Item* a, Item *b); Item *create_func_pi(void); Item *create_func_pow(Item* a, Item *b); +Item *create_func_current_user(void); Item *create_func_quarter(Item* a); Item *create_func_radians(Item *a); Item *create_func_release_lock(Item* a); diff --git a/sql/lex.h b/sql/lex.h index 717e8a355ca..bf0abc323e1 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -398,7 +398,7 @@ static SYMBOL sql_functions[] = { { "CAST", SYM(CAST_SYM),0,0}, { "CEIL", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ceiling)}, { "CEILING", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ceiling)}, - { "CURRENT_USER", SYM(USER),0,0}, + { "CURRENT_USER", SYM(FUNC_ARG0),0,CREATE_FUNC(create_func_current_user)}, { "BIT_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_bit_length)}, { "CHAR_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_char_length)}, { "CHARACTER_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_char_length)}, From 7cc9c3c6bf6d39ba057d6573a2d95fc7d987cc8e Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 Dec 2002 22:49:16 +0200 Subject: [PATCH 007/220] Don't initialize fulltext functions twice in multi-table-update mysql-test/mysql-test-run.sh: Added option --extern (from 4.1) mysql-test/r/multi_update.result: Portability fix mysql-test/t/multi_update.test: Portability fix --- mysql-test/mysql-test-run.sh | 1 + mysql-test/r/multi_update.result | 14 +++++++------- mysql-test/t/multi_update.test | 4 ++-- sql/sql_update.cc | 1 - 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 928beaf0aa4..5c80e7d538a 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -217,6 +217,7 @@ while test $# -gt 0; do --slave-binary=*) SLAVE_MYSQLD=`$ECHO "$1" | $SED -e "s;--slave-binary=;;"` ;; --local) USE_RUNNING_SERVER="" ;; + --extern) USE_RUNNING_SERVER="1" ;; --tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;; --local-master) MASTER_MYPORT=3306; diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index 7d1f5bd53f6..8cf035343b1 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -182,13 +182,13 @@ insert into t1 values(1,1,NULL); insert into t2 values(1,10,NULL),(2,20,NULL); set timestamp=1038000000; UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n; -select * from t1; -n d t -1 10 20021123002000 -select * from t2; -n d t -1 10 20021127154957 -2 20 20021127154957 +select n,d,unix_timestamp(t) from t1; +n d unix_timestamp(t) +1 10 1038000000 +select n,d,unix_timestamp(t) from t2; +n d unix_timestamp(t) +1 10 1038401397 +2 20 1038401397 UPDATE t1,t2 SET 1=2 WHERE t1.n=t2.n; You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '1=2 WHERE t1.n=t2.n' at line 1 drop table t1,t2; diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index b79b0749c82..ff456b710c1 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -183,8 +183,8 @@ insert into t1 values(1,1,NULL); insert into t2 values(1,10,NULL),(2,20,NULL); set timestamp=1038000000; UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n; -select * from t1; -select * from t2; +select n,d,unix_timestamp(t) from t1; +select n,d,unix_timestamp(t) from t2; --error 1064 UPDATE t1,t2 SET 1=2 WHERE t1.n=t2.n; drop table t1,t2; diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 4eab38bebad..2416a99faa8 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -517,7 +517,6 @@ int multi_update::prepare(List ¬_used_values) for (i=0 ; i < table_count ; i++) set_if_bigger(max_fields, fields_for_table[i]->elements); copy_field= new Copy_field[max_fields]; - init_ftfuncs(thd,1); DBUG_RETURN(thd->fatal_error != 0); } From 6271ea35b83501781cf3ee51a62fd95870b3fb96 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 Dec 2002 22:40:20 +0100 Subject: [PATCH 008/220] bulk insert code optimized mysql-test/r/distinct.result: updated mysql-test/r/fulltext.result: updated mysql-test/r/select.result: updated mysql-test/r/show_check.result: updated mysql-test/t/insert.test: updated --- include/my_base.h | 3 --- include/myisam.h | 4 +++ myisam/mi_extra.c | 27 ------------------- myisam/mi_write.c | 47 +++++++++++++++++++++++++++++----- myisam/myisamdef.h | 3 +-- mysql-test/r/distinct.result | 8 +++--- mysql-test/r/fulltext.result | 4 +-- mysql-test/r/select.result | 4 +-- mysql-test/r/show_check.result | 2 +- mysql-test/t/insert.test | 2 ++ sql/ha_myisam.cc | 18 ++++++------- sql/ha_myisammrg.cc | 4 +-- sql/sql_insert.cc | 20 +++++---------- 13 files changed, 73 insertions(+), 73 deletions(-) diff --git a/include/my_base.h b/include/my_base.h index 8ef8301b84d..bcb8c8d6a2f 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -106,9 +106,6 @@ enum ha_extra_function { HA_EXTRA_IGNORE_DUP_KEY, /* Dup keys don't rollback everything*/ HA_EXTRA_NO_IGNORE_DUP_KEY, HA_EXTRA_DONT_USE_CURSOR_TO_UPDATE, /* Cursor will not be used for update */ - HA_EXTRA_BULK_INSERT_BEGIN, - HA_EXTRA_BULK_INSERT_FLUSH, /* Flush one index */ - HA_EXTRA_BULK_INSERT_END, HA_EXTRA_PREPARE_FOR_DELETE, HA_EXTRA_PREPARE_FOR_UPDATE /* Remove read cache if problems */ }; diff --git a/include/myisam.h b/include/myisam.h index 79d18bf8736..94b5d23bba6 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -433,6 +433,10 @@ void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows); my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows, ulonglong key_map, my_bool force); +int mi_init_bulk_insert(MI_INFO *info, ulong cache_size, ha_rows rows); +void mi_flush_bulk_insert(MI_INFO *info, uint inx); +void mi_end_bulk_insert(MI_INFO *info); + #ifdef __cplusplus } #endif diff --git a/myisam/mi_extra.c b/myisam/mi_extra.c index d7a3aea516d..8429b22dad4 100644 --- a/myisam/mi_extra.c +++ b/myisam/mi_extra.c @@ -358,33 +358,6 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) case HA_EXTRA_QUICK: info->quick_mode=1; break; - case HA_EXTRA_BULK_INSERT_BEGIN: - error=_mi_init_bulk_insert(info, (extra_arg ? *(ulong*) extra_arg : - myisam_bulk_insert_tree_size)); - break; - case HA_EXTRA_BULK_INSERT_FLUSH: - if (info->bulk_insert) - { - uint index_to_flush= *(uint*) extra_arg; - if (is_tree_inited(&info->bulk_insert[index_to_flush])) - reset_tree(&info->bulk_insert[index_to_flush]); - } - break; - case HA_EXTRA_BULK_INSERT_END: - if (info->bulk_insert) - { - uint i; - for (i=0 ; i < share->base.keys ; i++) - { - if (is_tree_inited(& info->bulk_insert[i])) - { - delete_tree(& info->bulk_insert[i]); - } - } - my_free((void *)info->bulk_insert, MYF(0)); - info->bulk_insert=0; - } - break; case HA_EXTRA_NO_ROWS: if (!share->state.header.uniques) info->opt_flag|= OPT_NO_ROWS; diff --git a/myisam/mi_write.c b/myisam/mi_write.c index 70a1bea26bb..d39bbbf5fc7 100644 --- a/myisam/mi_write.c +++ b/myisam/mi_write.c @@ -801,26 +801,27 @@ static int keys_free(uchar *key, TREE_FREE mode, bulk_insert_param *param) } -int _mi_init_bulk_insert(MI_INFO *info, ulong cache_size) +int mi_init_bulk_insert(MI_INFO *info, ulong cache_size, ha_rows rows) { MYISAM_SHARE *share=info->s; MI_KEYDEF *key=share->keyinfo; bulk_insert_param *params; - uint i, num_keys; + uint i, num_keys, total_keylength; ulonglong key_map=0; DBUG_ENTER("_mi_init_bulk_insert"); DBUG_PRINT("enter",("cache_size: %lu", cache_size)); - if (info->bulk_insert) + if (info->bulk_insert || (rows && rows < MI_MIN_ROWS_TO_USE_BULK_INSERT)) DBUG_RETURN(0); - for (i=num_keys=0 ; i < share->base.keys ; i++) + for (i=total_keylength=num_keys=0 ; i < share->base.keys ; i++) { if (!(key[i].flag & HA_NOSAME) && share->base.auto_key != i+1 && test(share->state.key_map & ((ulonglong) 1 << i))) { num_keys++; key_map |=((ulonglong) 1 << i); + total_keylength+=key[i].maxlength+TREE_ELEMENT_EXTRA_SIZE; } } @@ -828,6 +829,11 @@ int _mi_init_bulk_insert(MI_INFO *info, ulong cache_size) num_keys * MI_MIN_SIZE_BULK_INSERT_TREE > cache_size) DBUG_RETURN(0); + if (rows && rows*total_keylength < cache_size) + cache_size=rows; + else + cache_size/=total_keylength*16; + info->bulk_insert=(TREE *) my_malloc((sizeof(TREE)*share->base.keys+ sizeof(bulk_insert_param)*num_keys),MYF(0)); @@ -836,7 +842,7 @@ int _mi_init_bulk_insert(MI_INFO *info, ulong cache_size) DBUG_RETURN(HA_ERR_OUT_OF_MEM); params=(bulk_insert_param *)(info->bulk_insert+share->base.keys); - for (i=0 ; i < share->base.keys ; i++,key++) + for (i=0 ; i < share->base.keys ; i++) { if (test(key_map & ((ulonglong) 1 << i))) { @@ -844,8 +850,8 @@ int _mi_init_bulk_insert(MI_INFO *info, ulong cache_size) params->keynr=i; /* Only allocate a 16'th of the buffer at a time */ init_tree(&info->bulk_insert[i], - cache_size / num_keys / 16 + 10, - cache_size / num_keys, 0, + cache_size * key[i].maxlength, + cache_size * key[i].maxlength, 0, (qsort_cmp2)keys_compare, 0, (tree_element_free) keys_free, (void *)params++); } @@ -855,3 +861,30 @@ int _mi_init_bulk_insert(MI_INFO *info, ulong cache_size) DBUG_RETURN(0); } + +void mi_flush_bulk_insert(MI_INFO *info, uint inx) +{ + if (info->bulk_insert) + { + if (is_tree_inited(&info->bulk_insert[inx])) + reset_tree(&info->bulk_insert[inx]); + } +} + +void mi_end_bulk_insert(MI_INFO *info) +{ + if (info->bulk_insert) + { + uint i; + for (i=0 ; i < info->s->base.keys ; i++) + { + if (is_tree_inited(& info->bulk_insert[i])) + { + delete_tree(& info->bulk_insert[i]); + } + } + my_free((void *)info->bulk_insert, MYF(0)); + info->bulk_insert=0; + } +} + diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h index f0d6f740661..07744e11e5f 100644 --- a/myisam/myisamdef.h +++ b/myisam/myisamdef.h @@ -373,6 +373,7 @@ struct st_myisam_info { #define MI_MIN_KEYBLOCK_LENGTH 50 /* When to split delete blocks */ #define MI_MIN_SIZE_BULK_INSERT_TREE 16384 /* this is per key */ +#define MI_MIN_ROWS_TO_USE_BULK_INSERT 100 /* The UNIQUE check is done with a hashed long key */ @@ -658,8 +659,6 @@ int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, File file_to_dup); int mi_open_keyfile(MYISAM_SHARE *share); void mi_setup_functions(register MYISAM_SHARE *share); -int _mi_init_bulk_insert(MI_INFO *info, ulong cache_size); - /* Functions needed by mi_check */ void mi_check_print_error _VARARGS((MI_CHECK *param, const char *fmt,...)); void mi_check_print_warning _VARARGS((MI_CHECK *param, const char *fmt,...)); diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index 020d6c6534f..919478c7265 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -173,9 +173,9 @@ INSERT INTO t2 values (1),(2),(3); INSERT INTO t3 VALUES (1,'1'),(2,'2'),(1,'1'),(2,'2'); explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a; table type possible_keys key key_len ref rows Extra -t3 index a a 5 NULL 6 Using index; Using temporary -t2 index a a 4 NULL 5 Using index; Distinct -t1 eq_ref PRIMARY PRIMARY 4 t2.a 1 Using where; Distinct +t1 ALL PRIMARY NULL NULL NULL 2 Using temporary +t2 ref a a 4 t1.a 1 Using index +t3 ref a a 5 t1.b 1 Using where; Using index SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a; a 1 @@ -190,7 +190,7 @@ insert into t3 select * from t4; explain select distinct t1.a from t1,t3 where t1.a=t3.a; table type possible_keys key key_len ref rows Extra t1 index PRIMARY PRIMARY 4 NULL 2 Using index; Using temporary -t3 ref a a 5 t1.a 10 Using where; Using index; Distinct +t3 ref a a 5 t1.a 1 Using where; Using index; Distinct select distinct t1.a from t1,t3 where t1.a=t3.a; a 1 diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index edf109fcc93..fc1e0788087 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -135,8 +135,8 @@ id 3 show keys from t2; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t2 1 tig 1 ticket A NULL NULL NULL YES BTREE -t2 1 tix 1 inhalt A NULL 1 NULL YES FULLTEXT +t2 1 tig 1 ticket A 3 NULL NULL YES BTREE +t2 1 tix 1 inhalt A 1 1 NULL YES FULLTEXT show create table t2; Table Create Table t2 CREATE TABLE `t2` ( diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index a921d75f20a..51cd67ac832 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -3239,8 +3239,8 @@ Field Type Null Key Default Extra Privileges show keys from t2; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE -t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE -t2 1 fld3 1 fld3 A NULL NULL NULL BTREE +t2 0 fld1 1 fld1 A 0 NULL NULL BTREE +t2 1 fld3 1 fld3 A 1199 NULL NULL BTREE drop table t4, t3, t2, t1; DO 1; DO benchmark(100,1+1),1,1; diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 2c32d766a38..70548311e26 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -9,7 +9,7 @@ Table Op Msg_type Msg_text test.t1 check status Table is already up to date check table t1 changed; Table Op Msg_type Msg_text -test.t1 check status OK +test.t1 check status Table is already up to date insert into t1 values (5,5,5); check table t1 changed; Table Op Msg_type Msg_text diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test index 0bca8dc5890..9b06b522028 100644 --- a/mysql-test/t/insert.test +++ b/mysql-test/t/insert.test @@ -46,6 +46,8 @@ drop table t1; create table t1 (sid char(20), id int(2) NOT NULL auto_increment, key(sid, id)); insert into t1 values ('skr',NULL),('skr',NULL),('test',NULL); select * from t1; +insert into t1 values ('rts',NULL),('rts',NULL),('test',NULL); +select * from t1; drop table t1; # diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 0c472ea6a45..0560afdf068 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -685,11 +685,14 @@ void ha_myisam::deactivate_non_unique_index(ha_rows rows) /* Only disable old index if the table was empty */ if (file->state->records == 0) mi_disable_non_unique_index(file,rows); - ha_myisam::extra_opt(HA_EXTRA_BULK_INSERT_BEGIN, - current_thd->variables.bulk_insert_buff_size); + else + { + mi_init_bulk_insert(file, + current_thd->variables.bulk_insert_buff_size, rows); table->bulk_insert= 1; } } + } enable_activate_all_index=1; } else @@ -704,7 +707,7 @@ bool ha_myisam::activate_all_index(THD *thd) MYISAM_SHARE* share = file->s; DBUG_ENTER("activate_all_index"); - mi_extra(file, HA_EXTRA_BULK_INSERT_END, 0); + mi_end_bulk_insert(file); table->bulk_insert= 0; if (enable_activate_all_index && share->state.key_map != set_bits(ulonglong, share->base.keys)) @@ -945,13 +948,11 @@ int ha_myisam::extra(enum ha_extra_function operation) } -/* To be used with WRITE_CACHE, EXTRA_CACHE and BULK_INSERT_BEGIN */ +/* To be used with WRITE_CACHE and EXTRA_CACHE */ int ha_myisam::extra_opt(enum ha_extra_function operation, ulong cache_size) { - if ((specialflag & SPECIAL_SAFE_MODE) & - (operation == HA_EXTRA_WRITE_CACHE || - operation == HA_EXTRA_BULK_INSERT_BEGIN)) + if ((specialflag & SPECIAL_SAFE_MODE) & operation == HA_EXTRA_WRITE_CACHE) return 0; return mi_extra(file, operation, (void*) &cache_size); } @@ -1213,8 +1214,7 @@ longlong ha_myisam::get_auto_increment() } if (table->bulk_insert) - mi_extra(file, HA_EXTRA_BULK_INSERT_FLUSH, - (void*) &table->next_number_index); + mi_flush_bulk_insert(file, table->next_number_index); longlong nr; int error; diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index 07683dca73e..f2c3d1a7747 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -247,9 +247,7 @@ int ha_myisammrg::extra(enum ha_extra_function operation) int ha_myisammrg::extra_opt(enum ha_extra_function operation, ulong cache_size) { - if ((specialflag & SPECIAL_SAFE_MODE) & - (operation == HA_EXTRA_WRITE_CACHE || - operation == HA_EXTRA_BULK_INSERT_BEGIN)) + if ((specialflag & SPECIAL_SAFE_MODE) & operation == HA_EXTRA_WRITE_CACHE) return 0; return myrg_extra(file, operation, (void*) &cache_size); } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 5ca08aa31b0..4d1b2e59f60 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -105,7 +105,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List &fields, int error; bool log_on= ((thd->options & OPTION_UPDATE_LOG) || !(thd->master_access & SUPER_ACL)); - bool transactional_table, log_delayed, bulk_insert=0; + bool transactional_table, log_delayed, bulk_insert; uint value_count; ulong counter = 1; ulonglong id; @@ -187,21 +187,16 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List &fields, thd->proc_info="update"; if (duplic == DUP_IGNORE || duplic == DUP_REPLACE) table->file->extra(HA_EXTRA_IGNORE_DUP_KEY); - if ((bulk_insert= (values_list.elements >= MIN_ROWS_TO_USE_BULK_INSERT && - lock_type != TL_WRITE_DELAYED && - !(specialflag & SPECIAL_SAFE_MODE)))) + if ((lock_type != TL_WRITE_DELAYED && !(specialflag & SPECIAL_SAFE_MODE))) { table->file->extra_opt(HA_EXTRA_WRITE_CACHE, min(thd->variables.read_buff_size, table->avg_row_length*values_list.elements)); - if (thd->variables.bulk_insert_buff_size) - table->file->extra_opt(HA_EXTRA_BULK_INSERT_BEGIN, - min(thd->variables.bulk_insert_buff_size, - (table->total_key_length + - table->keys * TREE_ELEMENT_EXTRA_SIZE)* - values_list.elements)); - table->bulk_insert= 1; + table->file->deactivate_non_unique_index(values_list.elements); + bulk_insert=1; } + else + bulk_insert=0; while ((values= its++)) { @@ -278,7 +273,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List &fields, error=1; } } - if (table->file->extra(HA_EXTRA_BULK_INSERT_END)) + if (table->file->activate_all_index(thd)) { if (!error) { @@ -286,7 +281,6 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List &fields, error=1; } } - table->bulk_insert= 0; } if (id && values_list.elements != 1) thd->insert_id(id); // For update log From 127d01dd016aeb4b90689219d13b67075e21b8bb Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 Dec 2002 00:06:05 +0100 Subject: [PATCH 009/220] ANALYZE for MERGE --- include/myisammrg.h | 2 ++ myisammrg/myrg_info.c | 17 ++++++++--------- myisammrg/myrg_open.c | 22 ++++++++++++++++++---- sql/ha_myisammrg.cc | 7 +++++++ 4 files changed, 35 insertions(+), 13 deletions(-) diff --git a/include/myisammrg.h b/include/myisammrg.h index c3b3b39424b..ea882450eef 100644 --- a/include/myisammrg.h +++ b/include/myisammrg.h @@ -51,6 +51,7 @@ typedef struct st_mymerge_info /* Struct from h_info */ uint reclength; /* Recordlength */ int errkey; /* With key was dupplicated on err */ uint options; /* HA_OPTION_... used */ + ulong *rec_per_key; /* for sql optimizing */ } MYMERGE_INFO; typedef struct st_myrg_table_info @@ -71,6 +72,7 @@ typedef struct st_myrg_info my_bool cache_in_use; LIST open_list; QUEUE by_key; + ulong *rec_per_key_part; /* for sql optimizing */ } MYRG_INFO; diff --git a/myisammrg/myrg_info.c b/myisammrg/myrg_info.c index 14bc228cc1f..ba840ac444b 100644 --- a/myisammrg/myrg_info.c +++ b/myisammrg/myrg_info.c @@ -28,8 +28,6 @@ ulonglong myrg_position(MYRG_INFO *info) ~(ulonglong) 0; } - /* If flag != 0 one only gets pos of last record */ - int myrg_status(MYRG_INFO *info,register MYMERGE_INFO *x,int flag) { MYRG_TABLE *current_table; @@ -55,15 +53,16 @@ int myrg_status(MYRG_INFO *info,register MYMERGE_INFO *x,int flag) DBUG_PRINT("info2",("table: %s, offset: %lu", file->table->filename,(ulong) file->file_offset)); } - x->records = info->records; - x->deleted = info->del; - x->data_file_length = info->data_file_length; - x->reclength = info->reclength; - x->options = info->options; + x->records= info->records; + x->deleted= info->del; + x->data_file_length= info->data_file_length; + x->reclength= info->reclength; + x->options= info->options; if (current_table) - x->errkey = current_table->table->errkey; + x->errkey= current_table->table->errkey; else - x->errkey=0; + x->errkey= 0; + x->rec_per_key = info->rec_per_key_part; } DBUG_RETURN(0); } diff --git a/myisammrg/myrg_open.c b/myisammrg/myrg_open.c index 9360f582958..6a3c8dd86d9 100644 --- a/myisammrg/myrg_open.c +++ b/myisammrg/myrg_open.c @@ -32,8 +32,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) { - int save_errno,i,errpos; - uint files,dir_length,length,options; + int save_errno,i,j,errpos; + uint files,dir_length,length,options, key_parts; ulonglong file_offset; char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end; MYRG_INFO info,*m_info; @@ -89,13 +89,25 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) } info.reclength=isam->s->base.reclength; } + key_parts=(isam ? isam->s->base.key_parts : 0); if (!(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO)+ - files*sizeof(MYRG_TABLE), + files*sizeof(MYRG_TABLE)+ + sizeof(long)*key_parts, MYF(MY_WME)))) goto err; *m_info=info; - m_info->open_tables=(files) ? (MYRG_TABLE *) (m_info+1) : 0; m_info->tables=files; + if (files) + { + m_info->open_tables=(MYRG_TABLE *) (m_info+1); + m_info->rec_per_key_part=(ulong *) (m_info->open_tables+files); + bzero((char*) m_info->rec_per_key_part,sizeof(long)*key_parts); + } + else + { + m_info->open_tables=0; + m_info->rec_per_key_part=0; + } errpos=2; options= (uint) ~0; @@ -107,6 +119,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) m_info->records+=isam->state->records; m_info->del+=isam->state->del; m_info->data_file_length+=isam->state->data_file_length; + for (j=0; j < key_parts; j++) + m_info->rec_per_key_part[j]+=isam->s->state.rec_per_key_part[j] / files; if (i) isam=(MI_INFO*) (isam->open_list.next->data); } diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index f2c3d1a7747..efebeb8b46d 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -229,6 +229,13 @@ void ha_myisammrg::info(uint flag) #else ref_length=4; // Can't be > than my_off_t #endif + if (flag & HA_STATUS_CONST) + { + if (table->key_parts) + memcpy((char*) table->key_info[0].rec_per_key, + (char*) info.rec_per_key, + sizeof(table->key_info[0].rec_per_key)*table->key_parts); + } } From 181537e9248196e94323c138f7fc7c503d2c8c41 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 Dec 2002 00:07:25 +0100 Subject: [PATCH 010/220] incorrect bugfix removed. EQ+BETWEEN still cannot be optimized :( --- sql/sql_select.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index c4bc10a8b2a..1e70064b4a1 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1267,7 +1267,7 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds, select->quick=0; if (records != HA_POS_ERROR) { - s->records=s->found_records=records; + s->found_records=records; s->read_time= (ha_rows) (s->quick ? s->quick->read_time : 0.0); } } From 37a02e4ce45ec6947f0aac5c3bdbce7be46beeac Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 Dec 2002 04:17:31 -0400 Subject: [PATCH 011/220] Update Windows binaries prefix according MySQL Pro release package sql/mysqld.cc: With the introduction of Pro release version the InnoDB table engine was added for all binaries and not more define only the max package --- sql/mysqld.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 6aa41f9f800..0895013c37e 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -184,12 +184,12 @@ static char **opt_argv; #ifdef __WIN__ #undef MYSQL_SERVER_SUFFIX #ifdef __NT__ -#if defined(HAVE_INNOBASE_DB) || defined(HAVE_BERKELEY_DB) +#if defined(HAVE_BERKELEY_DB) #define MYSQL_SERVER_SUFFIX "-max-nt" #else #define MYSQL_SERVER_SUFFIX "-nt" #endif /* ...DB */ -#elif defined(HAVE_INNOBASE_DB) || defined(HAVE_BERKELEY_DB) +#elif defined(HAVE_BERKELEY_DB) #define MYSQL_SERVER_SUFFIX "-max" #else #define MYSQL_SERVER_SUFFIX "" From 10bde0b61cbbc84f0ee4a1b6412c357f25db61e6 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 Dec 2002 14:25:23 +0100 Subject: [PATCH 012/220] - make sure to replace HOSTNAME in mysql.server when packing up the binary distribution (this will still be broken for 3.23.54) - make sure that mysql.server in the binary distribution is executable, too --- scripts/make_binary_distribution.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index bde77713d63..d8d34229b70 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -120,11 +120,11 @@ $CP scripts/* $BASE/bin rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh $BASE/bin/mysql_install_db $BASE/bin/make_binary_distribution $BASE/bin/setsomevars $BASE/support-files/Makefile* $BASE/support-files/*.sh $BASE/bin/replace \@localstatedir\@ ./data \@bindir\@ ./bin \@scriptdir\@ ./bin \@libexecdir\@ ./bin \@sbindir\@ ./bin \@prefix\@ . \@HOSTNAME\@ @HOSTNAME@ < $SOURCE/scripts/mysql_install_db.sh > $BASE/scripts/mysql_install_db -$BASE/bin/replace \@prefix\@ /usr/local/mysql \@bindir\@ ./bin \@MYSQLD_USER\@ root \@localstatedir\@ /usr/local/mysql/data < $SOURCE/support-files/mysql.server.sh > $BASE/support-files/mysql.server +$BASE/bin/replace \@prefix\@ /usr/local/mysql \@bindir\@ ./bin \@MYSQLD_USER\@ root \@localstatedir\@ /usr/local/mysql/data \@HOSTNAME\@ @HOSTNAME@ < $SOURCE/support-files/mysql.server.sh > $BASE/support-files/mysql.server $BASE/bin/replace /my/gnu/bin/hostname /bin/hostname -- $BASE/bin/safe_mysqld mv $BASE/support-files/binary-configure $BASE/configure -chmod a+x $BASE/bin/* $BASE/scripts/* $BASE/support-files/mysql-* $BASE/configure +chmod a+x $BASE/bin/* $BASE/scripts/* $BASE/support-files/mysql-* $BASE/support-files/mysql.server $BASE/configure $CP -r sql-bench/* $BASE/sql-bench rm -f $BASE/sql-bench/*.sh $BASE/sql-bench/Makefile* $BASE/lib/*.la From 89991c65f3327f33f11b81c23914dfad57c4002d Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 Dec 2002 18:40:38 +0500 Subject: [PATCH 013/220] merge Ranger's patches to crash-me, add new tests ( DEFAULT VALUES ) to crash-me sql-bench/crash-me.sh: new tests: - INSERT with DEFAULT: - INSERT with empty value list: - Insert DEFAULT VALUES; ------- -checking of reserved keywords (by courtesy of Ranger) -------- - added "--suffix" option - added description of "--config-file" to help section - fixed test for DIFFERENCE() - fixed small bug in safe_query_result (was s/,/,/ should s/,/./) (by courtesy of Ranger) sql-bench/server-cfg.sh: remove "KERNEL" and add "SAPDB" to sapdb version BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + sql-bench/crash-me.sh | 267 ++++++++++++++++++++++++++++++++++++++- sql-bench/server-cfg.sh | 3 +- 3 files changed, 266 insertions(+), 5 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index f4174cc2fbf..5c9df32641b 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -86,6 +86,7 @@ tonu@x153.internalnet tonu@x3.internalnet venu@work.mysql.com vva@genie.(none) +walrus@kishkin.ru walrus@mysql.com worm@altair.is.lan zak@balfor.local diff --git a/sql-bench/crash-me.sh b/sql-bench/crash-me.sh index 6c3ee9bd0dc..d18070d30b7 100644 --- a/sql-bench/crash-me.sh +++ b/sql-bench/crash-me.sh @@ -55,6 +55,7 @@ $opt_check_server=0; # Check if server is alive before each query $opt_sleep=10; # time to sleep while starting the db server $limit_changed=0; # For configure file $reconnect_count=0; +$opt_suffix=""; $opt_comment=$opt_config_file=$opt_log_queries_to_file=""; $limits{'crash_me_safe'}='yes'; $prompts{'crash_me_safe'}='crash me safe'; @@ -62,10 +63,13 @@ $limits{'operating_system'}= machine(); $prompts{'operating_system'}='crash-me tested on'; $retry_limit=3; -GetOptions("Information","help","server=s","debug","user=s","password=s","database=s","restart","force","quick","log-all-queries","comment=s","host=s","fix-limit-file","dir=s","db-start-cmd=s","sleep=s","batch-mode","config-file=s","log-queries-to-file=s","check-server") || usage(); +GetOptions("Information","help","server=s","debug","user=s","password=s","database=s","restart","force","quick","log-all-queries","comment=s","host=s","fix-limit-file","dir=s","db-start-cmd=s","sleep=s","suffix=s","batch-mode","config-file=s","log-queries-to-file=s","check-server") || usage(); usage() if ($opt_help || $opt_Information); -$opt_config_file="$pwd/$opt_dir/$opt_server.cfg" if (length($opt_config_file) == 0); +$opt_suffix = '-'.$opt_suffix if (length($opt_suffix) == 0); +$opt_config_file = "$pwd/$opt_dir/$opt_server$opt_suffix.cfg" if (length($opt_config_file) == 0); + +#!!! if ($opt_fix_limit_file) { @@ -298,6 +302,21 @@ report("INSERT with set syntax",'insert_with_set', "create table crash_q (a integer)", "insert into crash_q SET a=1", "drop table crash_q $drop_attr"); +report("INSERT with DEFAULT","insert_with_default", + "create table crash_me_q (a int)", + "insert into crash_me_q (a) values (DEFAULT)", + "drop table crash_me_q $drop_attr"); + +report("INSERT with empty value list","insert_with_empty_value_list", + "create table crash_me_q (a int)", + "insert into crash_me_q (a) values ()", + "drop table crash_me_q $drop_attr"); + +report("INSERT DEFAULT VALUES","insert_default_values", + "create table crash_me_q (a int)", + "insert into crash_me_q DEFAULT VALUES", + "drop table crash_me_q $drop_attr"); + report("allows end ';'","end_colon", "select * from crash_me;"); try_and_report("LIMIT number of rows","select_limit", ["with LIMIT", @@ -553,6 +572,13 @@ if (!defined($limits{'query_size'})) $query_size=$limits{'query_size'}; print "$limits{'query_size'}\n"; + +# +# Check for reserved words +# + +check_reserved_words($dbh); + # # Test database types # @@ -794,7 +820,7 @@ try_and_report("Automatic row id", "automatic_rowid", (["ASCII", "ascii", "ASCII('A')","65",0], ["CHAR", "char", "CHAR(65)" ,"A",1], ["CONCAT(2 arg)","concat", "concat('a','b')","ab",1], - ["DIFFERENCE()","difference","difference('abc','abe')",0,2], + ["DIFFERENCE()","difference","difference('abc','abe')",3,0], ["INSERT","insert","insert('abcd',2,2,'ef')","aefd",1], ["LEFT","left","left('abcd',2)","ab",1], ["LTRIM","ltrim","ltrim(' abcd')","abcd",1], @@ -2332,6 +2358,9 @@ $0 takes the following options: --batch-mode Don\'t ask any questions, quit on errors. +--config-file='filename' + Read limit results from specific file + --comment='some comment' Add this comment to the crash-me limit file @@ -2379,6 +2408,10 @@ $0 takes the following options: Known servers names are: Access, Adabas, AdabasD, Empress, Oracle, Informix, DB2, Mimer, mSQL, MS-SQL, MySQL, Pg, Solid or Sybase. For others $0 can\'t report the server version. +--suffix='suffix' (Default '') + Add suffix to the output filename. For instance if you run crash-me like "crash-me --suffix="myisam", + then output filename will look "mysql-myisam.cfg". + --user='user_name' User name to log into the SQL server. @@ -2687,6 +2720,228 @@ sub safe_query return $ok; } +sub check_reserved_words +{ + my ($dbh)= @_; + + my $answer, $prompt, $config, $keyword_type; + + my @keywords_type = ( "(ANSI SQL 92/99)", "(ANSI SQL 92)", "(ANSI SQL 99)", "(EXTRA)"); + my @keywords_ext = ( "ansi92/99", "ansi92", "ansi99", "extra"); + + my %reserved_words = ( + ABSOLUTE => 0, ACTION => 0, ADD => 0, + AFTER => 0, ALIAS => 0, ALL => 0, + ALLOCATE => 0, ALTER => 0, AND => 0, + ANY => 0, ARE => 0, AS => 0, + ASC => 0, ASSERTION => 0, AT => 0, + AUTHORIZATION => 0, BEFORE => 0, BEGIN => 0, + BIT => 0, BOOLEAN => 0, BOTH => 0, + BREADTH => 0, BY => 0, CALL => 0, + CASCADE => 0, CASCADED => 0, CASE => 0, + CAST => 0, CATALOG => 0, CHAR => 0, + CHARACTER => 0, CHECK => 0, CLOSE => 0, + COLLATE => 0, COLLATION => 0, COLUMN => 0, + COMMIT => 0, COMPLETION => 0, CONNECT => 0, + CONNECTION => 0, CONSTRAINT => 0, CONSTRAINTS => 0, + CONTINUE => 0, CORRESPONDING => 0, CREATE => 0, + CROSS => 0, CURRENT => 0, CURRENT_DATE => 0, + CURRENT_TIME => 0, CURRENT_TIMESTAMP => 0, CURRENT_USER => 0, + CURSOR => 0, CYCLE => 0, DATA => 0, + DATE => 0, DAY => 0, DEALLOCATE => 0, + DEC => 0, DECIMAL => 0, DECLARE => 0, + DEFAULT => 0, DEFERRABLE => 0, DEFERRED => 0, + DELETE => 0, DEPTH => 0, DESC => 0, + DESCRIBE => 0, DESCRIPTOR => 0, DIAGNOSTICS => 0, + DICTIONARY => 0, DISCONNECT => 0, DISTINCT => 0, + DOMAIN => 0, DOUBLE => 0, DROP => 0, + EACH => 0, ELSE => 0, ELSEIF => 0, + END => 0, END-EXEC => 0, EQUALS => 0, + ESCAPE => 0, EXCEPT => 0, EXCEPTION => 0, + EXEC => 0, EXECUTE => 0, EXTERNAL => 0, + FALSE => 0, FETCH => 0, FIRST => 0, + FLOAT => 0, FOR => 0, FOREIGN => 0, + FOUND => 0, FROM => 0, FULL => 0, + GENERAL => 0, GET => 0, GLOBAL => 0, + GO => 0, GOTO => 0, GRANT => 0, + GROUP => 0, HAVING => 0, HOUR => 0, + IDENTITY => 0, IF => 0, IGNORE => 0, + IMMEDIATE => 0, IN => 0, INDICATOR => 0, + INITIALLY => 0, INNER => 0, INPUT => 0, + INSERT => 0, INT => 0, INTEGER => 0, + INTERSECT => 0, INTERVAL => 0, INTO => 0, + IS => 0, ISOLATION => 0, JOIN => 0, + KEY => 0, LANGUAGE => 0, LAST => 0, + LEADING => 0, LEAVE => 0, LEFT => 0, + LESS => 0, LEVEL => 0, LIKE => 0, + LIMIT => 0, LOCAL => 0, LOOP => 0, + MATCH => 0, MINUTE => 0, MODIFY => 0, + MODULE => 0, MONTH => 0, NAMES => 0, + NATIONAL => 0, NATURAL => 0, NCHAR => 0, + NEW => 0, NEXT => 0, NO => 0, + NONE => 0, NOT => 0, NULL => 0, + NUMERIC => 0, OBJECT => 0, OF => 0, + OFF => 0, OLD => 0, ON => 0, + ONLY => 0, OPEN => 0, OPERATION => 0, + OPTION => 0, OR => 0, ORDER => 0, + OUTER => 0, OUTPUT => 0, PAD => 0, + PARAMETERS => 0, PARTIAL => 0, PRECISION => 0, + PREORDER => 0, PREPARE => 0, PRESERVE => 0, + PRIMARY => 0, PRIOR => 0, PRIVILEGES => 0, + PROCEDURE => 0, PUBLIC => 0, READ => 0, + REAL => 0, RECURSIVE => 0, REF => 0, + REFERENCES => 0, REFERENCING => 0, RELATIVE => 0, + RESIGNAL => 0, RESTRICT => 0, RETURN => 0, + RETURNS => 0, REVOKE => 0, RIGHT => 0, + ROLE => 0, ROLLBACK => 0, ROUTINE => 0, + ROW => 0, ROWS => 0, SAVEPOINT => 0, + SCHEMA => 0, SCROLL => 0, SEARCH => 0, + SECOND => 0, SECTION => 0, SELECT => 0, + SEQUENCE => 0, SESSION => 0, SESSION_USER => 0, + SET => 0, SIGNAL => 0, SIZE => 0, + SMALLINT => 0, SOME => 0, SPACE => 0, + SQL => 0, SQLEXCEPTION => 0, SQLSTATE => 0, + SQLWARNING => 0, STRUCTURE => 0, SYSTEM_USER => 0, + TABLE => 0, TEMPORARY => 0, THEN => 0, + TIME => 0, TIMESTAMP => 0, TIMEZONE_HOUR => 0, + TIMEZONE_MINUTE => 0, TO => 0, TRAILING => 0, + TRANSACTION => 0, TRANSLATION => 0, TRIGGER => 0, + TRUE => 0, UNDER => 0, UNION => 0, + UNIQUE => 0, UNKNOWN => 0, UPDATE => 0, + USAGE => 0, USER => 0, USING => 0, + VALUE => 0, VALUES => 0, VARCHAR => 0, + VARIABLE => 0, VARYING => 0, VIEW => 0, + WHEN => 0, WHENEVER => 0, WHERE => 0, + WHILE => 0, WITH => 0, WITHOUT => 0, + WORK => 0, WRITE => 0, YEAR => 0, + ZONE => 0, + + ASYNC => 1, AVG => 1, BETWEEN => 1, + BIT_LENGTH => 1, CHARACTER_LENGTH => 1, CHAR_LENGTH => 1, + COALESCE => 1, CONVERT => 1, COUNT => 1, + EXISTS => 1, EXTRACT => 1, INSENSITIVE => 1, + LOWER => 1, MAX => 1, MIN => 1, + NULLIF => 1, OCTET_LENGTH => 1, OID => 1, + OPERATORS => 1, OTHERS => 1, OVERLAPS => 1, + PENDANT => 1, POSITION => 1, PRIVATE => 1, + PROTECTED => 1, REPLACE => 1, SENSITIVE => 1, + SIMILAR => 1, SQLCODE => 1, SQLERROR => 1, + SUBSTRING => 1, SUM => 1, TEST => 1, + THERE => 1, TRANSLATE => 1, TRIM => 1, + TYPE => 1, UPPER => 1, VIRTUAL => 1, + VISIBLE => 1, WAIT => 1, + + ADMIN => 2, AGGREGATE => 2, ARRAY => 2, + BINARY => 2, BLOB => 2, CLASS => 2, + CLOB => 2, CONDITION => 2, CONSTRUCTOR => 2, + CONTAINS => 2, CUBE => 2, CURRENT_PATH => 2, + CURRENT_ROLE => 2, DATALINK => 2, DEREF => 2, + DESTROY => 2, DESTRUCTOR => 2, DETERMINISTIC => 2, + DO => 2, DYNAMIC => 2, EVERY => 2, + EXIT => 2, EXPAND => 2, EXPANDING => 2, + FREE => 2, FUNCTION => 2, GROUPING => 2, + HANDLER => 2, HAST => 2, HOST => 2, + INITIALIZE => 2, INOUT => 2, ITERATE => 2, + LARGE => 2, LATERAL => 2, LOCALTIME => 2, + LOCALTIMESTAMP => 2, LOCATOR => 2, MEETS => 2, + MODIFIES => 2, NCLOB => 2, NORMALIZE => 2, + ORDINALITY => 2, OUT => 2, PARAMETER => 2, + PATH => 2, PERIOD => 2, POSTFIX => 2, + PRECEDES => 2, PREFIX => 2, READS => 2, + REDO => 2, REPEAT => 2, RESULT => 2, + ROLLUP => 2, SETS => 2, SPECIFIC => 2, + SPECIFICTYPE => 2, START => 2, STATE => 2, + STATIC => 2, SUCCEEDS => 2, TERMINATE => 2, + THAN => 2, TREAT => 2, UNDO => 2, + UNTIL => 2, + + ANALYZE => 3, AUTO_INCREMENT => 3, BDB => 3, + BERKELEYDB => 3, BIGINT => 3, BTREE => 3, + CHANGE => 3, COLUMNS => 3, DATABASE => 3, + DATABASES => 3, DAY_HOUR => 3, DAY_MINUTE => 3, + DAY_SECOND => 3, DELAYED => 3, DISTINCTROW => 3, + ENCLOSED => 3, ERRORS => 3, ESCAPED => 3, + EXPLAIN => 3, FIELDS => 3, FULLTEXT => 3, + GEOMETRY => 3, HASH => 3, HIGH_PRIORITY => 3, + HOUR_MINUTE => 3, HOUR_SECOND => 3, INDEX => 3, + INFILE => 3, INNODB => 3, KEYS => 3, + KILL => 3, LINES => 3, LOAD => 3, + LOCK => 3, LONG => 3, LONGBLOB => 3, + LONGTEXT => 3, LOW_PRIORITY => 3, MASTER_SERVER_ID => 3, + MEDIUMBLOB => 3, MEDIUMINT => 3, MEDIUMTEXT => 3, + MIDDLEINT => 3, MINUTE_SECOND => 3, MRG_MYISAM => 3, + OPTIMIZE => 3, OPTIONALLY => 3, OUTFILE => 3, + PURGE => 3, REGEXP => 3, RENAME => 3, + REQUIRE => 3, RLIKE => 3, RTREE => 3, + SHOW => 3, SONAME => 3, SPATIAL => 3, + SQL_BIG_RESULT => 3,SQL_CALC_FOUND_ROWS => 3, SQL_SMALL_RESULT => 3, + SSL => 3, STARTING => 3, STRAIGHT_JOIN => 3, + STRIPED => 3, TABLES => 3, TERMINATED => 3, + TINYBLOB => 3, TINYINT => 3, TINYTEXT => 3, + TYPES => 3, UNLOCK => 3, UNSIGNED => 3, + USE => 3, USER_RESOURCES => 3, VARBINARY => 3, + WARNINGS => 3, XOR => 3, YEAR_MONTH => 3, + ZEROFILL => 3, + + BACKUP => 3, BREAK => 3, BROWSE => 3, + BULK => 3, CHECKPOINT => 3, CLUSTERED => 3, + COMPUTE => 3, CONTAINSTABLE => 3, DBCC => 3, + DENY => 3, DISK => 3, DISTRIBUTED => 3, + DUMMY => 3, DUMP => 3, ERRLVL => 3, + FILE => 3, FILLFACTOR => 3, FREETEXT => 3, + FREETEXTTABLE => 3, HOLDLOCK => 3, IDENTITYCOL => 3, + IDENTITY_INSERT => 3, LINENO => 3, NOCHECK => 3, + NONCLUSTERED => 3, OFFSETS => 3, OPENDATASOURCE => 3, + OPENQUERY => 3, OPENROWSET => 3, OPENXML => 3, + OVER => 3, PERCENT => 3, PLAN => 3, + PRINT => 3, PROC => 3, RAISERROR => 3, + READTEXT => 3, RECONFIGURE => 3, REPLICATION => 3, + RESTORE => 3, ROWCOUNT => 3, ROWGUIDCOL => 3, + RULE => 3, SAVE => 3, SETUSER => 3, + SHUTDOWN => 3, STATISTICS => 3, TEXTSIZE => 3, + TOP => 3, TRAN => 3, TRUNCATE => 3, + TSEQUAL => 3, UPDATETEXT => 3, WAITFOR => 3, + WRITETEXT => 3, + + ACCESS => 3, AUDIT => 3, CLUSTER => 3, + COMMENT => 3, COMPRESS => 3, EXCLUSIVE => 3, + IDENTIFIED => 3, INCREMENT => 3, INITIAL => 3, + MAXEXTENTS => 3, MINUS => 3, MLSLABEL => 3, + MODE => 3, NOAUDIT => 3, NOCOMPRESS => 3, + NOWAIT => 3, NUMBER => 3, OFFLINE => 3, + ONLINE => 3, PCTFREE => 3, RAW => 3, + RESOURCE => 3, ROWID => 3, ROWNUM => 3, + SHARE => 3, SUCCESSFUL => 3, SYNONYM => 3, + SYSDATE => 3, UID => 3, VALIDATE => 3, + VARCHAR2 => 3 + ); + + $dbh->do("drop table crash_me10"); + $dbh->do("create table crash_me10 (id int not null)") or warn "$dbh->errstr\n"; + $dbh->{RaiseError}= 1; + + foreach my $keyword (keys %reserved_words) + { + + $keyword_type= $reserved_words{$keyword}; + + $prompt= "Reserved keyword ".$keyword." ".$keywords_type[$keyword_type]; + $config= "reserved_word_".$keywords_ext[$keyword_type]."_".lc($keyword); + + eval { + $dbh->do("alter table crash_me10 add column $keyword int not null"); + }; + + $answer= ($@) ? "yes" : "no"; + + save_config_data($config,$answer,$prompt); + + print "$prompt: ",$limits{$config},"\n"; + + } + + $dbh->{RaiseError}= 0; +} # # Do a query on a query package object. @@ -3007,9 +3262,13 @@ sub safe_query_result } $result=0; # Ok $last_result= $row->[0]; # Save for report_result; + + # Note: + # if ($result_type == 2) We accept any return value as answer + if ($result_type == 0) # Compare numbers { - $row->[0] =~ s/,/,/; # Fix if ',' is used instead of '.' + $row->[0] =~ s/,/./; # Fix if ',' is used instead of '.' if ($row->[0] != $answer && (abs($row->[0]- $answer)/ (abs($row->[0]) + abs($answer))) > 0.01) { diff --git a/sql-bench/server-cfg.sh b/sql-bench/server-cfg.sh index 7f96c06ef99..533e7aea574 100644 --- a/sql-bench/server-cfg.sh +++ b/sql-bench/server-cfg.sh @@ -3470,7 +3470,8 @@ sub version if ($sth->execute && (@row = $sth->fetchrow_array) && $row[0] =~ /([\d\.]+)/) { - $version="sap-db $1"; + $version=$row[0]; + $verson =~ s/KERNEL/SAP DB/i; } $sth->finish; $dbh->disconnect; From 448644dc6bdd0abb71fe3b7dfc8ec5c20365f027 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 Dec 2002 19:09:56 +0500 Subject: [PATCH 014/220] SCRUM task - cleanup interbase section in the server-cfg sql-bench/server-cfg.sh: clean-up interbase section corrected misprint in DSN, creating indexes,version(), and fields conversations. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + sql-bench/server-cfg.sh | 39 +++++++++++++++++---------------------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index f4174cc2fbf..5c9df32641b 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -86,6 +86,7 @@ tonu@x153.internalnet tonu@x3.internalnet venu@work.mysql.com vva@genie.(none) +walrus@kishkin.ru walrus@mysql.com worm@altair.is.lan zak@balfor.local diff --git a/sql-bench/server-cfg.sh b/sql-bench/server-cfg.sh index 7f96c06ef99..c8c298ef1a7 100644 --- a/sql-bench/server-cfg.sh +++ b/sql-bench/server-cfg.sh @@ -2985,7 +2985,7 @@ sub new bless $self; $self->{'cmp_name'} = "interbase"; - $self->{'data_source'} = "DBI:InterBase:database=$database:ib_dialect=3"; + $self->{'data_source'} = "DBI:InterBase:database=$database;ib_dialect=3"; $self->{'limits'} = \%limits; $self->{'blob'} = "blob"; $self->{'text'} = ""; @@ -3000,7 +3000,7 @@ sub new $limits{'max_tables'} = 65000; # Should be big enough $limits{'max_text_size'} = 15000; # Max size with default buffers. $limits{'query_size'} = 1000000; # Max size with default buffers. - $limits{'max_index'} = 31; # Max number of keys + $limits{'max_index'} = 65000; # Max number of keys $limits{'max_index_parts'} = 8; # Max segments/key $limits{'max_column_name'} = 128; # max table and column name @@ -3050,16 +3050,13 @@ sub new sub version { my ($self)=@_; - my ($dbh,$sth,$version,@row); - + my ($dbh,$version); + + $version='Interbase ?'; + $dbh=$self->connect(); -# $sth = $dbh->prepare("show version"); -# $sth->execute; -# @row = $sth->fetchrow_array; -# $version = $row[0]; -# $version =~ s/.*version \"(.*)\"$/$1/; + eval { $version = $dbh->func('version','ib_database_info')->{'version'}; }; $dbh->disconnect; - $version = "6.0Beta"; $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/); return $version; } @@ -3090,36 +3087,34 @@ sub connect sub create { my($self,$table_name,$fields,$index,$options) = @_; - my($query,@queries); + my($query,@queries,@keys,@indexes); $query="create table $table_name ("; foreach $field (@$fields) { - $field =~ s/ big_decimal/ float/i; - $field =~ s/ double/ float/i; + $field =~ s/ big_decimal/ decimal/i; + $field =~ s/ double/ double precision/i; $field =~ s/ tinyint/ smallint/i; - $field =~ s/ mediumint/ int/i; - $field =~ s/ integer/ int/i; + $field =~ s/ mediumint/ integer/i; + $field =~ s/\bint\b/integer/i; $field =~ s/ float\(\d,\d\)/ float/i; - $field =~ s/ date/ int/i; # Because of tcp ? $field =~ s/ smallint\(\d\)/ smallint/i; - $field =~ s/ int\(\d\)/ int/i; + $field =~ s/ integer\(\d\)/ integer/i; $query.= $field . ','; } foreach $ind (@$index) { - my @index; - if ( $ind =~ /\bKEY\b/i ){ + if ( $ind =~ /(\bKEY\b)|(\bUNIQUE\b)/i ){ push(@keys,"ALTER TABLE $table_name ADD $ind"); }else{ - my @fields = split(' ',$index); + my @fields = split(' ',$ind); my $query="CREATE INDEX $fields[1] ON $table_name $fields[2]"; - push(@index,$query); + push(@indexes,$query); } } substr($query,-1)=")"; # Remove last ','; $query.=" $options" if (defined($options)); - push(@queries,$query); + push(@queries,$query,@keys,@indexes); return @queries; } From 5fcd6ce31e2bdc0ebf5106ca27f96a11294d7209 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 Dec 2002 21:38:00 +0100 Subject: [PATCH 015/220] order_by.result, key_diff.result: updated mysql-test/r/key_diff.result: updated mysql-test/r/order_by.result: updated --- mysql-test/r/key_diff.result | 2 +- mysql-test/r/order_by.result | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/key_diff.result b/mysql-test/r/key_diff.result index 4eaccc696f9..f8671639e2c 100644 --- a/mysql-test/r/key_diff.result +++ b/mysql-test/r/key_diff.result @@ -36,7 +36,7 @@ a a a a explain select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B; table type possible_keys key key_len ref rows Extra t1 ALL a NULL NULL NULL 5 -t2 ALL b NULL NULL NULL 5 Using where +t2 ref b b 4 t1.a 1 Using where select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B order by binary t1.a,t2.a; a b a b A B a a diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 48773bfa916..62a42150eb3 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -450,9 +450,9 @@ gid sid uid 103853 5 250 EXPLAIN select t1.gid, t2.sid, t3.uid from t3, t2, t1 where t2.gid = t1.gid and t2.uid = t3.uid order by t1.gid, t3.uid; table type possible_keys key key_len ref rows Extra -t1 index PRIMARY PRIMARY 4 NULL 6 Using index -t2 eq_ref PRIMARY,uid PRIMARY 4 t1.gid 1 -t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 Using where; Using index +t3 index PRIMARY PRIMARY 2 NULL 6 Using index; Using temporary; Using filesort +t2 ref PRIMARY,uid uid 2 t3.uid 1 Using where +t1 eq_ref PRIMARY PRIMARY 4 t2.gid 1 Using index EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t1.gid,t3.skr; table type possible_keys key key_len ref rows Extra t1 index PRIMARY PRIMARY 4 NULL 6 Using index From f3b563df037353a7228a30276fc5b7a49ce565b6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 11 Dec 2002 12:44:17 +0200 Subject: [PATCH 016/220] Fixed rare bug in show processlist which could cause core dump if a new thread was connecting. sql/sql_show.cc: Fixed rare bug in show processlist which could cause core dump if a new thread was connecting. (We where calling mutex_unlock() without having ever called mutex_lock) sql/sql_udf.cc: Fixed warning from valgrind --- sql/sql_show.cc | 12 +++++++----- sql/sql_udf.cc | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 12979f77e56..a6285cfacd0 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1025,6 +1025,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) THD *tmp; while ((tmp=it++)) { + struct st_my_thread_var *mysys_var; if ((tmp->net.vio || tmp->system_thread) && (!user || (tmp->user && !strcmp(tmp->user,user)))) { @@ -1034,12 +1035,13 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) thd_info->user=thd->strdup(tmp->user ? tmp->user : (tmp->system_thread ? "system user" : "unauthenticated user")); thd_info->host=thd->strdup(tmp->host ? tmp->host : (tmp->ip ? tmp->ip : - (tmp->system_thread ? "none" : "connecting host"))); + (tmp->system_thread ? "none" : + "connecting host"))); if ((thd_info->db=tmp->db)) // Safe test thd_info->db=thd->strdup(thd_info->db); thd_info->command=(int) tmp->command; - if (tmp->mysys_var) - pthread_mutex_lock(&tmp->mysys_var->mutex); + if ((mysys_var= tmp->mysys_var)) + pthread_mutex_lock(&mysys_var->mutex); thd_info->proc_info= (char*) (tmp->killed ? "Killed" : 0); thd_info->state_info= (char*) (tmp->locked ? "Locked" : tmp->net.reading_or_writing ? @@ -1051,8 +1053,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) tmp->mysys_var && tmp->mysys_var->current_cond ? "Waiting on cond" : NullS); - if (tmp->mysys_var) - pthread_mutex_unlock(&tmp->mysys_var->mutex); + if (mysys_var) + pthread_mutex_unlock(&mysys_var->mutex); #if !defined(DONT_USE_THR_ALARM) && ! defined(SCO) if (pthread_kill(tmp->real_id,0)) diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index 5705dccd8d0..82a5e5bc002 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -204,6 +204,8 @@ void udf_init() new_thd->version--; // Force close to free memory close_thread_tables(new_thd); delete new_thd; + /* Remember that we don't have a THD */ + my_pthread_setspecific_ptr(THR_THD, 0); DBUG_VOID_RETURN; } From 49162e0e54c085ecefb6893a5bd662e4f7b2f56a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 11 Dec 2002 12:59:55 +0200 Subject: [PATCH 017/220] Added back -max to server name if we are using InnoDB. libmysql/libmysql.c: Compatibility fix sql/mysqld.cc: Added back -max if we are using InnoDB. (This should not be done in the 3.23 version) --- libmysql/libmysql.c | 4 ++-- sql/mysqld.cc | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 9db1e1c9ab9..755d85dd04a 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -939,7 +939,7 @@ static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, else { cur->data[field] = to; - if (len > end_to - to) + if (len > (ulong) (end_to - to)) { free_rows(result); net->last_errno=CR_UNKNOWN_ERROR; @@ -998,7 +998,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) } else { - if (len > end_pos - pos) + if (len > (ulong) (end_pos - pos)) { mysql->net.last_errno=CR_UNKNOWN_ERROR; strmov(mysql->net.last_error,ER(mysql->net.last_errno)); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 0895013c37e..17cf8f79646 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -184,17 +184,17 @@ static char **opt_argv; #ifdef __WIN__ #undef MYSQL_SERVER_SUFFIX #ifdef __NT__ -#if defined(HAVE_BERKELEY_DB) +#if defined(HAVE_INNOBASE_DB) || defined(HAVE_BERKELEY_DB) #define MYSQL_SERVER_SUFFIX "-max-nt" #else #define MYSQL_SERVER_SUFFIX "-nt" #endif /* ...DB */ -#elif defined(HAVE_BERKELEY_DB) +#elif defined(HAVE_INNOBASE_DB) || defined(HAVE_BERKELEY_DB) #define MYSQL_SERVER_SUFFIX "-max" #else #define MYSQL_SERVER_SUFFIX "" #endif /* __NT__ */ -#endif +#endif /* __WIN__ */ #ifdef HAVE_BERKELEY_DB SHOW_COMP_OPTION have_berkeley_db=SHOW_OPTION_YES; From 934f5cc4662ded62609ce64be15c54d327cc554e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 11 Dec 2002 15:46:39 +0200 Subject: [PATCH 018/220] Ensure that BEGIN / COMMIT is handled properly if slave dies Added syntax support for CREATE TABLE foo (a char CHARACTER SET latin1) CHARSET=latin1; Docs/internals.texi: Update binary protocol description innobase/include/db0err.h: Merge from 3.23 mysql-test/r/insert.result: Updated test result from 3.23 sql/log.cc: Fixed bug in replication and log rotation sql/log_event.cc: Ensure that BEGIN / COMMIT is handled properly if slave dies sql/slave.cc: Fixed bug in replication and log rotation sql/slave.h: Ensure that BEGIN / COMMIT is handled properly if slave dies sql/sql_analyse.cc: Moved usage of res before res is destroyed (by bzero(&s...)) sql/sql_yacc.yy: Added syntax support for CREATE TABLE foo (a char CHARACTER SET latin1) CHARSET=latin1; To be able to read MySQL 4.1 dump files. --- Docs/internals.texi | 16 +++++++++++-- innobase/include/db0err.h | 3 ++- mysql-test/r/insert.result | 11 ++++++++- sql/log.cc | 5 ++++ sql/log_event.cc | 23 +++++++++++++++--- sql/slave.cc | 7 +++++- sql/slave.h | 10 ++++---- sql/sql_analyse.cc | 49 +++++++++++++++++++------------------- sql/sql_yacc.yy | 5 ++++ 9 files changed, 93 insertions(+), 36 deletions(-) diff --git a/Docs/internals.texi b/Docs/internals.texi index 7e364774e39..18bdc8d8b4c 100644 --- a/Docs/internals.texi +++ b/Docs/internals.texi @@ -1797,7 +1797,7 @@ The package contains the following information: @multitable @columnfractions .30 .70 @item Size @tab Comment -@item (param_count+7)/8 @tab Null bit map +@item (param_count+9)/8 @tab Null bit map (2 bits reserved for protocol) @item 1 @tab new_parameter_bound flag. Is set to 1 for first execute or if one has rebound the parameters. @item 2*param_count @tab Type of parameters (only given if new_parameter_bound flag is 1) @@ -1813,7 +1813,7 @@ The parameters are stored the following ways: @multitable @columnfractions .20 .10 .70 @item Type @tab Size @tab Comment -@item tynyint @tab 1 @tab One byte integer +@item tinyint @tab 1 @tab One byte integer @item short @tab 2 @tab @item int @tab 4 @tab @item longlong @tab 8 @tab @@ -1849,6 +1849,18 @@ bound parameters to the client. The server is always sending the data as type given for 'column type' for respective column. It's up to the client to convert the parameter to the requested type. +DATETIME, DATE and TIME are sent to the server in a binary format as follows: + +@multitable @columnfractions .20 .10 .70 +@item Type @tab Size @tab Comment +@item date @tab 1 + 0-11 @tab Length + 2 byte year, 1 byte MMDDHHMMSS, 4 byte billionth of a second +@item datetime @tab 1 + 0-11 @tab Length + 2 byte year, 1 byte MMDDHHMMSS, 4 byte billionth of a second +@item time @tab 1 + 0-14 @tab Length + sign (0 = pos, 1= neg), 4 byte days, 1 byte HHMMDD, 4 byte billionth of a second +@end multitable + +The first byte is a length byte and then comes all parameters that are +not 0. (Always counted from the beginning). + @node Fulltext Search, , protocol, Top @chapter Fulltext Search in MySQL diff --git a/innobase/include/db0err.h b/innobase/include/db0err.h index 86b79b65bf2..ae4b0fe4cc5 100644 --- a/innobase/include/db0err.h +++ b/innobase/include/db0err.h @@ -42,7 +42,8 @@ Created 5/24/1996 Heikki Tuuri #define DB_CANNOT_ADD_CONSTRAINT 38 /* adding a foreign key constraint to a table failed */ #define DB_CORRUPTION 39 /* data structure corruption noticed */ - +#define DB_COL_APPEARS_TWICE_IN_INDEX 40 + /* The following are partial failure codes */ #define DB_FAIL 1000 #define DB_OVERFLOW 1001 diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result index 2ffa9d88618..dedde4cc408 100644 --- a/mysql-test/r/insert.result +++ b/mysql-test/r/insert.result @@ -46,8 +46,17 @@ insert into t1 values ('skr',NULL),('skr',NULL),('test',NULL); select * from t1; sid id skr 1 -skr 2 +skr 1 test 1 +insert into t1 values ('rts',NULL),('rts',NULL),('test',NULL); +select * from t1; +sid id +rts 1 +rts 2 +skr 1 +skr 1 +test 1 +test 2 drop table t1; drop database if exists foo; create database foo; diff --git a/sql/log.cc b/sql/log.cc index 32dbdac1074..56019a76b22 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -654,7 +654,12 @@ int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli) rli->linfo.log_file_name); goto err; } + /* + Reset position to current log. This involves setting both of the + position variables: + */ rli->relay_log_pos = BIN_LOG_HEADER_SIZE; + rli->pending = 0; strmake(rli->relay_log_name,rli->linfo.log_file_name, sizeof(rli->relay_log_name)-1); diff --git a/sql/log_event.cc b/sql/log_event.cc index 373e50b84f7..d451a5bc46c 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -208,9 +208,13 @@ int Log_event::exec_event(struct st_relay_log_info* rli) { if (rli) // QQ When is this not true ? { - rli->inc_pos(get_event_len(),log_pos); - DBUG_ASSERT(rli->sql_thd != 0); - flush_relay_log_info(rli); + if (rli->inside_transaction) + rli->inc_pending(get_event_len()); + else + { + rli->inc_pos(get_event_len(),log_pos); + flush_relay_log_info(rli); + } } return 0; } @@ -1707,6 +1711,19 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli) mysql_log.write(thd,COM_QUERY,"%s",thd->query); DBUG_PRINT("query",("%s",thd->query)); mysql_parse(thd, thd->query, q_len); + + /* + Set a flag if we are inside an transaction so that we can restart + the transaction from the start if we are killed + + This will only be done if we are supporting transactional tables + in the slave. + */ + if (!strcmp(thd->query,"BEGIN")) + rli->inside_transaction= opt_using_transactions; + else if (!strcmp(thd->query,"COMMIT")) + rli->inside_transaction=0; + if ((expected_error != (actual_error = thd->net.last_errno)) && expected_error && !ignored_error_code(actual_error) && diff --git a/sql/slave.cc b/sql/slave.cc index eb53e488856..a4e0b029bbf 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2711,7 +2711,12 @@ static IO_CACHE *reopen_relay_log(RELAY_LOG_INFO *rli, const char **errmsg) if ((rli->cur_log_fd=open_binlog(cur_log,rli->relay_log_name, errmsg)) <0) DBUG_RETURN(0); - my_b_seek(cur_log,rli->relay_log_pos); + /* + We want to start exactly where we was before: + relay_log_pos Current log pos + pending Number of bytes already processed from the event + */ + my_b_seek(cur_log,rli->relay_log_pos + rli->pending); DBUG_RETURN(cur_log); } diff --git a/sql/slave.h b/sql/slave.h index 721fd8534a0..cb368ad26b1 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -169,11 +169,13 @@ typedef struct st_relay_log_info volatile bool abort_slave, slave_running; bool log_pos_current; bool skip_log_purge; - + bool inside_transaction; + st_relay_log_info() - :info_fd(-1),cur_log_fd(-1), cur_log_old_open_count(0), abort_pos_wait(0), - slave_run_id(0), inited(0), abort_slave(0), slave_running(0), - log_pos_current(0), skip_log_purge(0) + :info_fd(-1),cur_log_fd(-1), cur_log_old_open_count(0), abort_pos_wait(0), + slave_run_id(0), inited(0), abort_slave(0), slave_running(0), + log_pos_current(0), skip_log_purge(0), + inside_transaction(0) /* the default is autocommit=1 */ { relay_log_name[0] = master_log_name[0] = 0; bzero(&info_file,sizeof(info_file)); diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index 96bbd731882..cbd586b8d30 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -310,30 +310,6 @@ void field_str::add() was_maybe_zerofill = num_info.maybe_zerofill; } - if (room_in_tree) - { - if (res != &s) - s.copy(*res); - if (!tree_search(&tree, (void*) &s)) // If not in tree - { - s.copy(); // slow, when SAFE_MALLOC is in use - if (!tree_insert(&tree, (void*) &s, 0)) - { - room_in_tree = 0; // Remove tree, out of RAM ? - delete_tree(&tree); - } - else - { - bzero((char*) &s, sizeof(s)); // Let tree handle free of this - if ((treemem += length) > pc->max_treemem) - { - room_in_tree = 0; // Remove tree, too big tree - delete_tree(&tree); - } - } - } - } - if (!found) { found = 1; @@ -364,6 +340,31 @@ void field_str::add() max_arg.copy(*res); } } + + if (room_in_tree) + { + if (res != &s) + s.copy(*res); + if (!tree_search(&tree, (void*) &s)) // If not in tree + { + s.copy(); // slow, when SAFE_MALLOC is in use + if (!tree_insert(&tree, (void*) &s, 0)) + { + room_in_tree = 0; // Remove tree, out of RAM ? + delete_tree(&tree); + } + else + { + bzero((char*) &s, sizeof(s)); // Let tree handle free of this + if ((treemem += length) > pc->max_treemem) + { + room_in_tree = 0; // Remove tree, too big tree + delete_tree(&tree); + } + } + } + } + if ((num_info.zerofill && (max_length != min_length)) || (was_zero_fill && (max_length != min_length))) can_be_still_num = 0; // zerofilled numbers must be of same length diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 7cb05d6bd3c..2eb32d16bb7 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -167,6 +167,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token CACHE_SYM %token CASCADE %token CAST_SYM +%token CHARSET %token CHECKSUM_SYM %token CHECK_SYM %token COMMITTED_SYM @@ -855,6 +856,8 @@ create_table_option: table_list->next=0; lex->create_info.used_fields|= HA_CREATE_USED_UNION; } + | CHARSET opt_equal ident {} + | CHAR_SYM SET opt_equal ident {} | INSERT_METHOD EQ merge_insert_types { Lex->create_info.merge_insert_method= $3; Lex->create_info.used_fields|= HA_CREATE_USED_INSERT_METHOD;} | DATA_SYM DIRECTORY_SYM EQ TEXT_STRING { Lex->create_info.data_file_name= $4.str; } | INDEX DIRECTORY_SYM EQ TEXT_STRING { Lex->create_info.index_file_name= $4.str; }; @@ -1088,6 +1091,7 @@ attribute: opt_binary: /* empty */ {} | BINARY { Lex->type|=BINARY_FLAG; }; + | CHAR_SYM SET opt_equal ident {} references: REFERENCES table_ident opt_on_delete {} @@ -3192,6 +3196,7 @@ keyword: | BOOLEAN_SYM {} | CACHE_SYM {} | CHANGED {} + | CHARSET {} | CHECKSUM_SYM {} | CIPHER_SYM {} | CLIENT_SYM {} From ff50fc4fe5f33722cbe13e04be393d6a2d4bf5ce Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 11 Dec 2002 18:27:46 +0100 Subject: [PATCH 019/220] - tagged ChangeSet 1.1276.3.1 as MySQL 3.23.54 - bumped up version number in configure.in to 3.23.55 --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 3a5c1a56408..7a4498bff97 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! -AM_INIT_AUTOMAKE(mysql, 3.23.54) +AM_INIT_AUTOMAKE(mysql, 3.23.55) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 From aaf9a98e1368a19010da4bc4e7ba06943c2d8279 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 11 Dec 2002 19:37:09 +0100 Subject: [PATCH 020/220] - moved manual pages from "man" to "man/man1" for the binary distribution --- scripts/make_binary_distribution.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 9d25943bb52..c2b1a0cb2b3 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -50,7 +50,7 @@ mkdir $BASE $BASE/bin $BASE/data $BASE/data/mysql $BASE/data/test \ $BASE/include $BASE/lib $BASE/support-files $BASE/share $BASE/share/mysql \ $BASE/tests $BASE/scripts $BASE/sql-bench $BASE/mysql-test \ $BASE/mysql-test/t $BASE/mysql-test/r \ - $BASE/mysql-test/include $BASE/mysql-test/std_data $BASE/man + $BASE/mysql-test/include $BASE/mysql-test/std_data $BASE/man $BASE/man/man1 chmod o-rwx $BASE/data $BASE/data/* @@ -107,7 +107,7 @@ rm $BASE/include/Makefile*; rm $BASE/include/*.in $CP tests/*.res tests/*.tst tests/*.pl $BASE/tests $CP support-files/* $BASE/support-files -$CP man/*.? $BASE/man +$CP man/*.1 $BASE/man/man1 $CP -r sql/share/* $BASE/share/mysql rm -f $BASE/share/mysql/Makefile* $BASE/share/mysql/*/*.OLD From 182de7c203bf543520584318aa6936e69fdc9942 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 11 Dec 2002 21:22:57 +0200 Subject: [PATCH 021/220] Add CHARSET keyword (missing from last push) sql/field.cc: Small safety fix --- sql/field.cc | 6 ++++-- sql/lex.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sql/field.cc b/sql/field.cc index afd594b7045..aae4fac2a38 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -4220,9 +4220,11 @@ void Field_blob::get_key_image(char *buff,uint length) char *blob; if ((uint32) length > blob_length) { -#ifdef HAVE_purify + /* + Must clear this as we do a memcmp in opt_range.cc to detect + identical keys + */ bzero(buff+2+blob_length, (length-blob_length)); -#endif length=(uint) blob_length; } int2store(buff,length); diff --git a/sql/lex.h b/sql/lex.h index bf0abc323e1..826b9b4a9ef 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -80,6 +80,7 @@ static SYMBOL symbols[] = { { "CASE", SYM(CASE_SYM),0,0}, { "CHAR", SYM(CHAR_SYM),0,0}, { "CHARACTER", SYM(CHAR_SYM),0,0}, + { "CHARSET", SYM(CHARSET),0,0}, { "CHANGE", SYM(CHANGE),0,0}, { "CHANGED", SYM(CHANGED),0,0}, { "CHECK", SYM(CHECK_SYM),0,0}, From b870cfa5952056bbde9d0a92c63d87ade129d27f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 11 Dec 2002 21:24:28 +0200 Subject: [PATCH 022/220] log.cc: We must not commit inside InnoDB when LOAD DATA INFILE just writes a block to the binlog; only commit if the log event type is QUERY_EVENT or EXECUTE_LOAD_EVENT sql/log.cc: We must not commit inside InnoDB when LOAD DATA INFILE just writes a block to the binlog; only commit if the log event type is QUERY_EVENT or EXECUTE_LOAD_EVENT --- sql/log.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sql/log.cc b/sql/log.cc index 56019a76b22..21c88cc1616 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1115,8 +1115,20 @@ bool MYSQL_LOG::write(Log_event* event_info) if (file == &log_file) { - error = ha_report_binlog_offset_and_commit(thd, log_file_name, + /* + LOAD DATA INFILE in AUTOCOMMIT=1 mode writes to the binlog + chunks also before it is successfully completed. We only report + the binlog write and do the commit inside the transactional table + handler if the log event type is appropriate. + */ + + if (event_info->get_type_code() == QUERY_EVENT + || event_info->get_type_code() == EXEC_LOAD_EVENT) + { + error = ha_report_binlog_offset_and_commit(thd, log_file_name, file->pos_in_file); + } + should_rotate= (my_b_tell(file) >= (my_off_t) max_binlog_size); } @@ -1159,7 +1171,7 @@ uint MYSQL_LOG::next_file_id() NOTE - We only come here if there is something in the cache. - - The thing in the cache is always a complete transcation + - The thing in the cache is always a complete transaction - 'cache' needs to be reinitialized after this functions returns. IMPLEMENTATION From 25c8f58ac7710db353a1078f22988cdaa5633817 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 12 Dec 2002 11:06:55 +0200 Subject: [PATCH 023/220] - Fix handling of suffix option - Replace function 'check_reserved_words' with correct one BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + sql-bench/crash-me.sh | 390 +++++++++++++++++++-------------------- 2 files changed, 196 insertions(+), 195 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 5c9df32641b..a55a5f46496 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -62,6 +62,7 @@ pem@mysql.com peter@linux.local peter@mysql.com ram@ram.(none) +ranger@regul.home.lan root@x3.internalnet salle@geopard.(none) salle@geopard.online.bg diff --git a/sql-bench/crash-me.sh b/sql-bench/crash-me.sh index d18070d30b7..b101a7f595a 100644 --- a/sql-bench/crash-me.sh +++ b/sql-bench/crash-me.sh @@ -66,7 +66,7 @@ $retry_limit=3; GetOptions("Information","help","server=s","debug","user=s","password=s","database=s","restart","force","quick","log-all-queries","comment=s","host=s","fix-limit-file","dir=s","db-start-cmd=s","sleep=s","suffix=s","batch-mode","config-file=s","log-queries-to-file=s","check-server") || usage(); usage() if ($opt_help || $opt_Information); -$opt_suffix = '-'.$opt_suffix if (length($opt_suffix) == 0); +$opt_suffix = '-'.$opt_suffix if (length($opt_suffix) != 0); $opt_config_file = "$pwd/$opt_dir/$opt_server$opt_suffix.cfg" if (length($opt_config_file) == 0); #!!! @@ -2726,223 +2726,223 @@ sub check_reserved_words my $answer, $prompt, $config, $keyword_type; - my @keywords_type = ( "(ANSI SQL 92/99)", "(ANSI SQL 92)", "(ANSI SQL 99)", "(EXTRA)"); - my @keywords_ext = ( "ansi92/99", "ansi92", "ansi99", "extra"); + my @keywords_ext = ( "ansi-92/99", "ansi92", "ansi99", "extra"); my %reserved_words = ( - ABSOLUTE => 0, ACTION => 0, ADD => 0, - AFTER => 0, ALIAS => 0, ALL => 0, - ALLOCATE => 0, ALTER => 0, AND => 0, - ANY => 0, ARE => 0, AS => 0, - ASC => 0, ASSERTION => 0, AT => 0, - AUTHORIZATION => 0, BEFORE => 0, BEGIN => 0, - BIT => 0, BOOLEAN => 0, BOTH => 0, - BREADTH => 0, BY => 0, CALL => 0, - CASCADE => 0, CASCADED => 0, CASE => 0, - CAST => 0, CATALOG => 0, CHAR => 0, - CHARACTER => 0, CHECK => 0, CLOSE => 0, - COLLATE => 0, COLLATION => 0, COLUMN => 0, - COMMIT => 0, COMPLETION => 0, CONNECT => 0, - CONNECTION => 0, CONSTRAINT => 0, CONSTRAINTS => 0, - CONTINUE => 0, CORRESPONDING => 0, CREATE => 0, - CROSS => 0, CURRENT => 0, CURRENT_DATE => 0, - CURRENT_TIME => 0, CURRENT_TIMESTAMP => 0, CURRENT_USER => 0, - CURSOR => 0, CYCLE => 0, DATA => 0, - DATE => 0, DAY => 0, DEALLOCATE => 0, - DEC => 0, DECIMAL => 0, DECLARE => 0, - DEFAULT => 0, DEFERRABLE => 0, DEFERRED => 0, - DELETE => 0, DEPTH => 0, DESC => 0, - DESCRIBE => 0, DESCRIPTOR => 0, DIAGNOSTICS => 0, - DICTIONARY => 0, DISCONNECT => 0, DISTINCT => 0, - DOMAIN => 0, DOUBLE => 0, DROP => 0, - EACH => 0, ELSE => 0, ELSEIF => 0, - END => 0, END-EXEC => 0, EQUALS => 0, - ESCAPE => 0, EXCEPT => 0, EXCEPTION => 0, - EXEC => 0, EXECUTE => 0, EXTERNAL => 0, - FALSE => 0, FETCH => 0, FIRST => 0, - FLOAT => 0, FOR => 0, FOREIGN => 0, - FOUND => 0, FROM => 0, FULL => 0, - GENERAL => 0, GET => 0, GLOBAL => 0, - GO => 0, GOTO => 0, GRANT => 0, - GROUP => 0, HAVING => 0, HOUR => 0, - IDENTITY => 0, IF => 0, IGNORE => 0, - IMMEDIATE => 0, IN => 0, INDICATOR => 0, - INITIALLY => 0, INNER => 0, INPUT => 0, - INSERT => 0, INT => 0, INTEGER => 0, - INTERSECT => 0, INTERVAL => 0, INTO => 0, - IS => 0, ISOLATION => 0, JOIN => 0, - KEY => 0, LANGUAGE => 0, LAST => 0, - LEADING => 0, LEAVE => 0, LEFT => 0, - LESS => 0, LEVEL => 0, LIKE => 0, - LIMIT => 0, LOCAL => 0, LOOP => 0, - MATCH => 0, MINUTE => 0, MODIFY => 0, - MODULE => 0, MONTH => 0, NAMES => 0, - NATIONAL => 0, NATURAL => 0, NCHAR => 0, - NEW => 0, NEXT => 0, NO => 0, - NONE => 0, NOT => 0, NULL => 0, - NUMERIC => 0, OBJECT => 0, OF => 0, - OFF => 0, OLD => 0, ON => 0, - ONLY => 0, OPEN => 0, OPERATION => 0, - OPTION => 0, OR => 0, ORDER => 0, - OUTER => 0, OUTPUT => 0, PAD => 0, - PARAMETERS => 0, PARTIAL => 0, PRECISION => 0, - PREORDER => 0, PREPARE => 0, PRESERVE => 0, - PRIMARY => 0, PRIOR => 0, PRIVILEGES => 0, - PROCEDURE => 0, PUBLIC => 0, READ => 0, - REAL => 0, RECURSIVE => 0, REF => 0, - REFERENCES => 0, REFERENCING => 0, RELATIVE => 0, - RESIGNAL => 0, RESTRICT => 0, RETURN => 0, - RETURNS => 0, REVOKE => 0, RIGHT => 0, - ROLE => 0, ROLLBACK => 0, ROUTINE => 0, - ROW => 0, ROWS => 0, SAVEPOINT => 0, - SCHEMA => 0, SCROLL => 0, SEARCH => 0, - SECOND => 0, SECTION => 0, SELECT => 0, - SEQUENCE => 0, SESSION => 0, SESSION_USER => 0, - SET => 0, SIGNAL => 0, SIZE => 0, - SMALLINT => 0, SOME => 0, SPACE => 0, - SQL => 0, SQLEXCEPTION => 0, SQLSTATE => 0, - SQLWARNING => 0, STRUCTURE => 0, SYSTEM_USER => 0, - TABLE => 0, TEMPORARY => 0, THEN => 0, - TIME => 0, TIMESTAMP => 0, TIMEZONE_HOUR => 0, - TIMEZONE_MINUTE => 0, TO => 0, TRAILING => 0, - TRANSACTION => 0, TRANSLATION => 0, TRIGGER => 0, - TRUE => 0, UNDER => 0, UNION => 0, - UNIQUE => 0, UNKNOWN => 0, UPDATE => 0, - USAGE => 0, USER => 0, USING => 0, - VALUE => 0, VALUES => 0, VARCHAR => 0, - VARIABLE => 0, VARYING => 0, VIEW => 0, - WHEN => 0, WHENEVER => 0, WHERE => 0, - WHILE => 0, WITH => 0, WITHOUT => 0, - WORK => 0, WRITE => 0, YEAR => 0, - ZONE => 0, + 'ABSOLUTE' => 0, 'ACTION' => 0, 'ADD' => 0, + 'AFTER' => 0, 'ALIAS' => 0, 'ALL' => 0, + 'ALLOCATE' => 0, 'ALTER' => 0, 'AND' => 0, + 'ANY' => 0, 'ARE' => 0, 'AS' => 0, + 'ASC' => 0, 'ASSERTION' => 0, 'AT' => 0, + 'AUTHORIZATION' => 0, 'BEFORE' => 0, 'BEGIN' => 0, + 'BIT' => 0, 'BOOLEAN' => 0, 'BOTH' => 0, + 'BREADTH' => 0, 'BY' => 0, 'CALL' => 0, + 'CASCADE' => 0, 'CASCADED' => 0, 'CASE' => 0, + 'CAST' => 0, 'CATALOG' => 0, 'CHAR' => 0, + 'CHARACTER' => 0, 'CHECK' => 0, 'CLOSE' => 0, + 'COLLATE' => 0, 'COLLATION' => 0, 'COLUMN' => 0, + 'COMMIT' => 0, 'COMPLETION' => 0, 'CONNECT' => 0, + 'CONNECTION' => 0, 'CONSTRAINT' => 0, 'CONSTRAINTS' => 0, + 'CONTINUE' => 0, 'CORRESPONDING' => 0, 'CREATE' => 0, + 'CROSS' => 0, 'CURRENT' => 0, 'CURRENT_DATE' => 0, + 'CURRENT_TIME' => 0,'CURRENT_TIMESTAMP' => 0, 'CURRENT_USER' => 0, + 'CURSOR' => 0, 'CYCLE' => 0, 'DATA' => 0, + 'DATE' => 0, 'DAY' => 0, 'DEALLOCATE' => 0, + 'DEC' => 0, 'DECIMAL' => 0, 'DECLARE' => 0, + 'DEFAULT' => 0, 'DEFERRABLE' => 0, 'DEFERRED' => 0, + 'DELETE' => 0, 'DEPTH' => 0, 'DESC' => 0, + 'DESCRIBE' => 0, 'DESCRIPTOR' => 0, 'DIAGNOSTICS' => 0, + 'DICTIONARY' => 0, 'DISCONNECT' => 0, 'DISTINCT' => 0, + 'DOMAIN' => 0, 'DOUBLE' => 0, 'DROP' => 0, + 'EACH' => 0, 'ELSE' => 0, 'ELSEIF' => 0, + 'END' => 0, 'END-EXEC' => 0, 'EQUALS' => 0, + 'ESCAPE' => 0, 'EXCEPT' => 0, 'EXCEPTION' => 0, + 'EXEC' => 0, 'EXECUTE' => 0, 'EXTERNAL' => 0, + 'FALSE' => 0, 'FETCH' => 0, 'FIRST' => 0, + 'FLOAT' => 0, 'FOR' => 0, 'FOREIGN' => 0, + 'FOUND' => 0, 'FROM' => 0, 'FULL' => 0, + 'GENERAL' => 0, 'GET' => 0, 'GLOBAL' => 0, + 'GO' => 0, 'GOTO' => 0, 'GRANT' => 0, + 'GROUP' => 0, 'HAVING' => 0, 'HOUR' => 0, + 'IDENTITY' => 0, 'IF' => 0, 'IGNORE' => 0, + 'IMMEDIATE' => 0, 'IN' => 0, 'INDICATOR' => 0, + 'INITIALLY' => 0, 'INNER' => 0, 'INPUT' => 0, + 'INSERT' => 0, 'INT' => 0, 'INTEGER' => 0, + 'INTERSECT' => 0, 'INTERVAL' => 0, 'INTO' => 0, + 'IS' => 0, 'ISOLATION' => 0, 'JOIN' => 0, + 'KEY' => 0, 'LANGUAGE' => 0, 'LAST' => 0, + 'LEADING' => 0, 'LEAVE' => 0, 'LEFT' => 0, + 'LESS' => 0, 'LEVEL' => 0, 'LIKE' => 0, + 'LIMIT' => 0, 'LOCAL' => 0, 'LOOP' => 0, + 'MATCH' => 0, 'MINUTE' => 0, 'MODIFY' => 0, + 'MODULE' => 0, 'MONTH' => 0, 'NAMES' => 0, + 'NATIONAL' => 0, 'NATURAL' => 0, 'NCHAR' => 0, + 'NEW' => 0, 'NEXT' => 0, 'NO' => 0, + 'NONE' => 0, 'NOT' => 0, 'NULL' => 0, + 'NUMERIC' => 0, 'OBJECT' => 0, 'OF' => 0, + 'OFF' => 0, 'OLD' => 0, 'ON' => 0, + 'ONLY' => 0, 'OPEN' => 0, 'OPERATION' => 0, + 'OPTION' => 0, 'OR' => 0, 'ORDER' => 0, + 'OUTER' => 0, 'OUTPUT' => 0, 'PAD' => 0, + 'PARAMETERS' => 0, 'PARTIAL' => 0, 'PRECISION' => 0, + 'PREORDER' => 0, 'PREPARE' => 0, 'PRESERVE' => 0, + 'PRIMARY' => 0, 'PRIOR' => 0, 'PRIVILEGES' => 0, + 'PROCEDURE' => 0, 'PUBLIC' => 0, 'READ' => 0, + 'REAL' => 0, 'RECURSIVE' => 0, 'REF' => 0, + 'REFERENCES' => 0, 'REFERENCING' => 0, 'RELATIVE' => 0, + 'RESIGNAL' => 0, 'RESTRICT' => 0, 'RETURN' => 0, + 'RETURNS' => 0, 'REVOKE' => 0, 'RIGHT' => 0, + 'ROLE' => 0, 'ROLLBACK' => 0, 'ROUTINE' => 0, + 'ROW' => 0, 'ROWS' => 0, 'SAVEPOINT' => 0, + 'SCHEMA' => 0, 'SCROLL' => 0, 'SEARCH' => 0, + 'SECOND' => 0, 'SECTION' => 0, 'SELECT' => 0, + 'SEQUENCE' => 0, 'SESSION' => 0, 'SESSION_USER' => 0, + 'SET' => 0, 'SIGNAL' => 0, 'SIZE' => 0, + 'SMALLINT' => 0, 'SOME' => 0, 'SPACE' => 0, + 'SQL' => 0, 'SQLEXCEPTION' => 0, 'SQLSTATE' => 0, + 'SQLWARNING' => 0, 'STRUCTURE' => 0, 'SYSTEM_USER' => 0, + 'TABLE' => 0, 'TEMPORARY' => 0, 'THEN' => 0, + 'TIME' => 0, 'TIMESTAMP' => 0, 'TIMEZONE_HOUR' => 0, + 'TIMEZONE_MINUTE' => 0, 'TO' => 0, 'TRAILING' => 0, + 'TRANSACTION' => 0, 'TRANSLATION' => 0, 'TRIGGER' => 0, + 'TRUE' => 0, 'UNDER' => 0, 'UNION' => 0, + 'UNIQUE' => 0, 'UNKNOWN' => 0, 'UPDATE' => 0, + 'USAGE' => 0, 'USER' => 0, 'USING' => 0, + 'VALUE' => 0, 'VALUES' => 0, 'VARCHAR' => 0, + 'VARIABLE' => 0, 'VARYING' => 0, 'VIEW' => 0, + 'WHEN' => 0, 'WHENEVER' => 0, 'WHERE' => 0, + 'WHILE' => 0, 'WITH' => 0, 'WITHOUT' => 0, + 'WORK' => 0, 'WRITE' => 0, 'YEAR' => 0, + 'ZONE' => 0, - ASYNC => 1, AVG => 1, BETWEEN => 1, - BIT_LENGTH => 1, CHARACTER_LENGTH => 1, CHAR_LENGTH => 1, - COALESCE => 1, CONVERT => 1, COUNT => 1, - EXISTS => 1, EXTRACT => 1, INSENSITIVE => 1, - LOWER => 1, MAX => 1, MIN => 1, - NULLIF => 1, OCTET_LENGTH => 1, OID => 1, - OPERATORS => 1, OTHERS => 1, OVERLAPS => 1, - PENDANT => 1, POSITION => 1, PRIVATE => 1, - PROTECTED => 1, REPLACE => 1, SENSITIVE => 1, - SIMILAR => 1, SQLCODE => 1, SQLERROR => 1, - SUBSTRING => 1, SUM => 1, TEST => 1, - THERE => 1, TRANSLATE => 1, TRIM => 1, - TYPE => 1, UPPER => 1, VIRTUAL => 1, - VISIBLE => 1, WAIT => 1, + 'ASYNC' => 1, 'AVG' => 1, 'BETWEEN' => 1, + 'BIT_LENGTH' => 1,'CHARACTER_LENGTH' => 1, 'CHAR_LENGTH' => 1, + 'COALESCE' => 1, 'CONVERT' => 1, 'COUNT' => 1, + 'EXISTS' => 1, 'EXTRACT' => 1, 'INSENSITIVE' => 1, + 'LOWER' => 1, 'MAX' => 1, 'MIN' => 1, + 'NULLIF' => 1, 'OCTET_LENGTH' => 1, 'OID' => 1, + 'OPERATORS' => 1, 'OTHERS' => 1, 'OVERLAPS' => 1, + 'PENDANT' => 1, 'POSITION' => 1, 'PRIVATE' => 1, + 'PROTECTED' => 1, 'REPLACE' => 1, 'SENSITIVE' => 1, + 'SIMILAR' => 1, 'SQLCODE' => 1, 'SQLERROR' => 1, + 'SUBSTRING' => 1, 'SUM' => 1, 'TEST' => 1, + 'THERE' => 1, 'TRANSLATE' => 1, 'TRIM' => 1, + 'TYPE' => 1, 'UPPER' => 1, 'VIRTUAL' => 1, + 'VISIBLE' => 1, 'WAIT' => 1, - ADMIN => 2, AGGREGATE => 2, ARRAY => 2, - BINARY => 2, BLOB => 2, CLASS => 2, - CLOB => 2, CONDITION => 2, CONSTRUCTOR => 2, - CONTAINS => 2, CUBE => 2, CURRENT_PATH => 2, - CURRENT_ROLE => 2, DATALINK => 2, DEREF => 2, - DESTROY => 2, DESTRUCTOR => 2, DETERMINISTIC => 2, - DO => 2, DYNAMIC => 2, EVERY => 2, - EXIT => 2, EXPAND => 2, EXPANDING => 2, - FREE => 2, FUNCTION => 2, GROUPING => 2, - HANDLER => 2, HAST => 2, HOST => 2, - INITIALIZE => 2, INOUT => 2, ITERATE => 2, - LARGE => 2, LATERAL => 2, LOCALTIME => 2, - LOCALTIMESTAMP => 2, LOCATOR => 2, MEETS => 2, - MODIFIES => 2, NCLOB => 2, NORMALIZE => 2, - ORDINALITY => 2, OUT => 2, PARAMETER => 2, - PATH => 2, PERIOD => 2, POSTFIX => 2, - PRECEDES => 2, PREFIX => 2, READS => 2, - REDO => 2, REPEAT => 2, RESULT => 2, - ROLLUP => 2, SETS => 2, SPECIFIC => 2, - SPECIFICTYPE => 2, START => 2, STATE => 2, - STATIC => 2, SUCCEEDS => 2, TERMINATE => 2, - THAN => 2, TREAT => 2, UNDO => 2, - UNTIL => 2, + 'ADMIN' => 2, 'AGGREGATE' => 2, 'ARRAY' => 2, + 'BINARY' => 2, 'BLOB' => 2, 'CLASS' => 2, + 'CLOB' => 2, 'CONDITION' => 2, 'CONSTRUCTOR' => 2, + 'CONTAINS' => 2, 'CUBE' => 2, 'CURRENT_PATH' => 2, + 'CURRENT_ROLE' => 2, 'DATALINK' => 2, 'DEREF' => 2, + 'DESTROY' => 2, 'DESTRUCTOR' => 2, 'DETERMINISTIC' => 2, + 'DO' => 2, 'DYNAMIC' => 2, 'EVERY' => 2, + 'EXIT' => 2, 'EXPAND' => 2, 'EXPANDING' => 2, + 'FREE' => 2, 'FUNCTION' => 2, 'GROUPING' => 2, + 'HANDLER' => 2, 'HAST' => 2, 'HOST' => 2, + 'INITIALIZE' => 2, 'INOUT' => 2, 'ITERATE' => 2, + 'LARGE' => 2, 'LATERAL' => 2, 'LOCALTIME' => 2, + 'LOCALTIMESTAMP' => 2, 'LOCATOR' => 2, 'MEETS' => 2, + 'MODIFIES' => 2, 'NCLOB' => 2, 'NORMALIZE' => 2, + 'ORDINALITY' => 2, 'OUT' => 2, 'PARAMETER' => 2, + 'PATH' => 2, 'PERIOD' => 2, 'POSTFIX' => 2, + 'PRECEDES' => 2, 'PREFIX' => 2, 'READS' => 2, + 'REDO' => 2, 'REPEAT' => 2, 'RESULT' => 2, + 'ROLLUP' => 2, 'SETS' => 2, 'SPECIFIC' => 2, + 'SPECIFICTYPE' => 2, 'START' => 2, 'STATE' => 2, + 'STATIC' => 2, 'SUCCEEDS' => 2, 'TERMINATE' => 2, + 'THAN' => 2, 'TREAT' => 2, 'UNDO' => 2, + 'UNTIL' => 2, - ANALYZE => 3, AUTO_INCREMENT => 3, BDB => 3, - BERKELEYDB => 3, BIGINT => 3, BTREE => 3, - CHANGE => 3, COLUMNS => 3, DATABASE => 3, - DATABASES => 3, DAY_HOUR => 3, DAY_MINUTE => 3, - DAY_SECOND => 3, DELAYED => 3, DISTINCTROW => 3, - ENCLOSED => 3, ERRORS => 3, ESCAPED => 3, - EXPLAIN => 3, FIELDS => 3, FULLTEXT => 3, - GEOMETRY => 3, HASH => 3, HIGH_PRIORITY => 3, - HOUR_MINUTE => 3, HOUR_SECOND => 3, INDEX => 3, - INFILE => 3, INNODB => 3, KEYS => 3, - KILL => 3, LINES => 3, LOAD => 3, - LOCK => 3, LONG => 3, LONGBLOB => 3, - LONGTEXT => 3, LOW_PRIORITY => 3, MASTER_SERVER_ID => 3, - MEDIUMBLOB => 3, MEDIUMINT => 3, MEDIUMTEXT => 3, - MIDDLEINT => 3, MINUTE_SECOND => 3, MRG_MYISAM => 3, - OPTIMIZE => 3, OPTIONALLY => 3, OUTFILE => 3, - PURGE => 3, REGEXP => 3, RENAME => 3, - REQUIRE => 3, RLIKE => 3, RTREE => 3, - SHOW => 3, SONAME => 3, SPATIAL => 3, - SQL_BIG_RESULT => 3,SQL_CALC_FOUND_ROWS => 3, SQL_SMALL_RESULT => 3, - SSL => 3, STARTING => 3, STRAIGHT_JOIN => 3, - STRIPED => 3, TABLES => 3, TERMINATED => 3, - TINYBLOB => 3, TINYINT => 3, TINYTEXT => 3, - TYPES => 3, UNLOCK => 3, UNSIGNED => 3, - USE => 3, USER_RESOURCES => 3, VARBINARY => 3, - WARNINGS => 3, XOR => 3, YEAR_MONTH => 3, - ZEROFILL => 3, + 'ACCESS' => 3, 'ANALYZE' => 3, 'AUDIT' => 3, + 'AUTO_INCREMENT' => 3, 'BACKUP' => 3, 'BDB' => 3, + 'BERKELEYDB' => 3, 'BIGINT' => 3, 'BREAK' => 3, + 'BROWSE' => 3, 'BTREE' => 3, 'BULK' => 3, + 'CHANGE' => 3, 'CHECKPOINT' => 3, 'CLUSTER' => 3, + 'CLUSTERED' => 3, 'COLUMNS' => 3, 'COMMENT' => 3, + 'COMPRESS' => 3, 'COMPUTE' => 3, 'CONTAINSTABLE' => 3, + 'DATABASE' => 3, 'DATABASES' => 3, 'DAY_HOUR' => 3, + 'DAY_MINUTE' => 3, 'DAY_SECOND' => 3, 'DBCC' => 3, + 'DELAYED' => 3, 'DENY' => 3, 'DISK' => 3, + 'DISTINCTROW' => 3, 'DISTRIBUTED' => 3, 'DUMMY' => 3, + 'DUMP' => 3, 'ENCLOSED' => 3, 'ERRLVL' => 3, + 'ERRORS' => 3, 'ESCAPED' => 3, 'EXCLUSIVE' => 3, + 'EXPLAIN' => 3, 'FIELDS' => 3, 'FILE' => 3, + 'FILLFACTOR' => 3, 'FREETEXT' => 3, 'FREETEXTTABLE' => 3, + 'FULLTEXT' => 3, 'GEOMETRY' => 3, 'HASH' => 3, + 'HIGH_PRIORITY' => 3, 'HOLDLOCK' => 3, 'HOUR_MINUTE' => 3, + 'HOUR_SECOND' => 3, 'IDENTIFIED' => 3, 'IDENTITYCOL' => 3, + 'IDENTITY_INSERT' => 3, 'INCREMENT' => 3, 'INDEX' => 3, + 'INFILE' => 3, 'INITIAL' => 3, 'INNODB' => 3, + 'KEYS' => 3, 'KILL' => 3, 'LINENO' => 3, + 'LINES' => 3, 'LOAD' => 3, 'LOCK' => 3, + 'LONG' => 3, 'LONGBLOB' => 3, 'LONGTEXT' => 3, + 'LOW_PRIORITY' => 3, 'MASTER_SERVER_ID' => 3, 'MAXEXTENTS' => 3, + 'MEDIUMBLOB' => 3, 'MEDIUMINT' => 3, 'MEDIUMTEXT' => 3, + 'MIDDLEINT' => 3, 'MINUS' => 3, 'MINUTE_SECOND' => 3, + 'MLSLABEL' => 3, 'MODE' => 3, 'MRG_MYISAM' => 3, + 'NOAUDIT' => 3, 'NOCHECK' => 3, 'NOCOMPRESS' => 3, + 'NONCLUSTERED' => 3, 'NOWAIT' => 3, 'NUMBER' => 3, + 'OFFLINE' => 3, 'OFFSETS' => 3, 'ONLINE' => 3, + 'OPENDATASOURCE' => 3, 'OPENQUERY' => 3, 'OPENROWSET' => 3, + 'OPENXML' => 3, 'OPTIMIZE' => 3, 'OPTIONALLY' => 3, + 'OUTFILE' => 3, 'OVER' => 3, 'PCTFREE' => 3, + 'PERCENT' => 3, 'PLAN' => 3, 'PRINT' => 3, + 'PROC' => 3, 'PURGE' => 3, 'RAISERROR' => 3, + 'RAW' => 3, 'READTEXT' => 3, 'RECONFIGURE' => 3, + 'REGEXP' => 3, 'RENAME' => 3, 'REPLICATION' => 3, + 'REQUIRE' => 3, 'RESOURCE' => 3, 'RESTORE' => 3, + 'RLIKE' => 3, 'ROWCOUNT' => 3, 'ROWGUIDCOL' => 3, + 'ROWID' => 3, 'ROWNUM' => 3, 'RTREE' => 3, + 'RULE' => 3, 'SAVE' => 3, 'SETUSER' => 3, + 'SHARE' => 3, 'SHOW' => 3, 'SHUTDOWN' => 3, + 'SONAME' => 3, 'SPATIAL' => 3, 'SQL_BIG_RESULT' => 3, +'SQL_CALC_FOUND_ROWS' => 3,'SQL_SMALL_RESULT' => 3, 'SSL' => 3, + 'STARTING' => 3, 'STATISTICS' => 3, 'STRAIGHT_JOIN' => 3, + 'STRIPED' => 3, 'SUCCESSFUL' => 3, 'SYNONYM' => 3, + 'SYSDATE' => 3, 'TABLES' => 3, 'TERMINATED' => 3, + 'TEXTSIZE' => 3, 'TINYBLOB' => 3, 'TINYINT' => 3, + 'TINYTEXT' => 3, 'TOP' => 3, 'TRAN' => 3, + 'TRUNCATE' => 3, 'TSEQUAL' => 3, 'TYPES' => 3, + 'UID' => 3, 'UNLOCK' => 3, 'UNSIGNED' => 3, + 'UPDATETEXT' => 3, 'USE' => 3, 'USER_RESOURCES' => 3, + 'VALIDATE' => 3, 'VARBINARY' => 3, 'VARCHAR2' => 3, + 'WAITFOR' => 3, 'WARNINGS' => 3, 'WRITETEXT' => 3, + 'XOR' => 3, 'YEAR_MONTH' => 3, 'ZEROFILL' => 3 +); - BACKUP => 3, BREAK => 3, BROWSE => 3, - BULK => 3, CHECKPOINT => 3, CLUSTERED => 3, - COMPUTE => 3, CONTAINSTABLE => 3, DBCC => 3, - DENY => 3, DISK => 3, DISTRIBUTED => 3, - DUMMY => 3, DUMP => 3, ERRLVL => 3, - FILE => 3, FILLFACTOR => 3, FREETEXT => 3, - FREETEXTTABLE => 3, HOLDLOCK => 3, IDENTITYCOL => 3, - IDENTITY_INSERT => 3, LINENO => 3, NOCHECK => 3, - NONCLUSTERED => 3, OFFSETS => 3, OPENDATASOURCE => 3, - OPENQUERY => 3, OPENROWSET => 3, OPENXML => 3, - OVER => 3, PERCENT => 3, PLAN => 3, - PRINT => 3, PROC => 3, RAISERROR => 3, - READTEXT => 3, RECONFIGURE => 3, REPLICATION => 3, - RESTORE => 3, ROWCOUNT => 3, ROWGUIDCOL => 3, - RULE => 3, SAVE => 3, SETUSER => 3, - SHUTDOWN => 3, STATISTICS => 3, TEXTSIZE => 3, - TOP => 3, TRAN => 3, TRUNCATE => 3, - TSEQUAL => 3, UPDATETEXT => 3, WAITFOR => 3, - WRITETEXT => 3, - - ACCESS => 3, AUDIT => 3, CLUSTER => 3, - COMMENT => 3, COMPRESS => 3, EXCLUSIVE => 3, - IDENTIFIED => 3, INCREMENT => 3, INITIAL => 3, - MAXEXTENTS => 3, MINUS => 3, MLSLABEL => 3, - MODE => 3, NOAUDIT => 3, NOCOMPRESS => 3, - NOWAIT => 3, NUMBER => 3, OFFLINE => 3, - ONLINE => 3, PCTFREE => 3, RAW => 3, - RESOURCE => 3, ROWID => 3, ROWNUM => 3, - SHARE => 3, SUCCESSFUL => 3, SYNONYM => 3, - SYSDATE => 3, UID => 3, VALIDATE => 3, - VARCHAR2 => 3 - ); $dbh->do("drop table crash_me10"); - $dbh->do("create table crash_me10 (id int not null)") or warn "$dbh->errstr\n"; - $dbh->{RaiseError}= 1; - foreach my $keyword (keys %reserved_words) + foreach my $keyword (sort {$a cmp $b} keys %reserved_words) { - $keyword_type= $reserved_words{$keyword}; - $prompt= "Reserved keyword ".$keyword." ".$keywords_type[$keyword_type]; + $prompt= "Keyword ".$keyword; $config= "reserved_word_".$keywords_ext[$keyword_type]."_".lc($keyword); + $dbh->{RaiseError}= 1; + + $answer= "yes"; + eval { - $dbh->do("alter table crash_me10 add column $keyword int not null"); + $dbh->do("create table crash_me10 ($keyword int not null)"); }; - $answer= ($@) ? "yes" : "no"; + $dbh->{RaiseError}= 0; + + if (!$@) + { + $answer= "no"; + $dbh->do("drop table crash_me10"); + } save_config_data($config,$answer,$prompt); print "$prompt: ",$limits{$config},"\n"; - } - - $dbh->{RaiseError}= 0; } - + # # Do a query on a query package object. # From e6783a8785925f0e7433cd96d8f7f8b5c6d0c9a0 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 12 Dec 2002 21:01:32 +0200 Subject: [PATCH 024/220] Removed compiler warnings Fixed wrong variable name for Windows VC++Files/innobase/innobase.dsp: Don't use precompiled headers (doesn't work with samba) VC++Files/myisammrg/myisammrg.dsp: Add missing files VC++Files/mysqlbinlog/mysqlbinlog.dsp: Fixed included paths VC++Files/mysqldemb/mysqldemb.dsp: Don't use precompiled headers (doesn't work with samba) VC++Files/mysqlserver/mysqlserver.dsp: Don't use precompiled headers (doesn't work with samba) VC++Files/sql/mysqld.dsp: Fixed paths innobase/include/univ.i: Removed compiler warning myisammrg/myrg_open.c: Removed compiler warning sql/ha_myisam.cc: Removed compiler warning Fixed wrong (but not dangerous) if statement sql/ha_myisammrg.cc: Removed compiler warning sql/mysqld.cc: Fixed wrong variable name for Windows sql/sql_update.cc: Removed not used label --- VC++Files/innobase/innobase.dsp | 12 ++++++++---- VC++Files/myisammrg/myisammrg.dsp | 4 ++++ VC++Files/mysqlbinlog/mysqlbinlog.dsp | 6 +++--- VC++Files/mysqldemb/mysqldemb.dsp | 6 ++++-- VC++Files/mysqlserver/mysqlserver.dsp | 12 ++---------- VC++Files/sql/mysqld.dsp | 2 +- innobase/include/univ.i | 3 ++- myisammrg/myrg_open.c | 3 ++- sql/ha_myisam.cc | 4 ++-- sql/ha_myisammrg.cc | 2 +- sql/mysqld.cc | 2 +- sql/sql_update.cc | 2 -- 12 files changed, 30 insertions(+), 28 deletions(-) diff --git a/VC++Files/innobase/innobase.dsp b/VC++Files/innobase/innobase.dsp index a9dd33217be..0c2b656f043 100644 --- a/VC++Files/innobase/innobase.dsp +++ b/VC++Files/innobase/innobase.dsp @@ -43,7 +43,8 @@ RSC=rc.exe # PROP Intermediate_Dir "debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "__NT__" /D "WIN32" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /GX /Z7 /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "__NT__" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c +# ADD CPP /nologo /G6 /MTd /W3 /GX /Z7 /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "__NT__" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /FD /c +# SUBTRACT CPP /YX # ADD BASE RSC /l 0x416 /d "NDEBUG" # ADD RSC /l 0x416 /d "NDEBUG" BSC32=bscmake.exe @@ -66,7 +67,8 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "release" # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c +# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /FD /c +# SUBTRACT CPP /YX # ADD BASE RSC /l 0x416 /d "NDEBUG" # ADD RSC /l 0x416 /d "NDEBUG" BSC32=bscmake.exe @@ -89,7 +91,8 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "innobase___Win32_nt" # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c +# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /FD /c +# SUBTRACT CPP /YX # ADD BASE RSC /l 0x416 /d "NDEBUG" # ADD RSC /l 0x416 /d "NDEBUG" BSC32=bscmake.exe @@ -112,7 +115,8 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "innobase___Win32_Max_nt" # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c +# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /FD /c +# SUBTRACT CPP /YX # ADD BASE RSC /l 0x416 /d "NDEBUG" # ADD RSC /l 0x416 /d "NDEBUG" BSC32=bscmake.exe diff --git a/VC++Files/myisammrg/myisammrg.dsp b/VC++Files/myisammrg/myisammrg.dsp index e91d1f4e696..e8f86dac0e8 100644 --- a/VC++Files/myisammrg/myisammrg.dsp +++ b/VC++Files/myisammrg/myisammrg.dsp @@ -122,6 +122,10 @@ SOURCE=.\myrg_queue.c # End Source File # Begin Source File +SOURCE=.\myrg_range.c +# End Source File +# Begin Source File + SOURCE=.\myrg_rfirst.c # End Source File # Begin Source File diff --git a/VC++Files/mysqlbinlog/mysqlbinlog.dsp b/VC++Files/mysqlbinlog/mysqlbinlog.dsp index 5d3ff2bb090..94723b0a127 100644 --- a/VC++Files/mysqlbinlog/mysqlbinlog.dsp +++ b/VC++Files/mysqlbinlog/mysqlbinlog.dsp @@ -42,7 +42,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /I "../client" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /I "../sql" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -67,7 +67,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../" /I "../client" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c +# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../" /I "../sql" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -88,7 +88,7 @@ LINK32=link.exe # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File -SOURCE=.\mysqlbinlog.cpp +SOURCE=..\client\mysqlbinlog.cpp # End Source File # End Group # Begin Group "Header Files" diff --git a/VC++Files/mysqldemb/mysqldemb.dsp b/VC++Files/mysqldemb/mysqldemb.dsp index 7b844a68511..25dc1f6fee1 100644 --- a/VC++Files/mysqldemb/mysqldemb.dsp +++ b/VC++Files/mysqldemb/mysqldemb.dsp @@ -41,7 +41,8 @@ RSC=rc.exe # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /D "__WIN__" /YX /FD /c +# ADD CPP /nologo /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /D "__WIN__" /FD /c +# SUBTRACT CPP /YX # ADD BASE RSC /l 0x416 /d "NDEBUG" # ADD RSC /l 0x416 /d "NDEBUG" BSC32=bscmake.exe @@ -64,7 +65,8 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /D "__WIN__" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /D "__WIN__" /FD /GZ /c +# SUBTRACT CPP /YX # ADD BASE RSC /l 0x416 /d "_DEBUG" # ADD RSC /l 0x416 /d "_DEBUG" BSC32=bscmake.exe diff --git a/VC++Files/mysqlserver/mysqlserver.dsp b/VC++Files/mysqlserver/mysqlserver.dsp index 7991131c3a8..84c547ef453 100644 --- a/VC++Files/mysqlserver/mysqlserver.dsp +++ b/VC++Files/mysqlserver/mysqlserver.dsp @@ -41,7 +41,7 @@ RSC=rc.exe # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /D "MYSQL_SERVER" /D "__WIN__" /YX /FD /c +# ADD CPP /nologo /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /YX /FD /c # ADD BASE RSC /l 0x416 /d "NDEBUG" # ADD RSC /l 0x416 /d "NDEBUG" BSC32=bscmake.exe @@ -64,7 +64,7 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /YX /FD /GZ /c # ADD BASE RSC /l 0x416 /d "_DEBUG" # ADD RSC /l 0x416 /d "_DEBUG" BSC32=bscmake.exe @@ -80,13 +80,5 @@ LIB32=link.exe -lib # Name "mysqlserver - Win32 Release" # Name "mysqlserver - Win32 Debug" -# Begin Source File - -SOURCE=..\sql\set_var.cpp -# End Source File -# Begin Source File - -SOURCE=..\sql\sql_load.cpp -# End Source File # End Target # End Project diff --git a/VC++Files/sql/mysqld.dsp b/VC++Files/sql/mysqld.dsp index ac5550ad2b2..c550407da30 100644 --- a/VC++Files/sql/mysqld.dsp +++ b/VC++Files/sql/mysqld.dsp @@ -218,7 +218,7 @@ SOURCE=.\derror.cpp # End Source File # Begin Source File -SOURCE=..\client\errmsg.c +SOURCE=..\libmysql\errmsg.c # End Source File # Begin Source File diff --git a/innobase/include/univ.i b/innobase/include/univ.i index f32161fed20..43130549eae 100644 --- a/innobase/include/univ.i +++ b/innobase/include/univ.i @@ -9,7 +9,8 @@ Created 1/20/1994 Heikki Tuuri #ifndef univ_i #define univ_i -#if (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) && !defined(MYSQL_SERVER) +#if (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) && !defined(MYSQL_SERVER) && !defined(__WIN__) +#undef __WIN__ #define __WIN__ #include diff --git a/myisammrg/myrg_open.c b/myisammrg/myrg_open.c index 6a3c8dd86d9..f996277d287 100644 --- a/myisammrg/myrg_open.c +++ b/myisammrg/myrg_open.c @@ -32,7 +32,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) { - int save_errno,i,j,errpos; + int save_errno,i,errpos; uint files,dir_length,length,options, key_parts; ulonglong file_offset; char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end; @@ -113,6 +113,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) options= (uint) ~0; for (i=files ; i-- > 0 ; ) { + uint j; m_info->open_tables[i].table=isam; m_info->options|=isam->s->options; options&=isam->s->options; diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 0560afdf068..fcef1284385 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -628,7 +628,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK ¶m, bool optimize) the following 'if', thought conceptually wrong, is a useful optimization nevertheless. */ - if (file->state != &file->s->state.state); + if (file->state != &file->s->state.state) file->s->state.state = *file->state; if (file->s->base.auto_key) update_auto_increment_key(¶m, file, 1); @@ -952,7 +952,7 @@ int ha_myisam::extra(enum ha_extra_function operation) int ha_myisam::extra_opt(enum ha_extra_function operation, ulong cache_size) { - if ((specialflag & SPECIAL_SAFE_MODE) & operation == HA_EXTRA_WRITE_CACHE) + if ((specialflag & SPECIAL_SAFE_MODE) && operation == HA_EXTRA_WRITE_CACHE) return 0; return mi_extra(file, operation, (void*) &cache_size); } diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index efebeb8b46d..b043c6fd942 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -254,7 +254,7 @@ int ha_myisammrg::extra(enum ha_extra_function operation) int ha_myisammrg::extra_opt(enum ha_extra_function operation, ulong cache_size) { - if ((specialflag & SPECIAL_SAFE_MODE) & operation == HA_EXTRA_WRITE_CACHE) + if ((specialflag & SPECIAL_SAFE_MODE) && operation == HA_EXTRA_WRITE_CACHE) return 0; return myrg_extra(file, operation, (void*) &cache_size); } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 1a575932417..f18395f81d2 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2148,7 +2148,7 @@ The server will not act as a slave."); (void) thr_setconcurrency(concurrency); // 10 by default #if defined(__WIN__) && !defined(EMBEDDED_LIBRARY) //IRENA { - hEventShutdown=CreateEvent(0, FALSE, FALSE, event_name); + hEventShutdown=CreateEvent(0, FALSE, FALSE, shutdown_event_name); pthread_t hThread; if (pthread_create(&hThread,&connection_attrib,handle_shutdown,0)) sql_print_error("Warning: Can't create thread to handle shutdown requests"); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 2416a99faa8..8a349671c50 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -402,8 +402,6 @@ int mysql_multi_update(THD *thd, (ORDER *)NULL, options | SELECT_NO_JOIN_CACHE, result); - -end: delete result; DBUG_RETURN(res); } From d8a0617508abcb8d56e8889ca3166b8a5a11b8fa Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 13 Dec 2002 09:56:02 +0100 Subject: [PATCH 025/220] - added missing "test" to $NOHUP_NICENESS test (thanks to Nick Gaugler for spotting and reporting this) --- scripts/safe_mysqld.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/safe_mysqld.sh b/scripts/safe_mysqld.sh index 96568bd5d19..c2b6b8cd8b7 100644 --- a/scripts/safe_mysqld.sh +++ b/scripts/safe_mysqld.sh @@ -159,7 +159,7 @@ then NOHUP_NICENESS=`nohup nice 2>&1` if test $? -eq 0 && test x"$NOHUP_NICENESS" != x0 && nice --1 echo foo > /dev/null 2>&1 then - if $NOHUP_NICENESS -gt 0 + if test $NOHUP_NICENESS -gt 0 then $NOHUP_NICENESS="nice --$NOHUP_NICENESS nohup" else From 6a2ce08600d55898d3a4487f8d502aa3d9d988c9 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 13 Dec 2002 12:05:24 +0200 Subject: [PATCH 026/220] RESET SLAVE and CHANGE MASTER will now give an error if slave is running. This fixes a problem in replication where RESET SLAVE could crash a running slave. mysql-test/r/rpl_failsafe.result: Added missing drop mysql-test/r/rpl_log_pos.result: Added slave stop before change master mysql-test/t/rpl_log_pos.test: Added slave stop before change master sql/sql_parse.cc: reset_slave() sends it's own errors sql/sql_repl.cc: reset_slave() sends it own error. RESET SLAVE and CHANGE MASTER will now give an error if slave is running. This fixes a problem in replication where RESET SLAVE could crash a running slave. --- mysql-test/r/rpl_failsafe.result | 1 + mysql-test/r/rpl_log_pos.result | 4 ++ mysql-test/t/rpl_log_pos.test | 4 ++ sql/sql_parse.cc | 37 ++++++++++++---- sql/sql_repl.cc | 75 +++++++++++++++++++------------- 5 files changed, 82 insertions(+), 39 deletions(-) diff --git a/mysql-test/r/rpl_failsafe.result b/mysql-test/r/rpl_failsafe.result index 14b749fada9..7e8aeea64f7 100644 --- a/mysql-test/r/rpl_failsafe.result +++ b/mysql-test/r/rpl_failsafe.result @@ -1,4 +1,5 @@ slave stop; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; diff --git a/mysql-test/r/rpl_log_pos.result b/mysql-test/r/rpl_log_pos.result index 6883da76180..e76b565813f 100644 --- a/mysql-test/r/rpl_log_pos.result +++ b/mysql-test/r/rpl_log_pos.result @@ -10,7 +10,9 @@ master-bin.001 79 show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space 127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 124 +slave stop; change master to master_log_pos=73; +slave start; slave stop; change master to master_log_pos=73; show slave status; @@ -20,6 +22,7 @@ slave start; show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space 127.0.0.1 root MASTER_PORT 1 master-bin.001 73 slave-relay-bin.001 4 master-bin.001 No Yes 0 0 73 4 +slave stop; change master to master_log_pos=173; slave start; show slave status; @@ -32,6 +35,7 @@ create table if not exists t1 (n int); drop table if exists t1; create table t1 (n int); insert into t1 values (1),(2),(3); +slave stop; change master to master_log_pos=79; slave start; select * from t1; diff --git a/mysql-test/t/rpl_log_pos.test b/mysql-test/t/rpl_log_pos.test index f585fa233c5..e11ba92cfa7 100644 --- a/mysql-test/t/rpl_log_pos.test +++ b/mysql-test/t/rpl_log_pos.test @@ -8,7 +8,9 @@ connection slave; sync_with_master; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT show slave status; +slave stop; change master to master_log_pos=73; +slave start; sleep 5; slave stop; @@ -19,6 +21,7 @@ slave start; sleep 5; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT show slave status; +slave stop; change master to master_log_pos=173; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT slave start; @@ -32,6 +35,7 @@ create table t1 (n int); insert into t1 values (1),(2),(3); save_master_pos; connection slave; +slave stop; change master to master_log_pos=79; slave start; sync_with_master; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 8f1e9c37eae..bb26826b620 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1136,10 +1136,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, if (check_global_access(thd,RELOAD_ACL)) break; mysql_log.write(thd,command,NullS); - if (reload_acl_and_cache(thd, options, (TABLE_LIST*) 0)) - send_error(net,0); - else - send_eof(net); + /* error sending is deferred to reload_acl_and_cache */ + reload_acl_and_cache(thd, options, (TABLE_LIST*) 0) ; break; } case COM_SHUTDOWN: @@ -2347,10 +2345,8 @@ mysql_execute_command(void) case SQLCOM_RESET: if (check_global_access(thd,RELOAD_ACL) || check_db_used(thd, tables)) goto error; - if (reload_acl_and_cache(thd, lex->type, tables)) - send_error(&thd->net,0); - else - send_ok(&thd->net); + /* error sending is deferred to reload_acl_and_cache */ + reload_acl_and_cache(thd, lex->type, tables) ; break; case SQLCOM_KILL: kill_one_thread(thd,lex->thread_id); @@ -3332,10 +3328,15 @@ static bool check_dup(const char *db, const char *name, TABLE_LIST *tables) return 0; } + +/* + Reload/resets privileges and the different caches +*/ + bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables) { bool result=0; - + bool error_already_sent=0; select_errors=0; /* Write if more errors */ if (options & REFRESH_GRANT) { @@ -3393,11 +3394,29 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables) { LOCK_ACTIVE_MI; if (reset_slave(thd, active_mi)) + { result=1; + /* + reset_slave() sends error itself. + If it didn't, one would either change reset_slave()'s prototype, to + pass *errorcode and *errmsg to it when it's called or + change reset_slave to use my_error() to register the error. + */ + error_already_sent=1; + } UNLOCK_ACTIVE_MI; } if (options & REFRESH_USER_RESOURCES) reset_mqh(thd,(LEX_USER *) NULL); + + if (thd && !error_already_sent) + { + if (result) + send_error(&thd->net,0); + else + send_ok(&thd->net); + } + return result; } diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index ee16b84f87e..02440f511e1 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -695,20 +695,48 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report ) return 0; } + +/* + Remove all relay logs and start replication from the start + + SYNOPSIS + reset_slave() + thd Thread handler + mi Master info for the slave + + + NOTES + We don't send ok in this functions as this is called from + reload_acl_and_cache() which may have done other tasks, which may + have failed for which we want to send and error. + + RETURN + 0 ok + 1 error + In this case error is sent to the client with send_error() +*/ + + int reset_slave(THD *thd, MASTER_INFO* mi) { MY_STAT stat_area; char fname[FN_REFLEN]; - int restart_thread_mask = 0,error=0; + int thread_mask= 0, error= 0; + uint sql_errno=0; const char* errmsg=0; DBUG_ENTER("reset_slave"); lock_slave_threads(mi); - init_thread_mask(&restart_thread_mask,mi,0 /* not inverse */); - if ((error=terminate_slave_threads(mi,restart_thread_mask,1 /*skip lock*/)) - || (error=purge_relay_logs(&mi->rli, thd, - 1 /* just reset */, - &errmsg))) + init_thread_mask(&thread_mask,mi,0 /* not inverse */); + if (thread_mask) // We refuse if any slave thread is running + { + sql_errno= ER_SLAVE_MUST_STOP; + error=1; + goto err; + } + if ((error= purge_relay_logs(&mi->rli, thd, + 1 /* just reset */, + &errmsg))) goto err; end_master_info(mi); @@ -724,17 +752,15 @@ int reset_slave(THD *thd, MASTER_INFO* mi) error=1; goto err; } - if (restart_thread_mask) - error=start_slave_threads(0 /* mutex not needed */, - 1 /* wait for start*/, - mi,master_info_file,relay_log_info_file, - restart_thread_mask); - // TODO: fix error messages so they get to the client + err: unlock_slave_threads(mi); + if (thd && error) + send_error(&thd->net, sql_errno, errmsg); DBUG_RETURN(error); } + void kill_zombie_dump_threads(uint32 slave_server_id) { pthread_mutex_lock(&LOCK_thread_count); @@ -766,23 +792,20 @@ void kill_zombie_dump_threads(uint32 slave_server_id) int change_master(THD* thd, MASTER_INFO* mi) { - int error=0,restart_thread_mask; + int thread_mask; const char* errmsg=0; bool need_relay_log_purge=1; DBUG_ENTER("change_master"); - // kill slave thread lock_slave_threads(mi); - init_thread_mask(&restart_thread_mask,mi,0 /*not inverse*/); - if (restart_thread_mask && - (error=terminate_slave_threads(mi, - restart_thread_mask, - 1 /*skip lock*/))) + init_thread_mask(&thread_mask,mi,0 /*not inverse*/); + if (thread_mask) // We refuse if any slave thread is running { - send_error(&thd->net,error); + net_printf(&thd->net,ER_SLAVE_MUST_STOP); unlock_slave_threads(mi); DBUG_RETURN(1); } + thd->proc_info = "changing master"; LEX_MASTER_INFO* lex_mi = &thd->lex.mi; // TODO: see if needs re-write @@ -851,6 +874,7 @@ int change_master(THD* thd, MASTER_INFO* mi) &errmsg)) { net_printf(&thd->net, 0, "Failed purging old relay logs: %s",errmsg); + unlock_slave_threads(mi); DBUG_RETURN(1); } } @@ -881,18 +905,9 @@ int change_master(THD* thd, MASTER_INFO* mi) pthread_cond_broadcast(&mi->data_cond); pthread_mutex_unlock(&mi->rli.data_lock); - thd->proc_info = "starting slave"; - if (restart_thread_mask) - error=start_slave_threads(0 /* mutex not needed*/, - 1 /* wait for start*/, - mi,master_info_file,relay_log_info_file, - restart_thread_mask); unlock_slave_threads(mi); thd->proc_info = 0; - if (error) - send_error(&thd->net,error); - else - send_ok(&thd->net); + send_ok(&thd->net); DBUG_RETURN(0); } From 726f29f7e55d815e95bf56cb4b194302fa0c85f7 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 13 Dec 2002 13:47:25 +0100 Subject: [PATCH 027/220] - fixed another typo in NOHUP_NICENESS testing --- scripts/safe_mysqld.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/safe_mysqld.sh b/scripts/safe_mysqld.sh index c2b6b8cd8b7..67a38e49e01 100644 --- a/scripts/safe_mysqld.sh +++ b/scripts/safe_mysqld.sh @@ -161,7 +161,7 @@ then then if test $NOHUP_NICENESS -gt 0 then - $NOHUP_NICENESS="nice --$NOHUP_NICENESS nohup" + NOHUP_NICENESS="nice --$NOHUP_NICENESS nohup" else NOHUP_NICENESS="nice -$NOHUP_NICENESS nohup" fi From f84ce68116187295429174721214b809f8ef10dd Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 13 Dec 2002 16:01:51 +0200 Subject: [PATCH 028/220] Forbid SLAVE STOP if the thread executing the query has locked tables. This removes a possible deadlock situation. --- sql/sql_parse.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ddbc34b2c7e..f26be7f47e0 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1376,6 +1376,24 @@ mysql_execute_command(void) start_slave(thd); break; case SQLCOM_SLAVE_STOP: + /* + if the client thread has locked tables, a deadlock is possible. + Assume that + - the client thread does LOCK TABLE t READ. + - then the master updates t. + - then the SQL slave thread wants to update t, + so it waits for the client thread because t is locked by it. + - then the client thread does SLAVE STOP. + SLAVE STOP waits for the SQL slave thread to terminate its + update t, which waits for the client thread because t is locked by it. + To prevent that, refuse SLAVE STOP if the + client thread has locked tables + */ + if (thd->locked_tables || thd->active_transaction()) + { + send_error(&thd->net,ER_LOCK_OR_ACTIVE_TRANSACTION); + break; + } stop_slave(thd); break; From d2bae465344fcc81bb6fca940ed2025da7b52798 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 13 Dec 2002 16:28:15 +0200 Subject: [PATCH 029/220] Fixed possible replication problem in LOAD DATA INFILE with innodb tables. --- sql/sql_load.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sql/sql_load.cc b/sql/sql_load.cc index cfb12b8a5bf..6375ba46fd7 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -269,11 +269,6 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); table->time_stamp=save_time_stamp; table->next_number_field=0; - if (thd->lock) - { - mysql_unlock_tables(thd, thd->lock); - thd->lock=0; - } } if (file >= 0) my_close(file,MYF(0)); free_blobs(table); /* if pack_blob was used */ @@ -292,7 +287,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, mysql_bin_log.write(&d); } } - DBUG_RETURN(-1); // Error on read + error= -1; // Error on read + goto err; } sprintf(name,ER(ER_LOAD_INFO),info.records,info.deleted, info.records-info.copied,thd->cuted_fields); @@ -326,6 +322,13 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, } if (transactional_table) error=ha_autocommit_or_rollback(thd,error); + +err: + if (thd->lock) + { + mysql_unlock_tables(thd, thd->lock); + thd->lock=0; + } DBUG_RETURN(error); } From 094c801d9bb5899e5a0a50a9ac67bff331a42090 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 13 Dec 2002 15:42:31 +0100 Subject: [PATCH 030/220] - HP/UX 11 compile fix: fixed "records_in_range" class definition in sql/ha_myisammrg.h (removed "ha_myisammrg::") --- sql/ha_myisammrg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/ha_myisammrg.h b/sql/ha_myisammrg.h index 8e33b99e418..440b51e660f 100644 --- a/sql/ha_myisammrg.h +++ b/sql/ha_myisammrg.h @@ -69,7 +69,7 @@ class ha_myisammrg: public handler int rnd_next(byte *buf); int rnd_pos(byte * buf, byte *pos); void position(const byte *record); - ha_rows ha_myisammrg::records_in_range(int inx, + ha_rows records_in_range(int inx, const byte *start_key,uint start_key_len, enum ha_rkey_function start_search_flag, const byte *end_key,uint end_key_len, From 50d569a3ec9865a8559241e52850e48ed7000196 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 13 Dec 2002 16:38:52 +0100 Subject: [PATCH 031/220] Fixed syntax error in sql_yacc.yy (with bison 1.75). sql/sql_yacc.yy: Fixed syntax error (with bison 1.75). --- sql/sql_yacc.yy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 2eb32d16bb7..e26e57b8bbd 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1090,8 +1090,9 @@ attribute: opt_binary: /* empty */ {} - | BINARY { Lex->type|=BINARY_FLAG; }; + | BINARY { Lex->type|=BINARY_FLAG; } | CHAR_SYM SET opt_equal ident {} + ; references: REFERENCES table_ident opt_on_delete {} From 05e6b27a13b21cab3f918f425eefc559efc84a6e Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 14 Dec 2002 12:05:45 +0200 Subject: [PATCH 032/220] Transactions in AUTOCOMMIT=0 mode didn't rotate binary log. --- sql/log.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sql/log.cc b/sql/log.cc index 33c7414644a..b6c842e551d 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -807,6 +807,9 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache) log_file.pos_in_file); if (error) goto err; + + if (my_b_tell(&log_file) >= (my_off_t) max_binlog_size) + new_file(1); // inside mutex } error=0; From 697f939e2c8e4188ac180fb10b04a9f5bf035c91 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 14 Dec 2002 12:25:33 +0200 Subject: [PATCH 033/220] Make --lower-case-table-names default on MacOSX --- configure.in | 8 ++++---- sql/mysqld.cc | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/configure.in b/configure.in index 7a4498bff97..41e44a9e970 100644 --- a/configure.in +++ b/configure.in @@ -915,8 +915,8 @@ case $SYSTEM_TYPE in *darwin5*) if test "$ac_cv_prog_gcc" = "yes" then - CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH" - CXXFLAGS="$CXXFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ" + CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH -DFN_NO_CASE_SENCE" + CXXFLAGS="$CXXFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DFN_NO_CASE_SENCE" MAX_C_OPTIMIZE="-O" with_named_curses="" fi @@ -924,8 +924,8 @@ case $SYSTEM_TYPE in *darwin6*) if test "$ac_cv_prog_gcc" = "yes" then - CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH" - CXXFLAGS="$CXXFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ" + CFLAGS="$CFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH -DFN_NO_CASE_SENCE" + CXXFLAGS="$CXXFLAGS -traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DFN_NO_CASE_SENCE" MAX_C_OPTIMIZE="-O" fi ;; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 17cf8f79646..a5fc7eabe46 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2976,7 +2976,12 @@ CHANGEABLE_VAR changeable_vars[] = { { "long_query_time", (long*) &long_query_time, 10, 1, LONG_TIMEOUT, 0, 1 }, { "lower_case_table_names", (long*) &lower_case_table_names, - IF_WIN(1,0), 0, 1, 0, 1 }, +#ifdef FN_NO_CASE_SENCE + 1 +#else + 0 +#endif + ,0, 1, 0, 1 }, { "max_allowed_packet", (long*) &max_allowed_packet, 1024*1024L, 80, 64*1024*1024L, MALLOC_OVERHEAD, 1024 }, { "max_binlog_cache_size", (long*) &max_binlog_cache_size, From b512c8b83a52a7ef44e33b1b2c7e53dc64d28826 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 14 Dec 2002 12:45:31 +0200 Subject: [PATCH 034/220] Transactions in AUTOCOMMIT=0 mode didn't rotate binary log Don't enable any bulk insert or record caching code if inserting less than MIN_ROWS_TO_USE_BULK_INSERT rows (100) myisam/mi_check.c: Fixed bug in copying statistics for disabled index mysql-test/r/distinct.result: Fix result after not doing key statistics for first insert. mysql-test/r/fulltext.result: Fix result after not doing key statistics for first insert. mysql-test/r/insert.result: Fix result after not doing key statistics for first insert. mysql-test/r/key_diff.result: Fix result after not doing key statistics for first insert. mysql-test/r/order_by.result: Fix result after not doing key statistics for first insert. mysql-test/r/select.result: Fix result after not doing key statistics for first insert. mysql-test/r/show_check.result: Fix result after not doing key statistics for first insert. sql/ha_myisam.cc: Don't disable index when inserting only a few rows sql/log.cc: Transactions in AUTOCOMMIT=0 mode didn't rotate binary log. sql/sql_insert.cc: Don't enable any bulk insert or record caching code if inserting less than MIN_ROWS_TO_USE_BULK_INSERT --- myisam/mi_check.c | 14 +++++++------- mysql-test/r/distinct.result | 8 ++++---- mysql-test/r/fulltext.result | 4 ++-- mysql-test/r/insert.result | 4 ++-- mysql-test/r/key_diff.result | 2 +- mysql-test/r/order_by.result | 6 +++--- mysql-test/r/select.result | 4 ++-- mysql-test/r/show_check.result | 2 +- sql/ha_myisam.cc | 17 ++++++++++++----- sql/log.cc | 7 +++++++ sql/sql_insert.cc | 3 ++- 11 files changed, 43 insertions(+), 28 deletions(-) diff --git a/myisam/mi_check.c b/myisam/mi_check.c index b984f0e6ee6..d1165899bea 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -368,8 +368,8 @@ int chk_key(MI_CHECK *param, register MI_INFO *info) { /* Remember old statistics for key */ memcpy((char*) rec_per_key_part, - (char*) share->state.rec_per_key_part+ - (uint) (rec_per_key_part - param->rec_per_key_part), + (char*) (share->state.rec_per_key_part + + (uint) (rec_per_key_part - param->rec_per_key_part)), keyinfo->keysegs*sizeof(*rec_per_key_part)); continue; } @@ -1912,8 +1912,8 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, { /* Remember old statistics for key */ memcpy((char*) rec_per_key_part, - (char*) share->state.rec_per_key_part+ - (uint) (rec_per_key_part - param->rec_per_key_part), + (char*) (share->state.rec_per_key_part + + (uint) (rec_per_key_part - param->rec_per_key_part)), sort_param.keyinfo->keysegs*sizeof(*rec_per_key_part)); continue; } @@ -2272,8 +2272,8 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, { /* Remember old statistics for key */ memcpy((char*) rec_per_key_part, - (char*) share->state.rec_per_key_part+ - (uint) (rec_per_key_part - param->rec_per_key_part), + (char*) (share->state.rec_per_key_part+ + (uint) (rec_per_key_part - param->rec_per_key_part)), sort_param[i].keyinfo->keysegs*sizeof(*rec_per_key_part)); i--; continue; @@ -2435,7 +2435,7 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, got_error=0; if (&share->state.state != info->state) - memcpy( &share->state.state, info->state, sizeof(*info->state)); + memcpy(&share->state.state, info->state, sizeof(*info->state)); err: got_error|= flush_blocks(param,share->kfile); diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index 919478c7265..020d6c6534f 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -173,9 +173,9 @@ INSERT INTO t2 values (1),(2),(3); INSERT INTO t3 VALUES (1,'1'),(2,'2'),(1,'1'),(2,'2'); explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a; table type possible_keys key key_len ref rows Extra -t1 ALL PRIMARY NULL NULL NULL 2 Using temporary -t2 ref a a 4 t1.a 1 Using index -t3 ref a a 5 t1.b 1 Using where; Using index +t3 index a a 5 NULL 6 Using index; Using temporary +t2 index a a 4 NULL 5 Using index; Distinct +t1 eq_ref PRIMARY PRIMARY 4 t2.a 1 Using where; Distinct SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a; a 1 @@ -190,7 +190,7 @@ insert into t3 select * from t4; explain select distinct t1.a from t1,t3 where t1.a=t3.a; table type possible_keys key key_len ref rows Extra t1 index PRIMARY PRIMARY 4 NULL 2 Using index; Using temporary -t3 ref a a 5 t1.a 1 Using where; Using index; Distinct +t3 ref a a 5 t1.a 10 Using where; Using index; Distinct select distinct t1.a from t1,t3 where t1.a=t3.a; a 1 diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index fc1e0788087..edf109fcc93 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -135,8 +135,8 @@ id 3 show keys from t2; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t2 1 tig 1 ticket A 3 NULL NULL YES BTREE -t2 1 tix 1 inhalt A 1 1 NULL YES FULLTEXT +t2 1 tig 1 ticket A NULL NULL NULL YES BTREE +t2 1 tix 1 inhalt A NULL 1 NULL YES FULLTEXT show create table t2; Table Create Table t2 CREATE TABLE `t2` ( diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result index dedde4cc408..69b790ff35b 100644 --- a/mysql-test/r/insert.result +++ b/mysql-test/r/insert.result @@ -46,7 +46,7 @@ insert into t1 values ('skr',NULL),('skr',NULL),('test',NULL); select * from t1; sid id skr 1 -skr 1 +skr 2 test 1 insert into t1 values ('rts',NULL),('rts',NULL),('test',NULL); select * from t1; @@ -54,7 +54,7 @@ sid id rts 1 rts 2 skr 1 -skr 1 +skr 2 test 1 test 2 drop table t1; diff --git a/mysql-test/r/key_diff.result b/mysql-test/r/key_diff.result index f8671639e2c..4eaccc696f9 100644 --- a/mysql-test/r/key_diff.result +++ b/mysql-test/r/key_diff.result @@ -36,7 +36,7 @@ a a a a explain select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B; table type possible_keys key key_len ref rows Extra t1 ALL a NULL NULL NULL 5 -t2 ref b b 4 t1.a 1 Using where +t2 ALL b NULL NULL NULL 5 Using where select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B order by binary t1.a,t2.a; a b a b A B a a diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 62a42150eb3..48773bfa916 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -450,9 +450,9 @@ gid sid uid 103853 5 250 EXPLAIN select t1.gid, t2.sid, t3.uid from t3, t2, t1 where t2.gid = t1.gid and t2.uid = t3.uid order by t1.gid, t3.uid; table type possible_keys key key_len ref rows Extra -t3 index PRIMARY PRIMARY 2 NULL 6 Using index; Using temporary; Using filesort -t2 ref PRIMARY,uid uid 2 t3.uid 1 Using where -t1 eq_ref PRIMARY PRIMARY 4 t2.gid 1 Using index +t1 index PRIMARY PRIMARY 4 NULL 6 Using index +t2 eq_ref PRIMARY,uid PRIMARY 4 t1.gid 1 +t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 Using where; Using index EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t1.gid,t3.skr; table type possible_keys key key_len ref rows Extra t1 index PRIMARY PRIMARY 4 NULL 6 Using index diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 51cd67ac832..a921d75f20a 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -3239,8 +3239,8 @@ Field Type Null Key Default Extra Privileges show keys from t2; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE -t2 0 fld1 1 fld1 A 0 NULL NULL BTREE -t2 1 fld3 1 fld3 A 1199 NULL NULL BTREE +t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE +t2 1 fld3 1 fld3 A NULL NULL NULL BTREE drop table t4, t3, t2, t1; DO 1; DO benchmark(100,1+1),1,1; diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 70548311e26..2c32d766a38 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -9,7 +9,7 @@ Table Op Msg_type Msg_text test.t1 check status Table is already up to date check table t1 changed; Table Op Msg_type Msg_text -test.t1 check status Table is already up to date +test.t1 check status OK insert into t1 values (5,5,5); check table t1 changed; Table Op Msg_type Msg_text diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index fcef1284385..797fe97ea74 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -682,17 +682,24 @@ void ha_myisam::deactivate_non_unique_index(ha_rows rows) mi_extra(file, HA_EXTRA_NO_KEYS, 0); else { - /* Only disable old index if the table was empty */ - if (file->state->records == 0) + /* + Only disable old index if the table was empty and we are inserting + a lot of rows. + We should not do this for only a few rows as this is slower and + we don't want to update the key statistics based of only a few rows. + */ + if (file->state->records == 0 && + rows >= MI_MIN_ROWS_TO_USE_BULK_INSERT) mi_disable_non_unique_index(file,rows); else { mi_init_bulk_insert(file, - current_thd->variables.bulk_insert_buff_size, rows); - table->bulk_insert= 1; + current_thd->variables.bulk_insert_buff_size, + rows); + table->bulk_insert= 1; + } } } - } enable_activate_all_index=1; } else diff --git a/sql/log.cc b/sql/log.cc index 21c88cc1616..58f5298dad0 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1239,6 +1239,13 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache) log_file.pos_in_file))) goto err; signal_update(); + if (my_b_tell(&log_file) >= (my_off_t) max_binlog_size) + { + pthread_mutex_lock(&LOCK_index); + new_file(0); // inside mutex + pthread_mutex_unlock(&LOCK_index); + } + } VOID(pthread_mutex_unlock(&LOCK_log)); DBUG_RETURN(0); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 4d1b2e59f60..56a89e0bd1c 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -187,7 +187,8 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List &fields, thd->proc_info="update"; if (duplic == DUP_IGNORE || duplic == DUP_REPLACE) table->file->extra(HA_EXTRA_IGNORE_DUP_KEY); - if ((lock_type != TL_WRITE_DELAYED && !(specialflag & SPECIAL_SAFE_MODE))) + if ((lock_type != TL_WRITE_DELAYED && !(specialflag & SPECIAL_SAFE_MODE)) && + values_list.elements >= MIN_ROWS_TO_USE_BULK_INSERT) { table->file->extra_opt(HA_EXTRA_WRITE_CACHE, min(thd->variables.read_buff_size, From 0c8582b3c3691aedd72812721b6c6e83fc5256d8 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 14 Dec 2002 12:57:12 +0200 Subject: [PATCH 035/220] On windows, delete any conflicting 'to' files on rename(from,to) This fixes a bug with REPAIR TABLE t1 USE_FRM on windows. mysys/my_rename.c: On windows, delete any conflicting 'to' files on rename(from,to) --- mysys/my_rename.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mysys/my_rename.c b/mysys/my_rename.c index ea895ffcf76..1b7f434e792 100644 --- a/mysys/my_rename.c +++ b/mysys/my_rename.c @@ -46,6 +46,13 @@ int my_rename(const char *from, const char *to, myf MyFlags) } #endif #if defined(HAVE_RENAME) +#ifdef __WIN__ + /* + On windows we can't rename over an existing file: + Remove any conflicting files: + */ + (void) my_delete(to, MYF(0)); +#endif if (rename(from,to)) #else if (link(from, to) || unlink(from)) From 0bc6909f02abd8fc68ab90c8e7503596cf2b299e Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 14 Dec 2002 15:32:36 +0200 Subject: [PATCH 036/220] Fix for a bug with mysql_select_db() on manually created database and lower case table names. --- sql/sql_db.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 7fcda7948a2..e61a2aa60c5 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -323,6 +323,9 @@ bool mysql_change_db(THD *thd,const char *name) uint db_access; DBUG_ENTER("mysql_change_db"); + if (lower_case_table_names) + casedn_str(dbname); + if (!dbname || !(length=strip_sp(dbname))) { x_free(dbname); /* purecov: inspected */ From db4a9c8018c2e8626fa7c67d1ae08c9d90efcc4b Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 14 Dec 2002 22:38:33 +0200 Subject: [PATCH 037/220] perror.c: Add to perror the code 150 about wrong foreign key def extra/perror.c: Add to perror the code 150 about wrong foreign key def --- extra/perror.c | 1 + 1 file changed, 1 insertion(+) diff --git a/extra/perror.c b/extra/perror.c index 4d05adf29aa..e22ce467949 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -80,6 +80,7 @@ static HA_ERRORS ha_errlist[]= { 147,"Lock table is full; Restart program with a larger locktable"}, { 148,"Updates are not allowed under a read only transactions"}, { 149,"Lock deadlock; Retry transaction"}, + { 150,"Foreign key constraint is incorrectly formed"}, { -30999, "DB_INCOMPLETE: Sync didn't finish"}, { -30998, "DB_KEYEMPTY: Key/data deleted or never created"}, { -30997, "DB_KEYEXIST: The key/data pair already exists"}, From c82d6fddb94d0d69a05e846f2431ce25f9a21663 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 16 Dec 2002 17:28:53 +0200 Subject: [PATCH 038/220] Use delayed create index for LOAD DATA INFILE, INSERT ... SELECT and CREATE ... SELECT (Accidently disabled by a recent push) --- sql/ha_myisam.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 797fe97ea74..0a419879e3a 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -689,7 +689,7 @@ void ha_myisam::deactivate_non_unique_index(ha_rows rows) we don't want to update the key statistics based of only a few rows. */ if (file->state->records == 0 && - rows >= MI_MIN_ROWS_TO_USE_BULK_INSERT) + (!rows || rows >= MI_MIN_ROWS_TO_USE_BULK_INSERT)) mi_disable_non_unique_index(file,rows); else { From f1c832d3978558495975febad4e3c99c5831070f Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 16 Dec 2002 22:55:29 +0500 Subject: [PATCH 039/220] Add log lines to crash-me result file sql-bench/crash-me.sh: add tagline for emacs add log lines to result file remove wrong prompt for WEEK() sql-bench/server-cfg.sh: cleanup field conversation --- sql-bench/crash-me.sh | 384 +++++++++++++++++++++++++++++----------- sql-bench/server-cfg.sh | 25 +-- 2 files changed, 293 insertions(+), 116 deletions(-) diff --git a/sql-bench/crash-me.sh b/sql-bench/crash-me.sh index b101a7f595a..8f49da917c3 100644 --- a/sql-bench/crash-me.sh +++ b/sql-bench/crash-me.sh @@ -1,4 +1,5 @@ #!@PERL@ +# -*- perl -*- # Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB # # This library is free software; you can redistribute it and/or @@ -68,6 +69,10 @@ usage() if ($opt_help || $opt_Information); $opt_suffix = '-'.$opt_suffix if (length($opt_suffix) != 0); $opt_config_file = "$pwd/$opt_dir/$opt_server$opt_suffix.cfg" if (length($opt_config_file) == 0); +$log_prefix=' ###'; # prefix for log lines in result file +$safe_query_log=''; +$safe_query_result_log=''; +$log{"crash-me"}=""; #!!! @@ -167,11 +172,11 @@ $prompt="drop table require cascade/restrict"; $drop_attr=""; $dbh->do("drop table crash_me"); $dbh->do("drop table crash_me cascade"); -if (!safe_query(["create table crash_me (a integer not null)", +if (!safe_query_l('drop_requires_cascade',["create table crash_me (a integer not null)", "drop table crash_me"])) { $dbh->do("drop table crash_me cascade"); - if (safe_query(["create table crash_me (a integer not null)", + if (safe_query_l('drop_requires_cascade',["create table crash_me (a integer not null)", "drop table crash_me cascade"])) { save_config_data('drop_requires_cascade',"yes","$prompt"); @@ -196,10 +201,10 @@ $dbh->do("drop table crash_q $drop_attr"); $dbh->do("drop table crash_q1 $drop_attr"); $prompt="Tables without primary key"; -if (!safe_query(["create table crash_me (a integer not null,b char(10) not null)", +if (!safe_query_l('no_primary_key',["create table crash_me (a integer not null,b char(10) not null)", "insert into crash_me (a,b) values (1,'a')"])) { - if (!safe_query(["create table crash_me (a integer not null,b char(10) not null, primary key (a))", + if (!safe_query_l('no_primary_key',["create table crash_me (a integer not null,b char(10) not null, primary key (a))", "insert into crash_me (a,b) values (1,'a')"])) { die "Can't create table 'crash_me' with one record: $DBI::errstr\n"; @@ -421,9 +426,9 @@ check_and_report("Group on column with null values",'group_by_null', $prompt="Having"; if (!defined($limits{'having'})) { # Complicated because of postgreSQL - if (!safe_query_result("select a from crash_me group by a having a > 0",1,0)) + if (!safe_query_result_l("having","select a from crash_me group by a having a > 0",1,0)) { - if (!safe_query_result("select a from crash_me group by a having a < 0", + if (!safe_query_result_l("having","select a from crash_me group by a having a < 0", 1,0)) { save_config_data("having","error",$prompt); } else @@ -465,7 +470,7 @@ $logical_value= $limits{'logical_value'}; $false=0; $result="no"; -if ($res=safe_query("select (1=1)=true $end_query")) { +if ($res=safe_query_l('has_true_false',"select (1=1)=true $end_query")) { $false="false"; $result="yes"; } @@ -730,33 +735,33 @@ if (($limits{'type_extra_float(2_arg)'} eq "yes" || my $type=$limits{'type_extra_float(2_arg)'} eq "yes" ? "float(4,1)" : "decimal(4,1)"; my $result="undefined"; - if (execute_and_check(["create table crash_q (q1 $type)", + if (execute_and_check("storage_of_float",["create table crash_q (q1 $type)", "insert into crash_q values(1.14)"], "select q1 from crash_q", ["drop table crash_q $drop_attr"],1.1,0) && - execute_and_check(["create table crash_q (q1 $type)", + execute_and_check("storage_of_float",["create table crash_q (q1 $type)", "insert into crash_q values(1.16)"], "select q1 from crash_q", ["drop table crash_q $drop_attr"],1.1,0)) { $result="truncate"; } - elsif (execute_and_check(["create table crash_q (q1 $type)", + elsif (execute_and_check("storage_of_float",["create table crash_q (q1 $type)", "insert into crash_q values(1.14)"], "select q1 from crash_q", ["drop table crash_q $drop_attr"],1.1,0) && - execute_and_check(["create table crash_q (q1 $type)", + execute_and_check("storage_of_float",["create table crash_q (q1 $type)", "insert into crash_q values(1.16)"], "select q1 from crash_q", ["drop table crash_q $drop_attr"],1.2,0)) { $result="round"; } - elsif (execute_and_check(["create table crash_q (q1 $type)", + elsif (execute_and_check("storage_of_float",["create table crash_q (q1 $type)", "insert into crash_q values(1.14)"], "select q1 from crash_q", ["drop table crash_q $drop_attr"],1.14,0) && - execute_and_check(["create table crash_q (q1 $type)", + execute_and_check("storage_of_float",["create table crash_q (q1 $type)", "insert into crash_q values(1.16)"], "select q1 from crash_q", ["drop table crash_q $drop_attr"],1.16,0)) @@ -1202,6 +1207,7 @@ if ($limits{'functions'} eq 'yes') "select $tmp $end_query",[], undef(),4); } $prompt="Need to cast NULL for arithmetic"; + add_log("Need_cast_for_null"," Check if numeric_null ($numeric_null) is 'NULL'"); save_config_data("Need_cast_for_null", ($numeric_null eq "NULL") ? "no" : "yes", $prompt); @@ -1220,15 +1226,15 @@ else save_incomplete('func_extra_noround','Function NOROUND'); # 1) check if noround() function is supported - $error = safe_query("select noround(22.6) $end_query"); + $error = safe_query_l('func_extra_noround',"select noround(22.6) $end_query"); if ($error ne 1) # syntax error -- noround is not supported { $resultat = 'no' } else # Ok, now check if it really works { - $error=safe_query( "create table crash_me_nr (a int)", + $error=safe_query_l('func_extra_noround', [ "create table crash_me_nr (a int)", "insert into crash_me_nr values(noround(10.2))", - "drop table crash_me_nr $drop_attr"); + "drop table crash_me_nr $drop_attr"]); if ($error eq 1) { $resultat = "syntax only"; } else { @@ -1246,26 +1252,23 @@ check_parenthesis("func_sql_","USER"); # Test: WEEK() { - my $explain=""; my $resultat="no"; my $error; print "WEEK:"; save_incomplete('func_odbc_week','WEEK'); - $error = safe_query_result("select week(DATE '1997-02-01') $end_query",5,0); + $error = safe_query_result_l('func_odbc_week',"select week(DATE '1997-02-01') $end_query",5,0); # actually this query must return 4 or 5 in the $last_result, # $error can be 1 (not supported at all) , -1 ( probably USA weeks) # and 0 - EURO weeks if ($error == -1) { if ($last_result == 4) { $resultat = 'USA'; - $explain = ' started from Sunday'; } else { $resultat='error'; - $explain = " must return 4 or 5, but $last_error"; + add_log('func_odbc_week'," must return 4 or 5, but $last_result"); } } elsif ($error == 0) { $resultat = 'EURO'; - $explain = ' started from Monday'; } print " $resultat\n"; save_config_data('func_odbc_week',$resultat,"WEEK $explain"); @@ -1486,27 +1489,27 @@ report("index in create table",'index_in_create', # later if (!(defined($limits{'create_index'}) && defined($limits{'drop_index'}))) { - if ($res=safe_query("create index crash_q on crash_me (a)")) + if ($res=safe_query_l('create_index',"create index crash_q on crash_me (a)")) { $res="yes"; $drop_res="yes"; $end_drop_keyword=""; - if (!safe_query("drop index crash_q")) + if (!safe_query_l('drop_index',"drop index crash_q")) { # Can't drop the standard way; Check if mSQL - if (safe_query("drop index crash_q from crash_me")) + if (safe_query_l('drop_index',"drop index crash_q from crash_me")) { $drop_res="with 'FROM'"; # Drop is not ANSI SQL $end_drop_keyword="drop index %i from %t"; } # else check if Access or MySQL - elsif (safe_query("drop index crash_q on crash_me")) + elsif (safe_query_l('drop_index',"drop index crash_q on crash_me")) { $drop_res="with 'ON'"; # Drop is not ANSI SQL $end_drop_keyword="drop index %i on %t"; } # else check if MS-SQL - elsif (safe_query("drop index crash_me.crash_q")) + elsif (safe_query_l('drop_index',"drop index crash_me.crash_q")) { $drop_res="with 'table.index'"; # Drop is not ANSI SQL $end_drop_keyword="drop index %t.%i"; @@ -1516,7 +1519,7 @@ if (!(defined($limits{'create_index'}) && defined($limits{'drop_index'}))) { # Old MySQL 3.21 supports only the create index syntax # This means that the second create doesn't give an error. - $res=safe_query(["create index crash_q on crash_me (a)", + $res=safe_query_l('create_index',["create index crash_q on crash_me (a)", "create index crash_q on crash_me (a)", "drop index crash_q"]); $res= $res ? 'ignored' : 'yes'; @@ -1760,17 +1763,17 @@ report("views","views", save_incomplete('foreign_key','foreign keys'); # 1) check if foreign keys are supported - safe_query(create_table("crash_me_qf",["a integer not null"], + safe_query_l('foreign_key',create_table("crash_me_qf",["a integer not null"], ["primary key (a)"])); - $error = safe_query( create_table("crash_me_qf2",["a integer not null", + $error = safe_query_l('foreign_key', create_table("crash_me_qf2",["a integer not null", "foreign key (a) references crash_me_qf (a)"], [])); if ($error eq 1) # OK -- syntax is supported { $resultat = 'error'; # now check if foreign key really works - safe_query( "insert into crash_me_qf values (1)"); - if (safe_query( "insert into crash_me_qf2 values (2)") eq 1) { + safe_query_l('foreign_key', "insert into crash_me_qf values (1)"); + if (safe_query_l('foreign_key', "insert into crash_me_qf2 values (2)") eq 1) { $resultat = 'syntax only'; } else { $resultat = 'yes'; @@ -1779,7 +1782,7 @@ report("views","views", } else { $resultat = "no"; } - safe_query( "drop table crash_me_qf2 $drop_attr","drop table crash_me_qf $drop_attr"); + safe_query_l('foreign_key', "drop table crash_me_qf2 $drop_attr","drop table crash_me_qf $drop_attr"); print "$resultat\n"; save_config_data('foreign_key',$resultat,"foreign keys"); } @@ -2056,6 +2059,7 @@ if ($limits{'create_index'} ne 'no') if ($limits{'create_index'} eq 'ignored' || $limits{'unique_in_create'} eq 'yes') { # This should be true + add_log('max_index'," max_unique_index=$limits{'max_unique_index'} ,so max_index must be same"); save_config_data('max_index',$limits{'max_unique_index'},"max index"); print "indexes: $limits{'max_index'}\n"; } @@ -2063,10 +2067,10 @@ if ($limits{'create_index'} ne 'no') { if (!defined($limits{'max_index'})) { - assert("create table crash_q ($key_definitions)"); + safe_query_l('max_index',"create table crash_q ($key_definitions)"); for ($i=1; $i <= min($limits{'max_columns'},$max_keys) ; $i++) { - last if (!safe_query("create index crash_q$i on crash_q (q$i)")); + last if (!safe_query_l('max_index',"create index crash_q$i on crash_q (q$i)")); } save_config_data('max_index',$i == $max_keys ? $max_keys : $i, "max index"); @@ -2082,10 +2086,10 @@ if ($limits{'create_index'} ne 'no') print "indexs: $limits{'max_index'}\n"; if (!defined($limits{'max_unique_index'})) { - assert("create table crash_q ($key_definitions)"); + safe_query_l('max_unique_index',"create table crash_q ($key_definitions)"); for ($i=0; $i < min($limits{'max_columns'},$max_keys) ; $i++) { - last if (!safe_query("create unique index crash_q$i on crash_q (q$i)")); + last if (!safe_query_l('max_unique_index',"create unique index crash_q$i on crash_q (q$i)")); } save_config_data('max_unique_index',$i == $max_keys ? $max_keys : $i, "max unique index"); @@ -2101,7 +2105,7 @@ if ($limits{'create_index'} ne 'no') print "unique indexes: $limits{'max_unique_index'}\n"; if (!defined($limits{'max_index_parts'})) { - assert("create table crash_q ($key_definitions)"); + safe_query_l('max_index_parts',"create table crash_q ($key_definitions)"); $end_drop=$end_drop_keyword; $end_drop =~ s/%i/crash_q1%d/; $end_drop =~ s/%t/crash_q/; @@ -2182,23 +2186,23 @@ if (!defined($limits{$key})) { print "$prompt="; save_incomplete($key,$prompt); - if (!safe_query($server->create("crash_me_a",["a decimal(10,2)","b decimal(10,2)"]))) + if (!safe_query_l($key,$server->create("crash_me_a",["a decimal(10,2)","b decimal(10,2)"]))) { print DBI->errstr(); die "Can't create table 'crash_me_a' $DBI::errstr\n"; }; - if (!safe_query(["insert into crash_me_a (a,b) values (11.4,18.9)"])) + if (!safe_query_l($key,["insert into crash_me_a (a,b) values (11.4,18.9)"])) { die "Can't insert into table 'crash_me_a' a record: $DBI::errstr\n"; }; $arithmetic_safe = 'no'; $arithmetic_safe = 'yes' - if ( (safe_query_result('select count(*) from crash_me_a where a+b=30.3',1,0) == 0) - and (safe_query_result('select count(*) from crash_me_a where a+b-30.3 = 0',1,0) == 0) - and (safe_query_result('select count(*) from crash_me_a where a+b-30.3 < 0',0,0) == 0) - and (safe_query_result('select count(*) from crash_me_a where a+b-30.3 > 0',0,0) == 0) ); + if ( (safe_query_result_l($key,'select count(*) from crash_me_a where a+b=30.3',1,0) == 0) + and (safe_query_result_l($key,'select count(*) from crash_me_a where a+b-30.3 = 0',1,0) == 0) + and (safe_query_result_l($key,'select count(*) from crash_me_a where a+b-30.3 < 0',0,0) == 0) + and (safe_query_result_l($key,'select count(*) from crash_me_a where a+b-30.3 > 0',0,0) == 0) ); save_config_data($key,$arithmetic_safe,$prompt); print "$arithmetic_safe\n"; assert("drop table crash_me_a $drop_attr"); @@ -2214,11 +2218,12 @@ if (!safe_query($server->create("crash_me_n",["i integer","r integer"]))) print DBI->errstr(); die "Can't create table 'crash_me_n' $DBI::errstr\n"; }; -assert("insert into crash_me_n (i) values(1)"); -assert("insert into crash_me_n values(2,2)"); -assert("insert into crash_me_n values(3,3)"); -assert("insert into crash_me_n values(4,4)"); -assert("insert into crash_me_n (i) values(5)"); + +safe_query_l("position_of_null",["insert into crash_me_n (i) values(1)", +"insert into crash_me_n values(2,2)", +"insert into crash_me_n values(3,3)", +"insert into crash_me_n values(4,4)", +"insert into crash_me_n (i) values(5)"]); $key = "position_of_null"; $prompt ="Where is null values in sorted recordset"; @@ -2228,7 +2233,8 @@ if (!defined($limits{$key})) print "$prompt="; $sth=$dbh->prepare("select r from crash_me_n order by r "); $sth->execute; - $limit= detect_null_position($sth); + add_log($key,"< select r from crash_me_n order by r "); + $limit= detect_null_position($key,$sth); $sth->finish; print "$limit\n"; save_config_data($key,$limit,$prompt); @@ -2244,7 +2250,8 @@ if (!defined($limits{$key})) print "$prompt="; $sth=$dbh->prepare("select r from crash_me_n order by r desc"); $sth->execute; - $limit= detect_null_position($sth); + add_log($key,"< select r from crash_me_n order by r desc"); + $limit= detect_null_position($key,$sth); $sth->finish; print "$limit\n"; save_config_data($key,$limit,$prompt); @@ -2269,18 +2276,31 @@ $dbh->disconnect || warn $dbh->errstr; save_all_config_data(); exit 0; +# End of test +# + +$dbh->do("drop table crash_me $drop_attr"); # Remove temporary table + +print "crash-me safe: $limits{'crash_me_safe'}\n"; +print "reconnected $reconnect_count times\n"; + +$dbh->disconnect || warn $dbh->errstr; +save_all_config_data(); +exit 0; + # Check where is nulls in the sorted result (for) # it expects exactly 5 rows in the result sub detect_null_position { + my $key = shift; my $sth = shift; my ($z,$r1,$r2,$r3,$r4,$r5); - $r1 = $sth->fetchrow_array; - $r2 = $sth->fetchrow_array; - $r3 = $sth->fetchrow_array; - $r4 = $sth->fetchrow_array; - $r5 = $sth->fetchrow_array; + $r1 = $sth->fetchrow_array; add_log($key,"> $r1"); + $r2 = $sth->fetchrow_array; add_log($key,"> $r2"); + $r3 = $sth->fetchrow_array; add_log($key,"> $r3"); + $r4 = $sth->fetchrow_array; add_log($key,"> $r4"); + $r5 = $sth->fetchrow_array; add_log($key,"> $r5"); return "first" if ( !defined($r1) && !defined($r2) && defined($r3)); return "last" if ( !defined($r5) && !defined($r4) && defined($r3)); return "random"; @@ -2291,16 +2311,24 @@ sub check_parenthesis { my $fn=shift; my $resultat='no'; my $param_name=$prefix.lc($fn); + my $r; save_incomplete($param_name,$fn); - if (safe_query("select $fn $end_query") == 1) + $r = safe_query("select $fn $end_query"); + add_log($param_name,$safe_query_log); + if ($r == 1) { $resultat="yes"; } - elsif ( safe_query("select $fn() $end_query") == 1) - { - $resultat="with_parenthesis"; + else{ + $r = safe_query("select $fn() $end_query"); + add_log($param_name,$safe_query_log); + if ( $r == 1) + { + $resultat="with_parenthesis"; + } } + save_config_data($param_name,$resultat,$fn); } @@ -2313,16 +2341,22 @@ sub check_constraint { save_incomplete($key,$prompt); print "$prompt="; my $res = 'no'; - - if ( ($t=safe_query($create)) == 1) + my $t; + $t=safe_query($create); + add_log($key,$safe_query_log); + if ( $t == 1) { $res='yes'; - if (safe_query($check) == 1) + $t= safe_query($check); + add_log($key,$safe_query_log); + if ($t == 1) { $res='syntax only'; } } safe_query($drop); + add_log($key,$safe_query_log); + save_config_data($key,$res,$prompt); print "$res\n"; } @@ -2633,6 +2667,15 @@ sub check_connect # # print query if debugging # +sub repr_query { + my $query=shift; + if (length($query) > 130) + { + $query=substr($query,0,120) . "...(" . (length($query)-120) . ")"; + } + return $query; +} + sub print_query { my ($query)=@_; @@ -2652,10 +2695,19 @@ sub print_query # Note that all rows are executed (to ensure that we execute drop table commands) # +sub safe_query_l { + my $key = shift; + my $q = shift; + my $r = safe_query($q); + add_log($key,$safe_query_log); + return $r; +} + sub safe_query { my($queries)=@_; my($query,$ok,$retry_ok,$retry,@tmp,$sth); + $safe_query_log=""; $ok=1; if (ref($queries) ne "ARRAY") { @@ -2666,9 +2718,11 @@ sub safe_query { printf "query1: %-80.80s ...(%d - %d)\n",$query,length($query),$retry_limit if ($opt_log_all_queries); print LOG "$query;\n" if ($opt_log); + $safe_query_log .= "< $query\n"; if (length($query) > $query_size) { $ok=0; + $safe_query_log .= "Query is too long\n"; next; } @@ -2678,6 +2732,7 @@ sub safe_query if (! ($sth=$dbh->prepare($query))) { print_query($query); + $safe_query_log .= "> couldn't prepare:". $dbh->errstr. "\n"; $retry=100 if (!$server->abort_if_fatal_error()); # Force a reconnect because of Access drop table bug! if ($retry == $retry_limit-2) @@ -2692,6 +2747,7 @@ sub safe_query if (!$sth->execute()) { print_query($query); + $safe_query_log .= "> execute error:". $dbh->errstr. "\n"; $retry=100 if (!$server->abort_if_fatal_error()); # Force a reconnect because of Access drop table bug! if ($retry == $retry_limit-2) @@ -2705,6 +2761,8 @@ sub safe_query { $retry = $retry_limit; $retry_ok = 1; + $safe_query_log .= "> OK\n"; + } $sth->finish; } @@ -2912,7 +2970,7 @@ sub check_reserved_words ); - $dbh->do("drop table crash_me10"); + safe_query("drop table crash_me10 $drop_attr"); foreach my $keyword (sort {$a cmp $b} keys %reserved_words) { @@ -2921,28 +2979,14 @@ sub check_reserved_words $prompt= "Keyword ".$keyword; $config= "reserved_word_".$keywords_ext[$keyword_type]."_".lc($keyword); - $dbh->{RaiseError}= 1; - - $answer= "yes"; - - eval { - $dbh->do("create table crash_me10 ($keyword int not null)"); - }; - - $dbh->{RaiseError}= 0; - - if (!$@) - { - $answer= "no"; - $dbh->do("drop table crash_me10"); - } - - save_config_data($config,$answer,$prompt); - + report_fail($prompt,$config, + "create table crash_me10 ($keyword int not null)", + "drop table crash_me10 $drop_attr" + ); print "$prompt: ",$limits{$config},"\n"; } } - + # # Do a query on a query package object. # @@ -3002,7 +3046,17 @@ sub report print "$prompt: "; if (!defined($limits{$limit})) { - save_config_data($limit,safe_query(\@queries) ? "yes" : "no",$prompt); + my $queries_result = safe_query(\@queries); + add_log($limit, $safe_query_log); + my $report_result; + if ( $queries_result) { + $report_result= "yes"; + add_log($limit,"As far as all queries returned OK, result is YES"); + } else { + $report_result= "no"; + add_log($limit,"As far as some queries didnt return OK, result is NO"); + } + save_config_data($limit,$report_result,$prompt); } print "$limits{$limit}\n"; return $limits{$limit} ne "no"; @@ -3014,7 +3068,17 @@ sub report_fail print "$prompt: "; if (!defined($limits{$limit})) { - save_config_data($limit,safe_query(\@queries) ? "no" : "yes",$prompt); + my $queries_result = safe_query(\@queries); + add_log($limit, $safe_query_log); + my $report_result; + if ( $queries_result) { + $report_result= "no"; + add_log($limit,"As far as all queries returned OK, result is NO"); + } else { + $report_result= "yes"; + add_log($limit,"As far as some queries didnt return OK, result is YES"); + } + save_config_data($limit,$report_result,$prompt); } print "$limits{$limit}\n"; return $limits{$limit} ne "no"; @@ -3034,7 +3098,7 @@ sub report_one $result="no"; foreach $query (@$queries) { - if (safe_query($query->[0])) + if (safe_query_l($limit,$query->[0])) { $result= $query->[1]; last; @@ -3058,6 +3122,7 @@ sub report_result { save_incomplete($limit,$prompt); $error=safe_query_result($query,"1",2); + add_log($limit,$safe_query_result_log); save_config_data($limit,$error ? "not supported" :$last_result,$prompt); } print "$limits{$limit}\n"; @@ -3078,16 +3143,19 @@ sub report_trans $dbh->rollback; $dbh->{AutoCommit} = 1; if (safe_query_result($check,"","")) { + add_log($limit,$safe_query_result_log); save_config_data($limit,"yes",$limit); } safe_query($clear); } else { + add_log($limit,$safe_query_log); save_config_data($limit,"error",$limit); } $dbh->{AutoCommit} = 1; } else { + add_log($limit,"Couldnt undef autocommit ?? "); save_config_data($limit,"no",$limit); } safe_query($clear); @@ -3106,20 +3174,26 @@ sub report_rollback { if (safe_query(\@$queries)) { + add_log($limit,$safe_query_log); + $dbh->rollback; $dbh->{AutoCommit} = 1; if (safe_query($check)) { + add_log($limit,$safe_query_log); save_config_data($limit,"no",$limit); } else { + add_log($limit,$safe_query_log); save_config_data($limit,"yes",$limit); }; safe_query($clear); } else { + add_log($limit,$safe_query_log); save_config_data($limit,"error",$limit); } } else { + add_log($limit,'Couldnt undef Autocommit??'); save_config_data($limit,"error",$limit); } safe_query($clear); @@ -3141,8 +3215,14 @@ sub check_and_report { save_incomplete($limit,$prompt); $tmp=1-safe_query(\@$pre); - $tmp=safe_query_result($query,$answer,$string_type) if (!$tmp); + add_log($limit,$safe_query_log); + if (!$tmp) + { + $tmp=safe_query_result($query,$answer,$string_type) ; + add_log($limit,$safe_query_result_log); + }; safe_query(\@$post); + add_log($limit,$safe_query_log); delete $limits{$limit}; if ($function == 3) # Report error as 'no'. { @@ -3180,7 +3260,7 @@ sub try_and_report foreach $test (@tests) { my $tmp_type= shift(@$test); - if (safe_query(\@$test)) + if (safe_query_l($limit,\@$test)) { $type=$tmp_type; goto outer; @@ -3199,32 +3279,44 @@ sub try_and_report sub execute_and_check { - my ($pre,$query,$post,$answer,$string_type)=@_; + my ($key,$pre,$query,$post,$answer,$string_type)=@_; my ($tmp); - $tmp=safe_query(\@$pre); - $tmp=safe_query_result($query,$answer,$string_type) == 0 if ($tmp); - safe_query(\@$post); + $tmp=safe_query_l($key,\@$pre); + + $tmp=safe_query_result_l($key,$query,$answer,$string_type) == 0 if ($tmp); + safe_query_l($key,\@$post); return $tmp; } # returns 0 if ok, 1 if error, -1 if wrong answer # Sets $last_result to value of query +sub safe_query_result_l{ + my ($key,$query,$answer,$result_type)=@_; + my $r = safe_query_result($query,$answer,$result_type); + add_log($key,$safe_query_result_log); + return $r; +} sub safe_query_result { my ($query,$answer,$result_type)=@_; my ($sth,$row,$result,$retry); undef($last_result); - + $safe_query_result_log=""; + printf "\nquery3: %-80.80s\n",$query if ($opt_log_all_queries); print LOG "$query;\n" if ($opt_log); + $safe_query_result_log="<".$query."\n"; + for ($retry=0; $retry < $retry_limit ; $retry++) { if (!($sth=$dbh->prepare($query))) { print_query($query); + $safe_query_result_log .= "> prepare failed:".$dbh->errstr."\n"; + if ($server->abort_if_fatal_error()) { check_connect(); # Check that server is still up @@ -3236,6 +3328,7 @@ sub safe_query_result if (!$sth->execute) { print_query($query); + $safe_query_result_log .= "> execute failed:".$dbh->errstr."\n"; if ($server->abort_if_fatal_error()) { check_connect(); # Check that server is still up @@ -3252,6 +3345,7 @@ sub safe_query_result if (!($row=$sth->fetchrow_arrayref)) { print "\nquery: $query didn't return any result\n" if ($opt_debug); + $safe_query_result_log .= "> didn't return any result:".$dbh->errstr."\n"; $sth->finish; return ($result_type == 8) ? 0 : 1; } @@ -3262,7 +3356,7 @@ sub safe_query_result } $result=0; # Ok $last_result= $row->[0]; # Save for report_result; - + $safe_query_result_log .= ">".$last_result."\n"; # Note: # if ($result_type == 2) We accept any return value as answer @@ -3273,34 +3367,55 @@ sub safe_query_result (abs($row->[0]) + abs($answer))) > 0.01) { $result=-1; + $safe_query_result_log .= "We expected '$answer' but got '$last_result' \n"; } } elsif ($result_type == 1) # Compare where end space may differ { $row->[0] =~ s/\s+$//; - $result=-1 if ($row->[0] ne $answer); + if ($row->[0] ne $answer) + { + $result=-1; + $safe_query_result_log .= "We expected '$answer' but got '$last_result' \n"; + } ; } elsif ($result_type == 3) # This should be a exact match { - $result= -1 if ($row->[0] ne $answer); + if ($row->[0] ne $answer) + { + $result= -1; + $safe_query_result_log .= "we expected '$answer' but got '$last_result' \n"; + }; } elsif ($result_type == 4) # If results should be NULL { - $result= -1 if (defined($row->[0])); + if (defined($row->[0])) + { + $result= -1; + $safe_query_result_log .= "We expected NULL but got '$last_result' \n"; + }; } elsif ($result_type == 5) # Result should have given prefix { - $result= -1 if (length($row->[0]) < length($answer) && - substr($row->[0],1,length($answer)) ne $answer); + if (length($row->[0]) < length($answer) && + substr($row->[0],1,length($answer)) ne $answer) + { + $result= -1 ; + $safe_query_result_log .= "result must have prefix '$answer', but '$last_result' \n"; + }; } elsif ($result_type == 6) # Exact match but ignore errors { - $result= 1 if ($row->[0] ne $answer); + if ($row->[0] ne $answer) + { $result= 1; + $safe_query_result_log .= "We expected '$answer' but got '$last_result' \n"; + } ; } elsif ($result_type == 7) # Compare against array of numbers { if ($row->[0] != $answer->[0]) { + $safe_query_result_log .= "must be '$answer->[0]' \n"; $result= -1; } else @@ -3309,16 +3424,20 @@ sub safe_query_result shift @$answer; while (($row=$sth->fetchrow_arrayref)) { + $safe_query_result_log .= ">$row\n"; + $value=shift(@$answer); if (!defined($value)) { print "\nquery: $query returned to many results\n" if ($opt_debug); + $safe_query_result_log .= "It returned to many results \n"; $result= 1; last; } if ($row->[0] != $value) { + $safe_query_result_log .= "Must return $value here \n"; $result= -1; last; } @@ -3327,6 +3446,7 @@ sub safe_query_result { print "\nquery: $query returned too few results\n" if ($opt_debug); + $safe_query_result_log .= "It returned too few results \n"; $result= 1; } } @@ -3345,7 +3465,7 @@ sub safe_query_result sub find_limit() { my ($prompt,$limit,$query)=@_; - my ($first,$end,$i,$tmp); + my ($first,$end,$i,$tmp,@tmp_array, $queries); print "$prompt: "; if (defined($end=$limits{$limit})) { @@ -3353,10 +3473,30 @@ sub find_limit() return $end; } save_incomplete($limit,$prompt); + add_log($limit,"We are trying (example with N=5):"); + $queries = $query->query(5); + if (ref($queries) ne "ARRAY") + { + push(@tmp_array,$queries); + $queries= \@tmp_array; + } + foreach $tmp (@$queries) + { add_log($limit,repr_query($tmp)); } + if (defined($queries = $query->check_query())) + { + if (ref($queries) ne "ARRAY") + { + @tmp_array=(); + push(@tmp_array,$queries); + $queries= \@tmp_array; + } + foreach $tmp (@$queries) + { add_log($limit,repr_query($tmp)); } + } if (defined($query->{'init'}) && !defined($end=$limits{'restart'}{'tohigh'})) { - if (!safe_query($query->{'init'})) + if (!safe_query_l($limit,$query->{'init'})) { $query->cleanup(); return "error"; @@ -3384,7 +3524,7 @@ sub find_limit() $end= $query->max_limit(); $i=int(($end+$first)/2); } - + my $log_str = ""; unless(limit_query($query,0+$end)) { while ($first < $end) { @@ -3393,11 +3533,13 @@ sub find_limit() if (limit_query($query,$i)) { $first=$i; + $log_str .= " $i:OK"; $i=$first+int(($end-$first+1)/2); # to be a bit faster to go up } else - { + { $end=$i-1; + $log_str .= " $i:FAIL"; $i=$first+int(($end-$first+4)/5); # Prefere lower on errors } } @@ -3409,6 +3551,7 @@ sub find_limit() $end= $query->{'max_limit'}; } print "$end\n"; + add_log($limit,$log_str); save_config_data($limit,$end,$prompt); delete $limits{'restart'}; return $end; @@ -3460,6 +3603,7 @@ sub read_config_data { $limits{$key}=$limit eq "null"? undef : $limit; $prompts{$key}=length($prompt) ? substr($prompt,2) : ""; + $last_read=$key; delete $limits{'restart'}; } else @@ -3473,6 +3617,11 @@ sub read_config_data } } } + elsif (/\s*###(.*)$/) # log line + { + # add log line for previously read key + $log{$last_read} .= "$1\n"; + } elsif (!/^\s*$/ && !/^\#/) { die "Wrong config row: $_\n"; @@ -3494,6 +3643,18 @@ sub save_config_data print CONFIG_FILE "$key=$limit\t# $prompt\n"; $limits{$key}=$limit; $limit_changed=1; +# now write log lines (immediatelly after limits) + my $line; + my $last_line_was_empty=0; + foreach $line (split /\n/, $log{$key}) + { + print CONFIG_FILE " ###$line\n" + unless ( ($last_line_was_empty eq 1) + && ($line =~ /^\s+$/) ); + $last_line_was_empty= ($line =~ /^\s+$/)?1:0; + + }; + if (($opt_restart && $limits{'operating_system'} =~ /windows/i) || ($limits{'operating_system'} =~ /NT/)) { @@ -3504,6 +3665,12 @@ sub save_config_data } } +sub add_log +{ + my $key = shift; + my $line = shift; + $log{$key} .= $line . "\n"; +} sub save_all_config_data { @@ -3523,6 +3690,16 @@ sub save_all_config_data $tmp="$key=$limits{$key}"; print CONFIG_FILE $tmp . ("\t" x (int((32-min(length($tmp),32)+7)/8)+1)) . "# $prompts{$key}\n"; + my $line; + my $last_line_was_empty=0; + foreach $line (split /\n/, $log{$key}) + { + print CONFIG_FILE " ###$line\n" + unless ( ($last_line_was_empty eq 1) + && ($line =~ /^\s+$/) ); + $last_line_was_empty= ($line =~ /^\s+$/)?1:0; + + }; } close CONFIG_FILE; } @@ -3800,7 +3977,6 @@ sub new bless $self; } - sub query { my ($self,$i)=@_; diff --git a/sql-bench/server-cfg.sh b/sql-bench/server-cfg.sh index 247fd6c116d..31b8628ad79 100644 --- a/sql-bench/server-cfg.sh +++ b/sql-bench/server-cfg.sh @@ -1,4 +1,5 @@ #!@PERL@ +# -*- perl -*- # Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB # # This library is free software; you can redistribute it and/or @@ -671,9 +672,9 @@ sub create $field =~ s/int\(\d*\)/int/; $field =~ s/float\(\d*,\d*\)/float/; $field =~ s/ double/ float/; - $field =~ s/ decimal/ float/i; - $field =~ s/ big_decimal/ float/i; - $field =~ s/ date/ int/i; +# $field =~ s/ decimal/ float/i; +# $field =~ s/ big_decimal/ float/i; +# $field =~ s/ date/ int/i; # Pg doesn't have blob, it has text instead $field =~ s/ blob/ text/; $query.= $field . ','; @@ -946,9 +947,9 @@ sub create $field =~ s/ double/ float/i; # Solid doesn't have blob, it has long varchar $field =~ s/ blob/ long varchar/; - $field =~ s/ decimal/ float/i; - $field =~ s/ big_decimal/ float/i; - $field =~ s/ date/ int/i; +# $field =~ s/ decimal/ float/i; +# $field =~ s/ big_decimal/ float/i; +# $field =~ s/ date/ int/i; $query.= $field . ','; } substr($query,-1)=")"; # Remove last ','; @@ -1194,9 +1195,9 @@ sub create $field =~ s/ blob/ text/; $field =~ s/ varchar\((\d+)\)/ char($1,3)/; $field =~ s/ char\((\d+)\)/ char($1,3)/; - $field =~ s/ decimal/ float/i; - $field =~ s/ big_decimal/ longfloat/i; - $field =~ s/ date/ int/i; +# $field =~ s/ decimal/ float/i; +# $field =~ s/ big_decimal/ longfloat/i; +# $field =~ s/ date/ int/i; $field =~ s/ float(.*)/ float/i; if ($field =~ / int\((\d+)\)/) { if ($1 > 4) { @@ -2896,8 +2897,8 @@ sub create $query="create table $table_name ("; foreach $field (@$fields) { - $field =~ s/ decimal/ double(10,2)/i; - $field =~ s/ big_decimal/ double(10,2)/i; +# $field =~ s/ decimal/ double(10,2)/i; +# $field =~ s/ big_decimal/ double(10,2)/i; $field =~ s/ tinyint\(.*\)/ smallint/i; $field =~ s/ smallint\(.*\)/ smallint/i; $field =~ s/ mediumint/ integer/i; @@ -3092,7 +3093,7 @@ sub create $query="create table $table_name ("; foreach $field (@$fields) { - $field =~ s/ big_decimal/ decimal/i; +# $field =~ s/ big_decimal/ decimal/i; $field =~ s/ double/ double precision/i; $field =~ s/ tinyint/ smallint/i; $field =~ s/ mediumint/ integer/i; From e003d42e4af56c5785010f1f2426bd5bfa778ba3 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 16 Dec 2002 22:16:57 +0200 Subject: [PATCH 040/220] fix for a bug in CASE ...WHEN ... sql/sql_db.cc: fix for lower case ... --- mysql-test/r/case.result | 4 ++++ mysql-test/t/case.test | 5 +++++ sql/item_cmpfunc.cc | 2 ++ sql/sql_db.cc | 2 -- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result index 073164aa035..9ba33daaa4d 100644 --- a/mysql-test/r/case.result +++ b/mysql-test/r/case.result @@ -40,3 +40,7 @@ fcase count(*) nothing 2 one 1 two 1 +color +orange +yellow +green diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test index 79511f5f546..f2b8d42e07c 100644 --- a/mysql-test/t/case.test +++ b/mysql-test/t/case.test @@ -30,3 +30,8 @@ insert into t1 values(1),(2),(3),(4); select case a when 1 then 2 when 2 then 3 else 0 end as fcase, count(*) from t1 group by fcase; select case a when 1 then "one" when 2 then "two" else "nothing" end as fcase, count(*) from t1 group by fcase; drop table t1; +drop table if exists t; +create table t1 (row int not null, col int not null, val varchar(255) not null); +insert into t1 values (1,1,'orange'),(1,2,'large'),(2,1,'yellow'),(2,2,'medium'),(3,1,'green'),(3,2,'small'); +select max(case col when 1 then val else null end) as color from t1 group by row; +drop table if exists t; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 07704e3385f..0d10b17ad87 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -687,6 +687,8 @@ String *Item_func_case::val_str(String *str) } if (!(res=item->val_str(str))) null_value=1; + else + null_value=item->null_value; return res; } diff --git a/sql/sql_db.cc b/sql/sql_db.cc index e61a2aa60c5..338d3161bd4 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -371,8 +371,6 @@ bool mysql_change_db(THD *thd,const char *name) } send_ok(&thd->net); x_free(thd->db); - if (lower_case_table_names) - casedn_str(dbname); thd->db=dbname; thd->db_access=db_access; DBUG_RETURN(0); From 28eaef797401bbdd9f2f4e75a80f6c97628e0354 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 17 Dec 2002 20:15:15 +0200 Subject: [PATCH 041/220] A fix for a bug in fix_fields in case like this: select .. UNION select some_column; This is exhibited in sub-selects and derived tables. --- mysql-test/r/derived.result | 2 ++ mysql-test/t/derived.test | 2 ++ sql/sql_base.cc | 8 ++++++++ 3 files changed, 12 insertions(+) diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index 03e00b206b2..c4475cf7357 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -123,3 +123,5 @@ SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b; select * from (select 1 as a) b left join (select 2 as a) c using(a); a a 1 NULL +SELECT * FROM (SELECT 1 UNION SELECT a) b; +Unknown column 'a' in 'field list' diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index 5f63cea3c11..8f4ab57d6e5 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -43,3 +43,5 @@ explain select count(*) from t1 as tt1, (select * from t1) as tt2; drop table if exists t1; SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b; select * from (select 1 as a) b left join (select 2 as a) c using(a); +--error 1054 +SELECT * FROM (SELECT 1 UNION SELECT a) b; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 87cc0d616a9..ce6133392c6 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1735,6 +1735,14 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables, bool allow_rowid= tables && !tables->next; // Only one table for (; tables ; tables=tables->next) { + if (!tables->table) + { + if (report_error) + my_printf_error(ER_BAD_FIELD_ERROR,ER(ER_BAD_FIELD_ERROR),MYF(0), + item->full_name(),thd->where); + return (Field*) not_found_field; + } + Field *field=find_field_in_table(thd,tables->table,name,length, grant_option && !thd->master_access, allow_rowid); From f8601aa2c7fff7d3bb2c01517da22123a7761816 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 17 Dec 2002 21:04:37 +0200 Subject: [PATCH 042/220] beautifying the error messages --- sql/item.cc | 2 +- sql/sql_base.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/item.cc b/sql/item.cc index d05578c800a..c6b50cc8f89 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -178,7 +178,7 @@ const char *Item_ident::full_name() const char *tmp; if (!table_name) return field_name ? field_name : name ? name : "tmp_field"; - if (db_name) + if (db_name && db_name[0]) { tmp=(char*) sql_alloc((uint) strlen(db_name)+(uint) strlen(table_name)+ (uint) strlen(field_name)+3); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index ce6133392c6..e74adf5ccd3 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1707,7 +1707,7 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables, if (!found_table && report_error) { char buff[NAME_LEN*2+1]; - if (db) + if (db && db[0]) { strxnmov(buff,sizeof(buff)-1,db,".",table_name,NullS); table_name=buff; From eb377d06b60955f544c2b8f1b80d2255bae91061 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 17 Dec 2002 22:36:23 +0200 Subject: [PATCH 043/220] Fix for fix_fields in derived tables with UNION's .... --- mysql-test/r/derived.result | 4 ++++ mysql-test/t/derived.test | 4 ++++ sql/item.cc | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index c4475cf7357..f7cd45090c4 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -125,3 +125,7 @@ a a 1 NULL SELECT * FROM (SELECT 1 UNION SELECT a) b; Unknown column 'a' in 'field list' +SELECT 1 as a FROM (SELECT a UNION SELECT 1) b; +Unknown column 'a' in 'field list' +SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; +Unknown column 'a' in 'field list' diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index 8f4ab57d6e5..daa364db931 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -45,3 +45,7 @@ SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b; select * from (select 1 as a) b left join (select 2 as a) c using(a); --error 1054 SELECT * FROM (SELECT 1 UNION SELECT a) b; +--error 1054 +SELECT 1 as a FROM (SELECT a UNION SELECT 1) b; +--error 1054 +SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; diff --git a/sql/item.cc b/sql/item.cc index c6b50cc8f89..6ba22ae0b57 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -573,7 +573,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) Item **refer= (Item **)not_found_item; // Prevent using outer fields in subselects, that is not supported now SELECT_LEX *cursel=(SELECT_LEX *) thd->lex.current_select; - if (cursel->linkage != DERIVED_TABLE_TYPE) + if (cursel->master_unit()->first_select()->linkage != DERIVED_TABLE_TYPE) for (SELECT_LEX *sl=cursel->outer_select(); sl; sl= sl->outer_select()) From 65e12f2ffe2fd6f93900eba6126d24bb8edaa66c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 17 Dec 2002 23:18:19 +0200 Subject: [PATCH 044/220] fixed derived table visibility scope for derived tables with union mysql-test/r/derived.result: test of error messages mysql-test/t/derived.test: SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; --- mysql-test/r/derived.result | 4 ++++ mysql-test/t/derived.test | 4 ++++ sql/item.cc | 12 ++++++++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index 03e00b206b2..06d2e663221 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -1,3 +1,7 @@ +SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; +Unknown column 'a' in 'field list' +SELECT 1 as a FROM (SELECT a UNION SELECT 1) b; +Unknown column 'a' in 'field list' drop table if exists t1,t2,t3; CREATE TABLE t1 (a int not null, b char (10) not null); insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c'); diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index 5f63cea3c11..b9c9ab8a718 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -1,3 +1,7 @@ +-- error 1054 +SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; +-- error 1054 +SELECT 1 as a FROM (SELECT a UNION SELECT 1) b; drop table if exists t1,t2,t3; CREATE TABLE t1 (a int not null, b char (10) not null); insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c'); diff --git a/sql/item.cc b/sql/item.cc index d05578c800a..65a9422d8f1 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -573,7 +573,8 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) Item **refer= (Item **)not_found_item; // Prevent using outer fields in subselects, that is not supported now SELECT_LEX *cursel=(SELECT_LEX *) thd->lex.current_select; - if (cursel->linkage != DERIVED_TABLE_TYPE) + if (cursel->master_unit()->first_select()->linkage != + DERIVED_TABLE_TYPE) for (SELECT_LEX *sl=cursel->outer_select(); sl; sl= sl->outer_select()) @@ -586,7 +587,8 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) REPORT_EXCEPT_NOT_FOUND)) != (Item **)not_found_item) break; - if (sl->linkage == DERIVED_TABLE_TYPE) + if (sl->master_unit()->first_select()->linkage == + DERIVED_TABLE_TYPE) break; // do not look over derived table } if (!tmp) @@ -1024,7 +1026,8 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) if ((ref= find_item_in_list(this, *(thd->lex.current_select->get_item_list()), ((sl && - thd->lex.current_select->linkage != + thd->lex.current_select->master_unit()-> + first_select()->linkage != DERIVED_TABLE_TYPE) ? REPORT_EXCEPT_NOT_FOUND : REPORT_ALL_ERRORS))) == @@ -1050,7 +1053,8 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) if ((tmp= find_field_in_tables(thd, this, sl->get_table_list(), 0)) != not_found_field); - if (sl->linkage == DERIVED_TABLE_TYPE) + if (sl->master_unit()->first_select()->linkage == + DERIVED_TABLE_TYPE) break; // do not look over derived table } From 190fb8960aab98c41d746f8a42f4a1022744a31d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 18 Dec 2002 17:17:35 +0400 Subject: [PATCH 045/220] Spatial-related fixes sql/item_strfunc.cc: spatial function's fixes sql/spatial.cc: spatial type comperations are case-independent now sql/sql_string.h: this is a bit safer BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + sql/item_strfunc.cc | 22 +++++++++++++++------- sql/spatial.cc | 4 ++-- sql/sql_string.h | 2 +- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 15f884302a1..c8834a9997e 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -21,6 +21,7 @@ heikki@donna.mysql.fi heikki@hundin.mysql.fi heikki@rescue. heikki@work.mysql.com +hf@deer.mysql.r18.ru hf@genie.(none) jani@dsl-jkl1657.dial.inet.fi jani@hynda.(none) diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 473c4538ab1..0f70ca7a976 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2436,7 +2436,8 @@ General functions for spatial objects String *Item_func_geometry_from_text::val_str(String *str) { Geometry geom; - String *wkt = args[0]->val_str(str); + String arg_val; + String *wkt = args[0]->val_str(&arg_val); GTextReadStream trs(wkt->ptr(), wkt->length()); str->length(0); @@ -2454,7 +2455,8 @@ void Item_func_geometry_from_text::fix_length_and_dec() String *Item_func_as_text::val_str(String *str) { - String *wkt = args[0]->val_str(str); + String arg_val; + String *wkt = args[0]->val_str(&arg_val); Geometry geom; if ((null_value=(args[0]->null_value || @@ -2491,7 +2493,8 @@ String *Item_func_geometry_type::val_str(String *str) String *Item_func_envelope::val_str(String *str) { - String *wkb = args[0]->val_str(str); + String arg_val; + String *wkb = args[0]->val_str(&arg_val); Geometry geom; null_value = args[0]->null_value || @@ -2504,7 +2507,8 @@ String *Item_func_envelope::val_str(String *str) String *Item_func_centroid::val_str(String *str) { - String *wkb = args[0]->val_str(str); + String arg_val; + String *wkb = args[0]->val_str(&arg_val); Geometry geom; null_value = args[0]->null_value || @@ -2522,7 +2526,8 @@ String *Item_func_centroid::val_str(String *str) String *Item_func_spatial_decomp::val_str(String *str) { - String *wkb = args[0]->val_str(str); + String arg_val; + String *wkb = args[0]->val_str(&arg_val); Geometry geom; if ((null_value = (args[0]->null_value || @@ -2530,6 +2535,7 @@ String *Item_func_spatial_decomp::val_str(String *str) return 0; null_value=1; + str->length(0); switch(decomp_func) { case SP_STARTPOINT: @@ -2559,7 +2565,8 @@ ret: String *Item_func_spatial_decomp_n::val_str(String *str) { - String *wkb = args[0]->val_str(str); + String arg_val; + String *wkb = args[0]->val_str(&arg_val); long n = (long) args[1]->val_int(); Geometry geom; @@ -2639,6 +2646,7 @@ String *Item_func_point::val_str(String *str) String *Item_func_spatial_collection::val_str(String *str) { + String arg_value; uint i; null_value=1; @@ -2656,7 +2664,7 @@ String *Item_func_spatial_collection::val_str(String *str) if (args[i]->null_value) goto ret; - String *res = args[i]->val_str(str); + String *res = args[i]->val_str(&arg_value); if ( coll_type == Geometry::wkbGeometryCollection ) { diff --git a/sql/spatial.cc b/sql/spatial.cc index b21d30e4b53..1e2b9f1c512 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -44,7 +44,7 @@ static Geometry::GClassInfo ci_collection[] = IMPLEMENT_GEOM(GGeometryCollection, wkbGeometryCollection, "GEOMETRYCOLLECTION") }; -static Geometry::GClassInfo *ci_collection_end = ci_collection + sizeof(ci_collection); +static Geometry::GClassInfo *ci_collection_end = ci_collection + sizeof(ci_collection)/sizeof(ci_collection[0]); /***************************** Geometry *******************************/ @@ -66,7 +66,7 @@ Geometry::GClassInfo *Geometry::find_class(const char *name, size_t len) cur_rt < ci_collection_end; ++cur_rt) { if ((cur_rt->m_name[len] == 0) && - (strncmp(cur_rt->m_name, name, len) == 0)) + (strncasecmp(cur_rt->m_name, name, len) == 0)) { return cur_rt; } diff --git a/sql/sql_string.h b/sql/sql_string.h index d7447dd6ed6..afcc3d74530 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -225,7 +225,7 @@ public: { Ptr[str_length++] = c; } - void q_append(const uint32 &n) + void q_append(const uint32 n) { int4store(Ptr + str_length, n); str_length += 4; From 53239a714a17549863330facf3a8ea3bf74924c3 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 18 Dec 2002 19:00:00 +0200 Subject: [PATCH 046/220] Fix for found rows in multi-table updates --- mysql-test/r/multi_update.result | 10 ++++++++++ mysql-test/t/multi_update.test | 10 ++++++++++ sql/sql_update.cc | 5 ++--- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index 8cf035343b1..fe028a4cb95 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -236,3 +236,13 @@ n d 1 30 1 30 drop table t1,t2; +drop table if exists t1,t2,t3; +CREATE TABLE t1 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +INSERT INTO t1 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'),(10,''),(11,''),(12,''),(13,''); +CREATE TABLE t2 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +INSERT INTO t2 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'); +CREATE TABLE t3 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +INSERT INTO t3 VALUES (1,'jedan'),(2,'dva'); +update t1,t2 set t1.naziv="aaaa" where t1.broj=t2.broj; +update t1,t2,t3 set t1.naziv="bbbb", t2.naziv="aaaa" where t1.broj=t2.broj and t2.broj=t3.broj; +drop table if exists t1,t2,t3; diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index ff456b710c1..088b355a17c 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -214,3 +214,13 @@ UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n; select * from t1; select * from t2; drop table t1,t2; +drop table if exists t1,t2,t3; +CREATE TABLE t1 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +INSERT INTO t1 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'),(10,''),(11,''),(12,''),(13,''); +CREATE TABLE t2 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +INSERT INTO t2 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'); +CREATE TABLE t3 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +INSERT INTO t3 VALUES (1,'jedan'),(2,'dva'); +update t1,t2 set t1.naziv="aaaa" where t1.broj=t2.broj; +update t1,t2,t3 set t1.naziv="bbbb", t2.naziv="aaaa" where t1.broj=t2.broj and t2.broj=t3.broj; +drop table if exists t1,t2,t3; diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 8a349671c50..9817dcd2be5 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -614,7 +614,6 @@ bool multi_update::send_data(List ¬_used_values) TABLE_LIST *cur_table; DBUG_ENTER("multi_update::send_data"); - found++; for (cur_table= update_tables; cur_table ; cur_table= cur_table->next) { TABLE *table= cur_table->table; @@ -630,6 +629,7 @@ bool multi_update::send_data(List ¬_used_values) store_record(table,1); if (fill_record(*fields_for_table[offset], *values_for_table[offset])) DBUG_RETURN(1); + found++; if (compare_record(table, thd->query_id)) { int error; @@ -656,7 +656,7 @@ bool multi_update::send_data(List ¬_used_values) int error; TABLE *tmp_table= tmp_tables[offset]; fill_record(tmp_table->field+1, *values_for_table[offset]); - + found++; /* Store pointer to row */ memcpy((char*) tmp_table->field[0]->ptr, (char*) table->file->ref, table->file->ref_length); @@ -754,7 +754,6 @@ int multi_update::do_updates(bool from_send_error) continue; // May happen on dup key goto err; } - found++; if ((local_error= table->file->rnd_pos(table->record[0], ref_pos))) goto err; table->status|= STATUS_UPDATED; From 4debc215006816d68ea921580d3f38fc77879767 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Dec 2002 00:38:38 +0500 Subject: [PATCH 047/220] crash-me.sh: Wrap long lines, New test - date_format_inresult (returns which date format dbms uses in the result set) New tests: -date_format_ISO -date_format_ISO_with_date (checks if DBMS supports YYYY-MM-DD or DATE 'YYYY-MM-DD' formats) -date_format_EUR -date_format_EUR_with_date (the same but 'DD.MM.YYYY' format) -date_format_USA -date_format_USA_with_date ( the same but 'MM/DD/YYYY' format) -date_format_YYYYMMDD -date_format_YYYYMMDD_with_date sql-bench/crash-me.sh: Wrap long lines, New test - date_format_inresult (returns which date format dbms uses in the result set) New tests: -date_format_ISO -date_format_ISO_with_date (checks if DBMS supports YYYY-MM-DD or DATE 'YYYY-MM-DD' formats) -date_format_EUR -date_format_EUR_with_date (the same but 'DD.MM.YYYY' format) -date_format_USA -date_format_USA_with_date ( the same but 'MM/DD/YYYY' format) -date_format_YYYYMMDD -date_format_YYYYMMDD_with_date --- sql-bench/crash-me.sh | 817 +++++++++++++++++++++++++++++------------- 1 file changed, 569 insertions(+), 248 deletions(-) diff --git a/sql-bench/crash-me.sh b/sql-bench/crash-me.sh index 8f49da917c3..adea23c5884 100644 --- a/sql-bench/crash-me.sh +++ b/sql-bench/crash-me.sh @@ -64,11 +64,16 @@ $limits{'operating_system'}= machine(); $prompts{'operating_system'}='crash-me tested on'; $retry_limit=3; -GetOptions("Information","help","server=s","debug","user=s","password=s","database=s","restart","force","quick","log-all-queries","comment=s","host=s","fix-limit-file","dir=s","db-start-cmd=s","sleep=s","suffix=s","batch-mode","config-file=s","log-queries-to-file=s","check-server") || usage(); +GetOptions("Information","help","server=s","debug","user=s","password=s", +"database=s","restart","force","quick","log-all-queries","comment=s", +"host=s","fix-limit-file","dir=s","db-start-cmd=s","sleep=s","suffix=s", +"batch-mode","config-file=s","log-queries-to-file=s","check-server") + || usage(); usage() if ($opt_help || $opt_Information); $opt_suffix = '-'.$opt_suffix if (length($opt_suffix) != 0); -$opt_config_file = "$pwd/$opt_dir/$opt_server$opt_suffix.cfg" if (length($opt_config_file) == 0); +$opt_config_file = "$pwd/$opt_dir/$opt_server$opt_suffix.cfg" + if (length($opt_config_file) == 0); $log_prefix=' ###'; # prefix for log lines in result file $safe_query_log=''; $safe_query_result_log=''; @@ -121,7 +126,8 @@ if (length($opt_comment)) $opt_log=0; if (length($opt_log_queries_to_file)) { - open(LOG,">$opt_log_queries_to_file") || die "Can't open file $opt_log_queries_to_file\n"; + open(LOG,">$opt_log_queries_to_file") || + die "Can't open file $opt_log_queries_to_file\n"; $opt_log=1; } @@ -172,11 +178,13 @@ $prompt="drop table require cascade/restrict"; $drop_attr=""; $dbh->do("drop table crash_me"); $dbh->do("drop table crash_me cascade"); -if (!safe_query_l('drop_requires_cascade',["create table crash_me (a integer not null)", +if (!safe_query_l('drop_requires_cascade', + ["create table crash_me (a integer not null)", "drop table crash_me"])) { $dbh->do("drop table crash_me cascade"); - if (safe_query_l('drop_requires_cascade',["create table crash_me (a integer not null)", + if (safe_query_l('drop_requires_cascade', + ["create table crash_me (a integer not null)", "drop table crash_me cascade"])) { save_config_data('drop_requires_cascade',"yes","$prompt"); @@ -201,11 +209,14 @@ $dbh->do("drop table crash_q $drop_attr"); $dbh->do("drop table crash_q1 $drop_attr"); $prompt="Tables without primary key"; -if (!safe_query_l('no_primary_key',["create table crash_me (a integer not null,b char(10) not null)", +if (!safe_query_l('no_primary_key', + ["create table crash_me (a integer not null,b char(10) not null)", "insert into crash_me (a,b) values (1,'a')"])) { - if (!safe_query_l('no_primary_key',["create table crash_me (a integer not null,b char(10) not null, primary key (a))", - "insert into crash_me (a,b) values (1,'a')"])) + if (!safe_query_l('no_primary_key', + ["create table crash_me (a integer not null,b char(10) not null". + ", primary key (a))", + "insert into crash_me (a,b) values (1,'a')"])) { die "Can't create table 'crash_me' with one record: $DBI::errstr\n"; } @@ -328,8 +339,10 @@ try_and_report("LIMIT number of rows","select_limit", "select * from crash_me limit 1"], ["with TOP", "select TOP 1 * from crash_me"]); -report("SELECT with LIMIT #,#","select_limit2", "select * from crash_me limit 1,1"); -report("SELECT with LIMIT # OFFSET #","select_limit3", "select * from crash_me limit 1 offset 1"); +report("SELECT with LIMIT #,#","select_limit2", + "select * from crash_me limit 1,1"); +report("SELECT with LIMIT # OFFSET #", + "select_limit3", "select * from crash_me limit 1 offset 1"); # The following alter table commands MUST be kept together! if ($dbh->do("create table crash_q (a integer, b integer,c1 CHAR(10))")) @@ -351,7 +364,8 @@ if ($dbh->do("create table crash_q (a integer, b integer,c1 CHAR(10))")) "alter table crash_q alter b set default 10"); report_one("Alter table drop column",'alter_drop_col', [["alter table crash_q drop column b","yes"], - ["alter table crash_q drop column b restrict","with restrict/cascade"]]); + ["alter table crash_q drop column b restrict", + "with restrict/cascade"]]); report("Alter table rename table",'alter_rename_table', "alter table crash_q rename to crash_q1"); } @@ -373,13 +387,14 @@ report("truncate","truncate_table", "drop table crash_q $drop_attr"); if ($dbh->do("create table crash_q (a integer, b integer,c1 CHAR(10))") && - $dbh->do("create table crash_q1 (a integer, b integer,c1 CHAR(10) not null)")) + $dbh->do("create table crash_q1 (a integer, b integer,c1 CHAR(10) not null)")) { report("Alter table add constraint",'alter_add_constraint', "alter table crash_q add constraint c2 check(a > b)"); report_one("Alter table drop constraint",'alter_drop_constraint', [["alter table crash_q drop constraint c2","yes"], - ["alter table crash_q drop constraint c2 restrict","with restrict/cascade"]]); + ["alter table crash_q drop constraint c2 restrict", + "with restrict/cascade"]]); report("Alter table add unique",'alter_add_unique', "alter table crash_q add constraint u1 unique(c1)"); try_and_report("Alter table drop unique",'alter_drop_unique', @@ -395,7 +410,8 @@ if ($dbh->do("create table crash_q (a integer, b integer,c1 CHAR(10))") && ["with add primary key", "alter table crash_q1 add primary key(c1)"]); report("Alter table add foreign key",'alter_add_foreign_key', - "alter table crash_q add constraint f1 foreign key(c1) references crash_q1(c1)"); + "alter table crash_q add constraint f1 foreign key(c1)", + " references crash_q1(c1)"); try_and_report("Alter table drop foreign key",'alter_drop_foreign_key', ["with drop constraint", "alter table crash_q drop constraint f1"], @@ -426,10 +442,12 @@ check_and_report("Group on column with null values",'group_by_null', $prompt="Having"; if (!defined($limits{'having'})) { # Complicated because of postgreSQL - if (!safe_query_result_l("having","select a from crash_me group by a having a > 0",1,0)) + if (!safe_query_result_l("having", + "select a from crash_me group by a having a > 0",1,0)) { - if (!safe_query_result_l("having","select a from crash_me group by a having a < 0", - 1,0)) + if (!safe_query_result_l("having", + "select a from crash_me group by a having a < 0", + 1,0)) { save_config_data("having","error",$prompt); } else { save_config_data("having","yes",$prompt); } @@ -516,7 +534,8 @@ else if ($i == 0) { - print "Can't connect to server: $DBI::errstr. Please start it and try again\n"; + print "Can't connect to server: $DBI::errstr.". + " Please start it and try again\n"; exit 1; } $dbh=safe_connect(); @@ -549,7 +568,9 @@ if (!defined($limits{'query_size'})) } for ($i=$first ; $i < $end ; $i*=2) { - last if (!safe_query($query . (" " x ($i - length($query)-length($end_query) -1)) . "$select$end_query")); + last if (!safe_query($query . + (" " x ($i - length($query)-length($end_query) -1)) + . "$select$end_query")); $first=$i; save_config_data("restart",$i,"") if ($opt_restart); } @@ -599,7 +620,8 @@ check_reserved_words($dbh); "interval month", "interval day", "interval day to hour", "interval day to minute", "interval day to second", - "interval hour", "interval hour to minute", "interval hour to second", + "interval hour", "interval hour to minute", + "interval hour to second", "interval minute", "interval minute to second", "interval second", "national character varying(20)", @@ -664,6 +686,7 @@ foreach $types (@types) # Test some type limits # + check_and_report("Remembers end space in char()","remember_end_space", ["create table crash_q (a char(10))", "insert into crash_q values('hello ')"], @@ -679,55 +702,6 @@ check_and_report("Remembers end space in varchar()", ["drop table crash_q $drop_attr"], 'hello ',6); -check_and_report("Supports 0000-00-00 dates","date_zero", - ["create table crash_me2 (a date not null)", - "insert into crash_me2 values ('0000-00-00')"], - "select a from crash_me2", - ["drop table crash_me2 $drop_attr"], - "0000-00-00",1); - -check_and_report("Supports 0001-01-01 dates","date_one", - ["create table crash_me2 (a date not null)", - "insert into crash_me2 values (DATE '0001-01-01')"], - "select a from crash_me2", - ["drop table crash_me2 $drop_attr"], - "0001-01-01",1); - -check_and_report("Supports 9999-12-31 dates","date_last", - ["create table crash_me2 (a date not null)", - "insert into crash_me2 values (DATE '9999-12-31')"], - "select a from crash_me2", - ["drop table crash_me2 $drop_attr"], - "9999-12-31",1); - -check_and_report("Supports 'infinity dates","date_infinity", - ["create table crash_me2 (a date not null)", - "insert into crash_me2 values ('infinity')"], - "select a from crash_me2", - ["drop table crash_me2 $drop_attr"], - "infinity",1); - -if (!defined($limits{'date_with_YY'})) -{ - check_and_report("Supports YY-MM-DD dates","date_with_YY", - ["create table crash_me2 (a date not null)", - "insert into crash_me2 values ('98-03-03')"], - "select a from crash_me2", - ["drop table crash_me2 $drop_attr"], - "1998-03-03",5); - if ($limits{'date_with_YY'} eq "yes") - { - undef($limits{'date_with_YY'}); - check_and_report("Supports YY-MM-DD 2000 compilant dates", - "date_with_YY", - ["create table crash_me2 (a date not null)", - "insert into crash_me2 values ('10-03-03')"], - "select a from crash_me2", - ["drop table crash_me2 $drop_attr"], - "2010-03-03",5); - } -} - if (($limits{'type_extra_float(2_arg)'} eq "yes" || $limits{'type_sql_decimal(2_arg)'} eq "yes") && (!defined($limits{'storage_of_float'}))) @@ -775,13 +749,17 @@ if (($limits{'type_extra_float(2_arg)'} eq "yes" || try_and_report("Type for row id", "rowid", ["rowid", - "create table crash_q (a rowid)","drop table crash_q $drop_attr"], + "create table crash_q (a rowid)", + "drop table crash_q $drop_attr"], ["auto_increment", - "create table crash_q (a int not null auto_increment, primary key(a))","drop table crash_q $drop_attr"], + "create table crash_q (a int not null auto_increment". + ", primary key(a))","drop table crash_q $drop_attr"], ["oid", - "create table crash_q (a oid, primary key(a))","drop table crash_q $drop_attr"], + "create table crash_q (a oid, primary key(a))", + "drop table crash_q $drop_attr"], ["serial", - "create table crash_q (a serial, primary key(a))","drop table crash_q $drop_attr"]); + "create table crash_q (a serial, primary key(a))", + "drop table crash_q $drop_attr"]); try_and_report("Automatic row id", "automatic_rowid", ["_rowid", @@ -798,21 +776,26 @@ try_and_report("Automatic row id", "automatic_rowid", (["+, -, * and /","+","5*3-4/2+1",14,0], ["ANSI SQL SUBSTRING","substring","substring('abcd' from 2 for 2)","bc",1], ["BIT_LENGTH","bit_length","bit_length('abc')",24,0], - ["searched CASE","searched_case","case when 1 > 2 then 'false' when 2 > 1 then 'true' end", "true",1], - ["simple CASE","simple_case","case 2 when 1 then 'false' when 2 then 'true' end", "true",1], + ["searched CASE","searched_case", + "case when 1 > 2 then 'false' when 2 > 1 then 'true' end", "true",1], + ["simple CASE","simple_case", + "case 2 when 1 then 'false' when 2 then 'true' end", "true",1], ["CAST","cast","CAST(1 as CHAR)","1",1], ["CHARACTER_LENGTH","character_length","character_length('abcd')","4",0], ["CHAR_LENGTH","char_length","char_length(b)","10",0], - ["CHAR_LENGTH(constant)","char_length(constant)","char_length('abcd')","4",0], + ["CHAR_LENGTH(constant)","char_length(constant)", + "char_length('abcd')","4",0], ["COALESCE","coalesce","coalesce($char_null,'bcd','qwe')","bcd",1], ["CURRENT_DATE","current_date","current_date",0,2], ["CURRENT_TIME","current_time","current_time",0,2], ["CURRENT_TIMESTAMP","current_timestamp","current_timestamp",0,2], - ["EXTRACT","extract_sql","extract(minute from timestamp '2000-02-23 18:43:12.987')",43,0], + ["EXTRACT","extract_sql", + "extract(minute from timestamp '2000-02-23 18:43:12.987')",43,0], ["LOCALTIME","localtime","localtime",0,2], ["LOCALTIMESTAMP","localtimestamp","localtimestamp",0,2], ["LOWER","lower","LOWER('ABC')","abc",1], - ["NULLIF with strings","nullif_string","NULLIF(NULLIF('first','second'),'first')",undef(),4], + ["NULLIF with strings","nullif_string", + "NULLIF(NULLIF('first','second'),'first')",undef(),4], ["NULLIF with numbers","nullif_num","NULLIF(NULLIF(1,2),1)",undef(),4], ["OCTET_LENGTH","octet_length","octet_length('abc')",3,0], ["POSITION","position","position('ll' in 'hello')",3,0], @@ -869,14 +852,6 @@ try_and_report("Automatic row id", "automatic_rowid", ["TRUNCATE","truncate","truncate(18.18,-1)",10,0], ["NOW","now","now()",0,2], # Any value is acceptable ["CURDATE","curdate","curdate()",0,2], - ["DAYNAME","dayname","dayname(DATE '1997-02-01')","",2], - ["MONTH","month","month(DATE '1997-02-01')","",2], - ["MONTHNAME","monthname","monthname(DATE '1997-02-01')","",2], - ["DAYOFMONTH","dayofmonth","dayofmonth(DATE '1997-02-01')",1,0], - ["DAYOFWEEK","dayofweek","dayofweek(DATE '1997-02-01')",7,0], - ["DAYOFYEAR","dayofyear","dayofyear(DATE '1997-02-01')",32,0], - ["QUARTER","quarter","quarter(DATE '1997-02-01')",1,0], - ["YEAR","year","year(DATE '1997-02-01')",1997,0], ["CURTIME","curtime","curtime()",0,2], ["HOUR","hour","hour('12:13:14')",12,0], ["ANSI HOUR","hour_time","hour(TIME '12:13:14')",12,0], @@ -886,7 +861,8 @@ try_and_report("Automatic row id", "automatic_rowid", "timestampadd(SQL_TSI_SECOND,1,'1997-01-01 00:00:00')", "1997-01-01 00:00:01",1], ["TIMESTAMPDIFF","timestampdiff", - "timestampdiff(SQL_TSI_SECOND,'1997-01-01 00:00:02', '1997-01-01 00:00:01')","1",0], + "timestampdiff(SQL_TSI_SECOND,'1997-01-01 00:00:02',". + " '1997-01-01 00:00:01')","1",0], ["USER()","user()","user()",0,2], ["DATABASE","database","database()",0,2], ["IFNULL","ifnull","ifnull(2,3)",2,0], @@ -902,7 +878,6 @@ try_and_report("Automatic row id", "automatic_rowid", ["<> in SELECT","<>","1<>1","0",0], ["=","=","(1=1)",1,$logical_value], ["~* (case insensitive compare)","~*","'hi' ~* 'HI'",1,$logical_value], - ["ADD_MONTHS","add_months","add_months('1997-01-01',1)","1997-02-01",0], # oracle the date plus n months ["AND and OR in SELECT","and_or","1=1 AND 2=2",$logical_value,0], ["AND as '&&'",'&&',"1=1 && 2=2",$logical_value,0], ["ASCII_CHAR", "ascii_char", "ASCII_CHAR(65)","A",1], @@ -916,40 +891,38 @@ try_and_report("Automatic row id", "automatic_rowid", ["CONCAT(list)","concat_list", "concat('a','b','c','d')","abcd",1], ["CONVERT","convert","convert(CHAR,5)","5",1], ["COSH","cosh","cosh(0)","1",0], # oracle hyperbolic cosine of n. - ["DATEADD","dateadd","dateadd(day,3,'Nov 30 1997')",0,2], - ["DATEDIFF","datediff","datediff(month,'Oct 21 1997','Nov 30 1997')",0,2], - ["DATENAME","datename","datename(month,'Nov 30 1997')",0,2], - ["DATEPART","datepart","datepart(month,'July 20 1997')",0,2], - ["DATE_FORMAT","date_format", "date_format('1997-01-02 03:04:05','M W D Y y m d h i s w')", 0,2], ["ELT","elt","elt(2,'ONE','TWO','THREE')","TWO",1], ["ENCRYPT","encrypt","encrypt('hello')",0,2], ["FIELD","field","field('IBM','NCA','ICL','SUN','IBM','DIGITAL')",4,0], ["FORMAT","format","format(1234.5555,2)","1,234.56",1], - ["FROM_DAYS","from_days","from_days(729024)","1996-01-01",1], - ["FROM_UNIXTIME","from_unixtime","from_unixtime(0)",0,2], ["GETDATE","getdate","getdate()",0,2], - ["GREATEST","greatest","greatest('HARRY','HARRIOT','HAROLD')","HARRY",1], # oracle + ["GREATEST","greatest","greatest('HARRY','HARRIOT','HAROLD')","HARRY",1], ["IF","if", "if(5,6,7)",6,0], ["IN on numbers in SELECT","in_num","2 in (3,2,5,9,5,1)",$logical_value,0], ["IN on strings in SELECT","in_str","'monty' in ('david','monty','allan')", $logical_value,0], - ["INITCAP","initcap","initcap('the soap')","The Soap",1], # oracle Returns char, with the first letter of each word in uppercase + ["INITCAP","initcap","initcap('the soap')","The Soap",1], + # oracle Returns char, with the first letter of each word in uppercase ["INSTR (Oracle syntax)", "instr_oracle", "INSTR('CORPORATE FLOOR','OR',3,2)" ,"14",0], # oracle instring - ["INSTRB", "instrb", "INSTRB('CORPORATE FLOOR','OR',5,2)" ,"27",0], # oracle instring in bytes + ["INSTRB", "instrb", "INSTRB('CORPORATE FLOOR','OR',5,2)" ,"27",0], + # oracle instring in bytes ["INTERVAL","interval","interval(55,10,20,30,40,50,60,70,80,90,100)",5,0], - ["LAST_DAY","last_day","last_day('1997-04-01')","1997-04-30",0], # oracle last day of month of date ["LAST_INSERT_ID","last_insert_id","last_insert_id()",0,2], - ["LEAST","least","least('HARRY','HARRIOT','HAROLD')","HAROLD",1], # oracle - ["LENGTHB","lengthb","lengthb('CANDIDE')","14",0], # oracle length in bytes - ["LIKE ESCAPE in SELECT","like_escape","'%' like 'a%' escape 'a'",$logical_value,0], + ["LEAST","least","least('HARRY','HARRIOT','HAROLD')","HAROLD",1], + # oracle + ["LENGTHB","lengthb","lengthb('CANDIDE')","14",0], + # oracle length in bytes + ["LIKE ESCAPE in SELECT","like_escape", + "'%' like 'a%' escape 'a'",$logical_value,0], ["LIKE in SELECT","like","'a' like 'a%'",$logical_value,0], - ["LN","ln","ln(95)","4.55387689",0], # oracle natural logarithm of n + ["LN","ln","ln(95)","4.55387689",0], + # oracle natural logarithm of n ["LOCATE as INSTR","instr","instr('hello','ll')",3,0], - ["LOG(m,n)","log(m_n)","log(10,100)","2",0], # oracle logarithm, base m, of n - ["LOGN","logn","logn(2)","0.693147",0], # informix + ["LOG(m,n)","log(m_n)","log(10,100)","2",0], + # oracle logarithm, base m, of n + ["LOGN","logn","logn(2)","0.693147",0], + # informix ["LPAD","lpad","lpad('hi',4,'??')",'??hi',3], - ["MDY","mdy","mdy(7,1,1998)","1998-07-01",0], # informix ["MOD as %","%","10%7","3",0], - ["MONTHS_BETWEEN","months_between","months_between('1997-02-02','1997-01-01')","1.03225806",0], # oracle number of months between 2 dates ["NOT BETWEEN in SELECT","not_between","5 not between 4 and 6",0,0], ["NOT LIKE in SELECT","not_like","'a' not like 'a%'",0,0], ["NOT as '!' in SELECT","!","! 1",0,0], @@ -959,10 +932,9 @@ try_and_report("Automatic row id", "automatic_rowid", ["PASSWORD","password","password('hello')",0,2], ["PASTE", "paste", "paste('ABCDEFG',3,2,'1234')","AB1234EFG",1], ["PATINDEX","patindex","patindex('%a%','crash')",3,0], - ["PERIOD_ADD","period_add","period_add(9602,-12)",199502,0], - ["PERIOD_DIFF","period_diff","period_diff(199505,199404)",13,0], ["POW","pow","pow(3,2)",9,0], - ["RANGE","range","range(a)","0.0",0], # informix range(a) = max(a) - min(a) + ["RANGE","range","range(a)","0.0",0], + # informix range(a) = max(a) - min(a) ["REGEXP in SELECT","regexp","'a' regexp '^(a|b)*\$'",$logical_value,0], ["REPLICATE","replicate","replicate('a',5)","aaaaa",1], ["REVERSE","reverse","reverse('abcd')","dcba",1], @@ -974,23 +946,26 @@ try_and_report("Automatic row id", "automatic_rowid", ["STR","str","str(123.45,5,1)",123.5,3], ["STRCMP","strcmp","strcmp('abc','adc')",-1,0], ["STUFF","stuff","stuff('abc',2,3,'xyz')",'axyz',3], - ["SUBSTRB", "substrb", "SUBSTRB('ABCDEFG',5,4.2)" ,"CD",1], # oracle substring with bytes + ["SUBSTRB", "substrb", "SUBSTRB('ABCDEFG',5,4.2)" ,"CD",1], + # oracle substring with bytes ["SUBSTRING as MID","mid","mid('hello',3,2)","ll",1], - ["SUBSTRING_INDEX","substring_index","substring_index('www.tcx.se','.',-2)", "tcx.se",1], + ["SUBSTRING_INDEX","substring_index", + "substring_index('www.tcx.se','.',-2)", "tcx.se",1], ["SYSDATE","sysdate","sysdate()",0,2], ["TAIL","tail","tail('ABCDEFG',3)","EFG",0], - ["TANH","tanh","tanh(1)","0.462117157",0], # oracle hyperbolic tangent of n + ["TANH","tanh","tanh(1)","0.462117157",0], + # oracle hyperbolic tangent of n ["TIME_TO_SEC","time_to_sec","time_to_sec('01:23:21')","5001",0], - ["TO_DAYS","to_days","to_days(DATE '1996-01-01')",729024,0], ["TRANSLATE","translate","translate('abc','bc','de')",'ade',3], - ["TRIM; Many char extension","trim_many_char","trim(':!' FROM ':abc!')","abc",3], - ["TRIM; Substring extension","trim_substring","trim('cb' FROM 'abccb')","abc",3], + ["TRIM; Many char extension", + "trim_many_char","trim(':!' FROM ':abc!')","abc",3], + ["TRIM; Substring extension", + "trim_substring","trim('cb' FROM 'abccb')","abc",3], ["TRUNC","trunc","trunc(18.18,-1)",10,0], # oracle ["UID","uid","uid",0,2], # oracle uid from user ["UNIX_TIMESTAMP","unix_timestamp","unix_timestamp()",0,2], ["USERENV","userenv","userenv",0,2], # oracle user enviroment ["VERSION","version","version()",0,2], - ["WEEKDAY","weekday","weekday(DATE '1997-11-29')",5,0], ["automatic num->string convert","auto_num2string","concat('a',2)","a2",1], ["automatic string->num convert","auto_string2num","'1'+2",3,0], ["concatenation with +","concat_as_+","'abc' + 'def'","abcdef",1], @@ -1000,8 +975,8 @@ try_and_report("Automatic row id", "automatic_rowid", ["RFILL (3 arg)",'rfill3arg',"rfill('abcd','.',6)",'abcd..',1], ["RPAD (4 arg)",'rpad4arg',"rpad('abcd',2,'+-',8)",'abcd+-+-',1], ["LPAD (4 arg)",'rpad4arg',"lpad('abcd',2,'+-',8)",'+-+-abcd',1], - ["SAPDB compatible TRIM (1 arg)",'trim1arg',"trim(' abcd ')",'abcd',1], - ["SAPDB compatible TRIM (2 arg)",'trim2arg',"trim('..abcd..','.')",'abcd',1], + ["TRIM (1 arg)",'trim1arg',"trim(' abcd ')",'abcd',1], + ["TRIM (2 arg)",'trim2arg',"trim('..abcd..','.')",'abcd',1], ["LTRIM (2 arg)",'ltrim2arg',"ltrim('..abcd..','.')",'abcd..',1], ["RTRIM (2 arg)",'rtrim2arg',"rtrim('..abcd..','.')",'..abcd',1], ["EXPAND",'expand2arg',"expand('abcd',6)",'abcd ',0], @@ -1015,34 +990,24 @@ try_and_report("Automatic row id", "automatic_rowid", ["FLOAT",'float',"float(6666.66,4)",6667,0], ["LENGTH",'length',"length(1)",2,0], ["INDEX",'index',"index('abcdefg','cd',1,1)",3,0], - ["ADDDATE",'adddate',"ADDDATE('20021201',3)",'20021204',0], - ["SUBDATE",'subdate',"SUBDATE('20021204',3)",'20021201',0], - ["DATEDIFF (2 arg)",'datediff2arg',"DATEDIFF('20021204','20021201')",'3',0], # sapdb - ["DAYOFWEEK with sapdb internal date as arg",'dayofweek_sapdb',"DAYOFWEEK('19630816')",'5',0], - ["WEEKOFYEAR",'weekofyear',"WEEKOFYEAR('19630816')",'33',0], - ["DAYOFMONTH with sapdb internal date as arg",'dayofmonth_sapdb',"dayofmonth('19630816')",'16',0], - ["DAYOFYEAR with sapdb internal date as arg",'dayofyear_sapdb',"DAYOFYEAR('19630816')",'228',0], - ["MAKEDATE",'makedate',"MAKEDATE(1963,228)",'19630816',0], - ["DAYNAME with sapdb internal date as arg",'dayname_sapdb',"DAYNAME('19630816')",'Friday',0], - ["MONTHNAME with sapdb internal date as arg",'monthname_sapdb',"MONTHNAME('19630816')",'August',0], ["ADDTIME",'addtime',"ADDTIME('00200212','00000300')",'00200215',0], - ["SUBTIME",'subdate',"SUBDATE('00200215','00000300')",'00200212',0], + ["SUBTIME",'subtime',"SUBTIME('00200215','00000300')",'00200212',0], ["TIMEDIFF",'timediff',"TIMEDIFF('00200215','00200212')",'00000003',0], ["MAKETIME",'maketime',"MAKETIME(20,02,12)",'00200212',0], - ["YEAR with sapdb internal date as arg",'year_sapdb',"YEAR('20021201')",'2002',0], - ["MONTH with sapdb internal date as arg",'month_sapdb',"MONTH('20021201')",'12',0], - ["DAY",'day',"DAY('20021201')",1,0], - ["HOUR with sapdb internal time as arg",'hour_sapdb',"HOUR('00200212')",20,0], - ["MINUTE with sapdb internal time as arg",'minute_sapdb',"MINUTE('00200212')",2,0], - ["SECOND with sapdb internal time as arg",'second_sapdb',"SECOND('00200212')",12,0], - ["MICROSECOND",'microsecond',"MICROSECOND('19630816200212111111')",'111111',0], - ["TIMESTAMP",'timestamp',"timestamp('19630816','00200212')",'19630816200212000000',0], + ["HOUR with sapdb internal time as arg", + 'hour_sapdb',"HOUR('00200212')",20,0], + ["MINUTE with sapdb internal time as arg", + 'minute_sapdb',"MINUTE('00200212')",2,0], + ["SECOND with sapdb internal time as arg", + 'second_sapdb',"SECOND('00200212')",12,0], + ["MICROSECOND",'microsecond', + "MICROSECOND('19630816200212111111')",'111111',0], + ["TIMESTAMP",'timestamp', + "timestamp('19630816','00200212')",'19630816200212000000',0], ["TIME",'time',"time('00200212')",'00200212',0], - ["DATE",'date',"date('19630816')",'19630816',0], ["VALUE",'value',"value(NULL,'WALRUS')",'WALRUS',0], ["DECODE",'decode',"DECODE('S-103','T72',1,'S-103',2,'Leopard',3)",2,0], ["NUM",'num',"NUM('2123')",2123,0], - ["CHAR (conversation date)",'char_date',"CHAR(DATE('19630816'),EUR)",'16.08.1963',0], ["CHR (any type to string)",'chr_str',"CHR(67)",'67',0], ["HEX",'hex',"HEX('A')",41,0], ); @@ -1068,7 +1033,8 @@ try_and_report("Automatic row id", "automatic_rowid", ( ["BIT_AND",'bit_and',"bit_and(a)",1,0], ["BIT_OR", 'bit_or', "bit_or(a)",1,0], - ["COUNT(DISTINCT expr,expr,...)","count_distinct_list","count(distinct a,b)",1,0], + ["COUNT(DISTINCT expr,expr,...)", + "count_distinct_list","count(distinct a,b)",1,0], ["STD","std","std(a)",0,0], ["STDDEV","stddev","stddev(a)",0,0], ["VARIANCE","variance","variance(a)",0,0], @@ -1084,13 +1050,16 @@ try_and_report("Automatic row id", "automatic_rowid", ["IN on numbers","in_num","2 in (3,2,5,9,5,1)",1,0], ["LIKE ESCAPE","like_escape","b like '%' escape 'a'",1,0], ["LIKE","like","b like 'a%'",1,0], - ["MATCH UNIQUE","match_unique","1 match unique (select a from crash_me)",1,0], + ["MATCH UNIQUE","match_unique", + "1 match unique (select a from crash_me)",1,0], ["MATCH","match","1 match (select a from crash_me)",1,0], ["MATCHES","matches","b matcjhes 'a*'",1,0], ["NOT BETWEEN","not_between","7 not between 4 and 6",1,0], - ["NOT EXISTS","not_exists","not exists (select * from crash_me where a = 2)",1,0], + ["NOT EXISTS","not_exists", + "not exists (select * from crash_me where a = 2)",1,0], ["NOT LIKE","not_like","b not like 'b%'",1,0], - ["NOT UNIQUE","not_unique","not unique (select * from crash_me where a = 2)",1,0], + ["NOT UNIQUE","not_unique", + "not unique (select * from crash_me where a = 2)",1,0], ["UNIQUE","unique","unique (select * from crash_me)",1,0], ); @@ -1207,7 +1176,8 @@ if ($limits{'functions'} eq 'yes') "select $tmp $end_query",[], undef(),4); } $prompt="Need to cast NULL for arithmetic"; - add_log("Need_cast_for_null"," Check if numeric_null ($numeric_null) is 'NULL'"); + add_log("Need_cast_for_null", + " Check if numeric_null ($numeric_null) is 'NULL'"); save_config_data("Need_cast_for_null", ($numeric_null eq "NULL") ? "no" : "yes", $prompt); @@ -1232,7 +1202,8 @@ else $resultat = 'no' } else # Ok, now check if it really works { - $error=safe_query_l('func_extra_noround', [ "create table crash_me_nr (a int)", + $error=safe_query_l('func_extra_noround', + ["create table crash_me_nr (a int)", "insert into crash_me_nr values(noround(10.2))", "drop table crash_me_nr $drop_attr"]); if ($error eq 1) { @@ -1250,30 +1221,282 @@ check_parenthesis("func_sql_","SESSION_USER"); check_parenthesis("func_sql_","SYSTEM_USER"); check_parenthesis("func_sql_","USER"); + +if ($limits{'type_sql_date'} eq 'yes') +{ # + # Checking the format of date in result. + + safe_query("drop table crash_me_d $drop_attr"); + assert("create table crash_me_d (a date)"); + # find the example of date + my $dateexample; + if ($limits{'func_extra_sysdate'} eq 'yes') { + $dateexample=' sysdate() '; + } + elsif ($limits{'func_sql_current_date'} eq 'yes') { + $dateexample='CURRENT_DATE'; + } + elsif ($limits{'func_odbc_curdate'} eq 'yes') { + $dateexample='curdate()'; + } + elsif ($limits{'func_extra_getdate'} eq 'yes') { + $dateexample='getdate()'; + } + elsif ($limits{'func_odbc_now'} eq 'yes') { + $dateexample='now()'; + } else { + #try to guess + $dateexample="DATE '1963-08-16'"; + } ; + + my $key = 'date_format_inresult'; + my $prompt = "Date format in result"; + if (! safe_query_l('date_format_inresult', + "insert into crash_me_d values($dateexample) ")) + { + die "Cannot insert date ($dateexample):".$last_error; + }; + my $sth= $dbh->prepare("select a from crash_me_d"); + add_log('date_format_inresult',"< select a from crash_me_d"); + $sth->execute; + $_= $sth->fetchrow_array; + add_log('date_format_inresult',"> $_"); + safe_query_l($key,"delete from crash_me_d"); + if (/\d{4}-\d{2}-\d{2}/){ save_config_data($key,"iso",$prompt);} + elsif (/\d{2}-\d{2}-\d{2}/){ save_config_data($key,"short iso",$prompt);} + elsif (/\d{2}\.\d{2}\.\d{4}/){ save_config_data($key,"euro",$prompt);} + elsif (/\d{2}\.\d{2}\.\d{2}/){ save_config_data($key,"short euro",$prompt);} + elsif (/\d{2}\/\d{2}\/\d{4}/){ save_config_data($key,"usa",$prompt);} + elsif (/\d{2}\/\d{2}\/\d{2}/){ save_config_data($key,"short usa",$prompt);} + elsif (/\d*/){ save_config_data($key,"YYYYMMDD",$prompt);} + else { save_config_data($key,"unknown",$prompt);}; + $sth->finish; + + check_and_report("Supports YYYY-MM-DD (ISO) format","date_format_ISO", + [ "insert into crash_me_d(a) values ('1963-08-16')"], + "select a from crash_me_d", + ["delete from crash_me_d"], + make_date_r(1963,8,16),1); + + check_and_report("Supports DATE 'YYYY-MM-DD' (ISO) format", + "date_format_ISO_with_date", + [ "insert into crash_me_d(a) values (DATE '1963-08-16')"], + "select a from crash_me_d", + ["delete from crash_me_d"], + make_date_r(1963,8,16),1); + + check_and_report("Supports DD.MM.YYYY (EUR) format","date_format_EUR", + [ "insert into crash_me_d(a) values ('16.08.1963')"], + "select a from crash_me_d", + ["delete from crash_me_d"], + make_date_r(1963,8,16),1); + check_and_report("Supports DATE 'DD.MM.YYYY' (EUR) format", + "date_format_EUR_with_date", + [ "insert into crash_me_d(a) values (DATE '16.08.1963')"], + "select a from crash_me_d", + ["delete from crash_me_d"], + make_date_r(1963,8,16),1); + + check_and_report("Supports YYYYMMDD format", + "date_format_YYYYMMDD", + [ "insert into crash_me_d(a) values ('19630816')"], + "select a from crash_me_d", + ["delete from crash_me_d"], + make_date_r(1963,8,16),1); + check_and_report("Supports DATE 'YYYYMMDD' format", + "date_format_YYYYMMDD_with_date", + [ "insert into crash_me_d(a) values (DATE '19630816')"], + "select a from crash_me_d", + ["delete from crash_me_d"], + make_date_r(1963,8,16),1); + + check_and_report("Supports MM/DD/YYYY format", + "date_format_USA", + [ "insert into crash_me_d(a) values ('08/16/1963')"], + "select a from crash_me_d", + ["delete from crash_me_d"], + make_date_r(1963,8,16),1); + check_and_report("Supports DATE 'MM/DD/YYYY' format", + "date_format_USA_with_date", + [ "insert into crash_me_d(a) values (DATE '08/16/1963')"], + "select a from crash_me_d", + ["delete from crash_me_d"], + make_date_r(1963,8,16),1); + + + + + check_and_report("Supports 0000-00-00 dates","date_zero", + ["create table crash_me2 (a date not null)", + "insert into crash_me2 values (".make_date(0,0,0).")"], + "select a from crash_me2", + ["drop table crash_me2 $drop_attr"], + make_date_r(0,0,0),1); + + check_and_report("Supports 0001-01-01 dates","date_one", + ["create table crash_me2 (a date not null)", + "insert into crash_me2 values (".make_date(1,1,1).")"], + "select a from crash_me2", + ["drop table crash_me2 $drop_attr"], + make_date_r(1,1,1),1); + + check_and_report("Supports 9999-12-31 dates","date_last", + ["create table crash_me2 (a date not null)", + "insert into crash_me2 values (".make_date(9999,12,31).")"], + "select a from crash_me2", + ["drop table crash_me2 $drop_attr"], + make_date_r(9999,12,31),1); + + check_and_report("Supports 'infinity dates","date_infinity", + ["create table crash_me2 (a date not null)", + "insert into crash_me2 values ('infinity')"], + "select a from crash_me2", + ["drop table crash_me2 $drop_attr"], + "infinity",1); + + if (!defined($limits{'date_with_YY'})) + { + check_and_report("Supports YY-MM-DD dates","date_with_YY", + ["create table crash_me2 (a date not null)", + "insert into crash_me2 values ('98-03-03')"], + "select a from crash_me2", + ["drop table crash_me2 $drop_attr"], + make_date_r(1998,3,3),5); + if ($limits{'date_with_YY'} eq "yes") + { + undef($limits{'date_with_YY'}); + check_and_report("Supports YY-MM-DD 2000 compilant dates", + "date_with_YY", + ["create table crash_me2 (a date not null)", + "insert into crash_me2 values ('10-03-03')"], + "select a from crash_me2", + ["drop table crash_me2 $drop_attr"], + make_date_r(2010,3,3),5); + } + } + + # Test: WEEK() -{ - my $resultat="no"; - my $error; - print "WEEK:"; - save_incomplete('func_odbc_week','WEEK'); - $error = safe_query_result_l('func_odbc_week',"select week(DATE '1997-02-01') $end_query",5,0); - # actually this query must return 4 or 5 in the $last_result, - # $error can be 1 (not supported at all) , -1 ( probably USA weeks) - # and 0 - EURO weeks - if ($error == -1) { - if ($last_result == 4) { - $resultat = 'USA'; - } else { - $resultat='error'; - add_log('func_odbc_week'," must return 4 or 5, but $last_result"); - } - } elsif ($error == 0) { - $resultat = 'EURO'; - } - print " $resultat\n"; - save_config_data('func_odbc_week',$resultat,"WEEK $explain"); + { + my $resultat="no"; + my $error; + print "WEEK:"; + save_incomplete('func_odbc_week','WEEK'); + $error = safe_query_result_l('func_odbc_week', + "select week(".make_date(1997,2,1).") $end_query",5,0); + # actually this query must return 4 or 5 in the $last_result, + # $error can be 1 (not supported at all) , -1 ( probably USA weeks) + # and 0 - EURO weeks + if ($error == -1) { + if ($last_result == 4) { + $resultat = 'USA'; + } else { + $resultat='error'; + add_log('func_odbc_week', + " must return 4 or 5, but $last_result"); + } + } elsif ($error == 0) { + $resultat = 'EURO'; + } + print " $resultat\n"; + save_config_data('func_odbc_week',$resultat,"WEEK"); + } + + my $insert_query ='insert into crash_me_d values('. + make_date(1997,2,1).')'; + safe_query($insert_query); + + foreach $fn ( ( + ["DAYNAME","dayname","dayname(a)","",2], + ["MONTH","month","month(a)","",2], + ["MONTHNAME","monthname","monthname(a)","",2], + ["DAYOFMONTH","dayofmonth","dayofmonth(a)",1,0], + ["DAYOFWEEK","dayofweek","dayofweek(a)",7,0], + ["DAYOFYEAR","dayofyear","dayofyear(a)",32,0], + ["QUARTER","quarter","quarter(a)",1,0], + ["YEAR","year","year(a)",1997,0])) + { + $prompt='Function '.$fn->[0]; + $key='func_odbc_'.$fn->[1]; + add_log($key,"< ".$insert_query); + check_and_report($prompt,$key, + [],"select ".$fn->[2]." from crash_me_d",[], + $fn->[3],$fn->[4] + ); + + }; + safe_query(['delete from crash_me_d', + 'insert into crash_me_d values('.make_date(1963,8,16).')']); + foreach $fn (( + ["DATEADD","dateadd","dateadd(day,3,make_date(1997,11,30))",0,2], + ["MDY","mdy","mdy(7,1,1998)","make_date_r(1998,07,01)",0], # informix + ["DATEDIFF","datediff", + "datediff(month,'Oct 21 1997','Nov 30 1997')",0,2], + ["DATENAME","datename","datename(month,'Nov 30 1997')",0,2], + ["DATEPART","datepart","datepart(month,'July 20 1997')",0,2], + ["DATE_FORMAT","date_format", + "date_format('1997-01-02 03:04:05','M W D Y y m d h i s w')", 0,2], + ["FROM_DAYS","from_days", + "from_days(729024)","make_date_r(1996,1,1)",1], + ["FROM_UNIXTIME","from_unixtime","from_unixtime(0)",0,2], + ["MONTHS_BETWEEN","months_between", + "months_between(make_date(1997,2,2),make_date(1997,1,1))", + "1.03225806",0], # oracle number of months between 2 dates + ["PERIOD_ADD","period_add","period_add(9602,-12)",199502,0], + ["PERIOD_DIFF","period_diff","period_diff(199505,199404)",13,0], + ["WEEKDAY","weekday","weekday(make_date(1997,11,29))",5,0], + ["ADDDATE",'adddate', + "ADDDATE(make_date(2002,12,01),3)",'make_date_r(2002,12,04)',0], + ["SUBDATE",'subdate', + "SUBDATE(make_date(2002,12,04),3)",'make_date_r(2002,12,01)',0], + ["DATEDIFF (2 arg)",'datediff2arg', + "DATEDIFF(make_date(2002,12,04),make_date(2002,12,01))",'3',0], + ["WEEKOFYEAR",'weekofyear', + "WEEKOFYEAR(make_date(1963,08,16))",'33',0], +# table crash_me_d must contain record with 1963-08-16 (for CHAR) + ["CHAR (conversation date)",'char_date', + "CHAR(a,EUR)",'16.08.1963',0], + ["MAKEDATE",'makedate',"MAKEDATE(1963,228)" + ,'make_date_r(1963,08,16)',0], + ["TO_DAYS","to_days", + "to_days(make_date(1996,01,01))",729024,0], + ["ADD_MONTHS","add_months", + "add_months(make_date(1997,01,01),1)","make_date_r(1997,02,01)",0], + # oracle the date plus n months + ["LAST_DAY","last_day", + "last_day(make_date(1997,04,01))","make_date_r(1997,04,30)",0], + # oracle last day of month of date + ["DATE",'date',"date(make_date(1963,8,16))", + 'make_date_r(1963,8,16)',0], + ["DAY",'day',"DAY(make_date(2002,12,01))",1,0])) + { + $prompt='Function '.$fn->[0]; + $key='func_extra_'.$fn->[1]; + my $qry="select ".$fn->[2]." from crash_me_d"; + while( $qry =~ /^(.*)make_date\((\d+),(\d+),(\d+)\)(.*)$/) + { + my $dt= &make_date($2,$3,$4); + $qry=$1.$dt.$5; + }; + my $result=$fn->[3]; + while( $result =~ /^(.*)make_date_r\((\d+),(\d+),(\d+)\)(.*)$/) + { + my $dt= &make_date_r($2,$3,$4); + $result=$1.$dt.$5; + }; + check_and_report($prompt,$key, + [],$qry,[], + $result,$fn->[4] + ); + + } + + safe_query("drop table crash_me_d $drop_attr"); + } + + report("LIKE on numbers","like_with_number", "create table crash_q (a int,b int)", "insert into crash_q values(10,10)", @@ -1318,19 +1541,20 @@ if (defined($tmp)) if (!defined($limits{'multi_table_update'})) { if (check_and_report("Update with many tables","multi_table_update", - ["create table crash_q (a integer,b char(10))", - "insert into crash_q values(1,'c')", - "update crash_q left join crash_me on crash_q.a=crash_me.a set crash_q.b=crash_me.b"], - "select b from crash_q", - ["drop table crash_q $drop_attr"], - "a",1,undef(),2)) + ["create table crash_q (a integer,b char(10))", + "insert into crash_q values(1,'c')", + "update crash_q left join crash_me on crash_q.a=crash_me.a set crash_q.b=crash_me.b"], + "select b from crash_q", + ["drop table crash_q $drop_attr"], + "a",1,undef(),2)) { check_and_report("Update with many tables","multi_table_update", - ["create table crash_q (a integer,b char(10))", - "insert into crash_q values(1,'c')", - "update crash_q,crash_me set crash_q.b=crash_me.b where crash_q.a=crash_me.a"], - "select b from crash_q", - ["drop table crash_q $drop_attr"], + ["create table crash_q (a integer,b char(10))", + "insert into crash_q values(1,'c')", + "update crash_q,crash_me set crash_q.b=crash_me.b ". + "where crash_q.a=crash_me.a"], + "select b from crash_q", + ["drop table crash_q $drop_attr"], "a",1, 1); } @@ -1345,7 +1569,8 @@ report("DELETE FROM table1,table2...","multi_table_delete", check_and_report("Update with sub select","select_table_update", ["create table crash_q (a integer,b char(10))", "insert into crash_q values(1,'c')", - "update crash_q set b= (select b from crash_me where crash_q.a = crash_me.a)"], + "update crash_q set b= ". + "(select b from crash_me where crash_q.a = crash_me.a)"], "select b from crash_q", ["drop table crash_q $drop_attr"], "a",1); @@ -1615,25 +1840,31 @@ safe_query("drop table crash_q $drop_attr"); # test of different join types # -assert("create table crash_me2 (a integer not null,b char(10) not null, c1 integer)"); +assert("create table crash_me2 (a integer not null,b char(10) not null,". + " c1 integer)"); assert("insert into crash_me2 (a,b,c1) values (1,'b',1)"); assert("create table crash_me3 (a integer not null,b char(10) not null)"); assert("insert into crash_me3 (a,b) values (1,'b')"); report("inner join","inner_join", - "select crash_me.a from crash_me inner join crash_me2 ON crash_me.a=crash_me2.a"); + "select crash_me.a from crash_me inner join crash_me2 ON ". + "crash_me.a=crash_me2.a"); report("left outer join","left_outer_join", - "select crash_me.a from crash_me left join crash_me2 ON crash_me.a=crash_me2.a"); + "select crash_me.a from crash_me left join crash_me2 ON ". + "crash_me.a=crash_me2.a"); report("natural left outer join","natural_left_outer_join", "select c1 from crash_me natural left join crash_me2"); report("left outer join using","left_outer_join_using", "select c1 from crash_me left join crash_me2 using (a)"); report("left outer join odbc style","odbc_left_outer_join", - "select crash_me.a from { oj crash_me left outer join crash_me2 ON crash_me.a=crash_me2.a }"); + "select crash_me.a from { oj crash_me left outer join crash_me2 ON". + " crash_me.a=crash_me2.a }"); report("right outer join","right_outer_join", - "select crash_me.a from crash_me right join crash_me2 ON crash_me.a=crash_me2.a"); + "select crash_me.a from crash_me right join crash_me2 ON ". + "crash_me.a=crash_me2.a"); report("full outer join","full_outer_join", - "select crash_me.a from crash_me full join crash_me2 ON crash_me.a=crash_me2.a"); + "select crash_me.a from crash_me full join crash_me2 ON "." + crash_me.a=crash_me2.a"); report("cross join (same as from a,b)","cross_join", "select crash_me.a from crash_me cross join crash_me3"); report("natural join","natural_join", @@ -1687,7 +1918,8 @@ assert("drop table crash_me3 $drop_attr"); # >ALL | ANY | SOME - EXISTS - UNIQUE if (report("subqueries","subqueries", - "select a from crash_me where crash_me.a in (select max(a) from crash_me)")) + "select a from crash_me where crash_me.a in ". + "(select max(a) from crash_me)")) { $tmp=new query_repeat([],"select a from crash_me","","", " where a in (select a from crash_me",")", @@ -1765,7 +1997,8 @@ report("views","views", # 1) check if foreign keys are supported safe_query_l('foreign_key',create_table("crash_me_qf",["a integer not null"], ["primary key (a)"])); - $error = safe_query_l('foreign_key', create_table("crash_me_qf2",["a integer not null", + $error = safe_query_l('foreign_key', + create_table("crash_me_qf2",["a integer not null", "foreign key (a) references crash_me_qf (a)"], [])); if ($error eq 1) # OK -- syntax is supported @@ -1773,7 +2006,8 @@ report("views","views", $resultat = 'error'; # now check if foreign key really works safe_query_l('foreign_key', "insert into crash_me_qf values (1)"); - if (safe_query_l('foreign_key', "insert into crash_me_qf2 values (2)") eq 1) { + if (safe_query_l('foreign_key', "insert into crash_me_qf2 values (2)") eq 1) + { $resultat = 'syntax only'; } else { $resultat = 'yes'; @@ -1782,13 +2016,15 @@ report("views","views", } else { $resultat = "no"; } - safe_query_l('foreign_key', "drop table crash_me_qf2 $drop_attr","drop table crash_me_qf $drop_attr"); + safe_query_l('foreign_key', + "drop table crash_me_qf2 $drop_attr","drop table crash_me_qf $drop_attr"); print "$resultat\n"; save_config_data('foreign_key',$resultat,"foreign keys"); } report("Create SCHEMA","create_schema", - "create schema crash_schema create table crash_q (a int) create table crash_q2(b int)", + "create schema crash_schema create table crash_q (a int) ". + "create table crash_q2(b int)", "drop schema crash_schema cascade"); if ($limits{'foreign_key'} eq 'yes') @@ -1796,7 +2032,10 @@ if ($limits{'foreign_key'} eq 'yes') if ($limits{'create_schema'} eq 'yes') { report("Circular foreign keys","foreign_key_circular", - "create schema crash_schema create table crash_q (a int primary key, b int, foreign key (b) references crash_q2(a)) create table crash_q2(a int, b int, primary key(a), foreign key (b) references crash_q(a))", + "create schema crash_schema create table crash_q ". + "(a int primary key, b int, foreign key (b) references ". + "crash_q2(a)) create table crash_q2(a int, b int, ". + "primary key(a), foreign key (b) references crash_q(a))", "drop schema crash_schema cascade"); } } @@ -1824,35 +2063,47 @@ report("NULL constraint (SyBase style)","constraint_null", report("Triggers (ANSI SQL)","psm_trigger", "create table crash_q (a int ,b int)", - "create trigger crash_trigger after insert on crash_q referencing new table as new_a when (localtime > time '18:00:00') begin atomic end", + "create trigger crash_trigger after insert on crash_q referencing ". + "new table as new_a when (localtime > time '18:00:00') ". + "begin atomic end", "insert into crash_q values(1,2)", "drop trigger crash_trigger", "drop table crash_q $drop_attr"); report("PSM procedures (ANSI SQL)","psm_procedures", "create table crash_q (a int,b int)", - "create procedure crash_proc(in a1 int, in b1 int) language sql modifies sql data begin declare c1 int; set c1 = a1 + b1; insert into crash_q(a,b) values (a1,c1); end", + "create procedure crash_proc(in a1 int, in b1 int) language ". + "sql modifies sql data begin declare c1 int; set c1 = a1 + b1;". + " insert into crash_q(a,b) values (a1,c1); end", "call crash_proc(1,10)", "drop procedure crash_proc", "drop table crash_q $drop_attr"); report("PSM modules (ANSI SQL)","psm_modules", "create table crash_q (a int,b int)", - "create module crash_m declare procedure crash_proc(in a1 int, in b1 int) language sql modifies sql data begin declare c1 int; set c1 = a1 + b1; insert into crash_q(a,b) values (a1,c1); end; declare procedure crash_proc2(INOUT a int, in b int) contains sql set a = b + 10; end module", + "create module crash_m declare procedure ". + "crash_proc(in a1 int, in b1 int) language sql modifies sql ". + "data begin declare c1 int; set c1 = a1 + b1; ". + "insert into crash_q(a,b) values (a1,c1); end; ". + "declare procedure crash_proc2(INOUT a int, in b int) ". + "contains sql set a = b + 10; end module", "call crash_proc(1,10)", "drop module crash_m cascade", "drop table crash_q cascade $drop_attr"); report("PSM functions (ANSI SQL)","psm_functions", "create table crash_q (a int)", - "create function crash_func(in a1 int, in b1 int) returns int language sql deterministic contains sql begin return a1 * b1; end", + "create function crash_func(in a1 int, in b1 int) returns int". + " language sql deterministic contains sql ". + " begin return a1 * b1; end", "insert into crash_q values(crash_func(2,4))", "select a,crash_func(a,2) from crash_q", "drop function crash_func cascade", "drop table crash_q $drop_attr"); report("Domains (ANSI SQL)","domains", - "create domain crash_d as varchar(10) default 'Empty' check (value <> 'abcd')", + "create domain crash_d as varchar(10) default 'Empty' ". + "check (value <> 'abcd')", "create table crash_q(a crash_d, b int)", "insert into crash_q(a,b) values('xyz',10)", "insert into crash_q(b) values(10)", @@ -2028,28 +2279,31 @@ if ($limits{'unique_in_create'} eq 'yes') $max_keys,0)); find_limit("index parts","max_index_parts", - new query_table("create table crash_q ($key_definitions,unique (q0", + new query_table("create table crash_q ". + "($key_definitions,unique (q0", ",q%d","))", - ["insert into crash_q ($key_fields) values ($key_values)"], - "select q0 from crash_q",1, - "drop table crash_q $drop_attr", - $max_keys,1)); + ["insert into crash_q ($key_fields) values ($key_values)"], + "select q0 from crash_q",1, + "drop table crash_q $drop_attr", + $max_keys,1)); find_limit("max index part length","max_index_part_length", - new query_many(["create table crash_q (q char(%d) not null,unique(q))", - "insert into crash_q (q) values ('%s')"], - "select q from crash_q","%s", - ["drop table crash_q $drop_attr"], - $limits{'max_char_size'},0)); + new query_many(["create table crash_q (q char(%d) not null,". + "unique(q))", + "insert into crash_q (q) values ('%s')"], + "select q from crash_q","%s", + ["drop table crash_q $drop_attr"], + $limits{'max_char_size'},0)); if ($limits{'type_sql_varchar(1_arg)'} eq 'yes') { find_limit("index varchar part length","max_index_varchar_part_length", - new query_many(["create table crash_q (q varchar(%d) not null,unique(q))", - "insert into crash_q (q) values ('%s')"], - "select q from crash_q","%s", - ["drop table crash_q $drop_attr"], - $limits{'max_varchar_size'},0)); + new query_many(["create table crash_q (q varchar(%d) not null,". + "unique(q))", + "insert into crash_q (q) values ('%s')"], + "select q from crash_q","%s", + ["drop table crash_q $drop_attr"], + $limits{'max_varchar_size'},0)); } } @@ -2059,7 +2313,9 @@ if ($limits{'create_index'} ne 'no') if ($limits{'create_index'} eq 'ignored' || $limits{'unique_in_create'} eq 'yes') { # This should be true - add_log('max_index'," max_unique_index=$limits{'max_unique_index'} ,so max_index must be same"); + add_log('max_index', + " max_unique_index=$limits{'max_unique_index'} ,". + "so max_index must be same"); save_config_data('max_index',$limits{'max_unique_index'},"max index"); print "indexes: $limits{'max_index'}\n"; } @@ -2070,7 +2326,8 @@ if ($limits{'create_index'} ne 'no') safe_query_l('max_index',"create table crash_q ($key_definitions)"); for ($i=1; $i <= min($limits{'max_columns'},$max_keys) ; $i++) { - last if (!safe_query_l('max_index',"create index crash_q$i on crash_q (q$i)")); + last if (!safe_query_l('max_index', + "create index crash_q$i on crash_q (q$i)")); } save_config_data('max_index',$i == $max_keys ? $max_keys : $i, "max index"); @@ -2086,10 +2343,12 @@ if ($limits{'create_index'} ne 'no') print "indexs: $limits{'max_index'}\n"; if (!defined($limits{'max_unique_index'})) { - safe_query_l('max_unique_index',"create table crash_q ($key_definitions)"); + safe_query_l('max_unique_index', + "create table crash_q ($key_definitions)"); for ($i=0; $i < min($limits{'max_columns'},$max_keys) ; $i++) { - last if (!safe_query_l('max_unique_index',"create unique index crash_q$i on crash_q (q$i)")); + last if (!safe_query_l('max_unique_index', + "create unique index crash_q$i on crash_q (q$i)")); } save_config_data('max_unique_index',$i == $max_keys ? $max_keys : $i, "max unique index"); @@ -2105,7 +2364,8 @@ if ($limits{'create_index'} ne 'no') print "unique indexes: $limits{'max_unique_index'}\n"; if (!defined($limits{'max_index_parts'})) { - safe_query_l('max_index_parts',"create table crash_q ($key_definitions)"); + safe_query_l('max_index_parts', + "create table crash_q ($key_definitions)"); $end_drop=$end_drop_keyword; $end_drop =~ s/%i/crash_q1%d/; $end_drop =~ s/%t/crash_q/; @@ -2186,23 +2446,29 @@ if (!defined($limits{$key})) { print "$prompt="; save_incomplete($key,$prompt); - if (!safe_query_l($key,$server->create("crash_me_a",["a decimal(10,2)","b decimal(10,2)"]))) + if (!safe_query_l($key,$server->create("crash_me_a", + ["a decimal(10,2)","b decimal(10,2)"]))) { print DBI->errstr(); die "Can't create table 'crash_me_a' $DBI::errstr\n"; }; - if (!safe_query_l($key,["insert into crash_me_a (a,b) values (11.4,18.9)"])) + if (!safe_query_l($key, + ["insert into crash_me_a (a,b) values (11.4,18.9)"])) { die "Can't insert into table 'crash_me_a' a record: $DBI::errstr\n"; }; $arithmetic_safe = 'no'; $arithmetic_safe = 'yes' - if ( (safe_query_result_l($key,'select count(*) from crash_me_a where a+b=30.3',1,0) == 0) - and (safe_query_result_l($key,'select count(*) from crash_me_a where a+b-30.3 = 0',1,0) == 0) - and (safe_query_result_l($key,'select count(*) from crash_me_a where a+b-30.3 < 0',0,0) == 0) - and (safe_query_result_l($key,'select count(*) from crash_me_a where a+b-30.3 > 0',0,0) == 0) ); + if ( (safe_query_result_l($key, + 'select count(*) from crash_me_a where a+b=30.3',1,0) == 0) + and (safe_query_result_l($key, + 'select count(*) from crash_me_a where a+b-30.3 = 0',1,0) == 0) + and (safe_query_result_l($key, + 'select count(*) from crash_me_a where a+b-30.3 < 0',0,0) == 0) + and (safe_query_result_l($key, + 'select count(*) from crash_me_a where a+b-30.3 > 0',0,0) == 0)); save_config_data($key,$arithmetic_safe,$prompt); print "$arithmetic_safe\n"; assert("drop table crash_me_a $drop_attr"); @@ -2263,6 +2529,9 @@ if (!defined($limits{$key})) assert("drop table crash_me_n $drop_attr"); + + + # # End of test # @@ -2361,6 +2630,46 @@ sub check_constraint { print "$res\n"; } +sub make_date_r { + my $year=shift; + my $month=shift; + my $day=shift; + $_ = $limits{'date_format_inresult'}; + return sprintf "%02d-%02d-%02d", ($year%100),$month,$day if (/^short iso$/); + return sprintf "%04d-%02d-%02d", $year,$month,$day if (/^iso/); + return sprintf "%02d.%02d.%02d", $day,$month,($year%100) if (/^short euro/); + return sprintf "%02d.%02d.%04d", $day,$month,$year if (/^euro/); + return sprintf "%02d/%02d/%02d", $month,$day,($year%100) if (/^short usa/); + return sprintf "%02d/%02d/%04d", $month,$day,$year if (/^usa/); + return sprintf "%04d%02d%02d", $year,$month,$day if (/^YYYYMMDD/); + return "UNKNOWN FORMAT"; +} + + +sub make_date { + my $year=shift; + my $month=shift; + my $day=shift; + return sprintf "'%04d-%02d-%02d'", $year,$month,$day + if ($limits{'date_format_ISO'} eq yes); + return sprintf "DATE '%04d-%02d-%02d'", $year,$month,$day + if ($limits{'date_format_ISO_with_date'} eq yes); + return sprintf "'%02d.%02d.%04d'", $day,$month,$year + if ($limits{'date_format_EUR'} eq 'yes'); + return sprintf "DATE '%02d.%02d.%04d'", $day,$month,$year + if ($limits{'date_format_EUR_with_date'} eq 'yes'); + return sprintf "'%02d/%02d/%04d'", $month,$day,$year + if ($limits{'date_format_USA'} eq 'yes'); + return sprintf "DATE '%02d/%02d/%04d'", $month,$day,$year + if ($limits{'date_format_USA_with_date'} eq 'yes'); + return sprintf "'%04d%02d%02d'", $year,$month,$day + if ($limits{'date_format_YYYYMMDD'} eq 'yes'); + return sprintf "DATE '%04d%02d%02d'", $year,$month,$day + if ($limits{'date_format_YYYYMMDD_with_date'} eq 'yes'); + return "UNKNOWN FORMAT"; +} + + sub usage { print <{LongReadLen}= 16000000; # Set max retrieval buffer return $dbh; } - print "Error: $DBI::errstr; $server->{'data_source'} - '$opt_user' - '$opt_password'\n"; + print "Error: $DBI::errstr; $server->{'data_source'} ". + " - '$opt_user' - '$opt_password'\n"; print "I got the above error when connecting to $opt_server\n"; if (defined($object) && defined($object->{'limit'})) { - print "This check was done with limit: $object->{'limit'}.\nNext check will be done with a smaller limit!\n"; + print "This check was done with limit: $object->{'limit'}.". + "\nNext check will be done with a smaller limit!\n"; $object=undef(); } save_config_data('crash_me_safe','no',"crash me safe"); @@ -2692,7 +3005,8 @@ sub print_query # # Do one or many queries. Return 1 if all was ok -# Note that all rows are executed (to ensure that we execute drop table commands) +# Note that all rows are executed +# (to ensure that we execute drop table commands) # sub safe_query_l { @@ -2716,7 +3030,8 @@ sub safe_query } foreach $query (@$queries) { - printf "query1: %-80.80s ...(%d - %d)\n",$query,length($query),$retry_limit if ($opt_log_all_queries); + printf "query1: %-80.80s ...(%d - %d)\n",$query, + length($query),$retry_limit if ($opt_log_all_queries); print LOG "$query;\n" if ($opt_log); $safe_query_log .= "< $query\n"; if (length($query) > $query_size) @@ -2983,7 +3298,6 @@ sub check_reserved_words "create table crash_me10 ($keyword int not null)", "drop table crash_me10 $drop_attr" ); - print "$prompt: ",$limits{$config},"\n"; } } @@ -3367,7 +3681,8 @@ sub safe_query_result (abs($row->[0]) + abs($answer))) > 0.01) { $result=-1; - $safe_query_result_log .= "We expected '$answer' but got '$last_result' \n"; + $safe_query_result_log .= + "We expected '$answer' but got '$last_result' \n"; } } elsif ($result_type == 1) # Compare where end space may differ @@ -3376,7 +3691,8 @@ sub safe_query_result if ($row->[0] ne $answer) { $result=-1; - $safe_query_result_log .= "We expected '$answer' but got '$last_result' \n"; + $safe_query_result_log .= + "We expected '$answer' but got '$last_result' \n"; } ; } elsif ($result_type == 3) # This should be a exact match @@ -3384,7 +3700,8 @@ sub safe_query_result if ($row->[0] ne $answer) { $result= -1; - $safe_query_result_log .= "we expected '$answer' but got '$last_result' \n"; + $safe_query_result_log .= + "We expected '$answer' but got '$last_result' \n"; }; } elsif ($result_type == 4) # If results should be NULL @@ -3392,7 +3709,8 @@ sub safe_query_result if (defined($row->[0])) { $result= -1; - $safe_query_result_log .= "We expected NULL but got '$last_result' \n"; + $safe_query_result_log .= + "We expected NULL but got '$last_result' \n"; }; } elsif ($result_type == 5) # Result should have given prefix @@ -3401,14 +3719,16 @@ sub safe_query_result substr($row->[0],1,length($answer)) ne $answer) { $result= -1 ; - $safe_query_result_log .= "result must have prefix '$answer', but '$last_result' \n"; + $safe_query_result_log .= + "Result must have prefix '$answer', but '$last_result' \n"; }; } elsif ($result_type == 6) # Exact match but ignore errors { if ($row->[0] ne $answer) { $result= 1; - $safe_query_result_log .= "We expected '$answer' but got '$last_result' \n"; + $safe_query_result_log .= + "We expected '$answer' but got '$last_result' \n"; } ; } elsif ($result_type == 7) # Compare against array of numbers @@ -3459,8 +3779,9 @@ sub safe_query_result # # Find limit using binary search. This is a weighed binary search that -# will prefere lower limits to get the server to crash as few times as possible -# +# will prefere lower limits to get the server to crash as +# few times as possible + sub find_limit() { @@ -3505,7 +3826,8 @@ sub find_limit() if (!limit_query($query,1)) # This must work { - print "\nMaybe fatal error: Can't check '$prompt' for limit=1\nerror: $last_error\n"; + print "\nMaybe fatal error: Can't check '$prompt' for limit=1\n". + "error: $last_error\n"; return "error"; } @@ -3648,11 +3970,10 @@ sub save_config_data my $last_line_was_empty=0; foreach $line (split /\n/, $log{$key}) { - print CONFIG_FILE " ###$line\n" - unless ( ($last_line_was_empty eq 1) + print CONFIG_FILE " ###$line\n" + unless ( ($last_line_was_empty eq 1) && ($line =~ /^\s+$/) ); $last_line_was_empty= ($line =~ /^\s+$/)?1:0; - }; if (($opt_restart && $limits{'operating_system'} =~ /windows/i) || @@ -3684,7 +4005,8 @@ sub save_all_config_data select STDOUT; delete $limits{'restart'}; - print CONFIG_FILE "#This file is automaticly generated by crash-me $version\n\n"; + print CONFIG_FILE + "#This file is automaticly generated by crash-me $version\n\n"; foreach $key (sort keys %limits) { $tmp="$key=$limits{$key}"; @@ -3694,11 +4016,9 @@ sub save_all_config_data my $last_line_was_empty=0; foreach $line (split /\n/, $log{$key}) { - print CONFIG_FILE " ###$line\n" - unless ( ($last_line_was_empty eq 1) - && ($line =~ /^\s+$/) ); - $last_line_was_empty= ($line =~ /^\s+$/)?1:0; - + print CONFIG_FILE " ###$line\n" unless + ( ($last_line_was_empty eq 1) && ($line =~ /^\s*$/)); + $last_line_was_empty= ($line =~ /^\s*$/)?1:0; }; } close CONFIG_FILE; @@ -4267,7 +4587,8 @@ sub query $self->{'limit'}=$limit; $res=$parts=$values=""; - $size=main::min($main::limits{'max_index_part_length'},$main::limits{'max_char_size'}); + $size=main::min($main::limits{'max_index_part_length'}, + $main::limits{'max_char_size'}); $size=1 if ($size == 0); # Avoid infinite loop errors for ($length=$i=0; $length + $size <= $limit ; $length+=$size, $i++) { From ea4f406bafed272bf3517cbfd46dcc3091a2f1d6 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Dec 2002 07:38:32 +0200 Subject: [PATCH 048/220] optimized single value subselect (to be used as row) (SCRUM) sql/item.h: optimized single value subselect (to be used as row) sql/item_subselect.cc: optimized single value subselect (to be used as row) sql/item_subselect.h: optimized single value subselect (to be used as row) sql/sql_class.cc: optimized single value subselect (to be used as row) --- sql/item.h | 101 ++++++++++++++++++++++++++++++++++++++---- sql/item_subselect.cc | 61 +++++++++++++++++++++---- sql/item_subselect.h | 32 ++++--------- sql/sql_class.cc | 26 +---------- 4 files changed, 154 insertions(+), 66 deletions(-) diff --git a/sql/item.h b/sql/item.h index 1ea76731fd3..461a3805080 100644 --- a/sql/item.h +++ b/sql/item.h @@ -31,12 +31,12 @@ public: static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); } static void operator delete(void *ptr,size_t size) {} /*lint -e715 */ - enum Type {FIELD_ITEM,FUNC_ITEM,SUM_FUNC_ITEM,STRING_ITEM, - INT_ITEM,REAL_ITEM,NULL_ITEM,VARBIN_ITEM, - COPY_STR_ITEM,FIELD_AVG_ITEM, DEFAULT_ITEM, - PROC_ITEM,COND_ITEM,REF_ITEM,FIELD_STD_ITEM, - FIELD_VARIANCE_ITEM,CONST_ITEM, - SUBSELECT_ITEM, ROW_ITEM}; + enum Type {FIELD_ITEM, FUNC_ITEM, SUM_FUNC_ITEM, STRING_ITEM, + INT_ITEM, REAL_ITEM, NULL_ITEM, VARBIN_ITEM, + COPY_STR_ITEM, FIELD_AVG_ITEM, DEFAULT_ITEM, + PROC_ITEM,COND_ITEM, REF_ITEM, FIELD_STD_ITEM, + FIELD_VARIANCE_ITEM, CONST_ITEM, + SUBSELECT_ITEM, ROW_ITEM, CACHE_ITEM}; enum cond_result { COND_UNDEF,COND_OK,COND_TRUE,COND_FALSE }; String str_value; /* used to store value */ @@ -381,7 +381,8 @@ public: name=(char*) str_value.ptr(); decimals=NOT_FIXED_DEC; } - Item_string(const char *name_par,const char *str,uint length,CHARSET_INFO *cs) + Item_string(const char *name_par, const char *str, uint length, + CHARSET_INFO *cs) { str_value.set(str,length,cs); max_length=length; @@ -392,11 +393,13 @@ public: enum Type type() const { return STRING_ITEM; } double val() { - return my_strntod(str_value.charset(),str_value.ptr(),str_value.length(),(char**)NULL); + return my_strntod(str_value.charset(), str_value.ptr(), + str_value.length(), (char**) 0); } longlong val_int() { - return my_strntoll(str_value.charset(),str_value.ptr(),str_value.length(),(char**) 0,10); + return my_strntoll(str_value.charset(), str_value.ptr(), + str_value.length(), (char**) 0, 10); } String *val_str(String*) { return (String*) &str_value; } int save_in_field(Field *field, bool no_conversions); @@ -706,6 +709,86 @@ public: bool cmp(void); }; +class Item_cache: public Item +{ +public: + virtual void store(Item *)= 0; + void set_len_n_dec(uint32 max_len, uint8 dec) + { + max_length= max_len; + decimals= dec; + } + enum Type type() const { return CACHE_ITEM; } +}; + +class Item_cache_int: public Item_cache +{ + longlong value; +public: + Item_cache_int() { fixed= 1; null_value= 1; } + + void store(Item *item) + { + value= item->val_int_result(); + null_value= item->null_value; + } + double val() { return (double) value; } + longlong val_int() { return value; } + String* val_str(String *str) { str->set(value, thd_charset()); return str; } + enum Item_result result_type() const { return INT_RESULT; } +}; + +class Item_cache_real: public Item_cache +{ + double value; +public: + Item_cache_real() { fixed= 1; null_value= 1; } + + void store(Item *item) + { + value= item->val_result(); + null_value= item->null_value; + } + double val() { return value; } + longlong val_int() { return (longlong) (value+(value > 0 ? 0.5 : -0.5)); } + String* val_str(String *str) + { + str->set(value, decimals, thd_charset()); + return str; + } + enum Item_result result_type() const { return REAL_RESULT; } +}; + +class Item_cache_str: public Item_cache +{ + char buffer[80]; + String *value; +public: + Item_cache_str() { fixed= 1; null_value= 1; } + + void store(Item *item) + { + str_value.set(buffer, sizeof(buffer), item->charset()); + value= item->str_result(&str_value); + // TODO remove if str_value charset have no side effect for now + str_value.set_charset(value->charset()); + null_value= item->null_value; + } + double val() + { + return my_strntod(value->charset(), value->ptr(), + value->length(), (char**)0); + } + longlong val_int() + { + return my_strntoll(value->charset(), value->ptr(), + value->length(), (char**) 0, 10); + } + String* val_str(String *) { return value; } + enum Item_result result_type() const { return STRING_RESULT; } + CHARSET_INFO *charset() const { return value->charset(); }; +}; + extern Item_buff *new_Item_buff(Item *item); extern Item_result item_cmp_type(Item_result a,Item_result b); extern Item *resolve_const_item(Item *item,Item *cmp_item); diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index a8bbc433b7a..588be06a7e7 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -124,7 +124,7 @@ inline table_map Item_subselect::used_tables() const Item_singleval_subselect::Item_singleval_subselect(THD *thd, st_select_lex *select_lex): - Item_subselect() + Item_subselect(), value(0) { DBUG_ENTER("Item_singleval_subselect::Item_singleval_subselect"); init(thd, select_lex, new select_singleval_subselect(this)); @@ -133,10 +133,43 @@ Item_singleval_subselect::Item_singleval_subselect(THD *thd, DBUG_VOID_RETURN; } +void Item_singleval_subselect::reset() +{ + null_value= 1; + if (value) + value->null_value= 1; +} + +void Item_singleval_subselect::store(Item *item) +{ + value->store(item); +} + +enum Item_result Item_singleval_subselect::result_type() const +{ + return engine->type(); +} + void Item_singleval_subselect::fix_length_and_dec() { engine->fix_length_and_dec(); - res_type= engine->type(); + switch (engine->type()) + { + case INT_RESULT: + value= new Item_cache_int(); + break; + case REAL_RESULT: + value= new Item_cache_real(); + break; + case STRING_RESULT: + value= new Item_cache_str(); + break; + default: + // should never be in real life + DBUG_ASSERT(0); + return; + } + value->set_len_n_dec(max_length, decimals); } Item::Type Item_subselect::type() const @@ -146,32 +179,44 @@ Item::Type Item_subselect::type() const double Item_singleval_subselect::val () { - if (engine->exec()) + if (!engine->exec() && !value->null_value) + { + null_value= 0; + return value->val(); + } + else { reset(); return 0; } - return real_value; } longlong Item_singleval_subselect::val_int () { - if (engine->exec()) + if (!engine->exec() && !value->null_value) + { + null_value= 0; + return value->val_int(); + } + else { reset(); return 0; } - return int_value; } String *Item_singleval_subselect::val_str (String *str) { - if (engine->exec() || null_value) + if (!engine->exec() && !value->null_value) + { + null_value= 0; + return value->val_str(str); + } + else { reset(); return 0; } - return &string_value; } Item_exists_subselect::Item_exists_subselect(THD *thd, diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 0e6f939803d..a43caca22f2 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -90,44 +90,28 @@ public: /* single value subselect */ +class Item_cache; class Item_singleval_subselect :public Item_subselect { protected: - longlong int_value; /* Here stored integer value of this item */ - double real_value; /* Here stored real value of this item */ - /* - Here stored string value of this item. - (str_value used only as temporary buffer, because it can be changed - by Item::save_field) - */ - String string_value; - enum Item_result res_type; /* type of results */ + Item_cache *value; public: Item_singleval_subselect(THD *thd, st_select_lex *select_lex); Item_singleval_subselect(Item_singleval_subselect *item): Item_subselect(item) { - int_value= item->int_value; - real_value= item->real_value; - string_value.set(item->string_value, 0, item->string_value.length()); + value= item->value; max_length= item->max_length; decimals= item->decimals; - res_type= item->res_type; } - virtual void reset() - { - null_value= 1; - int_value= 0; - real_value= 0; - max_length= 4; - res_type= STRING_RESULT; - } - double val (); + void reset(); + void store(Item* item); + double val(); longlong val_int (); String *val_str (String *); Item *new_item() { return new Item_singleval_subselect(this); } - enum Item_result result_type() const { return res_type; } + enum Item_result result_type() const; void fix_length_and_dec(); friend class select_singleval_subselect; @@ -149,7 +133,7 @@ public: } Item_exists_subselect(): Item_subselect() {} - virtual void reset() + void reset() { value= 0; } diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 9e0489edb28..50164aed342 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -932,31 +932,7 @@ bool select_singleval_subselect::send_data(List &items) } List_iterator_fast li(items); Item *val_item= li++; // Only one (single value subselect) - /* - Following val() call have to be first, because function AVG() & STD() - calculate value on it & determinate "is it NULL?". - */ - it->real_value= val_item->val_result(); - if ((it->null_value= val_item->null_value)) - { - it->reset(); - } - else - { - it->max_length= val_item->max_length; - it->decimals= val_item->decimals; - it->set_charset(val_item->charset()); - it->int_value= val_item->val_int_result(); - String *s= val_item->str_result(&it->string_value); - if (s != &it->string_value) - { - it->string_value.set(*s, 0, s->length()); - } - // TODO: remove when correct charset handling appeared for Item - it->str_value.set(*s, 0, s->length()); // store charset - - it->res_type= val_item->result_type(); - } + it->store(val_item); it->assigned(1); DBUG_RETURN(0); } From 86ccbe3727e6200010d8b054e899ef0653f10672 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Dec 2002 07:38:33 +0200 Subject: [PATCH 049/220] support of simple row subselects (SCRUM) mysql-test/r/subselect.result: test of simple row subselect fixed table droping mysql-test/t/subselect.test: test of simple row subselect fixed table dropimg sql/item.cc: Item_cache_str fixed to correctly store NULL and copy string value sql/item.h: Item_cache_str fixed to correctly store NULL and copy string value sql/item_cmpfunc.cc: support of simple row subselects sql/item_subselect.cc: support of simple row subselects sql/item_subselect.h: support of simple row subselects sql/sql_class.cc: support of simple row subselects --- mysql-test/r/subselect.result | 70 +++++++++++++- mysql-test/t/subselect.test | 27 +++++- sql/item.cc | 54 +++++++++++ sql/item.h | 26 ++---- sql/item_cmpfunc.cc | 7 ++ sql/item_subselect.cc | 169 ++++++++++++++++++++++++++-------- sql/item_subselect.h | 18 ++-- sql/sql_class.cc | 5 +- 8 files changed, 307 insertions(+), 69 deletions(-) diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 493768ece4a..d45b7b24585 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -52,6 +52,54 @@ a SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL; a 1 +SELECT (SELECT 1,2,3) = ROW(1,2,3); +(SELECT 1,2,3) = ROW(1,2,3) +1 +SELECT (SELECT 1,2,3) = ROW(1,2,1); +(SELECT 1,2,3) = ROW(1,2,1) +0 +SELECT (SELECT 1,2,3) < ROW(1,2,1); +(SELECT 1,2,3) < ROW(1,2,1) +0 +SELECT (SELECT 1,2,3) > ROW(1,2,1); +(SELECT 1,2,3) > ROW(1,2,1) +1 +SELECT (SELECT 1,2,3) = ROW(1,2,NULL); +(SELECT 1,2,3) = ROW(1,2,NULL) +NULL +SELECT ROW(1,2,3) = (SELECT 1,2,3); +ROW(1,2,3) = (SELECT 1,2,3) +1 +SELECT ROW(1,2,3) = (SELECT 1,2,1); +ROW(1,2,3) = (SELECT 1,2,1) +0 +SELECT ROW(1,2,3) < (SELECT 1,2,1); +ROW(1,2,3) < (SELECT 1,2,1) +0 +SELECT ROW(1,2,3) > (SELECT 1,2,1); +ROW(1,2,3) > (SELECT 1,2,1) +1 +SELECT ROW(1,2,3) = (SELECT 1,2,NULL); +ROW(1,2,3) = (SELECT 1,2,NULL) +NULL +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a'); +(SELECT 1.5,2,'a') = ROW(1.5,2,'a') +1 +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b'); +(SELECT 1.5,2,'a') = ROW(1.5,2,'b') +0 +SELECT (SELECT 1.5,2,'a') = ROW('b',2,'b'); +(SELECT 1.5,2,'a') = ROW('b',2,'b') +0 +SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); +(SELECT 'b',2,'a') = ROW(1.5,2,'a') +0 +SELECT (SELECT 1.5,2,'a') = ROW(1.5,'c','a'); +(SELECT 1.5,2,'a') = ROW(1.5,'c','a') +0 +SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); +(SELECT 1.5,'c','a') = ROW(1.5,2,'a') +0 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; create table t1 (a int); create table t2 (a int, b int); @@ -602,7 +650,7 @@ CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin INSERT INTO t1 values (1),(1); UPDATE t SET id=(SELECT * FROM t1); Subselect returns more than 1 record -drop table t; +drop table t, t1; create table t (a int); insert into t values (1),(2),(3); select 1 IN (SELECT * from t); @@ -705,3 +753,23 @@ select 10.5 > ANY (SELECT * from t); 10.5 > ANY (SELECT * from t) 1 drop table t; +create table t1 (a int, b int, c varchar(10)); +create table t2 (a int); +insert into t1 values (1,2,'a'),(2,3,'b'),(3,4,'c'); +insert into t2 values (1),(2),(NULL); +select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t1 where a=t2.a) from t2; +a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a') (select c from t1 where a=t2.a) +1 1 a +2 0 b +NULL NULL NULL +select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2; +a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b') (select c from t1 where a=t2.a) +1 0 a +2 1 b +NULL NULL NULL +select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t1 where a=t2.a) from t2; +a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c') (select c from t1 where a=t2.a) +1 0 a +2 0 b +NULL NULL NULL +drop table t1,t2; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 0527d6a2001..ee3d31e66af 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -26,6 +26,22 @@ select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1)); SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1)); SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL; SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL; +SELECT (SELECT 1,2,3) = ROW(1,2,3); +SELECT (SELECT 1,2,3) = ROW(1,2,1); +SELECT (SELECT 1,2,3) < ROW(1,2,1); +SELECT (SELECT 1,2,3) > ROW(1,2,1); +SELECT (SELECT 1,2,3) = ROW(1,2,NULL); +SELECT ROW(1,2,3) = (SELECT 1,2,3); +SELECT ROW(1,2,3) = (SELECT 1,2,1); +SELECT ROW(1,2,3) < (SELECT 1,2,1); +SELECT ROW(1,2,3) > (SELECT 1,2,1); +SELECT ROW(1,2,3) = (SELECT 1,2,NULL); +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a'); +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b'); +SELECT (SELECT 1.5,2,'a') = ROW('b',2,'b'); +SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); +SELECT (SELECT 1.5,2,'a') = ROW(1.5,'c','a'); +SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; create table t1 (a int); @@ -363,7 +379,7 @@ CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin INSERT INTO t1 values (1),(1); -- error 1240 UPDATE t SET id=(SELECT * FROM t1); -drop table t; +drop table t, t1; #NULL test @@ -409,3 +425,12 @@ select 10.5 > ALL (SELECT * from t); select 1.5 > ANY (SELECT * from t); select 10.5 > ANY (SELECT * from t); drop table t; + +create table t1 (a int, b int, c varchar(10)); +create table t2 (a int); +insert into t1 values (1,2,'a'),(2,3,'b'),(3,4,'c'); +insert into t2 values (1),(2),(NULL); +select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t1 where a=t2.a) from t2; +select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2; +select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t1 where a=t2.a) from t2; +drop table t1,t2; diff --git a/sql/item.cc b/sql/item.cc index fbe0e27a01c..44851d26ef1 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1217,6 +1217,60 @@ bool field_is_equal_to_item(Field *field,Item *item) return result == field->val_real(); } +Item_cache* Item_cache::get_cache(Item_result type) +{ + switch (type) + { + case INT_RESULT: + return new Item_cache_int(); + case REAL_RESULT: + return new Item_cache_real(); + case STRING_RESULT: + return new Item_cache_str(); + default: + // should never be in real life + DBUG_ASSERT(0); + return 0; + } +} + +void Item_cache_str::store(Item *item) +{ + str_value.set(buffer, sizeof(buffer), item->charset()); + value= item->str_result(&str_value); + if ((null_value= item->null_value)) + value= 0; + else if (value != &str_value) + { + /* + We copy string value to avoid changing value if 'item' is table field + in queries like following (where t1.c is varchar): + select a, + (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'), + (select c from t1 where a=t2.a) + from t2; + */ + str_value.copy(*value); + value= &str_value; + } + +} +double Item_cache_str::val() +{ + if (value) + return my_strntod(value->charset(), value->ptr(), + value->length(), (char**)0); + else + return (double)0; +} +longlong Item_cache_str::val_int() +{ + if (value) + return my_strntoll(value->charset(), value->ptr(), + value->length(), (char**) 0, 10); + else + return (longlong)0; +} /***************************************************************************** ** Instantiate templates diff --git a/sql/item.h b/sql/item.h index 461a3805080..d11148f8b3f 100644 --- a/sql/item.h +++ b/sql/item.h @@ -103,7 +103,9 @@ public: virtual Item** addr(uint i) { return 0; } virtual bool check_cols(uint c); // It is not row => null inside is impossible - virtual bool null_inside() { return 0; }; + virtual bool null_inside() { return 0; } + // used in row subselects to get value of elements + virtual void bring_value() {} }; @@ -719,6 +721,7 @@ public: decimals= dec; } enum Type type() const { return CACHE_ITEM; } + static Item_cache* get_cache(Item_result type); }; class Item_cache_int: public Item_cache @@ -766,24 +769,9 @@ class Item_cache_str: public Item_cache public: Item_cache_str() { fixed= 1; null_value= 1; } - void store(Item *item) - { - str_value.set(buffer, sizeof(buffer), item->charset()); - value= item->str_result(&str_value); - // TODO remove if str_value charset have no side effect for now - str_value.set_charset(value->charset()); - null_value= item->null_value; - } - double val() - { - return my_strntod(value->charset(), value->ptr(), - value->length(), (char**)0); - } - longlong val_int() - { - return my_strntoll(value->charset(), value->ptr(), - value->length(), (char**) 0, 10); - } + void store(Item *item); + double val(); + longlong val_int(); String* val_str(String *) { return value; } enum Item_result result_type() const { return STRING_RESULT; } CHARSET_INFO *charset() const { return value->charset(); }; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 851a591bae9..39840fc90fd 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -247,6 +247,8 @@ int Arg_comparator::compare_e_int() int Arg_comparator::compare_row() { int res= 0; + (*a)->bring_value(); + (*b)->bring_value(); uint n= (*a)->cols(); for (uint i= 0; ibring_value(); + (*b)->bring_value(); uint n= (*a)->cols(); for (uint i= 0; icols(); if ((comparators= (cmp_item **) thd->alloc(sizeof(cmp_item *)*n))) { + item->bring_value(); item->null_value= 0; for (uint i=0; i < n; i++) if ((comparators[i]= cmp_item::get_comparator(item->el(i)))) @@ -1252,6 +1257,7 @@ void cmp_item_row::store_value_by_template(cmp_item *t, Item *item) n= tmpl->n; if ((comparators= (cmp_item **) sql_alloc(sizeof(cmp_item *)*n))) { + item->bring_value(); item->null_value= 0; for (uint i=0; i < n; i++) if ((comparators[i]= tmpl->comparators[i]->make_same())) @@ -1284,6 +1290,7 @@ int cmp_item_row::cmp(Item *arg) return 1; } bool was_null= 0; + arg->bring_value(); for (uint i=0; i < n; i++) if (comparators[i]->cmp(arg->el(i))) { diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 588be06a7e7..972c265a16b 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -112,9 +112,14 @@ bool Item_subselect::check_loop(uint id) DBUG_RETURN(engine->check_loop(id)); } +Item::Type Item_subselect::type() const +{ + return SUBSELECT_ITEM; +} + void Item_subselect::fix_length_and_dec() { - engine->fix_length_and_dec(); + engine->fix_length_and_dec(0); } inline table_map Item_subselect::used_tables() const @@ -130,6 +135,7 @@ Item_singleval_subselect::Item_singleval_subselect(THD *thd, init(thd, select_lex, new select_singleval_subselect(this)); max_columns= 1; maybe_null= 1; + max_columns= UINT_MAX; DBUG_VOID_RETURN; } @@ -140,9 +146,9 @@ void Item_singleval_subselect::reset() value->null_value= 1; } -void Item_singleval_subselect::store(Item *item) +void Item_singleval_subselect::store(uint i, Item *item) { - value->store(item); + row[i]->store(item); } enum Item_result Item_singleval_subselect::result_type() const @@ -152,29 +158,58 @@ enum Item_result Item_singleval_subselect::result_type() const void Item_singleval_subselect::fix_length_and_dec() { - engine->fix_length_and_dec(); - switch (engine->type()) + if ((max_columns= engine->cols()) == 1) { - case INT_RESULT: - value= new Item_cache_int(); - break; - case REAL_RESULT: - value= new Item_cache_real(); - break; - case STRING_RESULT: - value= new Item_cache_str(); - break; - default: - // should never be in real life - DBUG_ASSERT(0); - return; + engine->fix_length_and_dec(row= &value); + if (!(value= Item_cache::get_cache(engine->type()))) + { + my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); + current_thd->fatal_error= 1; + return; + } + } + else + { + THD *thd= current_thd; + if (!(row= (Item_cache**)thd->alloc(sizeof(Item_cache*)*max_columns))) + { + my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); + thd->fatal_error= 1; + return; + } + engine->fix_length_and_dec(row); + value= *row; } - value->set_len_n_dec(max_length, decimals); } -Item::Type Item_subselect::type() const +uint Item_singleval_subselect::cols() { - return SUBSELECT_ITEM; + return engine->cols(); +} + +bool Item_singleval_subselect::check_cols(uint c) +{ + if (c != engine->cols()) + { + my_error(ER_CARDINALITY_COL, MYF(0), c); + return 1; + } + return 0; +} + +bool Item_singleval_subselect::null_inside() +{ + for (uint i= 0; i < max_columns ; i++) + { + if (row[i]->null_value) + return 1; + } + return 0; +} + +void Item_singleval_subselect::bring_value() +{ + engine->exec(); } double Item_singleval_subselect::val () @@ -268,7 +303,7 @@ Item_allany_subselect::Item_allany_subselect(THD *thd, Item * left_exp, void Item_exists_subselect::fix_length_and_dec() { - decimals=0; + decimals= 0; max_length= 1; } @@ -540,31 +575,85 @@ int subselect_union_engine::prepare() return unit->prepare(thd, result); } -void subselect_single_select_engine::fix_length_and_dec() +static Item_result set_row(SELECT_LEX *select_lex, Item * item, + Item_cache **row) { + Item_result res_type= STRING_RESULT; + Item *sel_item; List_iterator_fast li(select_lex->item_list); - Item *sel_item= li++; - item->max_length= sel_item->max_length; - res_type= sel_item->result_type(); - item->decimals= sel_item->decimals; + for (uint i= 0; (sel_item= li++); i++) + { + item->max_length= sel_item->max_length; + res_type= sel_item->result_type(); + item->decimals= sel_item->decimals; + if (row) + { + if (!(row[i]= Item_cache::get_cache(res_type))) + { + my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); + current_thd->fatal_error= 1; + return STRING_RESULT; // we should return something + } + row[i]->set_len_n_dec(sel_item->max_length, sel_item->decimals); + } + } + if (select_lex->item_list.elements > 1) + res_type= ROW_RESULT; + return res_type; } -void subselect_union_engine::fix_length_and_dec() +void subselect_single_select_engine::fix_length_and_dec(Item_cache **row) { - uint32 mlen= 0, len; - Item *sel_item= 0; - for (SELECT_LEX *sl= unit->first_select(); sl; sl= sl->next_select()) + DBUG_ASSERT(row || select_lex->item_list.elements==1); + res_type= set_row(select_lex, item, row); +} + +void subselect_union_engine::fix_length_and_dec(Item_cache **row) +{ + DBUG_ASSERT(row || unit->first_select()->item_list.elements==1); + + if (unit->first_select()->item_list.elements == 1) { - List_iterator_fast li(sl->item_list); - Item *s_item= li++; - if ((len= s_item->max_length)) - mlen= len; - if (!sel_item) - sel_item= s_item; + uint32 mlen= 0, len; + Item *sel_item= 0; + for (SELECT_LEX *sl= unit->first_select(); sl; sl= sl->next_select()) + { + List_iterator_fast li(sl->item_list); + Item *s_item= li++; + if ((len= s_item->max_length) > mlen) + mlen= len; + if (!sel_item) + sel_item= s_item; + } + item->max_length= mlen; + res_type= sel_item->result_type(); + item->decimals= sel_item->decimals; + if (row) + { + if (!(row[0]= Item_cache::get_cache(res_type))) + { + my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); + current_thd->fatal_error= 1; + return; + } + row[0]->set_len_n_dec(mlen, sel_item->decimals); + } + } + else + { + SELECT_LEX *sl= unit->first_select(); + res_type= set_row(sl, item, row); + for(sl= sl->next_select(); sl; sl->next_select()) + { + List_iterator_fast li(sl->item_list); + Item *sel_item; + for (uint i= 0; (sel_item= li++); i++) + { + if (sel_item->max_length > row[i]->max_length) + row[i]->max_length= sel_item->max_length; + } + } } - item->max_length= mlen; - res_type= sel_item->result_type(); - item->decimals= sel_item->decimals; } int subselect_single_select_engine::exec() diff --git a/sql/item_subselect.h b/sql/item_subselect.h index a43caca22f2..3cb68cb3875 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -94,8 +94,7 @@ class Item_cache; class Item_singleval_subselect :public Item_subselect { protected: - Item_cache *value; - + Item_cache *value, **row; public: Item_singleval_subselect(THD *thd, st_select_lex *select_lex); Item_singleval_subselect(Item_singleval_subselect *item): @@ -106,7 +105,7 @@ public: decimals= item->decimals; } void reset(); - void store(Item* item); + void store(uint i, Item* item); double val(); longlong val_int (); String *val_str (String *); @@ -114,6 +113,13 @@ public: enum Item_result result_type() const; void fix_length_and_dec(); + uint cols(); + Item* el(uint i) { return (Item*)row[i]; } + Item** addr(uint i) { return (Item**)row + i; } + bool check_cols(uint c); + bool null_inside(); + void bring_value(); + friend class select_singleval_subselect; }; @@ -212,7 +218,7 @@ public: } virtual int prepare()= 0; - virtual void fix_length_and_dec()= 0; + virtual void fix_length_and_dec(Item_cache** row)= 0; virtual int exec()= 0; virtual uint cols()= 0; /* return number of columnss in select */ virtual bool depended()= 0; /* depended from outer select */ @@ -233,7 +239,7 @@ public: select_subselect *result, Item_subselect *item); int prepare(); - void fix_length_and_dec(); + void fix_length_and_dec(Item_cache** row); int exec(); uint cols(); bool depended(); @@ -250,7 +256,7 @@ public: select_subselect *result, Item_subselect *item); int prepare(); - void fix_length_and_dec(); + void fix_length_and_dec(Item_cache** row); int exec(); uint cols(); bool depended(); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 50164aed342..0b12a34ebfb 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -931,8 +931,9 @@ bool select_singleval_subselect::send_data(List &items) DBUG_RETURN(0); } List_iterator_fast li(items); - Item *val_item= li++; // Only one (single value subselect) - it->store(val_item); + Item *val_item; + for (uint i= 0; (val_item= li++); i++) + it->store(i, val_item); it->assigned(1); DBUG_RETURN(0); } From de539bf30adc10a93759729531622dd10ac42155 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Dec 2002 12:38:32 +0400 Subject: [PATCH 050/220] patches from sleepycat.com have been applied (SCRUM) ha_berkeley::rename_table() has been added (SCRUM) bdb/db/db_open.c: patches from sleepycat.com have been applied bdb/log/log_put.c: patches from sleepycat.com have been applied bdb/mp/mp_fopen.c: patches from sleepycat.com have been applied bdb/rep/rep_record.c: patches from sleepycat.com have been applied bdb/txn/txn.c: patches from sleepycat.com have been applied sql/ha_berkeley.cc: ha_berkeley::rename_table() has been added sql/ha_berkeley.h: ha_berkeley::rename_table() has been added --- bdb/db/db_open.c | 6 ++---- bdb/log/log_put.c | 2 ++ bdb/mp/mp_fopen.c | 35 ++++++++++++++++++--------------- bdb/rep/rep_record.c | 3 +++ bdb/txn/txn.c | 46 ++++++++++++++++++++++++++++++++------------ sql/ha_berkeley.cc | 18 +++++++++++++++++ sql/ha_berkeley.h | 1 + 7 files changed, 79 insertions(+), 32 deletions(-) diff --git a/bdb/db/db_open.c b/bdb/db/db_open.c index f6f96cda547..8352525361f 100644 --- a/bdb/db/db_open.c +++ b/bdb/db/db_open.c @@ -536,11 +536,9 @@ swap_retry: * and even a checksum error isn't a reason to panic the environment. */ if ((ret = __db_chk_meta(dbenv, dbp, meta, do_metachk)) != 0) { - if (ret == -1) { + if (ret == -1) __db_err(dbenv, "%s: metadata page checksum error", name); - ret = EINVAL; - } goto bad_format; } @@ -577,7 +575,7 @@ swap_retry: bad_format: __db_err(dbenv, "%s: unexpected file type or format", name); - return (ret); + return (ret == 0 ? EINVAL : ret); } /* diff --git a/bdb/log/log_put.c b/bdb/log/log_put.c index bf6de2b0f7b..64276fa8315 100644 --- a/bdb/log/log_put.c +++ b/bdb/log/log_put.c @@ -268,6 +268,8 @@ __log_txn_lsn(dbenv, lsnp, mbytesp, bytesp) if (mbytesp != NULL) { *mbytesp = lp->stat.st_wc_mbytes; *bytesp = (u_int32_t)(lp->stat.st_wc_bytes + lp->b_off); + + lp->stat.st_wc_mbytes = lp->stat.st_wc_bytes = 0; } R_UNLOCK(dbenv, &dblp->reginfo); diff --git a/bdb/mp/mp_fopen.c b/bdb/mp/mp_fopen.c index a91bf264652..8fdefb0f5e9 100644 --- a/bdb/mp/mp_fopen.c +++ b/bdb/mp/mp_fopen.c @@ -344,6 +344,23 @@ __memp_fopen_int(dbmfp, mfp, path, flags, mode, pagesize) goto err; } + /* + * Figure out the file's size. + * + * !!! + * We can't use off_t's here, or in any code in the mainline library + * for that matter. (We have to use them in the os stubs, of course, + * as there are system calls that take them as arguments.) The reason + * is some customers build in environments where an off_t is 32-bits, + * but still run where offsets are 64-bits, and they pay us a lot of + * money. + */ + if ((ret = __os_ioinfo( + dbenv, rpath, dbmfp->fhp, &mbytes, &bytes, NULL)) != 0) { + __db_err(dbenv, "%s: %s", rpath, db_strerror(ret)); + goto err; + } + /* * Get the file id if we weren't given one. Generated file id's * don't use timestamps, otherwise there'd be no chance of any @@ -470,6 +487,7 @@ alloc: /* Allocate and initialize a new MPOOLFILE. */ F_SET(mfp, MP_DIRECT); if (LF_ISSET(DB_EXTENT)) F_SET(mfp, MP_EXTENT); + F_SET(mfp, MP_CAN_MMAP); if (path == NULL) F_SET(mfp, MP_TEMP); @@ -479,21 +497,6 @@ alloc: /* Allocate and initialize a new MPOOLFILE. */ * and find the number of the last page in the file, all the * time being careful not to overflow 32 bits. * - * !!! - * We can't use off_t's here, or in any code in the mainline - * library for that matter. (We have to use them in the os - * stubs, of course, as there are system calls that take them - * as arguments.) The reason is that some customers build in - * environments where an off_t is 32-bits, but still run where - * offsets are 64-bits, and they pay us a lot of money. - */ - if ((ret = __os_ioinfo( - dbenv, rpath, dbmfp->fhp, &mbytes, &bytes, NULL)) != 0) { - __db_err(dbenv, "%s: %s", rpath, db_strerror(ret)); - goto err; - } - - /* * During verify or recovery, we might have to cope with a * truncated file; if the file size is not a multiple of the * page size, round down to a page, we'll take care of the @@ -582,7 +585,7 @@ check_map: * compiler will perpetrate, doing the comparison in a portable way is * flatly impossible. Hope that mmap fails if the file is too large. */ -#define DB_MAXMMAPSIZE (10 * 1024 * 1024) /* 10 Mb. */ +#define DB_MAXMMAPSIZE (10 * 1024 * 1024) /* 10 MB. */ if (F_ISSET(mfp, MP_CAN_MMAP)) { if (path == NULL) F_CLR(mfp, MP_CAN_MMAP); diff --git a/bdb/rep/rep_record.c b/bdb/rep/rep_record.c index e725008786c..d3619f509b4 100644 --- a/bdb/rep/rep_record.c +++ b/bdb/rep/rep_record.c @@ -1198,6 +1198,9 @@ gap_check: lp->wait_recs = 0; * replica get flushed now and again. */ ret = dbenv->log_flush(dbenv, &ckp_lsn); + /* Update the last_ckp in the txn region. */ + if (ret == 0) + __txn_updateckp(dbenv, &rp->lsn); break; case DB___txn_regop: if (!F_ISSET(dbenv, DB_ENV_REP_LOGSONLY)) diff --git a/bdb/txn/txn.c b/bdb/txn/txn.c index 06fc8264afd..78c54791d06 100644 --- a/bdb/txn/txn.c +++ b/bdb/txn/txn.c @@ -1209,18 +1209,7 @@ do_ckp: /* Look through the active transactions for the lowest begin LSN. */ return (ret); } - /* - * We want to make sure last_ckp only moves forward; since - * we drop locks above and in log_put, it's possible - * for two calls to __txn_ckp_log to finish in a different - * order from how they were called. - */ - R_LOCK(dbenv, &mgr->reginfo); - if (log_compare(®ion->last_ckp, &ckp_lsn) < 0) { - region->last_ckp = ckp_lsn; - (void)time(®ion->time_ckp); - } - R_UNLOCK(dbenv, &mgr->reginfo); + __txn_updateckp(dbenv, &ckp_lsn); } return (0); } @@ -1404,3 +1393,36 @@ __txn_reset(dbenv) return (__txn_recycle_log(dbenv, NULL, &scrap, 0, TXN_MINIMUM, TXN_MAXIMUM)); } + +/* + * __txn_updateckp -- + * Update the last_ckp field in the transaction region. This happens + * at the end of a normal checkpoint and also when a replication client + * receives a checkpoint record. + * + * PUBLIC: void __txn_updateckp __P((DB_ENV *, DB_LSN *)); + */ +void +__txn_updateckp(dbenv, lsnp) + DB_ENV *dbenv; + DB_LSN *lsnp; +{ + DB_TXNMGR *mgr; + DB_TXNREGION *region; + + mgr = dbenv->tx_handle; + region = mgr->reginfo.primary; + + /* + * We want to make sure last_ckp only moves forward; since + * we drop locks above and in log_put, it's possible + * for two calls to __txn_ckp_log to finish in a different + * order from how they were called. + */ + R_LOCK(dbenv, &mgr->reginfo); + if (log_compare(®ion->last_ckp, lsnp) < 0) { + region->last_ckp = *lsnp; + (void)time(®ion->time_ckp); + } + R_UNLOCK(dbenv, &mgr->reginfo); +} diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 1b8a2d9b3f8..adc2e0db195 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -1940,6 +1940,24 @@ int ha_berkeley::delete_table(const char *name) DBUG_RETURN(error); } + +int ha_berkeley::rename_table(const char * from, const char * to) +{ + int error; + char from_buff[FN_REFLEN]; + char to_buff[FN_REFLEN]; + + if ((error= db_create(&file, db_env, 0))) + my_errno= error; + else + error= file->rename(file, + fn_format(from_buff, from, "", ha_berkeley_ext, 2 | 4), + NULL, fn_format(to_buff, to, "", ha_berkeley_ext, + 2 | 4), 0); + return error; +} + + /* How many seeks it will take to read through the table This is to be comparable to the number returned by records_in_range so diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h index dfdd12470d6..dd42e7ab9e2 100644 --- a/sql/ha_berkeley.h +++ b/sql/ha_berkeley.h @@ -152,6 +152,7 @@ class ha_berkeley: public handler int create(const char *name, register TABLE *form, HA_CREATE_INFO *create_info); int delete_table(const char *name); + int rename_table(const char* from, const char* to); THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); From 3522a78600194e51613a44c95d48cb7299bbb0a9 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Dec 2002 14:08:25 +0500 Subject: [PATCH 051/220] server-cfg.sh: Corrected some typo. sql-bench/server-cfg.sh: Corrected some typo. --- sql-bench/server-cfg.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sql-bench/server-cfg.sh b/sql-bench/server-cfg.sh index 31b8628ad79..589ce519a86 100644 --- a/sql-bench/server-cfg.sh +++ b/sql-bench/server-cfg.sh @@ -3467,7 +3467,7 @@ sub version && $row[0] =~ /([\d\.]+)/) { $version=$row[0]; - $verson =~ s/KERNEL/SAP DB/i; + $version =~ s/KERNEL/SAP DB/i; } $sth->finish; $dbh->disconnect; @@ -3528,7 +3528,6 @@ sub create }else{ my @fields = split(' ',$ind); my $query="CREATE INDEX $fields[1] ON $table_name $fields[2]"; - print "$query \n"; push(@index,$query); } } From d19ba004e45cb33f5dce8182b633a54af3b9c4c3 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Dec 2002 15:27:46 +0400 Subject: [PATCH 052/220] Less "default_charset_info" --- sql/field.cc | 16 ++++++++-------- sql/field.h | 24 ++++++++++++------------ sql/item_buff.cc | 2 +- sql/opt_range.cc | 5 +++-- sql/opt_sum.cc | 3 ++- sql/sql_select.cc | 9 ++++++--- 6 files changed, 32 insertions(+), 27 deletions(-) diff --git a/sql/field.cc b/sql/field.cc index 8a53928a771..9acf2e14829 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -4276,7 +4276,7 @@ uint Field_varstring::max_packed_col_length(uint max_length) return (max_length > 255 ? 2 : 1)+max_length; } -void Field_varstring::get_key_image(char *buff, uint length, imagetype type) +void Field_varstring::get_key_image(char *buff, uint length, CHARSET_INFO *cs,imagetype type) { length-= HA_KEY_BLOB_LENGTH; uint f_length=uint2korr(ptr); @@ -4290,10 +4290,10 @@ void Field_varstring::get_key_image(char *buff, uint length, imagetype type) #endif } -void Field_varstring::set_key_image(char *buff,uint length) +void Field_varstring::set_key_image(char *buff,uint length, CHARSET_INFO *cs) { length=uint2korr(buff); // Real length is here - (void) Field_varstring::store(buff+2, length, default_charset_info); + (void) Field_varstring::store(buff+2, length, cs); } @@ -4542,7 +4542,7 @@ int Field_blob::cmp_binary(const char *a_ptr, const char *b_ptr, /* The following is used only when comparing a key */ -void Field_blob::get_key_image(char *buff,uint length, imagetype type) +void Field_blob::get_key_image(char *buff,uint length, CHARSET_INFO *cs,imagetype type) { length-= HA_KEY_BLOB_LENGTH; uint32 blob_length= get_length(ptr); @@ -4577,14 +4577,14 @@ void Field_blob::get_key_image(char *buff,uint length, imagetype type) memcpy(buff+2,blob,length); } -void Field_blob::set_key_image(char *buff,uint length) +void Field_blob::set_key_image(char *buff,uint length, CHARSET_INFO *cs) { length=uint2korr(buff); - (void) Field_blob::store(buff+2,length, default_charset_info); + (void) Field_blob::store(buff+2,length,cs); } -void Field_geom::get_key_image(char *buff,uint length, imagetype type) +void Field_geom::get_key_image(char *buff,uint length,CHARSET_INFO *cs, imagetype type) { length-=HA_KEY_BLOB_LENGTH; ulong blob_length=get_length(ptr); @@ -4603,7 +4603,7 @@ void Field_geom::get_key_image(char *buff,uint length, imagetype type) return; } -void Field_geom::set_key_image(char *buff,uint length) +void Field_geom::set_key_image(char *buff,uint length,CHARSET_INFO *cs) { } diff --git a/sql/field.h b/sql/field.h index d0855aa46b3..40578d19c82 100644 --- a/sql/field.h +++ b/sql/field.h @@ -149,14 +149,14 @@ public: if (null_ptr) null_ptr=ADD_TO_PTR(null_ptr,ptr_diff,uchar*); } - inline void get_image(char *buff,uint length) + inline void get_image(char *buff,uint length, CHARSET_INFO *cs) { memcpy(buff,ptr,length); } - inline void set_image(char *buff,uint length) + inline void set_image(char *buff,uint length, CHARSET_INFO *cs) { memcpy(ptr,buff,length); } - virtual void get_key_image(char *buff,uint length, imagetype type) - { get_image(buff,length); } - virtual void set_key_image(char *buff,uint length) - { set_image(buff,length); } + virtual void get_key_image(char *buff,uint length, CHARSET_INFO *cs, imagetype type) + { get_image(buff,length,cs); } + virtual void set_key_image(char *buff,uint length, CHARSET_INFO *cs) + { set_image(buff,length,cs); } inline int cmp_image(char *buff,uint length) { return memcmp(ptr,buff,length); } inline longlong val_int_offset(uint row_offset) @@ -836,8 +836,8 @@ public: bool send_binary(Protocol *protocol); int cmp(const char *,const char*); void sort_string(char *buff,uint length); - void get_key_image(char *buff,uint length, imagetype type); - void set_key_image(char *buff,uint length); + void get_key_image(char *buff,uint length, CHARSET_INFO *cs, imagetype type); + void set_key_image(char *buff,uint length, CHARSET_INFO *cs); void sql_type(String &str) const; char *pack(char *to, const char *from, uint max_length=~(uint) 0); const char *unpack(char* to, const char *from); @@ -908,8 +908,8 @@ public: store_length(length); memcpy_fixed(ptr+packlength,&data,sizeof(char*)); } - void get_key_image(char *buff,uint length, imagetype type); - void set_key_image(char *buff,uint length); + void get_key_image(char *buff,uint length, CHARSET_INFO *cs, imagetype type); + void set_key_image(char *buff,uint length, CHARSET_INFO *cs); void sql_type(String &str) const; inline bool copy() { char *tmp; @@ -950,8 +950,8 @@ public: table_arg, my_charset_bin) {} enum ha_base_keytype key_type() const { return HA_KEYTYPE_VARBINARY; } - void get_key_image(char *buff,uint length, imagetype type); - void set_key_image(char *buff,uint length); + void get_key_image(char *buff,uint length, CHARSET_INFO *cs,imagetype type); + void set_key_image(char *buff,uint length, CHARSET_INFO *cs); }; diff --git a/sql/item_buff.cc b/sql/item_buff.cc index 7b8976bb572..573d4ab17e3 100644 --- a/sql/item_buff.cc +++ b/sql/item_buff.cc @@ -99,7 +99,7 @@ bool Item_field_buff::cmp(void) { bool tmp= field->cmp(buff) != 0; // This is not a blob! if (tmp) - field->get_image(buff,length); + field->get_image(buff,length,field->charset()); if (null_value != field->is_null()) { null_value= !null_value; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index bcea522cb6d..fd1a56fc97a 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1043,7 +1043,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part, if (maybe_null) *str= (char) field->is_real_null(); // Set to 1 if null field->get_key_image(str+maybe_null,key_part->part_length, - key_part->image_type); + field->charset(),key_part->image_type); if (!(tree=new SEL_ARG(field,str,str))) DBUG_RETURN(0); @@ -2813,7 +2813,8 @@ print_key(KEY_PART *key_part,const char *key,uint used_length) } field->set_key_image((char*) key,key_part->part_length - ((field->type() == FIELD_TYPE_BLOB) ? - HA_KEY_BLOB_LENGTH : 0)); + HA_KEY_BLOB_LENGTH : 0), + field->charset()); field->val_str(&tmp,&tmp); fwrite(tmp.ptr(),sizeof(char),tmp.length(),DBUG_FILE); } diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index 1477d46e756..b1bb36353bf 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -364,7 +364,8 @@ static bool find_range_key(TABLE_REF *ref, Field* field, COND *cond) // Save found constant if (part->null_bit) *key_ptr++= (byte) test(part->field->is_null()); - part->field->get_key_image((char*) key_ptr,part->length, Field::itRAW); + part->field->get_key_image((char*) key_ptr,part->length, + part->field->charset(), Field::itRAW); key_ptr+=part->store_length - test(part->null_bit); left_length-=part->store_length; } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 602a4b494b6..988cae8363b 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -6645,12 +6645,14 @@ store_record_in_cache(JOIN_CACHE *cache) { if (last_record) { - copy->blob_field->get_image((char*) pos,copy->length+sizeof(char*)); + copy->blob_field->get_image((char*) pos,copy->length+sizeof(char*), + copy->blob_field->charset()); pos+=copy->length+sizeof(char*); } else { - copy->blob_field->get_image((char*) pos,copy->length); // blob length + copy->blob_field->get_image((char*) pos,copy->length, // blob length + copy->blob_field->charset()); memcpy(pos+copy->length,copy->str,copy->blob_length); // Blob data pos+=copy->length+copy->blob_length; } @@ -6707,7 +6709,8 @@ read_cached_record(JOIN_TAB *tab) { if (last_record) { - copy->blob_field->set_image((char*) pos,copy->length+sizeof(char*)); + copy->blob_field->set_image((char*) pos,copy->length+sizeof(char*), + copy->blob_field->charset()); pos+=copy->length+sizeof(char*); } else From 900a86f63141bf78b3571518264c5076c3330587 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Dec 2002 13:35:12 +0200 Subject: [PATCH 053/220] Item_in_optimizer is changed to be used with row IN subselect (SCRUM) removed unused items sql/item.cc: removed unused Items sql/item.h: removed unused Items sql/item_cmpfunc.cc: Item_in_optimizer is changed to be used with row IN subselect sql/item_cmpfunc.h: Item_in_optimizer is changed to be used with row IN subselect sql/item_subselect.cc: Item_in_optimizer is changed to be used with row IN subselect --- sql/item.cc | 31 ----------------- sql/item.h | 72 --------------------------------------- sql/item_cmpfunc.cc | 78 ++++++++++++++++++++----------------------- sql/item_cmpfunc.h | 19 ++++------- sql/item_subselect.cc | 5 +-- 5 files changed, 46 insertions(+), 159 deletions(-) diff --git a/sql/item.cc b/sql/item.cc index 44851d26ef1..340eb2c985c 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -47,11 +47,6 @@ Item::Item(): loop_id= 0; } -Item_ref_in_optimizer::Item_ref_in_optimizer(Item_in_optimizer *master, - char *table_name_par, - char *field_name_par): - Item_ref(master->args, table_name_par, field_name_par), owner(master) {} - bool Item::check_loop(uint id) { @@ -437,20 +432,6 @@ String *Item_copy_string::val_str(String *str) return &str_value; } -double Item_ref_in_optimizer::val() -{ - return owner->get_cache(); -} -longlong Item_ref_in_optimizer::val_int() -{ - return owner->get_cache_int(); -} -String* Item_ref_in_optimizer::val_str(String* s) -{ - return owner->get_cache_str(s); -} - - /* Functions to convert item to field (for send_fields) */ @@ -464,18 +445,6 @@ bool Item::fix_fields(THD *thd, return 0; } -bool Item_outer_select_context_saver::fix_fields(THD *thd, - struct st_table_list *list, - Item ** ref) -{ - DBUG_ENTER("Item_outer_select_context_saver::fix_fields"); - bool res= item->fix_fields(thd, - 0, // do not show current subselect fields - &item); - *ref= item; - DBUG_RETURN(res); -} - bool Item_asterisk_remover::fix_fields(THD *thd, struct st_table_list *list, Item ** ref) diff --git a/sql/item.h b/sql/item.h index d11148f8b3f..21087cfe0e2 100644 --- a/sql/item.h +++ b/sql/item.h @@ -109,60 +109,6 @@ public: }; -/* - Wrapper base class -*/ - -class Item_wrapper :public Item -{ -protected: - Item *item; -public: - /* - Following methods should not be used, because fix_fields exclude this - item (it assign '*ref' with field 'item' in derived classes) - */ - enum Type type() const { return item->type(); } - enum_field_types field_type() const { return item->field_type(); } - double val() { return item->val(); } - longlong val_int() { return item->val_int(); } - String* val_str(String* s) { return item->val_str(s); } - bool check_cols(uint col) { return item->check_cols(col); } - bool eq(const Item *item, bool binary_cmp) const - { return item->eq(item, binary_cmp); } - bool is_null() - { - item->val_int(); - return item->null_value; - } - bool get_date(TIME *ltime, bool fuzzydate) - { - return (null_value=item->get_date(ltime, fuzzydate)); - } - bool send(Protocol *prot, String *tmp) { return item->send(prot, tmp); } - int save_in_field(Field *field, bool no_conversions) - { - return item->save_in_field(field, no_conversions); - } - void save_org_in_field(Field *field) { item->save_org_in_field(field); } - enum Item_result result_type () const { return item->result_type(); } - table_map used_tables() const { return item->used_tables(); } -}; - - -/* - Save context of name resolution for Item, used in subselect transformer. -*/ -class Item_outer_select_context_saver :public Item_wrapper -{ -public: - Item_outer_select_context_saver(Item *it) - { - item= it; - } - bool fix_fields(THD *, struct st_table_list *, Item ** ref); -}; - class st_select_lex; class Item_ident :public Item { @@ -579,24 +525,6 @@ public: bool fix_fields(THD *, struct st_table_list *, Item ** ref); }; -class Item_in_optimizer; -class Item_ref_in_optimizer: public Item_ref -{ -protected: - Item_in_optimizer* owner; -public: - Item_ref_in_optimizer(Item_in_optimizer* master, - char *table_name_par,char *field_name_par); - double val(); - longlong val_int(); - String* val_str(String* s); - bool fix_fields(THD *, struct st_table_list *, Item ** ref) - { - fixed= 1; - return 0; - } -}; - /* The following class is used to optimize comparing of date columns We need to save the original item, to be able to set the field to the diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 39840fc90fd..be25a2609b0 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -274,13 +274,41 @@ int Arg_comparator::compare_e_row() return 1; } +bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables, + Item ** ref) +{ + + if (args[0]->check_cols(allowed_arg_cols) || + args[0]->fix_fields(thd, tables, args)) + return 1; + if (args[0]->maybe_null) + maybe_null=1; + if (args[0]->binary()) + set_charset(my_charset_bin); + with_sum_func= args[0]->with_sum_func; + used_tables_cache= args[0]->used_tables(); + const_item_cache= args[0]->const_item(); + if (!(cache= Item_cache::get_cache(args[0]->result_type()))) + { + my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); + thd->fatal_error= 1; + return 1; + } + if (args[1]->check_cols(allowed_arg_cols) || + args[1]->fix_fields(thd, tables, args)) + return 1; + if (args[1]->maybe_null) + maybe_null=1; + with_sum_func= with_sum_func || args[1]->with_sum_func; + used_tables_cache|= args[1]->used_tables(); + const_item_cache&= args[1]->const_item(); + return 0; +} + longlong Item_in_optimizer::val_int() { - int_cache_ok= 1; - flt_cache_ok= 0; - str_cache_ok= 0; - int_cache= args[0]->val_int_result(); - if (args[0]->null_value) + cache->store(args[0]); + if (cache->null_value) { null_value= 1; return 0; @@ -290,44 +318,10 @@ longlong Item_in_optimizer::val_int() return tmp; } -longlong Item_in_optimizer::get_cache_int() +bool Item_in_optimizer::is_null() { - if (!int_cache_ok) - { - int_cache_ok= 1; - flt_cache_ok= 0; - str_cache_ok= 0; - int_cache= args[0]->val_int_result(); - null_value= args[0]->null_value; - } - return int_cache; -} - -double Item_in_optimizer::get_cache() -{ - if (!flt_cache_ok) - { - flt_cache_ok= 1; - int_cache_ok= 0; - str_cache_ok= 0; - flt_cache= args[0]->val_result(); - null_value= args[0]->null_value; - } - return flt_cache; -} - -String *Item_in_optimizer::get_cache_str(String *s) -{ - if (!str_cache_ok) - { - str_cache_ok= 1; - int_cache_ok= 0; - flt_cache_ok= 0; - str_value.set(buffer, sizeof(buffer), s->charset()); - str_cache= args[0]->str_result(&str_value); - null_value= args[0]->null_value; - } - return str_cache; + cache->store(args[0]); + return (null_value= (cache->null_value || args[1]->is_null())); } longlong Item_func_eq::val_int() diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 994e51ef89f..41171da1338 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -85,25 +85,20 @@ public: void fix_length_and_dec() { decimals=0; max_length=1; } }; +class Item_cache; class Item_in_optimizer: public Item_bool_func { protected: - char buffer[80]; - longlong int_cache; - double flt_cache; - String *str_cache; - bool int_cache_ok, flt_cache_ok, str_cache_ok; + Item_cache *cache; public: Item_in_optimizer(Item *a,Item *b): - Item_bool_func(a,b), int_cache_ok(0), flt_cache_ok(0), str_cache_ok(0) {} - bool is_null() { return test(args[0]->is_null() || args[1]->is_null()); } + Item_bool_func(a,b), cache(0) {} + bool fix_fields(THD *, struct st_table_list *, Item **); + bool is_null(); longlong val_int(); + + Item **get_cache() { return (Item**)&cache; } - double get_cache(); - longlong get_cache_int(); - String *get_cache_str(String *s); - - friend class Item_ref_in_optimizer; }; class Item_bool_func2 :public Item_int_func diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 972c265a16b..c4a97731625 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -409,8 +409,9 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex, As far as Item_ref_in_optimizer do not substitude itself on fix_fields we can use same item for all selects. */ - Item *expr= new Item_ref_in_optimizer(optimizer, (char *)"", - (char*)""); + Item *expr= new Item_ref(optimizer->get_cache(), + (char *)"", + (char*)""); select_lex->master_unit()->dependent= 1; for (SELECT_LEX * sl= select_lex; sl; sl= sl->next_select()) { From 1c88b5f064cc645a49901fafb63fd1959d2452cc Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Dec 2002 16:42:35 +0400 Subject: [PATCH 054/220] COUNT(DISTINCT field) now honors charsets --- sql/item_sum.cc | 41 +++++++++++++++++++++++++---------------- sql/item_sum.h | 5 ++++- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/sql/item_sum.cc b/sql/item_sum.cc index f54ab87b81d..d78e535010f 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -542,7 +542,7 @@ void Item_sum_hybrid::reset_field() if (hybrid_type == STRING_RESULT) { char buff[MAX_FIELD_WIDTH]; - String tmp(buff,sizeof(buff),default_charset_info),*res; + String tmp(buff,sizeof(buff),result_field->charset()),*res; res=args[0]->val_str(&tmp); if (args[0]->null_value) @@ -897,17 +897,17 @@ String *Item_variance_field::val_str(String *str) #include "sql_select.h" -static int simple_raw_key_cmp(void* arg, byte* key1, byte* key2) +int simple_raw_key_cmp(void* arg, byte* key1, byte* key2) { return memcmp(key1, key2, *(uint*) arg); } -static int simple_str_key_cmp(void* arg, byte* key1, byte* key2) +int simple_str_key_cmp(void* arg, byte* key1, byte* key2) { - /* BAR TODO: remove default_charset_info */ - return my_strnncoll(default_charset_info, - (const uchar*) key1, *(uint*) arg, - (const uchar*) key2, *(uint*) arg); + Item_sum_count_distinct* item = (Item_sum_count_distinct*)arg; + CHARSET_INFO *cs=item->key_charset; + uint len=item->key_length; + return my_strnncoll(cs, (const uchar*) key1, len, (const uchar*) key2, len); } /* @@ -1037,14 +1037,22 @@ bool Item_sum_count_distinct::setup(THD *thd) Field* field = table->field[0]; switch(field->type()) { - /* - If we have a string, we must take care of charsets and case - sensitivity - */ case FIELD_TYPE_STRING: case FIELD_TYPE_VAR_STRING: - compare_key = (qsort_cmp2)(field->binary() ? simple_raw_key_cmp: - simple_str_key_cmp); + if (field->binary()) + { + compare_key = (qsort_cmp2)simple_raw_key_cmp; + cmp_arg = (void*) &key_length; + } + else + { + /* + If we have a string, we must take care of charsets and case + sensitivity + */ + compare_key = (qsort_cmp2)simple_str_key_cmp; + cmp_arg = (void*) this; + } break; default: /* @@ -1052,11 +1060,12 @@ bool Item_sum_count_distinct::setup(THD *thd) be compared with memcmp */ compare_key = (qsort_cmp2)simple_raw_key_cmp; + cmp_arg = (void*) &key_length; break; } - key_length = field->pack_length(); - cmp_arg = (void*) &key_length; - rec_offset = 1; + key_charset = field->charset(); + key_length = field->pack_length(); + rec_offset = 1; } else // too bad, cannot cheat - there is more than one field { diff --git a/sql/item_sum.h b/sql/item_sum.h index 50375fbf77c..d16a1f2224e 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -156,7 +156,8 @@ class Item_sum_count_distinct :public Item_sum_int TMP_TABLE_PARAM *tmp_table_param; TREE tree; uint key_length; - + CHARSET_INFO *key_charset; + // calculated based on max_heap_table_size. If reached, // walk the tree and dump it into MyISAM table uint max_elements_in_tree; @@ -175,6 +176,8 @@ class Item_sum_count_distinct :public Item_sum_int int tree_to_myisam(); friend int composite_key_cmp(void* arg, byte* key1, byte* key2); + friend int simple_str_key_cmp(void* arg, byte* key1, byte* key2); + friend int simple_raw_key_cmp(void* arg, byte* key1, byte* key2); friend int dump_leaf(byte* key, uint32 count __attribute__((unused)), Item_sum_count_distinct* item); From 774e9927b6f05bdec0277513242663d198929a85 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Dec 2002 16:50:48 +0400 Subject: [PATCH 055/220] ctype_many.result: COUNT(DISTINCT expr) and charset related test mysql-test/r/ctype_many.result: COUNT(DISTINCT expr) and charset related test --- mysql-test/r/ctype_many.result | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mysql-test/r/ctype_many.result b/mysql-test/r/ctype_many.result index 45fe91c096d..a483145e33a 100644 --- a/mysql-test/r/ctype_many.result +++ b/mysql-test/r/ctype_many.result @@ -336,6 +336,11 @@ CYR CAPIT SOFT SIGN CYR CAPIT E ü Э CYR CAPIT YU à Ю CYR CAPIT YA ñ Я +ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL; +UPDATE t1 SET bin_f=koi8_ru_f; +SELECT COUNT(DISTINCT bin_f),COUNT(DISTINCT koi8_ru_f),COUNT(DISTINCT utf8_f) FROM t1; +COUNT(DISTINCT bin_f) COUNT(DISTINCT koi8_ru_f) COUNT(DISTINCT utf8_f) +116 58 57 SELECT koi8_ru_f,MIN(comment) FROM t1 GROUP BY 1; koi8_ru_f MIN(comment) a LAT CAPIT A From 05ef8a612a8a94a0bf64801867b805675192f049 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Dec 2002 20:58:07 +0200 Subject: [PATCH 056/220] ha_innobase.cc: Better error message to help users who created tables with < 3.23.54 where MySQL implicitly added a PRIMARY KEY definition sql/ha_innobase.cc: Better error message to help users who created tables with < 3.23.54 where MySQL implicitly added a PRIMARY KEY definition --- sql/ha_innobase.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index 489c2fafd9b..c5b529a3881 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -1030,7 +1030,14 @@ how you can resolve the problem.\n", if (primary_key != MAX_KEY) { fprintf(stderr, "InnoDB: Error: table %s has no primary key in InnoDB\n" - "InnoDB: data dictionary, but has one in MySQL!\n", name); + "InnoDB: data dictionary, but has one in MySQL!\n" + "InnoDB: If you created the table with a MySQL\n" + "InnoDB: version < 3.23.54 and did not define a primary\n" + "InnoDB: key, but defined a unique key with all non-NULL\n" + "InnoDB: columns, then MySQL internally treats that key\n" + "InnoDB: as the primary key. You can fix this error by\n" + "InnoDB: dump + DROP + CREATE + reimport of the table.\n", + name); } ((row_prebuilt_t*)innobase_prebuilt) From a05b0f087c02eb7165a26e531f5e4cc34db0b173 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Dec 2002 21:15:09 +0200 Subject: [PATCH 057/220] row IN subselects (SCRUM) mysql-test/r/subselect.result: test of row IN subslect mysql-test/t/subselect.test: test of row IN subslect sql/item.cc: New helper Item - reference on item list by number cache item for row sql/item.h: layout fixed New helper Item - reference on item list by number cache item for row sql/item_cmpfunc.cc: changed Item_in_optimizer to be able work with row sql/item_cmpfunc.h: changed Item_in_optimizer to be able work with row sql/item_row.cc: Fixed row Item to be compatible with row subselect sql/item_row.h: Fixed row Item to be compatible with row subselect sql/item_subselect.cc: changed name of class to corerectly reflex its function row IN subselect sql/item_subselect.h: changed name of class to corerectly reflex its function row IN subselect sql/sql_class.cc: changed name of class to corerectly reflex its function sql/sql_class.h: changed name of class to corerectly reflex its function sql/sql_yacc.yy: changed name of class to corerectly reflex its function --- mysql-test/r/subselect.result | 31 ++++++++++ mysql-test/t/subselect.test | 14 +++++ sql/item.cc | 109 ++++++++++++++++++++++++++++++++++ sql/item.h | 70 +++++++++++++++++++++- sql/item_cmpfunc.cc | 27 ++++++--- sql/item_cmpfunc.h | 9 +-- sql/item_row.cc | 9 ++- sql/item_row.h | 1 + sql/item_subselect.cc | 97 ++++++++++++++++++++++++------ sql/item_subselect.h | 12 ++-- sql/sql_class.cc | 6 +- sql/sql_class.h | 4 +- sql/sql_yacc.yy | 12 ++-- 13 files changed, 353 insertions(+), 48 deletions(-) diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index d45b7b24585..f983825a56b 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -773,3 +773,34 @@ a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c') (select c from t1 where 2 0 b NULL NULL NULL drop table t1,t2; +drop table if exists t; +create table t (a int, b real, c varchar(10)); +insert into t values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b'); +select ROW(1, 1, 'a') IN (select a,b,c from t); +ROW(1, 1, 'a') IN (select a,b,c from t) +1 +select ROW(1, 2, 'a') IN (select a,b,c from t); +ROW(1, 2, 'a') IN (select a,b,c from t) +NULL +select ROW(1, 1, 'a') IN (select b,a,c from t); +ROW(1, 1, 'a') IN (select b,a,c from t) +1 +select ROW(1, 1, 'a') IN (select a,b,c from t where a is not null); +ROW(1, 1, 'a') IN (select a,b,c from t where a is not null) +1 +select ROW(1, 2, 'a') IN (select a,b,c from t where a is not null); +ROW(1, 2, 'a') IN (select a,b,c from t where a is not null) +0 +select ROW(1, 1, 'a') IN (select b,a,c from t where a is not null); +ROW(1, 1, 'a') IN (select b,a,c from t where a is not null) +1 +select ROW(1, 1, 'a') IN (select a,b,c from t where c='b' or c='a'); +ROW(1, 1, 'a') IN (select a,b,c from t where c='b' or c='a') +1 +select ROW(1, 2, 'a') IN (select a,b,c from t where c='b' or c='a'); +ROW(1, 2, 'a') IN (select a,b,c from t where c='b' or c='a') +NULL +select ROW(1, 1, 'a') IN (select b,a,c from t where c='b' or c='a'); +ROW(1, 1, 'a') IN (select b,a,c from t where c='b' or c='a') +1 +drop table if exists t; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index ee3d31e66af..863c5f0ad9c 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -434,3 +434,17 @@ select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2; select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t1 where a=t2.a) from t2; drop table t1,t2; + +drop table if exists t; +create table t (a int, b real, c varchar(10)); +insert into t values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b'); +select ROW(1, 1, 'a') IN (select a,b,c from t); +select ROW(1, 2, 'a') IN (select a,b,c from t); +select ROW(1, 1, 'a') IN (select b,a,c from t); +select ROW(1, 1, 'a') IN (select a,b,c from t where a is not null); +select ROW(1, 2, 'a') IN (select a,b,c from t where a is not null); +select ROW(1, 1, 'a') IN (select b,a,c from t where a is not null); +select ROW(1, 1, 'a') IN (select a,b,c from t where c='b' or c='a'); +select ROW(1, 2, 'a') IN (select a,b,c from t where c='b' or c='a'); +select ROW(1, 1, 'a') IN (select b,a,c from t where c='b' or c='a'); +drop table if exists t; diff --git a/sql/item.cc b/sql/item.cc index 340eb2c985c..37cc9939bde 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -498,6 +498,27 @@ bool Item_asterisk_remover::fix_fields(THD *thd, DBUG_RETURN(res); } +bool Item_ref_on_list_position::fix_fields(THD *thd, + struct st_table_list *tables, + Item ** reference) +{ + ref= 0; + List_iterator li(list); + Item *item; + uint i= 0; + for (; (item= li++) && i < pos; i++); + if (i == pos) + { + ref= li.ref(); + return Item_ref_null_helper::fix_fields(thd, tables, reference); + } + else + { + my_error(ER_CARDINALITY_COL, MYF(0), pos); + return 1; + } +} + double Item_ref_null_helper::val() { double tmp= (*ref)->val_result(); @@ -1196,6 +1217,8 @@ Item_cache* Item_cache::get_cache(Item_result type) return new Item_cache_real(); case STRING_RESULT: return new Item_cache_str(); + case ROW_RESULT: + return new Item_cache_row(); default: // should never be in real life DBUG_ASSERT(0); @@ -1241,6 +1264,92 @@ longlong Item_cache_str::val_int() return (longlong)0; } +bool Item_cache_row::allocate(uint num) +{ + n= num; + THD *thd= current_thd; + if (!(values= (Item_cache **) thd->calloc(sizeof(Item_cache *)*n))) + { + my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); + thd->fatal_error= 1; + return 1; + } + return 0; +} + +bool Item_cache_row::setup(Item * item) +{ + if (!values && allocate(item->cols())) + return 1; + for(uint i= 0; i < n; i++) + { + if (!(values[i]= Item_cache::get_cache(item->el(i)->result_type()))) + { + my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); + current_thd->fatal_error= 1; + return 1; + } + values[i]->setup(item->el(i)); + } + return 0; +} + +void Item_cache_row::store(Item * item) +{ + null_value= 0; + item->bring_value(); + for(uint i= 0; i < n; i++) + { + values[i]->store(item->el(i)); + null_value|= values[i]->null_value; + } +} + +void Item_cache_row::illegal_method_call(const char *method) +{ + DBUG_ENTER("Item_cache_row::illegal_method_call"); + DBUG_PRINT("error", ("!!! %s method was called for row item", method)); + DBUG_ASSERT(0); + my_error(ER_CARDINALITY_COL, MYF(0), 1); + DBUG_VOID_RETURN; +} + +bool Item_cache_row::check_cols(uint c) +{ + if (c != n) + { + my_error(ER_CARDINALITY_COL, MYF(0), c); + return 1; + } + return 0; +} + +bool Item_cache_row::null_inside() +{ + for (uint i= 0; i < n; i++) + { + if (values[i]->cols() > 1) + { + if (values[i]->null_inside()) + return 1; + } + else + { + values[i]->val_int(); + if (values[i]->null_value) + return 1; + } + } + return 0; +} + +void Item_cache_row::bring_value() +{ + for (uint i= 0; i < n; i++) + values[i]->bring_value(); + return; +} + /***************************************************************************** ** Instantiate templates *****************************************************************************/ diff --git a/sql/item.h b/sql/item.h index 21087cfe0e2..4e3c5f597ab 100644 --- a/sql/item.h +++ b/sql/item.h @@ -501,7 +501,7 @@ protected: Item_in_subselect* owner; public: Item_ref_null_helper(Item_in_subselect* master, Item **item, - char *table_name_par,char *field_name_par): + char *table_name_par, char *field_name_par): Item_ref(item, table_name_par, field_name_par), owner(master) {} double val(); longlong val_int(); @@ -509,6 +509,24 @@ public: bool get_date(TIME *ltime, bool fuzzydate); }; + +/* + Used to find item in list of select items after '*' items processing. +*/ +class Item_ref_on_list_position: public Item_ref_null_helper +{ +protected: + List &list; + uint pos; +public: + Item_ref_on_list_position(Item_in_subselect* master, + List &li, uint num, + char *table_name, char *field_name): + Item_ref_null_helper(master, 0, table_name, field_name), + list(li), pos(num) {} + bool fix_fields(THD *, struct st_table_list *, Item ** ref); +}; + /* To resolve '*' field moved to condition and register NULL values @@ -642,6 +660,8 @@ public: class Item_cache: public Item { public: + virtual bool allocate(uint i) { return 0; }; + virtual bool setup(Item *) { return 0; }; virtual void store(Item *)= 0; void set_len_n_dec(uint32 max_len, uint8 dec) { @@ -705,6 +725,54 @@ public: CHARSET_INFO *charset() const { return value->charset(); }; }; +class Item_cache_row: public Item_cache +{ + Item_cache **values; + uint n; +public: + Item_cache_row(): values(0), n(2) { fixed= 1; null_value= 1; } + + /* + 'allocate' used only in row transformer, to preallocate space for row + cache. + */ + bool allocate(uint num); + /* + 'setup' is needed only by row => it not called by simple row subselect + (only by IN subselect (in subselect optimizer)) + */ + bool setup(Item *item); + void store(Item *item); + void illegal_method_call(const char *); + void make_field(Send_field *) + { + illegal_method_call((const char*)"make_field"); + }; + double val() + { + illegal_method_call((const char*)"val"); + return 0; + }; + longlong val_int() + { + illegal_method_call((const char*)"val_int"); + return 0; + }; + String *val_str(String *) + { + illegal_method_call((const char*)"val_str"); + return 0; + }; + enum Item_result result_type() const { return ROW_RESULT; } + + uint cols() { return n; } + Item* el(uint i) { return values[i]; } + Item** addr(uint i) { return (Item **) (values + i); } + bool check_cols(uint c); + bool null_inside(); + void bring_value(); +}; + extern Item_buff *new_Item_buff(Item *item); extern Item_result item_cmp_type(Item_result a,Item_result b); extern Item *resolve_const_item(Item *item,Item *cmp_item); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index be25a2609b0..df949a910bd 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -274,12 +274,19 @@ int Arg_comparator::compare_e_row() return 1; } +bool Item_in_optimizer::preallocate_row() +{ + if ((cache= Item_cache::get_cache(ROW_RESULT))) + return 0; + my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); + current_thd->fatal_error= 1; + return 1; +} + bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables, Item ** ref) { - - if (args[0]->check_cols(allowed_arg_cols) || - args[0]->fix_fields(thd, tables, args)) + if (args[0]->fix_fields(thd, tables, args)) return 1; if (args[0]->maybe_null) maybe_null=1; @@ -288,15 +295,21 @@ bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables, with_sum_func= args[0]->with_sum_func; used_tables_cache= args[0]->used_tables(); const_item_cache= args[0]->const_item(); - if (!(cache= Item_cache::get_cache(args[0]->result_type()))) + if (!cache && !(cache= Item_cache::get_cache(args[0]->result_type()))) { my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); thd->fatal_error= 1; return 1; } - if (args[1]->check_cols(allowed_arg_cols) || - args[1]->fix_fields(thd, tables, args)) + cache->setup(args[0]); + if (args[1]->fix_fields(thd, tables, args)) return 1; + Item_in_subselect * sub= (Item_in_subselect *)args[1]; + if (args[0]->cols() != sub->engine->cols()) + { + my_error(ER_CARDINALITY_COL, MYF(0), args[0]->cols()); + return 1; + } if (args[1]->maybe_null) maybe_null=1; with_sum_func= with_sum_func || args[1]->with_sum_func; @@ -1215,7 +1228,7 @@ void cmp_item_row::store_value(Item *item) { THD *thd= current_thd; n= item->cols(); - if ((comparators= (cmp_item **) thd->alloc(sizeof(cmp_item *)*n))) + if ((comparators= (cmp_item **) thd->calloc(sizeof(cmp_item *)*n))) { item->bring_value(); item->null_value= 0; diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 41171da1338..e3d8eb7746d 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -91,14 +91,15 @@ class Item_in_optimizer: public Item_bool_func protected: Item_cache *cache; public: - Item_in_optimizer(Item *a,Item *b): - Item_bool_func(a,b), cache(0) {} + Item_in_optimizer(Item *a, Item_in_subselect *b): + Item_bool_func(a, (Item *)b), cache(0) {} + // used by row in transformer + bool preallocate_row(); bool fix_fields(THD *, struct st_table_list *, Item **); bool is_null(); longlong val_int(); - Item **get_cache() { return (Item**)&cache; } - + Item_cache **get_cache() { return &cache; } }; class Item_bool_func2 :public Item_int_func diff --git a/sql/item_row.cc b/sql/item_row.cc index 85a81a50256..9d605e05242 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -41,7 +41,7 @@ void Item_row::illegal_method_call(const char *method) DBUG_ENTER("Item_row::illegal_method_call"); DBUG_PRINT("error", ("!!! %s method was called for row item", method)); DBUG_ASSERT(0); - my_error(ER_CARDINALITY_COL, MYF(0), arg_count); + my_error(ER_CARDINALITY_COL, MYF(0), 1); DBUG_VOID_RETURN; } @@ -100,3 +100,10 @@ bool Item_row::null_inside() } return 0; } + +void Item_row::bring_value() +{ + for (uint i= 0; i < arg_count; i++) + items[i]->bring_value(); + return; +} diff --git a/sql/item_row.h b/sql/item_row.h index 4767d19d08f..cf67567c3ed 100644 --- a/sql/item_row.h +++ b/sql/item_row.h @@ -70,4 +70,5 @@ public: Item** addr(uint i) { return items + i; } bool check_cols(uint c); bool null_inside(); + void bring_value(); }; diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index c4a97731625..bb7a497a15c 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -127,36 +127,36 @@ inline table_map Item_subselect::used_tables() const return (table_map) engine->depended() ? 1L : 0L; } -Item_singleval_subselect::Item_singleval_subselect(THD *thd, +Item_singlerow_subselect::Item_singlerow_subselect(THD *thd, st_select_lex *select_lex): Item_subselect(), value(0) { - DBUG_ENTER("Item_singleval_subselect::Item_singleval_subselect"); - init(thd, select_lex, new select_singleval_subselect(this)); + DBUG_ENTER("Item_singlerow_subselect::Item_singlerow_subselect"); + init(thd, select_lex, new select_singlerow_subselect(this)); max_columns= 1; maybe_null= 1; max_columns= UINT_MAX; DBUG_VOID_RETURN; } -void Item_singleval_subselect::reset() +void Item_singlerow_subselect::reset() { null_value= 1; if (value) value->null_value= 1; } -void Item_singleval_subselect::store(uint i, Item *item) +void Item_singlerow_subselect::store(uint i, Item *item) { row[i]->store(item); } -enum Item_result Item_singleval_subselect::result_type() const +enum Item_result Item_singlerow_subselect::result_type() const { return engine->type(); } -void Item_singleval_subselect::fix_length_and_dec() +void Item_singlerow_subselect::fix_length_and_dec() { if ((max_columns= engine->cols()) == 1) { @@ -182,12 +182,12 @@ void Item_singleval_subselect::fix_length_and_dec() } } -uint Item_singleval_subselect::cols() +uint Item_singlerow_subselect::cols() { return engine->cols(); } -bool Item_singleval_subselect::check_cols(uint c) +bool Item_singlerow_subselect::check_cols(uint c) { if (c != engine->cols()) { @@ -197,7 +197,7 @@ bool Item_singleval_subselect::check_cols(uint c) return 0; } -bool Item_singleval_subselect::null_inside() +bool Item_singlerow_subselect::null_inside() { for (uint i= 0; i < max_columns ; i++) { @@ -207,12 +207,12 @@ bool Item_singleval_subselect::null_inside() return 0; } -void Item_singleval_subselect::bring_value() +void Item_singlerow_subselect::bring_value() { engine->exec(); } -double Item_singleval_subselect::val () +double Item_singlerow_subselect::val () { if (!engine->exec() && !value->null_value) { @@ -226,7 +226,7 @@ double Item_singleval_subselect::val () } } -longlong Item_singleval_subselect::val_int () +longlong Item_singlerow_subselect::val_int () { if (!engine->exec() && !value->null_value) { @@ -240,7 +240,7 @@ longlong Item_singleval_subselect::val_int () } } -String *Item_singleval_subselect::val_str (String *str) +String *Item_singlerow_subselect::val_str (String *str) { if (!engine->exec() && !value->null_value) { @@ -293,7 +293,7 @@ Item_allany_subselect::Item_allany_subselect(THD *thd, Item * left_exp, left_expr= left_exp; func= f; init(thd, select_lex, new select_exists_subselect(this)); - max_columns= UINT_MAX; + max_columns= 1; reset(); // We need only 1 row to determinate existence select_lex->master_unit()->global_parameters->select_limit= 1; @@ -305,6 +305,7 @@ void Item_exists_subselect::fix_length_and_dec() { decimals= 0; max_length= 1; + max_columns= engine->cols(); } double Item_exists_subselect::val () @@ -409,7 +410,7 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex, As far as Item_ref_in_optimizer do not substitude itself on fix_fields we can use same item for all selects. */ - Item *expr= new Item_ref(optimizer->get_cache(), + Item *expr= new Item_ref((Item**)optimizer->get_cache(), (char *)"", (char*)""); select_lex->master_unit()->dependent= 1; @@ -440,7 +441,7 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex, sl->having= item; else if (sl->where) - sl->where= new Item_cond_and(sl->having, item); + sl->where= new Item_cond_and(sl->where, item); else sl->where= item; } @@ -498,10 +499,68 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex, DBUG_VOID_RETURN; } +void Item_in_subselect::row_value_transformer(st_select_lex *select_lex, + Item *left_expr) +{ + DBUG_ENTER("Item_in_subselect::row_value_transformer"); + Item_in_optimizer *optimizer; + substitution= optimizer= new Item_in_optimizer(left_expr, this); + if (!optimizer) + { + current_thd->fatal_error= 1; + DBUG_VOID_RETURN; + } + select_lex->master_unit()->dependent= 1; + uint n= left_expr->cols(); + if (optimizer->preallocate_row() || (*optimizer->get_cache())->allocate(n)) + DBUG_VOID_RETURN; + for (SELECT_LEX * sl= select_lex; sl; sl= sl->next_select()) + { + select_lex->dependent= 1; + + Item *item= 0; + List_iterator_fast li(sl->item_list); + for (uint i= 0; i < n; i++) + { + Item *func= + new Item_ref_on_list_position(this, sl->item_list, i, + (char *) "", + (char *) ""); + func= + Item_bool_func2::eq_creator(new Item_ref((*optimizer->get_cache())-> + addr(i), + (char *)"", + (char *)""), + func); + if (!item) + item= func; + else + item= new Item_cond_and(item, func); + } + + if (sl->having || sl->with_sum_func || sl->group_list.first || + !sl->table_list.elements) + if (sl->having) + sl->having= new Item_cond_and(sl->having, item); + else + sl->having= item; + else + if (sl->where) + sl->where= new Item_cond_and(sl->where, item); + else + sl->where= item; + } + DBUG_VOID_RETURN; +} + + void Item_in_subselect::select_transformer(st_select_lex *select_lex) { - single_value_transformer(select_lex, left_expr, - &Item_bool_func2::eq_creator); + if (left_expr->cols() == 1) + single_value_transformer(select_lex, left_expr, + &Item_bool_func2::eq_creator); + else + row_value_transformer(select_lex, left_expr); } void Item_allany_subselect::select_transformer(st_select_lex *select_lex) diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 3cb68cb3875..04f0e6f3c83 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -86,18 +86,19 @@ public: bool check_loop(uint id); friend class select_subselect; + friend class Item_in_optimizer; }; /* single value subselect */ class Item_cache; -class Item_singleval_subselect :public Item_subselect +class Item_singlerow_subselect :public Item_subselect { protected: Item_cache *value, **row; public: - Item_singleval_subselect(THD *thd, st_select_lex *select_lex); - Item_singleval_subselect(Item_singleval_subselect *item): + Item_singlerow_subselect(THD *thd, st_select_lex *select_lex); + Item_singlerow_subselect(Item_singlerow_subselect *item): Item_subselect(item) { value= item->value; @@ -109,7 +110,7 @@ public: double val(); longlong val_int (); String *val_str (String *); - Item *new_item() { return new Item_singleval_subselect(this); } + Item *new_item() { return new Item_singlerow_subselect(this); } enum Item_result result_type() const; void fix_length_and_dec(); @@ -120,7 +121,7 @@ public: bool null_inside(); void bring_value(); - friend class select_singleval_subselect; + friend class select_singlerow_subselect; }; /* exists subselect */ @@ -174,6 +175,7 @@ public: virtual void select_transformer(st_select_lex *select_lex); void single_value_transformer(st_select_lex *select_lex, Item *left_expr, compare_func_creator func); + void row_value_transformer(st_select_lex *select_lex, Item *left_expr); longlong val_int(); double val(); String *val_str(String*); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 0b12a34ebfb..061bf12b71c 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -916,10 +916,10 @@ select_subselect::select_subselect(Item_subselect *item) this->item=item; } -bool select_singleval_subselect::send_data(List &items) +bool select_singlerow_subselect::send_data(List &items) { - DBUG_ENTER("select_singleval_subselect::send_data"); - Item_singleval_subselect *it= (Item_singleval_subselect *)item; + DBUG_ENTER("select_singlerow_subselect::send_data"); + Item_singlerow_subselect *it= (Item_singlerow_subselect *)item; if (it->assigned()) { my_message(ER_SUBSELECT_NO_1_ROW, ER(ER_SUBSELECT_NO_1_ROW), MYF(0)); diff --git a/sql/sql_class.h b/sql/sql_class.h index 7ca66d9ffb7..3abcf12e4b7 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -824,10 +824,10 @@ public: }; /* Single value subselect interface class */ -class select_singleval_subselect :public select_subselect +class select_singlerow_subselect :public select_subselect { public: - select_singleval_subselect(Item_subselect *item):select_subselect(item){} + select_singlerow_subselect(Item_subselect *item):select_subselect(item){} bool send_data(List &items); }; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 55f165c0739..d160c5281a8 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -587,7 +587,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); simple_ident select_item2 expr opt_expr opt_else sum_expr in_sum_expr table_wild opt_pad no_in_expr expr_expr simple_expr no_and_expr using_list expr_or_default set_expr_or_default - param_marker singleval_subselect singleval_subselect_init + param_marker singlerow_subselect singlerow_subselect_init exists_subselect exists_subselect_init %type @@ -2017,7 +2017,7 @@ simple_expr: $$= new Item_row(*$5); } | EXISTS exists_subselect { $$= $2; } - | singleval_subselect { $$= $1; } + | singlerow_subselect { $$= $1; } | '{' ident expr '}' { $$= $3; } | MATCH ident_list_arg AGAINST '(' expr ')' { Select->add_ftfunc_to_list((Item_func_match *) @@ -4487,17 +4487,17 @@ union_option: /* empty */ {} | ALL {Select->master_unit()->union_option= 1;}; -singleval_subselect: - subselect_start singleval_subselect_init +singlerow_subselect: + subselect_start singlerow_subselect_init subselect_end { $$= $2; }; -singleval_subselect_init: +singlerow_subselect_init: select_init2 { - $$= new Item_singleval_subselect(YYTHD, + $$= new Item_singlerow_subselect(YYTHD, Lex->current_select->master_unit()-> first_select()); }; From 9d580589966927569d6b759a3c550d64caa77ddc Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Dec 2002 13:00:06 +0400 Subject: [PATCH 058/220] COUNT(DISTINCT) charset related test --- mysql-test/t/ctype_many.test | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mysql-test/t/ctype_many.test b/mysql-test/t/ctype_many.test index 7854bc38d6f..b02684b2fb8 100644 --- a/mysql-test/t/ctype_many.test +++ b/mysql-test/t/ctype_many.test @@ -137,9 +137,12 @@ SELECT CONVERT(koi8_ru_f USING utf8),MIN(comment),COUNT(*) FROM t1 GROUP BY 1; ALTER TABLE t1 ADD utf8_f CHAR(32) CHARACTER SET utf8 NOT NULL; UPDATE t1 SET utf8_f=CONVERT(koi8_ru_f USING utf8); - SELECT * FROM t1; +ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL; +UPDATE t1 SET bin_f=koi8_ru_f; +SELECT COUNT(DISTINCT bin_f),COUNT(DISTINCT koi8_ru_f),COUNT(DISTINCT utf8_f) FROM t1; + SELECT koi8_ru_f,MIN(comment) FROM t1 GROUP BY 1; SELECT utf8_f,MIN(comment) FROM t1 GROUP BY 1; SELECT DISTINCT koi8_ru_f FROM t1; From 63c9b06a62c80cb8889ad753d73bcd0c759c0632 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Dec 2002 12:56:00 +0100 Subject: [PATCH 059/220] - tagged ChangeSet 1.1477 as MySQL 4.0.6 - bumped up version number in configure.in to 4.0.7-gamma configure.in: - bumped up version number in configure.in to 4.0.7-gamma --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 8652bb13154..70c6ae08a30 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! -AM_INIT_AUTOMAKE(mysql, 4.0.6-gamma) +AM_INIT_AUTOMAKE(mysql, 4.0.7-gamma) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 From f6d3338a9115fdbd8fb9d504adf0e505fa22ae8a Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Dec 2002 16:21:22 +0400 Subject: [PATCH 060/220] mysql_com.h: ulong fails to compile on FreeBSD. Peter, alsways use "unsigned long" instead!!! include/mysql_com.h: ulong fails to compile on FreeBSD. Peter, alsways use "unsigned long" instead!!! --- include/mysql_com.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/mysql_com.h b/include/mysql_com.h index 58f4e224b89..d4d0b63dc78 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -293,11 +293,11 @@ int get_password_length(my_bool force_old_scramble); char get_password_version(const char* password); void create_random_string(int length,struct rand_struct *rand_st,char* target); my_bool validate_password(const char* password, const char* message, - ulong* salt); + unsigned long* salt); void password_hash_stage1(char *to, const char *password); void password_hash_stage2(char *to,const char *salt); void password_crypt(const char* from,char* to, const char* password,int length); -void get_hash_and_password(ulong* salt, unsigned char pversion,char* hash, +void get_hash_and_password(unsigned long* salt, unsigned char pversion,char* hash, unsigned char* bin_password); void get_salt_from_password(unsigned long *res,const char *password); void create_key_from_old_password(const char* password,char* key); From baba4b1f2a9ad762100a92bd454d519e2f952d4f Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Dec 2002 13:43:40 +0100 Subject: [PATCH 061/220] - added missing file sql/protocol.h to distribution --- sql/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/Makefile.am b/sql/Makefile.am index 245e4c5d258..c4b641f714b 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -52,7 +52,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ field.h handler.h \ ha_isammrg.h ha_isam.h ha_myisammrg.h\ ha_heap.h ha_myisam.h ha_berkeley.h ha_innodb.h \ - opt_range.h opt_ft.h \ + opt_range.h opt_ft.h protocol.h \ sql_select.h structs.h table.h sql_udf.h hash_filo.h\ lex.h lex_symbol.h sql_acl.h sql_crypt.h \ log_event.h mini_client.h sql_repl.h slave.h \ From 791e9fb37ea10f3e91e56e15c869906d90313c06 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Dec 2002 14:58:27 +0200 Subject: [PATCH 062/220] Changed thd variables max_join_size and select_limit to type ha_rows. This fixed some optimization problems when using -DBIG_TABLES Portabilty fixes for OpenUnix and HPUX Added C and C++ version numbers to mysqlbug Docs/mysqld_error.txt: Added new error message acinclude.m4: Fix for configure problem on OpenUnix configure.in: Fix for OpenUnix Added C and C++ versions to mysqlbug mysql-test/r/variables.result: Update of max_join_size handling mysql-test/t/variables.test: Update of max_join_size handling mysys/Makefile.am: Removed duplicate row mysys/my_alloc.c: Safety fixes (not fatal) scripts/Makefile.am: Added C and C++ compiler versions to mysqlbug scripts/mysqlbug.sh: Added C and C++ compiler versions to mysqlbug sql/item_func.cc: Fixed that user variables that changes are not threated as constants. sql/item_func.h: Fixed that user variables that changes are not threated as constants. sql/mysqld.cc: Changed thd variables max_join_size and select_limit to type ha_rows sql/repl_failsafe.cc: Removed not needed cast sql/set_var.cc: Changed thd variables max_join_size and select_limit to type ha_rows sql/set_var.h: Changed thd variables max_join_size and select_limit to type ha_rows sql/slave.cc: Removed not needed cast sql/sql_class.h: Changed thd variables max_join_size and select_limit to type ha_rows sql/sql_parse.cc: Removed not needed cast Fixed security problem with mysql_drop_db() sql/sql_show.cc: Changed thd variables max_join_size and select_limit to type ha_rows sql/structs.h: Changed thd variables max_join_size and select_limit to type ha_rows --- Docs/mysqld_error.txt | 26 +++++++++++-- acinclude.m4 | 9 +++-- configure.in | 8 +++- mysql-test/r/variables.result | 4 +- mysql-test/t/variables.test | 3 ++ mysys/Makefile.am | 1 - mysys/my_alloc.c | 4 +- scripts/Makefile.am | 2 + scripts/mysqlbug.sh | 2 + sql/item_func.cc | 7 +++- sql/item_func.h | 7 ++-- sql/mysqld.cc | 16 +++++--- sql/repl_failsafe.cc | 2 +- sql/set_var.cc | 69 ++++++++++++++++++++++++++++++----- sql/set_var.h | 18 +++++++++ sql/slave.cc | 2 +- sql/sql_class.h | 4 +- sql/sql_parse.cc | 6 ++- sql/sql_show.cc | 3 ++ sql/structs.h | 2 +- 20 files changed, 157 insertions(+), 38 deletions(-) diff --git a/Docs/mysqld_error.txt b/Docs/mysqld_error.txt index db663e3d1f5..aeb3a12c263 100644 --- a/Docs/mysqld_error.txt +++ b/Docs/mysqld_error.txt @@ -300,7 +300,7 @@ #define ER_NOT_ALLOWED_COMMAND 1148 "The used command is not allowed with this MySQL version", #define ER_SYNTAX_ERROR 1149 -"You have an error in your SQL syntax", +"You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use", #define ER_DELAYED_CANT_CHANGE_LOCK 1150 "Delayed insert thread couldn't get requested lock for table %-.64s", #define ER_TOO_MANY_DELAYED_THREADS 1151 @@ -358,7 +358,7 @@ #define ER_CHECK_NO_SUCH_TABLE 1177 "Can't open table", #define ER_CHECK_NOT_IMPLEMENTED 1178 -"The handler for the table doesn't support check/repair", +"The handler for the table doesn't support %s", #define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179 "You are not allowed to execute this command in a transaction", #define ER_ERROR_DURING_COMMIT 1180 @@ -454,4 +454,24 @@ #define ER_DUP_ARGUMENT 1225 "Option '%s' used twice in statement", #define ER_USER_LIMIT_REACHED 1226 -"User '%-64s' has exceeded the '%s' resource (current value: %ld)", +"User '%-.64s' has exceeded the '%s' resource (current value: %ld)", +#define ER_SPECIFIC_ACCESS_DENIED_ERROR 1227 +"Access denied. You need the %-.128s privilege for this operation", +#define ER_LOCAL_VARIABLE 1228 +"Variable '%-.64s' is a LOCAL variable and can't be used with SET GLOBAL", +#define ER_GLOBAL_VARIABLE 1229 +"Variable '%-.64s' is a GLOBAL variable and should be set with SET GLOBAL", +#define ER_NO_DEFAULT 1230 +"Variable '%-.64s' doesn't have a default value", +#define ER_WRONG_VALUE_FOR_VAR 1231 +"Variable '%-.64s' can't be set to the value of '%-.64s'", +#define ER_WRONG_TYPE_FOR_VAR 1232 +"Wrong argument type to variable '%-.64s'", +#define ER_VAR_CANT_BE_READ 1233 +"Variable '%-.64s' can only be set, not read", +#define ER_CANT_USE_OPTION_HERE 1234 +"Wrong usage/placement of '%s'", +#define 1235 +"This version of MySQL doesn't yet support '%s'", +#define ER_MASTER_FATAL_ERROR_READING_BINLOG 1236 +"Got fatal error %d: '%-.128s' from master when reading data from binary log", diff --git a/acinclude.m4 b/acinclude.m4 index fda4f4bf7d5..7436b5136a5 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1211,7 +1211,9 @@ changequote(, )dnl hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) changequote([, ])dnl if test "$GCC" = yes; then - ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__ + case `$CC --version 2>/dev/null` in + 2.95.*) ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__ ;; + esac fi ;; # IRIX 6.2 and later require cc -n32. @@ -1326,7 +1328,7 @@ AC_DEFUN(MYSQL_SYS_LARGEFILE, # Local version of _AC_PROG_CXX_EXIT_DECLARATION that does not -# include #stdlib.h as this breaks things on Solaris +# include #stdlib.h as default as this breaks things on Solaris # (Conflicts with pthreads and big file handling) m4_define([_AC_PROG_CXX_EXIT_DECLARATION], @@ -1336,7 +1338,8 @@ m4_define([_AC_PROG_CXX_EXIT_DECLARATION], 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ - 'void exit (int);' + 'void exit (int);' \ + '#include ' do _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include $ac_declaration], diff --git a/configure.in b/configure.in index 8652bb13154..82eeea20ba4 100644 --- a/configure.in +++ b/configure.in @@ -135,13 +135,19 @@ if test $? -eq "0" then AC_MSG_CHECKING("C Compiler version"); AC_MSG_RESULT("$CC $CC_VERSION") +else +CC_VERSION="" fi CXX_VERSION=`$CXX --version` if test $? -eq "0" then AC_MSG_CHECKING("C++ compiler version"); AC_MSG_RESULT("$CXX $CXX_VERSION") +else +CXX_VERSION="" fi +AC_SUBST(CXX_VERSION) +AC_SUBST(CC_VERSION) # Fix for sgi gcc / sgiCC which tries to emulate gcc if test "$CC" = "sgicc" @@ -1228,7 +1234,7 @@ then # CC="$CC -Kthread -DOpenUNIX8"; # CXX="$CXX -Kthread -DOpenUNIX8"; CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"; - CXX="$CXX -Kthread -DUNIXWARE_7"; + CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK" fi AC_MSG_RESULT("yes") else diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index f8ac13477a9..ed477a8519b 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -50,7 +50,7 @@ Variable_name Value max_join_size 100 show global variables like 'max_join_size'; Variable_name Value -max_join_size 4294967295 +max_join_size HA_POS_ERROR set GLOBAL max_join_size=2000; show global variables like 'max_join_size'; Variable_name Value @@ -62,7 +62,7 @@ max_join_size 2000 set GLOBAL max_join_size=DEFAULT; show global variables like 'max_join_size'; Variable_name Value -max_join_size 4294967295 +max_join_size HA_POS_ERROR set @@max_join_size=1000, @@global.max_join_size=2000; select @@local.max_join_size, @@global.max_join_size; @@session.max_join_size @@global.max_join_size diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index e21fbd975e6..5863cb97d57 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -34,12 +34,15 @@ drop table t1; set max_join_size=100; show variables like 'max_join_size'; +--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR show global variables like 'max_join_size'; set GLOBAL max_join_size=2000; show global variables like 'max_join_size'; set max_join_size=DEFAULT; +--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR show variables like 'max_join_size'; set GLOBAL max_join_size=DEFAULT; +--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR show global variables like 'max_join_size'; set @@max_join_size=1000, @@global.max_join_size=2000; select @@local.max_join_size, @@global.max_join_size; diff --git a/mysys/Makefile.am b/mysys/Makefile.am index 6047debcaf5..67bc8feadaa 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -64,7 +64,6 @@ EXTRA_PROGRAMS = DEFS = -DDEFAULT_BASEDIR=\"$(prefix)\" \ -DDATADIR="\"$(MYSQLDATAdir)\"" \ -DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \ - -DDATADIR="\"$(MYSQLDATAdir)\"" \ -DSHAREDIR="\"$(MYSQLSHAREdir)\"" \ @DEFS@ diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index 1ab86476e41..4d3b0604984 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -25,12 +25,13 @@ void init_alloc_root(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size __attribute__((unused))) { - mem_root->free= mem_root->used= 0; + mem_root->free= mem_root->used= mem_root->pre_alloc= 0; mem_root->min_malloc= 32; mem_root->block_size= block_size-MALLOC_OVERHEAD-sizeof(USED_MEM)-8; mem_root->error_handler= 0; mem_root->block_num= 4; /* We shift this with >>2 */ mem_root->first_block_usage= 0; + #if !(defined(HAVE_purify) && defined(EXTRA_DEBUG)) if (pre_alloc_size) { @@ -137,6 +138,7 @@ static inline void mark_blocks_free(MEM_ROOT* root) /* Now everything is set; Indicate that nothing is used anymore */ root->used= 0; + root->first_block_usage= 0; } diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 7ecd00f5b39..8f17d8519b8 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -100,6 +100,8 @@ SUFFIXES = .sh -e 's!@''CC''@!@CC@!'\ -e 's!@''CXX''@!@CXX@!'\ -e 's!@''GXX''@!@GXX@!'\ + -e 's!@''CC_VERSION''@!@CC_VERSION@!'\ + -e 's!@''CXX_VERSION''@!@CXX_VERSION@!'\ -e 's!@''PERL''@!@PERL@!' \ -e 's!@''ASFLAGS''@!@SAVE_ASFLAGS@!'\ -e 's!@''CFLAGS''@!@SAVE_CFLAGS@!'\ diff --git a/scripts/mysqlbug.sh b/scripts/mysqlbug.sh index 8dbc931b7f6..49ac08d0013 100644 --- a/scripts/mysqlbug.sh +++ b/scripts/mysqlbug.sh @@ -231,6 +231,8 @@ ${ORGANIZATION- $ORGANIZATION_C} >Class: $CLASS_C >Release: mysql-${VERSION} ($COMPILATION_COMMENT) `test -n "$MYSQL_SERVER" && echo ">Server: $MYSQL_SERVER"` +>C compiler: @CC_VERSION@ +>C++ compiler: @CXX_VERSION@ >Environment: $ENVIRONMENT_C `test -n "$SYSTEM" && echo "System: $SYSTEM"` diff --git a/sql/item_func.cc b/sql/item_func.cc index c3b1190a4b6..20d7bffce21 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2038,11 +2038,14 @@ void Item_func_get_user_var::fix_length_and_dec() maybe_null=1; decimals=NOT_FIXED_DEC; max_length=MAX_BLOB_WIDTH; - if ((var_entry= get_variable(&thd->user_vars, name, 0))) - const_var_flag= thd->query_id != var_entry->update_query_id; + var_entry= get_variable(&thd->user_vars, name, 0); } +bool Item_func_get_user_var::const_item() const +{ return var_entry && current_thd->query_id != var_entry->update_query_id; } + + enum Item_result Item_func_get_user_var::result_type() const { user_var_entry *entry; diff --git a/sql/item_func.h b/sql/item_func.h index 501dcdadc3f..31310ab564e 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -902,11 +902,10 @@ class Item_func_get_user_var :public Item_func { LEX_STRING name; user_var_entry *var_entry; - bool const_var_flag; public: Item_func_get_user_var(LEX_STRING a): - Item_func(), name(a), const_var_flag(1) {} + Item_func(), name(a) {} user_var_entry *get_entry(); double val(); longlong val_int(); @@ -915,9 +914,9 @@ public: void print(String *str); enum Item_result result_type() const; const char *func_name() const { return "get_user_var"; } - bool const_item() const { return const_var_flag; } + bool const_item() const; table_map used_tables() const - { return const_var_flag ? 0 : RAND_TABLE_BIT; } + { return const_item() ? 0 : RAND_TABLE_BIT; } bool eq(const Item *item, bool binary_cmp) const; unsigned int size_of() { return sizeof(*this);} }; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index c09255d5dae..61ae07c01e7 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -242,6 +242,12 @@ SHOW_COMP_OPTION have_query_cache=SHOW_OPTION_NO; #endif bool opt_large_files= sizeof(my_off_t) > 4; +#if SIZEOF_OFF_T > 4 && defined(BIG_TABLES) +#define GET_HA_ROWS GET_ULL +#else +#define GET_HA_ROWS GET_ULONG +#endif + /* Variables to store startup options @@ -3562,7 +3568,7 @@ struct my_option my_long_options[] = {"max_join_size", OPT_MAX_JOIN_SIZE, "Joins that are probably going to read more than max_join_size records return an error.", (gptr*) &global_system_variables.max_join_size, - (gptr*) &max_system_variables.max_join_size, 0, GET_ULONG, REQUIRED_ARG, + (gptr*) &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG, ~0L, 1, ~0L, 0, 1, 0}, {"max_sort_length", OPT_MAX_SORT_LENGTH, "The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored).", @@ -3949,10 +3955,10 @@ static void set_options(void) /* Set default values for some variables */ global_system_variables.table_type=DB_TYPE_MYISAM; global_system_variables.tx_isolation=ISO_REPEATABLE_READ; - global_system_variables.select_limit= (ulong) HA_POS_ERROR; - max_system_variables.select_limit= (ulong) HA_POS_ERROR; - global_system_variables.max_join_size= (ulong) HA_POS_ERROR; - max_system_variables.max_join_size= (ulong) HA_POS_ERROR; + global_system_variables.select_limit= HA_POS_ERROR; + max_system_variables.select_limit= HA_POS_ERROR; + global_system_variables.max_join_size= HA_POS_ERROR; + max_system_variables.max_join_size= HA_POS_ERROR; #ifdef __WIN__ /* Allow Win32 users to move MySQL anywhere */ diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 4ebb2f5b476..471fd62ecb2 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -82,7 +82,7 @@ static int init_failsafe_rpl_thread(THD* thd) #endif thd->mem_root.free=thd->mem_root.used=0; - if ((ulong) thd->variables.max_join_size == (ulong) HA_POS_ERROR) + if (thd->variables.max_join_size == HA_POS_ERROR) thd->options|= OPTION_BIG_SELECTS; thd->proc_info="Thread initialized"; diff --git a/sql/set_var.cc b/sql/set_var.cc index 28222740c14..8e0baa234da 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -149,11 +149,11 @@ sys_var_long_ptr sys_max_delayed_threads("max_delayed_threads", &max_insert_delayed_threads); sys_var_thd_ulong sys_max_heap_table_size("max_heap_table_size", &SV::max_heap_table_size); -sys_var_thd_ulong sys_max_join_size("max_join_size", +sys_var_thd_ha_rows sys_max_join_size("max_join_size", &SV::max_join_size, fix_max_join_size); #ifndef TO_BE_DELETED /* Alias for max_join_size */ -sys_var_thd_ulong sys_sql_max_join_size("sql_max_join_size", +sys_var_thd_ha_rows sys_sql_max_join_size("sql_max_join_size", &SV::max_join_size, fix_max_join_size); #endif @@ -275,7 +275,7 @@ static sys_var_thd_bit sys_unique_checks("unique_checks", /* Local state variables */ -static sys_var_thd_ulong sys_select_limit("sql_select_limit", +static sys_var_thd_ha_rows sys_select_limit("sql_select_limit", &SV::select_limit); static sys_var_timestamp sys_timestamp("timestamp"); static sys_var_last_insert_id sys_last_insert_id("last_insert_id"); @@ -576,7 +576,7 @@ static void fix_max_join_size(THD *thd, enum_var_type type) { if (type != OPT_GLOBAL) { - if (thd->variables.max_join_size == (ulong) HA_POS_ERROR) + if (thd->variables.max_join_size == HA_POS_ERROR) thd->options|= OPTION_BIG_SELECTS; else thd->options&= ~OPTION_BIG_SELECTS; @@ -723,12 +723,7 @@ bool sys_var_thd_ulong::update(THD *thd, set_var *var) if (option_limits) tmp= (ulong) getopt_ull_limit_value(tmp, option_limits); if (var->type == OPT_GLOBAL) - { - /* Lock is needed to make things safe on 32 bit systems */ - pthread_mutex_lock(&LOCK_global_system_variables); global_system_variables.*offset= (ulong) tmp; - pthread_mutex_unlock(&LOCK_global_system_variables); - } else thd->variables.*offset= (ulong) tmp; return 0; @@ -755,10 +750,60 @@ byte *sys_var_thd_ulong::value_ptr(THD *thd, enum_var_type type) } +bool sys_var_thd_ha_rows::update(THD *thd, set_var *var) +{ + ulonglong tmp= var->value->val_int(); + + /* Don't use bigger value than given with --maximum-variable-name=.. */ + if ((ha_rows) tmp > max_system_variables.*offset) + tmp= max_system_variables.*offset; + + if (option_limits) + tmp= (ha_rows) getopt_ull_limit_value(tmp, option_limits); + if (var->type == OPT_GLOBAL) + { + /* Lock is needed to make things safe on 32 bit systems */ + pthread_mutex_lock(&LOCK_global_system_variables); + global_system_variables.*offset= (ha_rows) tmp; + pthread_mutex_unlock(&LOCK_global_system_variables); + } + else + thd->variables.*offset= (ha_rows) tmp; + return 0; +} + + +void sys_var_thd_ha_rows::set_default(THD *thd, enum_var_type type) +{ + if (type == OPT_GLOBAL) + { + /* We will not come here if option_limits is not set */ + pthread_mutex_lock(&LOCK_global_system_variables); + global_system_variables.*offset= (ha_rows) option_limits->def_value; + pthread_mutex_unlock(&LOCK_global_system_variables); + } + else + thd->variables.*offset= global_system_variables.*offset; +} + + +byte *sys_var_thd_ha_rows::value_ptr(THD *thd, enum_var_type type) +{ + if (type == OPT_GLOBAL) + return (byte*) &(global_system_variables.*offset); + return (byte*) &(thd->variables.*offset); +} + + bool sys_var_thd_ulonglong::update(THD *thd, set_var *var) { if (var->type == OPT_GLOBAL) + { + /* Lock is needed to make things safe on 32 bit systems */ + pthread_mutex_lock(&LOCK_global_system_variables); global_system_variables.*offset= var->value->val_int(); + pthread_mutex_unlock(&LOCK_global_system_variables); + } else thd->variables.*offset= var->value->val_int(); return 0; @@ -768,7 +813,11 @@ bool sys_var_thd_ulonglong::update(THD *thd, set_var *var) void sys_var_thd_ulonglong::set_default(THD *thd, enum_var_type type) { if (type == OPT_GLOBAL) + { + pthread_mutex_lock(&LOCK_global_system_variables); global_system_variables.*offset= (ulong) option_limits->def_value; + pthread_mutex_unlock(&LOCK_global_system_variables); + } else thd->variables.*offset= global_system_variables.*offset; } @@ -871,6 +920,8 @@ Item *sys_var::item(THD *thd, enum_var_type var_type) return new Item_uint((int32) *(ulong*) value_ptr(thd, var_type)); case SHOW_LONGLONG: return new Item_int(*(longlong*) value_ptr(thd, var_type)); + case SHOW_HA_ROWS: + return new Item_int((longlong) *(ha_rows*) value_ptr(thd, var_type)); case SHOW_MY_BOOL: return new Item_int((int32) *(my_bool*) value_ptr(thd, var_type),1); case SHOW_CHAR: diff --git a/sql/set_var.h b/sql/set_var.h index 3edd0373db9..c74f1e827bd 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -211,6 +211,24 @@ public: }; +class sys_var_thd_ha_rows :public sys_var_thd +{ +public: + ha_rows SV::*offset; + sys_var_thd_ha_rows(const char *name_arg, ha_rows SV::*offset_arg) + :sys_var_thd(name_arg), offset(offset_arg) + {} + sys_var_thd_ha_rows(const char *name_arg, ha_rows SV::*offset_arg, + sys_after_update_func func) + :sys_var_thd(name_arg,func), offset(offset_arg) + {} + bool update(THD *thd, set_var *var); + void set_default(THD *thd, enum_var_type type); + SHOW_TYPE type() { return SHOW_HA_ROWS; } + byte *value_ptr(THD *thd, enum_var_type type); +}; + + class sys_var_thd_ulonglong :public sys_var_thd { public: diff --git a/sql/slave.cc b/sql/slave.cc index a4e0b029bbf..d254221e726 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1548,7 +1548,7 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type) VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals)); #endif - if ((ulong) thd->variables.max_join_size == (ulong) HA_POS_ERROR) + if (thd->variables.max_join_size == HA_POS_ERROR) thd->options |= OPTION_BIG_SELECTS; if (thd_type == SLAVE_THD_SQL) diff --git a/sql/sql_class.h b/sql/sql_class.h index 241b7d0f87a..8c4a7b83ebf 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -284,13 +284,14 @@ struct system_variables { ulonglong myisam_max_extra_sort_file_size; ulonglong myisam_max_sort_file_size; + ha_rows select_limit; + ha_rows max_join_size; ulong bulk_insert_buff_size; ulong join_buff_size; ulong long_query_time; ulong max_allowed_packet; ulong max_heap_table_size; ulong max_sort_length; - ulong max_join_size; ulong max_tmp_tables; ulong myisam_sort_buff_size; ulong net_buffer_length; @@ -302,7 +303,6 @@ struct system_variables ulong query_cache_type; ulong read_buff_size; ulong read_rnd_buff_size; - ulong select_limit; ulong sortbuff_size; ulong tmp_table_size; ulong tx_isolation; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ea9c331af8f..d9f2b9ca70d 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -678,7 +678,7 @@ pthread_handler_decl(handle_one_connection,arg) goto end_thread; } - if ((ulong) thd->variables.max_join_size == (ulong) HA_POS_ERROR) + if (thd->variables.max_join_size == HA_POS_ERROR) thd->options |= OPTION_BIG_SELECTS; if (thd->client_capabilities & CLIENT_COMPRESS) net->compress=1; // Use compression @@ -754,7 +754,7 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg) #endif - if ((ulong) thd->variables.max_join_size == (ulong) HA_POS_ERROR) + if (thd->variables.max_join_size == HA_POS_ERROR) thd->options |= OPTION_BIG_SELECTS; thd->proc_info=0; @@ -1096,6 +1096,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, } if (lower_case_table_names) casedn_str(db); + if (check_access(thd,DROP_ACL,db,0,1)) + break; if (thd->locked_tables || thd->active_transaction()) { send_error(&thd->net,ER_LOCK_OR_ACTIVE_TRANSACTION); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 02f4655c655..a11abf75506 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1184,6 +1184,9 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables, case SHOW_LONGLONG: net_store_data(&packet2,(longlong) *(longlong*) value); break; + case SHOW_HA_ROWS: + net_store_data(&packet2,(longlong) *(ha_rows*) value); + break; case SHOW_BOOL: net_store_data(&packet2,(ulong) *(bool*) value ? "ON" : "OFF"); break; diff --git a/sql/structs.h b/sql/structs.h index bd058a08e46..be50c8fc24d 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -129,7 +129,7 @@ enum SHOW_TYPE SHOW_UNDEF, SHOW_LONG, SHOW_LONGLONG, SHOW_INT, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_BOOL, SHOW_MY_BOOL, SHOW_OPENTABLES, SHOW_STARTTIME, SHOW_QUESTION, - SHOW_LONG_CONST, SHOW_INT_CONST, SHOW_HAVE, SHOW_SYS, + SHOW_LONG_CONST, SHOW_INT_CONST, SHOW_HAVE, SHOW_SYS, SHOW_HA_ROWS, #ifdef HAVE_OPENSSL SHOW_SSL_CTX_SESS_ACCEPT, SHOW_SSL_CTX_SESS_ACCEPT_GOOD, SHOW_SSL_GET_VERSION, SHOW_SSL_CTX_GET_SESSION_CACHE_MODE, From 54abb8e922dcdb0834e29f7de76ec849f258e06c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Dec 2002 17:14:46 +0400 Subject: [PATCH 063/220] less default_charset_info --- sql/filesort.cc | 4 ++-- sql/key.cc | 3 +-- sql/opt_range.cc | 4 ++-- sql/sql_delete.cc | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/sql/filesort.cc b/sql/filesort.cc index 97e06997617..8b55a2f4aa1 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -470,10 +470,11 @@ static void make_sortkey(register SORTPARAM *param, switch (sort_field->result_type) { case STRING_RESULT: { + CHARSET_INFO *cs=item->charset(); if (item->maybe_null) *to++=1; /* All item->str() to use some extra byte for end null.. */ - String tmp((char*) to,sort_field->length+4,default_charset_info); + String tmp((char*) to,sort_field->length+4,cs); String *res=item->val_str(&tmp); if (!res) { @@ -488,7 +489,6 @@ static void make_sortkey(register SORTPARAM *param, break; } length=res->length(); - CHARSET_INFO *cs=res->charset(); int diff=(int) (sort_field->length-length); if (diff < 0) { diff --git a/sql/key.cc b/sql/key.cc index 84669808b92..875a89a146f 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -192,8 +192,7 @@ int key_cmp(TABLE *table,const byte *key,uint idx,uint key_length) if (!(key_part->key_type & (FIELDFLAG_NUMBER+FIELDFLAG_BINARY+ FIELDFLAG_PACK))) { - /* BAR TODO: I'm not sure this should be system_charset_info */ - if (my_strnncoll(system_charset_info, + if (my_strnncoll(key_part->field->charset(), (const uchar*) key, length, (const uchar*) table->record[0]+key_part->offset,length)) return 1; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index fd1a56fc97a..b117b6a5ea1 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -929,7 +929,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part, { bool like_error; char buff1[MAX_FIELD_WIDTH],*min_str,*max_str; - String tmp(buff1,sizeof(buff1),default_charset_info),*res; + String tmp(buff1,sizeof(buff1),value->charset()),*res; uint length,offset,min_length,max_length; if (!field->optimize_range(param->real_keynr[key_part->key])) @@ -2793,7 +2793,7 @@ static void print_key(KEY_PART *key_part,const char *key,uint used_length) { char buff[1024]; - String tmp(buff,sizeof(buff),default_charset_info); + String tmp(buff,sizeof(buff),NULL); for (uint length=0; length < used_length ; diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 88da3e2505c..cfa7170fd0a 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -536,7 +536,7 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK); bzero((char*) &create_info,sizeof(create_info)); create_info.auto_increment_value= table->file->auto_increment_value; - create_info.table_charset=default_charset_info; + create_info.table_charset=table->table_charset; db_type table_type=table->db_type; strmov(path,table->path); @@ -580,7 +580,7 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) } bzero((char*) &create_info,sizeof(create_info)); - create_info.table_charset=default_charset_info; + create_info.table_charset=table_list->table->table_charset; *fn_ext(path)=0; // Remove the .frm extension error= ha_create_table(path,&create_info,1) ? -1 : 0; From 3ebec6335139ff28537d6eb79344a682e2d853be Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Dec 2002 17:57:24 +0400 Subject: [PATCH 064/220] less default_charset_info --- sql/item_func.cc | 8 ++++---- sql/item_strfunc.cc | 15 +++++++++------ sql/mysqld.cc | 14 ++++++++------ sql/sql_class.cc | 11 ++++++----- sql/sql_help.cc | 20 +++++++++++--------- 5 files changed, 38 insertions(+), 30 deletions(-) diff --git a/sql/item_func.cc b/sql/item_func.cc index c0b6a872831..19fd6b12c67 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1883,7 +1883,7 @@ longlong Item_func_set_last_insert_id::val_int() longlong Item_func_benchmark::val_int() { char buff[MAX_FIELD_WIDTH]; - String tmp(buff,sizeof(buff), default_charset_info); + String tmp(buff,sizeof(buff), NULL); THD *thd=current_thd; for (ulong loop=0 ; loop < loop_count && !thd->killed; loop++) @@ -2029,7 +2029,7 @@ Item_func_set_user_var::update() case STRING_RESULT: { char buffer[MAX_FIELD_WIDTH]; - String tmp(buffer,sizeof(buffer),default_charset_info); + String tmp(buffer,sizeof(buffer),NULL); (void) val_str(&tmp); break; } @@ -2221,7 +2221,7 @@ longlong Item_func_inet_aton::val_int() char c = '.'; // we mark c to indicate invalid IP in case length is 0 char buff[36]; - String *s,tmp(buff,sizeof(buff),default_charset_info); + String *s,tmp(buff,sizeof(buff),NULL); if (!(s = args[0]->val_str(&tmp))) // If null value goto err; null_value=0; @@ -2275,7 +2275,7 @@ void Item_func_match::init_search(bool no_order) String *ft_tmp= 0; char tmp1[FT_QUERY_MAXLEN]; - String tmp2(tmp1,sizeof(tmp1),default_charset_info); + String tmp2(tmp1,sizeof(tmp1),NULL); // MATCH ... AGAINST (NULL) is meaningless, but possible if (!(ft_tmp=key_item()->val_str(&tmp2))) diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 240b3c213a5..78689bb3044 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1438,6 +1438,8 @@ String *Item_func_soundex::val_str(String *str) { String *res =args[0]->val_str(str); char last_ch,ch; + CHARSET_INFO *cs=my_charset_latin1; + if ((null_value=args[0]->null_value)) return 0; /* purecov: inspected */ @@ -1445,22 +1447,23 @@ String *Item_func_soundex::val_str(String *str) return str; /* purecov: inspected */ char *to= (char *) tmp_value.ptr(); char *from= (char *) res->ptr(), *end=from+res->length(); - - while (from != end && my_isspace(str->charset(),*from)) // Skip pre-space + tmp_value.set_charset(cs); + + while (from != end && my_isspace(cs,*from)) // Skip pre-space from++; /* purecov: inspected */ if (from == end) return &empty_string; // No alpha characters. - *to++ = my_toupper(str->charset(),*from);// Copy first letter - last_ch = get_scode(str->charset(),from);// code of the first letter + *to++ = my_toupper(cs,*from); // Copy first letter + last_ch = get_scode(cs,from); // code of the first letter // for the first 'double-letter check. // Loop on input letters until // end of input (null) or output // letter code count = 3 for (from++ ; from < end ; from++) { - if (!my_isalpha(str->charset(),*from)) + if (!my_isalpha(cs,*from)) continue; - ch=get_scode(str->charset(),from); + ch=get_scode(cs,from); if ((ch != '0') && (ch != last_ch)) // if not skipped or double { *to++ = ch; // letter, copy to output diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 943af7b44be..694f1a49f95 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -34,6 +34,8 @@ #include #include +#define mysqld_charset my_charset_latin1 + #ifndef DBUG_OFF #define ONE_THREAD #endif @@ -981,7 +983,7 @@ static void set_user(const char *user) { // allow a numeric uid to be used const char *pos; - for (pos=user; my_isdigit(system_charset_info,*pos); pos++) ; + for (pos=user; my_isdigit(mysqld_charset,*pos); pos++) ; if (*pos) // Not numeric id { fprintf(stderr,"Fatal error: Can't change to run as user '%s' ; Please check that the user exists!\n",user); @@ -4373,7 +4375,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), exit(1); } val= p--; - while (my_isspace(system_charset_info, *p) && p > argument) + while (my_isspace(mysqld_charset, *p) && p > argument) *p-- = 0; if (p == argument) { @@ -4383,7 +4385,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), } *val= 0; val+= 2; - while (*val && my_isspace(system_charset_info, *val)) + while (*val && my_isspace(mysqld_charset, *val)) *val++; if (!*val) { @@ -4525,7 +4527,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), have_symlink=SHOW_OPTION_DISABLED; break; case (int) OPT_BIND_ADDRESS: - if (argument && my_isdigit(system_charset_info, argument[0])) + if (argument && my_isdigit(mysqld_charset, argument[0])) { my_bind_addr = (ulong) inet_addr(argument); } @@ -4938,8 +4940,8 @@ static ulong find_bit_type(const char *x, TYPELIB *bit_lib) j=pos; while (j != end) { - if (my_toupper(system_charset_info,*i++) != - my_toupper(system_charset_info,*j++)) + if (my_toupper(mysqld_charset,*i++) != + my_toupper(mysqld_charset,*j++)) goto skipp; } found_int=bit; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 9e0489edb28..ef40ebeb273 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -526,7 +526,7 @@ bool select_send::send_data(List &items) List_iterator_fast li(items); Protocol *protocol= thd->protocol; char buff[MAX_FIELD_WIDTH]; - String buffer(buff, sizeof(buff), system_charset_info); + String buffer(buff, sizeof(buff), NULL); DBUG_ENTER("send_data"); protocol->prepare_for_resend(); @@ -649,7 +649,7 @@ bool select_export::send_data(List &items) DBUG_ENTER("send_data"); char buff[MAX_FIELD_WIDTH],null_buff[2],space[MAX_FIELD_WIDTH]; bool space_inited=0; - String tmp(buff,sizeof(buff),default_charset_info),*res; + String tmp(buff,sizeof(buff),NULL),*res; tmp.length(0); if (unit->offset_limit_cnt) @@ -710,10 +710,11 @@ bool select_export::send_data(List &items) pos++) { #ifdef USE_MB - if (use_mb(default_charset_info)) + CHARSET_INFO *res_charset=res->charset(); + if (use_mb(res_charset)) { int l; - if ((l=my_ismbchar(default_charset_info, pos, end))) + if ((l=my_ismbchar(res_charset, pos, end))) { pos += l-1; continue; @@ -856,7 +857,7 @@ bool select_dump::send_data(List &items) { List_iterator_fast li(items); char buff[MAX_FIELD_WIDTH]; - String tmp(buff,sizeof(buff),default_charset_info),*res; + String tmp(buff,sizeof(buff),NULL),*res; tmp.length(0); Item *item; DBUG_ENTER("send_data"); diff --git a/sql/sql_help.cc b/sql/sql_help.cc index db28823a43d..5d12f023842 100644 --- a/sql/sql_help.cc +++ b/sql/sql_help.cc @@ -22,6 +22,8 @@ ** Get help on string ***************************************************************************/ +#define help_charset my_charset_latin1 + MI_INFO *open_help_file(THD *thd, const char *name) { char path[FN_REFLEN]; @@ -104,21 +106,21 @@ int search_functions(MI_INFO *file_leafs, const char *mask, leaf.prepare_fields(); const char *lname= leaf.get_name(); - if (wild_case_compare(system_charset_info,lname,mask)) + if (wild_case_compare(help_charset,lname,mask)) continue; count++; if (count>2) { - String *s= new String(lname,system_charset_info); + String *s= new String(lname,help_charset); if (!s->copy()) names->push_back(s); } else if (count==1) { - *description= new String(leaf.get_description(),system_charset_info); - *example= new String(leaf.get_example(),system_charset_info); - *name= new String(lname,system_charset_info); + *description= new String(leaf.get_description(),help_charset); + *example= new String(leaf.get_example(),help_charset); + *name= new String(lname,help_charset); (*description)->copy(); (*example)->copy(); (*name)->copy(); @@ -132,7 +134,7 @@ int search_functions(MI_INFO *file_leafs, const char *mask, *description= 0; *example= 0; - String *s= new String(lname,system_charset_info); + String *s= new String(lname,help_charset); if (!s->copy()) names->push_back(s); } @@ -203,14 +205,14 @@ int search_categories(THD *thd, category.prepare_fields(); const char *lname= category.get_name(); - if (mask && wild_case_compare(system_charset_info,lname,mask)) + if (mask && wild_case_compare(help_charset,lname,mask)) continue; count++; if (count==1 && res_id) *res_id= category.get_cat_id(); - String *s= new String(lname,system_charset_info); + String *s= new String(lname,help_charset); if (!s->copy()) names->push_back(s); } @@ -282,7 +284,7 @@ int get_all_names_for_category(THD *thd,MI_INFO *file_leafs, (const byte*)&leaf_id,4,HA_READ_KEY_EXACT)) { leaf.prepare_fields(); - String *s= new String(leaf.get_name(),system_charset_info); + String *s= new String(leaf.get_name(),help_charset); if (!s->copy()) res->push_back(s); } From 2a6461588dc9faa15fd33d1a1898df59ac7e3cbb Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Dec 2002 18:08:49 +0400 Subject: [PATCH 065/220] less default_charset_info --- sql/item.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sql/item.cc b/sql/item.cc index fbe0e27a01c..66f84b40406 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -121,7 +121,7 @@ bool Item_string::eq(const Item *item, bool binary_cmp) const bool Item::get_date(TIME *ltime,bool fuzzydate) { char buff[40]; - String tmp(buff,sizeof(buff),default_charset_info),*res; + String tmp(buff,sizeof(buff),NULL),*res; if (!(res=val_str(&tmp)) || str_to_TIME(res->ptr(),res->length(),ltime,fuzzydate) == TIMESTAMP_NONE) { @@ -139,7 +139,7 @@ bool Item::get_date(TIME *ltime,bool fuzzydate) bool Item::get_time(TIME *ltime) { char buff[40]; - String tmp(buff,sizeof(buff),default_charset_info),*res; + String tmp(buff,sizeof(buff),NULL),*res; if (!(res=val_str(&tmp)) || str_to_time(res->ptr(),res->length(),ltime)) { @@ -1146,7 +1146,7 @@ Item *resolve_const_item(Item *item,Item *comp_item) if (res_type == STRING_RESULT) { char buff[MAX_FIELD_WIDTH]; - String tmp(buff,sizeof(buff),default_charset_info),*result; + String tmp(buff,sizeof(buff),NULL),*result; result=item->val_str(&tmp); if (item->null_value) { @@ -1160,7 +1160,7 @@ Item *resolve_const_item(Item *item,Item *comp_item) #ifdef DELETE_ITEMS delete item; #endif - return new Item_string(name,tmp_str,length,default_charset_info); + return new Item_string(name,tmp_str,length,result->charset()); } if (res_type == INT_RESULT) { @@ -1201,8 +1201,8 @@ bool field_is_equal_to_item(Field *field,Item *item) { char item_buff[MAX_FIELD_WIDTH]; char field_buff[MAX_FIELD_WIDTH]; - String item_tmp(item_buff,sizeof(item_buff),default_charset_info),*item_result; - String field_tmp(field_buff,sizeof(field_buff),default_charset_info); + String item_tmp(item_buff,sizeof(item_buff),NULL),*item_result; + String field_tmp(field_buff,sizeof(field_buff),NULL); item_result=item->val_str(&item_tmp); if (item->null_value) return 1; // This must be true From 313b296b2e0b5436d1c2ac8bbfa367e2168173d2 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Dec 2002 18:39:53 +0100 Subject: [PATCH 066/220] removed chroot() bugfix, now --chroot in 3.23 is broken again :(( --- sql/mysqld.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index a5fc7eabe46..bd17f7339a4 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -886,7 +886,8 @@ static void set_root(const char *path) sql_perror("chroot"); unireg_abort(1); } - my_setwd("/", MYF(0)); +// my_setwd("/", MYF(0)); + sql_print_error("Warning: --chroot option doesn't provide 100%% closed chroot jail in MySQL 3.23. Upgrade to 4.0"); #endif } From 35f6e920c5a0a991bbaae0107405230985cb7c81 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Dec 2002 20:55:51 +0200 Subject: [PATCH 067/220] btr0sea.c: Remove an assertion which can fail in a race of 3 threads innobase/btr/btr0sea.c: Remove an assertion which can fail in a race of 3 threads --- innobase/btr/btr0sea.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/innobase/btr/btr0sea.c b/innobase/btr/btr0sea.c index a798f28b4ab..421aafba1c5 100644 --- a/innobase/btr/btr0sea.c +++ b/innobase/btr/btr0sea.c @@ -453,8 +453,6 @@ btr_search_info_update_slow( } if (build_index) { - ut_a(block->n_fields + block->n_bytes > 0); - btr_search_build_page_hash_index(block->frame, block->n_fields, block->n_bytes, @@ -1028,7 +1026,10 @@ btr_search_build_page_hash_index( return; } - ut_a(n_fields + n_bytes > 0); + if (n_fields + n_bytes == 0) { + + return; + } /* Calculate and cache fold values and corresponding records into an array for fast insertion to the hash index */ From d1856800c1254a84c6ecba2209bdec583aaf6a30 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 21 Dec 2002 02:53:07 +0400 Subject: [PATCH 068/220] fix some warnings --- libmysql/libmysql.c | 11 ++++++++--- libmysqld/libmysqld.c | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 87093059d92..d0fc83bbeb3 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -947,7 +947,7 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd) } if (!(tmp= my_strdup(cmd,MYF(MY_WME))) || - insert_dynamic(options->init_commands, (byte*)&tmp)) + insert_dynamic(options->init_commands, (gptr)&tmp)) { my_free(tmp, MYF(MY_ALLOW_ZERO_PTR)); return 1; @@ -2623,8 +2623,13 @@ mysql_close(MYSQL *mysql) my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR)); if (mysql->options.init_commands) { - delete_dynamic(mysql->options.init_commands); - my_free((char*)mysql->options.init_commands,MYF(MY_WME)); + DYNAMIC_ARRAY *init_commands= mysql->options.init_commands; + char **ptr= (char**)init_commands->buffer; + char **end= ptr + init_commands->elements; + for (; ptrinit_commands, (byte*)&tmp)) + insert_dynamic(options->init_commands, (gptr)&tmp)) { my_free(tmp, MYF(MY_ALLOW_ZERO_PTR)); return 1; @@ -1152,8 +1152,13 @@ mysql_close(MYSQL *mysql) my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR)); if (mysql->options.init_commands) { - delete_dynamic(mysql->options.init_commands); - my_free((char*)mysql->options.init_commands,MYF(MY_WME)); + DYNAMIC_ARRAY *init_commands= mysql->options.init_commands; + char **ptr= (char**)init_commands->buffer; + char **end= ptr + init_commands->elements; + for (; ptrhost_info=mysql->user=mysql->passwd=mysql->db=0; From 23362b5cae7acbe00b64980802e8e5e7f9480f7d Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 21 Dec 2002 03:50:09 +0200 Subject: [PATCH 069/220] errmsg.txt: More descriptive foreign key error messages sql/share/english/errmsg.txt: More descriptive foreign key error messages --- sql/share/english/errmsg.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 105cf90ca7d..93a1b66816a 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -217,8 +217,8 @@ "Deadlock found when trying to get lock; Try restarting transaction", "The used table type doesn't support FULLTEXT indexes", "Cannot add foreign key constraint", -"Cannot add a child row: a foreign key constraint fails", -"Cannot delete a parent row: a foreign key constraint fails", +"Cannot add or update a child row: a foreign key constraint fails", +"Cannot delete or update a parent row: a foreign key constraint fails", "Error connecting to master: %-.128s", "Error running query on master: %-.128s", "Error when executing command %s: %-.128s", From 5f1b9717c53f19ef4f7a5206f59a7678a025dbe2 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 21 Dec 2002 10:45:06 +0200 Subject: [PATCH 070/220] Optimization of CASE bug fix --- sql/item_cmpfunc.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 0d10b17ad87..c3381eb76ea 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -685,10 +685,9 @@ String *Item_func_case::val_str(String *str) null_value=1; return 0; } + null_value= 0; if (!(res=item->val_str(str))) - null_value=1; - else - null_value=item->null_value; + null_value= 1; return res; } From b69d8f4a6f4a78f1ee61936ec440fa8ebb111319 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 22 Dec 2002 01:54:29 +0200 Subject: [PATCH 071/220] Many files: Merge InnoDB-4.0.7. Support for ON UPDATE CASCADE sql_select.cc: Remove superfluous prints to .err log when a locking SELECT fails to a deadlock or a lock wait timeout sql/sql_select.cc: Remove superfluous prints to .err log when a locking SELECT fails to a deadlock or a lock wait timeout innobase/btr/btr0sea.c: Merge InnoDB-4.0.7. Support for ON UPDATE CASCADE innobase/dict/dict0dict.c: Merge InnoDB-4.0.7. Support for ON UPDATE CASCADE innobase/fsp/fsp0fsp.c: Merge InnoDB-4.0.7. Support for ON UPDATE CASCADE innobase/ibuf/ibuf0ibuf.c: Merge InnoDB-4.0.7. Support for ON UPDATE CASCADE innobase/include/buf0buf.h: Merge InnoDB-4.0.7. Support for ON UPDATE CASCADE innobase/include/db0err.h: Merge InnoDB-4.0.7. Support for ON UPDATE CASCADE innobase/include/dict0mem.h: Merge InnoDB-4.0.7. Support for ON UPDATE CASCADE innobase/include/mem0mem.h: Merge InnoDB-4.0.7. Support for ON UPDATE CASCADE innobase/include/row0mysql.h: Merge InnoDB-4.0.7. Support for ON UPDATE CASCADE innobase/include/row0upd.h: Merge InnoDB-4.0.7. Support for ON UPDATE CASCADE innobase/include/mem0mem.ic: Merge InnoDB-4.0.7. Support for ON UPDATE CASCADE innobase/mem/mem0pool.c: Merge InnoDB-4.0.7. Support for ON UPDATE CASCADE innobase/row/row0ins.c: Merge InnoDB-4.0.7. Support for ON UPDATE CASCADE innobase/row/row0mysql.c: Merge InnoDB-4.0.7. Support for ON UPDATE CASCADE innobase/row/row0sel.c: Merge InnoDB-4.0.7. Support for ON UPDATE CASCADE innobase/row/row0upd.c: Merge InnoDB-4.0.7. Support for ON UPDATE CASCADE innobase/srv/srv0start.c: Merge InnoDB-4.0.7. Support for ON UPDATE CASCADE innobase/ut/ut0ut.c: Merge InnoDB-4.0.7. Support for ON UPDATE CASCADE --- innobase/btr/btr0sea.c | 92 ++++++++++--- innobase/dict/dict0dict.c | 136 +++++++++++++++---- innobase/fsp/fsp0fsp.c | 16 +-- innobase/ibuf/ibuf0ibuf.c | 13 +- innobase/include/buf0buf.h | 7 +- innobase/include/db0err.h | 5 +- innobase/include/dict0mem.h | 7 + innobase/include/mem0mem.h | 14 +- innobase/include/mem0mem.ic | 7 +- innobase/include/row0mysql.h | 10 +- innobase/include/row0upd.h | 5 +- innobase/mem/mem0pool.c | 52 +++++--- innobase/row/row0ins.c | 245 ++++++++++++++++++++++++++++++++--- innobase/row/row0mysql.c | 68 ++++++++-- innobase/row/row0sel.c | 17 ++- innobase/row/row0upd.c | 88 ++++++++++++- innobase/srv/srv0start.c | 13 +- innobase/ut/ut0ut.c | 4 +- sql/sql_select.cc | 37 ++++-- 19 files changed, 689 insertions(+), 147 deletions(-) diff --git a/innobase/btr/btr0sea.c b/innobase/btr/btr0sea.c index 31f001ee769..de3fe6e196e 100644 --- a/innobase/btr/btr0sea.c +++ b/innobase/btr/btr0sea.c @@ -19,6 +19,9 @@ Created 2/17/1996 Heikki Tuuri #include "btr0btr.h" #include "ha0ha.h" +ulint btr_search_this_is_zero = 0; /* A dummy variable to fool the + compiler */ + ulint btr_search_n_succ = 0; ulint btr_search_n_hash_fail = 0; @@ -56,16 +59,20 @@ before hash index building is started */ /************************************************************************ Builds a hash index on a page with the given parameters. If the page already -has a hash index with different parameters, the old hash index is removed. */ +has a hash index with different parameters, the old hash index is removed. +If index is non-NULL, this function checks if n_fields and n_bytes are +sensible values, and does not build a hash index if not. */ static void btr_search_build_page_hash_index( /*=============================*/ - page_t* page, /* in: index page, s- or x-latched */ - ulint n_fields, /* in: hash this many full fields */ - ulint n_bytes, /* in: hash this many bytes from the next + dict_index_t* index, /* in: index for which to build, or NULL if + not known */ + page_t* page, /* in: index page, s- or x-latched */ + ulint n_fields,/* in: hash this many full fields */ + ulint n_bytes,/* in: hash this many bytes from the next field */ - ulint side); /* in: hash for searches from this side */ + ulint side); /* in: hash for searches from this side */ /********************************************************************* This function should be called before reserving any btr search mutex, if @@ -173,7 +180,9 @@ btr_search_info_create( } /************************************************************************* -Updates the search info of an index about hash successes. */ +Updates the search info of an index about hash successes. NOTE that info +is NOT protected by any semaphore, to save CPU time! Do not assume its fields +are consistent. */ static void btr_search_info_update_hash( @@ -295,7 +304,9 @@ set_new_recomm: } /************************************************************************* -Updates the block search info on hash successes. */ +Updates the block search info on hash successes. NOTE that info and +block->n_hash_helps, n_fields, n_bytes, side are NOT protected by any +semaphore, to save CPU time! Do not assume the fields are consistent. */ static ibool btr_search_update_block_hash_info( @@ -425,12 +436,19 @@ btr_search_info_update_slow( { buf_block_t* block; ibool build_index; - + ulint* params; + ulint* params2; + ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED) && !rw_lock_own(&btr_search_latch, RW_LOCK_EX)); block = buf_block_align(btr_cur_get_rec(cursor)); + /* NOTE that the following two function calls do NOT protect + info or block->n_fields etc. with any semaphore, to save CPU time! + We cannot assume the fields are consistent when we return from + those functions! */ + btr_search_info_update_hash(info, cursor); build_index = btr_search_update_block_hash_info(info, block, cursor); @@ -439,7 +457,7 @@ btr_search_info_update_slow( btr_search_check_free_space_in_heap(); } - + if (cursor->flag == BTR_CUR_HASH_FAIL) { /* Update the hash node reference, if appropriate */ @@ -453,10 +471,30 @@ btr_search_info_update_slow( } if (build_index) { - btr_search_build_page_hash_index(block->frame, - block->n_fields, - block->n_bytes, - block->side); + /* Note that since we did not protect block->n_fields etc. + with any semaphore, the values can be inconsistent. We have + to check inside the function call that they make sense. We + also malloc an array and store the values there to make sure + the compiler does not let the function call parameters change + inside the called function. It might be that the compiler + would optimize the call just to pass pointers to block. */ + + params = mem_alloc(3 * sizeof(ulint)); + params[0] = block->n_fields; + params[1] = block->n_bytes; + params[2] = block->side; + + /* Make sure the compiler cannot deduce the values and do + optimizations */ + + params2 = params + btr_search_this_is_zero; + + btr_search_build_page_hash_index(cursor->index, + block->frame, + params2[0], + params2[1], + params2[2]); + mem_free(params); } } @@ -974,16 +1012,20 @@ btr_search_drop_page_hash_when_freed( /************************************************************************ Builds a hash index on a page with the given parameters. If the page already -has a hash index with different parameters, the old hash index is removed. */ +has a hash index with different parameters, the old hash index is removed. +If index is non-NULL, this function checks if n_fields and n_bytes are +sensible values, and does not build a hash index if not. */ static void btr_search_build_page_hash_index( /*=============================*/ - page_t* page, /* in: index page, s- or x-latched */ - ulint n_fields, /* in: hash this many full fields */ - ulint n_bytes, /* in: hash this many bytes from the next + dict_index_t* index, /* in: index for which to build, or NULL if + not known */ + page_t* page, /* in: index page, s- or x-latched */ + ulint n_fields,/* in: hash this many full fields */ + ulint n_bytes,/* in: hash this many bytes from the next field */ - ulint side) /* in: hash for searches from this side */ + ulint side) /* in: hash for searches from this side */ { hash_table_t* table; buf_block_t* block; @@ -1026,9 +1068,17 @@ btr_search_build_page_hash_index( return; } + /* Check that the values for hash index build are sensible */ + if (n_fields + n_bytes == 0) { - return; + return; + } + + if (index && (dict_index_get_n_unique_in_tree(index) < n_fields + || (dict_index_get_n_unique_in_tree(index) == n_fields + && n_bytes > 0))) { + return; } /* Calculate and cache fold values and corresponding records into @@ -1187,8 +1237,8 @@ btr_search_move_or_delete_hash_entries( ut_a(n_fields + n_bytes > 0); - btr_search_build_page_hash_index(new_page, n_fields, n_bytes, - side); + btr_search_build_page_hash_index(NULL, new_page, n_fields, + n_bytes, side); ut_a(n_fields == block->curr_n_fields); ut_a(n_bytes == block->curr_n_bytes); ut_a(side == block->curr_side); diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c index 563ca2521a4..c70e848c5c8 100644 --- a/innobase/dict/dict0dict.c +++ b/innobase/dict/dict0dict.c @@ -1145,23 +1145,25 @@ dict_index_add_to_cache( } /* Check that the same column does not appear twice in the index. - InnoDB assumes this in its algorithms, e.g., update of an index - entry */ + InnoDB assumes this in its algorithms, e.g., update of an index + entry */ for (i = 0; i < dict_index_get_n_fields(index); i++) { - for (j = 0; j < i; j++) { - if (dict_index_get_nth_field(index, j)->col - == dict_index_get_nth_field(index, i)->col) { + for (j = 0; j < i; j++) { + if (dict_index_get_nth_field(index, j)->col + == dict_index_get_nth_field(index, i)->col) { - fprintf(stderr, -"InnoDB: Error: column %s appears twice in index %s of table %s\n" + ut_print_timestamp(stderr); + + fprintf(stderr, +" InnoDB: Error: column %s appears twice in index %s of table %s\n" "InnoDB: This is not allowed in InnoDB.\n" "InnoDB: UPDATE can cause such an index to become corrupt in InnoDB.\n", - dict_index_get_nth_field(index, i)->col->name, - index->name, table->name); - } - } + dict_index_get_nth_field(index, i)->col->name, + index->name, table->name); + } + } } /* Build the cache internal representation of the index, @@ -2233,6 +2235,9 @@ dict_create_foreign_constraints( ulint error; ulint i; ulint j; + ibool is_on_delete; + ulint n_on_deletes; + ulint n_on_updates; dict_col_t* columns[500]; char* column_names[500]; ulint column_name_lens[500]; @@ -2392,6 +2397,12 @@ col_loop2: return(DB_CANNOT_ADD_CONSTRAINT); } + n_on_deletes = 0; + n_on_updates = 0; + +scan_on_conditions: + /* Loop here as long as we can find ON ... conditions */ + ptr = dict_accept(ptr, "ON", &success); if (!success) { @@ -2402,23 +2413,58 @@ col_loop2: ptr = dict_accept(ptr, "DELETE", &success); if (!success) { - dict_foreign_free(foreign); + ptr = dict_accept(ptr, "UPDATE", &success); + + if (!success) { + + dict_foreign_free(foreign); - return(DB_CANNOT_ADD_CONSTRAINT); + return(DB_CANNOT_ADD_CONSTRAINT); + } + + is_on_delete = FALSE; + n_on_updates++; + } else { + is_on_delete = TRUE; + n_on_deletes++; } ptr = dict_accept(ptr, "RESTRICT", &success); if (success) { - goto try_find_index; + goto scan_on_conditions; } ptr = dict_accept(ptr, "CASCADE", &success); if (success) { - foreign->type = DICT_FOREIGN_ON_DELETE_CASCADE; + if (is_on_delete) { + foreign->type |= DICT_FOREIGN_ON_DELETE_CASCADE; + } else { + foreign->type |= DICT_FOREIGN_ON_UPDATE_CASCADE; + } - goto try_find_index; + goto scan_on_conditions; + } + + ptr = dict_accept(ptr, "NO", &success); + + if (success) { + ptr = dict_accept(ptr, "ACTION", &success); + + if (!success) { + dict_foreign_free(foreign); + + return(DB_CANNOT_ADD_CONSTRAINT); + } + + if (is_on_delete) { + foreign->type |= DICT_FOREIGN_ON_DELETE_NO_ACTION; + } else { + foreign->type |= DICT_FOREIGN_ON_UPDATE_NO_ACTION; + } + + goto scan_on_conditions; } ptr = dict_accept(ptr, "SET", &success); @@ -2451,20 +2497,23 @@ col_loop2: } } - foreign->type = DICT_FOREIGN_ON_DELETE_SET_NULL; + if (is_on_delete) { + foreign->type |= DICT_FOREIGN_ON_DELETE_SET_NULL; + } else { + foreign->type |= DICT_FOREIGN_ON_UPDATE_SET_NULL; + } + goto scan_on_conditions; + try_find_index: - /* We check that there are no superfluous words like 'ON UPDATE ...' - which we do not support yet. */ - - ptr = dict_accept(ptr, (char *) "ON", &success); - - if (success) { + if (n_on_deletes > 1 || n_on_updates > 1) { + /* It is an error to define more than 1 action */ + dict_foreign_free(foreign); return(DB_CANNOT_ADD_CONSTRAINT); } - + /* Try to find an index which contains the columns as the first fields and in the right order, and the types are the same as in foreign->foreign_index */ @@ -3286,7 +3335,8 @@ dict_print_info_on_foreign_keys_in_create_format( /*=============================================*/ char* buf, /* in: auxiliary buffer */ char* str, /* in/out: pointer to a string */ - ulint len, /* in: space in str available for info */ + ulint len, /* in: str has to be a buffer at least + len + 5000 bytes */ dict_table_t* table) /* in: table */ { @@ -3356,14 +3406,30 @@ dict_print_info_on_foreign_keys_in_create_format( buf2 += sprintf(buf2, ")"); - if (foreign->type == DICT_FOREIGN_ON_DELETE_CASCADE) { + if (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE) { buf2 += sprintf(buf2, " ON DELETE CASCADE"); } - if (foreign->type == DICT_FOREIGN_ON_DELETE_SET_NULL) { + if (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL) { buf2 += sprintf(buf2, " ON DELETE SET NULL"); } + if (foreign->type & DICT_FOREIGN_ON_DELETE_NO_ACTION) { + buf2 += sprintf(buf2, " ON DELETE NO ACTION"); + } + + if (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE) { + buf2 += sprintf(buf2, " ON UPDATE CASCADE"); + } + + if (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL) { + buf2 += sprintf(buf2, " ON UPDATE SET NULL"); + } + + if (foreign->type & DICT_FOREIGN_ON_UPDATE_NO_ACTION) { + buf2 += sprintf(buf2, " ON UPDATE NO ACTION"); + } + foreign = UT_LIST_GET_NEXT(foreign_list, foreign); } no_space: @@ -3455,6 +3521,22 @@ dict_print_info_on_foreign_keys( buf2 += sprintf(buf2, " ON DELETE SET NULL"); } + if (foreign->type & DICT_FOREIGN_ON_DELETE_NO_ACTION) { + buf2 += sprintf(buf2, " ON DELETE NO ACTION"); + } + + if (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE) { + buf2 += sprintf(buf2, " ON UPDATE CASCADE"); + } + + if (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL) { + buf2 += sprintf(buf2, " ON UPDATE SET NULL"); + } + + if (foreign->type & DICT_FOREIGN_ON_UPDATE_NO_ACTION) { + buf2 += sprintf(buf2, " ON UPDATE NO ACTION"); + } + foreign = UT_LIST_GET_NEXT(foreign_list, foreign); } no_space: diff --git a/innobase/fsp/fsp0fsp.c b/innobase/fsp/fsp0fsp.c index ff586819d4a..ee48288b875 100644 --- a/innobase/fsp/fsp0fsp.c +++ b/innobase/fsp/fsp0fsp.c @@ -2479,20 +2479,20 @@ try_again: n_free = n_free_list_ext + n_free_up; if (alloc_type == FSP_NORMAL) { - /* We reserve 1 extent + 4 % of the space size to undo logs - and 1 extent + 1 % to cleaning operations; NOTE: this source + /* We reserve 1 extent + 0.5 % of the space size to undo logs + and 1 extent + 0.5 % to cleaning operations; NOTE: this source code is duplicated in the function below! */ - reserve = 2 + ((size / FSP_EXTENT_SIZE) * 5) / 100; + reserve = 2 + ((size / FSP_EXTENT_SIZE) * 2) / 200; if (n_free <= reserve + n_ext) { goto try_to_extend; } } else if (alloc_type == FSP_UNDO) { - /* We reserve 1 % of the space size to cleaning operations */ + /* We reserve 0.5 % of the space size to cleaning operations */ - reserve = 1 + ((size / FSP_EXTENT_SIZE) * 1) / 100; + reserve = 1 + ((size / FSP_EXTENT_SIZE) * 1) / 200; if (n_free <= reserve + n_ext) { @@ -2572,11 +2572,11 @@ fsp_get_available_space_in_free_extents( n_free = n_free_list_ext + n_free_up; - /* We reserve 1 extent + 4 % of the space size to undo logs - and 1 extent + 1 % to cleaning operations; NOTE: this source + /* We reserve 1 extent + 0.5 % of the space size to undo logs + and 1 extent + 0.5 % to cleaning operations; NOTE: this source code is duplicated in the function above! */ - reserve = 2 + ((size / FSP_EXTENT_SIZE) * 5) / 100; + reserve = 2 + ((size / FSP_EXTENT_SIZE) * 2) / 200; if (reserve > n_free) { return(0); diff --git a/innobase/ibuf/ibuf0ibuf.c b/innobase/ibuf/ibuf0ibuf.c index 143b3bfa584..668e9419c24 100644 --- a/innobase/ibuf/ibuf0ibuf.c +++ b/innobase/ibuf/ibuf0ibuf.c @@ -2657,10 +2657,7 @@ reset_bit: new_bits, &mtr); } } - - ibuf_data->n_merges++; - ibuf_data->n_merged_recs += n_inserts; - + #ifdef UNIV_IBUF_DEBUG /* printf("Ibuf merge %lu records volume %lu to page no %lu\n", n_inserts, volume, page_no); */ @@ -2670,6 +2667,14 @@ reset_bit: mem_heap_free(heap); + /* Protect our statistics keeping from race conditions */ + mutex_enter(&ibuf_mutex); + + ibuf_data->n_merges++; + ibuf_data->n_merged_recs += n_inserts; + + mutex_exit(&ibuf_mutex); + ibuf_exit(); #ifdef UNIV_IBUF_DEBUG ut_a(ibuf_count_get(space, page_no) == 0); diff --git a/innobase/include/buf0buf.h b/innobase/include/buf0buf.h index f76c437bd1d..395f88a2c7c 100644 --- a/innobase/include/buf0buf.h +++ b/innobase/include/buf0buf.h @@ -728,8 +728,8 @@ struct buf_block_struct{ bufferfixed, or (2) the thread has an x-latch on the block */ - /* 5. Hash search fields: NOTE that these fields are protected by - btr_search_mutex */ + /* 5. Hash search fields: NOTE that the first 4 fields are NOT + protected by any semaphore! */ ulint n_hash_helps; /* counter which controls building of a new hash index for the page */ @@ -742,6 +742,9 @@ struct buf_block_struct{ whether the leftmost record of several records with the same prefix should be indexed in the hash index */ + + /* The following 4 fields are protected by btr_search_latch: */ + ibool is_hashed; /* TRUE if hash index has already been built on this page; note that it does not guarantee that the index is diff --git a/innobase/include/db0err.h b/innobase/include/db0err.h index ae4b0fe4cc5..c67c09bad27 100644 --- a/innobase/include/db0err.h +++ b/innobase/include/db0err.h @@ -42,8 +42,9 @@ Created 5/24/1996 Heikki Tuuri #define DB_CANNOT_ADD_CONSTRAINT 38 /* adding a foreign key constraint to a table failed */ #define DB_CORRUPTION 39 /* data structure corruption noticed */ -#define DB_COL_APPEARS_TWICE_IN_INDEX 40 - +#define DB_COL_APPEARS_TWICE_IN_INDEX 40 /* InnoDB cannot handle an index + where same column appears twice */ + /* The following are partial failure codes */ #define DB_FAIL 1000 #define DB_OVERFLOW 1001 diff --git a/innobase/include/dict0mem.h b/innobase/include/dict0mem.h index 22293389bae..0798541cfe0 100644 --- a/innobase/include/dict0mem.h +++ b/innobase/include/dict0mem.h @@ -280,8 +280,15 @@ struct dict_foreign_struct{ table */ }; +/* The flags for ON_UPDATE and ON_DELETE can be ORed; the default is that +a foreign key constraint is enforced, therefore RESTRICT just means no flag */ #define DICT_FOREIGN_ON_DELETE_CASCADE 1 #define DICT_FOREIGN_ON_DELETE_SET_NULL 2 +#define DICT_FOREIGN_ON_UPDATE_CASCADE 4 +#define DICT_FOREIGN_ON_UPDATE_SET_NULL 8 +#define DICT_FOREIGN_ON_DELETE_NO_ACTION 16 +#define DICT_FOREIGN_ON_UPDATE_NO_ACTION 32 + #define DICT_INDEX_MAGIC_N 76789786 diff --git a/innobase/include/mem0mem.h b/innobase/include/mem0mem.h index bfd25f5bdbe..9ab3b2cd754 100644 --- a/innobase/include/mem0mem.h +++ b/innobase/include/mem0mem.h @@ -127,16 +127,18 @@ mem_heap_create_func( ulint line /* in: line where created */ ); /********************************************************************* -NOTE: Use the corresponding macro instead of this function. -Frees the space occupied by a memory heap. */ +NOTE: Use the corresponding macro instead of this function. Frees the space +occupied by a memory heap. In the debug version erases the heap memory +blocks. */ UNIV_INLINE void mem_heap_free_func( /*===============*/ - mem_heap_t* heap, /* in, own: heap to be freed */ - char* file_name, /* in: file name where freed */ - ulint line /* in: line where freed */ -); + mem_heap_t* heap, /* in, own: heap to be freed */ + char* file_name __attribute__((unused)), + /* in: file name where freed */ + ulint line __attribute__((unused))); + /* in: line where freed */ /******************************************************************* Allocates n bytes of memory from a memory heap. */ UNIV_INLINE diff --git a/innobase/include/mem0mem.ic b/innobase/include/mem0mem.ic index a7abb93d91d..1ff8c66e80a 100644 --- a/innobase/include/mem0mem.ic +++ b/innobase/include/mem0mem.ic @@ -440,9 +440,10 @@ void mem_heap_free_func( /*===============*/ mem_heap_t* heap, /* in, own: heap to be freed */ - char* file_name, /* in: file name where freed */ - ulint line /* in: line where freed */ - ) + char* file_name __attribute__((unused)), + /* in: file name where freed */ + ulint line __attribute__((unused))) + /* in: line where freed */ { mem_block_t* block; mem_block_t* prev_block; diff --git a/innobase/include/row0mysql.h b/innobase/include/row0mysql.h index 44b470fe7ea..25d2ab77007 100644 --- a/innobase/include/row0mysql.h +++ b/innobase/include/row0mysql.h @@ -492,7 +492,11 @@ struct row_prebuilt_struct { fetch many rows from the same cursor: it saves CPU time to fetch them in a batch; we reserve mysql_row_len - bytes for each such row */ + bytes for each such row; these + pointers point 4 bytes past the + allocated mem buf start, because + there is a 4 byte magic number at the + start and at the end */ ulint fetch_cache_first;/* position of the first not yet fetched row in fetch_cache */ ulint n_fetch_cached; /* number of not yet fetched rows @@ -501,8 +505,12 @@ struct row_prebuilt_struct { to this heap */ mem_heap_t* old_vers_heap; /* memory heap where a previous version is built in consistent read */ + ulint magic_n2; /* this should be the same as + magic_n */ }; +#define ROW_PREBUILT_FETCH_MAGIC_N 465765687 + #define ROW_MYSQL_WHOLE_ROW 0 #define ROW_MYSQL_REC_FIELDS 1 #define ROW_MYSQL_NO_TEMPLATE 2 diff --git a/innobase/include/row0upd.h b/innobase/include/row0upd.h index 9a3e2463267..273ec6074eb 100644 --- a/innobase/include/row0upd.h +++ b/innobase/include/row0upd.h @@ -312,8 +312,11 @@ struct upd_node_struct{ ibool in_mysql_interface; /* TRUE if the update node was created for the MySQL interface */ + dict_foreign_t* foreign;/* NULL or pointer to a foreign key + constraint if this update node is used in + doing an ON DELETE or ON UPDATE operation */ upd_node_t* cascade_node;/* NULL or an update node template which - is used to implement ON DELETE CASCADE + is used to implement ON DELETE/UPDATE CASCADE or ... SET NULL for foreign keys */ mem_heap_t* cascade_heap;/* NULL or a mem heap where the cascade node is created */ diff --git a/innobase/mem/mem0pool.c b/innobase/mem/mem0pool.c index 61cf1e50ce9..1c32a4d02a6 100644 --- a/innobase/mem/mem0pool.c +++ b/innobase/mem/mem0pool.c @@ -15,6 +15,7 @@ Created 5/12/1997 Heikki Tuuri #include "ut0mem.h" #include "ut0lst.h" #include "ut0byte.h" +#include "mem0mem.h" /* We would like to use also the buffer frames to allocate memory. This would be desirable, because then the memory consumption of the database @@ -251,7 +252,6 @@ mem_pool_fill_free_list( mem_area_t* area; mem_area_t* area2; ibool ret; - char err_buf[500]; ut_ad(mutex_own(&(pool->mutex))); @@ -300,11 +300,8 @@ mem_pool_fill_free_list( } if (UT_LIST_GET_LEN(pool->free_list[i + 1]) == 0) { - ut_sprintf_buf(err_buf, ((byte*)area) - 50, 100); - fprintf(stderr, -"InnoDB: Error: Removing element from mem pool free list %lu\n" -"InnoDB: though the list length is 0! Dump of 100 bytes around element:\n%s\n", - i + 1, err_buf); + mem_analyze_corruption((byte*)area); + ut_a(0); } @@ -340,7 +337,6 @@ mem_area_alloc( mem_area_t* area; ulint n; ibool ret; - char err_buf[500]; n = ut_2_log(ut_max(size + MEM_AREA_EXTRA_SIZE, MEM_AREA_MIN_SIZE)); @@ -364,20 +360,22 @@ mem_area_alloc( } if (!mem_area_get_free(area)) { - ut_sprintf_buf(err_buf, ((byte*)area) - 50, 100); fprintf(stderr, "InnoDB: Error: Removing element from mem pool free list %lu though the\n" -"InnoDB: element is not marked free! Dump of 100 bytes around element:\n%s\n", - n, err_buf); +"InnoDB: element is not marked free!\n", + n); + + mem_analyze_corruption((byte*)area); ut_a(0); } if (UT_LIST_GET_LEN(pool->free_list[n]) == 0) { - ut_sprintf_buf(err_buf, ((byte*)area) - 50, 100); fprintf(stderr, "InnoDB: Error: Removing element from mem pool free list %lu\n" -"InnoDB: though the list length is 0! Dump of 100 bytes around element:\n%s\n", - n, err_buf); +"InnoDB: though the list length is 0!\n", + n); + mem_analyze_corruption((byte*)area); + ut_a(0); } @@ -451,7 +449,6 @@ mem_area_free( void* new_ptr; ulint size; ulint n; - char err_buf[500]; if (mem_out_of_mem_err_msg_count > 0) { /* It may be that the area was really allocated from the @@ -468,18 +465,25 @@ mem_area_free( area = (mem_area_t*) (((byte*)ptr) - MEM_AREA_EXTRA_SIZE); - if (mem_area_get_free(area)) { - ut_sprintf_buf(err_buf, ((byte*)area) - 50, 100); + if (mem_area_get_free(area)) { fprintf(stderr, "InnoDB: Error: Freeing element to mem pool free list though the\n" -"InnoDB: element is marked free! Dump of 100 bytes around element:\n%s\n", - err_buf); +"InnoDB: element is marked free!\n"); + + mem_analyze_corruption((byte*)area); ut_a(0); } size = mem_area_get_size(area); - ut_ad(size != 0); + if (size == 0) { + fprintf(stderr, +"InnoDB: Error: Mem area size is 0. Possibly a memory overrun of the\n" +"InnoDB: previous allocated area!\n"); + + mem_analyze_corruption((byte*)area); + ut_a(0); + } #ifdef UNIV_LIGHT_MEM_DEBUG if (((byte*)area) + size < pool->buf + pool->size) { @@ -488,7 +492,15 @@ mem_area_free( next_size = mem_area_get_size( (mem_area_t*)(((byte*)area) + size)); - ut_a(ut_2_power_up(next_size) == next_size); + if (ut_2_power_up(next_size) != next_size) { + fprintf(stderr, +"InnoDB: Error: Memory area size %lu, next area size %lu not a power of 2!\n" +"InnoDB: Possibly a memory overrun of the buffer being freed here.\n", + size, next_size); + mem_analyze_corruption((byte*)area); + + ut_a(0); + } } #endif buddy = mem_area_get_buddy(area, size, pool); diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c index d0a5cfec604..990ef99b2a4 100644 --- a/innobase/row/row0ins.c +++ b/innobase/row/row0ins.c @@ -322,13 +322,129 @@ row_ins_clust_index_entry_by_modify( } /************************************************************************* -Either deletes or sets the referencing columns SQL NULL in a child row. -Used in ON DELETE ... clause for foreign keys when a parent row is -deleted. */ +Returns TRUE if in a cascaded update/delete an ancestor node of node +updates table. */ +static +ibool +row_ins_cascade_ancestor_updates_table( +/*===================================*/ + /* out: TRUE if an ancestor updates table */ + que_node_t* node, /* in: node in a query graph */ + dict_table_t* table) /* in: table */ +{ + que_node_t* parent; + upd_node_t* upd_node; + + parent = que_node_get_parent(node); + + while (que_node_get_type(parent) == QUE_NODE_UPDATE) { + + upd_node = parent; + + if (upd_node->table == table) { + + return(TRUE); + } + + parent = que_node_get_parent(parent); + + ut_a(parent); + } + + return(FALSE); +} + +/********************************************************************** +Calculates the update vector node->cascade->update for a child table in +a cascaded update. */ static ulint -row_ins_foreign_delete_or_set_null( -/*===============================*/ +row_ins_cascade_calc_update_vec( +/*============================*/ + /* out: number of fields in the + calculated update vector; the value + can also be 0 if no foreign key + fields changed */ + upd_node_t* node, /* in: update node of the parent + table */ + dict_foreign_t* foreign) /* in: foreign key constraint whose + type is != 0 */ +{ + upd_node_t* cascade = node->cascade_node; + dict_table_t* table = foreign->foreign_table; + dict_index_t* index = foreign->foreign_index; + upd_t* update; + upd_field_t* ufield; + dict_table_t* parent_table; + dict_index_t* parent_index; + upd_t* parent_update; + upd_field_t* parent_ufield; + ulint n_fields_updated; + ulint parent_field_no; + ulint i; + ulint j; + + ut_a(node && foreign && cascade && table && index); + + /* Calculate the appropriate update vector which will set the fields + in the child index record to the same value as the referenced index + record will get in the update. */ + + parent_table = node->table; + ut_a(parent_table == foreign->referenced_table); + parent_index = foreign->referenced_index; + parent_update = node->update; + + update = cascade->update; + + update->info_bits = 0; + update->n_fields = foreign->n_fields; + + n_fields_updated = 0; + + for (i = 0; i < foreign->n_fields; i++) { + + parent_field_no = dict_table_get_nth_col_pos( + parent_table, + dict_index_get_nth_col_no( + parent_index, i)); + + for (j = 0; j < parent_update->n_fields; j++) { + parent_ufield = parent_update->fields + j; + + if (parent_ufield->field_no == parent_field_no) { + + /* A field in the parent index record is + updated. Let us make the update vector + field for the child table. */ + + ufield = update->fields + n_fields_updated; + + ufield->field_no = + dict_table_get_nth_col_pos(table, + dict_index_get_nth_col_no(index, i)); + ufield->exp = NULL; + ufield->new_val = parent_ufield->new_val; + ufield->extern_storage = FALSE; + + n_fields_updated++; + } + } + } + + update->n_fields = n_fields_updated; + + return(n_fields_updated); +} + +/************************************************************************* +Perform referential actions or checks when a parent row is deleted or updated +and the constraint had an ON DELETE or ON UPDATE condition which was not +RESTRICT. */ +static +ulint +row_ins_foreign_check_on_constraint( +/*================================*/ /* out: DB_SUCCESS, DB_LOCK_WAIT, or error code */ que_thr_t* thr, /* in: query thread whose run_node @@ -378,15 +494,34 @@ row_ins_foreign_delete_or_set_null( ut_strlen(table->name) + 1); node = thr->run_node; - ut_a(que_node_get_type(node) == QUE_NODE_UPDATE); + if (node->is_delete && 0 == (foreign->type & + (DICT_FOREIGN_ON_DELETE_CASCADE + | DICT_FOREIGN_ON_DELETE_SET_NULL))) { - if (!node->is_delete) { - /* According to SQL-92 an UPDATE with respect to FOREIGN - KEY constraints is not semantically equivalent to a - DELETE + INSERT. Therefore we do not perform any action - here and consequently the child rows would be left - orphaned if we would let the UPDATE happen. Thus we return - an error. */ + /* No action is defined: return a foreign key error if + NO ACTION is not specified */ + + if (foreign->type & DICT_FOREIGN_ON_DELETE_NO_ACTION) { + + return(DB_SUCCESS); + } + + return(DB_ROW_IS_REFERENCED); + } + + if (!node->is_delete && 0 == (foreign->type & + (DICT_FOREIGN_ON_UPDATE_CASCADE + | DICT_FOREIGN_ON_UPDATE_SET_NULL))) { + + /* This is an UPDATE */ + + /* No action is defined: return a foreign key error if + NO ACTION is not specified */ + + if (foreign->type & DICT_FOREIGN_ON_UPDATE_NO_ACTION) { + + return(DB_SUCCESS); + } return(DB_ROW_IS_REFERENCED); } @@ -411,7 +546,10 @@ row_ins_foreign_delete_or_set_null( cascade->table = table; - if (foreign->type == DICT_FOREIGN_ON_DELETE_CASCADE ) { + cascade->foreign = foreign; + + if (node->is_delete + && (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE)) { cascade->is_delete = TRUE; } else { cascade->is_delete = FALSE; @@ -425,8 +563,30 @@ row_ins_foreign_delete_or_set_null( } } + /* We do not allow cyclic cascaded updating of the same + table. Check that we are not updating the same table which + is already being modified in this cascade chain. We have to + check this because the modification of the indexes of a + 'parent' table may still be incomplete, and we must avoid + seeing the indexes of the parent table in an inconsistent + state! In this way we also prevent possible infinite + update loops caused by cyclic cascaded updates. */ + + if (!cascade->is_delete + && row_ins_cascade_ancestor_updates_table(cascade, table)) { + + /* We do not know if this would break foreign key + constraints, but play safe and return an error */ + + err = DB_ROW_IS_REFERENCED; + + goto nonstandard_exit_func; + } + index = btr_pcur_get_btr_cur(pcur)->index; + ut_a(index == foreign->foreign_index); + rec = btr_pcur_get_rec(pcur); if (index->type & DICT_CLUSTERED) { @@ -520,7 +680,11 @@ row_ins_foreign_delete_or_set_null( goto nonstandard_exit_func; } - if (foreign->type == DICT_FOREIGN_ON_DELETE_SET_NULL) { + if ((node->is_delete + && (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL)) + || (!node->is_delete + && (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL))) { + /* Build the appropriate update vector which sets foreign->n_fields first fields in rec to SQL NULL */ @@ -540,6 +704,26 @@ row_ins_foreign_delete_or_set_null( } } + if (!node->is_delete + && (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE)) { + + /* Build the appropriate update vector which sets changing + foreign->n_fields first fields in rec to new values */ + + row_ins_cascade_calc_update_vec(node, foreign); + + if (cascade->update->n_fields == 0) { + + /* The update does not change any columns referred + to in this foreign key constraint: no need to do + anything */ + + err = DB_SUCCESS; + + goto nonstandard_exit_func; + } + } + /* Store pcur position and initialize or store the cascade node pcur stored position */ @@ -629,6 +813,7 @@ row_ins_check_foreign_constraint( dtuple_t* entry, /* in: index entry for index */ que_thr_t* thr) /* in: query thread */ { + upd_node_t* upd_node; dict_table_t* check_table; dict_index_t* check_index; ulint n_fields_cmp; @@ -665,6 +850,30 @@ run_again: } } + if (que_node_get_type(thr->run_node) == QUE_NODE_UPDATE) { + upd_node = thr->run_node; + + if (!(upd_node->is_delete) && upd_node->foreign == foreign) { + /* If a cascaded update is done as defined by a + foreign key constraint, do not check that + constraint for the child row. In ON UPDATE CASCADE + the update of the parent row is only half done when + we come here: if we would check the constraint here + for the child row it would fail. + + A QUESTION remains: if in the child table there are + several constraints which refer to the same parent + table, we should merge all updates to the child as + one update? And the updates can be contradictory! + Currently we just perform the update associated + with each foreign key constraint, one after + another, and the user has problems predicting in + which order they are performed. */ + + return(DB_SUCCESS); + } + } + if (check_ref) { check_table = foreign->referenced_table; check_index = foreign->referenced_index; @@ -774,8 +983,12 @@ run_again: break; } else if (foreign->type != 0) { + /* There is an ON UPDATE or ON DELETE + condition: check them in a separate + function */ + err = - row_ins_foreign_delete_or_set_null( + row_ins_foreign_check_on_constraint( thr, foreign, &pcur, &mtr); if (err != DB_SUCCESS) { diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index 9ce86b5d487..ba56b3071cd 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -313,6 +313,7 @@ row_create_prebuilt( prebuilt = mem_heap_alloc(heap, sizeof(row_prebuilt_t)); prebuilt->magic_n = ROW_PREBUILT_ALLOCATED; + prebuilt->magic_n2 = ROW_PREBUILT_ALLOCATED; prebuilt->table = table; @@ -378,11 +379,12 @@ row_prebuilt_free( { ulint i; - if (prebuilt->magic_n != ROW_PREBUILT_ALLOCATED) { + if (prebuilt->magic_n != ROW_PREBUILT_ALLOCATED + || prebuilt->magic_n2 != ROW_PREBUILT_ALLOCATED) { fprintf(stderr, - "InnoDB: Error: trying to free a corrupt\n" - "InnoDB: table handle. Magic n %lu, table name %s\n", - prebuilt->magic_n, prebuilt->table->name); +"InnoDB: Error: trying to free a corrupt\n" +"InnoDB: table handle. Magic n %lu, magic n2 %lu, table name %s\n", + prebuilt->magic_n, prebuilt->magic_n2, prebuilt->table->name); mem_analyze_corruption((byte*)prebuilt); @@ -390,6 +392,7 @@ row_prebuilt_free( } prebuilt->magic_n = ROW_PREBUILT_FREED; + prebuilt->magic_n2 = ROW_PREBUILT_FREED; btr_pcur_free_for_mysql(prebuilt->pcur); btr_pcur_free_for_mysql(prebuilt->clust_pcur); @@ -420,7 +423,23 @@ row_prebuilt_free( for (i = 0; i < MYSQL_FETCH_CACHE_SIZE; i++) { if (prebuilt->fetch_cache[i] != NULL) { - mem_free(prebuilt->fetch_cache[i]); + + if ((ROW_PREBUILT_FETCH_MAGIC_N != + mach_read_from_4((prebuilt->fetch_cache[i]) - 4)) + || (ROW_PREBUILT_FETCH_MAGIC_N != + mach_read_from_4((prebuilt->fetch_cache[i]) + + prebuilt->mysql_row_len))) { + fprintf(stderr, + "InnoDB: Error: trying to free a corrupt\n" + "InnoDB: fetch buffer.\n"); + + mem_analyze_corruption( + prebuilt->fetch_cache[i]); + + ut_a(0); + } + + mem_free((prebuilt->fetch_cache[i]) - 4); } } @@ -1435,7 +1454,7 @@ int row_create_index_for_mysql( /*=======================*/ /* out: error number or DB_SUCCESS */ - dict_index_t* index, /* in: index defintion */ + dict_index_t* index, /* in: index definition */ trx_t* trx) /* in: transaction handle */ { ind_node_t* node; @@ -1444,7 +1463,9 @@ row_create_index_for_mysql( ulint namelen; ulint keywordlen; ulint err; - + ulint i; + ulint j; + ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX)); ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(trx->mysql_thread_id == os_thread_get_curr_id()); @@ -1465,6 +1486,31 @@ row_create_index_for_mysql( return(DB_SUCCESS); } + /* Check that the same column does not appear twice in the index. + InnoDB assumes this in its algorithms, e.g., update of an index + entry */ + + for (i = 0; i < dict_index_get_n_fields(index); i++) { + for (j = 0; j < i; j++) { + if (0 == ut_strcmp( + dict_index_get_nth_field(index, j)->name, + dict_index_get_nth_field(index, i)->name)) { + + ut_print_timestamp(stderr); + + fprintf(stderr, +" InnoDB: Error: column %s appears twice in index %s of table %s\n" +"InnoDB: This is not allowed in InnoDB.\n", + dict_index_get_nth_field(index, i)->name, + index->name, index->table_name); + + err = DB_COL_APPEARS_TWICE_IN_INDEX; + + goto error_handling; + } + } + } + heap = mem_heap_create(512); trx->dict_operation = TRUE; @@ -1477,11 +1523,13 @@ row_create_index_for_mysql( SESS_COMM_EXECUTE, 0)); que_run_threads(thr); - err = trx->error_state; + err = trx->error_state; + que_graph_free((que_t*) que_node_get_parent(thr)); + +error_handling: if (err != DB_SUCCESS) { /* We have special error handling here */ - ut_a(err == DB_OUT_OF_FILE_SPACE); trx->error_state = DB_SUCCESS; @@ -1491,8 +1539,6 @@ row_create_index_for_mysql( trx->error_state = DB_SUCCESS; } - - que_graph_free((que_t*) que_node_get_parent(thr)); trx->op_info = (char *) ""; diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c index a3744089258..ea5b3020c08 100644 --- a/innobase/row/row0sel.c +++ b/innobase/row/row0sel.c @@ -2415,6 +2415,7 @@ row_sel_push_cache_row_for_mysql( row_prebuilt_t* prebuilt, /* in: prebuilt struct */ rec_t* rec) /* in: record to push */ { + byte* buf; ulint i; ut_ad(prebuilt->n_fetch_cached < MYSQL_FETCH_CACHE_SIZE); @@ -2424,8 +2425,18 @@ row_sel_push_cache_row_for_mysql( /* Allocate memory for the fetch cache */ for (i = 0; i < MYSQL_FETCH_CACHE_SIZE; i++) { - prebuilt->fetch_cache[i] = mem_alloc( - prebuilt->mysql_row_len); + + /* A user has reported memory corruption in these + buffers in Linux. Put magic numbers there to help + to track a possible bug. */ + + buf = mem_alloc(prebuilt->mysql_row_len + 8); + + prebuilt->fetch_cache[i] = buf + 4; + + mach_write_to_4(buf, ROW_PREBUILT_FETCH_MAGIC_N); + mach_write_to_4(buf + 4 + prebuilt->mysql_row_len, + ROW_PREBUILT_FETCH_MAGIC_N); } } @@ -2437,7 +2448,7 @@ row_sel_push_cache_row_for_mysql( prebuilt->n_fetch_cached++; } - + /************************************************************************* Tries to do a shortcut to fetch a clustered index record with a unique key, using the hash index if possible (not always). We assume that the search diff --git a/innobase/row/row0upd.c b/innobase/row/row0upd.c index 1231c94da63..64569bf3f96 100644 --- a/innobase/row/row0upd.c +++ b/innobase/row/row0upd.c @@ -71,6 +71,20 @@ the x-latch freed? The most efficient way for performing a searched delete is obviously to keep the x-latch for several steps of query graph execution. */ +/*************************************************************** +Checks if an update vector changes some of the first fields of an index +record. */ +static +ibool +row_upd_changes_first_fields( +/*=========================*/ + /* out: TRUE if changes */ + dtuple_t* entry, /* in: old value of index entry */ + dict_index_t* index, /* in: index of entry */ + upd_t* update, /* in: update vector for the row */ + ulint n); /* in: how many first fields to check */ + + /************************************************************************* Checks if index currently is mentioned as a referenced index in a foreign key constraint. */ @@ -132,6 +146,7 @@ ulint row_upd_check_references_constraints( /*=================================*/ /* out: DB_SUCCESS or an error code */ + upd_node_t* node, /* in: row update node */ btr_pcur_t* pcur, /* in: cursor positioned on a record; NOTE: the cursor position is lost in this function! */ dict_table_t* table, /* in: table in question */ @@ -173,7 +188,16 @@ row_upd_check_references_constraints( foreign = UT_LIST_GET_FIRST(table->referenced_list); while (foreign) { - if (foreign->referenced_index == index) { + /* Note that we may have an update which updates the index + record, but does NOT update the first fields which are + referenced in a foreign key constraint. Then the update does + NOT break the constraint. */ + + if (foreign->referenced_index == index + && (node->is_delete + || row_upd_changes_first_fields(entry, index, + node->update, foreign->n_fields))) { + if (foreign->foreign_table == NULL) { dict_table_get(foreign->foreign_table_name, trx); @@ -189,10 +213,9 @@ row_upd_check_references_constraints( } /* NOTE that if the thread ends up waiting for a lock - we will release dict_operation_lock - temporarily! But the counter on the table - protects 'foreign' from being dropped while the check - is running. */ + we will release dict_operation_lock temporarily! + But the counter on the table protects 'foreign' from + being dropped while the check is running. */ err = row_ins_check_foreign_constraint(FALSE, foreign, table, index, entry, thr); @@ -255,6 +278,7 @@ upd_node_create( node->index = NULL; node->update = NULL; + node->foreign = NULL; node->cascade_heap = NULL; node->cascade_node = NULL; @@ -953,6 +977,53 @@ row_upd_changes_some_index_ord_field_binary( return(FALSE); } +/*************************************************************** +Checks if an update vector changes some of the first fields of an index +record. */ +static +ibool +row_upd_changes_first_fields( +/*=========================*/ + /* out: TRUE if changes */ + dtuple_t* entry, /* in: index entry */ + dict_index_t* index, /* in: index of entry */ + upd_t* update, /* in: update vector for the row */ + ulint n) /* in: how many first fields to check */ +{ + upd_field_t* upd_field; + dict_field_t* ind_field; + dict_col_t* col; + ulint n_upd_fields; + ulint col_pos; + ulint i, j; + + ut_a(update && index); + ut_a(n <= dict_index_get_n_fields(index)); + + n_upd_fields = upd_get_n_fields(update); + + for (i = 0; i < n; i++) { + + ind_field = dict_index_get_nth_field(index, i); + col = dict_field_get_col(ind_field); + col_pos = dict_col_get_clust_pos(col); + + for (j = 0; j < n_upd_fields; j++) { + + upd_field = upd_get_nth_field(update, j); + + if (col_pos == upd_field->field_no + && cmp_dfield_dfield( + dtuple_get_nth_field(entry, i), + &(upd_field->new_val))) { + return(TRUE); + } + } + } + + return(FALSE); +} + /************************************************************************* Copies the column values from a record. */ UNIV_INLINE @@ -1106,9 +1177,11 @@ row_upd_sec_index_entry( err = btr_cur_del_mark_set_sec_rec(0, btr_cur, TRUE, thr, &mtr); if (err == DB_SUCCESS && check_ref) { + /* NOTE that the following call loses the position of pcur ! */ err = row_upd_check_references_constraints( + node, &pcur, index->table, index, thr, &mtr); if (err != DB_SUCCESS) { @@ -1224,7 +1297,7 @@ row_upd_clust_rec_by_insert( if (check_ref) { /* NOTE that the following call loses the position of pcur ! */ - err = row_upd_check_references_constraints( + err = row_upd_check_references_constraints(node, pcur, table, index, thr, mtr); if (err != DB_SUCCESS) { @@ -1392,7 +1465,8 @@ row_upd_del_mark_clust_rec( if (err == DB_SUCCESS && check_ref) { /* NOTE that the following call loses the position of pcur ! */ - err = row_upd_check_references_constraints(pcur, index->table, + err = row_upd_check_references_constraints(node, + pcur, index->table, index, thr, mtr); if (err != DB_SUCCESS) { mtr_commit(mtr); diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index d6e8a8dcb4a..ec674b69256 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -529,6 +529,9 @@ open_or_create_log_file( new database */ ibool* log_file_created, /* out: TRUE if new log file created */ + ibool log_file_has_been_opened,/* in: TRUE if a log file has been + opened before: then it is an error + to try to create another log file */ ulint k, /* in: log group number */ ulint i) /* in: log file number in group */ { @@ -581,12 +584,17 @@ open_or_create_log_file( } } else { *log_file_created = TRUE; - + ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Log file %s did not exist: new to be created\n", name); + if (log_file_has_been_opened) { + + return(DB_ERROR); + } + fprintf(stderr, "InnoDB: Setting log file %s size to %lu MB\n", name, srv_log_file_size >> (20 - UNIV_PAGE_SIZE_SHIFT)); @@ -1160,7 +1168,8 @@ innobase_start_or_create_for_mysql(void) for (i = 0; i < srv_n_log_files; i++) { err = open_or_create_log_file(create_new_db, - &log_file_created, k, i); + &log_file_created, + log_opened, k, i); if (err != DB_SUCCESS) { return((int) err); diff --git a/innobase/ut/ut0ut.c b/innobase/ut/ut0ut.c index c77cbe9cdcf..ff5d11d84ed 100644 --- a/innobase/ut/ut0ut.c +++ b/innobase/ut/ut0ut.c @@ -262,7 +262,7 @@ ut_print_buf( data = buf; for (i = 0; i < len; i++) { - if (isprint((char)(*data))) { + if (isprint((int)(*data))) { printf("%c", (char)*data); } data++; @@ -302,7 +302,7 @@ ut_sprintf_buf( data = buf; for (i = 0; i < len; i++) { - if (isprint((char)(*data))) { + if (isprint((int)(*data))) { n += sprintf(str + n, "%c", (char)*data); } else { n += sprintf(str + n, "."); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 1e70064b4a1..28aa21e94ce 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4709,7 +4709,10 @@ join_read_const(JOIN_TAB *tab) empty_record(table); if (error != HA_ERR_KEY_NOT_FOUND) { - sql_print_error("read_const: Got error %d when reading table %s", + /* Locking reads can legally return also these errors, do not + print them to the .err log */ + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error("read_const: Got error %d when reading table %s", error, table->path); table->file->print_error(error,MYF(0)); return 1; @@ -4772,7 +4775,8 @@ join_read_always_key(JOIN_TAB *tab) { if (error != HA_ERR_KEY_NOT_FOUND) { - sql_print_error("read_const: Got error %d when reading table %s",error, + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error("read_const: Got error %d when reading table %s",error, table->path); table->file->print_error(error,MYF(0)); return 1; @@ -4801,7 +4805,8 @@ join_read_last_key(JOIN_TAB *tab) { if (error != HA_ERR_KEY_NOT_FOUND) { - sql_print_error("read_const: Got error %d when reading table %s",error, + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error("read_const: Got error %d when reading table %s",error, table->path); table->file->print_error(error,MYF(0)); return 1; @@ -4833,7 +4838,8 @@ join_read_next_same(READ_RECORD *info) { if (error != HA_ERR_END_OF_FILE) { - sql_print_error("read_next: Got error %d when reading table %s",error, + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error("read_next: Got error %d when reading table %s",error, table->path); table->file->print_error(error,MYF(0)); return 1; @@ -4855,7 +4861,8 @@ join_read_prev_same(READ_RECORD *info) { if (error != HA_ERR_END_OF_FILE) { - sql_print_error("read_next: Got error %d when reading table %s",error, + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error("read_next: Got error %d when reading table %s",error, table->path); table->file->print_error(error,MYF(0)); error= 1; @@ -4926,7 +4933,8 @@ join_read_first(JOIN_TAB *tab) { if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE) { - sql_print_error("read_first_with_key: Got error %d when reading table", + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error("read_first_with_key: Got error %d when reading table", error); table->file->print_error(error,MYF(0)); return 1; @@ -4945,7 +4953,9 @@ join_read_next(READ_RECORD *info) { if (error != HA_ERR_END_OF_FILE) { - sql_print_error("read_next_with_key: Got error %d when reading table %s", + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error( + "read_next_with_key: Got error %d when reading table %s", error, info->table->path); info->file->print_error(error,MYF(0)); return 1; @@ -4977,7 +4987,8 @@ join_read_last(JOIN_TAB *tab) { if (error != HA_ERR_END_OF_FILE) { - sql_print_error("read_last_with_key: Got error %d when reading table", + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error("read_last_with_key: Got error %d when reading table", error, table->path); table->file->print_error(error,MYF(0)); return 1; @@ -4996,7 +5007,9 @@ join_read_prev(READ_RECORD *info) { if (error != HA_ERR_END_OF_FILE) { - sql_print_error("read_prev_with_key: Got error %d when reading table: %s", + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error( + "read_prev_with_key: Got error %d when reading table: %s", error,info->table->path); info->file->print_error(error,MYF(0)); return 1; @@ -5024,7 +5037,8 @@ join_ft_read_first(JOIN_TAB *tab) { if (error != HA_ERR_END_OF_FILE) { - sql_print_error("ft_read_first: Got error %d when reading table %s", + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error("ft_read_first: Got error %d when reading table %s", error, table->path); table->file->print_error(error,MYF(0)); return 1; @@ -5042,7 +5056,8 @@ join_ft_read_next(READ_RECORD *info) { if (error != HA_ERR_END_OF_FILE) { - sql_print_error("ft_read_next: Got error %d when reading table %s", + if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) + sql_print_error("ft_read_next: Got error %d when reading table %s", error, info->table->path); info->file->print_error(error,MYF(0)); return 1; From f0a3a93741724884b80f0eede0dac4074a24a25c Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 23 Dec 2002 13:33:55 +0100 Subject: [PATCH 072/220] - fix CC_VERSION and CXX_VERSION for compilers that return multiple lines of output for "--version" (e.g. gcc 3.x) --- configure.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index f35b9fa7da9..6dd838bb5f2 100644 --- a/configure.in +++ b/configure.in @@ -130,7 +130,7 @@ AC_PROG_CXX AC_PROG_CPP # Print version of CC and CXX compiler (if they support --version) -CC_VERSION=`$CC --version` +CC_VERSION=`$CC --version | sed 1q` if test $? -eq "0" then AC_MSG_CHECKING("C Compiler version"); @@ -138,7 +138,7 @@ then else CC_VERSION="" fi -CXX_VERSION=`$CXX --version` +CXX_VERSION=`$CXX --version | sed 1q` if test $? -eq "0" then AC_MSG_CHECKING("C++ compiler version"); From 23326969a46a8851fd7b746b6769fb5f7569602f Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 23 Dec 2002 18:25:25 +0200 Subject: [PATCH 073/220] LIMIT is prohibited in IN/ALL/ANY/SOME --- mysql-test/r/subselect.result | 8 +++++++- mysql-test/t/subselect.test | 10 +++++++++- sql/item_subselect.cc | 14 ++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 493768ece4a..f12e0396694 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -32,7 +32,7 @@ a 1 SELECT 1 FROM (SELECT (SELECT a) b) c; Unknown column 'a' in 'field list' -SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id LIMIT 1); +SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id); id 1 SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1); @@ -705,3 +705,9 @@ select 10.5 > ANY (SELECT * from t); 10.5 > ANY (SELECT * from t) 1 drop table t; +create table t (a float); +select 10.5 IN (SELECT * from t LIMIT 1); +This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' +select 10.5 IN (SELECT * from t LIMIT 1 UNION SELECT 1.5); +This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' +drop table t; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 0527d6a2001..347d6276280 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -15,7 +15,7 @@ SELECT (SELECT 1), a; SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1; -- error 1054 SELECT 1 FROM (SELECT (SELECT a) b) c; -SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id LIMIT 1); +SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id); -- error 1239 SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1); SELECT 1 IN (SELECT 1); @@ -409,3 +409,11 @@ select 10.5 > ALL (SELECT * from t); select 1.5 > ANY (SELECT * from t); select 10.5 > ANY (SELECT * from t); drop table t; + +#LIMIT is not supported now +create table t (a float); +-- error 1235 +select 10.5 IN (SELECT * from t LIMIT 1); +-- error 1235 +select 10.5 IN (SELECT * from t LIMIT 1 UNION SELECT 1.5); +drop table t; \ No newline at end of file diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index a8bbc433b7a..4b9e9c256d1 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -318,6 +318,13 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex, compare_func_creator func) { DBUG_ENTER("Item_in_subselect::single_value_transformer"); + if (select_lex->master_unit()->global_parameters->select_limit != + HA_POS_ERROR) + { + my_error(ER_NOT_SUPPORTED_YET, MYF(0), + "LIMIT & IN/ALL/ANY/SOME subquery"); + DBUG_VOID_RETURN; + } Item_in_optimizer *optimizer; substitution= optimizer= new Item_in_optimizer(left_expr, this); if (!optimizer) @@ -334,6 +341,13 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex, select_lex->master_unit()->dependent= 1; for (SELECT_LEX * sl= select_lex; sl; sl= sl->next_select()) { + if (select_lex->select_limit != HA_POS_ERROR) + { + my_error(ER_NOT_SUPPORTED_YET, MYF(0), + "LIMIT & IN/ALL/ANY/SOME subquery"); + DBUG_VOID_RETURN; + } + select_lex->dependent= 1; Item *item; if (sl->item_list.elements > 1) From 178d712fa986fa0528f4f65385fd37a78ccb3366 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Dec 2002 00:53:07 +0200 Subject: [PATCH 074/220] mysql multiline comment, by Sergey Gluhov. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + client/mysql.cc | 43 +++++++++++++++++++++++++++++----------- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index c8834a9997e..79637c24d10 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -24,6 +24,7 @@ heikki@work.mysql.com hf@deer.mysql.r18.ru hf@genie.(none) jani@dsl-jkl1657.dial.inet.fi +jani@dsl-kpogw4gb5.dial.inet.fi jani@hynda.(none) jani@hynda.mysql.fi jani@janikt.pp.saunalahti.fi diff --git a/client/mysql.cc b/client/mysql.cc index c6070699f05..7fdd1035614 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -40,7 +40,7 @@ #include #include -const char *VER= "13.1"; +const char *VER= "13.2"; /* Don't try to make a nice table if the data is too big */ #define MAX_COLUMN_LENGTH 1024 @@ -280,7 +280,8 @@ static void initialize_readline (char *name); #endif static COMMANDS *find_command (char *name,char cmd_name); -static bool add_line(String &buffer,char *line,char *in_string); +static bool add_line(String &buffer,char *line,char *in_string, + bool *ml_comment); static void remove_cntrl(String &buffer); static void print_table_data(MYSQL_RES *result); static void print_table_data_html(MYSQL_RES *result); @@ -805,9 +806,10 @@ static int read_lines(bool execute_commands) char *line; char in_string=0; ulong line_number=0; + bool ml_comment= 0; COMMANDS *com; status.exit_status=1; - + for (;;) { if (status.batch || !execute_commands) @@ -873,7 +875,7 @@ static int read_lines(bool execute_commands) #endif continue; } - if (add_line(glob_buffer,line,&in_string)) + if (add_line(glob_buffer,line,&in_string,&ml_comment)) break; } /* if in batch mode, send last query even if it doesn't end with \g or go */ @@ -934,7 +936,8 @@ static COMMANDS *find_command (char *name,char cmd_char) } -static bool add_line(String &buffer,char *line,char *in_string) +static bool add_line(String &buffer,char *line,char *in_string, + bool *ml_comment) { uchar inchar; char buff[80],*pos,*out; @@ -965,7 +968,7 @@ static bool add_line(String &buffer,char *line,char *in_string) continue; } #endif - if (inchar == '\\') + if (!*ml_comment && inchar == '\\') { // mSQL or postgreSQL style command ? if (!(inchar = (uchar) *++pos)) break; // readline adds one '\' @@ -999,7 +1002,7 @@ static bool add_line(String &buffer,char *line,char *in_string) continue; } } - else if (inchar == ';' && !*in_string) + else if (!*ml_comment && inchar == ';' && !*in_string) { // ';' is end of command if (out != line) buffer.append(line,(uint) (out-line)); // Add this line @@ -1019,17 +1022,33 @@ static bool add_line(String &buffer,char *line,char *in_string) buffer.length(0); out=line; } - else if (!*in_string && (inchar == '#' || - inchar == '-' && pos[1] == '-' && - my_isspace(system_charset_info,pos[2]))) + else if (!*ml_comment && (!*in_string && (inchar == '#' || + inchar == '-' && pos[1] == '-' && + my_isspace(system_charset_info,pos[2])))) break; // comment to end of line + else if (!*in_string && inchar == '/' && *(pos+1) == '*') + { + pos++; + *ml_comment= 1; + if (out != line) + { + buffer.append(line,(uint) (out-line)); + out=line; + } + } + else if (*ml_comment && !*in_string && inchar == '*' && *(pos+1) == '/') + { + pos++; + *ml_comment= 0; + } else { // Add found char to buffer if (inchar == *in_string) *in_string=0; else if (!*in_string && (inchar == '\'' || inchar == '"')) *in_string=(char) inchar; - *out++ = (char) inchar; + if (!(*ml_comment)) + *out++ = (char) inchar; } } if (out != line || !buffer.is_empty()) @@ -1038,7 +1057,7 @@ static bool add_line(String &buffer,char *line,char *in_string) uint length=(uint) (out-line); if (buffer.length() + length >= buffer.alloced_length()) buffer.realloc(buffer.length()+length+IO_SIZE); - if (buffer.append(line,length)) + if (!(*ml_comment) && buffer.append(line,length)) return 1; } return 0; From b861d68321b6242bc2579a4458aa137efd2e42c2 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Dec 2002 14:06:52 +0400 Subject: [PATCH 075/220] thd_charset copy in lex --- sql/sql_lex.cc | 1 + sql/sql_lex.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 99e465f79c0..ddbb562bdca 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -165,6 +165,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length) lex->select_lex.ftfunc_list= &lex->select_lex.ftfunc_list_alloc; lex->current_select= &lex->select_lex; lex->convert_set= (lex->thd= thd)->variables.convert_set; + lex->thd_charset= lex->thd->variables.thd_charset; lex->yacc_yyss=lex->yacc_yyvs=0; lex->ignore_space=test(thd->sql_mode & MODE_IGNORE_SPACE); lex->slave_thd_opt=0; diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 927b806a082..6e5fd6765fb 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -432,7 +432,7 @@ typedef struct st_lex create_field *last_field; Item *default_value, *comment; CONVERT *convert_set; - CONVERT *thd_convert_set; // Set with SET CHAR SET + CHARSET_INFO *thd_charset; LEX_USER *grant_user; gptr yacc_yyss,yacc_yyvs; THD *thd; From 7a74837e00be97bfaaf2940f06c636da7eed73a8 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Dec 2002 13:58:07 +0200 Subject: [PATCH 076/220] Many fixes. I still have to make a test case for : UPDATE from sub-select with derived table mysql-test/r/multi_update.result: Test for found rows in multi-table update mysql-test/r/subselect.result: Fix for new syntax for UNION's mysql-test/t/multi_update.test: Test for found rows in multi-table update mysql-test/t/subselect.test: Fix for new syntax for UNION's sql/sql_cache.cc: Fix for a bug that involved derived table in sub-select in UPDATE or DELETE statement sql/sql_derived.cc: Fix for a bug that involved derived table in sub-select in UPDATE or DELETE statement sql/sql_parse.cc: Fix for a bug that involved derived table in sub-select in UPDATE or DELETE statement sql/sql_show.cc: Fix for th eshow of replication status sql/sql_yacc.yy: Three fixes. One for not allowing mixing of braces and non-braces in UNION's Second one for table aliases in multi-table deletes / updates Third one for using derived tables within sub-selects for UPDATE / DELETE commands --- mysql-test/r/multi_update.result | 15 +++++++++++++++ mysql-test/r/subselect.result | 6 +++--- mysql-test/t/multi_update.test | 6 ++++++ mysql-test/t/subselect.test | 6 +++--- sql/sql_cache.cc | 2 ++ sql/sql_derived.cc | 9 ++------- sql/sql_parse.cc | 1 + sql/sql_show.cc | 2 +- sql/sql_yacc.yy | 26 ++++++++++++++++++++------ 9 files changed, 53 insertions(+), 20 deletions(-) diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index 8cf035343b1..f19323e1ffe 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -235,4 +235,19 @@ select * from t2; n d 1 30 1 30 +UPDATE t1 a ,t2 b SET t1.d=t2.d,t2.d=30 WHERE a.n=b.n; +select * from t1; +n d +1 30 +3 2 +select * from t2; +n d +1 30 +1 30 +DELETE t1, t2 FROM t1 a,t2 b where a.n=b.n; +select * from t1; +n d +3 2 +select * from t2; +n d drop table t1,t2; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 493768ece4a..c928538ed9c 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -86,20 +86,20 @@ select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1); a b 1 7 2 7 -select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) +(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 order by a limit 2) limit 3; a b 1 7 2 7 3 8 -select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) +(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); a b 1 7 2 7 3 8 4 8 -explain select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) +explain (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index ff456b710c1..4e0622d14bb 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -213,4 +213,10 @@ insert into t2 values(1,10),(1,20); UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n; select * from t1; select * from t2; +UPDATE t1 a ,t2 b SET t1.d=t2.d,t2.d=30 WHERE a.n=b.n; +select * from t1; +select * from t2; +DELETE t1, t2 FROM t1 a,t2 b where a.n=b.n; +select * from t1; +select * from t2; drop table t1,t2; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 0527d6a2001..ccf66ae23a9 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -44,11 +44,11 @@ select (select a from t3), a from t2; select * from t2 where t2.a=(select a from t1); insert into t3 values (6),(7),(3); select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1); -select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) +(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 order by a limit 2) limit 3; -select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) +(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); -explain select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) +explain (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); select (select a from t3 where anext) { DBUG_ASSERT(!using_transactions || tables_used->table!=0); + if (tables_used->derived) + continue; if (using_transactions && tables_used->table->file->has_transactions()) /* diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index f7d845e9e36..54179a5e25c 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -168,14 +168,9 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) tables->table_list->table=tables->table; // to fix a problem in EXPLAIN } else - { - if (is_union) - unit->exclude(); - else - sl->exclude(); - } + unit->exclude(); t->db=(char *)""; - t->derived=(SELECT_LEX *)0; // just in case ... + t->derived=(SELECT_LEX *)1; // just in case ... table->file->info(HA_STATUS_VARIABLE); } } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index f3636f0b1bb..553b9a1fe43 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3001,6 +3001,7 @@ mysql_init_query(THD *thd) lex->select_lex.link_prev= (st_select_lex_node**)&(lex->all_selects_list); lex->olap=lex->describe=0; lex->derived_tables= false; + lex->lock_option=TL_UNLOCK; thd->check_loops_counter= thd->select_number= lex->select_lex.select_number= 1; thd->free_list= 0; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index ebade0111b0..8ea357e65f2 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1469,7 +1469,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables, end= int10_to_str((long) thd->query_id, buff, 10); break; case SHOW_RPL_STATUS: - end= int10_to_str((long) rpl_status_type[(int)rpl_status], buff, 10); + end= strmov(buff, rpl_status_type[(int)rpl_status]); break; case SHOW_SLAVE_RUNNING: { diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 55f165c0739..f90376601df 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1668,12 +1668,17 @@ select_init: '(' SELECT_SYM select_part2 ')' { LEX *lex= Lex; - SELECT_LEX_NODE * sel= lex->current_select; + SELECT_LEX * sel= lex->current_select->select_lex(); if (sel->set_braces(1)) { send_error(lex->thd, ER_SYNTAX_ERROR); YYABORT; } + if (sel->linkage == UNION_TYPE && !sel->master_unit()->first_select()->braces) + { + send_error(lex->thd, ER_SYNTAX_ERROR); + YYABORT; + } /* select in braces, can't contain global parameters */ sel->master_unit()->global_parameters= sel->master_unit(); @@ -1683,11 +1688,17 @@ select_init2: select_part2 { LEX *lex= Lex; + SELECT_LEX * sel= lex->current_select->select_lex(); if (lex->current_select->set_braces(0)) { send_error(lex->thd, ER_SYNTAX_ERROR); YYABORT; } + if (sel->linkage == UNION_TYPE && sel->master_unit()->first_select()->braces) + { + send_error(lex->thd, ER_SYNTAX_ERROR); + YYABORT; + } } union_clause ; @@ -1695,6 +1706,7 @@ select_init2: select_part2: { LEX *lex=Lex; + SELECT_LEX * sel= lex->current_select->select_lex(); if (lex->current_select == &lex->select_lex) lex->lock_option= TL_READ; /* Only for global SELECT */ mysql_init_select(lex); @@ -2509,7 +2521,9 @@ join_table: lex->current_select= unit->outer_select(); if (!($$= lex->current_select-> add_table_to_list(lex->thd, new Table_ident(unit), $5, 0, - lex->lock_option))) + lex->lock_option,(List *)0, + (List *)0))) + YYABORT; }; @@ -3187,16 +3201,16 @@ table_wild_list: | table_wild_list ',' table_wild_one {}; table_wild_one: - ident opt_wild + ident opt_wild opt_table_alias { - if (!Select->add_table_to_list(YYTHD, new Table_ident($1), NULL, 1, + if (!Select->add_table_to_list(YYTHD, new Table_ident($1), $3, 1, Lex->lock_option)) YYABORT; } - | ident '.' ident opt_wild + | ident '.' ident opt_wild opt_table_alias { if (!Select->add_table_to_list(YYTHD, new Table_ident($1, $3, 0), - NULL, 1, Lex->lock_option)) + $5, 1, Lex->lock_option)) YYABORT; } ; From 8753e655d93f7616220132f13b8ea426e4f4cea7 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Dec 2002 14:33:11 +0200 Subject: [PATCH 077/220] fix for an error in the merge from 3.23 --- mysql-test/r/case.result | 5 +++++ mysql-test/t/case.test | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result index 183e2692d7a..e5fc7218c50 100644 --- a/mysql-test/r/case.result +++ b/mysql-test/r/case.result @@ -63,7 +63,12 @@ nothing 2 one 1 two 1 drop table t1; +drop table if exists t1; +create table t1 (row int not null, col int not null, val varchar(255) not null); +insert into t1 values (1,1,'orange'),(1,2,'large'),(2,1,'yellow'),(2,2,'medium'),(3,1,'green'),(3,2,'small'); +select max(case col when 1 then val else null end) as color from t1 group by row; color orange yellow green +drop table if exists t1; diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test index f2b8d42e07c..b5a1a60f15b 100644 --- a/mysql-test/t/case.test +++ b/mysql-test/t/case.test @@ -30,8 +30,8 @@ insert into t1 values(1),(2),(3),(4); select case a when 1 then 2 when 2 then 3 else 0 end as fcase, count(*) from t1 group by fcase; select case a when 1 then "one" when 2 then "two" else "nothing" end as fcase, count(*) from t1 group by fcase; drop table t1; -drop table if exists t; +drop table if exists t1; create table t1 (row int not null, col int not null, val varchar(255) not null); insert into t1 values (1,1,'orange'),(1,2,'large'),(2,1,'yellow'),(2,2,'medium'),(3,1,'green'),(3,2,'small'); select max(case col when 1 then val else null end) as color from t1 group by row; -drop table if exists t; +drop table if exists t1; From a7f0745dfac90b6f832e40a71c55c2312151aec0 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Dec 2002 16:25:03 +0100 Subject: [PATCH 078/220] - bumped up version number to 4.0.8-gamma - tagged ChangeSet 1.1484 as mysql-4.0.7 configure.in: - bumped up version number to 4.0.8-gamma --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 6dd838bb5f2..195cf6be4e1 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! -AM_INIT_AUTOMAKE(mysql, 4.0.7-gamma) +AM_INIT_AUTOMAKE(mysql, 4.0.8-gamma) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 From 709311d571fcb32f3beb3230456c07196937b4ff Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Dec 2002 21:44:54 +0300 Subject: [PATCH 079/220] Correct wrong error messages sql/share/english/errmsg.txt: Correct Error messages to match actual behavior --- sql/share/english/errmsg.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 68e4f07f246..eabbb6c1eeb 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -199,8 +199,8 @@ "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", From 4abcd967bad4f54181ab6710e1a4236aaeb9c370 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Dec 2002 22:40:19 +0300 Subject: [PATCH 080/220] Fix messages in other languages sql/share/czech/errmsg.txt: Chezh sql/share/danish/errmsg.txt: Danish sql/share/dutch/errmsg.txt: Dutch sql/share/estonian/errmsg.txt: Estonian sql/share/french/errmsg.txt: French sql/share/german/errmsg.txt: German sql/share/greek/errmsg.txt: Greek sql/share/hungarian/errmsg.txt: Hungarian sql/share/italian/errmsg.txt: Italian sql/share/japanese/errmsg.txt: Japanese sql/share/korean/errmsg.txt: Korean sql/share/norwegian-ny/errmsg.txt: Norwegian-ny sql/share/norwegian/errmsg.txt: Norwegian sql/share/polish/errmsg.txt: polish sql/share/portuguese/errmsg.txt: Portuguese sql/share/romanian/errmsg.txt: Romainian sql/share/russian/errmsg.txt: Russian sql/share/serbian/errmsg.txt: Serbian sql/share/slovak/errmsg.txt: Slovak sql/share/spanish/errmsg.txt: spanish sql/share/swedish/errmsg.txt: Swedish sql/share/ukrainian/errmsg.txt: Ukrainian --- sql/share/czech/errmsg.txt | 4 ++-- sql/share/danish/errmsg.txt | 4 ++-- sql/share/dutch/errmsg.txt | 4 ++-- sql/share/estonian/errmsg.txt | 4 ++-- sql/share/french/errmsg.txt | 4 ++-- sql/share/german/errmsg.txt | 4 ++-- sql/share/greek/errmsg.txt | 4 ++-- sql/share/hungarian/errmsg.txt | 4 ++-- sql/share/italian/errmsg.txt | 4 ++-- sql/share/japanese/errmsg.txt | 4 ++-- sql/share/korean/errmsg.txt | 4 ++-- sql/share/norwegian-ny/errmsg.txt | 4 ++-- sql/share/norwegian/errmsg.txt | 4 ++-- sql/share/polish/errmsg.txt | 4 ++-- sql/share/portuguese/errmsg.txt | 4 ++-- sql/share/romanian/errmsg.txt | 4 ++-- sql/share/russian/errmsg.txt | 4 ++-- sql/share/serbian/errmsg.txt | 4 ++-- sql/share/slovak/errmsg.txt | 4 ++-- sql/share/spanish/errmsg.txt | 4 ++-- sql/share/swedish/errmsg.txt | 4 ++-- sql/share/ukrainian/errmsg.txt | 4 ++-- 22 files changed, 44 insertions(+), 44 deletions(-) diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index 6c1a6db674b..c1ee8b12e7f 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -208,8 +208,8 @@ v/* "Tabulka '%-.64s' je ozna-Bèena jako poru¹ená a poslední (automatická?) oprava se nezdaøila", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index 2067f13d593..17c1dd76474 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -202,8 +202,8 @@ "Tabellen '%-.64s' er markeret med fejl og sidste (automatiske?) REPAIR fejlede", "Advarsel: Visse data i tabeller der ikke understøtter transaktioner kunne ikke tilbagestilles", "Fler-udtryks transaktion krævede mere plads en 'max_binlog_cache_size' bytes. Forhøj værdien af denne variabel og prøv igen', -"Denne handling kunne ikke udføres med kørende slave, brug først kommandoen SLAVE STOP", -"Denne handling kræver en kørende slave. Konfigurer en slave og brug kommandoen SLAVE START", +"Denne handling kunne ikke udføres med kørende slave, brug først kommandoen STOP SLAVE", +"Denne handling kræver en kørende slave. Konfigurer en slave og brug kommandoen START SLAVE", "Denne server er ikke konfigureret som slave. Ret in config-filen eller brug kommandoen CHANGE MASTER TO", "Kunne ikke initialisere master info-struktur. Check om rettigheder i master.info", "Kunne ikke danne en slave-tråd. Check systemressourcerne", diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index 0c8d652653f..a2ef2b0923d 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -210,8 +210,8 @@ "Tabel '%-.64s' staat als gecrashed gemarkeerd en de laatste (automatische?) reparatie poging mislukte", "Waarschuwing: Roll back mislukt voor sommige buiten transacties gewijzigde tabellen", "Multi-statement transactie vereist meer dan 'max_binlog_cache_size' bytes opslag. Verhoog deze mysqld variabele en probeer opnieuw', -"Deze operatie kan niet worden uitgevoerd met een actieve slave, doe eerst SLAVE STOP", -"Deze operatie vereist een actieve slave, configureer slave en doe dan SLAVE START", +"Deze operatie kan niet worden uitgevoerd met een actieve slave, doe eerst STOP SLAVE", +"Deze operatie vereist een actieve slave, configureer slave en doe dan START SLAVE", "De server is niet geconfigureerd als slave, fix in configuratie bestand of met CHANGE MASTER TO", "Kon master info structuur niet initialiseren, controleer permissies in master.info", "Kon slave thread niet aanmaken, controleer systeem resources", diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 13663cca8e2..367bda922f3 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -204,8 +204,8 @@ "Tabel '%-.64s' on märgitud vigaseks ja viimane (automaatne?) parandus ebaõnnestus", "Hoiatus: mõnesid transaktsioone mittetoetavaid tabeleid ei suudetud tagasi kerida", "Mitme lausendiga transaktsioon nõudis rohkem ruumi kui lubatud 'max_binlog_cache_size' muutujaga. Suurenda muutuja väärtust ja proovi uuesti", -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index ac1764aa7eb..93009f564e6 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -199,8 +199,8 @@ "La table '%-.64s' est marquée 'crashed' et le dernier 'repair' a échoué", "Attention: certaines tables ne supportant pas les transactions ont été changées et elles ne pourront pas être restituées", "Cette transaction à commandes multiples nécessite plus de 'max_binlog_cache_size' octets de stockage, augmentez cette variable de mysqld et réessayez', -"Cette opération ne peut être réalisée avec un esclave actif, faites SLAVE STOP d'abord", -"Cette opération nécessite un esclave actif, configurez les esclaves et faites SLAVE START", +"Cette opération ne peut être réalisée avec un esclave actif, faites STOP SLAVE d'abord", +"Cette opération nécessite un esclave actif, configurez les esclaves et faites START SLAVE", "Le server n'est pas configuré comme un esclave, changez le fichier de configuration ou utilisez CHANGE MASTER TO", "Impossible d'initialiser les structures d'information de maître, vérifiez les permissions sur master.info", "Impossible de créer une tâche esclave, vérifiez les ressources système", diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index c996066d0eb..24ee7a99409 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -208,8 +208,8 @@ "Tabelle '%-.64s' ist als defekt makiert und der letzte (automatische) Reparaturversuch schlug fehl.", "Warnung: Das Rollback konnte bei einigen Tabellen, die nicht mittels Transaktionen geändert wurden, nicht ausgeführt werden.", "Multi-Statement Transaktionen benötigen mehr als 'max_binlog_cache_size' Bytes An Speicher. Diese mysqld-Variable vergrössern und erneut versuchen.', -"Diese Operation kann nicht bei einem aktiven Slave durchgeführt werden. Das Kommand SLAVE STOP muss zuerst ausgeführt werden.", -"Diese Operation benötigt einen aktiven Slave. Slave konfigurieren und mittels SLAVE START aktivieren.", +"Diese Operation kann nicht bei einem aktiven Slave durchgeführt werden. Das Kommand STOP SLAVE muss zuerst ausgeführt werden.", +"Diese Operation benötigt einen aktiven Slave. Slave konfigurieren und mittels START SLAVE aktivieren.", "Der Server ist nicht als Slave konfigiriert. Im Konfigurations-File oder mittel CHANGE MASTER TO beheben.", "Konnte Master-Info-Struktur nicht initialisieren; Berechtigungen von master.info prüfen.", "Konnte keinen Slave-Thread starten. System-Resourcen überprüfen.", diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index 7e680216b3e..ffed9111859 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -199,8 +199,8 @@ "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index 747d2be5a3b..a597e3870b5 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -201,8 +201,8 @@ "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index ef7efa925af..84b4d02dc9e 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -199,8 +199,8 @@ "La tabella '%-.64s' e` segnalata come corrotta e l'ultima ricostruzione (automatica?) e` fallita", "Attenzione: Alcune delle modifiche alle tabelle non transazionali non possono essere ripristinate (roll back impossibile)", "La transazione a comandi multipli (multi-statement) ha richiesto piu` di 'max_binlog_cache_size' bytes di disco: aumentare questa variabile di mysqld e riprovare', -"Questa operazione non puo' essere eseguita con un database 'slave' che gira, lanciare prima SLAVE STOP", -"Questa operaione richiede un database 'slave', configurarlo ed eseguire SLAVE START", +"Questa operazione non puo' essere eseguita con un database 'slave' che gira, lanciare prima STOP SLAVE", +"Questa operaione richiede un database 'slave', configurarlo ed eseguire START SLAVE", "Il server non e' configurato come 'slave', correggere il file di configurazione cambiando CHANGE MASTER TO", "Impossibile inizializzare la struttura 'master info', controllare i permessi sul file master.info", "Impossibile creare il thread 'slave', controllare le risorse di sistema", diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index 61b69000473..f339faf5fc4 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -201,8 +201,8 @@ "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 9c367c43551..855f157d3b5 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -199,8 +199,8 @@ "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index a3fed98e81a..d930ec5ab74 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -201,8 +201,8 @@ "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index 26eabe3b91f..15bc59c39dc 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -201,8 +201,8 @@ "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 616a5d4919b..95315516cda 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -203,8 +203,8 @@ "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 04a9afaa808..47dc0ed569d 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -199,8 +199,8 @@ "Tabela '%-.64s' está marcada como danificada e a última reparação (automática?) falhou", "Aviso: Algumas tabelas não-transacionais alteradas não puderam ser reconstituídas (rolled back)", "Transações multi-declaradas (multi-statement transactions) requeriram mais do que o valor limite (max_binlog_cache_size) de bytes para armazenagem. Aumente o valor desta variável do mysqld e tente novamente", -"Esta operação não pode ser realizada com um 'slave' em execução. Execute SLAVE STOP primeiro", -"Esta operação requer um 'slave' em execução. Configure o 'slave' e execute SLAVE START", +"Esta operação não pode ser realizada com um 'slave' em execução. Execute STOP SLAVE primeiro", +"Esta operação requer um 'slave' em execução. Configure o 'slave' e execute START SLAVE", "O servidor não está configurado como 'slave'. Acerte o arquivo de configuração ou use CHANGE MASTER TO", "Não pode inicializar a estrutura de informação do 'master'. Verifique as permissões em 'master.info'", "Não conseguiu criar 'thread' de 'slave'. Verifique os recursos do sistema", diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 0ae6fc8e51a..722efe4f83f 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -203,8 +203,8 @@ "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index 343178b3118..ddbb5bdbe5d 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -202,8 +202,8 @@ "ôÁÂÌÉÃÁ '%-.64s' ÐÏÍÅÞÅÎÁ ËÁË ÉÓÐÏÒÞÅÎÎÁÑ É ÐÏÓÌÅÄÎÑÑ ÐÏÐÙÔËÁ ÉÓÐÒÁ×ÌÅÎÉÑ (Á×ÔÏÍÁÔÉÞÅÓËÁÑ?) ÎÅ ÕÄÁÌÁÓØ", "ðÒÅÄÕÐÒÅÖÄÅÎÉÅ: ÎÅËÏÔÏÒÙÅ ÎÅÔÒÁÎÚÁËÃÉÏÎÎÙÅ ÔÁÂÌÉÃÙ ÎÅ ÐÏÄÞÉÎÑÀÔÓÑ ROLLBACK", "íÎÏÇÏÚÁÐÒÏÓÎÁÑ ÔÒÁÎÚÁËÃÉÑ ÔÒÅÂÕÅÔ Õ×ÅÌÉÞÅÎÉÑ 'max_binlog_cache_size' - Õ×ÅÌÉÞÔÅ ÜÔÕ ÐÅÒÅÍÅÎÎÕÀ É ÐÏÐÒÏÂÕÊÔÅ ÅÝÅ ÒÁÚ", -"üÔÁ ÏÐÅÒÁÃÉÑ ÎÅ×ÏÚÍÏÖÎÁ Ó ÁËÔÉ×ÎÙÍ slave, ÎÁÄÏ SLAVE STOP", -"üÔÁ ÏÐÅÒÁÃÉÑ ÎÅ×ÏÚÍÏÖÎÁ Ó ÐÁÓÓÉ×ÎÙÍ slave, ÎÁÄÏ SLAVE START", +"üÔÁ ÏÐÅÒÁÃÉÑ ÎÅ×ÏÚÍÏÖÎÁ Ó ÁËÔÉ×ÎÙÍ slave, ÎÁÄÏ STOP SLAVE", +"üÔÁ ÏÐÅÒÁÃÉÑ ÎÅ×ÏÚÍÏÖÎÁ Ó ÐÁÓÓÉ×ÎÙÍ slave, ÎÁÄÏ START SLAVE", "üÔÏÔ ÓÅÒ×ÅÒ ÎÅ slave, ÉÓÐÒÁרÔÅ × ËÏÎÆÉÇÕÒÁÃÉÏÎÎÏÍ ÆÁÊÌÅ ÉÌÉ ËÏÍÍÁÎÄÏÊ CHANGE MASTER TO", "îÅ ÐÏÌÕÞÉÌÏÓØ ÉÎÉÃÉÁÌÉÚÉÒÏ×ÁÔØ ÓÔÒÕËÔÕÒÕ master info, ÐÒÏ×ÅÒÔÅ persmissions ÎÁ ÆÁÊÌÅ master.info", "îÅ ÍÏÇÕ ÓÏÚÄÁÔØ ÐÒÏÃÅÓÓ SLAVE, ÐÒÏ×ÅÒØÔÅ ÓÉÓÔÅÍÎÙÅ ÒÅÓÕÒÓÙ", diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index b04b94b82e8..c9ab4d8f656 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -205,8 +205,8 @@ "Tabela '%-.64s' je markirana kao ošteæena, a zadnja (automatska?) popravka je bila neuspela", "Upozorenje: Neke izmenjene tabele ne podržavaju komandu 'ROLLBACK'", "Transakcija sa više stavki zahtevala je više od 'max_binlog_cache_size' bajtova skladišnog prostora. Uveæajte ovu promenljivu servera i pokušajte ponovo', -"Ova operacija ne može biti izvršena dok je aktivan podreðeni server. Zadajte prvo komandu 'SLAVE STOP' da zaustavite podreðeni server.", -"Ova operacija zahteva da je aktivan podreðeni server. Konfigurišite prvo podreðeni server i onda izvršite komandu 'SLAVE START'", +"Ova operacija ne može biti izvršena dok je aktivan podreðeni server. Zadajte prvo komandu 'STOP SLAVE' da zaustavite podreðeni server.", +"Ova operacija zahteva da je aktivan podreðeni server. Konfigurišite prvo podreðeni server i onda izvršite komandu 'START SLAVE'", "Server nije konfigurisan kao podreðeni server, ispravite konfiguracioni file ili na njemu izvršite komandu 'CHANGE MASTER TO'", "Nisam mogao da inicijalizujem informacionu strukturu glavnog servera, proverite da li imam privilegije potrebne za pristup file-u 'master.info'", "Nisam mogao da startujem thread za podreðeni server, proverite sistemske resurse", diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index f8f52f86b6a..0d6a847a341 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -207,8 +207,8 @@ "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", "Some non-transactional changed tables couldn't be rolled back", "Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', -"This operation cannot be performed with a running slave, run SLAVE STOP first", -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation cannot be performed with a running slave, run STOP SLAVE first", +"This operation requires a running slave, configure slave and do START SLAVE", "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", "Could not initialize master info structure, check permisions on master.info", "Could not create slave thread, check system resources", diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index 674d36e9d8c..cc56e1f6aef 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -200,8 +200,8 @@ "Tabla '%-.64s' está marcada como crashed y la última reparación (automactica?) falló", "Aviso: Algunas tablas no transancionales no pueden tener rolled back", "Multipla transición necesita mas que 'max_binlog_cache_size' bytes de almacenamiento. Aumente esta variable mysqld y tente de nuevo', -"Esta operación no puede ser hecha con el esclavo funcionando, primero use SLAVE STOP", -"Esta operación necesita el esclavo funcionando, configure esclavo y haga el SLAVE START", +"Esta operación no puede ser hecha con el esclavo funcionando, primero use STOP SLAVE", +"Esta operación necesita el esclavo funcionando, configure esclavo y haga el START SLAVE", "El servidor no está configurado como esclavo, edite el archivo config file o con CHANGE MASTER TO", "No puedo inicializar la estructura info del master, verifique permisiones en el master.info", "No puedo crear el thread esclavo, verifique recursos del sistema", diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index 052568ac30d..b792864b9f4 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -199,8 +199,8 @@ "Tabell '%-.64s' är crashad och senast (automatiska?) reparation misslyckades", "Några icke transaktionella tabeller kunde inte återställas vid ROLLBACK", "Transaktionen krävde mera än 'max_binlog_cache_size' minne. Utöka denna mysqld variabel och försök på nytt", -"Denna operation kan inte göras under replikering; Gör SLAVE STOP först", -"Denna operation kan endast göras under replikering; Konfigurera slaven och gör SLAVE START", +"Denna operation kan inte göras under replikering; Gör STOP SLAVE först", +"Denna operation kan endast göras under replikering; Konfigurera slaven och gör START SLAVE", "Servern är inte konfigurerade som en replikations slav. Ändra konfigurationsfilen eller gör CHANGE MASTER TO", "Kunde inte initializera replications-strukturerna. Kontrollera privilegerna för 'master.info'", "Kunde inte starta en tråd för replikering", diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index 122506f17cf..2b6825adb8a 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -204,8 +204,8 @@ "ôÁÂÌÉÃÀ '%-.64s' ÍÁÒËÏ×ÁÎÏ ÑË Ú¦ÐÓÏ×ÁÎÕ ÔÁ ÏÓÔÁÎΤ (Á×ÔÏÍÁÔÉÞÎÅ?) צÄÎÏ×ÌÅÎÎÑ ÎÅ ×ÄÁÌÏÓÑ", "úÁÓÔÅÒÅÖÅÎÎÑ: äÅÑ˦ ÎÅÔÒÁÎÚÁËæÊΦ ÚͦÎÉ ÔÁÂÌÉÃØ ÎÅ ÍÏÖÎÁ ÂÕÄÅ ÐÏ×ÅÒÎÕÔÉ", "ôÒÁÎÚÁËÃ¦Ñ Ú ÂÁÇÁÔØÍÁ ×ÉÒÁÚÁÍÉ ×ÉÍÁÇÁ¤ Â¦ÌØÛÅ Î¦Ö 'max_binlog_cache_size' ÂÁÊÔ¦× ÄÌÑ ÚÂÅÒ¦ÇÁÎÎÑ. úÂ¦ÌØÛÔÅ ÃÀ ÚͦÎÎÕ mysqld ÔÁ ÓÐÒÏÂÕÊÔÅ ÚÎÏ×Õ', -"ïÐÅÒÁÃ¦Ñ ÎÅ ÍÏÖÅ ÂÕÔÉ ×ÉËÏÎÁÎÁ Ú ÚÁÐÕÝÅÎÉÍ Ð¦ÄÌÅÇÌÉÍ, ÓÐÏÞÁÔËÕ ×ÉËÏÎÁÊÔÅ SLAVE STOP", -"ïÐÅÒÁÃ¦Ñ ×ÉÍÁÇÁ¤ ÚÁÐÕÝÅÎÏÇÏ Ð¦ÄÌÅÇÌÏÇÏ, ÚËÏÎÆ¦ÇÕÒÕÊÔŠЦÄÌÅÇÌÏÇÏ ÔÁ ×ÉËÏÎÁÊÔÅ SLAVE START", +"ïÐÅÒÁÃ¦Ñ ÎÅ ÍÏÖÅ ÂÕÔÉ ×ÉËÏÎÁÎÁ Ú ÚÁÐÕÝÅÎÉÍ Ð¦ÄÌÅÇÌÉÍ, ÓÐÏÞÁÔËÕ ×ÉËÏÎÁÊÔÅ STOP SLAVE", +"ïÐÅÒÁÃ¦Ñ ×ÉÍÁÇÁ¤ ÚÁÐÕÝÅÎÏÇÏ Ð¦ÄÌÅÇÌÏÇÏ, ÚËÏÎÆ¦ÇÕÒÕÊÔŠЦÄÌÅÇÌÏÇÏ ÔÁ ×ÉËÏÎÁÊÔÅ START SLAVE", "óÅÒ×ÅÒ ÎÅ ÚËÏÎÆ¦ÇÕÒÏ×ÁÎÏ ÑË Ð¦ÄÌÅÇÌÉÊ, ×ÉÐÒÁ×ÔÅ ÃÅ Õ ÆÁÊ̦ ËÏÎÆ¦ÇÕÒÁæ§ ÁÂÏ Ú CHANGE MASTER TO", "îÅ ÍÏÖÕ ¦Î¦Ã¦Á̦ÚÕ×ÁÔÉ ÓÔÒÕËÔÕÒÕ ÉÎÆÏÒÍÁæ§ ÇÏÌÏ×ÎÏÇÏ, ÐÅÒÅצÒÔÅ ÐÒÁ×Á ÄÏÓÔÕÐÕ ÎÁ master.info", "îÅ ÍÏÖÕ ÓÔ×ÏÒÉÔÉ Ð¦ÄÌÅÇÌÕ Ç¦ÌËÕ, ÐÅÒÅצÒÔÅ ÓÉÓÔÅÍΦ ÒÅÓÕÒÓÉ", From d765d3f37b961e8a83e0c56365de27303d3a986b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Dec 2002 12:03:08 +0200 Subject: [PATCH 081/220] check of LIMIT in row IN subquery (SCRUM related) mysql-test/r/subselect.result: test of LIMIT in row IN subquery mysql-test/t/subselect.test: test of LIMIT in row IN subquery sql/item_subselect.cc: check of LIMIT in row IN subquery --- mysql-test/r/subselect.result | 2 ++ mysql-test/t/subselect.test | 2 ++ sql/item_subselect.cc | 14 ++++++++++++++ 3 files changed, 18 insertions(+) diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 6411bf2a3bc..ec0de79cbef 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -809,4 +809,6 @@ NULL select ROW(1, 1, 'a') IN (select b,a,c from t where c='b' or c='a'); ROW(1, 1, 'a') IN (select b,a,c from t where c='b' or c='a') 1 +select ROW(1, 1, 'a') IN (select b,a,c from t limit 2); +This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' drop table if exists t; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index cd4baacdacb..c77fc33f0ea 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -454,4 +454,6 @@ select ROW(1, 1, 'a') IN (select b,a,c from t where a is not null); select ROW(1, 1, 'a') IN (select a,b,c from t where c='b' or c='a'); select ROW(1, 2, 'a') IN (select a,b,c from t where c='b' or c='a'); select ROW(1, 1, 'a') IN (select b,a,c from t where c='b' or c='a'); +-- error 1235 +select ROW(1, 1, 'a') IN (select b,a,c from t limit 2); drop table if exists t; diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 74824fc7757..6bcb78134a2 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -517,6 +517,13 @@ void Item_in_subselect::row_value_transformer(st_select_lex *select_lex, Item *left_expr) { DBUG_ENTER("Item_in_subselect::row_value_transformer"); + if (select_lex->master_unit()->global_parameters->select_limit != + HA_POS_ERROR) + { + my_error(ER_NOT_SUPPORTED_YET, MYF(0), + "LIMIT & IN/ALL/ANY/SOME subquery"); + DBUG_VOID_RETURN; + } Item_in_optimizer *optimizer; substitution= optimizer= new Item_in_optimizer(left_expr, this); if (!optimizer) @@ -530,6 +537,13 @@ void Item_in_subselect::row_value_transformer(st_select_lex *select_lex, DBUG_VOID_RETURN; for (SELECT_LEX * sl= select_lex; sl; sl= sl->next_select()) { + if (select_lex->select_limit != HA_POS_ERROR) + { + my_error(ER_NOT_SUPPORTED_YET, MYF(0), + "LIMIT & IN/ALL/ANY/SOME subquery"); + DBUG_VOID_RETURN; + } + select_lex->dependent= 1; Item *item= 0; From 0ba620214ce9a9b2f22659a438b404badc69c60d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Dec 2002 12:51:08 +0200 Subject: [PATCH 082/220] more correct argument for translation function (SCRUM related) fiexd bug in LIMIT check sql/item_subselect.cc: more correct argument for translation function fiexd bug in LIMIT check sql/item_subselect.h: more correct argument for translation function --- sql/item_subselect.cc | 41 ++++++++++++++++++++--------------------- sql/item_subselect.h | 10 +++++----- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 6bcb78134a2..65c942a75ce 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -51,7 +51,7 @@ void Item_subselect::init(THD *thd, st_select_lex *select_lex, DBUG_ENTER("Item_subselect::init"); DBUG_PRINT("subs", ("select_lex 0x%xl", (ulong) select_lex)); - select_transformer(select_lex); + select_transformer(select_lex->master_unit()); if (select_lex->next_select()) engine= new subselect_union_engine(thd, select_lex->master_unit(), result, this); @@ -67,7 +67,7 @@ Item_subselect::~Item_subselect() delete engine; } -void Item_subselect::select_transformer(st_select_lex *select_lex) +void Item_subselect::select_transformer(st_select_lex_unit *unit) { DBUG_ENTER("Item_subselect::select_transformer"); DBUG_VOID_RETURN; @@ -394,13 +394,12 @@ Item_allany_subselect::Item_allany_subselect(Item_allany_subselect *item): func= item->func; } -void Item_in_subselect::single_value_transformer(st_select_lex *select_lex, +void Item_in_subselect::single_value_transformer(st_select_lex_unit *unit, Item *left_expr, compare_func_creator func) { DBUG_ENTER("Item_in_subselect::single_value_transformer"); - if (select_lex->master_unit()->global_parameters->select_limit != - HA_POS_ERROR) + if (unit->global_parameters->select_limit != HA_POS_ERROR) { my_error(ER_NOT_SUPPORTED_YET, MYF(0), "LIMIT & IN/ALL/ANY/SOME subquery"); @@ -420,17 +419,17 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex, Item *expr= new Item_ref((Item**)optimizer->get_cache(), (char *)"", (char*)""); - select_lex->master_unit()->dependent= 1; - for (SELECT_LEX * sl= select_lex; sl; sl= sl->next_select()) + unit->dependent= 1; + for (SELECT_LEX * sl= unit->first_select(); sl; sl= sl->next_select()) { - if (select_lex->select_limit != HA_POS_ERROR) + if (sl->select_limit != HA_POS_ERROR) { my_error(ER_NOT_SUPPORTED_YET, MYF(0), "LIMIT & IN/ALL/ANY/SOME subquery"); DBUG_VOID_RETURN; } - select_lex->dependent= 1; + sl->dependent= 1; Item *item; if (sl->item_list.elements > 1) { @@ -481,7 +480,7 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex, my_error(ER_NO_TABLES_USED, MYF(0)); DBUG_VOID_RETURN; } - if (select_lex->next_select()) + if (unit->first_select()->next_select()) { /* It is in union => we should perform it. @@ -513,11 +512,11 @@ void Item_in_subselect::single_value_transformer(st_select_lex *select_lex, DBUG_VOID_RETURN; } -void Item_in_subselect::row_value_transformer(st_select_lex *select_lex, +void Item_in_subselect::row_value_transformer(st_select_lex_unit *unit, Item *left_expr) { DBUG_ENTER("Item_in_subselect::row_value_transformer"); - if (select_lex->master_unit()->global_parameters->select_limit != + if (unit->global_parameters->select_limit != HA_POS_ERROR) { my_error(ER_NOT_SUPPORTED_YET, MYF(0), @@ -531,20 +530,20 @@ void Item_in_subselect::row_value_transformer(st_select_lex *select_lex, current_thd->fatal_error= 1; DBUG_VOID_RETURN; } - select_lex->master_unit()->dependent= 1; + unit->dependent= 1; uint n= left_expr->cols(); if (optimizer->preallocate_row() || (*optimizer->get_cache())->allocate(n)) DBUG_VOID_RETURN; - for (SELECT_LEX * sl= select_lex; sl; sl= sl->next_select()) + for (SELECT_LEX * sl= unit->first_select(); sl; sl= sl->next_select()) { - if (select_lex->select_limit != HA_POS_ERROR) + if (sl->select_limit != HA_POS_ERROR) { my_error(ER_NOT_SUPPORTED_YET, MYF(0), "LIMIT & IN/ALL/ANY/SOME subquery"); DBUG_VOID_RETURN; } - select_lex->dependent= 1; + sl->dependent= 1; Item *item= 0; List_iterator_fast li(sl->item_list); @@ -582,18 +581,18 @@ void Item_in_subselect::row_value_transformer(st_select_lex *select_lex, } -void Item_in_subselect::select_transformer(st_select_lex *select_lex) +void Item_in_subselect::select_transformer(st_select_lex_unit *unit) { if (left_expr->cols() == 1) - single_value_transformer(select_lex, left_expr, + single_value_transformer(unit, left_expr, &Item_bool_func2::eq_creator); else - row_value_transformer(select_lex, left_expr); + row_value_transformer(unit, left_expr); } -void Item_allany_subselect::select_transformer(st_select_lex *select_lex) +void Item_allany_subselect::select_transformer(st_select_lex_unit *unit) { - single_value_transformer(select_lex, left_expr, func); + single_value_transformer(unit, left_expr, func); } subselect_single_select_engine::subselect_single_select_engine(THD *thd, diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 04f0e6f3c83..6063730d6a8 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -71,7 +71,7 @@ public: { null_value= 1; } - virtual void select_transformer(st_select_lex *select_lex); + virtual void select_transformer(st_select_lex_unit *unit); bool assigned() { return value_assigned; } void assigned(bool a) { value_assigned= a; } enum Type type() const; @@ -172,10 +172,10 @@ public: null_value= 0; was_null= 0; } - virtual void select_transformer(st_select_lex *select_lex); - void single_value_transformer(st_select_lex *select_lex, + virtual void select_transformer(st_select_lex_unit *unit); + void single_value_transformer(st_select_lex_unit *unit, Item *left_expr, compare_func_creator func); - void row_value_transformer(st_select_lex *select_lex, Item *left_expr); + void row_value_transformer(st_select_lex_unit *unit, Item *left_expr); longlong val_int(); double val(); String *val_str(String*); @@ -194,7 +194,7 @@ public: Item_allany_subselect(THD *thd, Item * left_expr, compare_func_creator f, st_select_lex *select_lex); Item_allany_subselect(Item_allany_subselect *item); - virtual void select_transformer(st_select_lex *select_lex); + virtual void select_transformer(st_select_lex_unit *unit); }; class subselect_engine From da4d8e1b62edc5bc6f31d70279a619325ae69442 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Dec 2002 14:33:28 +0200 Subject: [PATCH 083/220] results fixing --- mysql-test/r/subselect.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index ec0de79cbef..502fe0fad60 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -634,7 +634,7 @@ EXPLAIN SELECT * FROM t WHERE id IN (SELECT 1 UNION SELECT 3); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t index NULL id 5 NULL 2 Using where; Using index 2 DEPENDENT SUBSELECT NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used SELECT * FROM t WHERE id IN (SELECT 5 UNION SELECT 3); id SELECT * FROM t WHERE id IN (SELECT 5 UNION SELECT 2); From a620fb9acafd0fb3996c9f1c07cc6fc0b0895bfe Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Dec 2002 16:34:32 +0400 Subject: [PATCH 084/220] BDB logs deleting has been moved from start_master to the start of mysql-test-run --- mysql-test/mysql-test-run.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index edfff5c4d46..34f3d365d7d 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -778,8 +778,6 @@ start_master() if [ x$MASTER_RUNNING = x1 ] || [ x$LOCAL_MASTER = x1 ] ; then return fi - # Remove old berkeley db log files that can confuse the server - $RM -f $MASTER_MYDDIR/log.* # Remove stale binary logs $RM -f $MYSQL_TEST_DIR/var/log/master-bin.* # Remove old master.info files @@ -1286,6 +1284,9 @@ then # Remove files that can cause problems $RM -f $MYSQL_TEST_DIR/var/run/* $MYSQL_TEST_DIR/var/tmp/* + # Remove old berkeley db log files that can confuse the server + $RM -f $MASTER_MYDDIR/log.* + wait_for_master=$SLEEP_TIME_FOR_FIRST_MASTER wait_for_slave=$SLEEP_TIME_FOR_FIRST_SLAVE $ECHO "Installing Test Databases" From 1e687d196ef059ff82542d1f0a71111c8a0b257a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Dec 2002 15:07:36 +0200 Subject: [PATCH 085/220] bug fixes and tests ... mysql-test/r/update.result: Test for update with subselect and derived table ... mysql-test/t/update.test: Test for update with subselect and derived table ... sql/sql_union.cc: Fix for usage of ORDER BY ... and / or LIMIT .... without braces --- mysql-test/r/update.result | 5 ++++- mysql-test/t/update.test | 5 ++++- sql/sql_union.cc | 7 ++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result index ba5c1c6e28f..60c975b540e 100644 --- a/mysql-test/r/update.result +++ b/mysql-test/r/update.result @@ -106,9 +106,12 @@ create table t1 (a int not null, b int not null); insert into t1 values (1,1),(1,2),(1,3); update t1 set b=4 where a=1 order by b asc limit 1; update t1 set b=4 where a=1 order by b desc limit 1; +create table t2 (a int not null, b int not null); +insert into t2 values (1,1),(1,2),(1,3); select * from t1; a b 1 4 1 2 1 4 -drop table t1; +update t1 set b=(select distinct 1 from (select * from t2) a); +drop table t1,t2; diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test index 5cbbd2a350e..24620982cda 100644 --- a/mysql-test/t/update.test +++ b/mysql-test/t/update.test @@ -85,5 +85,8 @@ create table t1 (a int not null, b int not null); insert into t1 values (1,1),(1,2),(1,3); update t1 set b=4 where a=1 order by b asc limit 1; update t1 set b=4 where a=1 order by b desc limit 1; +create table t2 (a int not null, b int not null); +insert into t2 values (1,1),(1,2),(1,3); select * from t1; -drop table t1; +update t1 set b=(select distinct 1 from (select * from t2) a); +drop table t1,t2; diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 10175bfe345..cdd34977e5a 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -279,9 +279,10 @@ int st_select_lex_unit::exec() } if (!thd->fatal_error) // Check if EOM { - offset_limit_cnt= global_parameters->offset_limit; - select_limit_cnt= global_parameters->select_limit+ - global_parameters->offset_limit; + SELECT_LEX *sl=thd->lex.current_select->master_unit()->first_select(); + offset_limit_cnt= (sl->braces) ? global_parameters->offset_limit : 0; + select_limit_cnt= (sl->braces) ? global_parameters->select_limit+ + global_parameters->offset_limit : HA_POS_ERROR; if (select_limit_cnt < global_parameters->select_limit) select_limit_cnt= HA_POS_ERROR; // no limit if (select_limit_cnt == HA_POS_ERROR) From a417e7b6b75132a744a8aa2e1f60260b08abb9df Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Dec 2002 23:57:01 +0200 Subject: [PATCH 086/220] Changed get_arg() so that it can be used to fetch more than just one argument from command line. Fixed a bug in interactive 'connect' command, which earlier couldn't take quoted arguments. How-to-repeat: mysql> connect `stupid db` localhost --- client/mysql.cc | 68 +++++++++++++++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 7fdd1035614..9ee441a7709 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -40,7 +40,7 @@ #include #include -const char *VER= "13.2"; +const char *VER= "13.3"; /* Don't try to make a nice table if the data is too big */ #define MAX_COLUMN_LENGTH 1024 @@ -195,7 +195,7 @@ static void end_pager(); static int init_tee(char *); static void end_tee(); static const char* construct_prompt(); -static char *get_arg(char *line); +static char *get_arg(char *line, my_bool get_next_arg); static void init_username(); static void add_int_to_prompt(int toadd); @@ -2231,23 +2231,21 @@ com_print(String *buffer,char *line __attribute__((unused))) static int com_connect(String *buffer, char *line) { - char *tmp,buff[256]; + char *tmp, buff[256]; bool save_rehash= rehash; int error; + bzero(buff, sizeof(buff)); if (buffer) { - while (my_isspace(system_charset_info,*line)) - line++; - strnmov(buff,line,sizeof(buff)-1); // Don't destroy history - if (buff[0] == '\\') // Short command - buff[1]=' '; - tmp=(char *) strtok(buff," \t"); // Skip connect command - if (tmp && (tmp=(char *) strtok(NullS," \t;"))) + strmov(buff, line); + tmp= get_arg(buff, 0); + if (tmp && *tmp) { - my_free(current_db,MYF(MY_ALLOW_ZERO_PTR)); - current_db=my_strdup(tmp,MYF(MY_WME)); - if ((tmp=(char *) strtok(NullS," \t;"))) + my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); + current_db= my_strdup(tmp, MYF(MY_WME)); + tmp= get_arg(buff, 1); + if (tmp) { my_free(current_host,MYF(MY_ALLOW_ZERO_PTR)); current_host=my_strdup(tmp,MYF(MY_WME)); @@ -2333,8 +2331,9 @@ com_use(String *buffer __attribute__((unused)), char *line) char *tmp; char buff[256]; + bzero(buff, sizeof(buff)); strmov(buff, line); - tmp= get_arg(buff); + tmp= get_arg(buff, 0); if (!tmp || !*tmp) { put_info("USE must be followed by a database name", INFO_ERROR); @@ -2376,9 +2375,20 @@ com_use(String *buffer __attribute__((unused)), char *line) } + +/* + Gets argument from a command on the command line. If get_next_arg is + not defined, skips the command and returns the first argument. The + line is modified by adding zero to the end of the argument. If + get_next_arg is defined, then the function searches for end of string + first, after found, returns the next argument and adds zero to the + end. If you ever wish to use this feature, remember to initialize all + items in the array to zero first. +*/ + enum quote_type { NO_QUOTE, SQUOTE, DQUOTE, BTICK }; -char *get_arg(char *line) +char *get_arg(char *line, my_bool get_next_arg) { char *ptr; my_bool quoted= 0, valid_arg= 0; @@ -2386,13 +2396,22 @@ char *get_arg(char *line) enum quote_type qtype= NO_QUOTE; ptr= line; - /* skip leading white spaces */ - while (my_isspace(system_charset_info, *ptr)) - ptr++; - if (*ptr == '\\') // short command was used - ptr+= 2; - while (!my_isspace(system_charset_info, *ptr)) // skip command - ptr++; + if (get_next_arg) + { + for (; ptr && *ptr; ptr++); + if ((ptr + 1) && *(ptr + 1)) + ptr++; + } + else + { + /* skip leading white spaces */ + while (my_isspace(system_charset_info, *ptr)) + ptr++; + if (*ptr == '\\') // short command was used + ptr+= 2; + while (!my_isspace(system_charset_info, *ptr)) // skip command + ptr++; + } while (my_isspace(system_charset_info, *ptr)) ptr++; if ((*ptr == '\'' && (qtype= SQUOTE)) || @@ -2415,9 +2434,8 @@ char *get_arg(char *line) ptr= line; ptr+= count; } - else if (!quoted && *ptr == ' ') - *(ptr + 1) = 0; - else if ((*ptr == '\'' && qtype == SQUOTE) || + else if ((!quoted && *ptr == ' ') || + (*ptr == '\'' && qtype == SQUOTE) || (*ptr == '\"' && qtype == DQUOTE) || (*ptr == '`' && qtype == BTICK)) { From 1dfa625f7b2a0767ce458c47122093a8c2ecf664 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Dec 2002 01:28:59 +0200 Subject: [PATCH 087/220] support of subselect without FROM reducing (SCRUM) fixed bug of calling setup_fields without correct lex->current_select pointer in mysql_derived more correct creation of reference in Item_field::fix_field mysql-test/r/subselect.result: new explain with subselect reduced mysql-test/t/subselect.test: new explain with subselect reduced sql/item.cc: support of subselect without FROM reducing more correct creation of reference in Item_field::fix_field sql/item.h: support of subselect without FROM reducing sql/item_cmpfunc.cc: support of subselect without FROM reducing sql/item_cmpfunc.h: support of subselect without FROM reducing sql/item_func.cc: support of subselect without FROM reducing sql/item_func.h: support of subselect without FROM reducing sql/item_row.cc: support of subselect without FROM reducing sql/item_row.h: support of subselect without FROM reducing sql/item_strfunc.h: fixed layout support of subselect without FROM reducing sql/item_subselect.cc: support of subselect without FROM reducing sql/item_subselect.h: support of subselect without FROM reducing sql/mysql_priv.h: reference in Item_field::fix_field related changes sql/sql_base.cc: reference in Item_field::fix_field related changes sql/sql_derived.cc: fixed bug of calling setup_fields without correct lex->current_select pointer --- mysql-test/r/subselect.result | 33 +++++++++++++++++++++++- mysql-test/t/subselect.test | 6 +++++ sql/item.cc | 42 ++++++++++++++++++------------ sql/item.h | 7 +++-- sql/item_cmpfunc.cc | 16 ++++++++++++ sql/item_cmpfunc.h | 12 +++++++++ sql/item_func.cc | 19 ++++++++++++++ sql/item_func.h | 7 +++++ sql/item_row.cc | 17 ++++++++++++- sql/item_row.h | 2 ++ sql/item_strfunc.h | 31 ++++++++++++++++------ sql/item_subselect.cc | 48 +++++++++++++++++++++++++++++++++++ sql/item_subselect.h | 1 + sql/mysql_priv.h | 2 +- sql/sql_base.cc | 5 +++- sql/sql_derived.cc | 9 ++++--- 16 files changed, 223 insertions(+), 34 deletions(-) diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 502fe0fad60..23aad50c6ae 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -1,13 +1,32 @@ select (select 2); (select 2) 2 +explain select (select 2); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1247 Select 2 was reduced during optimisation SELECT (SELECT 1) UNION SELECT (SELECT 2); (SELECT 1) 1 2 +explain SELECT (SELECT 1) UNION SELECT (SELECT 2); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1247 Select 2 was reduced during optimisation +Note 1247 Select 4 was reduced during optimisation SELECT (SELECT (SELECT 0 UNION SELECT 0)); (SELECT (SELECT 0 UNION SELECT 0)) 0 +explain SELECT (SELECT (SELECT 0 UNION SELECT 0)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBSELECT NULL NULL NULL NULL NULL NULL NULL No tables used +4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1247 Select 2 was reduced during optimisation SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a; Reference 'a' not supported (forward reference in item list) SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b; @@ -20,8 +39,9 @@ Reference 'a' not supported (forward reference in item list) EXPLAIN SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY system NULL NULL NULL NULL 1 -3 DEPENDENT SUBSELECT NULL NULL NULL NULL NULL NULL NULL No tables used 2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1247 Select 3 was reduced during optimisation SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; 1 1 @@ -629,6 +649,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t ref id id 5 const 1 Using where; Using index 3 SUBSELECT NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: +Note 1247 Select 3 was reduced during optimisation Note 1247 Select 2 was reduced during optimisation EXPLAIN SELECT * FROM t WHERE id IN (SELECT 1 UNION SELECT 3); id select_type table type possible_keys key key_len ref rows Extra @@ -752,6 +773,16 @@ NULL select 10.5 > ANY (SELECT * from t); 10.5 > ANY (SELECT * from t) 1 +explain select (select a+1) from t; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t ALL NULL NULL NULL NULL 3 +Warnings: +Note 1247 Select 2 was reduced during optimisation +select (select a+1) from t; +(select a+1) +2.5 +NULL +4.5 drop table t; create table t (a float); select 10.5 IN (SELECT * from t LIMIT 1); diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index c77fc33f0ea..4e8e71e50f8 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -1,6 +1,9 @@ select (select 2); +explain select (select 2); SELECT (SELECT 1) UNION SELECT (SELECT 2); +explain SELECT (SELECT 1) UNION SELECT (SELECT 2); SELECT (SELECT (SELECT 0 UNION SELECT 0)); +explain SELECT (SELECT (SELECT 0 UNION SELECT 0)); -- error 1245 SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a; -- error 1245 @@ -424,6 +427,8 @@ select 1.5 > ALL (SELECT * from t); select 10.5 > ALL (SELECT * from t); select 1.5 > ANY (SELECT * from t); select 10.5 > ANY (SELECT * from t); +explain select (select a+1) from t; +select (select a+1) from t; drop table t; #LIMIT is not supported now @@ -433,6 +438,7 @@ select 10.5 IN (SELECT * from t LIMIT 1); -- error 1235 select 10.5 IN (SELECT * from t LIMIT 1 UNION SELECT 1.5); drop table t; + create table t1 (a int, b int, c varchar(10)); create table t2 (a int); insert into t1 values (1,2,'a'),(2,3,'b'),(3,4,'c'); diff --git a/sql/item.cc b/sql/item.cc index 461f2ba9de5..1603e179e5e 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -546,8 +546,11 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) { if (!field) // If field is not checked { - Field *tmp; - if ((tmp= find_field_in_tables(thd, this, tables, 0)) == not_found_field) + TABLE_LIST *where= 0; + Field *tmp= (Field *)not_found_field; + if (outer_resolving || + (tmp= find_field_in_tables(thd, this, tables, &where, 0)) == + not_found_field) { /* We can't find table field in table list of current select, @@ -565,12 +568,12 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) SELECT_LEX *cursel=(SELECT_LEX *) thd->lex.current_select; if (cursel->master_unit()->first_select()->linkage != DERIVED_TABLE_TYPE) - for (SELECT_LEX *sl=cursel->outer_select(); + for (SELECT_LEX *sl=(outer_resolving?cursel:cursel->outer_select()); sl; sl= sl->outer_select()) { if ((tmp= find_field_in_tables(thd, this, - (last= sl)->get_table_list(), + (last= sl)->get_table_list(), &where, 0)) != not_found_field) break; if ((refer= find_item_in_list(this, sl->item_list, @@ -588,7 +591,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) else if (tmp == not_found_field && refer == (Item **)not_found_item) { // call to return error code - find_field_in_tables(thd, this, tables, 1); + find_field_in_tables(thd, this, tables, &where, 1); return -1; } else if (refer != (Item **)not_found_item) @@ -614,6 +617,17 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) found table as depended (of select where was found table) */ thd->lex.current_select->mark_as_dependent(last); + if (depended_from->having_fix_field) + { + Item_ref *rf; + *ref= rf= new Item_ref((where->db[0]?where->db:0), + (char *)where->alias, + (char *)field_name); + if (!rf) + return 1; + (rf)->outer_resolving= outer_resolving; + return rf->check_cols(1) || rf->fix_fields(thd, tables, ref); + } } } else if (!tmp) @@ -629,14 +643,6 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) table->used_fields++; table->used_keys&=field->part_of_key; } - if (depended_from != 0 && depended_from->having_fix_field) - { - *ref= new Item_ref((char *)db_name, (char *)table_name, - (char *)field_name); - if (!*ref) - return 1; - return (*ref)->check_cols(1) || (*ref)->fix_fields(thd, tables, ref); - } fixed= 1; return 0; } @@ -1007,13 +1013,17 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) { if (!ref) { - SELECT_LEX *sl= thd->lex.current_select->outer_select(); + TABLE_LIST *where= 0; + SELECT_LEX *sl= (outer_resolving? + thd->lex.current_select->select_lex(): + thd->lex.current_select->outer_select()); /* Finding only in current select will be performed for selects that have not outer one and for derived tables (which not support using outer fields for now) */ - if ((ref= find_item_in_list(this, + if (outer_resolving || + (ref= find_item_in_list(this, *(thd->lex.current_select->get_item_list()), ((sl && thd->lex.current_select->master_unit()-> @@ -1041,7 +1051,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) (Item **)not_found_item) break; if ((tmp= find_field_in_tables(thd, this, - sl->get_table_list(), + sl->get_table_list(), &where, 0)) != not_found_field); if (sl->master_unit()->first_select()->linkage == DERIVED_TABLE_TYPE) diff --git a/sql/item.h b/sql/item.h index 4e3c5f597ab..508c737e7b9 100644 --- a/sql/item.h +++ b/sql/item.h @@ -96,6 +96,7 @@ public: CHARSET_INFO *thd_charset() const; CHARSET_INFO *charset() const { return str_value.charset(); }; void set_charset(CHARSET_INFO *cs) { str_value.set_charset(cs); } + virtual void set_outer_resolving() {} // Row emulation virtual uint cols() { return 1; } @@ -117,12 +118,14 @@ public: const char *table_name; const char *field_name; st_select_lex *depended_from; + bool outer_resolving; /* used for items from reduced subselect */ Item_ident(const char *db_name_par,const char *table_name_par, const char *field_name_par) - :db_name(db_name_par),table_name(table_name_par), - field_name(field_name_par), depended_from(0) + :db_name(db_name_par), table_name(table_name_par), + field_name(field_name_par), depended_from(0), outer_resolving(0) { name = (char*) field_name_par; } const char *full_name() const; + void set_outer_resolving() { outer_resolving= 1; } }; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index df949a910bd..89ff5ef2822 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -946,6 +946,13 @@ Item_func_case::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) return 0; } +void Item_func_case::set_outer_resolving() +{ + first_expr->set_outer_resolving(); + else_expr->set_outer_resolving(); + Item_func::set_outer_resolving(); +} + bool Item_func_case::check_loop(uint id) { DBUG_ENTER("Item_func_case::check_loop"); @@ -1523,6 +1530,15 @@ bool Item_cond::check_loop(uint id) DBUG_RETURN(0); } +void Item_cond::set_outer_resolving() +{ + Item_func::set_outer_resolving(); + List_iterator li(list); + Item *item; + while ((item= li++)) + item->set_outer_resolving(); +} + void Item_cond::split_sum_func(List &fields) { List_iterator li(list); diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index e3d8eb7746d..603d7123a6f 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -277,6 +277,11 @@ public: const char *func_name() const { return "interval"; } void update_used_tables(); bool check_loop(uint id); + void set_outer_resolving() + { + item->set_outer_resolving(); + Item_func::set_outer_resolving(); + } }; @@ -359,6 +364,7 @@ public: bool fix_fields(THD *thd, struct st_table_list *tlist, Item **ref); Item *find_item(String *str); bool check_loop(uint id); + void set_outer_resolving(); }; @@ -643,6 +649,11 @@ class Item_func_in :public Item_int_func DBUG_RETURN(item->check_loop(id)); } bool nulls_in_row(); + void set_outer_resolving() + { + item->set_outer_resolving(); + Item_int_func::set_outer_resolving(); + } }; /* Functions used by where clause */ @@ -784,6 +795,7 @@ public: friend int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds); bool check_loop(uint id); void top_level_item() { abort_on_null=1; } + void set_outer_resolving(); }; diff --git a/sql/item_func.cc b/sql/item_func.cc index 19fd6b12c67..f0c956b873a 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -146,6 +146,16 @@ bool Item_func::check_loop(uint id) DBUG_RETURN(0); } +void Item_func::set_outer_resolving() +{ + if (arg_count) + { + Item **arg,**arg_end; + for (arg= args, arg_end= args+arg_count; arg != arg_end; arg++) + (*arg)->set_outer_resolving(); + } +} + void Item_func::split_sum_func(List &fields) { Item **arg,**arg_end; @@ -2356,6 +2366,15 @@ bool Item_func_match::check_loop(uint id) DBUG_RETURN(0); } +void Item_func_match::set_outer_resolving() +{ + Item_real_func::set_outer_resolving(); + List_iterator li(fields); + Item *item; + while ((item= li++)) + item->set_outer_resolving(); +} + bool Item_func_match::fix_index() { List_iterator_fast li(fields); diff --git a/sql/item_func.h b/sql/item_func.h index 36d6dcbe002..6ff2c7eef9d 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -133,6 +133,7 @@ public: friend class udf_handler; Field *tmp_table_field(TABLE *t_arg); bool check_loop(uint id); + void set_outer_resolving(); }; @@ -632,6 +633,11 @@ public: DBUG_RETURN(1); DBUG_RETURN(item->check_loop(id)); } + void set_outer_resolving() + { + item->set_outer_resolving(); + Item_int_func::set_outer_resolving(); + } }; @@ -1006,6 +1012,7 @@ public: bool fix_index(); void init_search(bool no_order); bool check_loop(uint id); + void set_outer_resolving(); }; diff --git a/sql/item_row.cc b/sql/item_row.cc index 9d605e05242..b54653f4183 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -105,5 +105,20 @@ void Item_row::bring_value() { for (uint i= 0; i < arg_count; i++) items[i]->bring_value(); - return; +} + +void Item_row::set_outer_resolving() +{ + for (uint i= 0; i < arg_count; i++) + items[i]->set_outer_resolving(); +} + +bool Item_row::check_loop(uint id) +{ + if (Item::check_loop(id)) + return 1; + for (uint i= 0; i < arg_count; i++) + if (items[i]->check_loop(id)) + return 1; + return 0; } diff --git a/sql/item_row.h b/sql/item_row.h index cf67567c3ed..f33e0cc9821 100644 --- a/sql/item_row.h +++ b/sql/item_row.h @@ -64,6 +64,8 @@ public: bool const_item() const { return const_item_cache; }; enum Item_result result_type() const { return ROW_RESULT; } void update_used_tables(); + bool check_loop(uint id); + void set_outer_resolving(); uint cols() { return arg_count; } Item* el(uint i) { return items[i]; } diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index c8706c2c933..12b003d7d82 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -108,14 +108,19 @@ public: separator->fix_fields(thd, tlist, &separator) || Item_func::fix_fields(thd, tlist, ref)); } - const char *func_name() const { return "concat_ws"; } - bool check_loop(uint id) - { - DBUG_ENTER("Item_func_concat_ws::check_loop"); - if (Item_str_func::check_loop(id)) - DBUG_RETURN(1); - DBUG_RETURN(separator->check_loop(id)); - } + const char *func_name() const { return "concat_ws"; } + bool check_loop(uint id) + { + DBUG_ENTER("Item_func_concat_ws::check_loop"); + if (Item_str_func::check_loop(id)) + DBUG_RETURN(1); + DBUG_RETURN(separator->check_loop(id)); + } + void set_outer_resolving() + { + separator->set_outer_resolving(); + Item_func::set_outer_resolving(); + } }; class Item_func_reverse :public Item_str_func @@ -393,6 +398,11 @@ public: DBUG_RETURN(1); DBUG_RETURN(item->check_loop(id)); } + void set_outer_resolving() + { + item->set_outer_resolving(); + Item_str_func::set_outer_resolving(); + } }; @@ -421,6 +431,11 @@ public: DBUG_RETURN(1); DBUG_RETURN(item->check_loop(id)); } + void set_outer_resolving() + { + item->set_outer_resolving(); + Item_str_func::set_outer_resolving(); + } }; diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 65c942a75ce..fe38c458495 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -146,6 +146,54 @@ void Item_singlerow_subselect::reset() value->null_value= 1; } +void Item_singlerow_subselect::select_transformer(st_select_lex_unit *unit) +{ + SELECT_LEX *select_lex= unit->first_select(); + + if (!select_lex->next_select() && !select_lex->table_list.elements && + select_lex->item_list.elements == 1) + { + + have_to_be_excluded= 1; + THD *thd= current_thd; + if (thd->lex.describe) + { + char warn_buff[MYSQL_ERRMSG_SIZE]; + sprintf(warn_buff, ER(ER_SELECT_REDUCED), select_lex->select_number); + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_SELECT_REDUCED, warn_buff); + } + substitution= select_lex->item_list.head(); + substitution->set_outer_resolving(); + if (substitution->type() == FIELD_ITEM || + substitution->type() == REF_ITEM) + name= substitution->name; // Save name for correct resolving + + if (select_lex->where || select_lex->having) + { + Item *cond; + if (!select_lex->having) + cond= select_lex->where; + else if (!select_lex->where) + cond= select_lex->having; + else + if (!(cond= new Item_cond_and(select_lex->having, select_lex->where))) + { + my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); + thd->fatal_error= 1; + return; + } + if (!(substitution= new Item_func_if(cond, substitution, + new Item_null()))) + { + my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); + thd->fatal_error= 1; + return; + } + } + } +} + void Item_singlerow_subselect::store(uint i, Item *item) { row[i]->store(item); diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 6063730d6a8..0d263f4aa39 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -106,6 +106,7 @@ public: decimals= item->decimals; } void reset(); + void select_transformer(st_select_lex_unit *unit); void store(uint i, Item* item); double val(); longlong val_int (); diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index cf0cefd76da..616a0573772 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -463,7 +463,7 @@ bool drop_locked_tables(THD *thd,const char *db, const char *table_name); void abort_locked_tables(THD *thd,const char *db, const char *table_name); extern const Field *not_found_field; Field *find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables, - bool report_error); + TABLE_LIST **where, bool report_error); Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length, bool check_grant,bool allow_rowid); #ifdef HAVE_OPENSSL diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 87cc0d616a9..eb7fdf783d3 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1654,6 +1654,7 @@ const Field *not_found_field= (Field*) 0x1; thd - pointer to current thread structure item - field item that should be found tables - tables for scaning + where - table where field found will be returned via this parameter report_error - if FALSE then do not report error if item not found and return not_found_field; @@ -1667,7 +1668,7 @@ const Field *not_found_field= (Field*) 0x1; Field * find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables, - bool report_error) + TABLE_LIST **where, bool report_error) { Field *found=0; const char *db=item->db_name; @@ -1688,6 +1689,7 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables, grant_option && !thd->master_access,1); if (find) { + (*where)= tables; if (find == WRONG_GRANT) return (Field*) 0; if (db || !thd->where) @@ -1742,6 +1744,7 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables, { if (field == WRONG_GRANT) return (Field*) 0; + (*where)= tables; if (found) { if (!thd->where) // Returns first found diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index f7d845e9e36..db516ae5f41 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -63,6 +63,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) TMP_TABLE_PARAM tmp_table_param; bool is_union=sl->next_select() && sl->next_select()->linkage == UNION_TYPE; DBUG_ENTER("mysql_derived"); + SELECT_LEX_NODE *save_current_select= lex->current_select; /* @@ -111,6 +112,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) } } + lex->current_select= sl; if (setup_fields(thd,tables,item_list,0,0,1)) { res=-1; @@ -119,7 +121,8 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) bzero((char*) &tmp_table_param,sizeof(tmp_table_param)); tmp_table_param.field_count=item_list.elements; if (!(table=create_tmp_table(thd, &tmp_table_param, item_list, - (ORDER*) 0, is_union && !unit->union_option, 1, + (ORDER*) 0, + is_union && !unit->union_option, 1, (sl->options | thd->options | TMP_TABLE_ALL_COLUMNS), HA_POS_ERROR))) @@ -138,8 +141,6 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) if (unit->select_limit_cnt == HA_POS_ERROR) sl->options&= ~OPTION_FOUND_ROWS; - SELECT_LEX_NODE *save_current_select= lex->current_select; - lex->current_select= sl; if (is_union) res=mysql_union(thd,lex,derived_result,unit); else @@ -149,7 +150,6 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) sl->having, (ORDER*) NULL, sl->options | thd->options | SELECT_NO_UNLOCK, derived_result, unit, sl, 0); - lex->current_select= save_current_select; if (!res) { @@ -184,6 +184,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) if (res) free_tmp_table(thd,table); exit: + lex->current_select= save_current_select; close_thread_tables(thd); } DBUG_RETURN(res); From 868ed1135fb1501e69f58a4792fb04e822cf754a Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Dec 2002 15:24:40 +0200 Subject: [PATCH 088/220] Update of test results --- mysql-test/r/case.result | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result index 183e2692d7a..661ffa99f2c 100644 --- a/mysql-test/r/case.result +++ b/mysql-test/r/case.result @@ -63,7 +63,12 @@ nothing 2 one 1 two 1 drop table t1; +drop table if exists t; +create table t1 (row int not null, col int not null, val varchar(255) not null); +insert into t1 values (1,1,'orange'),(1,2,'large'),(2,1,'yellow'),(2,2,'medium'),(3,1,'green'),(3,2,'small'); +select max(case col when 1 then val else null end) as color from t1 group by row; color orange yellow green +drop table if exists t; From ad22d0cbacd59f7dcac4ccc121486c614e609b93 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Dec 2002 15:55:22 +0200 Subject: [PATCH 089/220] Test cleanup mysql-test/r/case.result: Removed unnecessary drop commands mysql-test/t/case.test: Removed unnecessary drop commands --- mysql-test/r/case.result | 3 +-- mysql-test/t/case.test | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result index 661ffa99f2c..4c16b375400 100644 --- a/mysql-test/r/case.result +++ b/mysql-test/r/case.result @@ -63,7 +63,6 @@ nothing 2 one 1 two 1 drop table t1; -drop table if exists t; create table t1 (row int not null, col int not null, val varchar(255) not null); insert into t1 values (1,1,'orange'),(1,2,'large'),(2,1,'yellow'),(2,2,'medium'),(3,1,'green'),(3,2,'small'); select max(case col when 1 then val else null end) as color from t1 group by row; @@ -71,4 +70,4 @@ color orange yellow green -drop table if exists t; +drop table t1; diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test index b5a1a60f15b..3ba3a292c77 100644 --- a/mysql-test/t/case.test +++ b/mysql-test/t/case.test @@ -30,8 +30,12 @@ insert into t1 values(1),(2),(3),(4); select case a when 1 then 2 when 2 then 3 else 0 end as fcase, count(*) from t1 group by fcase; select case a when 1 then "one" when 2 then "two" else "nothing" end as fcase, count(*) from t1 group by fcase; drop table t1; -drop table if exists t1; + +# +# Test MAX(CASE ... ) that can return null +# + create table t1 (row int not null, col int not null, val varchar(255) not null); insert into t1 values (1,1,'orange'),(1,2,'large'),(2,1,'yellow'),(2,2,'medium'),(3,1,'green'),(3,2,'small'); select max(case col when 1 then val else null end) as color from t1 group by row; -drop table if exists t1; +drop table t1; From 5265a1656ea58d9534ebadfbd45c662080f89bb0 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Dec 2002 17:48:19 +0200 Subject: [PATCH 090/220] added FROM DUAL for derived tables --- mysql-test/r/derived.result | 3 +++ mysql-test/t/derived.test | 1 + sql/sql_yacc.yy | 1 + 3 files changed, 5 insertions(+) diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index 06d2e663221..6a3aa328175 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -1,3 +1,6 @@ +select * from (select 2 from DUAL) b; +2 +2 SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; Unknown column 'a' in 'field list' SELECT 1 as a FROM (SELECT a UNION SELECT 1) b; diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index b9c9ab8a718..0c366b65797 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -1,3 +1,4 @@ +select * from (select 2 from DUAL) b; -- error 1054 SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; -- error 1054 diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 55f165c0739..e99f2a3b17c 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -997,6 +997,7 @@ merge_insert_types: opt_select_from: opt_limit_clause {} + | FROM DUAL_SYM {} | select_from select_lock_type; udf_func_type: From c917474ed23e99ccb28b1c4802acb2a821177aad Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Dec 2002 19:12:57 +0300 Subject: [PATCH 091/220] Add proper error message for old client connecting new server using user which has password in new format SCRUM include/mysqld_error.h: Add new error message sql/share/czech/errmsg.txt: czech sql/share/danish/errmsg.txt: danish sql/share/dutch/errmsg.txt: dutch sql/share/english/errmsg.txt: New Error message for in case old client connects new server and new auth is to be used sql/share/estonian/errmsg.txt: estonian sql/share/french/errmsg.txt: french sql/share/german/errmsg.txt: german sql/share/greek/errmsg.txt: greek sql/share/hungarian/errmsg.txt: hungarian sql/share/italian/errmsg.txt: italian sql/share/japanese/errmsg.txt: japaneese sql/share/korean/errmsg.txt: korean sql/share/norwegian-ny/errmsg.txt: norwegian-ny sql/share/norwegian/errmsg.txt: norwegian sql/share/polish/errmsg.txt: polish sql/share/portuguese/errmsg.txt: portuguese sql/share/romanian/errmsg.txt: romanian sql/share/russian/errmsg.txt: russian sql/share/serbian/errmsg.txt: se sql/share/slovak/errmsg.txt: slovak sql/share/spanish/errmsg.txt: spanish sql/share/swedish/errmsg.txt: swedish sql/share/ukrainian/errmsg.txt: ukrainian sql/sql_parse.cc: Add proper error message if old clients can't authenticate due to unsupported protocol SCRUM --- include/mysqld_error.h | 3 ++- sql/share/czech/errmsg.txt | 1 + sql/share/danish/errmsg.txt | 1 + sql/share/dutch/errmsg.txt | 1 + sql/share/english/errmsg.txt | 1 + sql/share/estonian/errmsg.txt | 1 + sql/share/french/errmsg.txt | 1 + sql/share/german/errmsg.txt | 1 + sql/share/greek/errmsg.txt | 1 + sql/share/hungarian/errmsg.txt | 1 + sql/share/italian/errmsg.txt | 1 + sql/share/japanese/errmsg.txt | 1 + sql/share/korean/errmsg.txt | 1 + sql/share/norwegian-ny/errmsg.txt | 1 + sql/share/norwegian/errmsg.txt | 1 + sql/share/polish/errmsg.txt | 1 + sql/share/portuguese/errmsg.txt | 1 + sql/share/romanian/errmsg.txt | 1 + sql/share/russian/errmsg.txt | 1 + sql/share/serbian/errmsg.txt | 1 + sql/share/slovak/errmsg.txt | 1 + sql/share/spanish/errmsg.txt | 1 + sql/share/swedish/errmsg.txt | 1 + sql/share/ukrainian/errmsg.txt | 1 + sql/sql_parse.cc | 43 +++++++++++++++++++------------ 25 files changed, 52 insertions(+), 17 deletions(-) diff --git a/include/mysqld_error.h b/include/mysqld_error.h index 81a24e89164..377f714bfff 100644 --- a/include/mysqld_error.h +++ b/include/mysqld_error.h @@ -265,4 +265,5 @@ #define ER_DERIVED_MUST_HAVE_ALIAS 1246 #define ER_SELECT_REDUCED 1247 #define ER_TABLENAME_NOT_ALLOWED_HERE 1248 -#define ER_ERROR_MESSAGES 249 +#define ER_NOT_SUPPORTED_AUTH_MODE 1249 +#define ER_ERROR_MESSAGES 250 diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index c1ee8b12e7f..6c3196bfeba 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -259,3 +259,4 @@ v/* "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index 17c1dd76474..dcc016511dd 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -253,3 +253,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index a2ef2b0923d..6091616fc4a 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -261,3 +261,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index eabbb6c1eeb..d235f8f49a5 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -250,3 +250,4 @@ "Every derived table must have it's own alias", "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 367bda922f3..43eb5de89a5 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -255,3 +255,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index 93009f564e6..d7bb19c2876 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -250,3 +250,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index 24ee7a99409..765fbd875e2 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -260,3 +260,4 @@ "Für jede abgeleitete Tabelle muss ein eigener Alias angegeben werden.", "Select %u wurde während der Optimierung reduziert.", "Tabelle '%-.64s', die in einem der SELECT-Befehle verwendet wurde kann nicht in %-.32s verwendet werden." +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index ffed9111859..8831d4e47b9 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -250,3 +250,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index a597e3870b5..8d6c321d316 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -252,3 +252,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index 84b4d02dc9e..56b3018e3a6 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -250,3 +250,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index f339faf5fc4..70ab2d6d42d 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -252,3 +252,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 855f157d3b5..c18c3ed3873 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -250,3 +250,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index d930ec5ab74..9cd99613f52 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -252,3 +252,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index 15bc59c39dc..32fe6c30b34 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -252,3 +252,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 95315516cda..4b59a62f991 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -254,3 +254,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 47dc0ed569d..7236bd86652 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -250,3 +250,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 722efe4f83f..0b8bbe1c219 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -254,3 +254,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index ddbb5bdbe5d..2f1eedd207c 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -253,3 +253,4 @@ "Every derived table must have it's own alias" "Select %u ÂÙÌ ÕÐÒÁÚÄÎÅÎ × ÐÒÏÃÅÓÓÅ ÏÐÔÉÍÉÚÁÃÉÉ", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index c9ab4d8f656..75cfd73f3f0 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -246,3 +246,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 0d6a847a341..de354f234c7 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -258,3 +258,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index cc56e1f6aef..a528c3e6b36 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -251,3 +251,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index b792864b9f4..5473f4e8e42 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -250,3 +250,4 @@ "Every derived table must have it's own alias" "Select %u was reduced during optimisation", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index 2b6825adb8a..0b91786d1f3 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -255,3 +255,4 @@ "Every derived table must have it's own alias" "Select %u was ÓËÁÓÏ×ÁÎÏ ÐÒÉ ÏÐÔÉÍiÚÁÃii", "Table '%-.64s' from one of SELECT's can not be used in %-.32s" +"Client does not support authentication protocol requested by server. Consider upgrading MySQL client" \ No newline at end of file diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index f8a3350f051..e4531e7a2bf 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -189,9 +189,9 @@ end: static int check_user(THD *thd,enum_server_command command, const char *user, const char *passwd, const char *db, bool check_count, - bool do_send_error, char* crypted_scramble, - bool had_password,uint *cur_priv_version, - ACL_USER** hint_user) + bool simple_connect, bool do_send_error, + char* crypted_scramble, bool had_password, + uint *cur_priv_version, ACL_USER** hint_user) { thd->db=0; thd->db_length=0; @@ -222,14 +222,23 @@ static int check_user(THD *thd,enum_server_command command, const char *user, { if (do_send_error) { - net_printf(thd, ER_ACCESS_DENIED_ERROR, - thd->user, - thd->host_or_ip, - had_password ? ER(ER_YES) : ER(ER_NO)); - mysql_log.write(thd,COM_CONNECT,ER(ER_ACCESS_DENIED_ERROR), - thd->user, - thd->host_or_ip, - had_password ? ER(ER_YES) : ER(ER_NO)); + /* Old client should get nicer error message if password version is not supported*/ + if (simple_connect && *hint_user && (*hint_user)->pversion) + { + net_printf(thd, ER_NOT_SUPPORTED_AUTH_MODE); + mysql_log.write(thd,COM_CONNECT,ER(ER_NOT_SUPPORTED_AUTH_MODE)); + } + else + { + net_printf(thd, ER_ACCESS_DENIED_ERROR, + thd->user, + thd->host_or_ip, + had_password ? ER(ER_YES) : ER(ER_NO)); + mysql_log.write(thd,COM_CONNECT,ER(ER_ACCESS_DENIED_ERROR), + thd->user, + thd->host_or_ip, + had_password ? ER(ER_YES) : ER(ER_NO)); + } return(1); // Error already given } else @@ -638,8 +647,9 @@ check_connections(THD *thd) /* Store information if we used password. passwd will be dammaged */ bool using_password=test(passwd[0]); /* Check user permissions. If password failure we'll get scramble back */ - if (check_user(thd,COM_CONNECT, user, passwd, db, 1, simple_connect, - prepared_scramble,using_password,&cur_priv_version,&cached_user)<0) + if (check_user(thd, COM_CONNECT, user, passwd, db, 1, simple_connect, + simple_connect, prepared_scramble, using_password, &cur_priv_version, + &cached_user)<0) { /* If The client is old we just have to return error */ if (simple_connect) @@ -679,7 +689,7 @@ check_connections(THD *thd) } /* Final attempt to check the user based on reply */ if (check_user(thd,COM_CONNECT, tmp_user, (char*)net->read_pos, - tmp_db, 1, 1,prepared_scramble,using_password,&cur_priv_version, + tmp_db, 1, 0, 1, prepared_scramble, using_password, &cur_priv_version, &cached_user)) return -1; } @@ -1077,7 +1087,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, Do not retry if we already have sent error (result>0) */ if (check_user(thd,COM_CHANGE_USER, user, passwd, db, 0, simple_connect, - prepared_scramble,using_password,&cur_priv_version,&cached_user)<0) + simple_connect, prepared_scramble, using_password, &cur_priv_version, + &cached_user)<0) { /* If The client is old we just have to have auth failure */ if (simple_connect) @@ -1112,7 +1123,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, /* Final attempt to check the user based on reply */ if (check_user(thd,COM_CHANGE_USER, tmp_user, (char*)net->read_pos, - tmp_db, 0, 1,prepared_scramble,using_password,&cur_priv_version, + tmp_db, 0, 0, 1, prepared_scramble, using_password, &cur_priv_version, &cached_user)) goto restore_user; } From f1696d4f5f001d59204f19b2ef3fa921c9336a0f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Dec 2002 18:26:37 +0200 Subject: [PATCH 092/220] Cut hostnames at HOSTNAME_LENGTH to avoid theoretical hostname overruns Changed long packat handling to check for packets of length 0xffffff. This does however break packet handling for older clients. If you are using packets >= 16M then you need to upgrade client and server after this patch. Docs/internals.texi: Updated documentation for 4.1 protocol sql/ha_innodb.cc: Optimization of checking command sql/item.h: Removed automatic set of length for Item_string sql/item_create.cc: Optimized create of create_func_current_user() sql/net_serv.cc: Fixed wrong max packet length sql/sql_acl.cc: Safety fix. sql/sql_parse.cc: Cut hostnames at HOSTNAME_LENGTH to avoid theoretical hostname overruns --- Docs/internals.texi | 83 +++++++++++++++++++++++---------------------- sql/ha_innodb.cc | 9 ++--- sql/item.h | 2 -- sql/item_create.cc | 12 ++++--- sql/net_serv.cc | 2 +- sql/sql_acl.cc | 2 +- sql/sql_parse.cc | 2 ++ 7 files changed, 56 insertions(+), 56 deletions(-) diff --git a/Docs/internals.texi b/Docs/internals.texi index 18bdc8d8b4c..6719bd4a6fa 100644 --- a/Docs/internals.texi +++ b/Docs/internals.texi @@ -1585,7 +1585,7 @@ fe 00 . . @node 4.1 protocol changes,,, @section Changes to 4.0 protocol in 4.1 -All basic package handling is identical to 4.0. When communication +All basic packet handling is identical to 4.0. When communication with an old 4.0 or 3.x client we will use the old protocol. The new things that we support with 4.1 are: @@ -1596,7 +1596,7 @@ Warnings @item Prepared statements @item -Binary protocol (will be much faster than the current protocol that +Binary protocol (will be faster than the current protocol that converts everything to strings) @end itemize @@ -1617,15 +1617,15 @@ results will sent as binary (low-byte-first). @end itemize -@node 4.1 field package,,, -@section 4.1 field description package +@node 4.1 field packet,,, +@section 4.1 field description packet -The field description package is sent as a response to a query that -contains a result set. It can be distinguished from a ok package by -the fact that the first byte can't be 0 for a field package. -@xref {4.1 ok package}. +The field description packet is sent as a response to a query that +contains a result set. It can be distinguished from a ok packet by +the fact that the first byte can't be 0 for a field packet. +@xref {4.1 ok packet}. -The header package has the following structure: +The header packet has the following structure: @multitable @columnfractions .10 .90 @item Size @tab Comment @@ -1634,7 +1634,7 @@ The header package has the following structure: uses this to send the number of rows in the table) @end multitable -This package is always followed by a field description set. +This packet is always followed by a field description set. @xref{4.1 field desc}. @node 4.1 field desc,,, @@ -1655,17 +1655,17 @@ The field description result set contains the meta info for a result set. @end multitable -@node 4.1 ok package,,, -@section 4.1 ok package +@node 4.1 ok packet,,, +@section 4.1 ok packet -The ok package is the first that is sent as an response for a query +The ok packet is the first that is sent as an response for a query that didn't return a result set. -The ok package has the following structure: +The ok packet has the following structure: @multitable @columnfractions .10 .90 @item Size @tab Comment -@item 1 @tab 0 ; Marker for ok package +@item 1 @tab 0 ; Marker for ok packet @item 1-9 @tab Affected rows @item 1-9 @tab Last insert id (0 if one wasn't used) @item 2 @tab Server status; Can be used by client to check if we are inside an transaction @@ -1681,10 +1681,10 @@ The message is optional. For example for multi line INSERT it contains a string for how many rows was inserted / deleted. -@node 4.1 end package,,, -@section 4.1 end package +@node 4.1 end packet,,, +@section 4.1 end packet -The end package is sent as the last package for +The end packet is sent as the last packet for @itemize @bullet @item @@ -1695,41 +1695,42 @@ End of parameter type information End of result set @end itemize -The end package has the following structure: +The end packet has the following structure: @multitable @columnfractions .10 .90 @item Size @tab Comment -@item 1 @tab 254 ; Marker for EOF package +@item 1 @tab 254 ; Marker for EOF packet @item 2 @tab Warning count @item 2 @tab Status flags (For flags like SERVER_STATUS_MORE_RESULTS) @end multitable -Note that a normal package may start with byte 254, which means +Note that a normal packet may start with byte 254, which means 'length stored in 9 bytes'. One can different between these cases by checking the packet length < 9 bytes (in which case it's and end packet). -@node 4.1 error package -@section 4.1 error package. +@node 4.1 error packet +@section 4.1 error packet. -The error package is sent when something goes wrong. -The error package has the following structure: +The error packet is sent when something goes wrong. +The error packet has the following structure: @multitable @columnfractions .10 .90 @item Size @tab Comment -@item 1 @tab 255 Error package marker +@item 1 @tab 255 Error packet marker +@item 2 @tab Error code @item 1-255 @tab Null terminated error message @end multitable -The client/server protocol is designed in such a way that a package -can only start with 255 if it's an error package. +The client/server protocol is designed in such a way that a packet +can only start with 255 if it's an error packet. @node 4.1 prep init,,, -@section 4.1 prepared statement init package +@section 4.1 prepared statement init packet -This is the return package when one sends a query with the COM_PREPARE +This is the return packet when one sends a query with the COM_PREPARE command. @multitable @columnfractions .10 .90 @@ -1755,8 +1756,8 @@ Note that the above is not yet in 4.1 but will be added this month. As MySQL can have a parameter 'anywhere' it will in many cases not be able to provide the optimal information for all parameters. -If number of columns, in the header package, is not 0 then the -prepared statement will contain a result set. In this case the package +If number of columns, in the header packet, is not 0 then the +prepared statement will contain a result set. In this case the packet is followed by a field description result set. @xref{4.1 field descr}. @@ -1768,22 +1769,22 @@ value. One can call mysql_send_long_data() multiple times for the same parameter; The server will concatenate the results to a one big string. -The server will not require an end package for the string. +The server will not require an end packet for the string. mysql_send_long_data() is responsible updating a flag that all data has been sent. (Ie; That the last call to mysql_send_long_data() has the 'last_data' flag set). -This package is sent from client -> server: +This packet is sent from client -> server: @multitable @columnfractions .10 .90 @item Size @tab Comment @item 4 @tab Statement handler @item 2 @tab Parameter number @item 2 @tab Type of parameter (not used at this point) -@item # @tab data (Rest of package) +@item # @tab data (Rest of packet) @end itemize -The server will NOT send an @code{ok} or @code{error} package in +The server will NOT send an @code{ok} or @code{error} packet in responce for this. If there is any errors (like to big string), one will get the error when calling execute. @@ -1791,9 +1792,9 @@ will get the error when calling execute. @section 4.1 execute On execute we send all parameters to the server in a COM_EXECUTE -package. +packet. -The package contains the following information: +The packet contains the following information: @multitable @columnfractions .30 .70 @item Size @tab Comment @@ -1822,7 +1823,7 @@ The parameters are stored the following ways: @item string @tab 1-9 + # @tab Packed string length + string @end multitable -The result for this will be either an ok package or a binary result +The result for this will be either an ok packet or a binary result set. @node 4.1 binary result,,, @@ -1836,11 +1837,11 @@ For each result row: @item null bit map with first two bits set to 01 (bit 0,1 value 1) @item -parameter data, repeated for each not null parameter. +parameter data, repeated for each not null result column. @end itemize The idea with the reserving two bits in the null map is that we can -use standard error (first byte 255) and ok packages (first byte 0) +use standard error (first byte 255) and ok packets (first byte 0) to end a result sets. Except that the null-bit-map is shifted two steps, the server is diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index dd718f02ba9..b34de8cb831 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -1907,12 +1907,9 @@ ha_innobase::write_row( the counter here. */ skip_auto_inc_decr = FALSE; - - if (error == DB_DUPLICATE_KEY) { - ut_a(user_thd->query); - dict_accept(user_thd->query, "REPLACE", - &skip_auto_inc_decr); - } + if (error == DB_DUPLICATE_KEY && + user_thd->lex.sql_command == SQLCOM_REPLACE) + skip_auto_inc_decr= TRUE; if (!skip_auto_inc_decr && incremented_auto_inc_counter && prebuilt->trx->auto_inc_lock) { diff --git a/sql/item.h b/sql/item.h index 05b906a66a6..67dcc8ad7b8 100644 --- a/sql/item.h +++ b/sql/item.h @@ -267,8 +267,6 @@ public: } Item_string(const char *name_par,const char *str,uint length) { - if (!length) - length=strlen(str); str_value.set(str,length); max_length=length; name=(char*) name_par; diff --git a/sql/item_create.cc b/sql/item_create.cc index 1f0bad8eda3..c6fca1c01e1 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -294,10 +294,12 @@ Item *create_func_pow(Item* a, Item *b) Item *create_func_current_user() { THD *thd=current_thd; - Item_string *res=new Item_string("CURRENT_USER()", thd->priv_user, 0); - res->append("@", 1); - res->append((char *)thd->host_or_ip, 0); - return res; + char buff[HOSTNAME_LENGTH+USERNAME_LENGTH+2]; + uint length; + + length= (uint) (strxmov(buff, thd->priv_user, "@", thd->host_or_ip, NullS) - + buff); + return new Item_string("CURRENT_USER()", thd->memdup(buff, length), length); } Item *create_func_quarter(Item* a) @@ -403,7 +405,7 @@ Item *create_func_ucase(Item* a) Item *create_func_version(void) { - return new Item_string("VERSION()",server_version, 0); + return new Item_string("VERSION()",server_version, strlen(server_version)); } Item *create_func_weekday(Item* a) diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 122793b07a7..ac73a4ca15a 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -73,7 +73,7 @@ extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received; #include "thr_alarm.h" #define TEST_BLOCKING 8 -#define MAX_THREE_BYTES 255L*255L*255L +#define MAX_THREE_BYTES (256L*256L*256L-1) static int net_write_buff(NET *net,const char *packet,ulong len); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 673bc441b6b..1f8f25e5fb8 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1870,7 +1870,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, ulong rights, ulong col_rights, bool revoke_grant) { - char grantor[HOSTNAME_LENGTH+1+USERNAME_LENGTH]; + char grantor[HOSTNAME_LENGTH+USERNAME_LENGTH+2]; int old_row_exists = 1; int error=0; ulong store_table_rights, store_col_rights; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index d9f2b9ca70d..7caf75b6639 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -496,6 +496,7 @@ check_connections(THD *thd) { vio_in_addr(net->vio,&thd->remote.sin_addr); thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors); + thd->host[strnlen(thd->host, HOSTNAME_LENGTH)]= 0; if (connect_errors > max_connect_errors) return(ER_HOST_IS_BLOCKED); } @@ -512,6 +513,7 @@ check_connections(THD *thd) thd->ip=0; bzero((char*) &thd->remote,sizeof(struct sockaddr)); } + /* Ensure that wrong hostnames doesn't cause buffer overflows */ vio_keepalive(net->vio, TRUE); ulong pkt_len=0; From 0874356edb575c880615131d3314af5b7ee83f29 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Dec 2002 11:52:49 +0400 Subject: [PATCH 093/220] GIS doc --- Docs/gis.txt | 861 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 861 insertions(+) create mode 100644 Docs/gis.txt diff --git a/Docs/gis.txt b/Docs/gis.txt new file mode 100644 index 00000000000..d80a200d5a6 --- /dev/null +++ b/Docs/gis.txt @@ -0,0 +1,861 @@ + + OpenGIS support in MySQL + +------------------------------------------------------------------------ +Note: Blue colored lines among the text is features not implemented yet. +They are: + + * Spatial Reference Systems and their IDs (SRIDs) related things: + o Functions like Length() and Area() assume planar coordinate + system. + o All objects are currently considered to be in the same + planar coordinate system. + * Function Length() on LineString and MultiLineString currently + should be called as GLength(). +* No binary constructors like GeomFromWKB(). + +We also have to add "PostGIS compatibility" sections. + + + 1 Introduction + +MySQL implements a subset of *SQL2 with Geometry Types* environment +proposed by OpenGIS consortium's *Simple Features Specification For +SQL*. In this environment a geometry-valued column is implemented as a +column whose SQL type is drawn from the set of Geometry Types. SQL +server supports both textual and binary access to geometry. + + + 2 OpenGIS Geometry Model in MySQL + +MySQL supports the Open GIS Geometry Model based hierarcy of spatial +objects classes, which consists of: + + * Geometry + o *Point* + o Curve + + *LineString* + o Surface + + *Polygon* + o *GeometryCollection* + + *MultiPoint* + + MultiCurve + # *MultiLineString* + + MultiSurface + # *MultiPolygon* + +The base *Geometry* class has subclasses for Point, Curve, Surface and +GeometryCollection. + +Geometry, Curve, Surface, MultiCurve and MultiSurface are defined to be +non-instantiable classes, it is not possible to create an object of +these classes. + +Point, LineString, Polygon, GeometryCollection, MultiPoint, +MultiLineString, MultiPolygon are instantiable classes (bolded on the +hierarcy tree). MySQL provides a number of functions to construct +instances of these classes. + +TODO: Each spatial object is associated with a Spatial Reference System, +which describes the coordinate space in which the geometric object is +defined. + + + 2.1 Geometry + +Geometry is the root class of the hierarchy. Geometry is an abstract +(non-instantiable) class. The instantiable subclasses of Geometry +defined in this specification are restricted to 0, 1 and two-dimensional +geometric objects that exist in two-dimensional coordinate space. All +instantiable geometry classes are defined so that valid instances of a +geometry class are topologically closed (i.e. all defined geometries +include their boundary). + + + 2.2 Point + +A *Point* is a 0-dimensional geometry and represents a single location +in coordinate space. A Point in the case of 2D has a x-coordinate value +and a y-coordinate value. In the case of more dimensions, a Point has a +coordinate value for each dimension. The boundary of a Point is the +empty set. + + + 2.3 Curve + +A *Curve* is a one-dimensional geometric object usually stored as a +sequence of points, with the subclass of Curve specifying the form of +the interpolation between points. MySQL implementation defines only one +subclass of Curve, LineString, which uses linear interpolation between +points. + +A Curve is simple if it does not pass through the same point twice. A +Curve is closed if its start point is equal to its end point. The +boundary of a closed Curve is empty. A Curve that is simple and closed +is a Ring. The boundary of a non-closed Curve consists of its two end +points. A Curve is defined as topologically closed. + + + 2.4 LineString, Line, LinearRing + +A LineString is a Curve with linear interpolation between points. Each +consecutive pair of points defines a line segment. A Line is a +LineString with exactly 2 points. A LinearRing is a LineString that is +both closed and simple. + + + 2.5 Surface + +A *Surface* is a two-dimensional geometric object. The OpenGIS Abstract +Specification defines a simple Surface as consisting of a single 'patch' +that is associated with one 'exterior boundary' and 0 or more 'interior' +boundaries. Simple surfaces in three-dimensional space are isomorphic to +planar surfaces. Polyhedral surfaces are formed by 'stitching' together +simple surfaces along their boundaries, polyhedral surfaces in +three-dimensional space may not be planar as a whole. + +The boundary of a simple Surface is the set of closed curves +corresponding to its exterior and interior boundaries. + +The only instantiable subclass of Surface defined in this specification, +Polygon, is a simple Surface that is planar. + + + 2.6 Polygon + +A Polygon is a planar Surface, defined by 1 exterior boundary and 0 or +more interior boundaries. Each interior boundary defines a hole in the +Polygon. The assertions for polygons (the rules that define valid +polygons) are: + + * Polygons are topologically closed. + * The boundary of a Polygon consists of a set of LinearRings (i.e. + LineStrings which are both simple and closed) that make up its + exterior and interior boundaries. + * No two rings in the boundary cross, the rings in the boundary of a + Polygon may intersect at a Point but only as a tangent. + * A Polygon may not have cut lines, spikes or punctures. + * The Interior of every Polygon is a connected point set. + * The Exterior of a Polygon with 1 or more holes is not connected. +Each hole defines a connected component of the Exterior. + +In the above assertions, Interior, Closure and Exterior have the +standard topological definitions. The combination of 1 and 3 make a +Polygon a Regular Closed point set. Polygons are simple geometries. + + + 2.6 GeometryCollection + +A *GeometryCollection* is a geometry that is a collection of 1 or more +geometries of any class. All the elements in a GeometryCollection must +be in the same Spatial Reference (i.e. in the same coordinate system). +GeometryCollection places no other constraints on its elements. However +subclasses of GeometryCollection described below may restrict membership +based on dimension and may also place other constraints on the degree of +spatial overlap between elements. + + + 2.7 MultiPoint + +A *MultiPoint* is a 0 dimensional geometric collection. The elements of +a MultiPoint are restricted to Points. The points are not connected or +ordered. A MultiPoint is simple if no two Points in the MultiPoint are +equal (have identical coordinate values). The boundary of a MultiPoint +is the empty set. + + + 2.8 MultiCurve + +A MultiCurve is a one-dimensional geometry collection whose elements are +Curves. MultiCurve is a non-instantiable class, it defines a set of +methods for its subclasses and is included for reasons of extensibility. + +A MultiCurve is simple if and only if all of its elements are simple, +the only intersections between any two elements occur at points that are +on the boundaries of both elements. + +The boundary of a MultiCurve is obtained by applying the "mod 2 union +rule": A point is in the boundary of a MultiCurve if it is in the +boundaries of an odd number of elements of the MultiCurve. + +A MultiCurve is closed if all of its elements are closed. The boundary +of a closed MultiCurve is always empty. A MultiCurve is defined as +topologically closed. + + + 2.9 MultiLineString + +A *MultiLineString* is a MultiCurve whose elements are LineStrings. + + + 2.10 MultiSurface + +A MultiSurface is a two-dimensional geometric collection whose elements +are surfaces. The interiors of any two surfaces in a MultiSurface may +not intersect. The boundaries of any two elements in a MultiSurface may +intersect at most at a finite number of points. + +MultiSurface is a non-instantiable class in this specification, it +defines a set of methods for its subclasses and is included for reasons +of extensibility. The instantiable subclass of MultiSurface is +MultiPolygon, corresponding to a collection of Polygons. + + + 2.11 MultiPolygon + +A MultiPolygon is a MultiSurface whose elements are Polygons. + +The assertions for MultiPolygons are : + + * The interiors of 2 Polygons that are elements of a MultiPolygon + may not intersect. + * The Boundaries of any 2 Polygons that are elements of a + MultiPolygon may not cross and may touch at only a finite number + of points. (Note that crossing is prevented by assertion 1 above). + * A MultiPolygon is defined as topologically closed. + * A MultiPolygon may not have cut lines, spikes or punctures, a + MultiPolygon is a Regular, Closed point set. + * The interior of a MultiPolygon with more than 1 Polygon is not + connected, the number of connected components of the interior of a +MultiPolygon is equal to the number of Polygons in the MultiPolygon. + +The boundary of a MultiPolygon is a set of closed curves (LineStrings) +corresponding to the boundaries of its element Polygons. Each Curve in +the boundary of the MultiPolygon is in the boundary of exactly 1 element +Polygon, and every Curve in the boundary of an element Polygon is in the +boundary of the MultiPolygon. + + + 3 Exchange of spatial data + +MySQL provides binary and textual mechanismes to exchange spatial data. +Exchange is provided via so called Well Known Binary (WKB) and Well +Known Textual (WKT) representations of spatial data proposed by OpenGIS +specifications. + + + 3.1 Well-known Text representation (WKT) + +The Well-known Text (WKT) representation of Geometry is designed to +exchange geometry data in textual format. + +WKT is defined below in Bechus-Naur forms: + + * the notation {}* denotes 0 or more repetitions of the tokens + within the braces; +* the braces do not appear in the output token list. + +The text representation of the implemented instantiable geometric types +conforms to this grammar: + + := + + | + | + | + | + | + | + + := + + POINT + + := + + LINESTRING + + := + + POLYGON + + := + + MULTIPOINT + + := + + MULTILINESTRING + + := + + MULTIPOLYGON + + := + + GEOMETRYCOLLECTION + + := EMPTY | ( ) + + := + + := double precision literal + + := double precision literal + + := EMPTY + + | ( {, }* ) + + := EMPTY + + | ( {, < LineString Text > }*) + + := EMPTY + + | ( {, }* ) + + := EMPTY + + | ( {, < LineString Text > }* ) + + := EMPTY + + | ( < Polygon Text > {, < Polygon Text > }* ) + + := EMPTY + + | ( {, }* ) + + + WKT examples + +Examples of textual representations of Geometry objects are shown below: + + * |POINT(10 10)| - a Point + * |LINESTRING( 10 10, 20 20, 30 40)| - a LineString with three points + * |POLYGON((10 10, 10 20, 20 20,20 15, 10 10))| - a Polygon with one + exterior ring and 0 interior rings + * |MULTIPOINT(10 10, 20 20)| - a MultiPoint with two Points + * |MULTILINESTRING((10 10, 20 20), (15 15, 30 15))| - a + MultiLineString with two LineStrings + * |MULTIPOLYGON(((10 10, 10 20, 20 20, 20 15, 10 10)), ((60 60, 70 + 70, 80 60, 60 60 ) ))| - a MultiPolygon with two Polygons + * |GEOMETRYCOLLECTION( POINT (10 10),POINT (30 30), LINESTRING (15 + 15, 20 20))| - a GeometryCollection consisting of two Points and +one LineString + + + 3.2 Well-known Binary representation (WKB) + +Well Known Binary Representations is proposed by OpenGIS specifications +to exchange geometry data in binary format. This is WKB description: + +// Basic Type definitions +// byte : 1 byte +// uint32 : 32 bit unsigned integer (4 bytes) +// double : double precision number (8 bytes) +// Building Blocks : Point, LinearRing + +Point { + double [numDimentions]; +}; + +LinearRing { + uint32 numPoints; + Point points[numPoints]; +} + +enum wkbGeometryType { + wkbPoint = 1, + wkbLineString = 2, + wkbPolygon = 3, + wkbMultiPoint = 4, + wkbMultiLineString = 5, + wkbMultiPolygon = 6, + wkbGeometryCollection = 7 +}; + +enum wkbByteOrder { + wkbXDR = 0, // Big Endian + wkbNDR = 1 // Little Endian +}; + +WKBPoint { + byte byteOrder; + uint32 wkbType; // 1 + Point point; +} + +WKBLineString { + byte byteOrder; + uint32 wkbType; // 2 + uint32 numPoints; + Point points[numPoints]; +} + +WKBPolygon { + byte byteOrder; + uint32 wkbType; // 3 + uint32 numRings; + LinearRing rings[numRings]; +} + +WKBMultiPoint { + byte byteOrder; + uint32 wkbType; // 4 + uint32 num_wkbPoints; + WKBPoint WKBPoints[num_wkbPoints]; +} + +WKBMultiLineString { + byte byteOrder; + uint32 wkbType; // 5 + uint32 num_wkbLineStrings; + WKBLineString WKBLineStrings[num_wkbLineStrings]; +} + +wkbMultiPolygon { + byte byteOrder; + uint32 wkbType; // 6 + uint32 num_wkbPolygons; + WKBPolygon wkbPolygons[num_wkbPolygons]; +} + +WKBGeometry { + union { + WKBPoint point; + WKBLineString linestring; + WKBPolygon polygon; + WKBGeometryCollection collection; + WKBMultiPoint mpoint; + WKBMultiLineString mlinestring; + WKBMultiPolygon mpolygon; + } + +}; + +WKBGeometryCollection { + byte byte_order; + uint32 wkbType; // 7 + uint32 num_wkbGeometries; + WKBGeometry wkbGeometries[num_wkbGeometries]; +} + + + 3.3 MySQL data types for spatial objects + +MySQL implementation of OpenGIS provides the *GEOMETRY* data type to be +used in CREATE TABLE statements. For example, this statement creates a +table *geom* with spatial field *g*: + +CREATE TABLE geom ( + g Geometry; +); + +A field of *GEOMETRY* type can store a spatial objects of any OpenGIS +geometry class described above. + + + 3.4 Internal spatial data representation + +Internally (in *.MYD* files) spatial objects are stored in *WKB*, +combined with object's *SRID* (a numeric ID of Spatial Reference System +object associated with). During spatial analysis, for example, +calculating the fact that one object crosses another one, only those +with the same *SRID* are accepted. + +*SRID* may affect a way in which various spatial characteristics are +calculated. For example, in different coordinate systems distance +between two objects may differ even objects have the same coordinates, +like distance on plane coordinate system and distance on geocentric +(coordinates on Earth surface) systems are different things. + +There is a plan to provide a number of commonly used coordinate systems +in MySQL OpenGIS implementation. + + + 3.5 INSERTing spatial objects + +Spatial data can be INSERTed using a spatial constructor. The term +*spatial constructor* is used in this manual to refer to any function +which can construct a value of GEOMETRY type, i.e. an internal MySQL +representation of spatial data. + + + 3.5.1 Textual spatial constructors + +Textual spatial constructors take a gemometry description in WKT and +built GEOMETRY value. + + * |*GeomFromText(geometryTaggedText String [, SRID + Integer]):Geometry *| - constructs a Geometry value from its + well-known textual representation. + + |*GeomFromText()*| function accepts a WKT of any Geometry class as + it's first argument. + + For construction of Geometry values restricted to a particular + subclass, an implementation also provides a class-specific + construction function for each instantiable subtype as described + in the list below: + + * |*PointFromText(pointTaggedText String [,SRID Integer]):Point *| - + constructs a Point + + * |*LineFromText(lineStringTaggedText String [,SRID + Integer]):LineString *| - constructs a LineString + + * |*PolyFromText(polygonTaggedText String [,SRID Integer]):Polygon + *|- constructs a Polygon + + * |*MPointFromText(multiPointTaggedText String [,SRID + Integer]):MultiPoint *| - constructs a MultiPoint + + * |*MLineFromText(multiLineStringTaggedText String [,SRID + Integer]):MultiLineString *| - constructs a MultiLineString + + * |*MPolyFromText(multiPolygonTaggedText String [,SRID + Integer]):MultiPolygon *| - constructs a MultiPolygon + + * |*GeomCollFromText(geometryCollectionTaggedText String [,SRID + Integer]):GeomCollection *| - constructs a GeometryCollection + +Usage examples: + +INSERT INTO geom VALUES (GeomFromText('POINT(1 1)')) +INSERT INTO geom VALUES (GeomFromText('LINESTRING(0 0,1 1,2 2)')) +INSERT INTO geom VALUES (GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))')) +INSERT INTO geom VALUES (GeomFromText('GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1,2 2,3 3,4 4))')) + +The second argument of spatial constructirs, described above, is +currently ignored, It will be used to specify SRID in the future. +Nowdays, it is added for reasons of compatibility with OpenGIS +specifications and PostGIS implementation. + +As an optional feature, an implementation may also support building of +Polygon or MultiPolygon values given an arbitrary collection of possibly +intersecting rings or closed LineString values. Implementations that +support this feature should include the following functions: + + * |*BdPolyFromText(multiLineStringTaggedText String, SRID + Integer):Polygon *| - constructs a Polygon given an arbitrary + collection of closed linestrings as a MultiLineString text + representation. + * |*BdMPolyFromText(multiLineStringTaggedText String, SRID + Integer):MultiPolygon *| - constructs a MultiPolygon given an + arbitrary collection of closed linestrings as a MultiLineString +text representation. + + + 3.5.2 Binary spatial constructors + + * |*GeomFromWKB(WKBGeometry Binary, SRID Integer):Geometry *| - + constructs a Geometry value given its well-known binary + representation. + + |*GeomFromWKB()*| function can accept in it's first argument a WKB + of Geometry of any class. For construction of Geometry values + restricted to a particular subclass, an implementation also + provides a class-specific construction function for each + instantiable subclass as described in the list below: + + * |*PointFromWKB(WKBPoint Binary, SRID Integer):Point - *|constructs + a Point + * |* LineFromWKB(WKBLineString Binary, SRID Integer):LineString *| - + constructs a LineString + * |* PolyFromWKB(WKBPolygon Binary, SRID Integer):Polygon *| - + constructs a Polygon + * |* MPointFromWKB(WKBMultiPoint Binary, SRID Integer):MultiPoint *| + - constructs a MultiPoint + * |* MLineFromWKB(WKBMultiLineString Binary, SRID + Integer):MultiLineString *| - constructs a MultiLineString + * |* MPolyFromWKB(WKBMultiPolygon Binary, SRID Integer): + MultiPolygon *| - constructs a MultiPolygon + * |* GeomCollFromWKB(WKBGeometryCollection Binary, SRID Integer): +GeomCollection *| - constructs a GeometryCollection + +As an optional feature, an implementation may also support the uilding' +of Polygon or MultiPolygon values given an arbitrary collection of +possibly intersecting rings or closed LineString values. Implementations +that support this feature should include the following functions: + + * |* BdPolyFromWKB (WKBMultiLineString Binary,SRID Integer): Polygon + *| - constructs a Polygon given an arbitrary collection of closed + linestrings as a MultiLineString binary representation. + * |*BdMPolyFromWKB(WKBMultiLineString Binary, SRID + Integer):MultiPolygon *| - constructs a MultiPolygon given an + arbitrary collection of closed linestrings as a MultiLineString +binary representation. + +Inserting in *WKB* assumes that |GeomFromWKB()| function argument +contains a buffer with a correctly formed spatial object in WKB. In ODBC +applications it can be done using binding of argument. One also can +insert object in *WKB* using |mysql_escape_string()| in |libmysqlclient| +applications. + +For example: + +INSERT INTO geom VALUES (GeomFromWKB(buf,SRID)); + +where |buf| is a binary buffer with a spatial object in *WKB* +representation. + + + 3.5 SELECTing spatial objects + +Spatial objects are selected either in *WKT* or *WKB* representation by +use of AsText() and AsBinary() functions correspondently. + + +mysql> select AsText(g) as g from geom; ++-------------------------+ +| g | ++-------------------------+ +| POINT(1 1) | +| LINESTRING(0 0,1 1,2 2) | ++-------------------------+ +2 rows in set (0.00 sec) + +mysql> + +The query: + +SELECT AsBinary(g) FROM geom + +returns a BLOB which contains *WKB* representation of object. + + + 4 Functions for spatial analysis + + + 4.1 Basic functions on Geometry + + * |*AsText(g:Geometry):String*| - Exports this Geometry to a + specific well-known text representation of Geometry. + * |*AsBinary(g:Geometry):Binary*| - Exports this Geometry to a + specific well-known binary representation of Geometry. + * |*GeometryType(g:Geometry):String*| - Returns the name of the + instantiable subtype of Geometry of which this Geometry instance + is a member. The name of the instantiable subtype of Geometry is + returned as a string. + * |*Dimension(g:Geometry):Integer*| - The inherent dimension of this + Geometry object, which must be less than or equal to the + coordinate dimension. This specification is restricted to + geometries in two-dimensional coordinate space. + * |*IsEmpty(g:Geometry):Integer*| - Returns 1 (TRUE) if this + Geometry is the empty geometry . If true, then this Geometry + represents the empty point set, , for the coordinate space. + * |*IsSimple(g:Geometry):Integer *| - Returns 1 (TRUE) if this + Geometry has no anomalous geometric points, such as self + intersection or self tangency. The description of each + instantiable geometric class includes the specific conditions that + cause an instance of that class to be classified as not simple. + * |*SRID(g:Geometry):Integer*| - Returns the Spatial Reference + System ID for this Geometry. + * |*Distance(g1:Geometry,g2:Geometry):Double*| - the shortest +distance between any two points in the two geometries. + + + 4.2 Functions for specific geometry type + + + GeometryCollection functions + + * *NumGeometries(g:GeometryCollection ):Integer * -Returns the + number of geometries in this GeometryCollection. + * *GeometryN(g:GeometryCollection,N:integer):Geometry * -Returns the +Nth geometry in this GeometryCollection. + + + Point functions + + * *X(p:Point):Double* -The x-coordinate value for this Point. +* *Y(p:Point):Double* -The y-coordinate value for this Point. + + + LineString functions + + * *StartPoint(l:LineString):Point* The start point of this LineString. + * *EndPoint(l:LineString):Point* The end point of this LineString. + * *PointN(l:LineString,N:Integer):Point* Returns the specified point + N in this Linestring. + * *Length(l:LineString):Double* The length of this LineString in its + associated spatial reference. + * *IsRing(l:LineString):Integer* Returns 1 (TRUE) if this LineString + is closed (StartPoint ( ) = EndPoint ( )) and this LineString is + simple (does not pass through the same point more than once). + * *IsClosed(l:LineString):Integer* Returns 1 (TRUE) if this + LineString is closed (StartPoint ( ) = EndPoint ( )). + * *NumPoints(l:LineString):Integer* The number of points in this +LineString. + + + MultiLineString functions + + * *Length(m:MultiLineString):Double* The Length of this + MultiLineString which is equal to the sum of the lengths of the + elements. + * *IsClosed(m:MultiLineString):Integer* Returns 1 (TRUE) if this + MultiLineString is closed (StartPoint() = EndPoint() for each +LineString in this MultiLineString) + + + Polygon functions + + * *Area(p:Polygon):Double* The area of this Polygon, as measured in + the spatial reference system of this Polygon. + * *Centroid(p:Polygon):Point* The mathematical centroid for this + Polygon as a Point. The result is not guaranteed to be on this + Polygon. + * *PointOnSurface(p:Polygon):Point* A point guaranteed to be on this + Polygon. + * *NumInteriorRing(p:Polygon):Integer* Returns the number of + interior rings in this Polygon. + * *ExteriorRing(p:Polygon):LineString* Returns the exterior ring of + this Polygon as a LineString. + * *InteriorRingN(p:Polygon,N:Integer):LineString* Returns the Nth +interior ring for this Polygon as a LineString. + + + MultiPolygon functions + + * *Area(m:MultuSurface):Double* The area of this MultiPolygon, as + measured in the spatial reference system of this MultiPolygon. + * *Centroid(m:MultyPolygon):Point* The mathematical centroid for + this MultiPolygon as a Point. The result is not guaranteed to be + on this MultiPolygon. + * *PointOnSurface(m:MultuPolygon):Point* A Point guaranteed to be on +this MultiPolygon. + +Notes: /functions for specific geometry type retrun NULL if passed +object type is incorrect. For example Area() returns NULL if object type +is neither Polygon nor MultiPolygon/ + + + 4.3 Spatial operations (compound spatial constructors) + + * |*Envelope(g:Geometry):Geometry*|The minimum bounding box for this + Geometry, returned as a Geometry. The polygon is defined by the + corner points of the bounding box + |POLYGON((MINX,MINY),(MAXX,MINY),(MAXX,MAXY),(MINX,MAXY),(MINX,MINY))|. + + * |*Boundary(g:Geometry):Geometry*| - returns the closure of the + combinatorial boundary of this Geometry. + * |*Intersection(g1,g2:Geometry):Geometry*| - a geometry that + represents the point set intersection of g1 with g2. + * |*Union(g1,g2:Geometry):Geometry*| - a geometry that represents + the point set union of g1 with g2. + * |*Difference(g1,g2:Geometry):Geometry*| - a geometry that + represents the point set difference of g1 with g2. + * |*SymDifference(g1,g2:Geometry):Geometry*| - a geometry that + represents the point set symmetric difference of g1 with g2. + * |*Buffer(g:Geometry,distance:Double):Geometry*| - a geometry that + represents all points whose distance from g is less than or equal + to distance. + * |*ConvexHull(g:Geometry):Geometry*| - a geometry that represents +the convex hull of g. + + + 4.4 Functions for testing Spatial Relations between geometric objects + + * |*Equals(g1,g2)*| - Returns 1 if g1 is spatially equal to g2. + * |*Disjoint(g1,g2)*| - Returns 1 if g1 is spatially disjoint from g2. + * |*Intersects(g1,g2)*| - Returns 1 if g1 spatially intersects g2. + * |*Touches(g1,g2)*| - Returns 1 if g1 spatially touches g2. + * |*Crosses(g1,g2)*| - Returns 1 if g1 spatially crosses g2. + * |*Within(g1,g2)*| - Returns 1 if g1 is spatially within g2. + * |*Contains(g1,g2)*| - Returns 1 if g1 spatially contains g2. +* |*Overlaps(g1,g2)*| - Returns 1 if g1 spatially overlaps g2. + + + 5 Optimizing spatial analysis + + + 5.1 MBR + +MBR is a minimal bounding rectangle (box) for spatial object. It can be +represented as a set of min and max values of each dimension. + +For example: + +(Xmin,Xmax,Ymin,Ymax) + + + 5.2 Using SPATIAL indexes + +To optimize spatial object relationships analysis it is possible to +create a spatial index on geometry field using R-tree algorythm. R-tree +based spatial indexes store MBRs of spatial objects as a key values. + +CREATE SPATIAL INDEX gind ON geom (g); + +Or together with table definition: + +CREATE TABLE geom ( + g GEOMETRY, + SPATIAL INDEX(g) +); + +Optimizer attaches R-tree based SPATIAL index when a query with spatial +objects relationship functions is executed in WHERE clause. + +For example: + +SELECT geom.name FROM geom + WHERE Within(geom.g,GeomFromText('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))',SRID)); + + + 8 OpenGIS extensions implemented in MySQL + +MySQL provides it's own constructors to build geometry objects: + + * |*Point(double,double,SRID)*| - constructs a geometry of Point + class using it's coordinates and SRID. + * |*MultiPoint(Point,Point,...,Point)*| - constructs a MultiPoint + using Points. When any argument is not a geometry of Point class + the return value is NULL. + * |*LineString(Point,Point,...,Point)*| - constructs a LineString + from a number of Points. When any argument is not a geometry of + Point class the return value is NULL. When the number of Points is + less than two the return value is NULL. + * |*MultiLineString(LineString,LineString,...,LineString)*| - + constructs a MultiLineString using using LineStrings. When any + argument is not a geometry of LineStringClass return value is NULL. + * |*Polygon(LineString,LineString,...,LineString)*| - constructs a + Polygon from a number of LineStrings. When any argument is not a + LinearRing (i.e. not closed and simple geometry of class + LineString) the return value is NULL. + * |*MultiPolygon(Polygon,Polygon,...,Polygon)*| - constructs a + MultiPolygon from a set of Polygons. When any argument is not a + Polygon, the rerurn value is NULL. + * |*GeometryCollection(Geometry,Geometry,..,Geometry)*| - constucts + a GeometryCollection. When any argument is not a valid geometry +object of any instantiable class, the return value is NULL. + +The above functions (except Point()) return NULL if arguments are not in +the same spatial reference system (i.e. have different SRIDs). + + + Examples: + +INSERT INTO geom SELECT Point(x,y,SRID) FROM coords; +SELECT AsText(g) FROM geom WHERE + Contains(Polygon(LineString(Point(0,0),Point(0,1),Point(1,1),Point(1,0),Point(0,0)),SRID),geom.g); + + + 9 Things that differ in MySQL implemention and OpenGIS specifications + + + 9.1 Single GEOMETRY type + +Besides a GEOMETRY type, OpenGIS consortium specifications suggest the +implementation of several spatial field types correspondent to every +instansiable object subclass. For example a *Point* type is proposed to +restrict data stored in a field of this type to only Point OpenGIS +subclass. MySQL provides an implementation of single GEOMETRY type which +doesn't restrict objects to certain OpenGIS subclass. + + + 9.2 No additional Metadata Views + +OpenGIS specifications propose several additional metadata views. For +example, a system view named GEOMETRY_COLUMNS contains a description of +geometry columns, one row for each geometry column in the database. + + + 9.3 No functions to add/drop spatial columns + +OpenGIS assumes that columns can be added/dropped using +AddGeometryColumn() and DropGeometryColumn() functions correspondently. +In MySQL implementation one should use ALTER TABLE instead. From 22bbe44fd0062a213318f2e9d11a15eed6c16bdc Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Dec 2002 18:13:32 +0200 Subject: [PATCH 094/220] Removed ^M Reported by Georg Richter as it brokes his build with mipspro client/mysqlimport.c: Removed ^M client/mysqlshow.c: Removed ^M BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + client/mysqlimport.c | 2 +- client/mysqlshow.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 79637c24d10..697a3541769 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -69,6 +69,7 @@ ram@gw.udmsearch.izhnet.ru ram@mysql.r18.ru ram@ram.(none) root@x3.internalnet +salle@banica.(none) salle@geopard.(none) salle@geopard.online.bg sasha@mysql.sashanet.com diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 2de4a9b81b5..408a5873589 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -117,7 +117,7 @@ static struct my_option my_long_options[] = {"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port, (gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0}, - {"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory)", + {"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory)", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"replace", 'r', "If duplicate unique key was found, replace old row.", (gptr*) &replace, (gptr*) &replace, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/client/mysqlshow.c b/client/mysqlshow.c index df624a02c55..e6e21f177ef 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -179,7 +179,7 @@ static struct my_option my_long_options[] = {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory)", + {"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory)", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_SMEM {"shared_memory_base_name", OPT_SHARED_MEMORY_BASE_NAME, From 3db50925c70d3757f04d8fa0a1a9a02d471c4a47 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Dec 2002 19:47:23 +0300 Subject: [PATCH 095/220] SCRUM Add optional second parameter to password() function. It can be used to force password() to return fixed values. mysql-test/r/func_crypt.result: New test results mysql-test/t/func_crypt.test: new tests sql/item_strfunc.cc: Add optional second argument to password() function sql/item_strfunc.h: New method sql/sql_yacc.yy: Handling of password with 2 arguments --- mysql-test/r/func_crypt.result | 11 +++++++- mysql-test/t/func_crypt.test | 7 ++++- sql/item_strfunc.cc | 48 +++++++++++++++++++++++++++++----- sql/item_strfunc.h | 1 + sql/sql_yacc.yy | 6 ++--- 5 files changed, 61 insertions(+), 12 deletions(-) diff --git a/mysql-test/r/func_crypt.result b/mysql-test/r/func_crypt.result index ad3a64ccd1d..461ae1e7e09 100644 --- a/mysql-test/r/func_crypt.result +++ b/mysql-test/r/func_crypt.result @@ -1,6 +1,15 @@ select length(encrypt('foo', 'ff')) <> 0; length(encrypt('foo', 'ff')) <> 0 1 -select old_password('test'),length(password("1")),length(encrypt('test')),encrypt('test','aa'); +select password("a",""), password("a",NULL), password("","a"), password(NULL,"a"); +password("a","") password("a",NULL) password("","a") password(NULL,"a") +*2517f7235d68d4ba2e5019c93420523101157a792c01 NULL NULL +select password("aaaaaaaaaaaaaaaa","a"), password("a","aaaaaaaaaaaaaaaa"); +password("aaaaaaaaaaaaaaaa","a") password("a","aaaaaaaaaaaaaaaa") +*2cd3b9a44e9a9994789a30f935c92f45a96c5472f381 *37c7c5c794ff144819f2531bf03c57772cd84e40db09 +select old_password('test'), length(password("1")), length(encrypt('test')), encrypt('test','aa'); old_password('test') length(password("1")) length(encrypt('test')) encrypt('test','aa') 378b243e220ca493 45 13 aaqPiZY5xR5l. +select old_password(""), old_password(NULL), password(""), password(NULL); +old_password("") old_password(NULL) password("") password(NULL) + NULL NULL diff --git a/mysql-test/t/func_crypt.test b/mysql-test/t/func_crypt.test index 812bdade39f..af0ef661d06 100644 --- a/mysql-test/t/func_crypt.test +++ b/mysql-test/t/func_crypt.test @@ -1,3 +1,8 @@ select length(encrypt('foo', 'ff')) <> 0; --replace_result $1$aa$4OSUA5cjdx0RUQ08opV27/ aaqPiZY5xR5l. -select old_password('test'),length(password("1")),length(encrypt('test')),encrypt('test','aa'); + +# Test new and old password handling functions +select password("a",""), password("a",NULL), password("","a"), password(NULL,"a"); +select password("aaaaaaaaaaaaaaaa","a"), password("a","aaaaaaaaaaaaaaaa"); +select old_password('test'), length(password("1")), length(encrypt('test')), encrypt('test','aa'); +select old_password(""), old_password(NULL), password(""), password(NULL); diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 78689bb3044..17112e18456 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1271,18 +1271,52 @@ String *Item_func_trim::val_str(String *str) return &tmp_value; } +/* + Password() function can have 2 args now. Second argument can be used + to make results repeatable +*/ String *Item_func_password::val_str(String *str) { - String *res =args[0]->val_str(str); + struct rand_struct rand_st; // local structure for 2 param version + ulong seed=0; // seed to initialise random generator to + if ((null_value=args[0]->null_value)) return 0; - if (res->length() == 0) - return &empty_string; - make_scrambled_password(tmp_value,res->c_ptr(),opt_old_passwords, - ¤t_thd->rand); - str->set(tmp_value,get_password_length(opt_old_passwords),res->charset()); - return str; + + if (arg_count == 1) + { + String *res =args[0]->val_str(str); + if (res->length() == 0) + return &empty_string; + make_scrambled_password(tmp_value,res->c_ptr(),opt_old_passwords, + ¤t_thd->rand); + str->set(tmp_value,get_password_length(opt_old_passwords),res->charset()); + return str; + } + else + { + /* Check second argument for NULL value. First one is already checked */ + if ((null_value=args[1]->null_value)) + return 0; + /* Generate the seed first this allows to avoid double allocation */ + char* seed_ptr=args[1]->val_str(str)->c_ptr(); + while (*seed_ptr) + { + seed=seed*211+*seed_ptr; /* Use simple hashing */ + seed_ptr++; + } + /* Use constants which allow nice random values even with small seed */ + randominit(&rand_st,seed*111111+33333333L,seed*1111+55555555L); + + String *res =args[0]->val_str(str); + if (res->length() == 0) + return &empty_string; + make_scrambled_password(tmp_value,res->c_ptr(),opt_old_passwords, + &rand_st); + str->set(tmp_value,get_password_length(opt_old_passwords),res->charset()); + return str; + } } String *Item_func_old_password::val_str(String *str) diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index c8706c2c933..e11cde52a88 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -257,6 +257,7 @@ class Item_func_password :public Item_str_func char tmp_value[64]; /* This should be enough for new password format */ public: Item_func_password(Item *a) :Item_str_func(a) {} + Item_func_password(Item *a, Item *b) :Item_str_func(a,b) {} String *val_str(String *); void fix_length_and_dec() { max_length = get_password_length(opt_old_passwords); } const char *func_name() const { return "password"; } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 55f165c0739..b720c9ed4b8 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2201,9 +2201,9 @@ simple_expr: | NOW_SYM '(' expr ')' { $$= new Item_func_now($3); Lex->safe_to_cache_query=0;} | PASSWORD '(' expr ')' - { - $$= new Item_func_password($3); - } + { $$= new Item_func_password($3); } + | PASSWORD '(' expr ',' expr ')' + { $$= new Item_func_password($3,$5); } | POINTFROMTEXT '(' expr ')' { $$= new Item_func_geometry_from_text($3); } | POINTFROMTEXT '(' expr ',' expr ')' From d201a34e8ceea3911fa3d358863719e85a635875 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Dec 2002 21:19:25 +0200 Subject: [PATCH 096/220] postreview fix --- sql/item_subselect.cc | 12 +++++++++--- sql/item_subselect.h | 11 +++++------ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 65c942a75ce..7028147067e 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -180,6 +180,7 @@ void Item_singlerow_subselect::fix_length_and_dec() engine->fix_length_and_dec(row); value= *row; } + maybe_null= engine->may_be_null(); } uint Item_singlerow_subselect::cols() @@ -663,7 +664,7 @@ int subselect_union_engine::prepare() } static Item_result set_row(SELECT_LEX *select_lex, Item * item, - Item_cache **row) + Item_cache **row, bool *maybe_null) { Item_result res_type= STRING_RESULT; Item *sel_item; @@ -673,6 +674,7 @@ static Item_result set_row(SELECT_LEX *select_lex, Item * item, item->max_length= sel_item->max_length; res_type= sel_item->result_type(); item->decimals= sel_item->decimals; + *maybe_null= sel_item->maybe_null; if (row) { if (!(row[i]= Item_cache::get_cache(res_type))) @@ -692,7 +694,9 @@ static Item_result set_row(SELECT_LEX *select_lex, Item * item, void subselect_single_select_engine::fix_length_and_dec(Item_cache **row) { DBUG_ASSERT(row || select_lex->item_list.elements==1); - res_type= set_row(select_lex, item, row); + res_type= set_row(select_lex, item, row, &maybe_null); + if (cols() != 1) + maybe_null= 0; } void subselect_union_engine::fix_length_and_dec(Item_cache **row) @@ -711,6 +715,7 @@ void subselect_union_engine::fix_length_and_dec(Item_cache **row) mlen= len; if (!sel_item) sel_item= s_item; + maybe_null!= s_item->maybe_null; } item->max_length= mlen; res_type= sel_item->result_type(); @@ -729,7 +734,8 @@ void subselect_union_engine::fix_length_and_dec(Item_cache **row) else { SELECT_LEX *sl= unit->first_select(); - res_type= set_row(sl, item, row); + bool fake= 0; + res_type= set_row(sl, item, row, &fake); for(sl= sl->next_select(); sl; sl->next_select()) { List_iterator_fast li(sl->item_list); diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 6063730d6a8..41490dd2669 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -197,19 +197,15 @@ public: virtual void select_transformer(st_select_lex_unit *unit); }; -class subselect_engine +class subselect_engine: public Sql_alloc { protected: select_subselect *result; /* results storage class */ THD *thd; /* pointer to current THD */ Item_subselect *item; /* item, that use this engine */ enum Item_result res_type; /* type of results */ + bool maybe_null; /* may be null (first item in select) */ public: - static void *operator new(size_t size) - { - return (void*) sql_alloc((uint) size); - } - static void operator delete(void *ptr, size_t size) {} subselect_engine(THD *thd, Item_subselect *si, select_subselect *res) { @@ -217,7 +213,9 @@ public: item= si; this->thd= thd; res_type= STRING_RESULT; + maybe_null= 0; } + virtual ~subselect_engine() {}; // to satisfy compiler virtual int prepare()= 0; virtual void fix_length_and_dec(Item_cache** row)= 0; @@ -227,6 +225,7 @@ public: enum Item_result type() { return res_type; } virtual bool check_loop(uint id)= 0; virtual void exclude()= 0; + bool may_be_null() { return maybe_null; }; }; class subselect_single_select_engine: public subselect_engine From ae2a2981a57c7cd607114f8b17212154e0e32e2c Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 28 Dec 2002 02:17:16 +0500 Subject: [PATCH 097/220] 1) Add option (--verbose) that allows user switch on/off new logging in crash-me 2) Add new test: no_id_between, that indicates if NOT ID BETWEEN interprets as ID NOT BETWEEN sql-bench/crash-me.sh: 1) Add option (--verbose) that allows user switch on/off new logging in crash-me 2) Add new test: no_id_between, that indicates if NOT ID BETWEEN interprets as ID NOT BETWEEN --- sql-bench/crash-me.sh | 50 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/sql-bench/crash-me.sh b/sql-bench/crash-me.sh index adea23c5884..ea18431f8da 100644 --- a/sql-bench/crash-me.sh +++ b/sql-bench/crash-me.sh @@ -48,7 +48,7 @@ require "$pwd/server-cfg" || die "Can't read Configuration file: $!\n"; $opt_server="mysql"; $opt_host="localhost"; $opt_database="test"; $opt_dir="limits"; -$opt_user=$opt_password=""; +$opt_user=$opt_password="";$opt_verbose=""; $opt_debug=$opt_help=$opt_Information=$opt_restart=$opt_force=$opt_quick=0; $opt_log_all_queries=$opt_fix_limit_file=$opt_batch_mode=0; $opt_db_start_cmd=""; # the db server start command @@ -67,8 +67,8 @@ $retry_limit=3; GetOptions("Information","help","server=s","debug","user=s","password=s", "database=s","restart","force","quick","log-all-queries","comment=s", "host=s","fix-limit-file","dir=s","db-start-cmd=s","sleep=s","suffix=s", -"batch-mode","config-file=s","log-queries-to-file=s","check-server") - || usage(); +"batch-mode","config-file=s","log-queries-to-file=s","check-server", +"verbose!" => \$opt_verbose) || usage(); usage() if ($opt_help || $opt_Information); $opt_suffix = '-'.$opt_suffix if (length($opt_suffix) != 0); @@ -1375,7 +1375,6 @@ if ($limits{'type_sql_date'} eq 'yes') } } - # Test: WEEK() { my $resultat="no"; @@ -1496,6 +1495,36 @@ if ($limits{'type_sql_date'} eq 'yes') } +# NOT id BETWEEN a and b +if ($limits{'func_where_not_between'} eq 'yes') +{ + my $resultat = 'error'; + my $err; + my $key='not_id_between'; + my $prompt='NOT ID BETWEEN interprets as ID NOT BETWEEN'; + print "$prompt:"; + save_incomplete($key,$prompt); + safe_query_l($key,["create table crash_me_b (i int)", + "insert into crash_me_b values(2)", + "insert into crash_me_b values(5)"]); + $err =safe_query_result_l($key, + "select i from crash_me_b where not i between 1 and 3", + 5,0); + if ($err eq 1) { + if (not defined($last_result)) { + $resultat='no'; + }; + }; + if ( $err eq 0) { + $resultat = 'yes'; + }; + safe_query_l($key,["drop table crash_me_b"]); + save_config_data($key,$resultat,$prompt); + print "$resultat\n"; +}; + + + report("LIKE on numbers","like_with_number", "create table crash_q (a int,b int)", @@ -2740,7 +2769,7 @@ $0 takes the following options: --password='password' Password for the current user. - + --restart Save states during each limit tests. This will make it possible to continue by restarting with the same options if there is some bug in the DBI or @@ -2766,6 +2795,10 @@ $0 takes the following options: --sleep='time in seconds' (Default $opt_sleep) Wait this long before restarting server. +--verbose +--noverbose + Log into the result file queries performed for determination parameter value + EOF exit(0); } @@ -3615,6 +3648,11 @@ sub safe_query_result_l{ sub safe_query_result { +# result type can be +# 8 (must be empty), 2 (Any value), 0 (number) +# 1 (char, endspaces can differ), 3 (exact char), 4 (NULL) +# 5 (char with prefix), 6 (exact, errors are ignored) +# 7 (array of numbers) my ($query,$answer,$result_type)=@_; my ($sth,$row,$result,$retry); undef($last_result); @@ -3990,7 +4028,7 @@ sub add_log { my $key = shift; my $line = shift; - $log{$key} .= $line . "\n"; + $log{$key} .= $line . "\n" if ($opt_verbose);; } sub save_all_config_data From 3ab0ddc294891f31b65f92fb7af265047db15d52 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 28 Dec 2002 01:01:05 +0200 Subject: [PATCH 098/220] postreview fix (SCRUM) fixed layout sql/filesort.cc: fixed layout sql/gstream.cc: fixed layout sql/item.cc: postreview fix sql/item.h: postreview fix sql/item_cmpfunc.cc: postreview fix sql/item_cmpfunc.h: fixed layout sql/item_func.h: fixed layout sql/item_row.h: fixed layout sql/item_strfunc.cc: fixed layout sql/item_subselect.cc: postreview fix sql/item_subselect.h: postreview fix sql/nt_servc.cc: fixed layout sql/opt_range.cc: fixed layout sql/password.c: fixed layout sql/spatial.cc: fixed layout sql/sql_help.cc: fixed layout sql/sql_lex.cc: fixed layout sql/sql_olap.cc: fixed layout sql/sql_select.cc: fixed layout sql/sql_show.cc: fixed layout sql/sql_string.cc: fixed layout sql/sql_table.cc: fixed layout sql/stacktrace.c: fixed layout --- sql/filesort.cc | 2 +- sql/gstream.cc | 38 +++++++------- sql/item.cc | 32 ++++-------- sql/item.h | 6 +-- sql/item_cmpfunc.cc | 30 +---------- sql/item_cmpfunc.h | 4 +- sql/item_func.h | 2 +- sql/item_row.h | 2 +- sql/item_strfunc.cc | 6 +-- sql/item_subselect.cc | 113 ++++++++++++++---------------------------- sql/item_subselect.h | 13 ++--- sql/nt_servc.cc | 32 ++++++------ sql/opt_range.cc | 11 ++-- sql/password.c | 2 +- sql/spatial.cc | 6 +-- sql/sql_help.cc | 14 +++--- sql/sql_lex.cc | 6 +-- sql/sql_olap.cc | 12 ++--- sql/sql_select.cc | 2 +- sql/sql_show.cc | 4 +- sql/sql_string.cc | 2 +- sql/sql_table.cc | 2 +- sql/stacktrace.c | 6 +-- 23 files changed, 137 insertions(+), 210 deletions(-) diff --git a/sql/filesort.cc b/sql/filesort.cc index 8b55a2f4aa1..00ef12839cf 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -496,7 +496,7 @@ static void make_sortkey(register SORTPARAM *param, length=sort_field->length; } #ifdef USE_STRCOLL - if(use_strnxfrm(cs)) + if (use_strnxfrm(cs)) { if (item->binary()) { diff --git a/sql/gstream.cc b/sql/gstream.cc index 5a58fef6744..a97ed9cae03 100644 --- a/sql/gstream.cc +++ b/sql/gstream.cc @@ -3,36 +3,38 @@ int GTextReadStream::get_next_toc_type() const { const char *cur = m_cur; - while((*cur)&&(strchr(" \t\r\n",*cur))) + while ((*cur)&&(strchr(" \t\r\n",*cur))) { cur++; } - if(!(*cur)) + if (!(*cur)) { return eostream; } - if(((*cur>='a') && (*cur<='z')) || ((*cur>='A') && (*cur<='Z')) || (*cur=='_')) + if (((*cur>='a') && (*cur<='z')) || ((*cur>='A') && (*cur<='Z')) || + (*cur=='_')) { return word; } - if(((*cur>='0') && (*cur<='9')) || (*cur=='-') || (*cur=='+') || (*cur=='.')) + if (((*cur>='0') && (*cur<='9')) || (*cur=='-') || (*cur=='+') || + (*cur=='.')) { return numeric; } - if(*cur == '(') + if (*cur == '(') { return l_bra; } - if(*cur == ')') + if (*cur == ')') { return r_bra; } - if(*cur == ',') + if (*cur == ',') { return comma; } @@ -43,28 +45,28 @@ int GTextReadStream::get_next_toc_type() const const char *GTextReadStream::get_next_word(int *word_len) { const char *cur = m_cur; - while((*cur)&&(strchr(" \t\r\n",*cur))) + while ((*cur)&&(strchr(" \t\r\n",*cur))) { cur++; } m_last_text_position = cur; - if(!(*cur)) + if (!(*cur)) { return 0; } const char *wd_start = cur; - if(((*cur<'a') || (*cur>'z')) && ((*cur<'A') || (*cur>'Z')) && (*cur!='_')) + if (((*cur<'a') || (*cur>'z')) && ((*cur<'A') || (*cur>'Z')) && (*cur!='_')) { return NULL; } ++cur; - while(((*cur>='a') && (*cur<='z')) || ((*cur>='A') && (*cur<='Z')) || (*cur=='_') || - ((*cur>='0') && (*cur<='9'))) + while (((*cur>='a') && (*cur<='z')) || ((*cur>='A') && (*cur<='Z')) || + (*cur=='_') || ((*cur>='0') && (*cur<='9'))) { ++cur; } @@ -79,19 +81,19 @@ const char *GTextReadStream::get_next_word(int *word_len) int GTextReadStream::get_next_number(double *d) { const char *cur = m_cur; - while((*cur)&&(strchr(" \t\r\n",*cur))) + while ((*cur)&&(strchr(" \t\r\n",*cur))) { cur++; } m_last_text_position = cur; - if(!(*cur)) + if (!(*cur)) { set_error_msg("Numeric constant expected"); return 1; } - if(((*cur<'0') || (*cur>'9')) && (*cur!='-') && (*cur!='+') && (*cur!='.')) + if (((*cur<'0') || (*cur>'9')) && (*cur!='-') && (*cur!='+') && (*cur!='.')) { set_error_msg("Numeric constant expected"); return 1; @@ -101,7 +103,7 @@ int GTextReadStream::get_next_number(double *d) *d = strtod(cur, &endptr); - if(endptr) + if (endptr) { m_cur = endptr; } @@ -112,11 +114,11 @@ int GTextReadStream::get_next_number(double *d) char GTextReadStream::get_next_symbol() { const char *cur = m_cur; - while((*cur)&&(strchr(" \t\r\n",*cur))) + while ((*cur)&&(strchr(" \t\r\n",*cur))) { cur++; } - if(!(*cur)) + if (!(*cur)) { return 0; } diff --git a/sql/item.cc b/sql/item.cc index 1603e179e5e..079767e68d2 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -502,18 +502,17 @@ bool Item_ref_on_list_position::fix_fields(THD *thd, struct st_table_list *tables, Item ** reference) { - ref= 0; List_iterator li(list); Item *item; - uint i= 0; - for (; (item= li++) && i < pos; i++); - if (i == pos) + for (uint i= 0; (item= li++) && i < pos; i++); + if (item) { ref= li.ref(); return Item_ref_null_helper::fix_fields(thd, tables, reference); } else { + ref= 0; my_error(ER_CARDINALITY_COL, MYF(0), pos); return 1; } @@ -1280,29 +1279,20 @@ longlong Item_cache_str::val_int() bool Item_cache_row::allocate(uint num) { - n= num; + item_count= num; THD *thd= current_thd; - if (!(values= (Item_cache **) thd->calloc(sizeof(Item_cache *)*n))) - { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); - thd->fatal_error= 1; - return 1; - } - return 0; + return (!(values= + (Item_cache **) thd->calloc(sizeof(Item_cache *)*item_count))); } bool Item_cache_row::setup(Item * item) { if (!values && allocate(item->cols())) return 1; - for(uint i= 0; i < n; i++) + for (uint i= 0; i < item_count; i++) { if (!(values[i]= Item_cache::get_cache(item->el(i)->result_type()))) - { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); - current_thd->fatal_error= 1; return 1; - } values[i]->setup(item->el(i)); } return 0; @@ -1312,7 +1302,7 @@ void Item_cache_row::store(Item * item) { null_value= 0; item->bring_value(); - for(uint i= 0; i < n; i++) + for (uint i= 0; i < item_count; i++) { values[i]->store(item->el(i)); null_value|= values[i]->null_value; @@ -1330,7 +1320,7 @@ void Item_cache_row::illegal_method_call(const char *method) bool Item_cache_row::check_cols(uint c) { - if (c != n) + if (c != item_count) { my_error(ER_CARDINALITY_COL, MYF(0), c); return 1; @@ -1340,7 +1330,7 @@ bool Item_cache_row::check_cols(uint c) bool Item_cache_row::null_inside() { - for (uint i= 0; i < n; i++) + for (uint i= 0; i < item_count; i++) { if (values[i]->cols() > 1) { @@ -1359,7 +1349,7 @@ bool Item_cache_row::null_inside() void Item_cache_row::bring_value() { - for (uint i= 0; i < n; i++) + for (uint i= 0; i < item_count; i++) values[i]->bring_value(); return; } diff --git a/sql/item.h b/sql/item.h index 508c737e7b9..046464da97d 100644 --- a/sql/item.h +++ b/sql/item.h @@ -731,9 +731,9 @@ public: class Item_cache_row: public Item_cache { Item_cache **values; - uint n; + uint item_count; public: - Item_cache_row(): values(0), n(2) { fixed= 1; null_value= 1; } + Item_cache_row(): values(0), item_count(2) { fixed= 1; null_value= 1; } /* 'allocate' used only in row transformer, to preallocate space for row @@ -768,7 +768,7 @@ public: }; enum Item_result result_type() const { return ROW_RESULT; } - uint cols() { return n; } + uint cols() { return item_count; } Item* el(uint i) { return values[i]; } Item** addr(uint i) { return (Item **) (values + i); } bool check_cols(uint c); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 89ff5ef2822..94423642fa5 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -153,11 +153,7 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type) comparators[i].set_cmp_func(owner, (*a)->addr(i), (*b)->addr(i)); } else - { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); - current_thd->fatal_error= 1; return 1; - } } return 0; } @@ -276,11 +272,7 @@ int Arg_comparator::compare_e_row() bool Item_in_optimizer::preallocate_row() { - if ((cache= Item_cache::get_cache(ROW_RESULT))) - return 0; - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); - current_thd->fatal_error= 1; - return 1; + return (!(cache= Item_cache::get_cache(ROW_RESULT))); } bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables, @@ -296,11 +288,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables, used_tables_cache= args[0]->used_tables(); const_item_cache= args[0]->const_item(); if (!cache && !(cache= Item_cache::get_cache(args[0]->result_type()))) - { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); - thd->fatal_error= 1; return 1; - } cache->setup(args[0]); if (args[1]->fix_fields(thd, tables, args)) return 1; @@ -1246,18 +1234,10 @@ void cmp_item_row::store_value(Item *item) item->null_value|= item->el(i)->null_value; } else - { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); - thd->fatal_error= 1; return; - } } else - { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); - thd->fatal_error= 1; return; - } } void cmp_item_row::store_value_by_template(cmp_item *t, Item *item) @@ -1281,18 +1261,10 @@ void cmp_item_row::store_value_by_template(cmp_item *t, Item *item) item->null_value|= item->el(i)->null_value; } else - { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); - current_thd->fatal_error= 1; return; - } } else - { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); - current_thd->fatal_error= 1; return; - } } int cmp_item_row::cmp(Item *arg) diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 603d7123a6f..2aca3e1fabb 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -544,8 +544,8 @@ public: cmp_item_row(): comparators(0), n(0) {} ~cmp_item_row() { - if(comparators) - for(uint i= 0; i < n; i++) + if (comparators) + for (uint i= 0; i < n; i++) if (comparators[i]) delete comparators[i]; } diff --git a/sql/item_func.h b/sql/item_func.h index 6ff2c7eef9d..522b954b7b5 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -995,7 +995,7 @@ public: { ft_handler->please->close_search(ft_handler); ft_handler=0; - if(join_key) + if (join_key) table->file->ft_handler=0; table->fulltext_searched=0; } diff --git a/sql/item_row.h b/sql/item_row.h index f33e0cc9821..82580797ebc 100644 --- a/sql/item_row.h +++ b/sql/item_row.h @@ -33,7 +33,7 @@ public: ~Item_row() { - if(array_holder && items) + if (array_holder && items) sql_element_free(items); } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 78689bb3044..43eee0abf1c 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1961,7 +1961,7 @@ String *Item_func_conv_charset::val_str(String *str) d0=d=(unsigned char*)str->ptr(); de=d+dmaxlen; - while( s < se && d < de){ + while (s < se && d < de){ cnvres=from->mb_wc(from,&wc,s,se); if (cnvres>0) @@ -2035,7 +2035,7 @@ String *Item_func_conv_charset3::val_str(String *str) d0=d=(unsigned char*)str->ptr(); de=d+dmaxlen; - while( s < se && d < de){ + while (s < se && d < de){ cnvres=from_charset->mb_wc(from_charset,&wc,s,se); if (cnvres>0) @@ -2655,7 +2655,7 @@ String *Item_func_spatial_collection::val_str(String *str) null_value=1; str->length(0); - if(str->reserve(9,512)) + if (str->reserve(9,512)) return 0; str->q_append((char)Geometry::wkbNDR); diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index d14d2114d7e..8763701b7a3 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -32,6 +32,11 @@ SUBSELECT TODO: #include "mysql_priv.h" #include "sql_select.h" +inline Item * and_items(Item* cond, Item *item) +{ + return (cond? (new Item_cond_and(cond, item)) : item); +} + Item_subselect::Item_subselect(): Item_result_field(), engine_owner(1), value_assigned(0), substitution(0), have_to_be_excluded(0) @@ -51,7 +56,7 @@ void Item_subselect::init(THD *thd, st_select_lex *select_lex, DBUG_ENTER("Item_subselect::init"); DBUG_PRINT("subs", ("select_lex 0x%xl", (ulong) select_lex)); - select_transformer(select_lex->master_unit()); + select_transformer(thd, select_lex->master_unit()); if (select_lex->next_select()) engine= new subselect_union_engine(thd, select_lex->master_unit(), result, this); @@ -67,7 +72,7 @@ Item_subselect::~Item_subselect() delete engine; } -void Item_subselect::select_transformer(st_select_lex_unit *unit) +void Item_subselect::select_transformer(THD *thd, st_select_lex_unit *unit) { DBUG_ENTER("Item_subselect::select_transformer"); DBUG_VOID_RETURN; @@ -146,7 +151,8 @@ void Item_singlerow_subselect::reset() value->null_value= 1; } -void Item_singlerow_subselect::select_transformer(st_select_lex_unit *unit) +void Item_singlerow_subselect::select_transformer(THD *thd, + st_select_lex_unit *unit) { SELECT_LEX *select_lex= unit->first_select(); @@ -155,7 +161,6 @@ void Item_singlerow_subselect::select_transformer(st_select_lex_unit *unit) { have_to_be_excluded= 1; - THD *thd= current_thd; if (thd->lex.describe) { char warn_buff[MYSQL_ERRMSG_SIZE]; @@ -178,18 +183,10 @@ void Item_singlerow_subselect::select_transformer(st_select_lex_unit *unit) cond= select_lex->having; else if (!(cond= new Item_cond_and(select_lex->having, select_lex->where))) - { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); - thd->fatal_error= 1; return; - } if (!(substitution= new Item_func_if(cond, substitution, new Item_null()))) - { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); - thd->fatal_error= 1; return; - } } } } @@ -210,21 +207,13 @@ void Item_singlerow_subselect::fix_length_and_dec() { engine->fix_length_and_dec(row= &value); if (!(value= Item_cache::get_cache(engine->type()))) - { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); - current_thd->fatal_error= 1; return; - } } else { THD *thd= current_thd; if (!(row= (Item_cache**)thd->alloc(sizeof(Item_cache*)*max_columns))) - { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); - thd->fatal_error= 1; return; - } engine->fix_length_and_dec(row); value= *row; } @@ -443,7 +432,8 @@ Item_allany_subselect::Item_allany_subselect(Item_allany_subselect *item): func= item->func; } -void Item_in_subselect::single_value_transformer(st_select_lex_unit *unit, +void Item_in_subselect::single_value_transformer(THD *thd, + st_select_lex_unit *unit, Item *left_expr, compare_func_creator func) { @@ -457,10 +447,8 @@ void Item_in_subselect::single_value_transformer(st_select_lex_unit *unit, Item_in_optimizer *optimizer; substitution= optimizer= new Item_in_optimizer(left_expr, this); if (!optimizer) - { - current_thd->fatal_error= 1; DBUG_VOID_RETURN; - } + /* As far as Item_ref_in_optimizer do not substitude itself on fix_fields we can use same item for all selects. @@ -497,15 +485,9 @@ void Item_in_subselect::single_value_transformer(st_select_lex_unit *unit, (char *)"", (char*)"")); if (sl->having || sl->with_sum_func || sl->group_list.first) - if (sl->having) - sl->having= new Item_cond_and(sl->having, item); - else - sl->having= item; + sl->having= and_items(sl->having, item); else - if (sl->where) - sl->where= new Item_cond_and(sl->where, item); - else - sl->where= item; + sl->where= and_items(sl->where, item); } else { @@ -516,10 +498,7 @@ void Item_in_subselect::single_value_transformer(st_select_lex_unit *unit, item= (*func)(expr, new Item_asterisk_remover(this, item, (char *)"", (char*)"")); - if (sl->where) - sl->where= new Item_cond_and(sl->where, item); - else - sl->where= item; + sl->where= and_items(sl->where, item); } else { @@ -546,7 +525,6 @@ void Item_in_subselect::single_value_transformer(st_select_lex_unit *unit, item= (*func)(left_expr, item); substitution= item; have_to_be_excluded= 1; - THD *thd= current_thd; if (thd->lex.describe) { char warn_buff[MYSQL_ERRMSG_SIZE]; @@ -561,7 +539,8 @@ void Item_in_subselect::single_value_transformer(st_select_lex_unit *unit, DBUG_VOID_RETURN; } -void Item_in_subselect::row_value_transformer(st_select_lex_unit *unit, +void Item_in_subselect::row_value_transformer(THD *thd, + st_select_lex_unit *unit, Item *left_expr) { DBUG_ENTER("Item_in_subselect::row_value_transformer"); @@ -575,10 +554,8 @@ void Item_in_subselect::row_value_transformer(st_select_lex_unit *unit, Item_in_optimizer *optimizer; substitution= optimizer= new Item_in_optimizer(left_expr, this); if (!optimizer) - { - current_thd->fatal_error= 1; DBUG_VOID_RETURN; - } + unit->dependent= 1; uint n= left_expr->cols(); if (optimizer->preallocate_row() || (*optimizer->get_cache())->allocate(n)) @@ -608,40 +585,32 @@ void Item_in_subselect::row_value_transformer(st_select_lex_unit *unit, (char *)"", (char *)""), func); - if (!item) - item= func; - else - item= new Item_cond_and(item, func); + item= and_items(item, func); } if (sl->having || sl->with_sum_func || sl->group_list.first || !sl->table_list.elements) - if (sl->having) - sl->having= new Item_cond_and(sl->having, item); - else - sl->having= item; + sl->having= and_items(sl->having, item); else - if (sl->where) - sl->where= new Item_cond_and(sl->where, item); - else - sl->where= item; + sl->where= and_items(sl->where, item); } DBUG_VOID_RETURN; } -void Item_in_subselect::select_transformer(st_select_lex_unit *unit) +void Item_in_subselect::select_transformer(THD *thd, st_select_lex_unit *unit) { if (left_expr->cols() == 1) - single_value_transformer(unit, left_expr, + single_value_transformer(thd, unit, left_expr, &Item_bool_func2::eq_creator); else - row_value_transformer(unit, left_expr); + row_value_transformer(thd, unit, left_expr); } -void Item_allany_subselect::select_transformer(st_select_lex_unit *unit) +void Item_allany_subselect::select_transformer(THD *thd, + st_select_lex_unit *unit) { - single_value_transformer(unit, left_expr, func); + single_value_transformer(thd, unit, left_expr, func); } subselect_single_select_engine::subselect_single_select_engine(THD *thd, @@ -678,7 +647,7 @@ subselect_union_engine::subselect_union_engine(THD *thd, subselect_engine(thd, item, result) { unit= u; - if( !result) + if (!result) { //out of memory thd->fatal_error= 1; @@ -694,13 +663,13 @@ int subselect_single_select_engine::prepare() prepared= 1; SELECT_LEX_NODE *save_select= thd->lex.current_select; thd->lex.current_select= select_lex; - if(join->prepare((TABLE_LIST*) select_lex->table_list.first, - select_lex->where, - (ORDER*) select_lex->order_list.first, - (ORDER*) select_lex->group_list.first, - select_lex->having, - (ORDER*) 0, select_lex, - select_lex->master_unit(), 0)) + if (join->prepare((TABLE_LIST*) select_lex->table_list.first, + select_lex->where, + (ORDER*) select_lex->order_list.first, + (ORDER*) select_lex->group_list.first, + select_lex->having, + (ORDER*) 0, select_lex, + select_lex->master_unit(), 0)) return 1; thd->lex.current_select= save_select; return 0; @@ -726,11 +695,7 @@ static Item_result set_row(SELECT_LEX *select_lex, Item * item, if (row) { if (!(row[i]= Item_cache::get_cache(res_type))) - { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); - current_thd->fatal_error= 1; return STRING_RESULT; // we should return something - } row[i]->set_len_n_dec(sel_item->max_length, sel_item->decimals); } } @@ -763,7 +728,7 @@ void subselect_union_engine::fix_length_and_dec(Item_cache **row) mlen= len; if (!sel_item) sel_item= s_item; - maybe_null!= s_item->maybe_null; + maybe_null= s_item->maybe_null; } item->max_length= mlen; res_type= sel_item->result_type(); @@ -771,11 +736,7 @@ void subselect_union_engine::fix_length_and_dec(Item_cache **row) if (row) { if (!(row[0]= Item_cache::get_cache(res_type))) - { - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); - current_thd->fatal_error= 1; return; - } row[0]->set_len_n_dec(mlen, sel_item->decimals); } } @@ -784,7 +745,7 @@ void subselect_union_engine::fix_length_and_dec(Item_cache **row) SELECT_LEX *sl= unit->first_select(); bool fake= 0; res_type= set_row(sl, item, row, &fake); - for(sl= sl->next_select(); sl; sl->next_select()) + for (sl= sl->next_select(); sl; sl->next_select()) { List_iterator_fast li(sl->item_list); Item *sel_item; diff --git a/sql/item_subselect.h b/sql/item_subselect.h index e15748cbebf..cf7f612224a 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -71,7 +71,7 @@ public: { null_value= 1; } - virtual void select_transformer(st_select_lex_unit *unit); + virtual void select_transformer(THD *thd, st_select_lex_unit *unit); bool assigned() { return value_assigned; } void assigned(bool a) { value_assigned= a; } enum Type type() const; @@ -106,7 +106,7 @@ public: decimals= item->decimals; } void reset(); - void select_transformer(st_select_lex_unit *unit); + void select_transformer(THD *thd, st_select_lex_unit *unit); void store(uint i, Item* item); double val(); longlong val_int (); @@ -173,10 +173,11 @@ public: null_value= 0; was_null= 0; } - virtual void select_transformer(st_select_lex_unit *unit); - void single_value_transformer(st_select_lex_unit *unit, + virtual void select_transformer(THD *thd, st_select_lex_unit *unit); + void single_value_transformer(THD *thd, st_select_lex_unit *unit, Item *left_expr, compare_func_creator func); - void row_value_transformer(st_select_lex_unit *unit, Item *left_expr); + void row_value_transformer(THD *thd, st_select_lex_unit *unit, + Item *left_expr); longlong val_int(); double val(); String *val_str(String*); @@ -195,7 +196,7 @@ public: Item_allany_subselect(THD *thd, Item * left_expr, compare_func_creator f, st_select_lex *select_lex); Item_allany_subselect(Item_allany_subselect *item); - virtual void select_transformer(st_select_lex_unit *unit); + virtual void select_transformer(THD *thd, st_select_lex_unit *unit); }; class subselect_engine: public Sql_alloc diff --git a/sql/nt_servc.cc b/sql/nt_servc.cc index b917c91ce15..93bae6f444d 100644 --- a/sql/nt_servc.cc +++ b/sql/nt_servc.cc @@ -431,7 +431,7 @@ BOOL NTService::SeekStatus(LPCSTR szInternName, int OperationType) if (ret_error == ERROR_ACCESS_DENIED) { printf("Install/Remove of the Service Denied!\n"); - if(!is_super_user()) + if (!is_super_user()) printf("That operation should be made by an user with Administrator privileges!\n"); } else @@ -530,13 +530,13 @@ BOOL NTService::is_super_user() UINT x; BOOL ret_value=FALSE; - if(!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, TRUE,&hAccessToken )) + if (!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, TRUE,&hAccessToken )) { - if(GetLastError() != ERROR_NO_TOKEN) - return FALSE; + if (GetLastError() != ERROR_NO_TOKEN) + return FALSE; - if(!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hAccessToken)) - return FALSE; + if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hAccessToken)) + return FALSE; } ret_value= GetTokenInformation(hAccessToken,TokenGroups,InfoBuffer, @@ -544,21 +544,21 @@ BOOL NTService::is_super_user() CloseHandle(hAccessToken); - if(!ret_value ) - return FALSE; + if (!ret_value ) + return FALSE; - if(!AllocateAndInitializeSid(&siaNtAuthority, 2, - SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_ADMINS, - 0, 0, 0, 0, 0, 0, - &psidAdministrators)) - return FALSE; + if (!AllocateAndInitializeSid(&siaNtAuthority, 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, + &psidAdministrators)) + return FALSE; ret_value = FALSE; - for(x=0;xGroupCount;x++) + for (x=0;xGroupCount;x++) { - if( EqualSid(psidAdministrators, ptgGroups->Groups[x].Sid) ) + if ( EqualSid(psidAdministrators, ptgGroups->Groups[x].Sid) ) { ret_value = TRUE; break; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index b117b6a5ea1..887ce6c561a 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2162,12 +2162,13 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree, tmp=1; // Max one record else { - if(tmp_min_flag & GEOM_FLAG) + if (tmp_min_flag & GEOM_FLAG) { - tmp=param->table->file-> - records_in_range((int) keynr,(byte*)(param->min_key + 1), - min_key_length, (ha_rkey_function)(tmp_min_flag ^ GEOM_FLAG), - (byte *)NullS,0,HA_READ_KEY_EXACT); + tmp= param->table->file-> + records_in_range((int) keynr, (byte*)(param->min_key + 1), + min_key_length, + (ha_rkey_function)(tmp_min_flag ^ GEOM_FLAG), + (byte *)NullS, 0, HA_READ_KEY_EXACT); } else { diff --git a/sql/password.c b/sql/password.c index 9fd3757106d..da7a499ba09 100644 --- a/sql/password.c +++ b/sql/password.c @@ -573,7 +573,7 @@ void get_hash_and_password(ulong* salt, uint8 pversion, char* hash, unsigned cha while (salt=0;t--) + for (t=3;t>=0;t--) { bp[t]=val%256; diff --git a/sql/spatial.cc b/sql/spatial.cc index 1e2b9f1c512..5c6be3c221c 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -506,7 +506,7 @@ int GPolygon::get_data_as_text(String *txt) const for (; n_linear_rings>0; --n_linear_rings) { - if(no_data(data, 4)) + if (no_data(data, 4)) return 1; uint32 n_points = uint4korr(data); data += 4; @@ -593,7 +593,7 @@ int GPolygon::area(double *ar) const data += (8+8); } lr_area=fabs(lr_area)/2; - if(result==-1) result=lr_area; + if (result==-1) result=lr_area; else result-=lr_area; } *ar=fabs(result); @@ -1344,7 +1344,7 @@ int GGeometryCollection::get_mbr(MBR *mbr) const data += 4; for (; n_objects>0; --n_objects) { - if(no_data(data, WKB_HEADER_SIZE)) + if (no_data(data, WKB_HEADER_SIZE)) return 1; uint32 wkb_type = uint4korr(data + sizeof(char)); data += WKB_HEADER_SIZE; diff --git a/sql/sql_help.cc b/sql/sql_help.cc index 5d12f023842..013101a0ecc 100644 --- a/sql/sql_help.cc +++ b/sql/sql_help.cc @@ -96,7 +96,7 @@ int search_functions(MI_INFO *file_leafs, const char *mask, DBUG_ENTER("search_functions"); int count= 0; - if(mi_scan_init(file_leafs)) + if (mi_scan_init(file_leafs)) DBUG_RETURN(-1); help_leaf leaf; @@ -191,7 +191,7 @@ int search_categories(THD *thd, if (!(file_categories= open_help_file(thd,"function_category_name"))) DBUG_RETURN(-1); - if(mi_scan_init(file_categories)) + if (mi_scan_init(file_categories)) { mi_close(file_categories); DBUG_RETURN(-1); @@ -393,11 +393,11 @@ int mysqld_help(THD *thd, const char *mask) description->ptr(), example->ptr()))) goto end; } - else if((res= send_header_2(protocol)) || - (res= send_variant_2_list(protocol,&function_list,false)) || - (search_categories(thd, mask, &categories_list, 0)<0 && - (res=1)) || - (res= send_variant_2_list(protocol,&categories_list,true))) + else if ((res= send_header_2(protocol)) || + (res= send_variant_2_list(protocol,&function_list,false)) || + (search_categories(thd, mask, &categories_list, 0)<0 && + (res=1)) || + (res= send_variant_2_list(protocol,&categories_list,true))) { goto end; } diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index ddbb562bdca..c2ebcdc1f28 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1036,7 +1036,7 @@ void st_select_lex_node::include_global(st_select_lex_node **plink) //excluding from global list (internal function) void st_select_lex_node::fast_exclude() { - if(link_prev) + if (link_prev) { if ((*link_prev= link_next)) link_next->link_prev= link_prev; @@ -1068,7 +1068,7 @@ void st_select_lex_node::exclude() void st_select_lex_unit::exclude_level() { SELECT_LEX_UNIT *units= 0, **units_last= &units; - for(SELECT_LEX *sl= first_select(); sl; sl= sl->next_select()) + for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select()) { if (sl->link_prev && (*sl->link_prev= sl->link_next)) sl->link_next->link_prev= sl->link_prev; @@ -1142,7 +1142,7 @@ void st_select_lex_node::mark_as_dependent(SELECT_LEX *last) for (SELECT_LEX_NODE *s= this; s &&s != last; s= s->outer_select()) - if( !s->dependent ) + if ( !s->dependent ) { // Select is dependent of outer select s->dependent= 1; diff --git a/sql/sql_olap.cc b/sql/sql_olap.cc index 6eb4fbcaaf6..1f22073f556 100644 --- a/sql/sql_olap.cc +++ b/sql/sql_olap.cc @@ -62,7 +62,7 @@ static int make_new_olap_select(LEX *lex, SELECT_LEX *select_lex, List new List_iterator list_it(select_lex->item_list); List_iterator new_it(new_fields); - while((item=list_it++)) + while ((item=list_it++)) { bool not_found=true; if (item->type()==Item::FIELD_ITEM) @@ -109,15 +109,15 @@ static int olap_combos(List old_fields, List new_fields, Item *item int num_new_fields) { int sl_return = 0; - if(position == num_new_fields) + if (position == num_new_fields) { - if(item) + if (item) new_fields.push_front(item); sl_return = make_new_olap_select(lex, select_lex, new_fields); } else { - if(item) + if (item) new_fields.push_front(item); while ((num_fields - num_new_fields >= selection - position) && !sl_return) { @@ -170,12 +170,12 @@ int handle_olaps(LEX *lex, SELECT_LEX *select_lex) if (select_lex->olap == CUBE_TYPE) { - for( int i=count-1; i>=0 && !sl_return; i--) + for ( int i=count-1; i>=0 && !sl_return; i--) sl_return=olap_combos(item_list_copy, new_item_list, (Item *)0, lex, select_lex, 0, 0, count, i); } else if (select_lex->olap == ROLLUP_TYPE) { - for( int i=count-1; i>=0 && !sl_return; i--) + for ( int i=count-1; i>=0 && !sl_return; i--) { Item *item; item_list_copy.pop(); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 9ee8af08ae4..83ccbada630 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1160,7 +1160,7 @@ mysql_select(THD *thd, TABLE_LIST *tables, List &fields, COND *conds, if (thd->possible_loops) { Item *item; - while(thd->possible_loops->elements) + while (thd->possible_loops->elements) { item= thd->possible_loops->pop(); if (item->check_loop(thd->check_loops_counter++)) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index ebade0111b0..3bf64d6c78f 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1113,8 +1113,8 @@ store_create_info(THD *thd, TABLE *table, String *packet) packet->append(" USING BTREE", 12); // +BAR: send USING only in non-default case: non-spatial rtree - if((key_info->algorithm == HA_KEY_ALG_RTREE) && - !(key_info->flags & HA_SPATIAL)) + if ((key_info->algorithm == HA_KEY_ALG_RTREE) && + !(key_info->flags & HA_SPATIAL)) packet->append(" USING RTREE",12); packet->append(" (", 2); diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 51b2386ae62..5b84b86c277 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -254,7 +254,7 @@ bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *from, CHARSET break; outp: - if((cnvres=to->wc_mb(to,wc,d,de)) >0 ) + if ((cnvres=to->wc_mb(to,wc,d,de)) >0 ) { d+=cnvres; } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 1ab84531e40..0d4d8743628 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -398,7 +398,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, it.rewind(); while ((sql_field=it++)) { - if(!sql_field->charset) + if (!sql_field->charset) sql_field->charset = create_info->table_charset ? create_info->table_charset : thd->db_charset? thd->db_charset : diff --git a/sql/stacktrace.c b/sql/stacktrace.c index f5c0a59b572..762c45e7184 100644 --- a/sql/stacktrace.c +++ b/sql/stacktrace.c @@ -38,7 +38,7 @@ void safe_print_str(const char* name, const char* val, int max_len) } fprintf(stderr, "= "); - for(; max_len && PTR_SANE(val) && *val; --max_len) + for (; max_len && PTR_SANE(val) && *val; --max_len) fputc(*val++, stderr); fputc('\n', stderr); } @@ -59,7 +59,7 @@ void safe_print_str(const char* name, const char* val, int max_len) inline uchar** find_prev_fp(uint32* pc, uchar** fp) { int i; - for(i = 0; i < MAX_INSTR_IN_FUNC; ++i,--pc) + for (i = 0; i < MAX_INSTR_IN_FUNC; ++i,--pc) { uchar* p = (uchar*)pc; if (p[2] == 222 && p[3] == 35) @@ -73,7 +73,7 @@ inline uchar** find_prev_fp(uint32* pc, uchar** fp) inline uint32* find_prev_pc(uint32* pc, uchar** fp) { int i; - for(i = 0; i < MAX_INSTR_IN_FUNC; ++i,--pc) + for (i = 0; i < MAX_INSTR_IN_FUNC; ++i,--pc) { char* p = (char*)pc; if (p[1] == 0 && p[2] == 94 && p[3] == -73) From 4e56ad920429a8d3234d5cf052265a0255e0c596 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 28 Dec 2002 01:38:29 -0800 Subject: [PATCH 099/220] sql_table.cc: Fix CREATE LIKE TABLE .. temporary case sql/sql_table.cc: Fix CREATE LIKE TABLE .. temporary case --- mysql-test/r/create.result | 60 +++++++++++++++++++ mysql-test/t/create.test | 37 ++++++++++++ sql/mysql_priv.h | 3 + sql/sql_parse.cc | 12 ++-- sql/sql_table.cc | 119 +++++++++++++++++++++++++++++++++++++ sql/sql_yacc.yy | 9 ++- 6 files changed, 235 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 0be0d624fca..e1c5bb61da9 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -161,3 +161,63 @@ drop table if exists t1; create table t1 (a int, key(a)); create table t2 (b int, foreign key(b) references t1(a), key(b)); drop table if exists t1,t2; +drop table if exists t1, t2, t3; +create table t1(id int not null, name char(20)); +insert into t1 values(10,'mysql'),(20,'monty- the creator'); +create table t2(id int not null); +insert into t2 values(10),(20); +create table t3 like t1; +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `id` int(11) NOT NULL default '0', + `name` char(20) character set latin1 default NULL +) TYPE=MyISAM CHARSET=latin1 +select * from t3; +id name +create table if not exists t3 like t1; +Warnings: +Warning 1050 Table 't3' already exists +select @@warning_count; +@@warning_count +1 +create temporary table t3 like t2; +show create table t3; +Table Create Table +t3 CREATE TEMPORARY TABLE `t3` ( + `id` int(11) NOT NULL default '0' +) TYPE=MyISAM CHARSET=latin1 +select * from t3; +id +drop table t3; +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `id` int(11) NOT NULL default '0', + `name` char(20) character set latin1 default NULL +) TYPE=MyISAM CHARSET=latin1 +select * from t3; +id name +drop table t3; +create database test_$1; +drop table if exists test_$1.t3; +create table test_$1.t3 like t1; +create temporary table t3 like test_$1.t3; +show create table t3; +Table Create Table +t3 CREATE TEMPORARY TABLE `t3` ( + `id` int(11) NOT NULL default '0', + `name` char(20) character set latin1 default NULL +) TYPE=MyISAM CHARSET=latin1 +create table t3 like t1; +create table t3 like test_$1.t3; +Table 't3' already exists +create table non_existing_database.t1 like t1; +Got one of the listed errors +create table t3 like non_existing_table; +Unknown table 'non_existing_table' +create temporary table t3 like t1; +Table 't3' already exists +drop table t1, t2, t3; +drop table t3; +drop database test_$1; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 3bad053875c..f5f5116b429 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -113,3 +113,40 @@ drop table if exists t1; create table t1 (a int, key(a)); create table t2 (b int, foreign key(b) references t1(a), key(b)); drop table if exists t1,t2; + +# +# Test for CREATE TABLE .. LIKE .. +# + +drop table if exists t1, t2, t3; +create table t1(id int not null, name char(20)); +insert into t1 values(10,'mysql'),(20,'monty- the creator'); +create table t2(id int not null); +insert into t2 values(10),(20); +create table t3 like t1; +show create table t3; +select * from t3; +create table if not exists t3 like t1; +select @@warning_count; +create temporary table t3 like t2; +show create table t3; +select * from t3; +drop table t3; +show create table t3; +select * from t3; +drop table t3; +create database test_$1; +drop table if exists test_$1.t3; +create table test_$1.t3 like t1; +create temporary table t3 like test_$1.t3; +show create table t3; +create table t3 like t1; +!$1050 create table t3 like test_$1.t3; +--error 1044,1 +create table non_existing_database.t1 like t1; +!$1051 create table t3 like non_existing_table; +!$1050 create temporary table t3 like t1; +drop table t1, t2, t3; +drop table t3; +drop database test_$1; + diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index cf0cefd76da..1b0608e5f79 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -422,6 +422,9 @@ int mysql_alter_table(THD *thd, char *new_db, char *new_name, enum enum_duplicates handle_duplicates, enum enum_enable_or_disable keys_onoff=LEAVE_AS_IS, bool simple_alter=0); +int mysql_create_like_table(THD *thd, TABLE_LIST *table, + HA_CREATE_INFO *create_info, + Table_ident *src_table); bool mysql_rename_table(enum db_type base, const char *old_db, const char * old_name, diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index f8a3350f051..de976076a33 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1830,10 +1830,14 @@ mysql_execute_command(THD *thd) } else // regular create { - res = mysql_create_table(thd,tables->db ? tables->db : thd->db, - tables->real_name, &lex->create_info, - lex->create_list, - lex->key_list,0,0,0); // do logging + if (lex->name) + res= mysql_create_like_table(thd, tables, &lex->create_info, + (Table_ident *)lex->name); + else + res= mysql_create_table(thd,tables->db ? tables->db : thd->db, + tables->real_name, &lex->create_info, + lex->create_list, + lex->key_list,0,0,0); // do logging if (!res) send_ok(thd); } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 1ab84531e40..7cb1cee7e3c 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1376,6 +1376,125 @@ int mysql_optimize_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt) } +/* + Create a table identical to the specified table + + SYNOPSIS + mysql_create_like_table() + thd Thread object + table Table list (one table only) + create_info Create info + table_ident Src table_ident + + RETURN VALUES + 0 ok + -1 error +*/ + +int mysql_create_like_table(THD* thd, TABLE_LIST* table, + HA_CREATE_INFO *create_info, + Table_ident *table_ident) +{ + TABLE **tmp_table; + char src_path[FN_REFLEN], dst_path[FN_REFLEN]; + char *db= table->db; + char *table_name= table->real_name; + char *src_db= thd->db; + char *src_table= table_ident->table.str; + int err; + + DBUG_ENTER("mysql_create_like_table"); + + /* + Validate the source table + */ + if (table_ident->table.length > NAME_LEN || + (table_ident->table.length && + check_table_name(src_table,table_ident->table.length)) || + table_ident->db.str && check_db_name((src_db= table_ident->db.str))) + { + net_printf(thd,ER_WRONG_TABLE_NAME,src_table); + DBUG_RETURN(0); + } + + if ((tmp_table= find_temporary_table(thd, src_db, src_table))) + strxmov(src_path, (*tmp_table)->path, reg_ext, NullS); + else + { + strxmov(src_path, mysql_data_home, "/", src_db, "/", src_table, + reg_ext, NullS); + if (access(src_path, F_OK)) + { + my_error(ER_BAD_TABLE_ERROR, MYF(0), src_table); + DBUG_RETURN(-1); + } + } + + /* + Validate the destination table + + skip the destination table name checking as this is already + validated. + */ + if (create_info->options & HA_LEX_CREATE_TMP_TABLE) + { + if (find_temporary_table(thd, db, table_name)) + goto table_exists; + sprintf(dst_path,"%s%s%lx_%lx_%x%s",mysql_tmpdir,tmp_file_prefix, + current_pid, thd->thread_id, thd->tmp_table++,reg_ext); + create_info->table_options|= HA_CREATE_DELAY_KEY_WRITE; + } + else + { + strxmov(dst_path, mysql_data_home, "/", db, "/", table_name, + reg_ext, NullS); + if (!access(dst_path, F_OK)) + goto table_exists; + } + + /* + Create a new table by copying from source table + */ + if (my_copy(src_path, dst_path, MYF(MY_WME))) + DBUG_RETURN(-1); + + /* + As mysql_truncate don't work on a new table at this stage of + creation, instead create the table directly (for both normal + and temporary tables). + */ + *fn_ext(dst_path)= 0; + err= ha_create_table(dst_path, create_info, 1); + + if (create_info->options & HA_LEX_CREATE_TMP_TABLE) + { + if (err || !open_temporary_table(thd, dst_path, db, table_name, 1)) + { + (void) rm_temporary_table(create_info->db_type, dst_path); + DBUG_RETURN(-1); + } + } + else if (err) + { + (void) quick_rm_table(create_info->db_type, db, table_name); + DBUG_RETURN(-1); + } + DBUG_RETURN(0); + +table_exists: + if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS) + { + char warn_buff[MYSQL_ERRMSG_SIZE]; + sprintf(warn_buff,ER(ER_TABLE_EXISTS_ERROR),table_name); + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_TABLE_EXISTS_ERROR,warn_buff); + DBUG_RETURN(0); + } + my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name); + DBUG_RETURN(-1); +} + + int mysql_analyze_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt) { #ifdef OS2 diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index e99f2a3b17c..25c9ecb13ee 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -835,6 +835,7 @@ create: lex->create_info.options=$2 | $4; lex->create_info.db_type= (enum db_type) lex->thd->variables.table_type; lex->create_info.table_charset=thd->db_charset?thd->db_charset:default_charset_info; + lex->name=0; } create2 {} @@ -883,7 +884,13 @@ create: create2: '(' field_list ')' opt_create_table_options create3 {} | opt_create_table_options create3 {} - ; + | LIKE table_ident + { + LEX *lex=Lex; + if (!(lex->name= (char *)$2)) + YYABORT; + } + ; create3: /* empty */ {} From 84a9a9fe5bc7583905672c0b94011cfa1606b08d Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 28 Dec 2002 21:34:17 +0200 Subject: [PATCH 100/220] aliases with multi-table updates / deletes fix for a bug with derived tables and query cache ix for a charset bug in timestamp mysql-test/r/multi_update.result: aliases with multi-table updates / deletes mysql-test/r/query_cache.result: fix for query cache with derived tables mysql-test/t/multi_update.test: aliases with multi-table updates / deletes mysql-test/t/outfile.test: Fix of bug with charset in timestamp mysql-test/t/query_cache.test: fix for a bug with derived tables and query cache sql/field.cc: fix for a charset bug in timestamp sql/sql_parse.cc: aliases with multi-table updates / deletes sql/sql_yacc.yy: aliases with multi-table updates / deletes --- mysql-test/r/multi_update.result | 2 +- mysql-test/r/query_cache.result | 1 + mysql-test/t/multi_update.test | 2 +- mysql-test/t/outfile.test | 5 +++++ mysql-test/t/query_cache.test | 1 + sql/field.cc | 1 + sql/sql_parse.cc | 2 +- sql/sql_yacc.yy | 2 +- 8 files changed, 12 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index f19323e1ffe..dd2afc67e26 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -235,7 +235,7 @@ select * from t2; n d 1 30 1 30 -UPDATE t1 a ,t2 b SET t1.d=t2.d,t2.d=30 WHERE a.n=b.n; +UPDATE t1 a ,t2 b SET a.d=b.d,b.d=30 WHERE a.n=b.n; select * from t1; n d 1 30 diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index a37313a150a..ad9294e6d3a 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -531,6 +531,7 @@ i show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 +update t1 set i=(select distinct 1 from (select * from t2) a); drop table t1, t2, t3; use mysql; select * from db; diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 4e0622d14bb..28780ab4ed0 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -213,7 +213,7 @@ insert into t2 values(1,10),(1,20); UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n; select * from t1; select * from t2; -UPDATE t1 a ,t2 b SET t1.d=t2.d,t2.d=30 WHERE a.n=b.n; +UPDATE t1 a ,t2 b SET a.d=b.d,b.d=30 WHERE a.n=b.n; select * from t1; select * from t2; DELETE t1, t2 FROM t1 a,t2 b where a.n=b.n; diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test index c126d221bd2..3d524cb35a2 100644 --- a/mysql-test/t/outfile.test +++ b/mysql-test/t/outfile.test @@ -21,3 +21,8 @@ #select * into dumpfile "/tmp/select-test.99" from t1; #select load_file("/tmp/select-test.not-exist"); #drop table t1; +#drop table if exists t; +#CREATE TABLE t ( t timestamp NOT NULL, c char(200) character set latin1 NOT NULL default '', KEY t (t)) TYPE=MyISAM; +#INSERT INTO t VALUES ('2002-12-20 12:01:20',''); +#select * from t into outfile "fdg"; +#drop table if exists t; diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index 6c3f3d6ac52..eeaf1a83d1a 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -368,6 +368,7 @@ select * from t2; show status like "Qcache_queries_in_cache"; select * from t3; show status like "Qcache_queries_in_cache"; +update t1 set i=(select distinct 1 from (select * from t2) a); drop table t1, t2, t3; # diff --git a/sql/field.cc b/sql/field.cc index 9acf2e14829..00739f1ed14 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2845,6 +2845,7 @@ String *Field_timestamp::val_str(String *val_buffer, val_buffer->alloc(field_length+1); char *to=(char*) val_buffer->ptr(),*end=to+field_length; val_buffer->length(field_length); + val_buffer->set_charset(val_ptr->charset()); #ifdef WORDS_BIGENDIAN if (table->db_low_byte_first) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 95a739014e5..6d57ee21f3a 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3003,7 +3003,7 @@ mysql_init_query(THD *thd) lex->select_lex.link_prev= (st_select_lex_node**)&(lex->all_selects_list); lex->olap=lex->describe=0; lex->derived_tables= false; - lex->lock_option=TL_UNLOCK; + lex->lock_option=TL_READ; thd->check_loops_counter= thd->select_number= lex->select_lex.select_number= 1; thd->free_list= 0; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 53fa8afe4a7..d64d69b7c2f 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2522,7 +2522,7 @@ join_table: lex->current_select= unit->outer_select(); if (!($$= lex->current_select-> add_table_to_list(lex->thd, new Table_ident(unit), $5, 0, - lex->lock_option,(List *)0, + TL_READ,(List *)0, (List *)0))) YYABORT; From 8dceb7c051526e9ceeedb19d91bd146bc2c32683 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 Dec 2002 01:46:48 +0400 Subject: [PATCH 101/220] processing thread specific queries BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + mysql-test/r/rpl_temporary.result | 74 +++++++++++++++++++++++++++++++ mysql-test/t/rpl_temporary.test | 72 ++++++++++++++++++++++++++++++ sql/log_event.cc | 10 +++-- sql/log_event.h | 6 ++- sql/mysqld.cc | 1 + sql/set_var.cc | 6 +++ sql/sql_base.cc | 9 ++-- sql/sql_class.cc | 2 +- sql/sql_class.h | 11 ++--- sql/sql_lex.cc | 1 + sql/sql_lex.h | 1 + sql/sql_table.cc | 2 + 13 files changed, 181 insertions(+), 15 deletions(-) create mode 100644 mysql-test/r/rpl_temporary.result create mode 100644 mysql-test/t/rpl_temporary.test diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 89391563f72..15f884302a1 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -90,6 +90,7 @@ tonu@x153.internalnet tonu@x3.internalnet venu@myvenu.com venu@work.mysql.com +vva@eagle.mysql.r18.ru vva@genie.(none) walrus@mysql.com wax@mysql.com diff --git a/mysql-test/r/rpl_temporary.result b/mysql-test/r/rpl_temporary.result new file mode 100644 index 00000000000..a8a9fd92a87 --- /dev/null +++ b/mysql-test/r/rpl_temporary.result @@ -0,0 +1,74 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +drop table if exists t1; +create table t1(f int); +drop table if exists t2; +create table t2(f int); +insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +create temporary table t3(f int); +insert into t3 select * from t1 where f<6; +create temporary table t3(f int); +insert into t2 select count(*) from t3; +insert into t3 select * from t1 where f>=4; +drop temporary table t3; +insert into t2 select count(*) from t3; +drop temporary table t3; +select * from t2; +f +5 +7 +show binlog events; +Log_name Pos Event_type Server_id Orig_log_pos Info +master-bin.000001 4 Start 1 4 Server ver: 4.1.0-alpha-debug-log, Binlog ver: 3 +master-bin.000001 79 Query 1 79 use `test`; create table t1(f int) +master-bin.000001 136 Query 1 136 use `test`; create table t2(f int) +master-bin.000001 193 Query 1 193 use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10) +master-bin.000001 290 Query 1 290 use `test`; create temporary table t3(f int) +master-bin.000001 357 Query 1 357 use `test`; insert into t3 select * from t1 where f<6 +master-bin.000001 433 Query 1 433 use `test`; create temporary table t3(f int) +master-bin.000001 500 Query 1 500 use `test`; insert into t2 select count(*) from t3 +master-bin.000001 573 Query 1 573 use `test`; drop temporary table t3 +master-bin.000001 631 Query 1 631 use `test`; insert into t3 select * from t1 where f>=4 +master-bin.000001 708 Query 1 708 use `test`; insert into t2 select count(*) from t3 +master-bin.000001 781 Query 1 781 use `test`; drop temporary table t3 +drop table if exists t1; +drop table if exists t2; +use test; +SET TIMESTAMP=1040323920; +create table t1(f int); +SET TIMESTAMP=1040323931; +create table t2(f int); +SET TIMESTAMP=1040323938; +insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +SET TIMESTAMP=1040323945; +SET @@session.pseudo_thread_id=1; +create temporary table t3(f int); +SET TIMESTAMP=1040323952; +SET @@session.pseudo_thread_id=1; +insert into t3 select * from t1 where f<6; +SET TIMESTAMP=1040324145; +SET @@session.pseudo_thread_id=2; +create temporary table t3(f int); +SET TIMESTAMP=1040324186; +SET @@session.pseudo_thread_id=1; +insert into t2 select count(*) from t3; +SET TIMESTAMP=1040324200; +SET @@session.pseudo_thread_id=2; +insert into t3 select * from t1 where f>=4; +SET TIMESTAMP=1040324211; +SET @@session.pseudo_thread_id=1; +drop temporary table t3; +SET TIMESTAMP=1040324219; +SET @@session.pseudo_thread_id=2; +insert into t2 select count(*) from t3; +SET TIMESTAMP=1040324224; +SET @@session.pseudo_thread_id=2; +drop temporary table t3; +select * from t2; +f +5 +7 diff --git a/mysql-test/t/rpl_temporary.test b/mysql-test/t/rpl_temporary.test new file mode 100644 index 00000000000..a924e628fd4 --- /dev/null +++ b/mysql-test/t/rpl_temporary.test @@ -0,0 +1,72 @@ +source include/master-slave.inc; + +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); + +drop table if exists t1; +create table t1(f int); +drop table if exists t2; +create table t2(f int); +insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); + +connection con1; +create temporary table t3(f int); +insert into t3 select * from t1 where f<6; + +connection con2; +create temporary table t3(f int); + +connection con1; +insert into t2 select count(*) from t3; + +connection con2; +insert into t3 select * from t1 where f>=4; + +connection con1; +drop temporary table t3; + +connection con2; +insert into t2 select count(*) from t3; +drop temporary table t3; + +select * from t2; + +show binlog events; + +drop table if exists t1; +drop table if exists t2; + +use test; +SET TIMESTAMP=1040323920; +create table t1(f int); +SET TIMESTAMP=1040323931; +create table t2(f int); +SET TIMESTAMP=1040323938; +insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); + +SET TIMESTAMP=1040323945; +SET @@session.pseudo_thread_id=1; +create temporary table t3(f int); +SET TIMESTAMP=1040323952; +SET @@session.pseudo_thread_id=1; +insert into t3 select * from t1 where f<6; +SET TIMESTAMP=1040324145; +SET @@session.pseudo_thread_id=2; +create temporary table t3(f int); +SET TIMESTAMP=1040324186; +SET @@session.pseudo_thread_id=1; +insert into t2 select count(*) from t3; +SET TIMESTAMP=1040324200; +SET @@session.pseudo_thread_id=2; +insert into t3 select * from t1 where f>=4; +SET TIMESTAMP=1040324211; +SET @@session.pseudo_thread_id=1; +drop temporary table t3; +SET TIMESTAMP=1040324219; +SET @@session.pseudo_thread_id=2; +insert into t2 select count(*) from t3; +SET TIMESTAMP=1040324224; +SET @@session.pseudo_thread_id=2; +drop temporary table t3; + +select * from t2; \ No newline at end of file diff --git a/sql/log_event.cc b/sql/log_event.cc index 5050bba9965..9fae7639549 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -728,7 +728,9 @@ int Query_log_event::write_data(IO_CACHE* file) #ifndef MYSQL_CLIENT Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length, bool using_trans) - :Log_event(thd_arg, 0, using_trans), data_buf(0), query(query_arg), + :Log_event(thd_arg, !thd_arg->lex.tmp_table_used ? + 0 : LOG_EVENT_THREAD_SPECIFIC_F, using_trans), + data_buf(0), query(query_arg), db(thd_arg->db), q_len((uint32) query_length), error_code(thd_arg->killed ? ER_SERVER_SHUTDOWN: thd_arg->net.last_errno), thread_id(thd_arg->thread_id) @@ -810,6 +812,8 @@ void Query_log_event::print(FILE* file, bool short_form, char* last_db) *end++=';'; *end++='\n'; my_fwrite(file, (byte*) buff, (uint) (end-buff),MYF(MY_NABP | MY_WME)); + if (flags & LOG_EVENT_THREAD_SPECIFIC_F) + fprintf(file,"SET @@session.pseudo_thread_id=%lu;\n",(ulong)thread_id); my_fwrite(file, (byte*) query, q_len, MYF(MY_NABP | MY_WME)); fprintf(file, ";\n"); } @@ -845,7 +849,7 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli) thd->query_error= 0; // clear error thd->clear_error(); - thd->slave_proxy_id = thread_id; // for temp tables + thd->variables.pseudo_thread_id= thread_id; // for temp tables /* Sanity check to make sure the master did not get a really bad @@ -1468,7 +1472,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli) ex.skip_lines = skip_lines; List field_list; set_fields(field_list); - thd->slave_proxy_id = thd->thread_id; + thd->variables.pseudo_thread_id= thd->thread_id; if (net) { // mysql_load will use thd->net to read the file diff --git a/sql/log_event.h b/sql/log_event.h index 20a134ab3cc..4fa18c5cec6 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -212,8 +212,10 @@ struct sql_ex_info #define BINLOG_MAGIC "\xfe\x62\x69\x6e" -#define LOG_EVENT_TIME_F 0x1 -#define LOG_EVENT_FORCED_ROTATE_F 0x2 +#define LOG_EVENT_TIME_F 0x1 +#define LOG_EVENT_FORCED_ROTATE_F 0x2 +#define LOG_EVENT_THREAD_SPECIFIC_F 0x4 /* query depends on thread + (for example: TEMPORARY TABLE) */ enum Log_event_type { diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 9de04ac3454..19636531208 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1894,6 +1894,7 @@ int main(int argc, char **argv) set_options(); get_options(argc,argv); + max_system_variables.pseudo_thread_id= (ulong)~0; if (opt_log || opt_update_log || opt_slow_log || opt_bin_log) strcat(server_version,"-log"); DBUG_PRINT("info",("%s Ver %s for %s on %s\n",my_progname, diff --git a/sql/set_var.cc b/sql/set_var.cc index 691add191b2..669a0911192 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -21,6 +21,8 @@ - If the variable is thread specific, add it to 'system_variables' struct. If not, add it to mysqld.cc and an declaration in 'mysql_priv.h' + - Don't forget to initialize new fields in global_system_variables and + max_system_variables! - Use one of the 'sys_var... classes from set_var.h or write a specific one for the variable type. - Define it in the 'variable definition list' in this file. @@ -154,6 +156,8 @@ sys_var_thd_ulong sys_max_error_count("max_error_count", &SV::max_error_count); sys_var_thd_ulong sys_max_heap_table_size("max_heap_table_size", &SV::max_heap_table_size); +sys_var_thd_ulong sys_pseudo_thread_id("pseudo_thread_id", + &SV::pseudo_thread_id); sys_var_thd_ulonglong sys_max_join_size("max_join_size", &SV::max_join_size, fix_max_join_size); @@ -364,6 +368,7 @@ sys_var *sys_variables[]= &sys_net_retry_count, &sys_net_wait_timeout, &sys_net_write_timeout, + &sys_pseudo_thread_id, &sys_query_cache_size, #ifdef HAVE_QUERY_CACHE &sys_query_cache_limit, @@ -512,6 +517,7 @@ struct show_var_st init_vars[]= { {"pid_file", (char*) pidfile_name, SHOW_CHAR}, {"port", (char*) &mysql_port, SHOW_INT}, {"protocol_version", (char*) &protocol_version, SHOW_INT}, + {sys_pseudo_thread_id.name, (char*) &sys_pseudo_thread_id, SHOW_SYS}, {sys_read_buff_size.name, (char*) &sys_read_buff_size, SHOW_SYS}, {sys_read_rnd_buff_size.name,(char*) &sys_read_rnd_buff_size, SHOW_SYS}, {sys_rpl_recovery_rank.name,(char*) &sys_rpl_recovery_rank, SHOW_SYS}, diff --git a/sql/sql_base.cc b/sql/sql_base.cc index e2b36106fb0..7d0864d7adb 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -798,7 +798,7 @@ TABLE **find_temporary_table(THD *thd, const char *db, const char *table_name) uint key_length= (uint) (strmov(strmov(key,db)+1,table_name)-key)+1; TABLE *table,**prev; - int4store(key+key_length,thd->slave_proxy_id); + int4store(key+key_length,thd->variables.pseudo_thread_id); key_length += 4; prev= &thd->temporary_tables; @@ -838,7 +838,7 @@ bool rename_temporary_table(THD* thd, TABLE *table, const char *db, (strmov((table->real_name=strmov(table->table_cache_key=key, db)+1), table_name) - table->table_cache_key)+1; - int4store(key+table->key_length,thd->slave_proxy_id); + int4store(key+table->key_length,thd->variables.pseudo_thread_id); table->key_length += 4; return 0; } @@ -992,7 +992,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name, if (thd->killed) DBUG_RETURN(0); key_length= (uint) (strmov(strmov(key,db)+1,table_name)-key)+1; - int4store(key + key_length, thd->slave_proxy_id); + int4store(key + key_length, thd->variables.pseudo_thread_id); for (table=thd->temporary_tables; table ; table=table->next) { @@ -1006,6 +1006,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name, DBUG_RETURN(0); } table->query_id=thd->query_id; + thd->lex.tmp_table_used= 1; goto reset; } } @@ -1806,7 +1807,7 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, +1), table_name) - tmp_table->table_cache_key)+1; int4store(tmp_table->table_cache_key + tmp_table->key_length, - thd->slave_proxy_id); + thd->variables.pseudo_thread_id); tmp_table->key_length += 4; if (link_in_list) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index ba6369b0022..12ea06fa220 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -100,7 +100,7 @@ THD::THD():user_time(0), fatal_error(0), start_time=(time_t) 0; current_linfo = 0; slave_thread = 0; - slave_proxy_id = 0; + variables.pseudo_thread_id= 0; file_id = 0; cond_count=0; warn_id= 0; diff --git a/sql/sql_class.h b/sql/sql_class.h index ca56d2dcdf5..084ae412b3a 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -370,6 +370,12 @@ struct system_variables ulong tmp_table_size; ulong tx_isolation; + /* + In slave thread we need to know in behalf of which + thread the query is being run to replicate temp tables properly + */ + ulong pseudo_thread_id; + my_bool log_warnings; my_bool low_priority_updates; @@ -522,11 +528,6 @@ public: each thread that is using LOG_INFO needs to adjust the pointer to it */ LOG_INFO* current_linfo; - /* - In slave thread we need to know in behalf of which - thread the query is being run to replicate temp tables properly - */ - ulong slave_proxy_id; NET* slave_net; // network connection from slave -> m. my_off_t log_pos; /* Used by the sys_var class to store temporary values */ diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 833f36dbe9f..c1f44a85609 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -170,6 +170,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length) lex->slave_thd_opt=0; lex->sql_command=SQLCOM_END; lex->safe_to_cache_query= 1; + lex->tmp_table_used= 0; bzero(&lex->mi,sizeof(lex->mi)); return lex; } diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 0c761baffa3..385defbdf8e 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -459,6 +459,7 @@ typedef struct st_lex uint slave_thd_opt; CHARSET_INFO *charset; char *help_arg; + bool tmp_table_used; } LEX; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index d343ccd39f5..7ce50ba0f96 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -190,6 +190,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, wrong_tables.append(String(table->real_name,default_charset_info)); } } + thd->lex.tmp_table_used= tmp_table_deleted; if (some_tables_deleted || tmp_table_deleted) { query_cache_invalidate3(thd, tables, 0); @@ -814,6 +815,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, (void) rm_temporary_table(create_info->db_type, path); goto end; } + thd->lex.tmp_table_used= 1; } if (!tmp_table && !no_log) { From 49efae72b1a4ae96d0b790e804417154e4300e25 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 29 Dec 2002 21:50:52 -0200 Subject: [PATCH 102/220] Fix compiler warnings removing unreferenced variables sql/field.cc: Removing unreferenced local variables sql/item.cc: Remove unreferenced local variable sql/sql_parse.cc: Remove unreferenced local variable sql/sql_select.cc: Remove unreferenced local variable sql/sql_show.cc: Remove unreferenced local variable --- sql/field.cc | 2 -- sql/item.cc | 1 - sql/sql_parse.cc | 2 -- sql/sql_select.cc | 2 +- sql/sql_show.cc | 2 -- 5 files changed, 1 insertion(+), 8 deletions(-) diff --git a/sql/field.cc b/sql/field.cc index 9acf2e14829..36d1bf49c7c 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2797,7 +2797,6 @@ double Field_timestamp::val_real(void) longlong Field_timestamp::val_int(void) { - uint len,pos; int part_time; uint32 temp; time_t time_arg; @@ -3926,7 +3925,6 @@ double Field_string::val_real(void) longlong Field_string::val_int(void) { - longlong value; CHARSET_INFO *cs=charset(); return my_strntoll(cs,ptr,field_length,NULL,10); } diff --git a/sql/item.cc b/sql/item.cc index feb318f829d..da62207307c 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -608,7 +608,6 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) (char *)field_name); if (!r) return 1; - int res; if (r->check_cols(1) || r->fix_fields(thd, tables, ref)) return 1; r->depended_from= last; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index de976076a33..b053e694e4e 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1461,7 +1461,6 @@ mysql_execute_command(THD *thd) int res= 0; LEX *lex= &thd->lex; TABLE_LIST *tables= (TABLE_LIST*) lex->select_lex.table_list.first; - TABLE_LIST *cursor; SELECT_LEX *select_lex= &lex->select_lex; SELECT_LEX_UNIT *unit= &lex->unit; DBUG_ENTER("mysql_execute_command"); @@ -1803,7 +1802,6 @@ mysql_execute_command(THD *thd) } if (tables->next) { - TABLE_LIST *table; if (check_table_access(thd, SELECT_ACL, tables->next)) goto error; // Error message is given } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 9ee8af08ae4..4ac55c75e3a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -7525,7 +7525,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, JOIN_TAB *tab=join->join_tab+i; TABLE *table=tab->table; char buff[512],*buff_ptr=buff; - char buff1[512], buff2[512], buff3[512]; + char buff1[512], buff2[512]; String tmp1(buff1,sizeof(buff1),default_charset_info); String tmp2(buff2,sizeof(buff2),default_charset_info); tmp1.length(0); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index ebade0111b0..4cb0d2098d0 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -841,7 +841,6 @@ int mysqld_show_keys(THD *thd, TABLE_LIST *table_list) { TABLE *table; - char buff[256]; Protocol *protocol= thd->protocol; DBUG_ENTER("mysqld_show_keys"); DBUG_PRINT("enter",("db: %s table: %s",table_list->db, @@ -1329,7 +1328,6 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) time_t now= time(0); while ((thd_info=thread_infos.get())) { - char buff[20],*end; protocol->prepare_for_resend(); protocol->store((ulonglong) thd_info->thread_id); protocol->store(thd_info->user); From 23af1755f4e060b1121cae6a86df7510b3bba1b5 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 Dec 2002 21:42:02 +0400 Subject: [PATCH 103/220] fixing rpl_temporary.test for FreeBSD/Linux thread-order (it add 4 sec. sleep) --- mysql-test/r/rpl_temporary.result | 4 ++-- mysql-test/t/rpl_temporary.test | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/rpl_temporary.result b/mysql-test/r/rpl_temporary.result index a8a9fd92a87..a628936b600 100644 --- a/mysql-test/r/rpl_temporary.result +++ b/mysql-test/r/rpl_temporary.result @@ -31,8 +31,8 @@ master-bin.000001 290 Query 1 290 use `test`; create temporary table t3(f int) master-bin.000001 357 Query 1 357 use `test`; insert into t3 select * from t1 where f<6 master-bin.000001 433 Query 1 433 use `test`; create temporary table t3(f int) master-bin.000001 500 Query 1 500 use `test`; insert into t2 select count(*) from t3 -master-bin.000001 573 Query 1 573 use `test`; drop temporary table t3 -master-bin.000001 631 Query 1 631 use `test`; insert into t3 select * from t1 where f>=4 +master-bin.000001 573 Query 1 573 use `test`; insert into t3 select * from t1 where f>=4 +master-bin.000001 650 Query 1 650 use `test`; drop temporary table t3 master-bin.000001 708 Query 1 708 use `test`; insert into t2 select count(*) from t3 master-bin.000001 781 Query 1 781 use `test`; drop temporary table t3 drop table if exists t1; diff --git a/mysql-test/t/rpl_temporary.test b/mysql-test/t/rpl_temporary.test index a924e628fd4..1cb53c77f1f 100644 --- a/mysql-test/t/rpl_temporary.test +++ b/mysql-test/t/rpl_temporary.test @@ -12,18 +12,23 @@ insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); connection con1; create temporary table t3(f int); insert into t3 select * from t1 where f<6; +sleep 1; connection con2; create temporary table t3(f int); +sleep 1; connection con1; insert into t2 select count(*) from t3; +sleep 1; connection con2; insert into t3 select * from t1 where f>=4; +sleep 1; connection con1; drop temporary table t3; +sleep 1; connection con2; insert into t2 select count(*) from t3; From cbe18bae8b570f22d9b67466b7a9efe666b88ff3 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 Dec 2002 15:10:10 -0800 Subject: [PATCH 104/220] pure coverage test updates --- mysql-test/r/create.result | 15 +++++++++++++-- mysql-test/t/create.test | 8 ++++++-- sql/sql_table.cc | 14 ++++++++------ 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index e1c5bb61da9..6bfda427f78 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -198,9 +198,9 @@ t3 CREATE TABLE `t3` ( ) TYPE=MyISAM CHARSET=latin1 select * from t3; id name -drop table t3; +drop table t2, t3; +drop database if exists test_$1; create database test_$1; -drop table if exists test_$1.t3; create table test_$1.t3 like t1; create temporary table t3 like test_$1.t3; show create table t3; @@ -209,6 +209,15 @@ t3 CREATE TEMPORARY TABLE `t3` ( `id` int(11) NOT NULL default '0', `name` char(20) character set latin1 default NULL ) TYPE=MyISAM CHARSET=latin1 +create table t2 like t3; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + `name` char(20) character set latin1 default NULL +) TYPE=MyISAM CHARSET=latin1 +select * from t2; +id name create table t3 like t1; create table t3 like test_$1.t3; Table 't3' already exists @@ -218,6 +227,8 @@ create table t3 like non_existing_table; Unknown table 'non_existing_table' create temporary table t3 like t1; Table 't3' already exists +create table t3 like `a/a`; +Incorrect table name 'a/a' drop table t1, t2, t3; drop table t3; drop database test_$1; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index f5f5116b429..e057ffaebb0 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -134,18 +134,22 @@ select * from t3; drop table t3; show create table t3; select * from t3; -drop table t3; +drop table t2, t3; +drop database if exists test_$1; create database test_$1; -drop table if exists test_$1.t3; create table test_$1.t3 like t1; create temporary table t3 like test_$1.t3; show create table t3; +create table t2 like t3; +show create table t2; +select * from t2; create table t3 like t1; !$1050 create table t3 like test_$1.t3; --error 1044,1 create table non_existing_database.t1 like t1; !$1051 create table t3 like non_existing_table; !$1050 create temporary table t3 like t1; +!$1103 create table t3 like `a/a`; drop table t1, t2, t3; drop table t3; drop database test_$1; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 7cb1cee7e3c..05090cdf3e5 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1413,8 +1413,8 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table, check_table_name(src_table,table_ident->table.length)) || table_ident->db.str && check_db_name((src_db= table_ident->db.str))) { - net_printf(thd,ER_WRONG_TABLE_NAME,src_table); - DBUG_RETURN(0); + my_error(ER_WRONG_TABLE_NAME, MYF(0), src_table); + DBUG_RETURN(-1); } if ((tmp_table= find_temporary_table(thd, src_db, src_table))) @@ -1470,14 +1470,16 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table, { if (err || !open_temporary_table(thd, dst_path, db, table_name, 1)) { - (void) rm_temporary_table(create_info->db_type, dst_path); - DBUG_RETURN(-1); + (void) rm_temporary_table(create_info->db_type, + dst_path); /* purecov: inspected */ + DBUG_RETURN(-1); /* purecov: inspected */ } } else if (err) { - (void) quick_rm_table(create_info->db_type, db, table_name); - DBUG_RETURN(-1); + (void) quick_rm_table(create_info->db_type, db, + table_name); /* purecov: inspected */ + DBUG_RETURN(-1); /* purecov: inspected */ } DBUG_RETURN(0); From bc1718c915e62b8612804c35cb71f4d7756a2115 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 31 Dec 2002 10:17:35 +0200 Subject: [PATCH 105/220] ha_innodb.cc: Fix bug: could not switch trx isolation back to REPEATABLE READ after switching it to some other level sql/ha_innodb.cc: Fix bug: could not switch trx isolation back to REPEATABLE READ after switching it to some other level --- sql/ha_innodb.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index dd718f02ba9..3ab7de5d3bb 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -3812,8 +3812,8 @@ innobase_map_isolation_level( enum_tx_isolation iso) /* in: MySQL isolation level code */ { switch(iso) { - case ISO_READ_COMMITTED: return(TRX_ISO_READ_COMMITTED); case ISO_REPEATABLE_READ: return(TRX_ISO_REPEATABLE_READ); + case ISO_READ_COMMITTED: return(TRX_ISO_READ_COMMITTED); case ISO_SERIALIZABLE: return(TRX_ISO_SERIALIZABLE); case ISO_READ_UNCOMMITTED: return(TRX_ISO_READ_UNCOMMITTED); default: ut_a(0); return(0); @@ -3868,11 +3868,9 @@ ha_innobase::external_lock( trx->n_mysql_tables_in_use++; prebuilt->mysql_has_locked = TRUE; - if (thd->variables.tx_isolation != ISO_REPEATABLE_READ) { - trx->isolation_level = innobase_map_isolation_level( + trx->isolation_level = innobase_map_isolation_level( (enum_tx_isolation) thd->variables.tx_isolation); - } if (trx->isolation_level == TRX_ISO_SERIALIZABLE && prebuilt->select_lock_type == LOCK_NONE) { From 2fff4f018341df87d8217203883ff08be8cb840a Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 31 Dec 2002 13:00:41 +0400 Subject: [PATCH 106/220] XML parser --- include/Makefile.am | 2 +- include/my_xml.h | 59 +++++++ mysys/Makefile.am | 5 +- mysys/test_xml | Bin 0 -> 35493 bytes mysys/test_xml.c | 89 +++++++++++ mysys/xml.c | 369 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 522 insertions(+), 2 deletions(-) create mode 100644 include/my_xml.h create mode 100755 mysys/test_xml create mode 100644 mysys/test_xml.c create mode 100644 mysys/xml.c diff --git a/include/Makefile.am b/include/Makefile.am index c88e1ee1e40..652278e8a80 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -16,7 +16,7 @@ # MA 02111-1307, USA BUILT_SOURCES = mysql_version.h m_ctype.h my_config.h -pkginclude_HEADERS = dbug.h m_string.h my_sys.h my_list.h \ +pkginclude_HEADERS = dbug.h m_string.h my_sys.h my_list.h my_xml.h \ mysql.h mysql_com.h mysqld_error.h mysql_embed.h \ my_semaphore.h my_pthread.h my_no_pthread.h raid.h \ errmsg.h my_global.h my_net.h my_alloc.h \ diff --git a/include/my_xml.h b/include/my_xml.h new file mode 100644 index 00000000000..25db161715a --- /dev/null +++ b/include/my_xml.h @@ -0,0 +1,59 @@ +/* Copyright (C) 2000 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#ifndef _my_xml_h +#define _my_xml_h + +#ifdef __cplusplus +extern "C" { +#endif + + +#define MY_XML_OK 0 +#define MY_XML_ERROR 1 + +typedef struct xml_stack_st +{ + char errstr[128]; + char attr[128]; + char *attrend; + const char *beg; + const char *cur; + const char *end; + int (*enter)(struct xml_stack_st *st,const char *val, uint len); + int (*value)(struct xml_stack_st *st,const char *val, uint len); + int (*leave)(struct xml_stack_st *st,const char *val, uint len); +} MY_XML_PARSER; + +void my_xml_parser_create(MY_XML_PARSER *st); +void my_xml_parser_free(MY_XML_PARSER *st); +int my_xml_parse(MY_XML_PARSER *st,const char *str, uint len); + +void my_xml_set_value_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, const char *, uint len)); +void my_xml_set_enter_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, const char *, uint len)); +void my_xml_set_leave_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, const char *, uint len)); + +uint my_xml_error_pos(MY_XML_PARSER *st); +uint my_xml_error_lineno(MY_XML_PARSER *st); + +const char *my_xml_error_string(MY_XML_PARSER *st); + +#ifdef __cplusplus +} +#endif + +#endif /* _my_xml_h */ diff --git a/mysys/Makefile.am b/mysys/Makefile.am index 330e1d6e59d..cc72bfae7cf 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -50,7 +50,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\ my_getopt.c my_mkdir.c \ default.c my_compress.c checksum.c raid.cc \ my_net.c my_semaphore.c my_port.c \ - my_vsnprintf.c charset.c my_bitmap.c my_bit.c md5.c \ + my_vsnprintf.c charset.c xml.c my_bitmap.c my_bit.c md5.c \ my_gethostbyname.c rijndael.c my_aes.c sha1.c \ my_handler.c EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \ @@ -104,6 +104,9 @@ test_dir: test_dir.c $(LIBRARIES) test_charset$(EXEEXT): test_charset.c $(LIBRARIES) $(LINK) $(FLAGS) -DMAIN $(srcdir)/test_charset.c $(LDADD) $(LIBS) +test_xml$(EXEEXT): test_xml.c $(LIBRARIES) + $(LINK) $(FLAGS) -DMAIN $(srcdir)/test_xml.c $(LDADD) $(LIBS) + charset2html$(EXEEXT): charset2html.c $(LIBRARIES) $(LINK) $(FLAGS) -DMAIN $(srcdir)/charset2html.c $(LDADD) $(LIBS) diff --git a/mysys/test_xml b/mysys/test_xml new file mode 100755 index 0000000000000000000000000000000000000000..6b8b0b3b83c62e8bb17978098ca5273cbfc81903 GIT binary patch literal 35493 zcmd^od3;>Om2R~yK&&=kmV`|P8(SdD>egb}!XVp{vB8V5WMS5(rEaO)NNUlGY_m2N z1{B4_ESZo2GKPeZ@JK=!GEWn-I4lP8BQKtrmxMRN1ZM_ zNywYO-n;%?->*)csye6YoZ4>b_HE6}7KcKiBbB)(sEH~B{NSdN(i%J~ZqX4ns!ScO zW~$TGr|?vYaWw_-;NAwz`!L)kxF_O%pEu%oe+rm4q0p1aZ8#BFvj|u?*gmQOM-mOGl+A+-ceFY zB`H5;W!>Qcx!xON`hAFJnDNizF5MJ_Peb@M7hkHri}3mgvy= z`f^<=8jUA1iSAT3m&ioBGO^wS;=9sh&L(my+68VEy?EKmg$tHNS1w-M+T0dxTd;6h za}-GrmJkJZW;XQabm5sqEUwc1i9QO{YXpjB7cPF!X_NH~_e+>kCmR{QPQsKvxrE^s2~&$?3&V{FuO51P zaL+N9x3>=cw%jp;FTTHOv8zBm~;NoN^tM|kw5Ka%+V;EVfF+~~JZ zhb^Pa5wS&NC>@-iL>4OFxO>Xx0X2A79HEj&`Tua^{;?f`22s@8BamI8sAHLZ58_Av zX2XXcynGmwBUAP23rMf?eDwwWv`J1Fd~sj$I_Rd;btB!YFPQQT@8tH@VN}F5lZTt9 z%zb@e!qDqOFF@qh;pSsn+DB(WhwUZRYI9=rs%wY#T*Lft-!lb9MTX(klapgGv{fye zA5r_q##%?eE)}t_HF-O$;mwc6#=_f%9~u2{Y>bJuoFA7yWz%nF`oHC0{UFED-d zpy>zqOlcjyrj)h$D7of>3-#2R{5nJDBQ$)?sMEC~6jEqEBpA*gv-LY*xqB1Ler)rm z5dKF^CCA2;T8p+_Ao)xl{4jLe@yLAm@RregAkMD;KpSltzP4o3zvK^l?(dKR3R|mM zM=#U-o3`C@CM!JoLqsJ@(O9FuKwXZoX?H!%w6+jbGKy?%8GRY?LoaVHIZL6O&EI+J zkAEC%AN@6aZt%r2w)m-cm6W!R9*gmfq1W$ZXm=33MxrN3^#03R+ec5s3;{`DV-aN7 zKKdbeTLgV1sV3{dOi3}hu_gH`YbpdOq`>z#Z=wh-qql)OylwO2uOM{QwNX=t@TS3S zZw~IOUe_@;ZByg@C8e-~5ryaO_AMhNe6H9sax|Zdw~QRm=Y?BFPU5p}%gCqrtlTnk z2A}6{8JWuGnOjE6`8;{cNF|@gZ5fI1dH9x*Iy?hgGi|+l!q~*&i4BWNvZ(5PlYXFD zl9L~R3crM5!f!Wi%fGq1WXss4C7S7UFbyv%ne>CkF~j&B$N102IIPdHFM)CFE*;uC zHb{RQmj4?Dj{(k}TU1=yN#uc_aCHGh*S_@bfhKm0VKII)qa+@kN20J#q$=j5U7L%#@k^KT6Q zEp-`}MgE9EQEs9xo$^A?MU?Z`_>Z+F@lwHOvVw2Q# zNFqJJ?)=c+&4Y}dEBphKbh_=Ta!d$1h$7n|?5dX0oA#k^cz2@24axu8*)o#{pX1bB z%Q#ibD6xav3gxf2=ptHLhX=_uw!`o5wakYeBaTFgJ310}zgY$H-7A21wRx#`v1{JDR~&0V$jtjjiEv$J)S zFmqeTa%5bG_=F2(Vu)^>#Y$sg)&A?rPjG=sGyQ(_94UAj@>0gd&AqdAFhzi&@*J)ocLPMhYjwjpgyPs8TB^b!xkC3hkQeK zmdO7!!O-(Ve?`BayJOPeQh46xTlT@*eM>NQ}oQA87N-+eg36 z5fbArMvq04?${45P5)v*pPgT%X`2Gt(j07NKkT!0^nQ3+OR|89*wrSMhN>+c&)WtyS%# ze+$`-_Ve?%ki7h@%i2dD)}05k+I-DEYSS8M(?0r58GhJz-zkEqF*tX{t_xsJsGru{VS^to&94oLz0_BDPLS!*Vt)r_x<6nU zl{p}5n|+JXap|NxLQMK$>!dsOk>SJH`57o~Ev6Ceqdy2zKj~86>r&scN97ivrE(`B zg|z$^;eRd3qdt%E?;6e(bT;dPY&u;wmjv02svJ5$!+c4=Tqgoun7helKToosiR{}) z``*WVW(qjAXqz5t-naXREn{Nen$mEmjC<(BFUY^cW|O#~MI|EYTI2<5LR(@imhy*- zn&U~`;(k_>Hhv$%VOEiN#kixHztX$WU!D%DY8n0f?@+s#VKUA>;mPpUA?bj})7Z<6 zr?De&v}Tz^4DCgJ!^=yDZxL7GOS zsmHwpcXC|%H6~m(j$Sn`d?;CGg6}%qWk()+l)7N*tXXQ-tP9me^Jiah;Z$|ejI#+O zt}R^_PbB)w)+}GfN}X}R?CIGHXO!jp66^aDow-E3Y^J5Hi}fK~e#p9KM0g%rxhQoi zp6JV!*|gP%h)<*4XU}kKhb*J!(CM*bk?QMqS=1fCiPm*nG`*r`+?m2;Qk>mPR9$6my}|Z zRBLc^e~|l^+{?^CM&cekx%WloxF7121g30CwNHHD0xe4%p|4>_wZ*t{J4j=dw9&l zXQRSwo{K%)@8LUuH$vuzhL!rF!A1r3m;uii`aicR^*93o2DDc#hzU z1q)PncsP%}yaN8&%jR=8=vsOmW9eV==+7Gbqu(m^6N9g>!2%ArAl9nXM}leT*mH&P z70izN48hnq#C3sSTDDS`38v*L)h(FTs}%OqkXG;L-!E8u!Pf#}|(c&_lgBUpRwM}p@I zeF{2|g1S)f`GUEVuhb&J3j|*!c%k5a!CL0e32qkpHv}&h{1d?!3;vDZC4wiS$qQHM#3P--D?!Ni{nw=CeDqP;BtBG9K{G~syB0=yM(&){b2YJ*YriaYhBj9xjVtrC~p{*`i;R8kk3Bg0!ziBhed3|jgVYB@xSgBsH4WGqT8K@ zH>2G0)#aYz>3fRISG2yTxO|$xAL#ojkA9kmPxtga!_)Unk>Qh;yHj*LMfA}6o+9s? zr$PP#t>@3ww@LIpTX7Ft>pRuccdDoFR8N<)J$=vd=+ixXuBYz|Pv4oM?pRuc zcdF>yBKpFT{!D%QMc?z)gV6U@;H~OB&j-(kXXvX*Rd_nilKCWKnp7oXu%0?ZKEt3l zB2V9s$p4`5ht-QH_bXCvm6ZEUgXu@Snov^#j>tP&O|Msa^drwag)U02CLlcuk$$0C z=I9rho}Tmt*a@-x3)L+SH>p9_11?xHCuLSEk;Rk|s?|&So)OJodU9g@L&KJBu zq+Ts}q2RTG7YQB`+${JB!P*;N7Odxl?+9KZJRb?xbHbCRuv|SSJYTS$6J8`(d-COi zmrL5T;1z-g1?xHC7X-Hm{VBnh34UJiD#1S&+$#7#1h)z1LfXy=PZq4_gcXAIoN%#V zJtw?UaF3+roRDqAt54{+3%*0}oq``0JS_Ozg0~2MS@7otzad!93I9{Do)ea0NmCFG zoRJaytO*4+b}i@|K|SxpkQ(s#pZ4$`4@WR$7Svsm&y|984>%}TXa5}xp9KxohaT?z zv@R=wB!|Jal@H=g=9%PYBav zf;Imy1wSQ$4}e(@H)6x#q%+B1A@nL>((PqsTP8f(FXDnV$5~}TxujVBIcEp-U4q|| z1jn93`mY672o|U|3VvS#4*_ok`dmb*|8DTtZc*wN9{)4bnUD56CbH$eCUnV0-Fhy0 zs&&BQc~Iz@{96x`V)L0bBdCW(9`<=+hoJjBw;G-wqy6s(E-=zuwyc+gu1DP83cg-A zrp_e4_MLXYy+Z$j;6A}W5u6r$OgZ`c1uVSKP>s+d<(8`3cgG5OM*8G z-XnO6;4#7X3O=!lGTbNlT*3DXo+tPL!7YLx5xidTmjpiwyb)!VWt!@Q8=cfIk<6TdC_jd=gyL(%=m@5kYtl+(ZHw!)*=3Y?u3O-Bl{eo)* ze@XBX!H)^PPVkonuM_;7;Li#Ek>Do;|Eu8V1piX-PX)gzcvSFC!5<0!mEcL3z7*8I z3qD)$+k)!_za#ik!7C?HFJ6!7hk6+FjRrsCVeV%>Z|Hnje)3rQs~*44<74iVke~Y` zZ-T$TNL;7Fy$cE*Fs^FgX*gZWIrAdmt=K;)l^CuIg7p#CS*JSsELG-krQ307!d@;+ zQ?4c;6lri+H98zoOB}9NEe_Xs>!4b7ouk*Oq{H>5m!)iT)dtW%PX1|#C(jDe@d9-R zbnF%#8$2B^@Ya&^y|v_p3SFCAO&IU48JEunFP}l+My&5_1G8N6ZR^eYL z?-N237Q?_@L~@yaql*oFc-bV@m#7_JG@L?>+o{b>2QlzhnFcm3b77b zl^%JBSF6uE{&w|-! zPBl9mQ_CEVtE(MOsGA(_Qo2`W{@v;!M^CD)4yV-D9bT)x>2R-l+TlL+hQnz!>Tth$ z&*AlIufrSUaK7KB&m5vnzXy7wS}69gU2v1BHNA$l?YooI2|9{4L;MfmpN5tHTf-%# zZ%h6+i_N@iFw^cgc(P84dbmaQ2^nlsw|cg8oA~1=&GU$Pl>cTC?F56F_n97Mm@?Df z%R!%pcSch_Yh~W($-Gf)Sj)W8+jkoDeDDslBS`u0l(YZLzX|hy46$-GsUfdF8TR&4 zKC4zbo_joB_?${P`WCg$;d{-Dp84M=f0yt{<=6GIQQBA6&qk>$T|XOLTd;n(64Lv? zpI5J-e&(aDw&E=$``C*OW}CJe%r?Eo;3>eon&6p1pZr(e{__{S{pSb0{pT-w`_F$_ zx!sVV5prT$r*1HqvfN^@-`8;7_WHwt2(s#{3A2mOZA%L+3D?t{!0C;qyL+F z%i({QzvW@DNxiLpLnEJKDM}*|?qR4P$C>Xycg)W+)6=+h&hpuz@#E_n$ zQ{R(9w>bLAp&^Gq71A?t@|+gB&(Y5aeZk=~Ltl5eEcBGaXNO*N_?*xVho^`B$>ABH z|K;%cq4yk~724}?W#~B5>0oXdI?>_k&=iMjLT5N!8=C9zoKUmF^`R9G&kJ4Qa6_oi z;rXE(9KJ9#=(Q-^?L@q_2Vz^F#8!7=>dT9L4)Jp2 zIZZ7LU45_Za~6bxv1wt5;{~rKwaEPuDCV@G(?B~^T3tU2j0Nkm$iG&~x;V7nm9^L_ zYe|TreH;&E#!^acl6)==6Qc!QNg)3+PyXeh6F(-O7rlJ6 zE|-L8w*LfrBl2f{yeJRz`8ScLCG>!kXQjxa^I7T1)8ff}6JN6WL)lV{}t z@=UydvaJq%&B@c|$}6JN6XXZ$Vi~Nnke_iMmS60+3>pHKjm{(S(S10jMur5x7&On~Lnp9`# zEDeFXLNgui4q-dvkmYJQqxj=1?8`y6Mimp8{RkM*vWKnVs=L?GrM;~_J*EWHI?DYb(!lK+K`>C zDrfVUui@|R?2JS^)4lyT035GW_*2<=xtUcJ;qv(zc{Eg2MXKC|P6{EzRgj|E31Q1RAaU&{NL(as zU63&Bl^Vc?s-Sca8Kot!1EiS~WEx~dRlNEv$}5{pXL7D4>UHw^@`hQ}kvVns4g4Rf zYpw%Io2%L9vN`H%YpZL)sjJqtSh&haRE0dlk$T;1E~kLcnnIYFMQV{%S5G=-%*3=i z;%X49;^}-xPeNNz(CGDyl4|kegT@U<$Ur0PNvwA&htYu9di-5=&pffjimHn0NJFYO z)@{Po5fXxgo>;aC>x^7BZ@+xoB6G?cL_o`PfS{)C!>D{M=|DOa*E*t}Dcjs~?RTlZ z&YpZcF*}=!r_zrCQo{p=XbA8}FqU3#vrCdwMFrX!++x^j^7 zJ{=Vg`W(_ht~cDMbIMa?*)1J)O?ud{hwBVKsu=Wo%kJo?KhU9;KM0 z%3&Gdsz^$N;eAm3Tnc)hQldX?- z#IlKb2%+}Qquya=36qO5$8ko8#EX|MYnIevxb@L~oz|qu6eWnRGr_tV$+4>^)}1A( zzPw^?T}8OA0UsoQCuvGJ91&7S7qhG`NA=WGw`fmCmnTbju6P8x^Yry8ksR$PlFu!# zh(vTrojqx-6&mwA+)*}Pk%5v1#YyA_6>&d~!5*E~97s6WHqQb(vI7L|~f<4{Fh5Q(dd&%y$@ds_Sb+oxH8Gni^eD-qu=8z0Nkz7GlY$Ok z4W@Z&QBgF6KFfv*2-vC|TXkJUJ!{XDUt6Qg@94SStIoPAEkwGj3txyJEA*?YF;*q5 zouer9if~2k0et}f3Szvk=lk#hiuiachvnRc{=@-Y10&$xHqLqa9I@nTn1TY$xa}Nc z%8&#^aiOIFz4Zt=NimEps`@*i_7sx-+dB z=#6UQkglX&)R%sc5k)b&3Q#&?`cr-J#Cnq?=m` zK1*VvbW@{IP|um(SoV5bh;D8jk&N}lb%&13*yMOXb@5HKQ5tEBShThn{Txd^YGw!M zsE}TIMo1%b5y)64b|}L~o`aK+D4JAFKFR@BXq2jo^_UNmQXrkwrlkFulptwat&=v; zw#p)mvBImttc{gqW36?@0%@%z8!v$L9EQYR^U)jfvA9$h$ka+=l}}~G({t1fv3Oh$ zabTiictDr)_=N3u`q9(}WGKOon6c5Kc-AiBA-9PiD2}J$ph6+2iI01^M<^&g9C{Ve zDJr#AU8(i`IiprYiwbIY%BmV+8wh8rFY4#4Aqqxzkw)l`ZDmCE#_dM%@= zepGBW(Ve}~lBt$dOm-bQbxWmEy1KfuMHN;}wRB8So>MEH7_d1|Evc@9_E`8BPb$`j z-W`K%rz@3OigvIYkWN>%5te(SkB(Po)4+lxlVmdjk zF(gjypny$?>0cy_*@%$vr7Fxi*gwJf@kD#uiC7rgfCnR2p0h0SV1}nBEIo^;**|T_=>F%ckdCT1H5{F;r~!-971! z7`?EV+?np{N*yq1?aw8-CIGh^`D^JQ)CaZ`jQq7URZuY$*pa_h=3m7lf2|l^@yK5* zvrm8IujPacnQ=bKQCpAvwKDR{Ff3Fv^4H49KZk}RWHa*D%E-@osV19|AJVh)<%Ah@ zH^zfZtt2)W`4Oa6=mhT2xT&$PXHwUpW1dA9O7@c>R$dbhZYo*^T_5X&u08 zM}E)_9Qi@i${=wt^20LN2$H28`9Y&%T;8~mA2e-Mpt+GBL{t4mBR|MgODZN9`9Y;p zy1I%+e#B5M9b-mj(41O!Ar+ci)upJ z8>79czC1Ry*P$0@@phvIF&KSVoT2&>bf)w8j6x>bozRn8Xu=9?gH_ z0wWtMh0OCrILw7Oup_Q3lei&|sm_LZVxinX(h>ZqBx#(FaLY(j@sY^^T@YH0eG|GG zu;>Qs#42EIKAY>s$09gMfsou*!n_LwWjkX%2~>7xCT)r`dqys=kJ}Oq4H9P1ve#A}Np5Kvg;1M>frnsU*>6 z!TK(*;J%SokqKN3CRMeVXz7^PKrDrQ0w#dTN&{iG#{D28PA)0)HHojNnQZj)9(Uik=sT_woO_wBQ9t^sj>xsa6DvZ5vPNMl8Q{#rP;B2HS zd1H|mq%hBBGdptv0j+Fk+Kjjd>yl{$!d#}yk&O8?6n6*Ifn7l_i^o7m6k^hT3ux4maf8Eo+wtXO0@V3#&~<9(%l#@GFCgT8n_JN`xTi{VJA4%%^j2; zvr>~8wrsOt{6m~+bD7uYYczqaZsZYrGE{7qSx?n{g}lc}4A41cnIcvb0XLSYG~6y* zdy7rhS0TRF)TDQ%uIag{uZJ<)EOvZ}=l0iv;7 z8eN@EidCx26EKT9=-x#x6YGa7W5wR>imNg6d5nalV|9QJ6N}}c6N3`6T>sZ5ouXR)8i0n9qSFB8Gaq`(mEYY?*ot) zvosDt^e)U8tSEdfp-Ekiq}To6VtY9UGOsF_VaE20W@HirDrz|yBj(hB*))>u!E+i2 zdjqw&L4!7Mas^G`uL*m%-g32RYbg`F?W8m@!uK_T6-#5!{+jIJ`2aP5niA<|W8x*0b(-I0MK7B$0~ z^o9Dx9$p?`7Gy_|7`u9tsq8Gl)@197t6?)&HUpV{WMfhH>eJ0nKrFIMNKDi8#+UKK zt4zpY#^`F`l3j|&y11yTmEBU~is)*K;%xt&590Ce+w)s_<(G}rRrQYdP>~i? z=bw5w1;x3imJ<}$KkD8V6xTf(M<8AZLfi2fS0~Lmr|E4$3!Kvopu%T6Ipgf4 z#VyTrxTLub(l|S5u7fnr4qB0Onm(7TuIn?ek4baRY2F}%=A6@Xxn%Q=(6~FvZX`19 z4w~~%9ypn?pFh93X%sgqg;>|ExPGYb+EtVX8 zkl*Fl9w$-_UC_dCN-M9{g)2r_KMRt%u3qJ1mPke5W&_22i0wN-*UIVfRu6>(2lq8h zP(*BT--v7<9MpS@$1&{`<0kHSk%YG)hw{aP$I4`XL-r7nok<*{OR6lNQM7-IOQVQc z8X0OPmB#6aqM15gS?f(!sYP^Is6<&HoQDTmV13ra&vT62I5*s^a+z+E8-1bU#taZE z2$!T6nB%U zV+P!rO|-NvS=GFtDY|?$zU3Ni=J#S3EookK>AY}7an!2jMXOh}E^Tj~7a13`V&$sk z3zp5RuF!e3UD47UUA|z=yqXH^O4_4Z5qVLlH;2)=>a$uPN)KQTYau92BMO^oi5|th zjzuOC=Cl?PpbfM2a$HMNn^blht^19?{JfS3D19=vk^ag;4TtmTBGM~=DZe(;@AYJSd*0* zkE1-Xg&3~sydztnV8Q$+&TKJ5G>tcVl^H2SC_c1BKD0={cd%1iS_Tf(tkjP`w#5t& zJhw$EYL(hxbz3wQ!vQV)Xb(E^3_iXqZWTc<0$!SsTF0|5mdf5hsPU9OA^=Wyad?PT z-H=ZgZR=zby>>|{LmbW(c_~F6>A$+Po>OIa;tuOW*YKw z)q>i^`?MRfJn+-m+ph(u4Iv(qVg@Nrtb2ukFQOS?@??(F$T?5Iq z36WeJ#?T`AP!WuUlF&{S)8njw9`j@bz_5VbRZMrgu?df%NydR}eGhgs%$}|_KpZL2 zT+}vjr&uSAm#1#|QV15PbDXXQy0}~P&I4CD<&OV^_ z(UJ4m2MfVYevWSlAQi@dY)!V`R4i>@%Z|;1e*O?yF5L;k(PZX9tG04txscBAtMQT( z4Ti56G4~!PG1kb^Y`(-8u(OyC$KmOaf@4e|w5>vvSA%1@l(tU!>038D} zfHejggu{55>1vmYuLhiG=}yX-QF6nZaGD1s(~5dRq&p-_6(zvT!A&}6Mx@esRmL1( z2bi(}p!L_I&m6$QhP@SbXbhjE7n3q;Yb57VF2njX1==-s5apF>7u$&Rm!oFAjdwjL zC{PLJh1w@gSHG5Ax>!RTNZ9>Rt&fns?pRB&^X<$e;-*`xdSmO>}%`VG4#G}OkerlQ@T-B4=m26F;T4bVk3vaz;5|! z5^pUreL!=kt&tinXy@Wh))YNMFLIv1Q__C@a$$hoFjlV{v1-i_W{E+I>k1~_GnhYZ z9_Vv2cvr;pc<^^*@7afo3raBt0*CC1CgWJxi682fbzKrCbTFD*Yt^<5bBW@(oeZ1S ztg(B7G0Ef94VBCEc&xgSP!j)kf>mpVE7?*LQ&Skn{K*D7d_C0QOiDN3Tgjlu)d*C> zF#?|85t=NyWJCffT&HR5*=YjUP0)W*hLO<>jp*)qZrmj1xCkdRM4Ox=kDMI>W3?WQ zWUWPaH0RcJIq(`VV#b#@r;t&O9yECjnY4he)xkmQVlq{dzsNxaU}%vs2!E8p;S-rb z1^i`+N7rK()?uuHIUKy_~B= zz1STjIYFtz+8f=8#|3R|Jnx8v+RBg~2MyOp^oc)7!mvG`hq_{ked!Di8S{0Q%yuyK zis^HEG7pl>0t%3v)k6)M|%SUV^Nw~baJ*tcY+*1jLb{@!hGko7?BK zY0Ya9IsXb@l|zB(dQ3$X$Kn{M2r9M_R4p@?#ycQ$BN!Q^{tv}~J@RzMb}x&Kg;=wY zI4tL&t~5AZ%r%04a?%UuJ~lQ1-IqnZv*8JvBt!cZuzbNX5Rb`0)I>V zHAEZ@Y%lWhisH6>uY>P(L~LV(xyZ*mj@$A*h~Gqd5Q@HNKMrDe@Q`n`TR#5m@zwZf zi~SY@o99h$#0P9Fk402sSfkYOWMwKm|yDg!}e=@ zLWX=WZtt4ttj)%s;>A)Qzb9tc@4*@V^f><0oc%DOM7=l08aN%l@1hxx61(8}5X80LD zzC8Mr{cSwz|IY{q@*L;B>jtvaC%_}zc{|rn!6C@ce>broPhlK4OM<~ik8hVze>%18bN$h z^1U&BnR=h`Pp1D0!lj#ZJi|{S%DJ3LJP1B9)ApMakFMTGgSE_y!Wf59;9hdsyf zu%9;(J{9?$C-F+XgRs5I0LBo$8T_PCo{6Xz`nyhltU3;1_7}7}=6@2x{6-Xe4u;DS zo{4z&m6W#03Hb*R<~Ox${tqL(2Jvx8uhf?rhI~v@OeK#1G|Bn$~kMI%`{wc!z79_vZM)}@A_-@2AKl1-O!uBd7=*-|mSiY+Z-%lF% zJ*581Y8>8eYFoJ~x@>7{TQq7uQ-j~%tgJyyJRQ}4N*9$Wa5R=*4{Gz0=;BoimN!Qi zHebAS1rl)*9gXLEdpD?b$6EZHXJt67x^OroVW^yT8`zc3@OVO6cKDImBCl}2K$&`* z0)?k}MH7lL(%OKQLx;T2KJo88i#q6PdJS*Q;2) z_Eb1JpUT-7lRH=DD$zHP%B1^nfItg?%1gM9Dd@`QS#|KmQEU9mP44t6td4Q2!e;0% znDHrw7+JH6i(|25wuA$g|6s=o$mW^o1%u+>g(|#h>Px9?apfGae#hUwCe}keoR`D< x9u>WK*~*0rmPJ=CUfkN;7HwOwa9J~&oEiul-^^N3q$;>q)S1jcii2tXe*pAMH3R?v literal 0 HcmV?d00001 diff --git a/mysys/test_xml.c b/mysys/test_xml.c new file mode 100644 index 00000000000..d97d6561681 --- /dev/null +++ b/mysys/test_xml.c @@ -0,0 +1,89 @@ +#include +#include +#include +#include +#include "my_xml.h" + +static void mstr(char *str,const char *src,uint l1,uint l2) +{ + l1 = l1' +#define MY_XML_SLASH '/' +#define MY_XML_COMMENT 'C' +#define MY_XML_TEXT 'T' +#define MY_XML_QUESTION '?' +#define MY_XML_EXCLAM '!' + +typedef struct xml_attr_st +{ + const char *beg; + const char *end; +} MY_XML_ATTR; + +static const char *lex2str(int lex) +{ + switch(lex) + { + case MY_XML_EOF: return "EOF"; + case MY_XML_STRING: return "STRING"; + case MY_XML_IDENT: return "IDENT"; + case MY_XML_EQ: return "'='"; + case MY_XML_LT: return "'<'"; + case MY_XML_GT: return "'>'"; + case MY_XML_SLASH: return "'/'"; + case MY_XML_COMMENT: return "COMMENT"; + case MY_XML_TEXT: return "TEXT"; + case MY_XML_QUESTION: return "'?'"; + case MY_XML_EXCLAM: return "'!'"; + } + return "UNKNOWN"; +} + +static void my_xml_norm_text(MY_XML_ATTR *a) +{ + for ( ; (a->beg < a->end) && strchr(" \t\r\n",a->beg[0]) ; a->beg++ ); + for ( ; (a->beg < a->end) && strchr(" \t\r\n",a->end[-1]) ; a->end-- ); +} + + +static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a) +{ + int lex; + + for( ; ( p->cur < p->end) && strchr(" \t\r\n",p->cur[0]) ; p->cur++); + + if (p->cur >= p->end) + { + a->beg=p->end; + a->end=p->end; + lex=MY_XML_EOF; + goto ret; + } + + a->beg=p->cur; + a->end=p->cur; + + if (!memcmp(p->cur,"", 3); p->cur++); + if(!memcmp(p->cur, "-->", 3)) + p->cur+=3; + a->end=p->cur; + lex=MY_XML_COMMENT; + } + else if (strchr("?=/<>!",p->cur[0])) + { + p->cur++; + a->end=p->cur; + lex=a->beg[0]; + } + else if ( (p->cur[0]=='"') || (p->cur[0]=='\'') ) + { + p->cur++; + for( ; ( p->cur < p->end ) && (p->cur[0]!=a->beg[0]); p->cur++); + a->end=p->cur; + if (a->beg[0]==p->cur[0])p->cur++; + a->beg++; + my_xml_norm_text(a); + lex=MY_XML_STRING; + } + else + { + for( ; (p->cur < p->end) && !strchr("?'\"=/<> \t\r\n", p->cur[0]); p->cur++); + a->end=p->cur; + my_xml_norm_text(a); + lex=MY_XML_IDENT; + } + +#if 0 + printf("LEX=%s[%d]\n",lex2str(lex),a->end-a->beg); +#endif + +ret: + return lex; +} + + +static int my_xml_value(MY_XML_PARSER *st, const char *str, uint len) +{ + return (st->value) ? (st->value)(st,str,len) : MY_XML_OK; +} + + +static int my_xml_enter(MY_XML_PARSER *st, const char *str, uint len) +{ + if ( (st->attrend-st->attr+len+1)>sizeof(st->attr)) + { + sprintf(st->errstr,"To deep XML"); + return MY_XML_ERROR; + } + if (st->attrend > st->attr) + { + st->attrend[0]='.'; + st->attrend++; + } + memcpy(st->attrend,str,len); + st->attrend+=len; + st->attrend[0]='\0'; + return st->enter ? st->enter(st,st->attr,st->attrend-st->attr) : MY_XML_OK; +} + +static void mstr(char *s,const char *src,uint l1, uint l2) +{ + l1 = l1attrend; (e>p->attr) && (e[0]!='.') ; e--); + glen = (e[0]=='.') ? (p->attrend-e-1) : p->attrend-e; + + if (str && (slen != glen)) + { + mstr(s,str,sizeof(s)-1,slen); + mstr(g,e+1,sizeof(g)-1,glen), + sprintf(p->errstr,"'' unexpected ('' wanted)",s,g); + return MY_XML_ERROR; + } + + rc = p->leave ? p->leave(p,p->attr,p->attrend-p->attr) : MY_XML_OK; + + *e='\0'; + p->attrend=e; + + return rc; +} + + +int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len) +{ + p->attrend=p->attr; + p->beg=str; + p->cur=str; + p->end=str+len; + + while ( p->cur < p->end ) + { + MY_XML_ATTR a; + if(p->cur[0]=='<') + { + int lex; + int question=0; + int exclam=0; + + lex=my_xml_scan(p,&a); + + if (MY_XML_COMMENT==lex) + { + continue; + } + + lex=my_xml_scan(p,&a); + + if (MY_XML_SLASH==lex) + { + if(MY_XML_IDENT!=(lex=my_xml_scan(p,&a))) + { + sprintf(p->errstr,"1: %s unexpected (ident wanted)",lex2str(lex)); + return MY_XML_ERROR; + } + if(MY_XML_OK!=my_xml_leave(p,a.beg,a.end-a.beg)) + return MY_XML_ERROR; + lex=my_xml_scan(p,&a); + goto gt; + } + + if (MY_XML_EXCLAM==lex) + { + lex=my_xml_scan(p,&a); + exclam=1; + } + else if (MY_XML_QUESTION==lex) + { + lex=my_xml_scan(p,&a); + question=1; + } + + if (MY_XML_IDENT==lex) + { + if(MY_XML_OK!=my_xml_enter(p,a.beg,a.end-a.beg)) + return MY_XML_ERROR; + } + else + { + sprintf(p->errstr,"3: %s unexpected (ident or '/' wanted)",lex2str(lex)); + return MY_XML_ERROR; + } + + while ((MY_XML_IDENT==(lex=my_xml_scan(p,&a))) || (MY_XML_STRING==lex)) + { + MY_XML_ATTR b; + if(MY_XML_EQ==(lex=my_xml_scan(p,&b))) + { + lex=my_xml_scan(p,&b); + if ( (lex==MY_XML_IDENT) || (lex=MY_XML_STRING) ) + { + if((MY_XML_OK!=my_xml_enter(p,a.beg,a.end-a.beg)) || + (MY_XML_OK!=my_xml_value(p,b.beg,b.end-b.beg)) || + (MY_XML_OK!=my_xml_leave(p,a.beg,a.end-a.beg))) + return MY_XML_ERROR; + } + else + { + sprintf(p->errstr,"4: %s unexpected (ident or string wanted)",lex2str(lex)); + return MY_XML_ERROR; + } + } + else if ( (MY_XML_STRING==lex) || (MY_XML_IDENT==lex) ) + { + if((MY_XML_OK!=my_xml_enter(p,a.beg,a.end-a.beg)) || + (MY_XML_OK!=my_xml_leave(p,a.beg,a.end-a.beg))) + return MY_XML_ERROR; + } + else + break; + } + + if (lex==MY_XML_SLASH) + { + if(MY_XML_OK!=my_xml_leave(p,NULL,0)) + return MY_XML_ERROR; + lex=my_xml_scan(p,&a); + } + +gt: + if (question) + { + if (lex!=MY_XML_QUESTION) + { + sprintf(p->errstr,"6: %s unexpected ('?' wanted)",lex2str(lex)); + return MY_XML_ERROR; + } + if(MY_XML_OK!=my_xml_leave(p,NULL,0)) + return MY_XML_ERROR; + lex=my_xml_scan(p,&a); + } + + if (exclam) + { + if(MY_XML_OK!=my_xml_leave(p,NULL,0)) + return MY_XML_ERROR; + } + + if (lex!=MY_XML_GT) + { + sprintf(p->errstr,"5: %s unexpected ('>' wanted)",lex2str(lex)); + return MY_XML_ERROR; + } + } + else + { + a.beg=p->cur; + for ( ; (p->cur < p->end) && (p->cur[0]!='<') ; p->cur++); + a.end=p->cur; + + my_xml_norm_text(&a); + if (a.beg!=a.end) + { + my_xml_value(p,a.beg,a.end-a.beg); + } + } + } + return MY_XML_OK; +} + +void my_xml_parser_create(MY_XML_PARSER *p) +{ + bzero((void*)p,sizeof(p[0])); +} + +void my_xml_parser_free(MY_XML_PARSER *p __attribute__((unused))) +{ +} + +void my_xml_set_value_handler(MY_XML_PARSER *p, int (*action)(MY_XML_PARSER *p, const char *s, uint l)) +{ + p->value=action; +} + +void my_xml_set_enter_handler(MY_XML_PARSER *p, int (*action)(MY_XML_PARSER *p, const char *s, uint l)) +{ + p->enter=action; +} + +void my_xml_set_leave_handler(MY_XML_PARSER *p, int (*action)(MY_XML_PARSER *p, const char *s, uint l)) +{ + p->leave=action; +} + +const char *my_xml_error_string(MY_XML_PARSER *p) +{ + return p->errstr; +} + + +uint my_xml_error_pos(MY_XML_PARSER *p) +{ + const char *beg=p->beg; + const char *s; + for ( s=p->beg ; scur; s++) + if (s[0]=='\n') + beg=s; + return p->cur-beg; +} + +uint my_xml_error_lineno(MY_XML_PARSER *p) +{ + uint res=0; + const char *s; + for ( s=p->beg ; scur; s++) + if (s[0]=='\n') + res++; + return res; +} From 43d8212eec25d4def258b6a28a14978a5b79ea4c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 31 Dec 2002 13:06:30 +0400 Subject: [PATCH 107/220] license has been added --- mysys/test_xml.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mysys/test_xml.c b/mysys/test_xml.c index d97d6561681..2a679906cbf 100644 --- a/mysys/test_xml.c +++ b/mysys/test_xml.c @@ -1,3 +1,19 @@ +/* Copyright (C) 2000 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include #include #include From 666e150920f8b57a4bba35e7fe4c8471e1c77186 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 31 Dec 2002 16:58:41 +0500 Subject: [PATCH 108/220] Change locks in sql_udf.cc to rw_locks (SCRUM) sql/sql_udf.cc: Change locks to rw_locks --- sql/sql_udf.cc | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index 51d43b41833..324befcb59e 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -33,6 +33,7 @@ #endif #include "mysql_priv.h" +#include #ifdef HAVE_DLOPEN extern "C" @@ -70,7 +71,7 @@ extern "C" static bool initialized = 0; static MEM_ROOT mem; static HASH udf_hash; -static pthread_mutex_t THR_LOCK_udf; +static rw_lock_t THR_LOCK_udf; static udf_func *add_udf(char *name, Item_result ret, char *dl, @@ -122,8 +123,8 @@ void udf_init() if (initialized) DBUG_VOID_RETURN; - pthread_mutex_init(&THR_LOCK_udf,MY_MUTEX_INIT_SLOW); - + my_rwlock_init(&THR_LOCK_udf,NULL); + init_sql_alloc(&mem, 1024,0); THD *new_thd = new THD; if (!new_thd || @@ -262,7 +263,7 @@ static void del_udf(udf_func *udf) void free_udf(udf_func *udf) { DBUG_ENTER("free_udf"); - pthread_mutex_lock(&THR_LOCK_udf); + rw_wrlock(&THR_LOCK_udf); if (!--udf->usage_count) { /* @@ -274,7 +275,7 @@ void free_udf(udf_func *udf) if (!find_udf_dl(udf->dl)) dlclose(udf->dlhandle); } - pthread_mutex_unlock(&THR_LOCK_udf); + rw_unlock(&THR_LOCK_udf); DBUG_VOID_RETURN; } @@ -287,7 +288,7 @@ udf_func *find_udf(const char *name,uint length,bool mark_used) DBUG_ENTER("find_udf"); /* TODO: This should be changed to reader locks someday! */ - pthread_mutex_lock(&THR_LOCK_udf); + rw_rdlock(&THR_LOCK_udf); if ((udf=(udf_func*) hash_search(&udf_hash,(byte*) name, length ? length : (uint) strlen(name)))) { @@ -296,7 +297,7 @@ udf_func *find_udf(const char *name,uint length,bool mark_used) else if (mark_used) udf->usage_count++; } - pthread_mutex_unlock(&THR_LOCK_udf); + rw_unlock(&THR_LOCK_udf); DBUG_RETURN(udf); } @@ -375,7 +376,7 @@ int mysql_create_function(THD *thd,udf_func *udf) DBUG_RETURN(1); } - pthread_mutex_lock(&THR_LOCK_udf); + rw_wrlock(&THR_LOCK_udf); if ((hash_search(&udf_hash,(byte*) udf->name, udf->name_length))) { net_printf(thd, ER_UDF_EXISTS, udf->name); @@ -438,13 +439,13 @@ int mysql_create_function(THD *thd,udf_func *udf) del_udf(u_d); goto err; } - pthread_mutex_unlock(&THR_LOCK_udf); + rw_unlock(&THR_LOCK_udf); DBUG_RETURN(0); err: if (new_dl) dlclose(dl); - pthread_mutex_unlock(&THR_LOCK_udf); + rw_unlock(&THR_LOCK_udf); DBUG_RETURN(1); } @@ -460,7 +461,7 @@ int mysql_drop_function(THD *thd,const char *udf_name) send_error(thd, ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES)); DBUG_RETURN(1); } - pthread_mutex_lock(&THR_LOCK_udf); + rw_wrlock(&THR_LOCK_udf); if (!(udf=(udf_func*) hash_search(&udf_hash,(byte*) udf_name, (uint) strlen(udf_name)))) { @@ -490,10 +491,10 @@ int mysql_drop_function(THD *thd,const char *udf_name) } close_thread_tables(thd); - pthread_mutex_unlock(&THR_LOCK_udf); + rw_unlock(&THR_LOCK_udf); DBUG_RETURN(0); err: - pthread_mutex_unlock(&THR_LOCK_udf); + rw_unlock(&THR_LOCK_udf); DBUG_RETURN(1); } From 178bce1447aee86d90bf94ce30e22900e09aca12 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 31 Dec 2002 17:01:53 +0500 Subject: [PATCH 109/220] Fixed duplicate of handle_count in __NT__ section sql/mysqld.cc: Fixed duplicate of handle_count --- sql/mysqld.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 35d1951b9d6..b607bcdb3a1 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -182,7 +182,6 @@ static char szPipeName [ 257 ]; static SECURITY_ATTRIBUTES saPipeSecurity; static SECURITY_DESCRIPTOR sdPipeDescriptor; static HANDLE hPipe = INVALID_HANDLE_VALUE; -static uint handler_count; static bool opt_enable_named_pipe = 0; #endif #ifdef __WIN__ From d78d76f114704668d43db2c023ae60d17603ffc0 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 31 Dec 2002 18:01:53 +0200 Subject: [PATCH 110/220] A fix for a charset bug in the select_export (select into outfile) class. --- mysql-test/t/outfile.test | 6 +++--- sql/field.cc | 1 - sql/item.cc | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test index 3d524cb35a2..a944df01051 100644 --- a/mysql-test/t/outfile.test +++ b/mysql-test/t/outfile.test @@ -22,7 +22,7 @@ #select load_file("/tmp/select-test.not-exist"); #drop table t1; #drop table if exists t; -#CREATE TABLE t ( t timestamp NOT NULL, c char(200) character set latin1 NOT NULL default '', KEY t (t)) TYPE=MyISAM; -#INSERT INTO t VALUES ('2002-12-20 12:01:20',''); -#select * from t into outfile "fdg"; +#CREATE TABLE t ( t timestamp NOT NULL, c char(200) character set latin1 NOT NULL default '', i int(11), v varchar(200), b blob, KEY t (t)) TYPE=MyISAM; +#INSERT INTO t VALUES ('2002-12-20 12:01:20','',1,"aaa","bbb"); +#select * from t into outfile "check"; #drop table if exists t; diff --git a/sql/field.cc b/sql/field.cc index be565e2e869..36d1bf49c7c 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2844,7 +2844,6 @@ String *Field_timestamp::val_str(String *val_buffer, val_buffer->alloc(field_length+1); char *to=(char*) val_buffer->ptr(),*end=to+field_length; val_buffer->length(field_length); - val_buffer->set_charset(val_ptr->charset()); #ifdef WORDS_BIGENDIAN if (table->db_low_byte_first) diff --git a/sql/item.cc b/sql/item.cc index 95689e20faa..08ca2d66f02 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -220,6 +220,7 @@ String *Item_field::str_result(String *str) { if ((null_value=result_field->is_null())) return 0; + str->set_charset(str_value.charset()); return result_field->val_str(str,&str_value); } From cd248a8d636395a467f26550b55e0a184e86f0db Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 31 Dec 2002 18:39:16 +0200 Subject: [PATCH 111/220] postreviews fix (SCRUM related) reordered Item_row class variables to be sorted by memory size mysql-test/r/subselect.result: fix result of subselect test sql/item.cc: postreviews fix sql/item.h: postreviews fix sql/item_cmpfunc.h: postreviews fix sql/item_row.cc: postreviews fix sql/item_row.h: reordered class variables to be sorted by memory size postreviews fix sql/item_strfunc.cc: postreviews fix sql/item_subselect.cc: postreviews fix --- mysql-test/r/subselect.result | 3 +-- sql/item.cc | 5 +++-- sql/item.h | 4 ++++ sql/item_cmpfunc.h | 9 +++++++++ sql/item_row.cc | 28 ++++++++------------------ sql/item_row.h | 19 ++++++++++-------- sql/item_strfunc.cc | 3 ++- sql/item_subselect.cc | 37 ++++++++++++++++++++++++----------- 8 files changed, 64 insertions(+), 44 deletions(-) diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 7059054104f..7dc03a31878 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -39,9 +39,8 @@ Reference 'a' not supported (forward reference in item list) EXPLAIN SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY system NULL NULL NULL NULL 1 +3 DEPENDENT SUBSELECT NULL NULL NULL NULL NULL NULL NULL No tables used 2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used -Warnings: -Note 1247 Select 3 was reduced during optimisation SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; 1 1 diff --git a/sql/item.cc b/sql/item.cc index 5de4c6951e5..8feeabd306e 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1289,9 +1289,10 @@ bool Item_cache_row::setup(Item * item) return 1; for (uint i= 0; i < item_count; i++) { - if (!(values[i]= Item_cache::get_cache(item->el(i)->result_type()))) + Item *el= item->el(i); + if (!(values[i]= Item_cache::get_cache(el->result_type()))) return 1; - values[i]->setup(item->el(i)); + values[i]->setup(el); } return 0; } diff --git a/sql/item.h b/sql/item.h index 046464da97d..3decdc388eb 100644 --- a/sql/item.h +++ b/sql/item.h @@ -515,6 +515,10 @@ public: /* Used to find item in list of select items after '*' items processing. + + Because item '*' can be used in item list. when we create + Item_ref_on_list_position we do not know how item list will be changed, but + we know number of item position (I mean queries like "select * from t"). */ class Item_ref_on_list_position: public Item_ref_null_helper { diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 2aca3e1fabb..44c788f381c 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -97,6 +97,13 @@ public: bool preallocate_row(); bool fix_fields(THD *, struct st_table_list *, Item **); bool is_null(); + /* + Item_in_optimizer item is special boolean function. On value request + (one of val, val_int or val_str methods) it evaluate left expression + of IN by storing it value in cache item (one of Item_cache* items), + then it test cache is it NULL. If left expression (cache) is NULL then + Item_in_optimizer return NULL, else it evaluate Item_in_subselect. + */ longlong val_int(); Item_cache **get_cache() { return &cache; } @@ -546,8 +553,10 @@ public: { if (comparators) for (uint i= 0; i < n; i++) + { if (comparators[i]) delete comparators[i]; + } } void store_value(Item *item); int cmp(Item *arg); diff --git a/sql/item_row.cc b/sql/item_row.cc index b54653f4183..ba4ac19b880 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -54,7 +54,14 @@ bool Item_row::fix_fields(THD *thd, TABLE_LIST *tabl, Item **ref) if (items[i]->fix_fields(thd, tabl, items+i)) return 1; used_tables_cache |= items[i]->used_tables(); - const_item_cache&= items[i]->const_item(); + if (const_item_cache&= items[i]->const_item() && !with_null) + if (items[i]->cols() > 1) + with_null|= items[i]->null_inside(); + else + { + items[i]->val_int(); + with_null|= items[i]->null_value; + } maybe_null|= items[i]->maybe_null; } return 0; @@ -82,25 +89,6 @@ bool Item_row::check_cols(uint c) return 0; } -bool Item_row::null_inside() -{ - for (uint i= 0; i < arg_count; i++) - { - if (items[i]->cols() > 1) - { - if (items[i]->null_inside()) - return 1; - } - else - { - items[i]->val_int(); - if (items[i]->null_value) - return 1; - } - } - return 0; -} - void Item_row::bring_value() { for (uint i= 0; i < arg_count; i++) diff --git a/sql/item_row.h b/sql/item_row.h index 82580797ebc..ccaf68bed64 100644 --- a/sql/item_row.h +++ b/sql/item_row.h @@ -16,19 +16,22 @@ class Item_row: public Item { - bool array_holder; - table_map used_tables_cache; - bool const_item_cache; - uint arg_count; Item **items; + table_map used_tables_cache; + uint arg_count; + bool array_holder; + bool const_item_cache; + bool with_null; public: Item_row(List &); Item_row(Item_row *item): - Item(), array_holder(0), + Item(), + items(item->items), used_tables_cache(item->used_tables_cache), - const_item_cache(item->const_item_cache), arg_count(item->arg_count), - items(item->items) + array_holder(0), + const_item_cache(item->const_item_cache), + with_null(0) {} ~Item_row() @@ -71,6 +74,6 @@ public: Item* el(uint i) { return items[i]; } Item** addr(uint i) { return items + i; } bool check_cols(uint c); - bool null_inside(); + bool null_inside() { return with_null; }; void bring_value(); }; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 43eee0abf1c..ce362d6b972 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1961,7 +1961,8 @@ String *Item_func_conv_charset::val_str(String *str) d0=d=(unsigned char*)str->ptr(); de=d+dmaxlen; - while (s < se && d < de){ + while (s < se && d < de) + { cnvres=from->mb_wc(from,&wc,s,se); if (cnvres>0) diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 8763701b7a3..75aef846b17 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -157,7 +157,11 @@ void Item_singlerow_subselect::select_transformer(THD *thd, SELECT_LEX *select_lex= unit->first_select(); if (!select_lex->next_select() && !select_lex->table_list.elements && - select_lex->item_list.elements == 1) + select_lex->item_list.elements == 1 && + // TODO: mark subselect items from item list separately + !(select_lex->item_list.head()->type() == FIELD_ITEM || + select_lex->item_list.head()->type() == REF_ITEM) + ) { have_to_be_excluded= 1; @@ -170,9 +174,6 @@ void Item_singlerow_subselect::select_transformer(THD *thd, } substitution= select_lex->item_list.head(); substitution->set_outer_resolving(); - if (substitution->type() == FIELD_ITEM || - substitution->type() == REF_ITEM) - name= substitution->name; // Save name for correct resolving if (select_lex->where || select_lex->having) { @@ -444,6 +445,9 @@ void Item_in_subselect::single_value_transformer(THD *thd, "LIMIT & IN/ALL/ANY/SOME subquery"); DBUG_VOID_RETURN; } + // no sense in ORDER BY without LIMIT + unit->global_parameters->order_list.empty(); + Item_in_optimizer *optimizer; substitution= optimizer= new Item_in_optimizer(left_expr, this); if (!optimizer) @@ -476,18 +480,16 @@ void Item_in_subselect::single_value_transformer(THD *thd, else item= (Item*) sl->item_list.pop(); - if (sl->having || sl->with_sum_func || sl->group_list.first || - sl->order_list.first) + sl->order_list.empty(); // no sense in ORDER BY without LIMIT + + if (sl->having || sl->with_sum_func || sl->group_list.first) { sl->item_list.push_back(item); item= (*func)(expr, new Item_ref_null_helper(this, sl->item_list.head_ref(), (char *)"", (char*)"")); - if (sl->having || sl->with_sum_func || sl->group_list.first) - sl->having= and_items(sl->having, item); - else - sl->where= and_items(sl->where, item); + sl->having= and_items(sl->having, item); } else { @@ -547,10 +549,22 @@ void Item_in_subselect::row_value_transformer(THD *thd, if (unit->global_parameters->select_limit != HA_POS_ERROR) { + /* + Because we do the following (not exactly, following is just explenation) + transformation + SELECT * from t1 WHERE t1.a IN (SELECT t2.a FROM t2) + -> + SELECT * from t1 WHERE EXISTS(SELECT 1 FROM t2 t1.a = t2.a LIMIT 1) + + it's impossible to support limit in the sub select. + */ my_error(ER_NOT_SUPPORTED_YET, MYF(0), "LIMIT & IN/ALL/ANY/SOME subquery"); DBUG_VOID_RETURN; } + // no sense in ORDER BY without LIMIT + unit->global_parameters->order_list.empty(); + Item_in_optimizer *optimizer; substitution= optimizer= new Item_in_optimizer(left_expr, this); if (!optimizer) @@ -568,6 +582,7 @@ void Item_in_subselect::row_value_transformer(THD *thd, "LIMIT & IN/ALL/ANY/SOME subquery"); DBUG_VOID_RETURN; } + sl->order_list.empty(); // no sense in ORDER BY without LIMIT sl->dependent= 1; @@ -589,7 +604,7 @@ void Item_in_subselect::row_value_transformer(THD *thd, } if (sl->having || sl->with_sum_func || sl->group_list.first || - !sl->table_list.elements) + !sl->table_list.elements || !sl->table_list.elements) sl->having= and_items(sl->having, item); else sl->where= and_items(sl->where, item); From be551fd94370ef85aa9aa9cad36a890eee9c04b0 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Jan 2003 15:59:35 +0400 Subject: [PATCH 112/220] Fix for QUOTE() function. --- mysql-test/r/func_str.result | 3 +++ mysql-test/t/func_str.test | 2 +- sql/item_strfunc.cc | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index d0358aad6ba..429574575f1 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -170,6 +170,9 @@ quote(concat('abc\'', '\\cba')) select quote(1/0), quote('\0\Z'); quote(1/0) quote('\0\Z') NULL '\0\Z' +select length(quote(concat(char(0), "test"))); +length(quote(concat(char(0), "test"))) +8 select reverse(""); reverse("") diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index d355cc95317..97b771e7363 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -69,7 +69,7 @@ select decode(encode("abcdef","monty"),"monty")="abcdef"; select quote('\'\"\\test'); select quote(concat('abc\'', '\\cba')); select quote(1/0), quote('\0\Z'); - +select length(quote(concat(char(0), "test"))); # # Wrong usage of functions # diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index ce362d6b972..0baa479a601 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2398,7 +2398,7 @@ String *Item_func_quote::val_str(String *str) */ to= (char*) str->ptr() + new_length - 1; *to--= '\''; - for (start= (char*) arg->ptr() ; end-- != start; to--) + for (start= (char*) arg->ptr(),end= start + arg_length; end-- != start; to--) { /* We can't use the bitmask here as we want to replace \O and ^Z with 0 From 3fe840ee07992340b5b7977ec66483e6f837ba1b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 2 Jan 2003 12:24:33 +0200 Subject: [PATCH 113/220] post-post-review fix (SCRUM) sql/item.cc: post-post-review fix sql/item_cmpfunc.h: post-post-review fix sql/item_row.cc: post-post-review fix sql/item_subselect.cc: post-post-review fix --- sql/item.cc | 5 +++-- sql/item_cmpfunc.h | 2 ++ sql/item_row.cc | 2 ++ sql/item_subselect.cc | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sql/item.cc b/sql/item.cc index 8feeabd306e..c6cce9a5b48 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1290,9 +1290,10 @@ bool Item_cache_row::setup(Item * item) for (uint i= 0; i < item_count; i++) { Item *el= item->el(i); - if (!(values[i]= Item_cache::get_cache(el->result_type()))) + Item_cache *tmp; + if (!(tmp= values[i]= Item_cache::get_cache(el->result_type()))) return 1; - values[i]->setup(el); + tmp->setup(el); } return 0; } diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 44c788f381c..bd7d1bfaf7a 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -552,11 +552,13 @@ public: ~cmp_item_row() { if (comparators) + { for (uint i= 0; i < n; i++) { if (comparators[i]) delete comparators[i]; } + } } void store_value(Item *item); int cmp(Item *arg); diff --git a/sql/item_row.cc b/sql/item_row.cc index ba4ac19b880..c62ab60c0cd 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -55,6 +55,7 @@ bool Item_row::fix_fields(THD *thd, TABLE_LIST *tabl, Item **ref) return 1; used_tables_cache |= items[i]->used_tables(); if (const_item_cache&= items[i]->const_item() && !with_null) + { if (items[i]->cols() > 1) with_null|= items[i]->null_inside(); else @@ -62,6 +63,7 @@ bool Item_row::fix_fields(THD *thd, TABLE_LIST *tabl, Item **ref) items[i]->val_int(); with_null|= items[i]->null_value; } + } maybe_null|= items[i]->maybe_null; } return 0; diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 75aef846b17..c5ecdc87d40 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -604,7 +604,7 @@ void Item_in_subselect::row_value_transformer(THD *thd, } if (sl->having || sl->with_sum_func || sl->group_list.first || - !sl->table_list.elements || !sl->table_list.elements) + !sl->table_list.elements) sl->having= and_items(sl->having, item); else sl->where= and_items(sl->where, item); From 0b34c533729ef20d73a3a9954933e8a867ac7923 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 2 Jan 2003 14:29:26 +0200 Subject: [PATCH 114/220] Small optimization of sending big blocks. Updated Italian error messages sql/net_serv.cc: Small optimization of sending big blocks. Some small formating changes sql/share/italian/errmsg.txt: Updated error messages (by Cristian Giussani) --- sql/net_serv.cc | 25 ++++++++++++++++++------ sql/share/italian/errmsg.txt | 38 ++++++++++++++++++------------------ 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/sql/net_serv.cc b/sql/net_serv.cc index ac73a4ca15a..0d4cf9b9444 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -285,6 +285,7 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len) /* Caching the data in a local buffer before sending it. One can force the buffer to be flushed with 'net_flush'. + */ static int @@ -292,15 +293,24 @@ net_write_buff(NET *net,const char *packet,ulong len) { ulong left_length=(ulong) (net->buff_end - net->write_pos); - while (len > left_length) + if (len > left_length) { memcpy((char*) net->write_pos,packet,left_length); if (net_real_write(net,(char*) net->buff,net->max_packet)) return 1; net->write_pos=net->buff; packet+=left_length; - len-=left_length; - left_length=net->max_packet; + len-= left_length; + left_length= net->max_packet; + + /* Send out rest of the blocks as full sized blocks */ + while (len > left_length) + { + if (net_real_write(net, packet, left_length)) + return 1; + packet+= left_length; + len-= left_length; + } } memcpy((char*) net->write_pos,packet,len); net->write_pos+=len; @@ -633,7 +643,10 @@ my_real_read(NET *net, ulong *complen) #ifdef HAVE_COMPRESS if (net->compress) { - /* complen is > 0 if package is really compressed */ + /* + If the packet is compressed then complen > 0 and contains the + number of bytes in the uncompressed packet + */ *complen=uint3korr(&(net->buff[net->where_b + NET_HEADER_SIZE])); } #endif @@ -704,7 +717,7 @@ my_net_read(NET *net) { net->where_b += len; total_length += len; - len = my_real_read (net,&complen); + len = my_real_read(net,&complen); } while (len == MAX_THREE_BYTES); if (len != packet_error) len+= total_length; @@ -732,7 +745,7 @@ my_net_read(NET *net) } else { - /* reuse buffer, as there is noting in it that we need */ + /* reuse buffer, as there is nothing in it that we need */ buf_length=start_of_packet=first_packet_offset=0; } for (;;) diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index 4dd7b02de4e..cc26818aa41 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -219,22 +219,22 @@ "Impossibile aggiungere il vincolo di integrita' referenziale (foreign key constraint)", "Impossibile aggiungere la riga: un vincolo d'integrita' referenziale non e' soddisfatto", "Impossibile cancellare la riga: un vincolo d'integrita' referenziale non e' soddisfatto", -"Error connecting to master: %-.128s", -"Error running query on master: %-.128s", -"Error when executing command %s: %-.128s", -"Wrong usage of %s and %s", -"The used SELECT statements have a different number of columns", -"Can't execute the query because you have a conflicting read lock", -"Mixing of transactional and non-transactional tables is disabled", -"Option '%s' used twice in statement", -"User '%-.64s' has exceeded the '%s' resource (current value: %ld)", -"Access denied. You need the %-.128s privilege for this operation", -"Variable '%-.64s' is a LOCAL variable and can't be used with SET GLOBAL", -"Variable '%-.64s' is a GLOBAL variable and should be set with SET GLOBAL", -"Variable '%-.64s' doesn't have a default value", -"Variable '%-.64s' can't be set to the value of '%-.64s'", -"Wrong argument type to variable '%-.64s'", -"Variable '%-.64s' can only be set, not read", -"Wrong usage/placement of '%s'", -"This version of MySQL doesn't yet support '%s'", -"Got fatal error %d: '%-.128s' from master when reading data from binary log", +"Errore durante la connessione al master: %-.128s", +"Errore eseguendo una query sul master: %-.128s", +"Errore durante l'esecuzione del comando %s: %-.128s", +"Uso errato di %s e %s", +"La SELECT utilizzata ha un numero di colonne differente", +"Impossibile eseguire la query perche' c'e' un conflitto con in lock di lettura", +"E' disabilitata la possibilita' di mischiare tabelle transazionali e non-transazionali", +"L'opzione '%s' e' stata usata due volte nel comando", +"L'utente '%-.64s' ha ecceduto la risorsa '%s' (valore corrente: %ld)", +"Accesso non consentito. Serve il privilegio %-.128s per questa operazione", +"La variabile '%-.64s' e' una variabile locale ( LOCAL ) e non puo' essere cambiata usando SET GLOBAL", +"La variabile '%-.64s' e' una variabile globale ( GLOBAL ) e deve essere cambiata usando SET GLOBAL", +"La variabile '%-.64s' non ha un valore di default", +"Alla variabile '%-.64s' non puo' essere assegato il valore '%-.64s'", +"Tipo di valore errato per la variabile '%-.64s'", +"Alla variabile '%-.64s' e' di sola scrittura quindi puo' essere solo assegnato un valore, non letto", +"Uso/posizione di '%s' sbagliato", +"Questa versione di MySQL non supporta ancora '%s'", +"Errore fatale %d: '%-.128s' dal master leggendo i dati dal log binario", From 41dc1eaa4f79e0398d652ad4c89638acb4655d80 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 2 Jan 2003 16:21:22 +0200 Subject: [PATCH 115/220] Fixing some bugs in client - server protocol and adding a feature that connection does not close in the case when client sends a buffer larger then max_allowed_packet. --- sql/net_serv.cc | 21 ++++++++++++++++++--- sql/sql_parse.cc | 6 ++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 122793b07a7..d01b28863b9 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -469,6 +469,7 @@ static void my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed) ALARM alarm_buff; uint retry_count=0; my_bool old_mode; + uint32 old=remain; if (!thr_alarm_in_use(&alarmed)) { @@ -490,6 +491,12 @@ static void my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed) return; } remain -= (uint32) length; + if (!remain && old==MAX_THREE_BYTES && + (length=vio_read(net->vio,(char*) net->buff,NET_HEADER_SIZE))) + { + old=remain= uint3korr(net->buff); + net->pkt_nr++; + } statistic_add(bytes_received,length,&LOCK_bytes_received); } } @@ -647,11 +654,19 @@ my_real_read(NET *net, ulong *complen) { if (net_realloc(net,helping)) { +#ifdef MYSQL_SERVER #ifndef NO_ALARM - if (i == 1) - my_net_skip_rest(net, (uint32) len, &alarmed); + if (net->compress) + { + len= packet_error; + goto end; + } + my_net_skip_rest(net, (uint32) len, &alarmed); + len=0; +#endif +#else + len= packet_error; /* Return error */ #endif - len= packet_error; /* Return error */ goto end; } } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index d9f2b9ca70d..1e690df20dd 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -884,6 +884,12 @@ bool do_command(THD *thd) vio_description(net->vio) )); return TRUE; } + else if (!packet_length) + { + send_error(net,net->last_errno,NullS); + net->error=0; + DBUG_RETURN(FALSE); + } else { packet=(char*) net->read_pos; From e79e53dcb3c7c95e951f3640dfdbc03c760c2a2f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 2 Jan 2003 18:04:02 +0300 Subject: [PATCH 116/220] SCRUM password() function changes. sql/item_strfunc.cc: Fix password() function according Monty's comment --- sql/item_strfunc.cc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index ab05712bf46..d2b0e89254e 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1281,12 +1281,12 @@ String *Item_func_password::val_str(String *str) struct rand_struct rand_st; // local structure for 2 param version ulong seed=0; // seed to initialise random generator to + String *res =args[0]->val_str(str); if ((null_value=args[0]->null_value)) return 0; - + if (arg_count == 1) { - String *res =args[0]->val_str(str); if (res->length() == 0) return &empty_string; make_scrambled_password(tmp_value,res->c_ptr(),opt_old_passwords, @@ -1296,22 +1296,30 @@ String *Item_func_password::val_str(String *str) } else { + /* We'll need the buffer to get second parameter */ + char key_buff[80]; + String tmp_key_value(key_buff, sizeof(key_buff), system_charset_info); + String *key =args[1]->val_str(&tmp_key_value); + /* Check second argument for NULL value. First one is already checked */ if ((null_value=args[1]->null_value)) return 0; + + /* This shall be done after checking for null for proper results */ + if (res->length() == 0) + return &empty_string; + /* Generate the seed first this allows to avoid double allocation */ - char* seed_ptr=args[1]->val_str(str)->c_ptr(); + char* seed_ptr=key->c_ptr(); while (*seed_ptr) { seed=seed*211+*seed_ptr; /* Use simple hashing */ seed_ptr++; } + /* Use constants which allow nice random values even with small seed */ randominit(&rand_st,seed*111111+33333333L,seed*1111+55555555L); - String *res =args[0]->val_str(str); - if (res->length() == 0) - return &empty_string; make_scrambled_password(tmp_value,res->c_ptr(),opt_old_passwords, &rand_st); str->set(tmp_value,get_password_length(opt_old_passwords),res->charset()); From d5ddb99772f0970b823d9d475da8d0236c79a08f Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 3 Jan 2003 12:30:01 +0400 Subject: [PATCH 117/220] User data --- include/my_xml.h | 2 ++ mysys/xml.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/include/my_xml.h b/include/my_xml.h index 25db161715a..0d968ab38c7 100644 --- a/include/my_xml.h +++ b/include/my_xml.h @@ -34,6 +34,7 @@ typedef struct xml_stack_st const char *beg; const char *cur; const char *end; + void *user_data; int (*enter)(struct xml_stack_st *st,const char *val, uint len); int (*value)(struct xml_stack_st *st,const char *val, uint len); int (*leave)(struct xml_stack_st *st,const char *val, uint len); @@ -46,6 +47,7 @@ int my_xml_parse(MY_XML_PARSER *st,const char *str, uint len); void my_xml_set_value_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, const char *, uint len)); void my_xml_set_enter_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, const char *, uint len)); void my_xml_set_leave_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, const char *, uint len)); +void my_xml_set_user_data(MY_XML_PARSER *st, void *); uint my_xml_error_pos(MY_XML_PARSER *st); uint my_xml_error_lineno(MY_XML_PARSER *st); diff --git a/mysys/xml.c b/mysys/xml.c index 049eb05b19c..4f6301249ae 100644 --- a/mysys/xml.c +++ b/mysys/xml.c @@ -342,6 +342,11 @@ void my_xml_set_leave_handler(MY_XML_PARSER *p, int (*action)(MY_XML_PARSER *p, p->leave=action; } +void my_xml_set_user_data(MY_XML_PARSER *p, void *user_data) +{ + p->user_data=user_data; +} + const char *my_xml_error_string(MY_XML_PARSER *p) { return p->errstr; From ac0bb91fb12afda09902d08333ffb6522fabcd14 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 3 Jan 2003 12:40:09 +0400 Subject: [PATCH 118/220] ignore: added test_xml BitKeeper/etc/ignore: added test_xml --- .bzrignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.bzrignore b/.bzrignore index 2c115322cc5..379f5401021 100644 --- a/.bzrignore +++ b/.bzrignore @@ -580,3 +580,4 @@ vio/test-sslclient vio/test-sslserver vio/viotest-ssl libmysqld/protocol.cc +test_xml From 389cec7d99e85b3dbf3827ca70e8e79f0898b4db Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 3 Jan 2003 14:35:32 +0400 Subject: [PATCH 119/220] Charset index is sotred in XML now --- libmysql/Makefile.shared | 2 +- mysys/charset.c | 203 ++++++++++++---- sql/share/Makefile.am | 4 +- sql/share/charsets/Index.xml | 455 +++++++++++++++++++++++++++++++++++ 4 files changed, 617 insertions(+), 47 deletions(-) create mode 100644 sql/share/charsets/Index.xml diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared index a2e6fddff0f..4d8b703fb2d 100644 --- a/libmysql/Makefile.shared +++ b/libmysql/Makefile.shared @@ -58,7 +58,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \ mf_loadpath.lo my_pthread.lo my_thr_init.lo \ thr_mutex.lo mulalloc.lo string.lo default.lo \ my_compress.lo array.lo my_once.lo list.lo my_net.lo \ - charset.lo hash.lo mf_iocache.lo \ + charset.lo xml.lo hash.lo mf_iocache.lo \ mf_iocache2.lo my_seek.lo \ my_pread.lo mf_cache.lo my_vsnprintf.lo md5.lo sha1.lo\ my_getopt.lo my_gethostbyname.lo my_port.lo diff --git a/mysys/charset.c b/mysys/charset.c index cf0628495fc..3f650bbe14d 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -19,7 +19,9 @@ #include #include #include +#include +#define MY_CHARSET_INDEX "Index.xml" const char *charsets_dir = NULL; static int charset_initialized=0; @@ -85,53 +87,166 @@ char *get_charsets_dir(char *buf) } +#define MAX_BUF 1024*16 + + +static void mstr(char *str,const char *src,uint l1,uint l2) +{ + l1 = l1str; s++) + if (!strncmp(attr,s->str,len)) + return s; + return NULL; +} + +struct my_cs_file_info +{ + CHARSET_INFO cs; + myf myflags; +}; + +static int cs_enter(MY_XML_PARSER *st,const char *attr, uint len) +{ + struct my_cs_file_info *i = (struct my_cs_file_info *)st->user_data; + struct my_cs_file_section_st *s = cs_file_sec(attr,len); + + if ( s && (s->state == _CS_CHARSET)) + { + bzero(&i->cs,sizeof(i->cs)); + } + return MY_XML_OK; +} + +static int cs_leave(MY_XML_PARSER *st,const char *attr, uint len) +{ + struct my_cs_file_info *i = (struct my_cs_file_info *)st->user_data; + struct my_cs_file_section_st *s = cs_file_sec(attr,len); + + if (s && (s->state == _CS_COLLATION) && !all_charsets[i->cs.number]) + { + if (!(all_charsets[i->cs.number]= + (CHARSET_INFO*) my_once_alloc(sizeof(CHARSET_INFO),i->myflags))) + { + return MY_XML_ERROR; + } + all_charsets[i->cs.number][0]=i->cs; + } + return MY_XML_OK; +} + +static int cs_value(MY_XML_PARSER *st,const char *attr, uint len) +{ + struct my_cs_file_info *i = (struct my_cs_file_info *)st->user_data; + struct my_cs_file_section_st *s; + int state = (s=cs_file_sec(st->attr,strlen(st->attr))) ? s->state : 0; + + if(0) + { + char str[256]; + mstr(str,attr,len,sizeof(str)-1); + printf("VALUE %d %s='%s'\n",state,st->attr,str); + } + + switch (state) + { + case _CS_ID: + i->cs.number = my_strntoul(my_charset_latin1,attr,len,(char**)NULL,0); + break; + case _CS_COLNAME: + if ((i->cs.name = (char*) my_once_alloc(len+1,i->myflags))) + { + memcpy((char*)i->cs.name,attr,len); + ((char*)(i->cs.name))[len]='\0'; + } + break; + } + return MY_XML_OK; +} + static my_bool read_charset_index(myf myflags) { - struct simpleconfig_buf_st fb; - char buf[MAX_LINE], num_buf[MAX_LINE]; - - strmov(get_charsets_dir(buf), "Index"); - - if ((fb.f = my_fopen(buf, O_RDONLY, myflags)) == NULL) - return TRUE; - fb.buf[0] = '\0'; - fb.p = fb.buf; - + char *buf; + int fd; + uint len; + MY_XML_PARSER p; + struct my_cs_file_info i; - while (!get_word(&fb, buf) && !get_word(&fb, num_buf)) + if (! (buf = (char *)my_malloc(MAX_BUF,myflags))) + return FALSE; + + strmov(get_charsets_dir(buf),MY_CHARSET_INDEX); + + if ((fd=my_open(buf,O_RDONLY,myflags)) < 0) { - uint csnum; - uint length; - CHARSET_INFO *cs; - - if (!(csnum = atoi(num_buf))) - { - /* corrupt Index file */ - my_fclose(fb.f,myflags); - return TRUE; - } - - if (all_charsets[csnum]) - continue; - - if (!(cs=(CHARSET_INFO*) my_once_alloc(sizeof(cs[0]),myflags))) - { - my_fclose(fb.f,myflags); - return TRUE; - } - bzero(cs,sizeof(cs[0])); - - if (!(cs->name= (char*)my_once_alloc(length=(uint)strlen(buf)+1,myflags))) - { - my_fclose(fb.f,myflags); - return TRUE; - } - memcpy((char*)cs->name,buf,length); - cs->number=csnum; - all_charsets[csnum]=cs; + my_free(buf,myflags); + return TRUE; } - my_fclose(fb.f,myflags); - + + len=read(fd,buf,MAX_BUF); + my_xml_parser_create(&p); + my_close(fd,myflags); + + my_xml_set_enter_handler(&p,cs_enter); + my_xml_set_value_handler(&p,cs_value); + my_xml_set_leave_handler(&p,cs_leave); + my_xml_set_user_data(&p,(void*)&i); + + if (MY_XML_OK!=my_xml_parse(&p,buf,len)) + { + /* + printf("ERROR at line %d pos %d '%s'\n", + my_xml_error_lineno(&p)+1, + my_xml_error_pos(&p), + my_xml_error_string(&p)); + */ + } + + my_xml_parser_free(&p); + return FALSE; } @@ -472,7 +587,7 @@ CHARSET_INFO *get_charset(uint cs_number, myf flags) if (!cs && (flags & MY_WME)) { char index_file[FN_REFLEN], cs_string[23]; - strmov(get_charsets_dir(index_file), "Index"); + strmov(get_charsets_dir(index_file),MY_CHARSET_INDEX); cs_string[0]='#'; int10_to_str(cs_number, cs_string+1, 10); my_error(EE_UNKNOWN_CHARSET, MYF(ME_BELL), cs_string, index_file); @@ -505,7 +620,7 @@ CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags) if (!cs && (flags & MY_WME)) { char index_file[FN_REFLEN]; - strmov(get_charsets_dir(index_file), "Index"); + strmov(get_charsets_dir(index_file),MY_CHARSET_INDEX); my_error(EE_UNKNOWN_CHARSET, MYF(ME_BELL), cs_name, index_file); } diff --git a/sql/share/Makefile.am b/sql/share/Makefile.am index c70ac9ccf57..a1b506f1ff5 100644 --- a/sql/share/Makefile.am +++ b/sql/share/Makefile.am @@ -7,7 +7,7 @@ dist-hook: done; \ sleep 1 ; touch $(srcdir)/*/errmsg.sys $(INSTALL_DATA) $(srcdir)/charsets/README $(distdir)/charsets - $(INSTALL_DATA) $(srcdir)/charsets/Index $(distdir)/charsets + $(INSTALL_DATA) $(srcdir)/charsets/Index.xml $(distdir)/charsets all: @AVAILABLE_LANGUAGES_ERRORS@ @@ -25,7 +25,7 @@ install-data-local: done $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/charsets $(INSTALL_DATA) $(srcdir)/charsets/README $(DESTDIR)$(pkgdatadir)/charsets/README - $(INSTALL_DATA) $(srcdir)/charsets/Index $(DESTDIR)$(pkgdatadir)/charsets/Index + $(INSTALL_DATA) $(srcdir)/charsets/Index.xml $(DESTDIR)$(pkgdatadir)/charsets/Index.xml $(INSTALL_DATA) $(srcdir)/charsets/*.conf $(DESTDIR)$(pkgdatadir)/charsets fix_errors: diff --git a/sql/share/charsets/Index.xml b/sql/share/charsets/Index.xml new file mode 100644 index 00000000000..79b622f9c5c --- /dev/null +++ b/sql/share/charsets/Index.xml @@ -0,0 +1,455 @@ + + + + + +This file lists all of the available character sets. +To make maintaining easier please: + - keep records sorted by collation number. + - change charset-list.max-id when adding a new collation. + + + + Traditional Chinese + big-5 + bigfive + big-five + cn-big5 + csbig5 + + + + + Central European + csisolatin2 + iso-8859-2 + iso-ir-101 + iso_8859-2 + iso_8859-2:1987 + l2 + + + Hungarian + Polish + Romanian + Croatian + Slovak + Slovenian + Sorbian + + + + + + + Western + + Dutch + English + French + German Duden + Italian + Latin + Pogtuguese + Spanish + + + + + Western + 850 + cp850 + cspc850multilingual + ibm850 + + Dutch + English + French + German Duden + Italian + Latin + Pogtuguese + Spanish + + + + + Western + csisolatin1 + csisolatin1 + iso-8859-1 + iso-ir-100 + iso_8859-1 + iso_8859-1:1987 + l1 + latin1 + + + + + + + Dutch + English + French + German Duden + Italian + Latin + Pogtuguese + Spanish + + + Dutch + English + French + German Duden + Italian + Latin + Pogtuguese + Spanish + + + + + Western + hproman8 + + Dutch + English + French + German Duden + Italian + Latin + Pogtuguese + Spanish + + + + + Cyrillic + koi8-ru + cskoi8r + + + + + Western + iso-646-se + + + + + Western + us + us-ascii + csascii + iso-ir-6 + iso646-us + + + + + Japanese + euc-jp + + + + + Japanese + s-jis + shift-jis + x-sjis + + + + + Cyrillic + windows-1251 + ms-cyr + ms-cyrillic + + Belarusian + Bulgarian + Macedonian + Russian + Serbian + Mongolian + Ukrainian + + + + + Belarusian + Bulgarian + Macedonian + Russian + Serbian + Mongolian + Ukrainian + + + Belarusian + Bulgarian + Macedonian + Russian + Serbian + Mongolian + Ukrainian + + + + + Hebrew + csisolatinhebrew + iso-8859-8 + iso-ir-138 + + + + + Thai + tis-620 + + + + + Korean + euckr + euc-kr + + + + + Baltic + BalticRim + iso-8859-13 + l7 + + + + + + + Cyrillic + koi8-u + + + + + Simplified Chinese + chinese + iso-ir-58 + + + + + Greek + csisolatingreek + ecma-118 + greek8 + iso-8859-7 + iso-ir-126 + + + + + Central European + ms-ce + windows-1250 + + Hungarian + Polish + Romanian + Croatian + Slovak + Slovenian + Sorbian + + + + + + East Asian + cp936 + + + + + Baltic + WinBaltRim + windows-1257 + + + + Latvian + Lithuanian + + + Latvian + Lithuanian + + + Latvian + Lithuanian + + + + + South Asian + csisolatin5 + iso-8859-9 + iso-ir-148 + l5 + latin5 + turkish + + + + + South Asian + armscii-8 + + + + + Unicode + utf-8 + + + + + Unicode + + + + + Cyrillic + 866 + csibm866 + ibm866 + + + + + Central European + + + + + Central European + MacCentralEurope + + Hungarian + Polish + Romanian + Croatian + Slovak + Slovenian + Sorbian + + + + Hungarian + Polish + Romanian + Croatian + Slovak + Slovenian + Sorbian + + + Hungarian + Polish + Romanian + Croatian + Slovak + Slovenian + Sorbian + + + Hungarian + Polish + Romanian + Croatian + Slovak + Slovenian + Sorbian + + + + + Western + Mac + Macintosh + csmacintosh + + Dutch + English + French + German Duden + Italian + Latin + Pogtuguese + Spanish + + + + Dutch + English + French + German Duden + Italian + Latin + Pogtuguese + Spanish + + + Dutch + English + French + German Duden + Italian + Latin + Pogtuguese + Spanish + + + Dutch + English + French + German Duden + Italian + Latin + Pogtuguese + Spanish + + + + + Central European + 852 + cp852 + ibm852 + + Hungarian + Polish + Romanian + Croatian + Slovak + Slovenian + Sorbian + + + + + Arabic + ms-arab + windows-1256 + + + + + + + + From 218e9524a6e78007eadc5c49cf92af65e5999ae6 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 3 Jan 2003 03:52:53 -0800 Subject: [PATCH 120/220] Binary protocol changes (to monty) --- libmysql/libmysql.c | 165 ++++++++++++++++++++++++-------------------- sql/field.cc | 35 +++++++++- sql/field.h | 6 +- sql/protocol.cc | 37 +++++++--- sql/sql_prepare.cc | 34 +++++---- 5 files changed, 173 insertions(+), 104 deletions(-) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index d0fc83bbeb3..d6d2dca9af0 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1739,6 +1739,7 @@ static void mysql_once_init() #define strdup_if_not_null(A) (A) == 0 ? 0 : my_strdup((A),MYF(MY_WME)) +#ifdef HAVE_OPENSSL my_bool STDCALL mysql_ssl_set(MYSQL *mysql __attribute__((unused)) , const char *key __attribute__((unused)), @@ -1747,15 +1748,14 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) , const char *capath __attribute__((unused)), const char *cipher __attribute__((unused))) { -#ifdef HAVE_OPENSSL mysql->options.ssl_key= strdup_if_not_null(key); mysql->options.ssl_cert= strdup_if_not_null(cert); mysql->options.ssl_ca= strdup_if_not_null(ca); mysql->options.ssl_capath= strdup_if_not_null(capath); mysql->options.ssl_cipher= strdup_if_not_null(cipher); -#endif return 0; } +#endif /************************************************************************** @@ -1763,10 +1763,10 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) , NB! Errors are not reported until you do mysql_real_connect. **************************************************************************/ +#ifdef HAVE_OPENSLL static void mysql_ssl_free(MYSQL *mysql __attribute__((unused))) { -#ifdef HAVE_OPENSLL my_free(mysql->options.ssl_key, MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.ssl_cert, MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.ssl_ca, MYF(MY_ALLOW_ZERO_PTR)); @@ -1780,8 +1780,8 @@ mysql_ssl_free(MYSQL *mysql __attribute__((unused))) mysql->options.ssl_cipher= 0; mysql->options.use_ssl = FALSE; mysql->connector_fd = 0; -#endif /* HAVE_OPENSLL */ } +#endif /* HAVE_OPENSLL */ /************************************************************************** Connect to sql server @@ -3824,12 +3824,13 @@ static my_bool my_realloc_str(NET *net, ulong length) 1 error */ -static my_bool read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt) +static my_bool read_prepare_result(MYSQL_STMT *stmt) { uchar *pos; uint field_count; + ulong length, param_count; MYSQL_DATA *fields_data; - ulong length; + MYSQL *mysql= stmt->mysql; DBUG_ENTER("read_prepare_result"); mysql= mysql->last_used_con; @@ -3837,9 +3838,9 @@ static my_bool read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt) DBUG_RETURN(1); pos=(uchar*) mysql->net.read_pos; - stmt->stmt_id= uint4korr(pos); pos+=4; - field_count= uint2korr(pos); pos+=2; - stmt->param_count=uint2korr(pos); pos+=2; + stmt->stmt_id= uint4korr(pos); pos+=4; + field_count= uint2korr(pos); pos+=2; + param_count= uint2korr(pos); pos+=2; if (field_count != 0) { @@ -3862,9 +3863,10 @@ static my_bool read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt) set_stmt_error(stmt, CR_OUT_OF_MEMORY); DBUG_RETURN(0); } - stmt->bind= (stmt->params + stmt->param_count); - stmt->field_count= (uint) field_count; - mysql->status= MYSQL_STATUS_READY; + stmt->bind= (stmt->params + stmt->param_count); + stmt->field_count= (uint) field_count; + stmt->param_count= (ulong) param_count; + stmt->mysql->status= MYSQL_STATUS_READY; DBUG_RETURN(0); } @@ -3908,13 +3910,13 @@ mysql_prepare(MYSQL *mysql, const char *query, ulong length) } init_alloc_root(&stmt->mem_root,8192,0); - if (read_prepare_result(mysql, stmt)) + stmt->mysql= mysql; + if (read_prepare_result(stmt)) { stmt_close(stmt, 1); DBUG_RETURN(0); } stmt->state= MY_ST_PREPARE; - stmt->mysql= mysql; mysql->stmts= list_add(mysql->stmts, &stmt->list); stmt->list.data= stmt; DBUG_PRINT("info", ("Parameter count: %ld", stmt->param_count)); @@ -3925,18 +3927,41 @@ mysql_prepare(MYSQL *mysql, const char *query, ulong length) /* Returns prepared meta information in the form of resultset to client. +TODO : Return param information also */ +MYSQL_RES *prepare_result(MYSQL_FIELD *fields, unsigned long count) +{ + MYSQL_RES *result; + + if (!count || !fields) + return 0; + + if (!(result=(MYSQL_RES*) my_malloc(sizeof(*result)+ + sizeof(ulong)*count, + MYF(MY_WME | MY_ZEROFILL)))) + return 0; + + result->eof=1; /* Marker for buffered */ + result->fields= fields; + result->field_count= count; + return result; +} + MYSQL_RES * STDCALL mysql_prepare_result(MYSQL_STMT *stmt) { MYSQL_RES *result; DBUG_ENTER("mysql_prepare_result"); - - if (!stmt->fields) + + if (!stmt->field_count || !stmt->fields) DBUG_RETURN(0); - result= &stmt->tmp_result; - bzero((char*) result, sizeof(MYSQL_RES)); + + if (!(result=(MYSQL_RES*) my_malloc(sizeof(*result)+ + sizeof(ulong)*stmt->field_count, + MYF(MY_WME | MY_ZEROFILL)))) + return 0; + result->eof=1; /* Marker for buffered */ result->fields= stmt->fields; result->field_count= stmt->field_count; @@ -4088,12 +4113,13 @@ static my_bool store_param(MYSQL_STMT *stmt, MYSQL_BIND *param) DBUG_ENTER("store_param"); DBUG_PRINT("enter",("type: %d, buffer:%lx, length: %d", param->buffer_type, param->buffer ? param->buffer : "0", *param->length)); - - if (param->is_null || param->buffer_type == MYSQL_TYPE_NULL) + + if (param->is_null || param->buffer_type == MYSQL_TYPE_NULL || + *param->length == MYSQL_NULL_DATA) store_param_null(net, param); else { - /* Allocate for worst case (long string) */ + /* Allocate for worst case (long string) */ if ((my_realloc_str(net, 9 + *param->length))) DBUG_RETURN(1); (*param->store_param_func)(net, param); @@ -4101,7 +4127,6 @@ static my_bool store_param(MYSQL_STMT *stmt, MYSQL_BIND *param) DBUG_RETURN(0); } - /* Send the prepare query to server for execution */ @@ -4125,13 +4150,6 @@ static my_bool execute(MYSQL_STMT * stmt, char *packet, ulong length) } stmt->state= MY_ST_EXECUTE; mysql_free_result(stmt->result); -#if USED_IN_FETCH - if (stmt->res_buffers) /* Result buffers exists, cache results */ - { - mysql_free_result(stmt->result); - stmt->result= mysql_store_result(mysql); - } - #endif DBUG_RETURN(0); } @@ -4420,21 +4438,21 @@ static void fetch_result_tinyint(MYSQL_BIND *param, uchar **row) static void fetch_result_short(MYSQL_BIND *param, uchar **row) { - short value= *(short *)row; - int2store(param->buffer, value); + short value= (short)**row; + int2store(param->buffer, value); *row+=2; } static void fetch_result_int32(MYSQL_BIND *param, uchar **row) { - int32 value= *(int32 *)row; + int32 value= (int32)**row; int4store(param->buffer, value); *row+=4; } static void fetch_result_int64(MYSQL_BIND *param, uchar **row) { - longlong value= *(longlong *)row; + longlong value= (longlong)**row; int8store(param->buffer, value); *row+=8; } @@ -4443,7 +4461,7 @@ static void fetch_result_float(MYSQL_BIND *param, uchar **row) { float value; float4get(value,*row); - float4store(param->buffer, *row); + float4store(param->buffer, value); *row+=4; } @@ -4459,6 +4477,7 @@ static void fetch_result_str(MYSQL_BIND *param, uchar **row) { ulong length= net_field_length(row); memcpy(param->buffer, (char *)*row, length); + *(param->buffer+length)= '\0'; /* do we need this for all cases.. I doubt */ *param->length= length; *row+=length; } @@ -4537,41 +4556,46 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind) Fetch row data to bind buffers */ -static my_bool -stmt_fetch_row(MYSQL_STMT *stmt, uchar **row) +static void +stmt_fetch_row(MYSQL_STMT *stmt, uchar *row) { MYSQL_BIND *bind, *end; - uchar *null_ptr= (uchar*) *row, bit; - - row+= (stmt->field_count+9)/8; - bit= 4; /* First 2 bits are reserved */ - + MYSQL_FIELD *field; + uchar *null_ptr, bit; + + null_ptr= row; + row+= (stmt->field_count+9)/8; /* skip null bits */ + bit= 4; /* first 2 bits are reserved */ + /* Copy complete row to application buffers */ - for (bind= stmt->bind, end= (MYSQL_BIND *) bind + stmt->field_count; - bind < end; - bind++) - { + for (bind= stmt->bind, end= (MYSQL_BIND *) bind + stmt->field_count, + field= stmt->fields; + bind < end && field; + bind++, field++) + { if (*null_ptr & bit) - bind->is_null= 1; + *bind->length= MYSQL_NULL_DATA; else - { - bind->is_null= 0; - (*bind->fetch_result)(bind, row); - } + /* TODO: Add conversion routines code here */ + (*bind->fetch_result)(bind, &row); if (! (bit<<=1) & 255) { - bit=1; /* To next byte */ + bit= 1; /* To next byte */ null_ptr++; } } - return 0; } static int read_binary_data(MYSQL *mysql) -{ +{ + /* TODO : Changes needed based on logic of use_result/store_result + Currently by default it is use_result. In case of + store_result, the data packet must point to already + read data. + */ if (packet_error == net_safe_read(mysql)) return -1; - if (mysql->net.read_pos[0]) + if (mysql->net.read_pos[0] == 254) return 1; /* End of data */ return 0; } @@ -4584,29 +4608,24 @@ static int read_binary_data(MYSQL *mysql) int STDCALL mysql_fetch(MYSQL_STMT *stmt) { MYSQL *mysql= stmt->mysql; + int res; DBUG_ENTER("mysql_fetch"); - if (stmt->res_buffers) + if (!(res= read_binary_data(mysql))) { - int res; - if (!(res= read_binary_data(mysql))) - { - if (stmt->res_buffers) - DBUG_RETURN((int) stmt_fetch_row(stmt,(uchar **) &mysql->net.read_pos+1)); - DBUG_RETURN(0); - } - DBUG_PRINT("info", ("end of data")); - mysql->status= MYSQL_STATUS_READY; - - if (res < 0) /* Network error */ - { - set_stmt_errmsg(stmt,(char *)mysql->net.last_error, - mysql->net.last_errno); - DBUG_RETURN(MYSQL_STATUS_ERROR); - } - DBUG_RETURN(MYSQL_NO_DATA); /* no more data */ + if (stmt->res_buffers) + stmt_fetch_row(stmt, mysql->net.read_pos+1); + DBUG_RETURN(0); } - DBUG_RETURN(0); //?? do we need to set MYSQL_STATUS_READY ? + mysql->status= MYSQL_STATUS_READY; + if (res < 0) /* Network error */ + { + set_stmt_errmsg(stmt,(char *)mysql->net.last_error, + mysql->net.last_errno); + DBUG_RETURN(MYSQL_STATUS_ERROR); + } + DBUG_PRINT("info", ("end of data")); + DBUG_RETURN(MYSQL_NO_DATA); /* no more data */ } diff --git a/sql/field.cc b/sql/field.cc index 9acf2e14829..c8e71e8060b 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2599,7 +2599,7 @@ String *Field_double::val_str(String *val_buffer, bool Field_double::send_binary(Protocol *protocol) { - return protocol->store((float) Field_double::val_real(), dec, (String*) 0); + return protocol->store((double) Field_double::val_real(), dec, (String*) 0); } @@ -3169,7 +3169,7 @@ bool Field_time::send_binary(Protocol *protocol) Field_time::get_time(&tm); tm.day= tm.hour/3600; // Move hours to days tm.hour-= tm.day*3600; - return protocol->store(&tm); + return protocol->store_time(&tm); } @@ -3254,6 +3254,13 @@ int Field_year::store(longlong nr) return 0; } +bool Field_year::send_binary(Protocol *protocol) +{ + ulonglong tmp= Field_year::val_int(); + TIME tm; + tm.year= (uint32) tmp; + return protocol->store_date(&tm); +} double Field_year::val_real(void) { @@ -3371,6 +3378,16 @@ int Field_date::store(longlong nr) return error; } +bool Field_date::send_binary(Protocol *protocol) +{ + longlong tmp= Field_date::val_int(); + TIME tm; + tm.year= (uint32) tmp/10000L % 10000; + tm.month= (uint32) tmp/100 % 100; + tm.day= (uint32) tmp % 100; + return protocol->store_date(&tm); +} + double Field_date::val_real(void) { @@ -3544,7 +3561,12 @@ void Field_newdate::store_time(TIME *ltime,timestamp_type type) int3store(ptr,tmp); } - +bool Field_newdate::send_binary(Protocol *protocol) +{ + TIME tm; + Field_newdate::get_date(&tm,0); + return protocol->store_date(&tm); +} double Field_newdate::val_real(void) { @@ -3705,6 +3727,13 @@ void Field_datetime::store_time(TIME *ltime,timestamp_type type) longlongstore(ptr,tmp); } +bool Field_datetime::send_binary(Protocol *protocol) +{ + TIME tm; + Field_datetime::get_date(&tm, 1); + return protocol->store(&tm); +} + double Field_datetime::val_real(void) { diff --git a/sql/field.h b/sql/field.h index 40578d19c82..67bae7302f9 100644 --- a/sql/field.h +++ b/sql/field.h @@ -166,7 +166,7 @@ public: ptr-=row_offset; return tmp; } - bool send_binary(Protocol *protocol); + virtual bool send_binary(Protocol *protocol); virtual char *pack(char* to, const char *from, uint max_length=~(uint) 0) { uint32 length=pack_length(); @@ -792,7 +792,6 @@ public: double val_real(void); longlong val_int(void); String *val_str(String*,String *); - bool send_binary(Protocol *protocol); int cmp(const char *,const char*); void sort_string(char *buff,uint length); void sql_type(String &str) const; @@ -833,7 +832,6 @@ public: double val_real(void); longlong val_int(void); String *val_str(String*,String *); - bool send_binary(Protocol *protocol); int cmp(const char *,const char*); void sort_string(char *buff,uint length); void get_key_image(char *buff,uint length, CHARSET_INFO *cs, imagetype type); @@ -876,7 +874,6 @@ public: double val_real(void); longlong val_int(void); String *val_str(String*,String *); - bool send_binary(Protocol *protocol); int cmp(const char *,const char*); int cmp(const char *a, uint32 a_length, const char *b, uint32 b_length); int cmp_offset(uint offset); @@ -982,7 +979,6 @@ public: double val_real(void); longlong val_int(void); String *val_str(String*,String *); - bool send_binary(Protocol *protocol); int cmp(const char *,const char*); void sort_string(char *buff,uint length); uint32 pack_length() const { return (uint32) packlength; } diff --git a/sql/protocol.cc b/sql/protocol.cc index 9d7dc66b452..63bca9b70b3 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -616,7 +616,7 @@ bool Protocol_simple::store_null() field_pos++; #endif char buff[1]; - buff[0]= 251; + buff[0]= (char)251; return packet->append(buff, sizeof(buff), PACKET_BUFFET_EXTRA_ALLOC); } @@ -774,13 +774,27 @@ bool Protocol_simple::store_time(TIME *tm) /**************************************************************************** Functions to handle the binary protocol used with prepared statements + + Data format: + + [ok:1] <-- reserved ok packet + [null_field:(field_count+7+2)/8] <-- reserved to send null data. The size is + calculated using: + bit_fields= (field_count+7+2)/8; + 2 bits are reserved + [[length]data] <-- data field (the length applies only for + string/binary/time/timestamp fields and + rest of them are not sent as they have + the default length that client understands + based on the field type + [..]..[[length]data] <-- data ****************************************************************************/ bool Protocol_prep::prepare_for_send(List *item_list) { - field_count=item_list->elements; - bit_fields= (field_count+3)/8; - if (packet->alloc(bit_fields)) + field_count= item_list->elements; + bit_fields= (field_count+9)/8; + if (packet->alloc(bit_fields+1)) return 1; /* prepare_for_resend will be called after this one */ return 0; @@ -789,9 +803,8 @@ bool Protocol_prep::prepare_for_send(List *item_list) void Protocol_prep::prepare_for_resend() { - packet->length(bit_fields); - bzero((char*) packet->ptr()+1, bit_fields-1); - packet[0]=1; // Marker for ok packet + packet->length(bit_fields+1); + bzero((char*) packet->ptr(), 1+bit_fields); field_pos=0; } @@ -813,7 +826,7 @@ bool Protocol_prep::store(const char *from,uint length) bool Protocol_prep::store_null() { - uint offset=(field_pos+2)/8, bit= (1 << ((field_pos+2) & 7)); + uint offset= (field_pos+2)/8+1, bit= (1 << ((field_pos+2) & 7)); /* Room for this as it's allocated in prepare_for_send */ char *to= (char*) packet->ptr()+offset; *to= (char) ((uchar) *to | (uchar) bit); @@ -926,6 +939,7 @@ bool Protocol_prep::store(TIME *tm) { #ifndef DEBUG_OFF DBUG_ASSERT(field_types == 0 || + field_types[field_pos] == MYSQL_TYPE_YEAR || field_types[field_pos] == MYSQL_TYPE_DATETIME || field_types[field_pos] == MYSQL_TYPE_DATE || field_types[field_pos] == MYSQL_TYPE_TIMESTAMP); @@ -987,3 +1001,10 @@ bool Protocol_prep::store_time(TIME *tm) buff[0]=(char) length; // Length is stored first return packet->append(buff, length+1, PACKET_BUFFET_EXTRA_ALLOC); } + +#if 0 +bool Protocol_prep::send_fields(List *list, uint flag) +{ + return prepare_for_send(list); +}; +#endif diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 704acc9c1c2..93004ce2937 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -440,10 +440,9 @@ static bool mysql_test_upd_fields(PREP_STMT *stmt, TABLE_LIST *table_list, COND *conds) { THD *thd= stmt->thd; - TABLE *table; DBUG_ENTER("mysql_test_upd_fields"); - if (!(table = open_ltable(thd,table_list,table_list->lock_type))) + if (open_and_lock_tables(thd, table_list)) DBUG_RETURN(1); if (setup_tables(table_list) || setup_fields(thd,table_list,fields,1,0,0) || @@ -477,13 +476,12 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables, COND *conds, ORDER *order, ORDER *group, Item *having) { - TABLE *table; bool hidden_group_fields; THD *thd= stmt->thd; List all_fields(fields); DBUG_ENTER("mysql_test_select_fields"); - if (!(table = open_ltable(thd,tables,TL_READ))) + if (open_and_lock_tables(thd, tables)) DBUG_RETURN(1); thd->used_tables=0; // Updated by setup_fields @@ -512,7 +510,7 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables, sending any info on where clause. */ if (send_prep_stmt(stmt, fields.elements) || - thd->protocol_prep.send_fields(&fields,0) || + thd->protocol_simple.send_fields(&fields,0) || send_item_params(stmt)) DBUG_RETURN(1); DBUG_RETURN(0); @@ -626,14 +624,17 @@ static bool parse_prepare_query(PREP_STMT *stmt, /* Initialize parameter items in statement */ -static bool init_param_items(THD *thd, PREP_STMT *stmt) + +static bool init_param_items( PREP_STMT *stmt) { + List ¶ms= stmt->thd->lex.param_list; Item_param **to; + if (!(stmt->param= to= (Item_param **) my_malloc(sizeof(Item_param *)*(stmt->param_count+1), MYF(MY_WME)))) return 1; - List_iterator param_iterator(thd->lex.param_list); + List_iterator param_iterator(params); while ((*(to++) = (Item_param *)param_iterator++)); return 0; } @@ -659,29 +660,32 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length) DBUG_ENTER("mysql_stmt_prepare"); bzero((char*) &stmt, sizeof(stmt)); - stmt.thd= thd; + stmt.stmt_id= ++thd->current_stmt_id; init_sql_alloc(&stmt.mem_root, 8192, 8192); + + stmt.thd= thd; + stmt.thd->mem_root= stmt.mem_root; - thd->mem_root= stmt.mem_root; - if (alloc_query(thd, packet, packet_length)) + if (alloc_query(stmt.thd, packet, packet_length)) goto err; + if (parse_prepare_query(&stmt, thd->query, thd->query_length)) goto err; if (!(specialflag & SPECIAL_NO_PRIOR)) my_pthread_setprio(pthread_self(),WAIT_PRIOR); - if (init_param_items(thd, &stmt)) + if (init_param_items(&stmt)) goto err; - stmt.mem_root= thd->mem_root; + stmt.mem_root= stmt.thd->mem_root; tree_insert(&thd->prepared_statements, (void *)&stmt, 0, (void *)0); thd->mem_root= thd_root; // restore main mem_root DBUG_RETURN(0); err: - stmt.mem_root= thd->mem_root; + stmt.mem_root= stmt.thd->mem_root; free_prep_stmt(&stmt, free_free, (void*) 0); thd->mem_root = thd_root; // restore main mem_root DBUG_RETURN(1); @@ -727,9 +731,9 @@ void mysql_stmt_execute(THD *thd, char *packet) mysql_delete(), mysql_update() and mysql_select() to not to have re-check on setup_* and other things .. */ - thd->protocol= &thd->protocol_prep; // Switch to binary protocol + stmt->thd->protocol= &thd->protocol_prep; // Switch to binary protocol mysql_execute_command(stmt->thd); - thd->protocol= &thd->protocol_simple; // Use normal protocol + stmt->thd->protocol= &thd->protocol_simple; // Use normal protocol if (!(specialflag & SPECIAL_NO_PRIOR)) my_pthread_setprio(pthread_self(), WAIT_PRIOR); From 6aee32283012510443c03ec590f4b53a4866187d Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 3 Jan 2003 04:12:34 -0800 Subject: [PATCH 121/220] Missed commit --- include/mysql.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mysql.h b/include/mysql.h index 063d7227351..daa544f216c 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -510,7 +510,7 @@ MYSQL_RES *STDCALL mysql_prepare_result(MYSQL_STMT *stmt); #define MYSQL_STATUS_ERROR 2 #define MYSQL_NO_DATA 100 #define MYSQL_NEED_DATA 99 -#define MYSQL_LONG_DATA_END 0xFF +#define MYSQL_NULL_DATA (-1) #define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) From 7df75ca76ac6ff716443f04aaa3fda01239dc0aa Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 3 Jan 2003 15:07:40 +0200 Subject: [PATCH 122/220] Further fix for export class problem --- sql/item.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/item.cc b/sql/item.cc index 08ca2d66f02..2f1c5245a01 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -198,6 +198,7 @@ String *Item_field::val_str(String *str) { if ((null_value=field->is_null())) return 0; + str->set_charset(str_value.charset()); return field->val_str(str,&str_value); } From 2ca6d018d767207c0583fceeccd2a941281e51f2 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 3 Jan 2003 17:08:00 +0200 Subject: [PATCH 123/220] fixed do with subselects mysql-test/r/subselect.result: test of DO with subselects mysql-test/t/subselect.test: test of DO with subselects --- mysql-test/r/subselect.result | 11 ++++++++++- mysql-test/t/subselect.test | 10 +++++++++- sql/sql_parse.cc | 9 ++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 7dc03a31878..38a8e0368c6 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -841,4 +841,13 @@ ROW(1, 1, 'a') IN (select b,a,c from t where c='b' or c='a') 1 select ROW(1, 1, 'a') IN (select b,a,c from t limit 2); This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' -drop table if exists t; +drop table t; +create table t (a int); +insert into t values (1); +do @a:=(SELECT a from t); +select @a; +@a +1 +drop table t; +do (SELECT a from t); +Table 'test.t' doesn't exist diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index ba9491125a4..de07df1905b 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -462,4 +462,12 @@ select ROW(1, 2, 'a') IN (select a,b,c from t where c='b' or c='a'); select ROW(1, 1, 'a') IN (select b,a,c from t where c='b' or c='a'); -- error 1235 select ROW(1, 1, 'a') IN (select b,a,c from t limit 2); -drop table if exists t; +drop table t; + +create table t (a int); +insert into t values (1); +do @a:=(SELECT a from t); +select @a; +drop table t; +-- error 1146 +do (SELECT a from t); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index c0b33153dab..ac18b65e8ce 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1598,7 +1598,14 @@ mysql_execute_command(THD *thd) break; } case SQLCOM_DO: - res=mysql_do(thd, *lex->insert_list); + if (tables && ((res= check_table_access(thd, SELECT_ACL, tables)) || + (res= open_and_lock_tables(thd,tables)))) + break; + + fix_tables_pointers(lex->all_selects_list); + res= mysql_do(thd, *lex->insert_list); + if (thd->net.report_error) + res= -1; break; case SQLCOM_EMPTY_QUERY: From 287906e972266e9f629a8b53a7f6c46f22bac11a Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 3 Jan 2003 19:46:15 +0400 Subject: [PATCH 124/220] Fix for the QUOTE() function. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + mysql-test/r/func_str.result | 3 +++ mysql-test/t/func_str.test | 1 + sql/item_strfunc.cc | 2 +- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index a55a5f46496..652ac3eb519 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -61,6 +61,7 @@ paul@teton.kitebird.com pem@mysql.com peter@linux.local peter@mysql.com +ram@mysql.r18.ru ram@ram.(none) ranger@regul.home.lan root@x3.internalnet diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 69e37d7b911..9e8f2b90f07 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -155,6 +155,9 @@ quote(concat('abc\'', '\\cba')) select quote(1/0), quote('\0\Z'); quote(1/0) quote('\0\Z') NULL '\0\Z' +select length(quote(concat(char(0),"test"))); +length(quote(concat(char(0),"test"))) +8 select reverse(""); reverse("") diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index 717b9c86a07..f95cd901dfb 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -64,6 +64,7 @@ select decode(encode("abcdef","monty"),"monty")="abcdef"; select quote('\'\"\\test'); select quote(concat('abc\'', '\\cba')); select quote(1/0), quote('\0\Z'); +select length(quote(concat(char(0),"test"))); # # Wrong usage of functions diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index af533eefe9a..1d058a7d810 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2134,7 +2134,7 @@ String *Item_func_quote::val_str(String *str) */ to= (char*) str->ptr() + new_length - 1; *to--= '\''; - for (start= (char*) arg->ptr() ; end-- != start; to--) + for (start= (char*) arg->ptr(),end= start + arg_length; end-- != start; to--) { /* We can't use the bitmask here as we want to replace \O and ^Z with 0 From a644e002ce9f9904747cae2e3d84bac1f19f3837 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 4 Jan 2003 01:19:17 -0200 Subject: [PATCH 125/220] Fix warnings and error VC++ compiler client/mysql.cc: Removing unreferenced variables sql/sql_test.cc: Fix VC++ compiler error that doesn't permits the declaration and initialization of variables that can be skipped by the prior goto end instruction. --- client/mysql.cc | 1 - sql/sql_test.cc | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 9ee441a7709..680175f2123 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1414,7 +1414,6 @@ static int com_server_help(String *buffer __attribute__((unused)), server_cmd= cmd_buf; } - char buff[16], time_buf[32]; MYSQL_RES *result; ulong timer; uint error= 0; diff --git a/sql/sql_test.cc b/sql/sql_test.cc index 3fbeaa753db..758778ecfa8 100644 --- a/sql/sql_test.cc +++ b/sql/sql_test.cc @@ -276,6 +276,7 @@ static void display_table_locks (void) VOID(pthread_mutex_unlock(&lock->mutex)); } VOID(pthread_mutex_unlock(&THR_LOCK_lock)); + uint i; if (!saved_table_locks.elements) goto end; qsort((gptr) dynamic_element(&saved_table_locks,0,TABLE_LOCK_INFO *),saved_table_locks.elements,sizeof(TABLE_LOCK_INFO),(qsort_cmp) dl_compare); @@ -283,7 +284,7 @@ static void display_table_locks (void) puts("\nThread database.table_name Locked/Waiting Lock_type\n"); - for (uint i=0 ; i < saved_table_locks.elements ; i++) + for (i=0 ; i < saved_table_locks.elements ; i++) { TABLE_LOCK_INFO *dl_ptr=dynamic_element(&saved_table_locks,i,TABLE_LOCK_INFO*); printf("%-8ld%-28.28s%-22s%s\n", From 594bfe01bf335c35cedd62a865cfd308fee8ef6e Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 3 Jan 2003 23:37:16 -0800 Subject: [PATCH 126/220] Fix date,time,timestamp,year - binary protocol --- libmysql/libmysql.c | 386 +++++++++++++++++++++++++++++++++++++++----- sql/field.cc | 4 +- sql/protocol.cc | 28 ++-- 3 files changed, 362 insertions(+), 56 deletions(-) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index d6d2dca9af0..9d87cef2e34 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1739,7 +1739,6 @@ static void mysql_once_init() #define strdup_if_not_null(A) (A) == 0 ? 0 : my_strdup((A),MYF(MY_WME)) -#ifdef HAVE_OPENSSL my_bool STDCALL mysql_ssl_set(MYSQL *mysql __attribute__((unused)) , const char *key __attribute__((unused)), @@ -1748,14 +1747,15 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) , const char *capath __attribute__((unused)), const char *cipher __attribute__((unused))) { +#ifdef HAVE_OPENSSL mysql->options.ssl_key= strdup_if_not_null(key); mysql->options.ssl_cert= strdup_if_not_null(cert); mysql->options.ssl_ca= strdup_if_not_null(ca); mysql->options.ssl_capath= strdup_if_not_null(capath); mysql->options.ssl_cipher= strdup_if_not_null(cipher); +#endif /* HAVE_OPENSSL */ return 0; } -#endif /************************************************************************** @@ -3927,27 +3927,8 @@ mysql_prepare(MYSQL *mysql, const char *query, ulong length) /* Returns prepared meta information in the form of resultset to client. -TODO : Return param information also */ -MYSQL_RES *prepare_result(MYSQL_FIELD *fields, unsigned long count) -{ - MYSQL_RES *result; - - if (!count || !fields) - return 0; - - if (!(result=(MYSQL_RES*) my_malloc(sizeof(*result)+ - sizeof(ulong)*count, - MYF(MY_WME | MY_ZEROFILL)))) - return 0; - - result->eof=1; /* Marker for buffered */ - result->fields= fields; - result->field_count= count; - return result; -} - MYSQL_RES * STDCALL mysql_prepare_result(MYSQL_STMT *stmt) { @@ -4430,6 +4411,327 @@ mysql_send_long_data(MYSQL_STMT *stmt, uint param_number, ****************************************************************************/ +static ulong get_field_length(uint type) +{ + ulong length; + + switch (type) { + + case MYSQL_TYPE_TINY: + length= 1; + break; + case MYSQL_TYPE_SHORT: + case MYSQL_TYPE_YEAR: + length= 2; + break; + case MYSQL_TYPE_LONG: + case MYSQL_TYPE_FLOAT: + length= 4; + break; + case MYSQL_TYPE_LONGLONG: + case MYSQL_TYPE_DOUBLE: + length= 8; + break; + default: + length= 0; + } + return length; +} + +static void send_data_long(MYSQL_BIND *param, longlong value) +{ + char *buffer= param->buffer; + + *param->length= get_field_length(param->buffer_type); + switch(param->buffer_type) { + + case MYSQL_TYPE_TINY: + *param->buffer= (uchar) value; + break; + case MYSQL_TYPE_SHORT: + int2store(buffer, (short)value); + break; + case MYSQL_TYPE_LONG: + int4store(buffer, (int32)value); + break; + case MYSQL_TYPE_LONGLONG: + int8store(buffer, (longlong)value); + break; + case MYSQL_TYPE_FLOAT: + { + float data= (float)value; + float4store(buffer, data); + break; + } + case MYSQL_TYPE_DOUBLE: + { + double data= (double)value; + float8store(buffer, data); + break; + } + default: + { + uint length= sprintf(buffer,"%lld",value); + *param->length= length; + buffer[length]='\0'; + } + } +} + +static void send_data_double(MYSQL_BIND *param, double value) +{ + char *buffer= param->buffer; + + *param->length= get_field_length(param->buffer_type); + switch(param->buffer_type) { + + case MYSQL_TYPE_TINY: + *buffer= (uchar)value; + break; + case MYSQL_TYPE_SHORT: + int2store(buffer, (short)value); + break; + case MYSQL_TYPE_LONG: + int4store(buffer, (int32)value); + break; + case MYSQL_TYPE_LONGLONG: + int8store(buffer, (longlong)value); + break; + case MYSQL_TYPE_FLOAT: + { + float data= (float)value; + float4store(buffer, data); + break; + } + case MYSQL_TYPE_DOUBLE: + { + double data= (double)value; + float8store(buffer, data); + break; + } + default: + { + uint length= sprintf(buffer,"%g",value); + *param->length= length; + buffer[length]='\0'; + } + } +} + +static void send_data_str(MYSQL_BIND *param, char *value, uint src_length) +{ + char *buffer= param->buffer; + + *param->length= get_field_length(param->buffer_type); + switch(param->buffer_type) { + + case MYSQL_TYPE_TINY: + *buffer= (char)*value; + break; + case MYSQL_TYPE_SHORT: + { + short data= (short)sint2korr(value); + int2store(buffer, data); + break; + } + case MYSQL_TYPE_LONG: + { + int32 data= (int32)sint4korr(value); + int4store(buffer, data); + break; + } + case MYSQL_TYPE_LONGLONG: + { + longlong data= sint8korr(value); + int8store(buffer, data); + break; + } + case MYSQL_TYPE_FLOAT: + { + float data; + float4get(data, value); + float4store(buffer, data); + break; + } + case MYSQL_TYPE_DOUBLE: + { + double data; + float8get(data, value); + float8store(buffer, data); + break; + } + default: + *param->length= src_length; + memcpy(buffer, value, src_length); + buffer[src_length]='\0'; + } +} + +static my_bool fetch_results(MYSQL_STMT *stmt, MYSQL_BIND *param, + uint field_type, uchar **row) +{ + ulong length; + + length= get_field_length(field_type); + switch (field_type) { + + case MYSQL_TYPE_TINY: + { + uchar value= (uchar) **row; + send_data_long(param,(longlong)value); + break; + } + case MYSQL_TYPE_SHORT: + case MYSQL_TYPE_YEAR: + { + short value= (short)sint2korr(*row); + send_data_long(param,(longlong)value); + break; + } + case MYSQL_TYPE_LONG: + { + int32 value= (int32)sint4korr(*row); + send_data_long(param,(int32)value); + break; + } + case MYSQL_TYPE_LONGLONG: + { + longlong value= (longlong)sint8korr(*row); + send_data_long(param,value); + break; + } + case MYSQL_TYPE_FLOAT: + { + float value; + float4get(value,*row); + send_data_double(param,(double)value); + break; + } + case MYSQL_TYPE_DOUBLE: + { + double value; + float8get(value,*row); + send_data_double(param,(double)value); + break; + } + case MYSQL_TYPE_DATE: + case MYSQL_TYPE_DATETIME: + case MYSQL_TYPE_TIMESTAMP: + { + uchar month,day; + short year; + int arg_length; + char ts[50],frac[10],time[20],date[20]; + + if (!(length= net_field_length(row))) + { + *param->length= 0; + break; + } + if (param->buffer_type < MYSQL_TYPE_VAR_STRING || + param->buffer_type > MYSQL_TYPE_STRING) + { + /* + Don't allow fetching of date/time/ts to non-string types + TODO: Allow fetching of date or time to long types. + */ + sprintf(stmt->last_error, + ER(stmt->last_errno= CR_UNSUPPORTED_PARAM_TYPE), + param->buffer_type, param->param_number); + return 1; + } + + arg_length= 0; + if (length > 7) + { + int sec_part= sint4korr(*row+7); + sprintf(frac,".%04d", sec_part); + arg_length+= 5; + } + if (length == 7) + { + uchar hour, minute, sec; + hour= *(*row+4); + minute= *(*row+5); + sec= *(*row+6); + sprintf((char *)time," %02d:%02d:%02d",hour,minute,sec); + arg_length+= 9; + } + + year= sint2korr(*row); + month= *(*row+2); + day= *(*row+3); + sprintf((char*) date,"%04d-%02d-%02d",year,month,day); + arg_length+= 10; + + if (arg_length != 19) + time[0]='\0'; + if (arg_length != 24) + frac[0]='\0'; + + strxmov(ts,date,time,frac,NullS); + send_data_str(param,ts,arg_length); + break; + } + case MYSQL_TYPE_TIME: + { + int day, arg_length; + uchar hour, minute, sec; + char ts[255], frac[20], time[20]; + const char *sign= ""; + + if (!(length= net_field_length(row))) + { + *param->length= 0; + break; + } + if (param->buffer_type < MYSQL_TYPE_VAR_STRING || + param->buffer_type > MYSQL_TYPE_STRING) + { + /* + Don't allow fetching of date/time/ts to non-string types + + TODO: Allow fetching of time to long types without + any conversion. + */ + sprintf(stmt->last_error, + ER(stmt->last_errno= CR_UNSUPPORTED_PARAM_TYPE), + param->buffer_type, param->param_number); + return 1; + } + arg_length= 0; + if (length > 8) + { + int sec_part= sint4korr(*row+8); + sprintf(frac,".%04d", sec_part); + arg_length+= 5; + } + + if (**row) + sign="-"; + + day= sint4korr(*row); /* TODO: how to handle this case */ + hour= *(*row+5); + minute= *(*row+6); + sec= *(*row+7); + arg_length+= sprintf((char *)time,"%s%02d:%02d:%02d",sign,hour,minute,sec); + + if (arg_length <= 9) + frac[0]='\0'; + + strxmov(ts,time,frac,NullS); + send_data_str(param,ts,arg_length); + break; + } + default: + length= net_field_length(row); + send_data_str(param,*row,length); + break; + } + *row+= length; + return 0; +} + static void fetch_result_tinyint(MYSQL_BIND *param, uchar **row) { *param->buffer= (uchar) **row; @@ -4438,23 +4740,23 @@ static void fetch_result_tinyint(MYSQL_BIND *param, uchar **row) static void fetch_result_short(MYSQL_BIND *param, uchar **row) { - short value= (short)**row; - int2store(param->buffer, value); - *row+=2; + short value = (short)sint2korr(*row); + int2store(param->buffer, value); + *row+= 2; } static void fetch_result_int32(MYSQL_BIND *param, uchar **row) { - int32 value= (int32)**row; + int32 value= (int32)sint4korr(*row); int4store(param->buffer, value); - *row+=4; + *row+= 4; } static void fetch_result_int64(MYSQL_BIND *param, uchar **row) -{ - longlong value= (longlong)**row; +{ + longlong value= (longlong)sint8korr(*row); int8store(param->buffer, value); - *row+=8; + *row+= 8; } static void fetch_result_float(MYSQL_BIND *param, uchar **row) @@ -4462,7 +4764,7 @@ static void fetch_result_float(MYSQL_BIND *param, uchar **row) float value; float4get(value,*row); float4store(param->buffer, value); - *row+=4; + *row+= 4; } static void fetch_result_double(MYSQL_BIND *param, uchar **row) @@ -4470,16 +4772,16 @@ static void fetch_result_double(MYSQL_BIND *param, uchar **row) double value; float8get(value,*row); float8store(param->buffer, value); - *row+=8; + *row+= 8; } static void fetch_result_str(MYSQL_BIND *param, uchar **row) { ulong length= net_field_length(row); memcpy(param->buffer, (char *)*row, length); - *(param->buffer+length)= '\0'; /* do we need this for all cases.. I doubt */ + *(param->buffer+length)= '\0'; *param->length= length; - *row+=length; + *row+= length; } /* @@ -4535,9 +4837,10 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind) case MYSQL_TYPE_TINY_BLOB: case MYSQL_TYPE_MEDIUM_BLOB: case MYSQL_TYPE_LONG_BLOB: + case MYSQL_TYPE_BLOB: case MYSQL_TYPE_VAR_STRING: case MYSQL_TYPE_STRING: - param->length= ¶m->buffer_length; + param->bind_length= 0; param->fetch_result= fetch_result_str; break; default: @@ -4560,7 +4863,7 @@ static void stmt_fetch_row(MYSQL_STMT *stmt, uchar *row) { MYSQL_BIND *bind, *end; - MYSQL_FIELD *field; + MYSQL_FIELD *field, *field_end; uchar *null_ptr, bit; null_ptr= row; @@ -4569,15 +4872,20 @@ stmt_fetch_row(MYSQL_STMT *stmt, uchar *row) /* Copy complete row to application buffers */ for (bind= stmt->bind, end= (MYSQL_BIND *) bind + stmt->field_count, - field= stmt->fields; - bind < end && field; + field= stmt->fields, + field_end= (MYSQL_FIELD *)stmt->fields+stmt->field_count; + bind < end && field < field_end; bind++, field++) { if (*null_ptr & bit) *bind->length= MYSQL_NULL_DATA; else - /* TODO: Add conversion routines code here */ - (*bind->fetch_result)(bind, &row); + { + if (field->type == bind->buffer_type) + (*bind->fetch_result)(bind, &row); + else if (fetch_results(stmt, bind, field->type, &row)) + break; + } if (! (bit<<=1) & 255) { bit= 1; /* To next byte */ diff --git a/sql/field.cc b/sql/field.cc index 1a0b5d496b2..d3de4e144bf 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -3257,9 +3257,7 @@ int Field_year::store(longlong nr) bool Field_year::send_binary(Protocol *protocol) { ulonglong tmp= Field_year::val_int(); - TIME tm; - tm.year= (uint32) tmp; - return protocol->store_date(&tm); + return protocol->store_short(tmp); } double Field_year::val_real(void) diff --git a/sql/protocol.cc b/sql/protocol.cc index 63bca9b70b3..d7cf9d39b5c 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -852,7 +852,8 @@ bool Protocol_prep::store_short(longlong from) { #ifndef DEBUG_OFF DBUG_ASSERT(field_types == 0 || - field_types[field_pos] == MYSQL_TYPE_SHORT); + field_types[field_pos] == MYSQL_TYPE_SHORT || + field_types[field_pos] == MYSQL_TYPE_YEAR); #endif field_pos++; char *to= packet->prep_append(2, PACKET_BUFFET_EXTRA_ALLOC); @@ -939,7 +940,6 @@ bool Protocol_prep::store(TIME *tm) { #ifndef DEBUG_OFF DBUG_ASSERT(field_types == 0 || - field_types[field_pos] == MYSQL_TYPE_YEAR || field_types[field_pos] == MYSQL_TYPE_DATETIME || field_types[field_pos] == MYSQL_TYPE_DATE || field_types[field_pos] == MYSQL_TYPE_TIMESTAMP); @@ -950,11 +950,11 @@ bool Protocol_prep::store(TIME *tm) pos= buff+1; int2store(pos, tm->year); - int2store(pos+2, tm->month); - int2store(pos+3, tm->day); - int2store(pos+4, tm->hour); - int2store(pos+5, tm->minute); - int2store(pos+6, tm->second); + pos[2]= (uchar) tm->month; + pos[3]= (uchar) tm->day; + pos[4]= (uchar) tm->hour; + pos[5]= (uchar) tm->minute; + pos[6]= (uchar) tm->second; int4store(pos+7, tm->second_part); if (tm->second_part) length=11; @@ -987,15 +987,15 @@ bool Protocol_prep::store_time(TIME *tm) field_pos++; pos= buff+1; pos[0]= tm->neg ? 1 : 0; - int4store(pos+1, tm->day); - int2store(pos+5, tm->hour); - int2store(pos+7, tm->minute); - int2store(pos+9, tm->second); - int4store(pos+11, tm->second_part); + int4store(pos+1, tm->day); + pos[5]= (uchar) tm->hour; + pos[6]= (uchar) tm->minute; + pos[7]= (uchar) tm->second; + int4store(pos+8, tm->second_part); if (tm->second_part) - length=14; + length=11; else if (tm->hour || tm->minute || tm->second || tm->day) - length=10; + length=8; else length=0; buff[0]=(char) length; // Length is stored first From 6609f346d6121ee2e6542b82b87f5f4f6924bbda Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 3 Jan 2003 23:38:47 -0800 Subject: [PATCH 127/220] Prepared statements + binary protocol test update --- tests/client_test.c | 1950 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 1548 insertions(+), 402 deletions(-) diff --git a/tests/client_test.c b/tests/client_test.c index 280df2bf717..d5e13dd3b43 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -32,14 +32,13 @@ #include #include -#include - - /* mysql client headers */ #include #include #include +#include + #ifndef true #define true 1 #endif @@ -58,100 +57,119 @@ static char *opt_user=0; static char *opt_password=0; static char *opt_host=0; static char *opt_unix_socket=0; -static uint opt_port; +static unsigned int opt_port; static my_bool tty_password=0; static MYSQL *mysql=0; -static char query[255]; +static char query[255]; +static char current_db[]= "client_test_db"; -#define myheader(str) { printf("\n\n#######################\n"); \ - printf("%s",str); \ - printf("\n#######################\n"); \ +#define myheader(str) { fprintf(stdout,"\n\n#######################\n"); \ + fprintf(stdout,"%s",str); \ + fprintf(stdout,"\n#######################\n"); \ } #define init_bind(x) (bzero(x,sizeof(x))) -void print_error(const char *msg) +#ifndef mysql_param_result +#define mysql_param_result mysql_prepare_result +#endif + +static void print_error(const char *msg) { if (mysql) { - fprintf(stderr,"\n [MySQL]%s \n",mysql_error(mysql)); + if (mysql->server_version) + fprintf(stderr,"\n [MySQL-%s]",mysql->server_version); + else + fprintf(stderr,"\n [MySQL]"); + fprintf(stderr," %s\n",mysql_error(mysql)); } - else if(msg) fprintf(stderr, "%s\n", msg); + else if(msg) fprintf(stderr, " [MySQL] %s\n", msg); } -void print_st_error(MYSQL_STMT *stmt, const char *msg) +static void print_st_error(MYSQL_STMT *stmt, const char *msg) { if (stmt) { - fprintf(stderr,"\n [MySQL]%s \n",mysql_stmt_error(stmt)); + if (stmt->mysql && stmt->mysql->server_version) + fprintf(stderr,"\n [MySQL-%s]",stmt->mysql->server_version); + else + fprintf(stderr,"\n [MySQL]"); + + fprintf(stderr," %s\n",mysql_stmt_error(stmt)); } - else if(msg) fprintf(stderr, "%s\n", msg); + else if(msg) fprintf(stderr, " [MySQL] %s\n", msg); } +static void client_disconnect(); #define myerror(msg) print_error(msg) #define mysterror(stmt, msg) print_st_error(stmt, msg) -#define myassert(x) if(x) {\ - fprintf(stderr,"ASSERTION FAILED AT %d@%s\n",__LINE__, __FILE__);\ - exit(1);\ +#define myassert(exp) \ + if(!exp) {\ + client_disconnect(); \ + fprintf(stderr,"\n"); \ + assert(exp); \ } -#define myassert_r(x) if(!x) {\ - fprintf(stderr,"ASSERTION FAILED AT %d@%s\n",__LINE__, __FILE__);\ - exit(1);\ +#define myassert_r(exp) \ + if(exp) {\ + client_disconnect(); \ + fprintf(stderr,"\n"); \ + assert(!(exp)); \ } #define myquery(r) \ -if( r != 0) \ { \ +if( r || r == -1) \ myerror(NULL); \ - myassert(true);\ + myassert(r == 0); \ } #define myquery_r(r) \ -if( r != 0) \ { \ +if( r || r == -1) \ myerror(NULL); \ - myassert_r(true);\ +myassert_r(r == 0); \ } #define mystmt(stmt,r) \ -if( r != 0) \ { \ +if( r || r == -1) \ mysterror(stmt,NULL); \ - myassert(true);\ +myassert(r == 0);\ } -#define myxquery(stmt) \ -if( stmt == 0) \ -{ \ - myerror(NULL); \ - myassert(true);\ -} - -#define myxquery_r(stmt) \ -if( stmt == 0) \ -{ \ - myerror(NULL); \ - myassert_r(true);\ -} \ -else myassert(true); - #define mystmt_r(stmt,r) \ -if( r != 0) \ { \ +if( r || r == -1) \ mysterror(stmt,NULL); \ - myassert_r(true);\ +myassert_r(r == 0);\ } +#define mystmt_init(stmt) \ +{ \ +if( stmt == 0) \ + myerror(NULL); \ +myassert(stmt != 0); \ +} + +#define mystmt_init_r(stmt) \ +{ \ +myassert(stmt == 0);\ +} + #define mytest(x) if(!x) {myerror(NULL);myassert(true);} #define mytest_r(x) if(x) {myerror(NULL);myassert(true);} +#define PREPARE(A,B) mysql_prepare(A,B,strlen(B)) + /******************************************************** * connect to the server * *********************************************************/ static void client_connect() { + char buff[255]; myheader("client_connect"); if(!(mysql = mysql_init(NULL))) @@ -163,28 +181,37 @@ static void client_connect() opt_password, opt_db ? opt_db:"test", opt_port, opt_unix_socket, 0))) { - myerror("connection failed"); + myerror("connection failed"); + mysql_close(mysql); exit(0); } /* set AUTOCOMMIT to ON*/ mysql_autocommit(mysql, true); + sprintf(buff,"CREATE DATABASE IF NOT EXISTS %s", current_db); + mysql_query(mysql, buff); + sprintf(buff,"USE %s", current_db); + mysql_query(mysql, buff); } /******************************************************** * close the connection * *********************************************************/ -void client_disconnect() +static void client_disconnect() { - myheader("client_disconnect"); - - mysql_close(mysql); + if (mysql) + { + char buff[255]; + sprintf(buff,"DROP DATABASE IF EXISTS %s", current_db); + mysql_query(mysql, buff); + mysql_close(mysql); + } } /******************************************************** * query processing * *********************************************************/ -void client_query() +static void client_query() { int rc; @@ -222,7 +249,7 @@ void client_query() /******************************************************** * print dashes * *********************************************************/ -void my_print_dashes(MYSQL_RES *result) +static void my_print_dashes(MYSQL_RES *result) { MYSQL_FIELD *field; unsigned int i,j; @@ -244,7 +271,7 @@ void my_print_dashes(MYSQL_RES *result) /******************************************************** * print resultset metadata information * *********************************************************/ -void my_print_result_metadata(MYSQL_RES *result) +static void my_print_result_metadata(MYSQL_RES *result) { MYSQL_FIELD *field; unsigned int i,j; @@ -287,6 +314,9 @@ int my_process_result_set(MYSQL_RES *result) MYSQL_FIELD *field; unsigned int i; unsigned int row_count=0; + + if (!result) + return 0; my_print_result_metadata(result); @@ -313,50 +343,157 @@ int my_process_result_set(MYSQL_RES *result) my_print_dashes(result); if (mysql_errno(mysql) != 0) - fprintf(stderr, "\n\tmysql_fetch_row() failed\n"); + fprintf(stderr, "\n mysql_fetch_row() failed\n"); else - fprintf(stdout,"\n\t%d rows returned\n", row_count); + fprintf(stdout,"\n %d rows returned", row_count); return(row_count); } -static void verify_col_data(const char *table, const char *col, const char *exp_data) +/******************************************************** +* process the stmt result set * +*********************************************************/ +uint my_process_stmt_result(MYSQL_STMT *stmt) { - MYSQL_STMT *stmt; - MYSQL_BIND bind[1]; - char data[255]; - int rc; + int field_count; + uint row_count= 0; + MYSQL_BIND buffer[50]; + MYSQL_FIELD *field; + MYSQL_RES *result; + char data[50][255]; + long length[50]; + int rc, i; + + if (!(result= mysql_prepare_result(stmt))) + { + while (!mysql_fetch(stmt)); + return 0; + } - init_bind(bind); - - bind[0].buffer_type=FIELD_TYPE_STRING; - bind[0].buffer= (char *)data; - bind[0].buffer_length= sizeof(data); + field_count= stmt->field_count; + for(i=0; i < field_count; i++) + { + buffer[i].buffer_type= MYSQL_TYPE_STRING; + buffer[i].buffer_length=50; + buffer[i].length=(long *)&length[i]; + buffer[i].buffer=(gptr)data[i]; + } - sprintf(query, "SELECT `%s` FROM `%s`", col, table); + my_print_result_metadata(result); - printf("\n %s", query); - stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); - - rc = mysql_bind_result(stmt,bind); - mystmt(stmt, rc); - - rc = mysql_execute(stmt); - mystmt(stmt, rc); - - rc = mysql_fetch(stmt); + rc= mysql_bind_result(stmt,buffer); mystmt(stmt,rc); - printf("\n data : %s (expected: %s)",data, exp_data); - assert(strcmp(data,exp_data)==0); + mysql_field_seek(result, 0); + while (mysql_fetch(stmt) == 0) + { + fputc('\t',stdout); + fputc('|',stdout); - mysql_stmt_close(stmt); + for (i=0; i < field_count; i++) + { + field = mysql_fetch_field(result); + if(length[i] == MYSQL_NULL_DATA) + fprintf(stdout, " %-*s |", (int) field->max_length, "NULL"); + else if (IS_NUM(field->type)) + fprintf(stdout, " %*s |", (int) field->max_length, data[i]); + else + fprintf(stdout, " %-*s |", (int) field->max_length, data[i]); + } + fputc('\t',stdout); + fputc('\n',stdout); + row_count++; + } + my_print_dashes(result); + fprintf(stdout,"\n %d rows returned", row_count); + mysql_free_result(result); + + return row_count; } +/* + Utility function to verify a particular column data +*/ +static void verify_col_data(const char *table, const char *col, + const char *exp_data) +{ + MYSQL_RES *result; + MYSQL_ROW row; + char query[255]; + int rc, field= 1; + + if (table && col) + { + sprintf(query, "SELECT %s FROM %s LIMIT 1", col, table); + + fprintf(stdout,"\n %s", query); + rc = mysql_query(mysql, query); + myquery(rc); + + field= 0; + } + + result = mysql_use_result(mysql); + mytest(result); + + if (!(row= mysql_fetch_row(result)) || !row[field]) + { + fprintf(stdout,"\n *** ERROR: FAILED TO GET THE RESULT ***"); + exit(1); + } + fprintf(stdout,"\n obtained: `%s` (expected: `%s`)", + row[field], exp_data); + myassert(strcmp(row[field],exp_data) == 0); + mysql_free_result(result); +} + +/* + Utility function to verify the field members +*/ + +static void verify_prepare_field(MYSQL_RES *result, + unsigned int no,const char *name, const char *org_name, + enum enum_field_types type, const char *table, + const char *org_table, const char *db) +{ + MYSQL_FIELD *field; + + if (!(field= mysql_fetch_field_direct(result,no))) + { + fprintf(stdout,"\n *** ERROR: FAILED TO GET THE RESULT ***"); + exit(1); + } + fprintf(stdout,"\n field[%d]:", no); + fprintf(stdout,"\n name :`%s`\t(expected: `%s`)", field->name, name); + fprintf(stdout,"\n org_name :`%s`\t(expected: `%s`)", field->org_name, org_name); + fprintf(stdout,"\n type :`%d`\t(expected: `%d`)", field->type, type); + fprintf(stdout,"\n table :`%s`\t(expected: `%s`)", field->table, table); + fprintf(stdout,"\n org_table:`%s`\t(expected: `%s`)", field->org_table, org_table); + fprintf(stdout,"\n database :`%s`\t(expected: `%s`)", field->db, db); + fprintf(stdout,"\n"); + myassert(strcmp(field->name,name) == 0); + myassert(strcmp(field->org_name,org_name) == 0); + myassert(field->type == type); + myassert(strcmp(field->table,table) == 0); + myassert(strcmp(field->org_table,org_table) == 0); + myassert(strcmp(field->db,db) == 0); +} + +/* + Utility function to verify the parameter count +*/ +static void verify_param_count(MYSQL_STMT *stmt, long exp_count) +{ + long param_count= mysql_param_count(stmt); + fprintf(stdout,"\n total parameters in stmt: %ld (expected: %ld)", + param_count, exp_count); + myassert(param_count == exp_count); +} + + /******************************************************** * store result processing * *********************************************************/ -void client_store_result() +static void client_store_result() { MYSQL_RES *result; int rc; @@ -375,9 +512,9 @@ void client_store_result() } /******************************************************** -* use result processing * +* fetch the results *********************************************************/ -void client_use_result() +static void client_use_result() { MYSQL_RES *result; int rc; @@ -398,7 +535,7 @@ void client_use_result() /******************************************************** * query processing * *********************************************************/ -void test_debug_example() +static void test_debug_example() { int rc; MYSQL_RES *result; @@ -418,7 +555,7 @@ void test_debug_example() rc = mysql_query(mysql,"UPDATE test_debug_example SET name='updated' WHERE name='deleted'"); myquery(rc); - rc = mysql_query(mysql,"SELECT * FROM test_debug_example"); + rc = mysql_query(mysql,"SELECT * FROM test_debug_example where name='mysql'"); myquery(rc); result = mysql_use_result(mysql); @@ -434,7 +571,7 @@ void test_debug_example() /******************************************************** * to test autocommit feature * *********************************************************/ -void test_tran_bdb() +static void test_tran_bdb() { MYSQL_RES *result; MYSQL_ROW row; @@ -512,7 +649,7 @@ void test_tran_bdb() /******************************************************** * to test autocommit feature * *********************************************************/ -void test_tran_innodb() +static void test_tran_innodb() { MYSQL_RES *result; MYSQL_ROW row; @@ -591,10 +728,10 @@ void test_tran_innodb() To test simple prepares of all DML statements *********************************************************/ -void test_prepare_simple() +static void test_prepare_simple() { MYSQL_STMT *stmt; - int rc,param_count; + int rc; myheader("test_prepare_simple"); @@ -610,41 +747,33 @@ void test_prepare_simple() /* alter table */ strcpy(query,"ALTER TABLE test_prepare_simple ADD new char(20)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout,"\n total parameters in alter:%d\n", param_count); - assert(param_count == 0); + verify_param_count(stmt,0); mysql_stmt_close(stmt); /* insert */ strcpy(query,"INSERT INTO test_prepare_simple VALUES(?,?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout,"\n total parameters in insert:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); mysql_stmt_close(stmt); /* update */ strcpy(query,"UPDATE test_prepare_simple SET id=? WHERE id=? AND name= ?"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout,"\n total parameters in update:%d\n", param_count); - assert(param_count == 3); + verify_param_count(stmt,3); mysql_stmt_close(stmt); /* delete */ strcpy(query,"DELETE FROM test_prepare_simple WHERE id=10"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout,"\n total parameters in delete:%d\n", param_count); - assert(param_count == 0); + verify_param_count(stmt,0); rc = mysql_execute(stmt); mystmt(stmt, rc); @@ -653,11 +782,9 @@ void test_prepare_simple() /* delete */ strcpy(query,"DELETE FROM test_prepare_simple WHERE id=?"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout,"\n total parameters in delete:%d\n", param_count); - assert(param_count == 1); + verify_param_count(stmt,1); rc = mysql_execute(stmt); mystmt_r(stmt, rc); @@ -666,11 +793,9 @@ void test_prepare_simple() /* select */ strcpy(query,"SELECT * FROM test_prepare_simple WHERE id=? AND name= ?"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout,"\n total parameters in select:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); mysql_stmt_close(stmt); @@ -683,9 +808,10 @@ void test_prepare_simple() /******************************************************** * to test simple prepare field results * *********************************************************/ -void test_prepare_field_result() +static void test_prepare_field_result() { MYSQL_STMT *stmt; + MYSQL_RES *result; int rc,param_count; myheader("test_prepare_field_result"); @@ -696,29 +822,47 @@ void test_prepare_field_result() rc = mysql_commit(mysql); myquery(rc); - rc = mysql_query(mysql,"CREATE TABLE test_prepare_field_result(id int, name varchar(50), extra int)"); + rc = mysql_query(mysql,"CREATE TABLE test_prepare_field_result(int_c int, \ + var_c varchar(50), ts_c timestamp(14),\ + char_c char(3), date_c date,extra tinyint)"); myquery(rc); /* insert */ - strcpy(query,"SELECT id,name FROM test_prepare_field_result WHERE id=?"); + strcpy(query,"SELECT int_c,var_c,date_c as date,ts_c,char_c FROM \ + test_prepare_field_result as t1 WHERE int_c=?"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout,"\n total parameters in insert:%d\n", param_count); - assert(param_count == 1); + verify_param_count(stmt,1); + + result = mysql_prepare_result(stmt); + mytest(result); + + my_print_result_metadata(result); + + fprintf(stdout,"\n\n field attributes:\n"); + verify_prepare_field(result,0,"int_c","int_c",MYSQL_TYPE_LONG, + "t1","test_prepare_field_result",current_db); + verify_prepare_field(result,1,"var_c","var_c",MYSQL_TYPE_VAR_STRING, + "t1","test_prepare_field_result",current_db); + verify_prepare_field(result,2,"date","date_c",MYSQL_TYPE_DATE, + "t1","test_prepare_field_result",current_db); + verify_prepare_field(result,3,"ts_c","ts_c",MYSQL_TYPE_TIMESTAMP, + "t1","test_prepare_field_result",current_db); + verify_prepare_field(result,4,"char_c","char_c",MYSQL_TYPE_STRING, + "t1","test_prepare_field_result",current_db); + + param_count= mysql_num_fields(result); + fprintf(stdout,"\n\n total fields: `%d` (expected: `5`)", param_count); + myassert(param_count == 5); mysql_stmt_close(stmt); - - /* now fetch the results ..*/ - rc = mysql_commit(mysql); - myquery(rc); } /******************************************************** * to test simple prepare field results * *********************************************************/ -void test_prepare_syntax() +static void test_prepare_syntax() { MYSQL_STMT *stmt; int rc; @@ -736,11 +880,11 @@ void test_prepare_syntax() strcpy(query,"INSERT INTO test_prepare_syntax VALUES(?"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery_r(stmt); + mystmt_init_r(stmt); strcpy(query,"SELECT id,name FROM test_prepare_syntax WHERE id=? AND WHERE"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery_r(stmt); + mystmt_init_r(stmt); /* now fetch the results ..*/ rc = mysql_commit(mysql); @@ -751,10 +895,10 @@ void test_prepare_syntax() /******************************************************** * to test simple prepare * *********************************************************/ -void test_prepare() +static void test_prepare() { MYSQL_STMT *stmt; - int rc,param_count; + int rc; char query[200]; int int_data; char str_data[50]; @@ -779,7 +923,7 @@ void test_prepare() myquery(rc); rc = mysql_query(mysql,"CREATE TABLE my_prepare(col1 tinyint,\ - col2 varchar(50), col3 int,\ + col2 varchar(15), col3 int,\ col4 smallint, col5 bigint, \ col6 float, col7 double )"); myquery(rc); @@ -787,11 +931,9 @@ void test_prepare() /* insert by prepare */ strcpy(query,"INSERT INTO my_prepare VALUES(?,?,?,?,?,?,?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 7); + verify_param_count(stmt,7); /* tinyint */ bind[0].buffer_type=FIELD_TYPE_TINY; @@ -852,7 +994,7 @@ void test_prepare() result = mysql_store_result(mysql); mytest(result); - assert((int)tiny_data == my_process_result_set(result)); + myassert((int)tiny_data == my_process_result_set(result)); mysql_free_result(result); } @@ -860,10 +1002,10 @@ void test_prepare() /******************************************************** * to test double comparision * *********************************************************/ -void test_double_compare() +static void test_double_compare() { MYSQL_STMT *stmt; - int rc,param_count; + int rc; char query[200],real_data[10], tiny_data; double double_data; MYSQL_RES *result; @@ -890,10 +1032,9 @@ void test_double_compare() strcpy(query, "UPDATE test_double_compare SET col1=100 WHERE col1 = ? AND col2 = ? AND COL3 = ?"); stmt = mysql_prepare(mysql,query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in update:%d\n", param_count); + verify_param_count(stmt,3); /* tinyint */ bind[0].buffer_type=FIELD_TYPE_TINY; @@ -916,7 +1057,7 @@ void test_double_compare() mystmt(stmt, rc); rc = (int)mysql_affected_rows(mysql); - printf("\n total affected rows:%d",rc); + fprintf(stdout,"\n total affected rows:%d",rc); mysql_stmt_close(stmt); @@ -932,21 +1073,17 @@ void test_double_compare() result = mysql_store_result(mysql); mytest(result); - assert((int)tiny_data == my_process_result_set(result)); + myassert((int)tiny_data == my_process_result_set(result)); mysql_free_result(result); - } - - - /******************************************************** * to test simple null * *********************************************************/ -void test_null() +static void test_null() { MYSQL_STMT *stmt; - int rc,param_count; + int rc; int nData=1; MYSQL_RES *result; MYSQL_BIND bind[2]; @@ -966,15 +1103,13 @@ void test_null() /* insert by prepare, wrong column name */ strcpy(query,"INSERT INTO test_null(col3,col2) VALUES(?,?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery_r(stmt); + mystmt_init_r(stmt); strcpy(query,"INSERT INTO test_null(col1,col2) VALUES(?,?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); bind[0].is_null=1; bind[0].buffer_type=MYSQL_TYPE_NULL; @@ -1003,49 +1138,171 @@ void test_null() result = mysql_store_result(mysql); mytest(result); - assert(nData == my_process_result_set(result)); + myassert(nData == my_process_result_set(result)); mysql_free_result(result); } +/******************************************************** +* to test fetch null * +*********************************************************/ +static void test_fetch_null() +{ + MYSQL_STMT *stmt; + int rc; + const char query[100]; + int length[11], i, nData; + MYSQL_BIND bind[11]; + + myheader("test_fetch_null"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_fetch_null"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint, \ + col3 int, col4 bigint, \ + col5 float, col6 double, \ + col7 date, col8 time, \ + col9 varbinary(10), \ + col10 varchar(50),\ + col11 char(20))"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"INSERT INTO test_fetch_null(col11) VALUES(1000)"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + /* fetch */ + for (i=0; i < 10; i++) + { + bind[i].buffer_type=FIELD_TYPE_LONG; + length[i]=99; + bind[i].length= (long *)&length[i]; + } + bind[i].buffer_type=FIELD_TYPE_LONG; + bind[i].buffer=(gptr)&nData; + + strcpy((char *)query , "SELECT * FROM test_fetch_null"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + rc = mysql_bind_result(stmt,bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + for (i=0; i < 10; i++) + { + fprintf(stdout, "\n data[%d]: %s", i, length[i] == MYSQL_NULL_DATA ? "NULL" : "NOT NULL"); + myassert(length[i] == MYSQL_NULL_DATA); + } + fprintf(stdout, "\n data[%d]: %d", i, nData); + myassert(nData == 1000); + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} /******************************************************** * to test simple select * *********************************************************/ -void test_select_simple() +static void test_select_version() { MYSQL_STMT *stmt; - int rc,length; + int rc; + const char query[100]; + + myheader("test_select_version"); + + strcpy((char *)query , "SELECT @@version"); + stmt = PREPARE(mysql, query); + mystmt_init(stmt); + + verify_param_count(stmt,0); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + my_process_stmt_result(stmt); + mysql_stmt_close(stmt); +} + +/******************************************************** +* to test simple select * +*********************************************************/ +static void test_select_simple() +{ + MYSQL_STMT *stmt; + int rc; const char query[100]; - MYSQL_RES *result; myheader("test_select_simple"); /* insert by prepare */ strcpy((char *)query, "SHOW TABLES FROM mysql"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - length = mysql_param_count(stmt); - fprintf(stdout," total parameters in select:%d\n", length); - assert(length == 0); + verify_param_count(stmt,0); rc = mysql_execute(stmt); mystmt(stmt, rc); - /* get the result */ - result = mysql_store_result(mysql); - mytest(result); - - my_process_result_set(result); - mysql_free_result(result); - + my_process_stmt_result(stmt); mysql_stmt_close(stmt); +} -#if 0 - strcpy((char *)query , "SELECT @@ VERSION"); - length = strlen(query); - rc = mysql_query(mysql,query); +/******************************************************** +* to test simple select to debug * +*********************************************************/ +static void test_select_direct() +{ + int rc; + MYSQL_RES *result; + + myheader("test_select_direct"); + + rc = mysql_autocommit(mysql,true); + myquery(rc); + + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_select"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_select(id int, id1 tinyint, \ + id2 float, \ + id3 double, \ + name varchar(50))"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + /* insert a row and commit the transaction */ + rc = mysql_query(mysql,"INSERT INTO test_select VALUES(10,5,2.3,4.5,'venu')"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"SELECT * FROM test_select"); myquery(rc); /* get the result */ @@ -1054,22 +1311,88 @@ void test_select_simple() my_process_result_set(result); mysql_free_result(result); -#endif } +/******************************************************** +* to test simple select with prepare * +*********************************************************/ +static void test_select_prepare() +{ + int rc, count; + MYSQL_STMT *stmt; + + myheader("test_select_prepare"); + + rc = mysql_autocommit(mysql,true); + myquery(rc); + + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_select"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_select(id int, name varchar(50))"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + /* insert a row and commit the transaction */ + rc = mysql_query(mysql,"INSERT INTO test_select VALUES(10,'venu')"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + stmt = mysql_prepare(mysql,"SELECT * FROM test_select",50); + mystmt_init(stmt); + + rc = mysql_execute(stmt); + mystmt(stmt,rc); + + count= my_process_stmt_result(stmt); + + rc = mysql_query(mysql,"DROP TABLE test_select"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_select(id tinyint, id1 int, \ + id2 float, id3 float, \ + name varchar(50))"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + /* insert a row and commit the transaction */ + rc = mysql_query(mysql,"INSERT INTO test_select(id,id1,id2,name) VALUES(10,5,2.3,'venu')"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + stmt = mysql_prepare(mysql,"SELECT * FROM test_select",25); + mystmt_init(stmt); + + rc = mysql_execute(stmt); + mystmt(stmt,rc); + + my_process_stmt_result(stmt); +} /******************************************************** * to test simple select * *********************************************************/ -void test_select() +static void test_select() { MYSQL_STMT *stmt; - int rc,param_count=0; - char *szData=(char *)"updated-value"; + int rc; + char szData[25]; int nData=1; MYSQL_BIND bind[2]; - MYSQL_RES *result; - myheader("test_select"); @@ -1105,15 +1428,13 @@ void test_select() strcpy(query,"SELECT * FROM test_select WHERE id=? AND name=?"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in select:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); /* string data */ nData=10; - szData=(char *)"venu"; + strcpy(szData,(char *)"venu"); bind[1].buffer_type=FIELD_TYPE_STRING; bind[1].buffer=szData; bind[1].buffer_length=4; @@ -1126,28 +1447,50 @@ void test_select() rc = mysql_execute(stmt); mystmt(stmt, rc); + myassert( 1 == my_process_stmt_result(stmt)); + + mysql_stmt_close(stmt); +} + +/******************************************************** +* to test simple select show * +*********************************************************/ +static void test_select_show() +{ + MYSQL_STMT *stmt; + int rc; + MYSQL_RES *result; + + myheader("test_select_show"); + + mysql_autocommit(mysql,true); + + strcpy(query,"SELECT * FROM mysql.host"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + verify_param_count(stmt,0); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + /* get the result */ result = mysql_store_result(mysql); mytest(result); - assert( 1 == my_process_result_set(result)); + my_process_result_set(result); mysql_free_result(result); mysql_stmt_close(stmt); - - /* bit complicated SELECT */ } - - - /******************************************************** * to test simple update * *********************************************************/ -void test_simple_update() +static void test_simple_update() { MYSQL_STMT *stmt; - int rc,param_count; + int rc; char szData[25]; int nData=1; MYSQL_RES *result; @@ -1175,7 +1518,7 @@ void test_simple_update() rc = mysql_query(mysql,"INSERT INTO test_update VALUES(1,'MySQL',100)"); myquery(rc); - assert(1 == mysql_affected_rows(mysql)); + myassert(1 == mysql_affected_rows(mysql)); rc = mysql_commit(mysql); myquery(rc); @@ -1183,11 +1526,9 @@ void test_simple_update() /* insert by prepare */ strcpy(query,"UPDATE test_update SET col2=? WHERE col1=?"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in update:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); nData=1; bind[0].buffer_type=FIELD_TYPE_STRING; @@ -1201,7 +1542,7 @@ void test_simple_update() rc = mysql_execute(stmt); mystmt(stmt, rc); - assert(1 == mysql_affected_rows(mysql)); + myassert(1 == mysql_affected_rows(mysql)); mysql_stmt_close(stmt); @@ -1217,7 +1558,7 @@ void test_simple_update() result = mysql_store_result(mysql); mytest(result); - assert(1 == my_process_result_set(result)); + myassert(1 == my_process_result_set(result)); mysql_free_result(result); } @@ -1225,10 +1566,10 @@ void test_simple_update() /******************************************************** * to test simple long data handling * *********************************************************/ -void test_long_data() +static void test_long_data() { MYSQL_STMT *stmt; - int rc,param_count, int_data=10; + int rc, int_data; char *data=NullS; MYSQL_RES *result; MYSQL_BIND bind[3]; @@ -1255,15 +1596,13 @@ void test_long_data() strcpy(query,"INSERT INTO test_long_data(col1,col2) VALUES(?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery_r(stmt); + mystmt_init_r(stmt); strcpy(query,"INSERT INTO test_long_data(col1,col2,col3) VALUES(?,?,?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 3); + verify_param_count(stmt,3); bind[0].buffer=(char *)&int_data; bind[0].buffer_type=FIELD_TYPE_LONG; @@ -1272,7 +1611,7 @@ void test_long_data() /* Non string or binary type, error */ bind[1].buffer_type=FIELD_TYPE_LONG; rc = mysql_bind_param(stmt,bind); - fprintf(stdout,"mysql_bind_param() returned %d\n",rc); + fprintf(stdout," mysql_bind_param() returned: %d\n",rc); mystmt_r(stmt, rc); bind[1].buffer_type=FIELD_TYPE_STRING; @@ -1280,36 +1619,37 @@ void test_long_data() rc = mysql_bind_param(stmt,bind); mystmt(stmt, rc); + int_data= 999; rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); - assert(rc == MYSQL_NEED_DATA); + fprintf(stdout," mysql_execute() returned %d\n",rc); + myassert(rc == MYSQL_NEED_DATA); data = (char *)"Micheal"; /* supply data in pieces */ - rc = mysql_send_long_data(stmt,1,data,7,1); + rc = mysql_send_long_data(stmt,1,data,7,0); mystmt(stmt, rc); /* try to execute mysql_execute() now, it should return MYSQL_NEED_DATA as the long data supply is not yet over */ rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); - assert(rc == MYSQL_NEED_DATA); + fprintf(stdout," mysql_execute() returned %d\n",rc); + myassert(rc == MYSQL_NEED_DATA); /* append data again ..*/ /* Indicate end of data */ - data = (char *)" 'monty' widenius"; + data = (char *)" 'monty' Widenius"; rc = mysql_send_long_data(stmt,1,data,17,1); mystmt(stmt, rc); - rc = mysql_send_long_data(stmt,2,"Venu (venu@mysql.com",4,1); + rc = mysql_send_long_data(stmt,2,"Venu (venu@mysql.com)",4,1); mystmt(stmt, rc); /* execute */ rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); + fprintf(stdout," mysql_execute() returned %d\n",rc); mystmt(stmt,rc); rc = mysql_commit(mysql); @@ -1323,17 +1663,21 @@ void test_long_data() result = mysql_store_result(mysql); mytest(result); - assert(1 == my_process_result_set(result)); + myassert(1 == my_process_result_set(result)); mysql_free_result(result); + + verify_col_data("test_long_data","col1","999"); + verify_col_data("test_long_data","col2","Micheal 'monty' Widenius"); + verify_col_data("test_long_data","col3","Venu"); } /******************************************************** * to test long data (string) handling * *********************************************************/ -void test_long_data_str() +static void test_long_data_str() { MYSQL_STMT *stmt; - int rc,param_count; + int rc, i; char data[255]; long length; MYSQL_RES *result; @@ -1360,11 +1704,9 @@ void test_long_data_str() strcpy(query,"INSERT INTO test_long_data_str VALUES(?,?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); bind[0].buffer = (gptr)&length; bind[0].buffer_type = FIELD_TYPE_LONG; @@ -1377,28 +1719,24 @@ void test_long_data_str() length = 10; rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); - assert(rc == MYSQL_NEED_DATA); + fprintf(stdout," mysql_execute() returned %d\n",rc); + myassert(rc == MYSQL_NEED_DATA); length = 40; sprintf(data,"MySQL AB"); /* supply data in pieces */ + for(i=0; i < 4; i++) { - int i; - for(i=0; i < 4; i++) - { - rc = mysql_send_long_data(stmt,1,(char *)data,5,0); - mystmt(stmt, rc); - } - - /* try to execute mysql_execute() now, it should return - MYSQL_NEED_DATA as the long data supply is not yet over - */ - rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); - assert(rc == MYSQL_NEED_DATA); + rc = mysql_send_long_data(stmt,1,(char *)data,5,0); + mystmt(stmt, rc); } + /* try to execute mysql_execute() now, it should return + MYSQL_NEED_DATA as the long data supply is not yet over + */ + rc = mysql_execute(stmt); + fprintf(stdout," mysql_execute() returned %d\n",rc); + myassert(rc == MYSQL_NEED_DATA); /* Indiate end of data supply */ rc = mysql_send_long_data(stmt,1,0,0,1); @@ -1406,7 +1744,7 @@ void test_long_data_str() /* execute */ rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); + fprintf(stdout," mysql_execute() returned %d\n",rc); mystmt(stmt,rc); mysql_stmt_close(stmt); @@ -1422,20 +1760,27 @@ void test_long_data_str() result = mysql_store_result(mysql); mytest(result); - assert(1 == my_process_result_set(result)); + myassert(1 == my_process_result_set(result)); mysql_free_result(result); + + sprintf(data,"%d", i*5); + verify_col_data("test_long_data_str","LENGTH(longstr)", data); + data[0]='\0'; + while (i--) + sprintf(data,"%s%s", data,"MySQL"); + verify_col_data("test_long_data_str","longstr", data); } /******************************************************** * to test long data (string) handling * *********************************************************/ -void test_long_data_str1() +static void test_long_data_str1() { MYSQL_STMT *stmt; - int rc,param_count; - char *data=(char *)"MySQL AB"; - int length; + int rc; + char data[255]; + int length, i; MYSQL_RES *result; MYSQL_BIND bind[2]; @@ -1460,11 +1805,9 @@ void test_long_data_str1() strcpy(query,"INSERT INTO test_long_data_str VALUES(?,?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); bind[0].buffer=data; /* string data */ bind[0].is_long_data=1; /* specify long data suppy during run-time */ @@ -1478,44 +1821,41 @@ void test_long_data_str1() length = 10; rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); - assert(rc == MYSQL_NEED_DATA); + fprintf(stdout," mysql_execute() returned %d\n",rc); + myassert(rc == MYSQL_NEED_DATA); - length = strlen(data); + length = sprintf(data,"MySQL AB"); /* supply data in pieces */ + for(i=0; i < 3; i++) { - int i; - for(i=0; i < 2; i++) - { - rc = mysql_send_long_data(stmt,0,data,length,0); - mystmt(stmt, rc); + rc = mysql_send_long_data(stmt,0,data,length,0); + mystmt(stmt, rc); - rc = mysql_send_long_data(stmt,1,data,2,0); - mystmt(stmt, rc); - } - /* try to execute mysql_execute() now, it should return - MYSQL_NEED_DATA as the long data supply is not yet over - */ - rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); - assert(rc == MYSQL_NEED_DATA); + rc = mysql_send_long_data(stmt,1,data,2,0); + mystmt(stmt, rc); } - + /* try to execute mysql_execute() now, it should return + MYSQL_NEED_DATA as the long data supply is not yet over + */ + rc = mysql_execute(stmt); + fprintf(stdout," mysql_execute() returned %d\n",rc); + myassert(rc == MYSQL_NEED_DATA); + /* Indiate end of data supply */ rc = mysql_send_long_data(stmt,1,0,0,1); mystmt(stmt, rc); rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); - assert(rc == MYSQL_NEED_DATA); + fprintf(stdout," mysql_execute() returned %d\n",rc); + myassert(rc == MYSQL_NEED_DATA); rc = mysql_send_long_data(stmt,0,0,0,1); mystmt(stmt, rc); /* execute */ rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); + fprintf(stdout," mysql_execute() returned %d\n",rc); mystmt(stmt,rc); mysql_stmt_close(stmt); @@ -1531,18 +1871,24 @@ void test_long_data_str1() result = mysql_store_result(mysql); mytest(result); - assert(1 == my_process_result_set(result)); + myassert(1 == my_process_result_set(result)); mysql_free_result(result); + + sprintf(data,"%d",i*length); + verify_col_data("test_long_data_str","length(longstr)",data); + + sprintf(data,"%d",i*2); + verify_col_data("test_long_data_str","length(blb)",data); } /******************************************************** * to test long data (binary) handling * *********************************************************/ -void test_long_data_bin() +static void test_long_data_bin() { MYSQL_STMT *stmt; - int rc,param_count; + int rc; char data[255]; int length; MYSQL_RES *result; @@ -1569,11 +1915,9 @@ void test_long_data_bin() strcpy(query,"INSERT INTO test_long_data_bin VALUES(?,?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); bind[0].buffer = (gptr)&length; bind[0].buffer_type = FIELD_TYPE_LONG; @@ -1586,8 +1930,8 @@ void test_long_data_bin() length = 10; rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); - assert(rc == MYSQL_NEED_DATA); + fprintf(stdout," mysql_execute() returned %d\n",rc); + myassert(rc == MYSQL_NEED_DATA); sprintf(data,"MySQL AB"); @@ -1604,8 +1948,8 @@ void test_long_data_bin() MYSQL_NEED_DATA as the long data supply is not yet over */ rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); - assert(rc == MYSQL_NEED_DATA); + fprintf(stdout," mysql_execute() returned %d\n",rc); + myassert(rc == MYSQL_NEED_DATA); } /* Indiate end of data supply */ @@ -1614,7 +1958,7 @@ void test_long_data_bin() /* execute */ rc = mysql_execute(stmt); - fprintf(stdout,"mysql_execute() returned %d\n",rc); + fprintf(stdout," mysql_execute() returned %d\n",rc); mystmt(stmt,rc); mysql_stmt_close(stmt); @@ -1630,7 +1974,7 @@ void test_long_data_bin() result = mysql_store_result(mysql); mytest(result); - assert(1 == my_process_result_set(result)); + myassert(1 == my_process_result_set(result)); mysql_free_result(result); } @@ -1638,10 +1982,10 @@ void test_long_data_bin() /******************************************************** * to test simple delete * *********************************************************/ -void test_simple_delete() +static void test_simple_delete() { MYSQL_STMT *stmt; - int rc,param_count; + int rc; char szData[30]={0}; int nData=1; MYSQL_RES *result; @@ -1670,7 +2014,7 @@ void test_simple_delete() rc = mysql_query(mysql,"INSERT INTO test_simple_delete VALUES(1,'MySQL',100)"); myquery(rc); - assert(1 == mysql_affected_rows(mysql)); + myassert(1 == mysql_affected_rows(mysql)); rc = mysql_commit(mysql); myquery(rc); @@ -1678,11 +2022,9 @@ void test_simple_delete() /* insert by prepare */ strcpy(query,"DELETE FROM test_simple_delete WHERE col1=? AND col2=? AND col3=100"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in delete:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); nData=1; strcpy(szData,"MySQL"); @@ -1697,7 +2039,7 @@ void test_simple_delete() rc = mysql_execute(stmt); mystmt(stmt, rc); - assert(1 == mysql_affected_rows(mysql)); + myassert(1 == mysql_affected_rows(mysql)); mysql_stmt_close(stmt); @@ -1713,7 +2055,7 @@ void test_simple_delete() result = mysql_store_result(mysql); mytest(result); - assert(0 == my_process_result_set(result)); + myassert(0 == my_process_result_set(result)); mysql_free_result(result); } @@ -1722,10 +2064,10 @@ void test_simple_delete() /******************************************************** * to test simple update * *********************************************************/ -void test_update() +static void test_update() { MYSQL_STMT *stmt; - int rc,param_count; + int rc; char szData[25]; int nData=1; MYSQL_RES *result; @@ -1753,11 +2095,9 @@ void test_update() strcpy(query,"INSERT INTO test_update(col2,col3) VALUES(?,?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); /* string data */ bind[0].buffer_type=FIELD_TYPE_STRING; @@ -1773,16 +2113,14 @@ void test_update() rc = mysql_execute(stmt); mystmt(stmt, rc); - assert(1 == mysql_affected_rows(mysql)); + myassert(1 == mysql_affected_rows(mysql)); mysql_stmt_close(stmt); strcpy(query,"UPDATE test_update SET col2=? WHERE col3=?"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in update:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); nData=100; @@ -1797,7 +2135,7 @@ void test_update() rc = mysql_execute(stmt); mystmt(stmt, rc); - assert(1 == mysql_affected_rows(mysql)); + myassert(1 == mysql_affected_rows(mysql)); mysql_stmt_close(stmt); @@ -1813,7 +2151,7 @@ void test_update() result = mysql_store_result(mysql); mytest(result); - assert(1 == my_process_result_set(result)); + myassert(1 == my_process_result_set(result)); mysql_free_result(result); } @@ -1821,13 +2159,13 @@ void test_update() /******************************************************** * to test simple prepare * *********************************************************/ -void test_init_prepare() +static void test_prepare_noparam() { MYSQL_STMT *stmt; - int param_count, rc; + int rc; MYSQL_RES *result; - myheader("test_init_prepare"); + myheader("test_prepare_noparam"); rc = mysql_query(mysql,"DROP TABLE IF EXISTS my_prepare"); myquery(rc); @@ -1842,11 +2180,9 @@ void test_init_prepare() /* insert by prepare */ strcpy(query,"INSERT INTO my_prepare VALUES(10,'venu')"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 0); + verify_param_count(stmt,0); rc = mysql_execute(stmt); mystmt(stmt, rc); @@ -1865,7 +2201,7 @@ void test_init_prepare() result = mysql_store_result(mysql); mytest(result); - assert(1 == my_process_result_set(result)); + myassert(1 == my_process_result_set(result)); mysql_free_result(result); } @@ -1873,12 +2209,12 @@ void test_init_prepare() /******************************************************** * to test simple bind result * *********************************************************/ -void test_bind_result() +static void test_bind_result() { MYSQL_STMT *stmt; int rc; const char query[100]; - int nData; + int nData, length, length1; char szData[100]; MYSQL_BIND bind[2]; @@ -1903,6 +2239,9 @@ void test_bind_result() rc = mysql_query(mysql,"INSERT INTO test_bind_result VALUES(20,'MySQL')"); myquery(rc); + rc = mysql_query(mysql,"INSERT INTO test_bind_result(col2) VALUES('monty')"); + myquery(rc); + rc = mysql_commit(mysql); myquery(rc); @@ -1910,13 +2249,15 @@ void test_bind_result() bind[0].buffer_type=FIELD_TYPE_LONG; bind[0].buffer= (gptr) &nData; /* integer data */ + bind[0].length= (long *)&length; bind[1].buffer_type=FIELD_TYPE_STRING; bind[1].buffer=szData; /* string data */ bind[1].buffer_length=sizeof(szData); + bind[1].length=(long *)&length1; strcpy((char *)query , "SELECT * FROM test_bind_result"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); rc = mysql_bind_result(stmt,bind); mystmt(stmt, rc); @@ -1927,30 +2268,397 @@ void test_bind_result() rc = mysql_fetch(stmt); mystmt(stmt,rc); - printf("\n row 1:%d,%s",nData, szData); - assert(nData == 10); - assert(strcmp(szData,"venu")==0); + fprintf(stdout,"\n row 1: %d,%s(%d)",nData, szData, length1); + myassert(nData == 10); + myassert(strcmp(szData,"venu")==0); + myassert(length1 == 4); rc = mysql_fetch(stmt); mystmt(stmt,rc); - printf("\n row 2:%d,%s",nData, szData); - assert(nData == 20); - assert(strcmp(szData,"MySQL")==0); + fprintf(stdout,"\n row 2: %d,%s(%d)",nData, szData, length1); + myassert(nData == 20); + myassert(strcmp(szData,"MySQL")==0); + myassert(length1 == 5); + + length=99; + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + if (length == MYSQL_NULL_DATA) + fprintf(stdout,"\n row 3: NULL,%s(%d)", szData, length1); + else + fprintf(stdout,"\n row 3: %d,%s(%d)", nData, szData, length1); + myassert(length == MYSQL_NULL_DATA); + myassert(strcmp(szData,"monty")==0); + myassert(length1 == 5); rc = mysql_fetch(stmt); - assert(rc == MYSQL_NO_DATA); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} + + +/******************************************************** +* to test ext bind result * +*********************************************************/ +static void test_bind_result_ext() +{ + MYSQL_STMT *stmt; + int rc; + const char query[100]; + uchar t_data; + short s_data; + int i_data; + longlong b_data; + float f_data; + double d_data; + char szData[20], bData[20]; + int szLength, bLength; + MYSQL_BIND bind[8]; + + myheader("test_bind_result_ext"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_result"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, \ + c3 int, c4 bigint, \ + c5 float, c6 double, \ + c7 varbinary(10), \ + c8 varchar(50))"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"INSERT INTO test_bind_result VALUES(19,2999,3999,4999999,\ + 2345.6,5678.89563,\ + 'venu','mysql')"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + bind[0].buffer_type=MYSQL_TYPE_TINY; + bind[0].buffer=(gptr)&t_data; + + bind[1].buffer_type=MYSQL_TYPE_SHORT; + bind[2].buffer_type=MYSQL_TYPE_LONG; + + bind[3].buffer_type=MYSQL_TYPE_LONGLONG; + bind[1].buffer=(gptr)&s_data; + + bind[2].buffer=(gptr)&i_data; + bind[3].buffer=(gptr)&b_data; + + bind[4].buffer_type=MYSQL_TYPE_FLOAT; + bind[4].buffer=(gptr)&f_data; + + bind[5].buffer_type=MYSQL_TYPE_DOUBLE; + bind[5].buffer=(gptr)&d_data; + + bind[6].buffer_type=MYSQL_TYPE_STRING; + bind[6].buffer=(gptr)&szData; + bind[6].length=(long *)&szLength; + + bind[7].buffer_type=MYSQL_TYPE_TINY_BLOB; + bind[7].buffer=(gptr)&bData; + bind[7].length=(long *)&bLength; + + strcpy((char *)query , "SELECT * FROM test_bind_result"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + rc = mysql_bind_result(stmt,bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + fprintf(stdout, "\n data (tiny) : %d", t_data); + fprintf(stdout, "\n data (short) : %d", s_data); + fprintf(stdout, "\n data (int) : %d", i_data); + fprintf(stdout, "\n data (big) : %lld", b_data); + + fprintf(stdout, "\n data (float) : %f", f_data); + fprintf(stdout, "\n data (double) : %f", d_data); + + fprintf(stdout, "\n data (str) : %s(%d)", szData, szLength); + fprintf(stdout, "\n data (bin) : %s(%d)", bData, bLength); + + + myassert(t_data == 19); + myassert(s_data == 2999); + myassert(i_data == 3999); + myassert(b_data == 4999999); + /*myassert(f_data == 2345.60);*/ + /*myassert(d_data == 5678.89563);*/ + myassert(strcmp(szData,"venu")==0); + myassert(strcmp(bData,"mysql")==0); + myassert(szLength == 4); + myassert(bLength == 5); + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} + + +/******************************************************** +* to test ext bind result * +*********************************************************/ +static void test_bind_result_ext1() +{ + MYSQL_STMT *stmt; + int rc; + const char query[100]; + char t_data[20]; + float s_data; + short i_data; + short b_data; + int f_data; + long bData; + long length[11]; + char d_data[20]; + double szData; + MYSQL_BIND bind[8]; + + myheader("test_bind_result_ext1"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_result"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, \ + c3 int, c4 bigint, \ + c5 float, c6 double, \ + c7 varbinary(10), \ + c8 varchar(10))"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"INSERT INTO test_bind_result VALUES(120,2999,3999,54,\ + 2.6,58.89,\ + '206','6.7')"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + bind[0].buffer_type=MYSQL_TYPE_STRING; + bind[0].buffer=(gptr)t_data; + + for (rc=0; rc <= 7; rc++) + bind[rc].length= &length[rc]; + + bind[1].buffer_type=MYSQL_TYPE_FLOAT; + bind[1].buffer=(gptr)&s_data; + + bind[2].buffer_type=MYSQL_TYPE_SHORT; + bind[2].buffer=(gptr)&i_data; + + bind[3].buffer_type=MYSQL_TYPE_TINY; + bind[3].buffer=(gptr)&b_data; + + bind[4].buffer_type=MYSQL_TYPE_LONG; + bind[4].buffer=(gptr)&f_data; + + bind[5].buffer_type=MYSQL_TYPE_STRING; + bind[5].buffer=(gptr)d_data; + + bind[6].buffer_type=MYSQL_TYPE_LONG; + bind[6].buffer=(gptr)&bData; + + bind[7].buffer_type=MYSQL_TYPE_DOUBLE; + bind[7].buffer=(gptr)&szData; + + strcpy((char *)query , "SELECT * FROM test_bind_result"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + rc = mysql_bind_result(stmt,bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + fprintf(stdout, "\n data (tiny) : %s(%ld)", t_data, length[0]); + fprintf(stdout, "\n data (short) : %f(%ld)", s_data, length[1]); + fprintf(stdout, "\n data (int) : %d(%ld)", i_data, length[2]); + fprintf(stdout, "\n data (big) : %d(%ld)", b_data, length[3]); + + fprintf(stdout, "\n data (float) : %d(%ld)", f_data, length[4]); + fprintf(stdout, "\n data (double) : %s(%ld)", d_data, length[5]); + + fprintf(stdout, "\n data (bin) : %ld(%ld)", bData, length[6]); + fprintf(stdout, "\n data (str) : %g(%ld)", szData, length[7]); + + myassert(strcmp(t_data,"120")==0); + myassert(i_data == 3999); + myassert(f_data == 2); + myassert(strcmp(d_data,"58.89")==0); + + myassert(length[0] == 3); + myassert(length[1] == 4); + myassert(length[2] == 2); + myassert(length[3] == 1); + myassert(length[4] == 4); + myassert(length[5] == 5); + myassert(length[6] == 4); + myassert(length[7] == 8); + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); } /******************************************************** -* to test simple prepare with all possible types * +* to test fetching of date, time and ts * *********************************************************/ -void test_prepare_ext() +static void test_fetch_date() { MYSQL_STMT *stmt; - int rc,param_count; + int rc, year; + char date[25], time[25], ts[25], ts_4[15], ts_6[20], dt[20]; + int d_length, t_length, ts_length, ts4_length, ts6_length, + dt_length, y_length; + + MYSQL_BIND bind[3]; + + myheader("test_fetch_date"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_result"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_bind_result(c1 date, c2 time, \ + c3 timestamp(14), \ + c4 year, \ + c5 datetime, \ + c6 timestamp(4), \ + c7 timestamp(6))"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"INSERT INTO test_bind_result VALUES('2002-01-02',\ + '12:49:00',\ + '2002-01-02 17:46:59', \ + 2010,\ + '2010-07-10', \ + '2020','1999-12-29')"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + bind[0].buffer_type=MYSQL_TYPE_STRING; + bind[1]=bind[2]=bind[0]; + + bind[0].buffer=(gptr)&date; + bind[0].length=(long *)&d_length; + + bind[1].buffer=(gptr)&time; + bind[1].length=(long *)&t_length; + + bind[2].buffer=(gptr)&ts; + bind[2].length=(long *)&ts_length; + + bind[3].buffer_type=MYSQL_TYPE_LONG; + bind[3].buffer=(gptr)&year; + bind[3].length=(long *)&y_length; + + bind[4].buffer_type=MYSQL_TYPE_STRING; + bind[4].buffer=(gptr)&dt; + bind[4].length=(long *)&dt_length; + + bind[5].buffer_type=MYSQL_TYPE_STRING; + bind[5].buffer=(gptr)&ts_4; + bind[5].length=(long *)&ts4_length; + + bind[6].buffer_type=MYSQL_TYPE_STRING; + bind[6].buffer=(gptr)&ts_6; + bind[6].length=(long *)&ts6_length; + + stmt = mysql_prepare(mysql, "SELECT * FROM test_bind_result", 50); + mystmt_init(stmt); + + rc = mysql_bind_result(stmt,bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + ts_4[0]='\0'; + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + fprintf(stdout, "\n date : %s(%d)", date, d_length); + fprintf(stdout, "\n time : %s(%d)", time, t_length); + fprintf(stdout, "\n ts : %s(%d)", ts, ts_length); + fprintf(stdout, "\n year : %d(%d)", year, y_length); + fprintf(stdout, "\n dt : %s(%d)", dt, dt_length); + fprintf(stdout, "\n ts(4) : %s(%d)", ts_4, ts4_length); + fprintf(stdout, "\n ts(6) : %s(%d)", ts_6, ts6_length); + + myassert(strcmp(date,"2002-01-02")==0); + myassert(d_length == 10); + + myassert(strcmp(time,"12:49:00")==0); + myassert(d_length == 8); + + myassert(strcmp(ts,"2002-01-02 17:46:59")==0); + myassert(ts_length == 19); + + myassert(year == 2010); + myassert(y_length == 4); + + myassert(strcmp(dt,"2010-07-10")==0); + myassert(dt_length == 10); + + myassert(ts_4[0] == '\0'); + myassert(ts4_length == 0); + + myassert(strcmp(ts_6,"1999-12-29")==0); + myassert(ts6_length == 10); + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} + + +/******************************************************** +* to test simple prepare with all possible types * +*********************************************************/ +static void test_prepare_ext() +{ + MYSQL_STMT *stmt; + int rc; char *sql; int nData=1; MYSQL_RES *result; @@ -2012,9 +2720,7 @@ void test_prepare_ext() stmt = mysql_prepare(mysql,query, strlen(query)); myquery(rc); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 6); + verify_param_count(stmt,6); /*tinyint*/ bind_int[0].buffer_type=FIELD_TYPE_TINY; @@ -2065,7 +2771,7 @@ void test_prepare_ext() result = mysql_store_result(mysql); mytest(result); - assert(nData == my_process_result_set(result)); + myassert(nData == my_process_result_set(result)); mysql_free_result(result); } @@ -2075,14 +2781,14 @@ void test_prepare_ext() /******************************************************** * to test real and alias names * *********************************************************/ -void test_field_names() +static void test_field_names() { int rc; MYSQL_RES *result; myheader("test_field_names"); - printf("\n%d,%d,%d",MYSQL_TYPE_DECIMAL,MYSQL_TYPE_NEWDATE,MYSQL_TYPE_ENUM); + fprintf(stdout,"\n %d,%d,%d",MYSQL_TYPE_DECIMAL,MYSQL_TYPE_NEWDATE,MYSQL_TYPE_ENUM); rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_field_names1"); myquery(rc); @@ -2108,7 +2814,7 @@ void test_field_names() result = mysql_use_result(mysql); mytest(result); - assert(0 == my_process_result_set(result)); + myassert(0 == my_process_result_set(result)); mysql_free_result(result); /* with table name included with true column name */ @@ -2118,23 +2824,20 @@ void test_field_names() result = mysql_use_result(mysql); mytest(result); - assert(0 == my_process_result_set(result)); + myassert(0 == my_process_result_set(result)); mysql_free_result(result); } /******************************************************** * to test warnings * *********************************************************/ -void test_warnings() +static void test_warnings() { int rc; MYSQL_RES *result; myheader("test_warnings"); - rc = mysql_query(mysql,"USE test"); - myquery(rc); - rc = mysql_query(mysql,"SHOW WARNINGS"); myquery(rc); @@ -2148,7 +2851,7 @@ void test_warnings() /******************************************************** * to test errors * *********************************************************/ -void test_errors() +static void test_errors() { int rc; MYSQL_RES *result; @@ -2170,10 +2873,10 @@ void test_errors() /******************************************************** * to test simple prepare-insert * *********************************************************/ -void test_insert() +static void test_insert() { MYSQL_STMT *stmt; - int rc,param_count, length; + int rc, length; char query[200]; char str_data[50]; char tiny_data; @@ -2199,11 +2902,9 @@ void test_insert() bzero(bind, sizeof(bind)); strcpy(query,"INSERT INTO test_prep_insert VALUES(?,?)"); stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,2); /* tinyint */ bind[0].buffer_type=FIELD_TYPE_TINY; @@ -2238,7 +2939,7 @@ void test_insert() result = mysql_store_result(mysql); mytest(result); - assert((int)tiny_data == my_process_result_set(result)); + myassert((int)tiny_data == my_process_result_set(result)); mysql_free_result(result); } @@ -2246,10 +2947,10 @@ void test_insert() /******************************************************** * to test simple prepare-resultset info * *********************************************************/ -void test_prepare_resultset() +static void test_prepare_resultset() { MYSQL_STMT *stmt; - int rc,param_count; + int rc; char query[200]; MYSQL_RES *result; @@ -2268,38 +2969,15 @@ void test_prepare_resultset() name varchar(50),extra double)"); myquery(rc); - /* insert by prepare */ - strcpy(query,"INSERT INTO test_prepare_resultset(id,name) VALUES(?,?)"); - stmt = mysql_prepare(mysql, query, strlen(query)); - myxquery(stmt); + strcpy(query,"SELECT * FROM test_prepare_resultset"); + stmt = PREPARE(mysql, query); + mystmt_init(stmt); - param_count = mysql_param_count(stmt); - fprintf(stdout," total parameters in insert:%d\n", param_count); - assert(param_count == 2); + verify_param_count(stmt,0); - rc = mysql_query(mysql,"SELECT * FROM test_prepare_resultset"); - myquery(rc); - - /* get the prepared-result */ result = mysql_prepare_result(stmt); - assert( result != 0); - - my_print_result_metadata(result); - mysql_free_result(result); - - result = mysql_store_result(mysql); mytest(result); - - assert(0 == my_process_result_set(result)); - mysql_free_result(result); - - /* get the prepared-result */ - result = mysql_prepare_result(stmt); - assert( result != 0); - my_print_result_metadata(result); - mysql_free_result(result); - mysql_stmt_close(stmt); } @@ -2307,7 +2985,7 @@ void test_prepare_resultset() * to test field flags (verify .NET provider) * *********************************************************/ -void test_field_flags() +static void test_field_flags() { int rc; MYSQL_RES *result; @@ -2348,22 +3026,459 @@ void test_field_flags() for(i=0; i< mysql_num_fields(result); i++) { field = mysql_fetch_field(result); - printf("\nfield:%d",i); + fprintf(stdout,"\n field:%d",i); if(field->flags & NOT_NULL_FLAG) - printf("\n NOT_NULL_FLAG"); + fprintf(stdout,"\n NOT_NULL_FLAG"); if(field->flags & PRI_KEY_FLAG) - printf("\n PRI_KEY_FLAG"); + fprintf(stdout,"\n PRI_KEY_FLAG"); if(field->flags & UNIQUE_KEY_FLAG) - printf("\n UNIQUE_KEY_FLAG"); + fprintf(stdout,"\n UNIQUE_KEY_FLAG"); if(field->flags & MULTIPLE_KEY_FLAG) - printf("\n MULTIPLE_KEY_FLAG"); + fprintf(stdout,"\n MULTIPLE_KEY_FLAG"); if(field->flags & AUTO_INCREMENT_FLAG) - printf("\n AUTO_INCREMENT_FLAG"); + fprintf(stdout,"\n AUTO_INCREMENT_FLAG"); } mysql_free_result(result); } +/************************************************************** + * Test mysql_stmt_close for open stmts * +**************************************************************/ +static void test_stmt_close() +{ + MYSQL *lmysql; + MYSQL_STMT *stmt1, *stmt2, *stmt3, *stmt_x; + MYSQL_BIND param[1]; + MYSQL_RES *result; + char query[100]; + unsigned int count; + int rc; + + myheader("test_stmt_close"); + + init_bind(param); + if(!(lmysql = mysql_init(NULL))) + { + myerror("mysql_init() failed"); + exit(0); + } + if (!(mysql_real_connect(lmysql,opt_host,opt_user, + opt_password, opt_db ? opt_db:"inter_client_test_db", opt_port, + opt_unix_socket, 0))) + { + myerror("connection failed"); + exit(0); + } + if (opt_db) + strcpy(current_db,opt_db); + + /* set AUTOCOMMIT to ON*/ + mysql_autocommit(lmysql, true); + mysql_query(lmysql,"DROP TABLE IF EXISTS test_stmt_close"); + mysql_query(lmysql,"CREATE TABLE test_stmt_close(id int)"); + + strcpy(query,"ALTER TABLE test_stmt_close ADD name varchar(20)"); + stmt1= PREPARE(lmysql, query); + mystmt_init(stmt1); + count= mysql_param_count(stmt1); + fprintf(stdout,"\n total params in alter: %d", count); + myassert(count == 0); + strcpy(query,"INSERT INTO test_stmt_close(id) VALUES(?)"); + stmt_x= PREPARE(mysql, query); + mystmt_init(stmt_x); + count= mysql_param_count(stmt_x); + fprintf(stdout,"\n total params in insert: %d", count); + myassert(count == 1); + strcpy(query,"UPDATE test_stmt_close SET id=? WHERE id=?"); + stmt3= PREPARE(lmysql, query); + mystmt_init(stmt3); + count= mysql_param_count(stmt3); + fprintf(stdout,"\n total params in update: %d", count); + myassert(count == 2); + strcpy(query,"SELECT * FROM test_stmt_close WHERE id=?"); + stmt2= PREPARE(lmysql, query); + mystmt_init(stmt2); + count= mysql_param_count(stmt2); + fprintf(stdout,"\n total params in select: %d", count); + myassert(count == 1); + + rc= mysql_stmt_close(stmt1); + fprintf(stdout,"\n mysql_close_stmt(1) returned: %d", rc); + myassert(rc == 0); + mysql_close(lmysql); /* it should free all stmts */ +#if NOT_VALID + rc= mysql_stmt_close(stmt3); + fprintf(stdout,"\n mysql_close_stmt(3) returned: %d", rc); + myassert( rc == 1); + rc= mysql_stmt_close(stmt2); + fprintf(stdout,"\n mysql_close_stmt(2) returned: %d", rc); + myassert( rc == 1); +#endif + + count= 100; + param[0].buffer=(gptr)&count; + param[0].buffer_type=MYSQL_TYPE_LONG; + rc = mysql_bind_param(stmt_x, param); + mystmt(stmt_x, rc); + rc = mysql_execute(stmt_x); + mystmt(stmt_x, rc); + + rc= (ulong)mysql_affected_rows(stmt_x->mysql); + fprintf(stdout,"\n total rows affected: %d", rc); + myassert (rc == 1); + + rc= mysql_stmt_close(stmt_x); + fprintf(stdout,"\n mysql_close_stmt(x) returned: %d", rc); + myassert( rc == 0); + + /*verify_col_data("test_stmt_close", "id", "100");*/ + rc = mysql_query(mysql,"SELECT id FROM test_stmt_close"); + myquery(rc); + + result = mysql_store_result(mysql); + mytest(result); + + myassert(1 == my_process_result_set(result)); + mysql_free_result(result); +} + +/******************************************************** + * To test simple set-variable prepare * +*********************************************************/ +static void test_set_variable() +{ + MYSQL_STMT *stmt; + int rc, select_limit=88; + char query[200]; + MYSQL_BIND bind[1]; + MYSQL_RES *result; + + + myheader("test_set_variable"); + + rc = mysql_autocommit(mysql, true); + myquery(rc); + + strcpy(query,"SET GLOBAL delayed_insert_limit=?"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + verify_param_count(stmt,1); + + result= mysql_param_result(stmt); + mytest_r(result); + + init_bind(bind); + + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer=(gptr)&select_limit; + + rc = mysql_bind_param(stmt, bind); + mystmt(stmt,rc); + + rc= mysql_execute(stmt); + mystmt(stmt,rc); + + mysql_store_result(mysql); + + strcpy(query,"show variables like 'delayed_insert_limit'"); + rc = mysql_query(mysql,query); + myquery(rc); + + verify_col_data(NullS, NullS, "88"); + +#if TO_BE_FIXED + + select_limit= 100;/* reset to default */ + rc= mysql_execute(stmt); + mystmt(stmt,rc); + + mysql_store_result(mysql); + mysql_stmt_close(stmt); + + rc = mysql_query(mysql,query); + myquery(rc); + + verify_col_data(NullS, NullS, "100"); +#endif + mysql_stmt_close(stmt); +} +#if NOT_USED +/* Insert meta info .. */ +static void test_insert_meta() +{ + MYSQL_STMT *stmt; + int rc; + char query[200]; + MYSQL_RES *result; + MYSQL_FIELD *field; + + myheader("test_insert_meta"); + + rc = mysql_autocommit(mysql, true); + myquery(rc); + + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_prep_insert"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_prep_insert(col1 tinyint,\ + col2 varchar(50), col3 varchar(30))"); + myquery(rc); + + strcpy(query,"INSERT INTO test_prep_insert VALUES(10,'venu1','test')"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + verify_param_count(stmt,0); + + result= mysql_param_result(stmt); + mytest_r(result); + + strcpy(query,"INSERT INTO test_prep_insert VALUES(?,'venu',?)"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + verify_param_count(stmt,2); + + result= mysql_param_result(stmt); + mytest(result); + + my_print_result_metadata(result); + + mysql_field_seek(result, 0); + field= mysql_fetch_field(result); + mytest(field); + fprintf(stdout, "\n obtained: `%s` (expected: `%s`)", field->name, "col1"); + myassert(strcmp(field->name,"col1")==0); + + field= mysql_fetch_field(result); + mytest(field); + fprintf(stdout, "\n obtained: `%s` (expected: `%s`)", field->name, "col3"); + myassert(strcmp(field->name,"col3")==0); + + field= mysql_fetch_field(result); + mytest_r(field); + + mysql_free_result(result); + mysql_stmt_close(stmt); +} + +/* Update meta info .. */ +static void test_update_meta() +{ + MYSQL_STMT *stmt; + int rc; + char query[200]; + MYSQL_RES *result; + MYSQL_FIELD *field; + + myheader("test_update_meta"); + + rc = mysql_autocommit(mysql, true); + myquery(rc); + + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_prep_update"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_prep_update(col1 tinyint,\ + col2 varchar(50), col3 varchar(30))"); + myquery(rc); + + strcpy(query,"UPDATE test_prep_update SET col1=10, col2='venu1' WHERE col3='test'"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + verify_param_count(stmt,0); + + result= mysql_param_result(stmt); + mytest_r(result); + + strcpy(query,"UPDATE test_prep_update SET col1=?, col2='venu' WHERE col3=?"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + verify_param_count(stmt,2); + + result= mysql_param_result(stmt); + mytest(result); + + my_print_result_metadata(result); + + mysql_field_seek(result, 0); + field= mysql_fetch_field(result); + mytest(field); + fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col1"); + fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_update"); + myassert(strcmp(field->name,"col1")==0); + myassert(strcmp(field->table,"test_prep_update")==0); + + field= mysql_fetch_field(result); + mytest(field); + fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col3"); + fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_update"); + myassert(strcmp(field->name,"col3")==0); + myassert(strcmp(field->table,"test_prep_update")==0); + + field= mysql_fetch_field(result); + mytest_r(field); + + mysql_free_result(result); + mysql_stmt_close(stmt); +} + +/* Select meta info .. */ +static void test_select_meta() +{ + MYSQL_STMT *stmt; + int rc; + char query[200]; + MYSQL_RES *result; + MYSQL_FIELD *field; + + myheader("test_select_meta"); + + rc = mysql_autocommit(mysql, true); + myquery(rc); + + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_prep_select"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_prep_select(col1 tinyint,\ + col2 varchar(50), col3 varchar(30))"); + myquery(rc); + + strcpy(query,"SELECT * FROM test_prep_select WHERE col1=10"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + verify_param_count(stmt,0); + + result= mysql_param_result(stmt); + mytest_r(result); + + strcpy(query,"SELECT col1, col3 from test_prep_select WHERE col1=? AND col3='test' AND col2= ?"); + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + + verify_param_count(stmt,2); + + result= mysql_param_result(stmt); + mytest(result); + + my_print_result_metadata(result); + + mysql_field_seek(result, 0); + field= mysql_fetch_field(result); + mytest(field); + fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col1"); + fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_select"); + myassert(strcmp(field->name,"col1")==0); + myassert(strcmp(field->table,"test_prep_select")==0); + + field= mysql_fetch_field(result); + mytest(field); + fprintf(stdout, "\n col obtained: `%s` (expected: `%s`)", field->name, "col2"); + fprintf(stdout, "\n tab obtained: `%s` (expected: `%s`)", field->table, "test_prep_select"); + myassert(strcmp(field->name,"col2")==0); + myassert(strcmp(field->table,"test_prep_select")==0); + + field= mysql_fetch_field(result); + mytest_r(field); + + mysql_free_result(result); + mysql_stmt_close(stmt); +} +#endif + +/* Test FUNCTION field info / DATE_FORMAT() table_name . */ +static void test_func_fields() +{ + int rc; + MYSQL_RES *result; + MYSQL_FIELD *field; + + myheader("test_func_fields"); + + rc = mysql_autocommit(mysql, true); + myquery(rc); + + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_dateformat"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_dateformat(id int, \ + ts timestamp)"); + myquery(rc); + + rc = mysql_query(mysql, "INSERT INTO test_dateformat(id) values(10)"); + myquery(rc); + + rc = mysql_query(mysql, "SELECT ts FROM test_dateformat"); + myquery(rc); + + result = mysql_store_result(mysql); + mytest(result); + + field = mysql_fetch_field(result); + mytest(field); + fprintf(stdout,"\n table name: `%s` (expected: `%s`)", field->table, + "test_dateformat"); + myassert(strcmp(field->table, "test_dateformat")==0); + + field = mysql_fetch_field(result); + mytest_r(field); /* no more fields */ + + mysql_free_result(result); + + /* DATE_FORMAT */ + rc = mysql_query(mysql, "SELECT DATE_FORMAT(ts,'%Y') AS 'venu' FROM test_dateformat"); + myquery(rc); + + result = mysql_store_result(mysql); + mytest(result); + + field = mysql_fetch_field(result); + mytest(field); + fprintf(stdout,"\n table name: `%s` (expected: `%s`)", field->table, ""); + myassert(field->table[0] == '\0'); + + field = mysql_fetch_field(result); + mytest_r(field); /* no more fields */ + + mysql_free_result(result); + + /* FIELD ALIAS TEST */ + rc = mysql_query(mysql, "SELECT DATE_FORMAT(ts,'%Y') AS 'YEAR' FROM test_dateformat"); + myquery(rc); + + result = mysql_store_result(mysql); + mytest(result); + + field = mysql_fetch_field(result); + mytest(field); + fprintf(stdout,"\n field name: `%s` (expected: `%s`)", field->name, "YEAR"); + fprintf(stdout,"\n field org name: `%s` (expected: `%s`)",field->org_name,""); + myassert(strcmp(field->name, "YEAR")==0); + myassert(field->org_name[0] == '\0'); + + field = mysql_fetch_field(result); + mytest_r(field); /* no more fields */ + + mysql_free_result(result); +} + static struct my_option myctest_long_options[] = { {"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, @@ -2398,24 +3513,24 @@ static void usage(void) puts("and you are welcome to modify and redistribute it under the GPL license\n"); puts(" Copyright (C) 1995-2002 MySQL AB "); puts("-----------------------------------------------------------------------\n"); - printf("usage: %s [OPTIONS]\n\n", my_progname); - printf("\ + fprintf(stdout,"usage: %s [OPTIONS]\n\n", my_progname); + fprintf(stdout,"\ -?, --help Display this help message and exit.\n\ -D --database=... Database name to be used for test.\n\ -h, --host=... Connect to host.\n\ -p, --password[=...] Password to use when connecting to server.\n"); #ifdef __WIN__ - printf("\ + fprintf(stdout,"\ -W, --pipe Use named pipes to connect to server.\n"); #endif - printf("\ + fprintf(stdout,"\ -P, --port=... Port number to use for connection.\n\ -S, --socket=... Socket file to use for connection.\n"); #ifndef DONT_ALLOW_USER_CHANGE - printf("\ + fprintf(stdout,"\ -u, --user=# User for login if not current user.\n"); #endif - printf("*********************************************************************\n"); + fprintf(stdout,"*********************************************************************\n"); } static my_bool @@ -2471,24 +3586,52 @@ int main(int argc, char **argv) MY_INIT(argv[0]); get_options(argc,argv); - client_connect(); /* connect to server */ - + client_connect(); /* connect to server */ + test_select_prepare(); + test_prepare(); + test_prepare_simple(); + test_bind_result(); /* result bind test */ + test_fetch_null(); /* to fetch null data */ + test_fetch_date(); + test_bind_result_ext(); /* result bind test - extension */ + test_bind_result_ext1(); /* result bind test - extension */ + test_select_direct(); /* direct select - protocol_simple debug */ + test_select_prepare(); /* prepare select - protocol_prep debug */ + test_select_direct(); /* direct select - protocol_simple debug */ + test_select(); + test_select_version(); + test_set_variable(); /* set variable prepare */ +#if NOT_USED + test_select_meta(); /* select param meta information */ + test_update_meta(); /* update param meta information */ + test_insert_meta(); /* insert param meta information */ +#endif + test_simple_update(); /* simple update test */ + test_func_fields(); + test_long_data(); + test_insert(); + test_set_variable(); + test_tran_innodb(); + test_select_version(); + test_select_simple(); + test_debug_example(); + test_select(); + test_select_show(); test_null(); /* test null data handling */ - test_simple_update(); - //test_select_simple(); - //test_prepare_resultset(); - //test_select(); /* simple prepare-select */ + test_simple_update(); + test_prepare_resultset(); + test_prepare_noparam();/* prepare without parameters */ + test_select(); /* simple prepare-select */ test_insert(); /* prepare with insert */ - //test_bind_result(); /* result bind test */ - //test_long_data(); /* long data handling in pieces */ + test_bind_result(); /* result bind test */ + test_long_data(); /* long data handling in pieces */ test_prepare_simple();/* simple prepare */ test_prepare(); /* prepare test */ - test_prepare_simple();/* simple prepare */ test_null(); /* test null data handling */ test_debug_example(); /* some debugging case */ test_update(); /* prepare-update test */ test_simple_update(); /* simple prepare with update */ - //test_long_data(); /* long data handling in pieces */ + test_long_data(); /* long data handling in pieces */ test_simple_delete(); /* prepare with delete */ test_field_names(); /* test for field names */ test_double_compare();/* float comparision */ @@ -2499,20 +3642,23 @@ int main(int argc, char **argv) test_tran_innodb(); /* transaction test on InnoDB table type */ test_prepare_ext(); /* test prepare with all types conversion -- TODO */ test_prepare_syntax();/* syntax check for prepares */ - //test_prepare_field_result(); /* prepare meta info */ + test_prepare_field_result(); /* prepare meta info */ + test_prepare_resultset(); test_field_names(); /* test for field names */ test_field_flags(); /* test to help .NET provider team */ - //test_long_data_str(); /* long data handling */ - //test_long_data_str1();/* yet another long data handling */ - //test_long_data_bin(); /* long binary insertion */ + test_long_data_str(); /* long data handling */ + test_long_data_str1();/* yet another long data handling */ + test_long_data_bin(); /* long binary insertion */ test_warnings(); /* show warnings test */ test_errors(); /* show errors test */ - //test_select_simple(); /* simple select prepare */ - //test_prepare_resultset();/* prepare meta info test */ - + test_select_simple(); /* simple select prepare */ + test_prepare_resultset();/* prepare meta info test */ + test_func_fields(); /* FUNCTION field info */ + /*test_stmt_close(); */ /* mysql_stmt_close() test -- hangs */ + test_prepare_field_result(); /* prepare meta info */ client_disconnect(); /* disconnect from server */ - - fprintf(stdout,"\ndone !!!\n"); + + fprintf(stdout,"\n\nSUCCESS !!!\n"); return(0); } From dd644ed885cce16edb3acea1f4352d94cf7af6bf Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 4 Jan 2003 13:28:41 +0400 Subject: [PATCH 128/220] .del-test_xml~6237d9729f4fe38: Delete: mysys/test_xml BitKeeper/deleted/.del-test_xml~6237d9729f4fe38: Delete: mysys/test_xml --- mysys/test_xml | Bin 35493 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 mysys/test_xml diff --git a/mysys/test_xml b/mysys/test_xml deleted file mode 100755 index 6b8b0b3b83c62e8bb17978098ca5273cbfc81903..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 35493 zcmd^od3;>Om2R~yK&&=kmV`|P8(SdD>egb}!XVp{vB8V5WMS5(rEaO)NNUlGY_m2N z1{B4_ESZo2GKPeZ@JK=!GEWn-I4lP8BQKtrmxMRN1ZM_ zNywYO-n;%?->*)csye6YoZ4>b_HE6}7KcKiBbB)(sEH~B{NSdN(i%J~ZqX4ns!ScO zW~$TGr|?vYaWw_-;NAwz`!L)kxF_O%pEu%oe+rm4q0p1aZ8#BFvj|u?*gmQOM-mOGl+A+-ceFY zB`H5;W!>Qcx!xON`hAFJnDNizF5MJ_Peb@M7hkHri}3mgvy= z`f^<=8jUA1iSAT3m&ioBGO^wS;=9sh&L(my+68VEy?EKmg$tHNS1w-M+T0dxTd;6h za}-GrmJkJZW;XQabm5sqEUwc1i9QO{YXpjB7cPF!X_NH~_e+>kCmR{QPQsKvxrE^s2~&$?3&V{FuO51P zaL+N9x3>=cw%jp;FTTHOv8zBm~;NoN^tM|kw5Ka%+V;EVfF+~~JZ zhb^Pa5wS&NC>@-iL>4OFxO>Xx0X2A79HEj&`Tua^{;?f`22s@8BamI8sAHLZ58_Av zX2XXcynGmwBUAP23rMf?eDwwWv`J1Fd~sj$I_Rd;btB!YFPQQT@8tH@VN}F5lZTt9 z%zb@e!qDqOFF@qh;pSsn+DB(WhwUZRYI9=rs%wY#T*Lft-!lb9MTX(klapgGv{fye zA5r_q##%?eE)}t_HF-O$;mwc6#=_f%9~u2{Y>bJuoFA7yWz%nF`oHC0{UFED-d zpy>zqOlcjyrj)h$D7of>3-#2R{5nJDBQ$)?sMEC~6jEqEBpA*gv-LY*xqB1Ler)rm z5dKF^CCA2;T8p+_Ao)xl{4jLe@yLAm@RregAkMD;KpSltzP4o3zvK^l?(dKR3R|mM zM=#U-o3`C@CM!JoLqsJ@(O9FuKwXZoX?H!%w6+jbGKy?%8GRY?LoaVHIZL6O&EI+J zkAEC%AN@6aZt%r2w)m-cm6W!R9*gmfq1W$ZXm=33MxrN3^#03R+ec5s3;{`DV-aN7 zKKdbeTLgV1sV3{dOi3}hu_gH`YbpdOq`>z#Z=wh-qql)OylwO2uOM{QwNX=t@TS3S zZw~IOUe_@;ZByg@C8e-~5ryaO_AMhNe6H9sax|Zdw~QRm=Y?BFPU5p}%gCqrtlTnk z2A}6{8JWuGnOjE6`8;{cNF|@gZ5fI1dH9x*Iy?hgGi|+l!q~*&i4BWNvZ(5PlYXFD zl9L~R3crM5!f!Wi%fGq1WXss4C7S7UFbyv%ne>CkF~j&B$N102IIPdHFM)CFE*;uC zHb{RQmj4?Dj{(k}TU1=yN#uc_aCHGh*S_@bfhKm0VKII)qa+@kN20J#q$=j5U7L%#@k^KT6Q zEp-`}MgE9EQEs9xo$^A?MU?Z`_>Z+F@lwHOvVw2Q# zNFqJJ?)=c+&4Y}dEBphKbh_=Ta!d$1h$7n|?5dX0oA#k^cz2@24axu8*)o#{pX1bB z%Q#ibD6xav3gxf2=ptHLhX=_uw!`o5wakYeBaTFgJ310}zgY$H-7A21wRx#`v1{JDR~&0V$jtjjiEv$J)S zFmqeTa%5bG_=F2(Vu)^>#Y$sg)&A?rPjG=sGyQ(_94UAj@>0gd&AqdAFhzi&@*J)ocLPMhYjwjpgyPs8TB^b!xkC3hkQeK zmdO7!!O-(Ve?`BayJOPeQh46xTlT@*eM>NQ}oQA87N-+eg36 z5fbArMvq04?${45P5)v*pPgT%X`2Gt(j07NKkT!0^nQ3+OR|89*wrSMhN>+c&)WtyS%# ze+$`-_Ve?%ki7h@%i2dD)}05k+I-DEYSS8M(?0r58GhJz-zkEqF*tX{t_xsJsGru{VS^to&94oLz0_BDPLS!*Vt)r_x<6nU zl{p}5n|+JXap|NxLQMK$>!dsOk>SJH`57o~Ev6Ceqdy2zKj~86>r&scN97ivrE(`B zg|z$^;eRd3qdt%E?;6e(bT;dPY&u;wmjv02svJ5$!+c4=Tqgoun7helKToosiR{}) z``*WVW(qjAXqz5t-naXREn{Nen$mEmjC<(BFUY^cW|O#~MI|EYTI2<5LR(@imhy*- zn&U~`;(k_>Hhv$%VOEiN#kixHztX$WU!D%DY8n0f?@+s#VKUA>;mPpUA?bj})7Z<6 zr?De&v}Tz^4DCgJ!^=yDZxL7GOS zsmHwpcXC|%H6~m(j$Sn`d?;CGg6}%qWk()+l)7N*tXXQ-tP9me^Jiah;Z$|ejI#+O zt}R^_PbB)w)+}GfN}X}R?CIGHXO!jp66^aDow-E3Y^J5Hi}fK~e#p9KM0g%rxhQoi zp6JV!*|gP%h)<*4XU}kKhb*J!(CM*bk?QMqS=1fCiPm*nG`*r`+?m2;Qk>mPR9$6my}|Z zRBLc^e~|l^+{?^CM&cekx%WloxF7121g30CwNHHD0xe4%p|4>_wZ*t{J4j=dw9&l zXQRSwo{K%)@8LUuH$vuzhL!rF!A1r3m;uii`aicR^*93o2DDc#hzU z1q)PncsP%}yaN8&%jR=8=vsOmW9eV==+7Gbqu(m^6N9g>!2%ArAl9nXM}leT*mH&P z70izN48hnq#C3sSTDDS`38v*L)h(FTs}%OqkXG;L-!E8u!Pf#}|(c&_lgBUpRwM}p@I zeF{2|g1S)f`GUEVuhb&J3j|*!c%k5a!CL0e32qkpHv}&h{1d?!3;vDZC4wiS$qQHM#3P--D?!Ni{nw=CeDqP;BtBG9K{G~syB0=yM(&){b2YJ*YriaYhBj9xjVtrC~p{*`i;R8kk3Bg0!ziBhed3|jgVYB@xSgBsH4WGqT8K@ zH>2G0)#aYz>3fRISG2yTxO|$xAL#ojkA9kmPxtga!_)Unk>Qh;yHj*LMfA}6o+9s? zr$PP#t>@3ww@LIpTX7Ft>pRuccdDoFR8N<)J$=vd=+ixXuBYz|Pv4oM?pRuc zcdF>yBKpFT{!D%QMc?z)gV6U@;H~OB&j-(kXXvX*Rd_nilKCWKnp7oXu%0?ZKEt3l zB2V9s$p4`5ht-QH_bXCvm6ZEUgXu@Snov^#j>tP&O|Msa^drwag)U02CLlcuk$$0C z=I9rho}Tmt*a@-x3)L+SH>p9_11?xHCuLSEk;Rk|s?|&So)OJodU9g@L&KJBu zq+Ts}q2RTG7YQB`+${JB!P*;N7Odxl?+9KZJRb?xbHbCRuv|SSJYTS$6J8`(d-COi zmrL5T;1z-g1?xHC7X-Hm{VBnh34UJiD#1S&+$#7#1h)z1LfXy=PZq4_gcXAIoN%#V zJtw?UaF3+roRDqAt54{+3%*0}oq``0JS_Ozg0~2MS@7otzad!93I9{Do)ea0NmCFG zoRJaytO*4+b}i@|K|SxpkQ(s#pZ4$`4@WR$7Svsm&y|984>%}TXa5}xp9KxohaT?z zv@R=wB!|Jal@H=g=9%PYBav zf;Imy1wSQ$4}e(@H)6x#q%+B1A@nL>((PqsTP8f(FXDnV$5~}TxujVBIcEp-U4q|| z1jn93`mY672o|U|3VvS#4*_ok`dmb*|8DTtZc*wN9{)4bnUD56CbH$eCUnV0-Fhy0 zs&&BQc~Iz@{96x`V)L0bBdCW(9`<=+hoJjBw;G-wqy6s(E-=zuwyc+gu1DP83cg-A zrp_e4_MLXYy+Z$j;6A}W5u6r$OgZ`c1uVSKP>s+d<(8`3cgG5OM*8G z-XnO6;4#7X3O=!lGTbNlT*3DXo+tPL!7YLx5xidTmjpiwyb)!VWt!@Q8=cfIk<6TdC_jd=gyL(%=m@5kYtl+(ZHw!)*=3Y?u3O-Bl{eo)* ze@XBX!H)^PPVkonuM_;7;Li#Ek>Do;|Eu8V1piX-PX)gzcvSFC!5<0!mEcL3z7*8I z3qD)$+k)!_za#ik!7C?HFJ6!7hk6+FjRrsCVeV%>Z|Hnje)3rQs~*44<74iVke~Y` zZ-T$TNL;7Fy$cE*Fs^FgX*gZWIrAdmt=K;)l^CuIg7p#CS*JSsELG-krQ307!d@;+ zQ?4c;6lri+H98zoOB}9NEe_Xs>!4b7ouk*Oq{H>5m!)iT)dtW%PX1|#C(jDe@d9-R zbnF%#8$2B^@Ya&^y|v_p3SFCAO&IU48JEunFP}l+My&5_1G8N6ZR^eYL z?-N237Q?_@L~@yaql*oFc-bV@m#7_JG@L?>+o{b>2QlzhnFcm3b77b zl^%JBSF6uE{&w|-! zPBl9mQ_CEVtE(MOsGA(_Qo2`W{@v;!M^CD)4yV-D9bT)x>2R-l+TlL+hQnz!>Tth$ z&*AlIufrSUaK7KB&m5vnzXy7wS}69gU2v1BHNA$l?YooI2|9{4L;MfmpN5tHTf-%# zZ%h6+i_N@iFw^cgc(P84dbmaQ2^nlsw|cg8oA~1=&GU$Pl>cTC?F56F_n97Mm@?Df z%R!%pcSch_Yh~W($-Gf)Sj)W8+jkoDeDDslBS`u0l(YZLzX|hy46$-GsUfdF8TR&4 zKC4zbo_joB_?${P`WCg$;d{-Dp84M=f0yt{<=6GIQQBA6&qk>$T|XOLTd;n(64Lv? zpI5J-e&(aDw&E=$``C*OW}CJe%r?Eo;3>eon&6p1pZr(e{__{S{pSb0{pT-w`_F$_ zx!sVV5prT$r*1HqvfN^@-`8;7_WHwt2(s#{3A2mOZA%L+3D?t{!0C;qyL+F z%i({QzvW@DNxiLpLnEJKDM}*|?qR4P$C>Xycg)W+)6=+h&hpuz@#E_n$ zQ{R(9w>bLAp&^Gq71A?t@|+gB&(Y5aeZk=~Ltl5eEcBGaXNO*N_?*xVho^`B$>ABH z|K;%cq4yk~724}?W#~B5>0oXdI?>_k&=iMjLT5N!8=C9zoKUmF^`R9G&kJ4Qa6_oi z;rXE(9KJ9#=(Q-^?L@q_2Vz^F#8!7=>dT9L4)Jp2 zIZZ7LU45_Za~6bxv1wt5;{~rKwaEPuDCV@G(?B~^T3tU2j0Nkm$iG&~x;V7nm9^L_ zYe|TreH;&E#!^acl6)==6Qc!QNg)3+PyXeh6F(-O7rlJ6 zE|-L8w*LfrBl2f{yeJRz`8ScLCG>!kXQjxa^I7T1)8ff}6JN6WL)lV{}t z@=UydvaJq%&B@c|$}6JN6XXZ$Vi~Nnke_iMmS60+3>pHKjm{(S(S10jMur5x7&On~Lnp9`# zEDeFXLNgui4q-dvkmYJQqxj=1?8`y6Mimp8{RkM*vWKnVs=L?GrM;~_J*EWHI?DYb(!lK+K`>C zDrfVUui@|R?2JS^)4lyT035GW_*2<=xtUcJ;qv(zc{Eg2MXKC|P6{EzRgj|E31Q1RAaU&{NL(as zU63&Bl^Vc?s-Sca8Kot!1EiS~WEx~dRlNEv$}5{pXL7D4>UHw^@`hQ}kvVns4g4Rf zYpw%Io2%L9vN`H%YpZL)sjJqtSh&haRE0dlk$T;1E~kLcnnIYFMQV{%S5G=-%*3=i z;%X49;^}-xPeNNz(CGDyl4|kegT@U<$Ur0PNvwA&htYu9di-5=&pffjimHn0NJFYO z)@{Po5fXxgo>;aC>x^7BZ@+xoB6G?cL_o`PfS{)C!>D{M=|DOa*E*t}Dcjs~?RTlZ z&YpZcF*}=!r_zrCQo{p=XbA8}FqU3#vrCdwMFrX!++x^j^7 zJ{=Vg`W(_ht~cDMbIMa?*)1J)O?ud{hwBVKsu=Wo%kJo?KhU9;KM0 z%3&Gdsz^$N;eAm3Tnc)hQldX?- z#IlKb2%+}Qquya=36qO5$8ko8#EX|MYnIevxb@L~oz|qu6eWnRGr_tV$+4>^)}1A( zzPw^?T}8OA0UsoQCuvGJ91&7S7qhG`NA=WGw`fmCmnTbju6P8x^Yry8ksR$PlFu!# zh(vTrojqx-6&mwA+)*}Pk%5v1#YyA_6>&d~!5*E~97s6WHqQb(vI7L|~f<4{Fh5Q(dd&%y$@ds_Sb+oxH8Gni^eD-qu=8z0Nkz7GlY$Ok z4W@Z&QBgF6KFfv*2-vC|TXkJUJ!{XDUt6Qg@94SStIoPAEkwGj3txyJEA*?YF;*q5 zouer9if~2k0et}f3Szvk=lk#hiuiachvnRc{=@-Y10&$xHqLqa9I@nTn1TY$xa}Nc z%8&#^aiOIFz4Zt=NimEps`@*i_7sx-+dB z=#6UQkglX&)R%sc5k)b&3Q#&?`cr-J#Cnq?=m` zK1*VvbW@{IP|um(SoV5bh;D8jk&N}lb%&13*yMOXb@5HKQ5tEBShThn{Txd^YGw!M zsE}TIMo1%b5y)64b|}L~o`aK+D4JAFKFR@BXq2jo^_UNmQXrkwrlkFulptwat&=v; zw#p)mvBImttc{gqW36?@0%@%z8!v$L9EQYR^U)jfvA9$h$ka+=l}}~G({t1fv3Oh$ zabTiictDr)_=N3u`q9(}WGKOon6c5Kc-AiBA-9PiD2}J$ph6+2iI01^M<^&g9C{Ve zDJr#AU8(i`IiprYiwbIY%BmV+8wh8rFY4#4Aqqxzkw)l`ZDmCE#_dM%@= zepGBW(Ve}~lBt$dOm-bQbxWmEy1KfuMHN;}wRB8So>MEH7_d1|Evc@9_E`8BPb$`j z-W`K%rz@3OigvIYkWN>%5te(SkB(Po)4+lxlVmdjk zF(gjypny$?>0cy_*@%$vr7Fxi*gwJf@kD#uiC7rgfCnR2p0h0SV1}nBEIo^;**|T_=>F%ckdCT1H5{F;r~!-971! z7`?EV+?np{N*yq1?aw8-CIGh^`D^JQ)CaZ`jQq7URZuY$*pa_h=3m7lf2|l^@yK5* zvrm8IujPacnQ=bKQCpAvwKDR{Ff3Fv^4H49KZk}RWHa*D%E-@osV19|AJVh)<%Ah@ zH^zfZtt2)W`4Oa6=mhT2xT&$PXHwUpW1dA9O7@c>R$dbhZYo*^T_5X&u08 zM}E)_9Qi@i${=wt^20LN2$H28`9Y&%T;8~mA2e-Mpt+GBL{t4mBR|MgODZN9`9Y;p zy1I%+e#B5M9b-mj(41O!Ar+ci)upJ z8>79czC1Ry*P$0@@phvIF&KSVoT2&>bf)w8j6x>bozRn8Xu=9?gH_ z0wWtMh0OCrILw7Oup_Q3lei&|sm_LZVxinX(h>ZqBx#(FaLY(j@sY^^T@YH0eG|GG zu;>Qs#42EIKAY>s$09gMfsou*!n_LwWjkX%2~>7xCT)r`dqys=kJ}Oq4H9P1ve#A}Np5Kvg;1M>frnsU*>6 z!TK(*;J%SokqKN3CRMeVXz7^PKrDrQ0w#dTN&{iG#{D28PA)0)HHojNnQZj)9(Uik=sT_woO_wBQ9t^sj>xsa6DvZ5vPNMl8Q{#rP;B2HS zd1H|mq%hBBGdptv0j+Fk+Kjjd>yl{$!d#}yk&O8?6n6*Ifn7l_i^o7m6k^hT3ux4maf8Eo+wtXO0@V3#&~<9(%l#@GFCgT8n_JN`xTi{VJA4%%^j2; zvr>~8wrsOt{6m~+bD7uYYczqaZsZYrGE{7qSx?n{g}lc}4A41cnIcvb0XLSYG~6y* zdy7rhS0TRF)TDQ%uIag{uZJ<)EOvZ}=l0iv;7 z8eN@EidCx26EKT9=-x#x6YGa7W5wR>imNg6d5nalV|9QJ6N}}c6N3`6T>sZ5ouXR)8i0n9qSFB8Gaq`(mEYY?*ot) zvosDt^e)U8tSEdfp-Ekiq}To6VtY9UGOsF_VaE20W@HirDrz|yBj(hB*))>u!E+i2 zdjqw&L4!7Mas^G`uL*m%-g32RYbg`F?W8m@!uK_T6-#5!{+jIJ`2aP5niA<|W8x*0b(-I0MK7B$0~ z^o9Dx9$p?`7Gy_|7`u9tsq8Gl)@197t6?)&HUpV{WMfhH>eJ0nKrFIMNKDi8#+UKK zt4zpY#^`F`l3j|&y11yTmEBU~is)*K;%xt&590Ce+w)s_<(G}rRrQYdP>~i? z=bw5w1;x3imJ<}$KkD8V6xTf(M<8AZLfi2fS0~Lmr|E4$3!Kvopu%T6Ipgf4 z#VyTrxTLub(l|S5u7fnr4qB0Onm(7TuIn?ek4baRY2F}%=A6@Xxn%Q=(6~FvZX`19 z4w~~%9ypn?pFh93X%sgqg;>|ExPGYb+EtVX8 zkl*Fl9w$-_UC_dCN-M9{g)2r_KMRt%u3qJ1mPke5W&_22i0wN-*UIVfRu6>(2lq8h zP(*BT--v7<9MpS@$1&{`<0kHSk%YG)hw{aP$I4`XL-r7nok<*{OR6lNQM7-IOQVQc z8X0OPmB#6aqM15gS?f(!sYP^Is6<&HoQDTmV13ra&vT62I5*s^a+z+E8-1bU#taZE z2$!T6nB%U zV+P!rO|-NvS=GFtDY|?$zU3Ni=J#S3EookK>AY}7an!2jMXOh}E^Tj~7a13`V&$sk z3zp5RuF!e3UD47UUA|z=yqXH^O4_4Z5qVLlH;2)=>a$uPN)KQTYau92BMO^oi5|th zjzuOC=Cl?PpbfM2a$HMNn^blht^19?{JfS3D19=vk^ag;4TtmTBGM~=DZe(;@AYJSd*0* zkE1-Xg&3~sydztnV8Q$+&TKJ5G>tcVl^H2SC_c1BKD0={cd%1iS_Tf(tkjP`w#5t& zJhw$EYL(hxbz3wQ!vQV)Xb(E^3_iXqZWTc<0$!SsTF0|5mdf5hsPU9OA^=Wyad?PT z-H=ZgZR=zby>>|{LmbW(c_~F6>A$+Po>OIa;tuOW*YKw z)q>i^`?MRfJn+-m+ph(u4Iv(qVg@Nrtb2ukFQOS?@??(F$T?5Iq z36WeJ#?T`AP!WuUlF&{S)8njw9`j@bz_5VbRZMrgu?df%NydR}eGhgs%$}|_KpZL2 zT+}vjr&uSAm#1#|QV15PbDXXQy0}~P&I4CD<&OV^_ z(UJ4m2MfVYevWSlAQi@dY)!V`R4i>@%Z|;1e*O?yF5L;k(PZX9tG04txscBAtMQT( z4Ti56G4~!PG1kb^Y`(-8u(OyC$KmOaf@4e|w5>vvSA%1@l(tU!>038D} zfHejggu{55>1vmYuLhiG=}yX-QF6nZaGD1s(~5dRq&p-_6(zvT!A&}6Mx@esRmL1( z2bi(}p!L_I&m6$QhP@SbXbhjE7n3q;Yb57VF2njX1==-s5apF>7u$&Rm!oFAjdwjL zC{PLJh1w@gSHG5Ax>!RTNZ9>Rt&fns?pRB&^X<$e;-*`xdSmO>}%`VG4#G}OkerlQ@T-B4=m26F;T4bVk3vaz;5|! z5^pUreL!=kt&tinXy@Wh))YNMFLIv1Q__C@a$$hoFjlV{v1-i_W{E+I>k1~_GnhYZ z9_Vv2cvr;pc<^^*@7afo3raBt0*CC1CgWJxi682fbzKrCbTFD*Yt^<5bBW@(oeZ1S ztg(B7G0Ef94VBCEc&xgSP!j)kf>mpVE7?*LQ&Skn{K*D7d_C0QOiDN3Tgjlu)d*C> zF#?|85t=NyWJCffT&HR5*=YjUP0)W*hLO<>jp*)qZrmj1xCkdRM4Ox=kDMI>W3?WQ zWUWPaH0RcJIq(`VV#b#@r;t&O9yECjnY4he)xkmQVlq{dzsNxaU}%vs2!E8p;S-rb z1^i`+N7rK()?uuHIUKy_~B= zz1STjIYFtz+8f=8#|3R|Jnx8v+RBg~2MyOp^oc)7!mvG`hq_{ked!Di8S{0Q%yuyK zis^HEG7pl>0t%3v)k6)M|%SUV^Nw~baJ*tcY+*1jLb{@!hGko7?BK zY0Ya9IsXb@l|zB(dQ3$X$Kn{M2r9M_R4p@?#ycQ$BN!Q^{tv}~J@RzMb}x&Kg;=wY zI4tL&t~5AZ%r%04a?%UuJ~lQ1-IqnZv*8JvBt!cZuzbNX5Rb`0)I>V zHAEZ@Y%lWhisH6>uY>P(L~LV(xyZ*mj@$A*h~Gqd5Q@HNKMrDe@Q`n`TR#5m@zwZf zi~SY@o99h$#0P9Fk402sSfkYOWMwKm|yDg!}e=@ zLWX=WZtt4ttj)%s;>A)Qzb9tc@4*@V^f><0oc%DOM7=l08aN%l@1hxx61(8}5X80LD zzC8Mr{cSwz|IY{q@*L;B>jtvaC%_}zc{|rn!6C@ce>broPhlK4OM<~ik8hVze>%18bN$h z^1U&BnR=h`Pp1D0!lj#ZJi|{S%DJ3LJP1B9)ApMakFMTGgSE_y!Wf59;9hdsyf zu%9;(J{9?$C-F+XgRs5I0LBo$8T_PCo{6Xz`nyhltU3;1_7}7}=6@2x{6-Xe4u;DS zo{4z&m6W#03Hb*R<~Ox${tqL(2Jvx8uhf?rhI~v@OeK#1G|Bn$~kMI%`{wc!z79_vZM)}@A_-@2AKl1-O!uBd7=*-|mSiY+Z-%lF% zJ*581Y8>8eYFoJ~x@>7{TQq7uQ-j~%tgJyyJRQ}4N*9$Wa5R=*4{Gz0=;BoimN!Qi zHebAS1rl)*9gXLEdpD?b$6EZHXJt67x^OroVW^yT8`zc3@OVO6cKDImBCl}2K$&`* z0)?k}MH7lL(%OKQLx;T2KJo88i#q6PdJS*Q;2) z_Eb1JpUT-7lRH=DD$zHP%B1^nfItg?%1gM9Dd@`QS#|KmQEU9mP44t6td4Q2!e;0% znDHrw7+JH6i(|25wuA$g|6s=o$mW^o1%u+>g(|#h>Px9?apfGae#hUwCe}keoR`D< x9u>WK*~*0rmPJ=CUfkN;7HwOwa9J~&oEiul-^^N3q$;>q)S1jcii2tXe*pAMH3R?v From a533a95c288e1a4b8ff24874f880ed1cc8d7dd9b Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 4 Jan 2003 13:35:52 +0400 Subject: [PATCH 129/220] libmysql.c: SLL -> SSL libmysql/libmysql.c: SLL -> SSL --- libmysql/libmysql.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 9d87cef2e34..7ab8d26d233 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1763,7 +1763,7 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) , NB! Errors are not reported until you do mysql_real_connect. **************************************************************************/ -#ifdef HAVE_OPENSLL +#ifdef HAVE_OPENSSL static void mysql_ssl_free(MYSQL *mysql __attribute__((unused))) { @@ -1781,7 +1781,7 @@ mysql_ssl_free(MYSQL *mysql __attribute__((unused))) mysql->options.use_ssl = FALSE; mysql->connector_fd = 0; } -#endif /* HAVE_OPENSLL */ +#endif /* HAVE_OPENSSL */ /************************************************************************** Connect to sql server From 782295137b513c45f83add72008b1bfbfde2502d Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 4 Jan 2003 14:12:20 +0400 Subject: [PATCH 130/220] Some changes to separate charset and collation terms --- include/m_ctype.h | 3 +++ mysys/charset.c | 29 ++++++++++++++++++++++++----- sql/sql_show.cc | 15 +++++++++++---- strings/ctype-big5.c | 1 + strings/ctype-bin.c | 1 + strings/ctype-czech.c | 1 + strings/ctype-euc_kr.c | 1 + strings/ctype-gb2312.c | 1 + strings/ctype-gbk.c | 1 + strings/ctype-latin1_de.c | 1 + strings/ctype-mb.c | 2 +- strings/ctype-sjis.c | 1 + strings/ctype-tis620.c | 1 + strings/ctype-ujis.c | 1 + strings/ctype-utf8.c | 2 ++ strings/ctype-win1250ch.c | 1 + strings/ctype.c | 24 ++++++++++++++++++++++++ 17 files changed, 76 insertions(+), 10 deletions(-) diff --git a/include/m_ctype.h b/include/m_ctype.h index 09a24201588..85397796e73 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -49,6 +49,7 @@ typedef struct unicase_info_st { #define MY_CS_INDEX 4 /* sets listed in the Index file */ #define MY_CS_LOADED 8 /* sets that are currently loaded */ #define MY_CS_BINSORT 16 /* if binary sort order */ +#define MY_CS_PRIMARY 32 /* if primary collation */ #define MY_CHARSET_UNDEFINED 0 #define MY_CHARSET_CURRENT (default_charset_info->number) @@ -65,6 +66,7 @@ typedef struct charset_info_st { uint number; uint state; + const char *csname; const char *name; const char *comment; uchar *ctype; @@ -127,6 +129,7 @@ typedef struct charset_info_st int (*l10tostr)(struct charset_info_st *, char *to, uint n, int radix, long int val); int (*ll10tostr)(struct charset_info_st *, char *to, uint n, int radix, longlong val); + /* String-to-number convertion routines */ long (*strntol)(struct charset_info_st *, const char *s, uint l,char **e, int base); ulong (*strntoul)(struct charset_info_st *, const char *s, uint l, char **e, int base); longlong (*strntoll)(struct charset_info_st *, const char *s, uint l, char **e, int base); diff --git a/mysys/charset.c b/mysys/charset.c index 3f650bbe14d..37dd484c58e 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -165,15 +165,24 @@ static int cs_leave(MY_XML_PARSER *st,const char *attr, uint len) { struct my_cs_file_info *i = (struct my_cs_file_info *)st->user_data; struct my_cs_file_section_st *s = cs_file_sec(attr,len); + int state = s ? s->state : 0; - if (s && (s->state == _CS_COLLATION) && !all_charsets[i->cs.number]) + if (state == _CS_COLLATION) { - if (!(all_charsets[i->cs.number]= - (CHARSET_INFO*) my_once_alloc(sizeof(CHARSET_INFO),i->myflags))) + if (!all_charsets[i->cs.number]) { - return MY_XML_ERROR; + if (!(all_charsets[i->cs.number]= + (CHARSET_INFO*) my_once_alloc(sizeof(CHARSET_INFO),i->myflags))) + { + return MY_XML_ERROR; + } + all_charsets[i->cs.number][0]=i->cs; } - all_charsets[i->cs.number][0]=i->cs; + else + { + all_charsets[i->cs.number]->state |= i->cs.state; + } + i->cs.state=0; } return MY_XML_OK; } @@ -203,6 +212,16 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len) ((char*)(i->cs.name))[len]='\0'; } break; + case _CS_NAME: + if ((i->cs.csname = (char*) my_once_alloc(len+1,i->myflags))) + { + memcpy((char*)i->cs.csname,attr,len); + ((char*)(i->cs.csname))[len]='\0'; + } + break; + case _CS_FLAG: + if (!strncmp("primary",attr,len)) + i->cs.state |= MY_CS_PRIMARY; } return MY_XML_OK; } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index fb7f479bca0..ac9cc6b3002 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1362,10 +1362,14 @@ int mysqld_show_charsets(THD *thd, const char *wild) List field_list; CHARSET_INFO **cs; Protocol *protocol= thd->protocol; + char flags[64]; + DBUG_ENTER("mysqld_show_charsets"); - field_list.push_back(new Item_empty_string("Name",30)); + field_list.push_back(new Item_empty_string("CS_Name",30)); + field_list.push_back(new Item_empty_string("COL_Name",30)); field_list.push_back(new Item_return_int("Id",11, FIELD_TYPE_SHORT)); + field_list.push_back(new Item_empty_string("Flags",30)); field_list.push_back(new Item_return_int("strx_maxlen",3, FIELD_TYPE_TINY)); field_list.push_back(new Item_return_int("mb_maxlen",3, FIELD_TYPE_TINY)); @@ -1374,14 +1378,17 @@ int mysqld_show_charsets(THD *thd, const char *wild) for (cs=all_charsets ; cs < all_charsets+255 ; cs++ ) { - if (!cs[0]) - continue; - if (!(wild && wild[0] && + if (cs[0] && !(wild && wild[0] && wild_case_compare(system_charset_info,cs[0]->name,wild))) { protocol->prepare_for_resend(); + protocol->store(cs[0]->csname); protocol->store(cs[0]->name); protocol->store_short((longlong) cs[0]->number); + flags[0]='\0'; + if (cs[0]->state & MY_CS_PRIMARY) + strcat(flags,"pri"); + protocol->store(flags); protocol->store_tiny((longlong) cs[0]->strxfrm_multiply); protocol->store_tiny((longlong) cs[0]->mbmaxlen); if (protocol->write()) diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index 573c3c67db0..74ff300c9e9 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -6219,6 +6219,7 @@ CHARSET_INFO my_charset_big5 = { 1, /* number */ MY_CS_COMPILED, /* state */ + "big5", /* cs name */ "big5", /* name */ "", /* comment */ ctype_big5, diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index 7848862a0db..377e50f3dab 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -260,6 +260,7 @@ static CHARSET_INFO my_charset_bin_st = { 63, /* number */ MY_CS_COMPILED|MY_CS_BINSORT,/* state */ + "binary", /* cs name */ "binary", /* name */ "", /* comment */ ctype_bin, /* ctype */ diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c index d309ddc80c8..bb0afe98032 100644 --- a/strings/ctype-czech.c +++ b/strings/ctype-czech.c @@ -597,6 +597,7 @@ CHARSET_INFO my_charset_czech = { 2, /* number */ MY_CS_COMPILED, /* state */ + "latin2", /* cs name */ "czech", /* name */ "", /* comment */ ctype_czech, diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index 2fe8db85369..6388d4b062f 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -8637,6 +8637,7 @@ CHARSET_INFO my_charset_euc_kr = { 19, /* number */ MY_CS_COMPILED, /* state */ + "euc_kr", /* cs name */ "euc_kr", /* name */ "", /* comment */ ctype_euc_kr, diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index c06b70011df..77a55f6dadc 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -5687,6 +5687,7 @@ CHARSET_INFO my_charset_gb2312 = { 24, /* number */ MY_CS_COMPILED, /* state */ + "gb2312", /* cs name */ "gb2312", /* name */ "", /* comment */ ctype_gb2312, diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index 82a75188c24..004c3c778e0 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -9874,6 +9874,7 @@ CHARSET_INFO my_charset_gbk = { 28, /* number */ MY_CS_COMPILED, /* state */ + "gbk", /* cs name */ "gbk", /* name */ "", /* comment */ ctype_gbk, diff --git a/strings/ctype-latin1_de.c b/strings/ctype-latin1_de.c index 49acd3fa8a8..166e059ef42 100644 --- a/strings/ctype-latin1_de.c +++ b/strings/ctype-latin1_de.c @@ -415,6 +415,7 @@ CHARSET_INFO my_charset_latin1_de = { 31, /* number */ MY_CS_COMPILED, /* state */ + "latin1", /* cs name */ "latin1_de", /* name */ "", /* comment */ ctype_latin1_de, diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index 092b7aa4f0f..5b963e74db9 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -201,7 +201,7 @@ int my_wildcmp_mb(CHARSET_INFO *cs, { // Found w_many uchar cmp; const char* mb = wildstr; - int mblen; + int mblen=0; wildstr++; /* Remove any '%' and '_' from the wild search string */ diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index 43db7ebc24a..1e9a5895683 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -4461,6 +4461,7 @@ CHARSET_INFO my_charset_sjis = { 13, /* number */ MY_CS_COMPILED, /* state */ + "sjis", /* cs name */ "sjis", /* name */ "", /* comment */ ctype_sjis, diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index 2dae3036426..b448ebdd926 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -689,6 +689,7 @@ CHARSET_INFO my_charset_tis620 = { 18, /* number */ MY_CS_COMPILED, /* state */ + "tis620", /* cs name */ "tis620", /* name */ "", /* comment */ ctype_tis620, diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index 9d970005c85..2c3c8dd11c3 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -8431,6 +8431,7 @@ CHARSET_INFO my_charset_ujis = { 12, /* number */ MY_CS_COMPILED, /* state */ + "ujis", /* cs name */ "ujis", /* name */ "", /* comment */ ctype_ujis, diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index c32592dafec..738bcde92b6 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -1959,6 +1959,7 @@ CHARSET_INFO my_charset_utf8 = { 33, /* number */ MY_CS_COMPILED, /* state */ + "utf8", /* cs name */ "utf8", /* name */ "", /* comment */ ctype_utf8, /* ctype */ @@ -3025,6 +3026,7 @@ CHARSET_INFO my_charset_ucs2 = { 35, /* number */ MY_CS_COMPILED, /* state */ + "ucs2", /* cs name */ "ucs2", /* name */ "", /* comment */ ctype_ucs2, /* ctype */ diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c index b7a6b21cf4a..0bc63ab07cc 100644 --- a/strings/ctype-win1250ch.c +++ b/strings/ctype-win1250ch.c @@ -623,6 +623,7 @@ CHARSET_INFO my_charset_win1250ch = { 34, /* number */ MY_CS_COMPILED, /* state */ + "cp1250", /* cs name */ "win1250ch", /* name */ "", /* comment */ ctype_win1250ch, diff --git a/strings/ctype.c b/strings/ctype.c index 8e7d8ad939c..5869ee804c6 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -2811,6 +2811,7 @@ static CHARSET_INFO compiled_charsets[] = { { 8, /* number */ MY_CS_COMPILED, /* state */ + "latin1", /* cs name */ "latin1", /* name */ "", /* comment */ ctype_latin1, @@ -2856,6 +2857,7 @@ static CHARSET_INFO compiled_charsets[] = { { 14, /* number */ MY_CS_COMPILED, /* state */ + "cp1251", /* cs name */ "cp1251", /* name */ "", /* comment */ ctype_cp1251, @@ -2900,6 +2902,7 @@ static CHARSET_INFO compiled_charsets[] = { { 29, /* number */ MY_CS_COMPILED, /* state */ + "cp1257", /* cs name */ "cp1257", /* name */ "", /* comment */ ctype_cp1257, @@ -2944,6 +2947,7 @@ static CHARSET_INFO compiled_charsets[] = { { 27, /* number */ MY_CS_COMPILED, /* state */ + "latin2", /* cs name */ "croat", /* name */ "", /* comment */ ctype_croat, @@ -2989,6 +2993,7 @@ static CHARSET_INFO compiled_charsets[] = { { 15, /* number */ MY_CS_COMPILED, /* state */ + "latin1", /* cs name */ "danish", /* name */ "", /* comment */ ctype_danish, @@ -3033,6 +3038,7 @@ static CHARSET_INFO compiled_charsets[] = { { 3, /* number */ MY_CS_COMPILED, /* state */ + "dec8", /* cs name */ "dec8", /* name */ "", /* comment */ ctype_dec8, @@ -3077,6 +3083,7 @@ static CHARSET_INFO compiled_charsets[] = { { 4, /* number */ MY_CS_COMPILED, /* state */ + "cp850", /* cs name */ "dos", /* name */ "", /* comment */ ctype_dos, @@ -3121,6 +3128,7 @@ static CHARSET_INFO compiled_charsets[] = { { 20, /* number */ MY_CS_COMPILED, /* state */ + "latin7", /* cs name */ "estonia", /* name */ "", /* comment */ ctype_estonia, @@ -3166,6 +3174,7 @@ static CHARSET_INFO compiled_charsets[] = { { 5, /* number */ MY_CS_COMPILED, /* state */ + "latin1", /* cs name */ "german1", /* name */ "", /* comment */ ctype_german1, @@ -3210,6 +3219,7 @@ static CHARSET_INFO compiled_charsets[] = { { 25, /* number */ MY_CS_COMPILED, /* state */ + "greek", /* cs name */ "greek", /* name */ "", /* comment */ ctype_greek, @@ -3254,6 +3264,7 @@ static CHARSET_INFO compiled_charsets[] = { { 16, /* number */ MY_CS_COMPILED, /* state */ + "hebrew", /* cs name */ "hebrew", /* name */ "", /* comment */ ctype_hebrew, @@ -3298,6 +3309,7 @@ static CHARSET_INFO compiled_charsets[] = { { 6, /* number */ MY_CS_COMPILED, /* state */ + "hp8", /* cs name */ "hp8", /* name */ "", /* comment */ ctype_hp8, @@ -3342,6 +3354,7 @@ static CHARSET_INFO compiled_charsets[] = { { 21, /* number */ MY_CS_COMPILED, /* state */ + "latin2", /* cs name */ "hungarian", /* name */ "", /* comment */ ctype_hungarian, @@ -3386,6 +3399,7 @@ static CHARSET_INFO compiled_charsets[] = { { 7, /* number */ MY_CS_COMPILED, /* state */ + "koi8_ru", /* cs name */ "koi8_ru", /* name */ "", /* comment */ ctype_koi8_ru, @@ -3430,6 +3444,7 @@ static CHARSET_INFO compiled_charsets[] = { { 22, /* number */ MY_CS_COMPILED, /* state */ + "koi8_ukr", /* cs name */ "koi8_ukr", /* name */ "", /* comment */ ctype_koi8_ukr, @@ -3475,6 +3490,7 @@ static CHARSET_INFO compiled_charsets[] = { { 9, /* number */ MY_CS_COMPILED, /* state */ + "latin2", /* cs name */ "latin2", /* name */ "", /* comment */ ctype_latin2, @@ -3519,6 +3535,7 @@ static CHARSET_INFO compiled_charsets[] = { { 30, /* number */ MY_CS_COMPILED, /* state */ + "latin5", /* cs name */ "latin5", /* name */ "", /* comment */ ctype_latin5, @@ -3564,6 +3581,7 @@ static CHARSET_INFO compiled_charsets[] = { { 10, /* number */ MY_CS_COMPILED, /* state */ + "swe7", /* cs name */ "swe7", /* name */ "", /* comment */ ctype_swe7, @@ -3609,6 +3627,7 @@ static CHARSET_INFO compiled_charsets[] = { { 11, /* number */ MY_CS_COMPILED, /* state */ + "ascii", /* cs name */ "usa7", /* name */ "", /* comment */ ctype_usa7, @@ -3653,6 +3672,7 @@ static CHARSET_INFO compiled_charsets[] = { { 26, /* number */ MY_CS_COMPILED, /* state */ + "cp1250", /* cs name */ "win1250", /* name */ "", /* comment */ ctype_win1250, @@ -3697,6 +3717,7 @@ static CHARSET_INFO compiled_charsets[] = { { 23, /* number */ MY_CS_COMPILED, /* state */ + "cp1251", /* cs name */ "win1251ukr", /* name */ "", /* comment */ ctype_win1251ukr, @@ -3741,6 +3762,7 @@ static CHARSET_INFO compiled_charsets[] = { { 32, /* number */ MY_CS_COMPILED, /* state */ + "armscii8", /* cs name */ "armscii8", /* name */ "", /* comment */ ctype_armscii8, @@ -3785,6 +3807,7 @@ static CHARSET_INFO compiled_charsets[] = { { 17, /* number */ MY_CS_COMPILED, /* state */ + "cp1251", /* cs name */ "win1251", /* name */ "", /* comment */ ctype_win1251, @@ -3828,6 +3851,7 @@ static CHARSET_INFO compiled_charsets[] = { { 0, /* end-of-list marker */ 0, /* state */ + NullS, /* cs name */ NullS, /* name */ NullS, /* comment */ NULL, From 5bdee64bf097698296aa7a6e6250f23a85aaf974 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 4 Jan 2003 14:25:05 +0400 Subject: [PATCH 131/220] .del-Index~a8f78510440e2fc4: Delete: sql/share/charsets/Index BitKeeper/deleted/.del-Index~a8f78510440e2fc4: Delete: sql/share/charsets/Index --- sql/share/charsets/Index | 70 ---------------------------------------- 1 file changed, 70 deletions(-) delete mode 100644 sql/share/charsets/Index diff --git a/sql/share/charsets/Index b/sql/share/charsets/Index deleted file mode 100644 index b2d9fe3e2a1..00000000000 --- a/sql/share/charsets/Index +++ /dev/null @@ -1,70 +0,0 @@ -# sql/share/charsets/Index -# -# This file lists all of the available character sets. Please keep this -# file sorted by character set number. - - -big5 1 -czech 2 -dec8 3 -dos 4 -german1 5 -hp8 6 -koi8_ru 7 -latin1 8 -latin2 9 -swe7 10 -usa7 11 -ujis 12 -sjis 13 -cp1251 14 -danish 15 -hebrew 16 -tis620 18 -euc_kr 19 -estonia 20 -hungarian 21 -koi8_ukr 22 -# win1251ukr is depreciated. Use cp1251cias, cp1251csas or cp1251bin instead. -win1251ukr 23 -gb2312 24 -greek 25 -win1250 26 -croat 27 -gbk 28 -# cp1257 is depreciated. -# Use cp1257ltlvciai, cp1257ltlvcsas, cp1257bin, cp1257ltlvcias instead -cp1257 29 -latin5 30 -latin1_de 31 -armscii8 32 -utf8 33 -win1250ch 34 - -ucs2 35 -cp866 36 -keybcs2 37 - -macce 38 -macroman 39 - -pclatin2 40 -latvian 41 -latvian1 42 -maccebin 43 -macceciai 44 -maccecias 45 -maccecsas 46 -latin1bin 47 -latin1cias 48 -latin1csas 49 -cp1251bin 50 -cp1251cias 51 -cp1251csas 52 -macromanbin 53 -macromancias 54 -macromanciai 55 -macromancsas 56 -cp1256 57 - -binary 63 From f5847785365ce6b68c3afa7f77a5b2f33cfb94dc Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 4 Jan 2003 14:50:15 +0400 Subject: [PATCH 132/220] Index.xml: "compiled" flag sql/share/charsets/Index.xml: "compiled" flag --- sql/share/charsets/Index.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sql/share/charsets/Index.xml b/sql/share/charsets/Index.xml index 79b622f9c5c..9dd8b43f0b4 100644 --- a/sql/share/charsets/Index.xml +++ b/sql/share/charsets/Index.xml @@ -16,7 +16,7 @@ To make maintaining easier please: big-five cn-big5 csbig5 - + @@ -27,7 +27,7 @@ To make maintaining easier please: iso_8859-2 iso_8859-2:1987 l2 - + Hungarian Polish @@ -86,7 +86,7 @@ To make maintaining easier please: - + Dutch @@ -209,14 +209,14 @@ To make maintaining easier please: Thai tis-620 - + Korean euckr euc-kr - + @@ -239,7 +239,7 @@ To make maintaining easier please: Simplified Chinese chinese iso-ir-58 - + @@ -271,7 +271,7 @@ To make maintaining easier please: East Asian cp936 - + @@ -449,7 +449,7 @@ To make maintaining easier please: - + From 24b256987eb93ed7b14d92ce0100f2fc859bd4f9 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 4 Jan 2003 14:59:52 +0400 Subject: [PATCH 133/220] Optimization of key usage (ORDER BY) (SCRUM) --- mysql-test/r/order_by.result | 34 +++++++++++++++ mysql-test/t/order_by.test | 21 +++++++++ sql/sql_select.cc | 84 ++++++++++++++++++++++++++++++++++++ 3 files changed, 139 insertions(+) diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 5645961a178..a2b463ab361 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -506,3 +506,37 @@ SELECT titre,t1.numeropost,auteur,icone,nbrep,'0',date,vue,ouvert,lastauteur,des titre numeropost auteur icone nbrep 0 date vue ouvert lastauteur dest test 1 joce 0 0 0 0000-00-00 00:00:00 0 1 bug drop table t1,t2; +CREATE TABLE t1 ( +FieldKey varchar(36) NOT NULL default '', +LongVal bigint(20) default NULL, +StringVal mediumtext, +KEY FieldKey (FieldKey), +KEY LongField (FieldKey,LongVal), +KEY StringField (FieldKey,StringVal(32)) +); +INSERT INTO t1 VALUES ('0',3,'0'),('1',2,'1'),('1',1,'3'), ('1',0,'2'); +EXPLAIN SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref FieldKey,LongField,StringField LongField 36 const 2 Using where +SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal; +FieldKey LongVal StringVal +1 0 2 +1 1 3 +1 2 1 +EXPLAIN SELECT * FROM t1 WHERE FieldKey > '0' ORDER BY LongVal; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range FieldKey,LongField,StringField FieldKey 36 NULL 3 Using where; Using filesort +SELECT * FROM t1 WHERE FieldKey > '0' ORDER BY LongVal; +FieldKey LongVal StringVal +1 0 2 +1 1 3 +1 2 1 +EXPLAIN SELECT * FROM t1 WHERE FieldKey > '0' ORDER BY FieldKey, LongVal; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range FieldKey,LongField,StringField LongField 36 NULL 3 Using where +SELECT * FROM t1 WHERE FieldKey > '0' ORDER BY FieldKey, LongVal; +FieldKey LongVal StringVal +1 0 2 +1 1 3 +1 2 1 +DROP TABLE t1; diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 0ee6f901aae..f4842a4998c 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -330,3 +330,24 @@ INSERT INTO t2 (numeropost,pseudo) VALUES (1,'joce'),(1,'bug'); SELECT titre,t1.numeropost,auteur,icone,nbrep,0,date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30; SELECT titre,t1.numeropost,auteur,icone,nbrep,'0',date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30; drop table t1,t2; + +# +# Test of test_if_subkey() function +# + +CREATE TABLE t1 ( + FieldKey varchar(36) NOT NULL default '', + LongVal bigint(20) default NULL, + StringVal mediumtext, + KEY FieldKey (FieldKey), + KEY LongField (FieldKey,LongVal), + KEY StringField (FieldKey,StringVal(32)) +); +INSERT INTO t1 VALUES ('0',3,'0'),('1',2,'1'),('1',1,'3'), ('1',0,'2'); +EXPLAIN SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal; +SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal; +EXPLAIN SELECT * FROM t1 WHERE FieldKey > '0' ORDER BY LongVal; +SELECT * FROM t1 WHERE FieldKey > '0' ORDER BY LongVal; +EXPLAIN SELECT * FROM t1 WHERE FieldKey > '0' ORDER BY FieldKey, LongVal; +SELECT * FROM t1 WHERE FieldKey > '0' ORDER BY FieldKey, LongVal; +DROP TABLE t1; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index ae45f96fbe8..dc2e315e69d 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -5933,6 +5933,69 @@ static uint find_shortest_key(TABLE *table, key_map usable_keys) return best; } +/* + SYNOPSIS + is_subkey() + key_part - first key parts + ref_key_part - second key parts + ref_key_part_end - last+1 part of the second key + DESCRIPTION + Test if a second key is the subkey of the first one. + NOTE + Second key MUST be shorter than the first one. + RETURN + 1 - is the subkey + 0 - otherwise +*/ + +inline bool +is_subkey(KEY_PART_INFO *key_part, KEY_PART_INFO *ref_key_part, + KEY_PART_INFO *ref_key_part_end) +{ + for (; ref_key_part < ref_key_part_end; key_part++, ref_key_part++) + if (!key_part->field->eq(ref_key_part->field)) + return 0; + return 1; +} + +/* + SYNOPSIS + test_if_subkey() + ref - number of key, used for WHERE clause + usable_keys - keys for testing + DESCRIPTION + Test if we can use one of the 'usable_keys' instead of 'ref' key. + RETURN + MAX_KEY - if we can't use other key + the number of found key - otherwise +*/ + +static uint +test_if_subkey(ORDER *order, TABLE *table, uint ref, key_map usable_keys) +{ + uint nr; + uint min_length= (uint) ~0; + uint best= MAX_KEY; + uint not_used; + KEY_PART_INFO *ref_key_part= table->key_info[ref].key_part; + uint ref_key_parts= table->key_info[ref].key_parts; + KEY_PART_INFO *ref_key_part_end= ref_key_part + ref_key_parts; + + for (nr= 0; usable_keys; usable_keys>>= 1, nr++) + { + if ((usable_keys & 1) && + table->key_info[nr].key_length < min_length && + table->key_info[nr].key_parts >= ref_key_parts && + is_subkey(table->key_info[nr].key_part, ref_key_part, + ref_key_part_end) && + test_if_order_by_key(order, table, nr, ¬_used)) + { + min_length= table->key_info[nr].key_length; + best= nr; + } + } + return best; +} /* Test if we can skip the ORDER BY by using an index. @@ -5980,6 +6043,27 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, */ int order_direction; uint used_key_parts; + if (!(usable_keys & ((key_map) 1 << ref_key))) + { + /* + We come here when ref_key is not among usable_keys + */ + uint a; + if ((a= test_if_subkey(order, table, ref_key, usable_keys)) < MAX_KEY) + { + if (tab->ref.key >= 0) + { + tab->ref.key= a; + table->file->index_init(a); + } + else + { + select->quick->index= a; + select->quick->init(); + } + ref_key= a; + } + } /* Check if we get the rows in requested sorted order by using the key */ if ((usable_keys & ((key_map) 1 << ref_key)) && (order_direction = test_if_order_by_key(order,table,ref_key, From f67891c24422a223a50a2477883e587c520057ad Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 4 Jan 2003 15:21:52 +0400 Subject: [PATCH 134/220] charset.c: this function will be used to load both Index and a named charset, so let's add a new argument to pass file name mysys/charset.c: this function will be used to load both Index and a named charset, so let's add a new argument to pass file name --- mysys/charset.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mysys/charset.c b/mysys/charset.c index 37dd484c58e..f590ee2a49e 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -226,7 +226,7 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len) return MY_XML_OK; } -static my_bool read_charset_index(myf myflags) +static my_bool read_charset_index(const char *filename, myf myflags) { char *buf; int fd; @@ -237,7 +237,7 @@ static my_bool read_charset_index(myf myflags) if (! (buf = (char *)my_malloc(MAX_BUF,myflags))) return FALSE; - strmov(get_charsets_dir(buf),MY_CHARSET_INDEX); + strmov(get_charsets_dir(buf),filename); if ((fd=my_open(buf,O_RDONLY,myflags)) < 0) { @@ -313,7 +313,7 @@ static my_bool init_available_charsets(myf myflags) if (*cs) set_max_sort_char(*cs); } - error = read_charset_index(myflags); + error = read_charset_index(MY_CHARSET_INDEX,myflags); charset_initialized=1; pthread_mutex_unlock(&THR_LOCK_charset); } From 2d89861033074d5f801d7fc3a5720f20f9e03e6c Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 4 Jan 2003 15:17:16 +0200 Subject: [PATCH 135/220] Added support for max_allowed_packet in option files read by mysql_option() Extended max_allowed_packet for clients to 1G Fixed bug in sending compressed rows >= 16M Fix bug in skiping too long packets from clients. Added checking of wrong command number sent by client. include/mysql.h: Added max_allowed_packet as option parameter. include/mysql_com.h: Added COM_END to be able to check for wrong commands. libmysql/libmysql.c: Extended max_allowed_packet for clients to 1G Added support for max_allowed_packet in option files read by mysql_option() mysys/my_compress.c: Debugging output sql/net_pkg.cc: Fixed wrong handling of blobs >= 16M sql/net_serv.cc: Changed MAX_THREE_BYTES -> MAX_PACKET_LENGTH More DEBUG output and more comments Fixed bug in sending compressed rows >= 16M Optimized sending of big packets (fewer memcpy and compress data in bigger blocks) Fix bug in skiping too long packets from clients. (old code didn't always work for big packets) sql/sql_class.h: Changed type of variable sql/sql_parse.cc: Added checking of wrong command number sent by client. Changed handling of too big packets to make code safer tests/big_record.pl: E --- include/mysql.h | 1 + include/mysql_com.h | 16 +-- libmysql/libmysql.c | 14 ++- mysql-test/r/packet.result | 25 ++++ mysql-test/t/packet.test | 31 +++++ mysys/my_compress.c | 41 ++++--- sql/net_pkg.cc | 2 +- sql/net_serv.cc | 237 +++++++++++++++++++++++-------------- sql/sql_class.h | 2 +- sql/sql_parse.cc | 24 ++-- tests/big_record.pl | 57 +++++---- 11 files changed, 301 insertions(+), 149 deletions(-) create mode 100644 mysql-test/r/packet.result create mode 100644 mysql-test/t/packet.test diff --git a/include/mysql.h b/include/mysql.h index d581df91f64..8d497720a23 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -119,6 +119,7 @@ struct st_mysql_options { char *ssl_ca; /* PEM CA file */ char *ssl_capath; /* PEM directory of CA-s? */ char *ssl_cipher; /* cipher to use */ + unsigned long max_allowed_packet; my_bool use_ssl; /* if to use SSL or not */ my_bool compress,named_pipe; /* diff --git a/include/mysql_com.h b/include/mysql_com.h index a7e73405ac0..963c1212794 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -34,14 +34,14 @@ #define MYSQL_SERVICENAME "MySql" #endif /* __WIN__ */ -enum enum_server_command {COM_SLEEP,COM_QUIT,COM_INIT_DB,COM_QUERY, - COM_FIELD_LIST,COM_CREATE_DB,COM_DROP_DB,COM_REFRESH, - COM_SHUTDOWN,COM_STATISTICS, - COM_PROCESS_INFO,COM_CONNECT,COM_PROCESS_KILL, - COM_DEBUG,COM_PING,COM_TIME,COM_DELAYED_INSERT, - COM_CHANGE_USER, COM_BINLOG_DUMP, - COM_TABLE_DUMP, COM_CONNECT_OUT, - COM_REGISTER_SLAVE}; +enum enum_server_command { + COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST, + COM_CREATE_DB, COM_DROP_DB, COM_REFRESH, COM_SHUTDOWN, COM_STATISTICS, + COM_PROCESS_INFO, COM_CONNECT, COM_PROCESS_KILL, COM_DEBUG, COM_PING, + COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP, + COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE, + COM_END /* Must be last! */ +}; #define NOT_NULL_FLAG 1 /* Field can't be NULL */ #define PRI_KEY_FLAG 2 /* Field is part of a primary key */ diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 49c110c738d..152177c0fbe 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -60,7 +60,7 @@ static my_bool mysql_client_init=0; uint mysql_port=0; my_string mysql_unix_port=0; ulong net_buffer_length=8192; -ulong max_allowed_packet=16*1024*1024L; +ulong max_allowed_packet= 1024L*1024L*1024L; ulong net_read_timeout= NET_READ_TIMEOUT; ulong net_write_timeout= NET_WRITE_TIMEOUT; @@ -713,8 +713,8 @@ static const char *default_options[]= "character-sets-dir", "default-character-set", "interactive-timeout", "connect-timeout", "local-infile", "disable-local-infile", "replication-probe", "enable-reads-from-master", "repl-parse-query", - "ssl-cipher", - NullS + "ssl-cipher", "max-allowed-packet", + NullS }; static TYPELIB option_types={array_elements(default_options)-1, @@ -868,6 +868,9 @@ static void mysql_read_default_options(struct st_mysql_options *options, case 25: /* repl-parse-query */ options->rpl_parse= 1; break; + case 27: + options->max_allowed_packet= atoi(opt_arg); + break; default: DBUG_PRINT("warning",("unknown option: %s",option[0])); } @@ -1908,6 +1911,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, mysql->server_version,mysql->server_capabilities, mysql->server_status, client_flag)); + /* This needs to be changed as it's not useful with big packets */ int3store(buff+2,max_allowed_packet); if (user && user[0]) strmake(buff+5,user,32); /* Max user name */ @@ -1935,6 +1939,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, goto error; if (client_flag & CLIENT_COMPRESS) /* We will use compression */ net->compress=1; + if (mysql->options.max_allowed_packet) + net->max_packet_size= mysql->options.max_allowed_packet; if (db && mysql_select_db(mysql,db)) goto error; if (mysql->options.init_command) @@ -2302,7 +2308,7 @@ mysql_real_query(MYSQL *mysql, const char *query, ulong length) { DBUG_ENTER("mysql_real_query"); DBUG_PRINT("enter",("handle: %lx",mysql)); - DBUG_PRINT("query",("Query = \"%s\"",query)); + DBUG_PRINT("query",("Query = '%-.4096s'",query)); if (mysql_send_query(mysql,query,length)) DBUG_RETURN(-1); diff --git a/mysql-test/r/packet.result b/mysql-test/r/packet.result new file mode 100644 index 00000000000..e994e4d63da --- /dev/null +++ b/mysql-test/r/packet.result @@ -0,0 +1,25 @@ +set global max_allowed_packet=100; +set max_allowed_packet=100; +set global net_buffer_length=100; +set net_buffer_length=100; +SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; +len +1024 +select repeat('a',200); +repeat('a',200) +NULL +select @@net_buffer_length, @@max_allowed_packet; +@@net_buffer_length @@max_allowed_packet +1024 80 +SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; +Got a packet bigger than 'max_allowed_packet' +set global max_allowed_packet=default; +set max_allowed_packet=default; +set global net_buffer_length=default; +set net_buffer_length=default; +SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; +len +100 +select length(repeat('a',200)); +length(repeat('a',200)) +200 diff --git a/mysql-test/t/packet.test b/mysql-test/t/packet.test new file mode 100644 index 00000000000..5c4e7efcaf3 --- /dev/null +++ b/mysql-test/t/packet.test @@ -0,0 +1,31 @@ + +# +# Check protocol handling +# + +connect (con1,localhost,root,,); + +connection con1; +set global max_allowed_packet=100; +set max_allowed_packet=100; +set global net_buffer_length=100; +set net_buffer_length=100; +# Have to be > 1024 as min value of net_buffer_length is 1024 +SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; +# Should return NULL as 200 is bigger than max_allowed_packet +select repeat('a',200); + +# +# Connection 2 should get error for too big packets +# +connect (con2,localhost,root,,); +connection con2; +select @@net_buffer_length, @@max_allowed_packet; +--error 1153 +SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; +set global max_allowed_packet=default; +set max_allowed_packet=default; +set global net_buffer_length=default; +set net_buffer_length=default; +SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; +select length(repeat('a',200)); diff --git a/mysys/my_compress.c b/mysys/my_compress.c index 1e46584d525..dd076311188 100644 --- a/mysys/my_compress.c +++ b/mysys/my_compress.c @@ -32,24 +32,28 @@ my_bool my_compress(byte *packet, ulong *len, ulong *complen) { + DBUG_ENTER("my_compress"); if (*len < MIN_COMPRESS_LENGTH) + { *complen=0; + DBUG_PRINT("note",("Packet too short: Not compressed")); + } else { byte *compbuf=my_compress_alloc(packet,len,complen); if (!compbuf) - return *complen ? 0 : 1; + DBUG_RETURN(*complen ? 0 : 1); memcpy(packet,compbuf,*len); my_free(compbuf,MYF(MY_WME)); } - return 0; + DBUG_RETURN(0); } byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen) { byte *compbuf; - *complen = *len * 120 / 100 + 12; - if (!(compbuf = (byte *) my_malloc(*complen,MYF(MY_WME)))) + *complen= *len * 120 / 100 + 12; + if (!(compbuf= (byte *) my_malloc(*complen,MYF(MY_WME)))) return 0; /* Not enough memory */ if (compress((Bytef*) compbuf,(ulong *) complen, (Bytef*) packet, (uLong) *len ) != Z_OK) @@ -59,31 +63,36 @@ byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen) } if (*complen >= *len) { - *complen=0; - my_free(compbuf,MYF(MY_WME)); + *complen= 0; + my_free(compbuf, MYF(MY_WME)); + DBUG_PRINT("note",("Packet got longer on compression; Not compressed")); return 0; } - swap(ulong,*len,*complen); /* *len is now packet length */ + swap(ulong, *len, *complen); /* *len is now packet length */ return compbuf; } my_bool my_uncompress (byte *packet, ulong *len, ulong *complen) { + DBUG_ENTER("my_uncompress"); if (*complen) /* If compressed */ { - byte *compbuf = (byte *) my_malloc (*complen,MYF(MY_WME)); + byte *compbuf= (byte *) my_malloc(*complen,MYF(MY_WME)); + int error; if (!compbuf) - return 1; /* Not enough memory */ - if (uncompress((Bytef*) compbuf, complen, (Bytef*) packet, *len) != Z_OK) + DBUG_RETURN(1); /* Not enough memory */ + if ((error=uncompress((Bytef*) compbuf, complen, (Bytef*) packet, *len)) + != Z_OK) { /* Probably wrong packet */ - my_free (compbuf,MYF(MY_WME)); - return 1; + DBUG_PRINT("error",("Can't uncompress packet, error: %d",error)); + my_free(compbuf, MYF(MY_WME)); + DBUG_RETURN(1); } - *len = *complen; - memcpy(packet,compbuf,*len); - my_free(compbuf,MYF(MY_WME)); + *len= *complen; + memcpy(packet, compbuf, *len); + my_free(compbuf, MYF(MY_WME)); } - return 0; + DBUG_RETURN(0); } #endif /* HAVE_COMPRESS */ diff --git a/sql/net_pkg.cc b/sql/net_pkg.cc index 8bb601cebcf..afedba6a259 100644 --- a/sql/net_pkg.cc +++ b/sql/net_pkg.cc @@ -222,7 +222,7 @@ net_store_length(char *pkg, ulonglong length) } *packet++=254; int8store(packet,length); - return (char*) packet+9; + return (char*) packet+8; } char * diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 49454c9df2c..19f68e0b631 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -73,9 +73,9 @@ extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received; #include "thr_alarm.h" #define TEST_BLOCKING 8 -#define MAX_THREE_BYTES (256L*256L*256L-1) +#define MAX_PACKET_LENGTH (256L*256L*256L-1) -static int net_write_buff(NET *net,const char *packet,ulong len); +static my_bool net_write_buff(NET *net,const char *packet,ulong len); /* Init with packet info */ @@ -131,12 +131,16 @@ static my_bool net_realloc(NET *net, ulong length) { uchar *buff; ulong pkt_length; + DBUG_ENTER("net_realloc"); + DBUG_PRINT("enter",("length: %lu", length)); + if (length >= net->max_packet_size) { - DBUG_PRINT("error",("Packet too large (%lu)", length)); + DBUG_PRINT("error",("Packet too large. Max sixe: %lu", + net->max_packet_size)); net->error=1; net->last_errno=ER_NET_PACKET_TOO_LARGE; - return 1; + DBUG_RETURN(1); } pkt_length = (length+IO_SIZE-1) & ~(IO_SIZE-1); /* @@ -151,11 +155,11 @@ static my_bool net_realloc(NET *net, ulong length) #ifdef MYSQL_SERVER net->last_errno=ER_OUT_OF_RESOURCES; #endif - return 1; + DBUG_RETURN(1); } net->buff=net->write_pos=buff; net->buff_end=buff+(net->max_packet=pkt_length); - return 0; + DBUG_RETURN(0); } /* Remove unwanted characters from connection */ @@ -217,13 +221,13 @@ my_net_write(NET *net,const char *packet,ulong len) { uchar buff[NET_HEADER_SIZE]; /* - Big packets are handled by splitting them in packets of MAX_THREE_BYTES - length. The last packet is always a packet that is < MAX_THREE_BYTES. - (The last packet may even have a lengt of 0) + Big packets are handled by splitting them in packets of MAX_PACKET_LENGTH + length. The last packet is always a packet that is < MAX_PACKET_LENGTH. + (The last packet may even have a length of 0) */ - while (len >= MAX_THREE_BYTES) + while (len >= MAX_PACKET_LENGTH) { - const ulong z_size = MAX_THREE_BYTES; + const ulong z_size = MAX_PACKET_LENGTH; int3store(buff, z_size); buff[3]= (uchar) net->pkt_nr++; if (net_write_buff(net, (char*) buff, NET_HEADER_SIZE) || @@ -238,7 +242,7 @@ my_net_write(NET *net,const char *packet,ulong len) if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE)) return 1; DBUG_DUMP("packet_header",(char*) buff,NET_HEADER_SIZE); - return net_write_buff(net,packet,len); + return test(net_write_buff(net,packet,len)); } /* @@ -256,64 +260,107 @@ net_write_command(NET *net,uchar command,const char *packet,ulong len) ulong length=len+1; /* 1 extra byte for command */ uchar buff[NET_HEADER_SIZE+1]; uint header_size=NET_HEADER_SIZE+1; + DBUG_ENTER("net_write_command"); + DBUG_PRINT("enter",("length: %lu", len)); + buff[4]=command; /* For first packet */ - if (length >= MAX_THREE_BYTES) + if (length >= MAX_PACKET_LENGTH) { /* Take into account that we have the command in the first header */ - len= MAX_THREE_BYTES -1; + len= MAX_PACKET_LENGTH -1; do { - int3store(buff, MAX_THREE_BYTES); + int3store(buff, MAX_PACKET_LENGTH); buff[3]= (uchar) net->pkt_nr++; if (net_write_buff(net,(char*) buff, header_size) || net_write_buff(net,packet,len)) - return 1; + DBUG_RETURN(1); packet+= len; - length-= MAX_THREE_BYTES; - len=MAX_THREE_BYTES; - header_size=NET_HEADER_SIZE; - } while (length >= MAX_THREE_BYTES); + length-= MAX_PACKET_LENGTH; + len= MAX_PACKET_LENGTH; + header_size= NET_HEADER_SIZE; + } while (length >= MAX_PACKET_LENGTH); len=length; /* Data left to be written */ } int3store(buff,length); buff[3]= (uchar) net->pkt_nr++; - return test(net_write_buff(net,(char*) buff,header_size) || - net_write_buff(net,packet,len) || net_flush(net)); + DBUG_RETURN(test(net_write_buff(net,(char*) buff,header_size) || + net_write_buff(net,packet,len) || net_flush(net))); } /* Caching the data in a local buffer before sending it. - One can force the buffer to be flushed with 'net_flush'. + SYNOPSIS + net_write_buff() + net Network handler + packet Packet to send + len Length of packet + + DESCRIPTION + Fill up net->buffer and send it to the client when full. + + If the rest of the to-be-sent-packet is bigger than buffer, + send it in one big block (to avoid copying to internal buffer). + If not, copy the rest of the data to the buffer and return without + sending data. + + NOTES + The cached buffer can be sent as it is with 'net_flush()'. + + In this code we have to be careful to not send a packet longer than + MAX_PACKET_LENGTH to net_real_write() if we are using the compressed protocol + as we store the length of the compressed packet in 3 bytes. + + RETURN + 0 ok + 1 */ -static int +static my_bool net_write_buff(NET *net,const char *packet,ulong len) { - ulong left_length=(ulong) (net->buff_end - net->write_pos); + ulong left_length; + if (net->compress && net->max_packet > MAX_PACKET_LENGTH) + left_length= MAX_PACKET_LENGTH - (net->write_pos - net->buff); + else + left_length= (ulong) (net->buff_end - net->write_pos); if (len > left_length) { - memcpy((char*) net->write_pos,packet,left_length); - if (net_real_write(net,(char*) net->buff,net->max_packet)) - return 1; - net->write_pos=net->buff; - packet+=left_length; - len-= left_length; - left_length= net->max_packet; - - /* Send out rest of the blocks as full sized blocks */ - while (len > left_length) + if (net->write_pos != net->buff) { - if (net_real_write(net, packet, left_length)) + /* Fill up already used packet and write it */ + memcpy((char*) net->write_pos,packet,left_length); + if (net_real_write(net,(char*) net->buff, + (ulong) (net->write_pos - net->buff) + left_length)) return 1; + net->write_pos= net->buff; packet+= left_length; len-= left_length; } + if (net->compress) + { + /* + We can't have bigger packets than 16M with compression + Because the uncompressed length is stored in 3 bytes + */ + left_length= MAX_PACKET_LENGTH; + while (len > left_length) + { + if (net_real_write(net, packet, left_length)) + return 1; + packet+= left_length; + len-= left_length; + } + } + if (len > net->max_packet) + return net_real_write(net, packet, len) ? 1 : 0; + /* Send out rest of the blocks as full sized blocks */ } memcpy((char*) net->write_pos,packet,len); - net->write_pos+=len; + net->write_pos+= len; return 0; } @@ -364,11 +411,7 @@ net_real_write(NET *net,const char *packet,ulong len) memcpy(b+header_length,packet,len); if (my_compress((byte*) b+header_length,&len,&complen)) - { - DBUG_PRINT("warning", - ("Compression error; Continuing without compression")); complen=0; - } int3store(&b[NET_HEADER_SIZE],complen); int3store(b,len); b[3]=(uchar) (net->compress_pkt_nr++); @@ -469,28 +512,15 @@ net_real_write(NET *net,const char *packet,ulong len) *****************************************************************************/ #ifndef NO_ALARM -/* - Help function to clear the commuication buffer when we get a too - big packet -*/ -static void my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed) +static my_bool net_safe_read(NET *net, char *buff, uint32 length, + thr_alarm_t *alarmed) { - ALARM alarm_buff; uint retry_count=0; - my_bool old_mode; - uint32 old=remain; - - if (!thr_alarm_in_use(&alarmed)) + while (length > 0) { - if (!thr_alarm(alarmed,net->read_timeout,&alarm_buff) || - vio_blocking(net->vio, TRUE, &old_mode) < 0) - return; /* Can't setup, abort */ - } - while (remain > 0) - { - ulong length; - if ((int) (length=vio_read(net->vio,(char*) net->buff,remain)) <= 0L) + int tmp; + if ((tmp=vio_read(net->vio,(char*) net->buff, length)) <= 0) { my_bool interrupted = vio_should_retry(net->vio); if (!thr_got_alarm(&alarmed) && interrupted) @@ -498,17 +528,60 @@ static void my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed) if (retry_count++ < net->retry_count) continue; } - return; + return 1; } - remain -= (uint32) length; - if (!remain && old==MAX_THREE_BYTES && - (length=vio_read(net->vio,(char*) net->buff,NET_HEADER_SIZE))) - { - old=remain= uint3korr(net->buff); - net->pkt_nr++; - } - statistic_add(bytes_received,length,&LOCK_bytes_received); + length-= tmp; } + return 0; +} + +/* + Help function to clear the commuication buffer when we get a too big packet. + + SYNOPSIS + my_net_skip_rest() + net Communication handle + remain Bytes to read + alarmed Parameter for thr_alarm() + alarm_buff Parameter for thr_alarm() + + RETURN VALUES + 0 Was able to read the whole packet + 1 Got mailformed packet from client +*/ + +static my_bool my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed, + ALARM *alarm_buff) +{ + uint32 old=remain; + DBUG_ENTER("my_net_skip_rest"); + DBUG_PRINT("enter",("bytes_to_skip: %u", (uint) remain)); + + if (!thr_alarm_in_use(&alarmed)) + { + my_bool old_mode; + if (!thr_alarm(alarmed,net->read_timeout, alarm_buff) || + vio_blocking(net->vio, TRUE, &old_mode) < 0) + DBUG_RETURN(1); /* Can't setup, abort */ + } + for (;;) + { + while (remain > 0) + { + uint length= min(remain, net->max_packet); + if (net_safe_read(net, (char*) net->buff, length, alarmed)) + DBUG_RETURN(1); + statistic_add(bytes_received, length, &LOCK_bytes_received); + remain -= (uint32) length; + } + if (old != MAX_PACKET_LENGTH) + break; + if (net_safe_read(net, (char*) net->buff, NET_HEADER_SIZE, alarmed)) + DBUG_RETURN(1); + old=remain= uint3korr(net->buff); + net->pkt_nr++; + } + DBUG_RETURN(0); } #endif /* NO_ALARM */ @@ -607,9 +680,8 @@ my_real_read(NET *net, ulong *complen) continue; } #endif - DBUG_PRINT("error",("Couldn't read packet: remain: %lu errno: %d length: %ld alarmed: %d", - remain,vio_errno(net->vio), length, - thr_got_alarm(&alarmed))); + DBUG_PRINT("error",("Couldn't read packet: remain: %u errno: %d length: %ld", + remain, vio_errno(net->vio), length)); len= packet_error; net->error=2; /* Close socket */ #ifdef MYSQL_SERVER @@ -667,19 +739,12 @@ my_real_read(NET *net, ulong *complen) { if (net_realloc(net,helping)) { -#ifdef MYSQL_SERVER -#ifndef NO_ALARM - if (net->compress) - { - len= packet_error; - goto end; - } - my_net_skip_rest(net, (uint32) len, &alarmed); - len=0; -#endif -#else - len= packet_error; /* Return error */ +#if defined(MYSQL_SERVER) && !defined(NO_ALARM) + if (!net->compress && + !my_net_skip_rest(net, (uint32) len, &alarmed, &alarm_buff)) + net->error= 3; /* Successfully skiped packet */ #endif + len= packet_error; /* Return error and close connection */ goto end; } } @@ -723,7 +788,7 @@ my_net_read(NET *net) { #endif len = my_real_read(net,&complen); - if (len == MAX_THREE_BYTES) + if (len == MAX_PACKET_LENGTH) { /* First packet of a multi-packet. Concatenate the packets */ ulong save_pos = net->where_b; @@ -733,7 +798,7 @@ my_net_read(NET *net) net->where_b += len; total_length += len; len = my_real_read(net,&complen); - } while (len == MAX_THREE_BYTES); + } while (len == MAX_PACKET_LENGTH); if (len != packet_error) len+= total_length; net->where_b = save_pos; @@ -791,7 +856,7 @@ my_net_read(NET *net) else start_of_packet+= read_length + NET_HEADER_SIZE; - if (read_length != MAX_THREE_BYTES) /* last package */ + if (read_length != MAX_PACKET_LENGTH) /* last package */ { multi_byte_packet= 0; /* No last zero len packet */ break; diff --git a/sql/sql_class.h b/sql/sql_class.h index 8c4a7b83ebf..af80c3e31ac 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -358,7 +358,7 @@ public: uint client_capabilities; /* What the client supports */ /* Determines if which non-standard SQL behaviour should be enabled */ uint sql_mode; - uint max_client_packet_length; + ulong max_client_packet_length; ulong master_access; /* Global privileges from mysql.user */ ulong db_access; /* Privileges for current db */ diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 0f072a73ac6..599c31d43ca 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -75,7 +75,8 @@ const char *command_name[]={ "Sleep", "Quit", "Init DB", "Query", "Field List", "Create DB", "Drop DB", "Refresh", "Shutdown", "Statistics", "Processlist", "Connect","Kill","Debug","Ping","Time","Delayed_insert","Change user", - "Binlog Dump","Table Dump", "Connect Out", "Register Slave" + "Binlog Dump","Table Dump", "Connect Out", "Register Slave", + "Error" // Last command number }; bool volatile abort_slave = 0; @@ -209,7 +210,7 @@ static bool check_user(THD *thd,enum_server_command command, const char *user, !(thd->client_capabilities & CLIENT_LONG_PASSWORD),&ur); DBUG_PRINT("info", - ("Capabilities: %d packet_length: %d Host: '%s' User: '%s' Using password: %s Access: %u db: '%s'", + ("Capabilities: %d packet_length: %ld Host: '%s' User: '%s' Using password: %s Access: %u db: '%s'", thd->client_capabilities, thd->max_client_packet_length, thd->host_or_ip, thd->priv_user, passwd[0] ? "yes": "no", @@ -882,20 +883,22 @@ bool do_command(THD *thd) net_new_transaction(net); if ((packet_length=my_net_read(net)) == packet_error) { - DBUG_PRINT("info",("Got error reading command from socket %s", - vio_description(net->vio) )); - return TRUE; - } - else if (!packet_length) - { + DBUG_PRINT("info",("Got error %d reading command from socket %s", + net->error, + vio_description(net->vio))); + /* Check if we can continue without closing the connection */ + if (net->error != 3) + DBUG_RETURN(TRUE); // We have to close it. send_error(net,net->last_errno,NullS); - net->error=0; + net->error= 0; DBUG_RETURN(FALSE); } else { packet=(char*) net->read_pos; command = (enum enum_server_command) (uchar) packet[0]; + if (command >= COM_END) + command= COM_END; // Wrong command DBUG_PRINT("info",("Command on %s = %d (%s)", vio_description(net->vio), command, command_name[command])); @@ -1025,7 +1028,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, if (!(specialflag & SPECIAL_NO_PRIOR)) my_pthread_setprio(pthread_self(),QUERY_PRIOR); mysql_log.write(thd,command,"%s",thd->query); - DBUG_PRINT("query",("%s",thd->query)); + DBUG_PRINT("query",("%-.4096s",thd->query)); /* thd->query_length is set by mysql_parse() */ mysql_parse(thd,thd->query,packet_length); if (!(specialflag & SPECIAL_NO_PRIOR)) @@ -1223,6 +1226,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, case COM_CONNECT: // Impossible here case COM_TIME: // Impossible from client case COM_DELAYED_INSERT: + case COM_END: default: send_error(net, ER_UNKNOWN_COM_ERROR); break; diff --git a/tests/big_record.pl b/tests/big_record.pl index 52d3dca5f7b..08547b50823 100755 --- a/tests/big_record.pl +++ b/tests/big_record.pl @@ -1,58 +1,69 @@ #!/usr/bin/perl -# This is a test with stores big records in a blob +# This is a test with stores big records in a blob. # Note that for the default test the mysql server should have been -# started with at least 'mysqld -O max_allowed_packet=200k' - -$host= shift || ""; -$test_db="test"; -$opt_user=$opt_password=""; +# started with at least 'mysqld -O max_allowed_packet=30M' and you should have +# at least 256M memory in your computer. use DBI; -$|= 1; # Autoflush +use Getopt::Long; -$table="test_big_record"; -$rows=20; # Test of blobs up to ($rows-1)*10000+1 bytes +$opt_host=""; +$opt_user=$opt_password=""; +$opt_db="test"; +$opt_rows=200; # Test of blobs up to ($rows-1)*100000+1 bytes +$opt_compress=0; +$opt_table="test_big_record"; + +GetOptions("host=s","db=s","user=s", "password=s", "table=s", "rows=i", + "compress") || die "Aborted"; print "Connection to database $test_db\n"; -$dbh = DBI->connect("DBI:mysql:$test_db:$host",$opt_user,$opt_password) || die "Can't connect: $DBI::errstr\n"; +$extra_options=""; +$extra_options.=":mysql_compression=1" if ($opt_compress); -$dbh->do("drop table if exists $table"); +$dbh = DBI->connect("DBI:mysql:$opt_db:$host$extra_options",$opt_user,$opt_password) || die "Can't connect: $DBI::errstr\n"; -print "Creating table $table\n"; +$dbh->do("drop table if exists $opt_table"); + +print "Creating table $opt_table\n"; ($dbh->do("\ -CREATE TABLE $table ( +CREATE TABLE $opt_table ( auto int(5) unsigned NOT NULL DEFAULT '0' auto_increment, - test mediumblob, + test longblob, PRIMARY KEY (auto))")) or die $DBI::errstr; -print "Inserting $rows records\n"; +print "Inserting $opt_rows records\n"; -for ($i=0 ; $i < $rows ; $i++) +$|=1; # Flush output to stdout to be able to monitor process + +for ($i=0 ; $i < $opt_rows ; $i++) { - $tmp= chr(65+$i) x ($i*10000+1); + $tmp= chr(65+($i % 16)) x ($i*100000+1); + print $i," ",length($tmp),"\n"; $tmp= $dbh->quote($tmp); - $dbh->do("insert into $table (test) values ($tmp)") or die $DBI::errstr; + $dbh->do("insert into $opt_table (test) values ($tmp)") or die $DBI::errstr; } -print "Testing records\n"; +print "Reading records\n"; + +$sth=$dbh->prepare("select * from $opt_table", { "mysql_use_result" => 1}) or die $dbh->errstr; -$sth=$dbh->prepare("select * from $table") or die $dbh->errstr; $sth->execute() or die $sth->errstr; $i=0; while (($row = $sth->fetchrow_arrayref)) { print $row->[0]," ",length($row->[1]),"\n"; - die "Record $i had wrong data in blob" if ($row->[1] ne (chr(65+$i)) x ($i*10000+1)); + die "Record $i had wrong data in blob" if ($row->[1] ne (chr(65+($i % 16)) x ($i*100000+1))); $i++; } -die "Didn't get all rows from server" if ($i != $rows); +die "Didn't get all rows from server" if ($i != $opt_rows); -$dbh->do("drop table $table") or die $DBI::errstr; +$dbh->do("drop table $opt_table") or die $DBI::errstr; print "Test ok\n"; exit 0; From e229fe9801cc9fb7e3783cf708bc7cb695606c64 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 4 Jan 2003 15:37:20 +0200 Subject: [PATCH 136/220] Added support for DROP TEMPORARY TABLE Removed mysql_warnings() API function. Post merge fixes. client/mysqltest.c: Don't use mysql_warnings(). include/mysql.h: Removed mysql_warnings() API function libmysql/libmysql.c: Removed mysql_warnings() API function mysql-test/r/rpl_log_pos.result: Updated results mysql-test/t/connect.test: Removed empty lines mysql-test/t/rpl_log_pos.test: Update to new syntax sql/item.h: Fix after merge sql/item_create.cc: Fix after merge sql/mysql_priv.h: Added support for DROP TEMPORARY TABLE sql/sql_db.cc: Added support for DROP TEMPORARY TABLE sql/sql_parse.cc: SHOW WARNINGS now shows notes, warnings and errors. Support for DROP TEMPORARY TABLE Post merge fixes sql/sql_repl.cc: Post merge fixes sql/sql_table.cc: Added support for DROP TEMPORARY TABLE --- client/mysqltest.c | 11 ++++-- include/mysql.h | 1 - libmysql/libmysql.c | 12 ------ mysql-test/r/rpl_log_pos.result | 6 +-- mysql-test/t/connect.test | 2 - mysql-test/t/rpl_log_pos.test | 8 ++-- sql/item.h | 3 +- sql/item_create.cc | 3 +- sql/mysql_priv.h | 7 ++-- sql/sql_db.cc | 2 +- sql/sql_parse.cc | 29 +++++++++------ sql/sql_repl.cc | 8 ++-- sql/sql_table.cc | 66 +++++++++++++++++++++------------ 13 files changed, 89 insertions(+), 69 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 9d724404edc..6a637c0533c 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -2207,10 +2207,15 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags) /* Add all warnings to the result */ if (!disable_result_log && mysql_warning_count(mysql)) { - MYSQL_RES *warn_res= mysql_warnings(mysql); + MYSQL_RES *warn_res=0; + uint count= mysql_warning_count(mysql); + if (!mysql_real_query(mysql, "SHOW WARNINGS", 13)) + { + warn_res=mysql_store_result(mysql); + } if (!warn_res) - verbose_msg("Warning count is %d but didn't get any warnings\n", - mysql_warning_count(mysql)); + verbose_msg("Warning count is %u but didn't get any warnings\n", + count); else { dynstr_append_mem(ds, "Warnings:\n", 10); diff --git a/include/mysql.h b/include/mysql.h index 063d7227351..f9b8c1ecbb3 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -381,7 +381,6 @@ MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table, MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql); MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql); -MYSQL_RES * STDCALL mysql_warnings(MYSQL *mysql); int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg); void STDCALL mysql_free_result(MYSQL_RES *result); diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 8314b3bc24e..8cf59281719 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -3515,18 +3515,6 @@ uint STDCALL mysql_thread_safe(void) #endif } -MYSQL_RES *STDCALL mysql_warnings(MYSQL *mysql) -{ - uint warning_count; - DBUG_ENTER("mysql_warnings"); - /* Save warning count as mysql_real_query may change this */ - warning_count= mysql->warning_count; - if (mysql_real_query(mysql, "SHOW WARNINGS", 13)) - DBUG_RETURN(0); - mysql->warning_count= warning_count; - DBUG_RETURN(mysql_store_result(mysql)); -} - /**************************************************************************** Some support functions ****************************************************************************/ diff --git a/mysql-test/r/rpl_log_pos.result b/mysql-test/r/rpl_log_pos.result index 4ba3736604e..fa38e42ae73 100644 --- a/mysql-test/r/rpl_log_pos.result +++ b/mysql-test/r/rpl_log_pos.result @@ -10,9 +10,9 @@ master-bin.000001 79 show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space 127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 127 -slave stop; +stop slave; change master to master_log_pos=73; -slave start; +start slave; stop slave; change master to master_log_pos=73; show slave status; @@ -35,7 +35,7 @@ create table if not exists t1 (n int); drop table if exists t1; create table t1 (n int); insert into t1 values (1),(2),(3); -slave stop; +stop slave; change master to master_log_pos=79; start slave; select * from t1; diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test index 0bc5ca3914f..192d3eaf3e0 100644 --- a/mysql-test/t/connect.test +++ b/mysql-test/t/connect.test @@ -63,5 +63,3 @@ show tables; #--error 1045 #connect (con1,localhost,test,zorro,); #--error 1045 - - diff --git a/mysql-test/t/rpl_log_pos.test b/mysql-test/t/rpl_log_pos.test index 03c86137ae0..bc1349a959a 100644 --- a/mysql-test/t/rpl_log_pos.test +++ b/mysql-test/t/rpl_log_pos.test @@ -6,9 +6,9 @@ show master status; sync_slave_with_master; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT show slave status; -slave stop; +stop slave; change master to master_log_pos=73; -slave start; +start slave; sleep 5; stop slave; @@ -19,7 +19,7 @@ start slave; sleep 5; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT show slave status; -slave stop; +stop slave; change master to master_log_pos=173; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT start slave; @@ -34,7 +34,7 @@ create table t1 (n int); insert into t1 values (1),(2),(3); save_master_pos; connection slave; -slave stop; +stop slave; change master to master_log_pos=79; start slave; sync_with_master; diff --git a/sql/item.h b/sql/item.h index 1ea76731fd3..89867a8cdbd 100644 --- a/sql/item.h +++ b/sql/item.h @@ -381,7 +381,8 @@ public: name=(char*) str_value.ptr(); decimals=NOT_FIXED_DEC; } - Item_string(const char *name_par,const char *str,uint length,CHARSET_INFO *cs) + Item_string(const char *name_par,const char *str,uint length, + CHARSET_INFO *cs) { str_value.set(str,length,cs); max_length=length; diff --git a/sql/item_create.cc b/sql/item_create.cc index f277061394a..0dba7f6e3ae 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -311,7 +311,8 @@ Item *create_func_current_user() length= (uint) (strxmov(buff, thd->priv_user, "@", thd->host_or_ip, NullS) - buff); - return new Item_string("CURRENT_USER()", thd->memdup(buff, length), length); + return new Item_string("CURRENT_USER()", thd->memdup(buff, length), length, + default_charset_info); } Item *create_func_quarter(Item* a) diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index cf0cefd76da..3d5adf24e03 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -323,11 +323,12 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent); int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create); int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent); void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ushort flags); -int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists); +int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists, + my_bool drop_temporary); int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, - bool log_query); + bool drop_temporary, bool log_query); int mysql_rm_table_part2_with_lock(THD *thd, TABLE_LIST *tables, - bool if_exists, + bool if_exists, bool drop_temporary, bool log_query); int quick_rm_table(enum db_type base,const char *db, const char *table_name); diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 311bf29aee7..7ff4caf356c 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -468,7 +468,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, my_dirend(dirp); if (thd->killed || - (tot_list && mysql_rm_table_part2_with_lock(thd, tot_list, 1, 1))) + (tot_list && mysql_rm_table_part2_with_lock(thd, tot_list, 1, 0, 1))) DBUG_RETURN(-1); /* diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 6f8c53cede0..85658a93791 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -963,7 +963,7 @@ bool do_command(THD *thd) } else if (!packet_length) { - send_error(net,net->last_errno,NullS); + send_error(thd,net->last_errno,NullS); net->error=0; DBUG_RETURN(FALSE); } @@ -1629,7 +1629,9 @@ mysql_execute_command(THD *thd) { res= mysqld_show_warnings(thd, (ulong) ((1L << (uint) MYSQL_ERROR::WARN_LEVEL_NOTE) | - (1L << (uint) MYSQL_ERROR::WARN_LEVEL_WARN))); + (1L << (uint) MYSQL_ERROR::WARN_LEVEL_WARN) | + (1L << (uint) MYSQL_ERROR::WARN_LEVEL_ERROR) + )); break; } case SQLCOM_SHOW_ERRORS: @@ -1883,7 +1885,7 @@ mysql_execute_command(THD *thd) */ if (thd->locked_tables || thd->active_transaction()) { - send_error(&thd->net,ER_LOCK_OR_ACTIVE_TRANSACTION); + send_error(thd,ER_LOCK_OR_ACTIVE_TRANSACTION); break; } { @@ -2293,12 +2295,17 @@ mysql_execute_command(THD *thd) } case SQLCOM_DROP_TABLE: { - if (check_table_access(thd,DROP_ACL,tables)) - goto error; /* purecov: inspected */ - if (end_active_trans(thd)) - res= -1; - else - res = mysql_rm_table(thd,tables,lex->drop_if_exists); + if (!lex->drop_temporary) + { + if (check_table_access(thd,DROP_ACL,tables)) + goto error; /* purecov: inspected */ + if (end_active_trans(thd)) + { + res= -1; + break; + } + } + res= mysql_rm_table(thd,tables,lex->drop_if_exists, lex->drop_temporary); } break; case SQLCOM_DROP_INDEX: @@ -3777,9 +3784,9 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables) if (thd && !error_already_sent) { if (result) - send_error(&thd->net,0); + send_error(thd,0); else - send_ok(&thd->net); + send_ok(thd); } return result; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index c3c9d508bf6..5bdc15c2bf0 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -757,7 +757,7 @@ int reset_slave(THD *thd, MASTER_INFO* mi) err: unlock_slave_threads(mi); if (thd && error) - send_error(&thd->net, sql_errno, errmsg); + send_error(thd, sql_errno, errmsg); DBUG_RETURN(error); } @@ -802,7 +802,7 @@ int change_master(THD* thd, MASTER_INFO* mi) init_thread_mask(&thread_mask,mi,0 /*not inverse*/); if (thread_mask) // We refuse if any slave thread is running { - net_printf(&thd,ER_SLAVE_MUST_STOP); + net_printf(thd,ER_SLAVE_MUST_STOP); unlock_slave_threads(mi); DBUG_RETURN(1); } @@ -874,7 +874,7 @@ int change_master(THD* thd, MASTER_INFO* mi) 0 /* not only reset, but also reinit */, &errmsg)) { - net_printf(&thd, 0, "Failed purging old relay logs: %s",errmsg); + net_printf(thd, 0, "Failed purging old relay logs: %s",errmsg); unlock_slave_threads(mi); DBUG_RETURN(1); } @@ -908,7 +908,7 @@ int change_master(THD* thd, MASTER_INFO* mi) unlock_slave_threads(mi); thd->proc_info = 0; - send_ok(&thd); + send_ok(thd); DBUG_RETURN(0); } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 1ab84531e40..4848c374932 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -46,7 +46,8 @@ static int copy_data_between_tables(TABLE *from,TABLE *to, ** This will wait for all users to free the table before dropping it *****************************************************************************/ -int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists) +int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists, + my_bool drop_temporary) { int error; DBUG_ENTER("mysql_rm_table"); @@ -57,7 +58,7 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists) thd->mysys_var->current_cond= &COND_refresh; VOID(pthread_mutex_lock(&LOCK_open)); - if (global_read_lock) + if (!drop_temporary && global_read_lock) { if (thd->global_read_lock) { @@ -72,7 +73,7 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists) } } - error=mysql_rm_table_part2(thd,tables,if_exists,0); + error=mysql_rm_table_part2(thd,tables, if_exists, drop_temporary, 0); err: pthread_mutex_unlock(&LOCK_open); @@ -91,14 +92,15 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists) int mysql_rm_table_part2_with_lock(THD *thd, TABLE_LIST *tables, bool if_exists, - bool dont_log_query) + bool drop_temporary, bool dont_log_query) { int error; thd->mysys_var->current_mutex= &LOCK_open; thd->mysys_var->current_cond= &COND_refresh; VOID(pthread_mutex_lock(&LOCK_open)); - error=mysql_rm_table_part2(thd,tables, if_exists, dont_log_query); + error=mysql_rm_table_part2(thd,tables, if_exists, drop_temporary, + dont_log_query); pthread_mutex_unlock(&LOCK_open); VOID(pthread_cond_broadcast(&COND_refresh)); // Signal to refresh @@ -111,6 +113,17 @@ int mysql_rm_table_part2_with_lock(THD *thd, } /* + Execute the drop of a normal or temporary table + + SYNOPSIS + mysql_rm_table_part2() + thd Thread handler + tables Tables to drop + if_exists If set, don't give an error if table doesn't exists. + In this case we give an warning of level 'NOTE' + drop_temporary Only drop temporary tables + dont_log_query Don't log the query + TODO: When logging to the binary log, we should log tmp_tables and transactional tables as separate statements if we @@ -120,10 +133,15 @@ int mysql_rm_table_part2_with_lock(THD *thd, The current code only writes DROP statements that only uses temporary tables to the cache binary log. This should be ok on most cases, but not all. + + RETURN + 0 ok + 1 Error + -1 Thread was killed */ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, - bool dont_log_query) + bool drop_temporary, bool dont_log_query) { TABLE_LIST *table; char path[FN_REFLEN]; @@ -142,26 +160,28 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, continue; // removed temporary table } - abort_locked_tables(thd,db,table->real_name); - while (remove_table_from_cache(thd,db,table->real_name) && !thd->killed) - { - dropping_tables++; - (void) pthread_cond_wait(&COND_refresh,&LOCK_open); - dropping_tables--; - } - drop_locked_tables(thd,db,table->real_name); - if (thd->killed) - DBUG_RETURN(-1); - - /* remove form file and isam files */ - strxmov(path, mysql_data_home, "/", db, "/", table->real_name, reg_ext, - NullS); - (void) unpack_filename(path,path); error=0; + if (!drop_temporary) + { + abort_locked_tables(thd,db,table->real_name); + while (remove_table_from_cache(thd,db,table->real_name) && !thd->killed) + { + dropping_tables++; + (void) pthread_cond_wait(&COND_refresh,&LOCK_open); + dropping_tables--; + } + drop_locked_tables(thd,db,table->real_name); + if (thd->killed) + DBUG_RETURN(-1); - table_type=get_table_type(path); + /* remove form file and isam files */ + strxmov(path, mysql_data_home, "/", db, "/", table->real_name, reg_ext, + NullS); + (void) unpack_filename(path,path); - if (access(path,F_OK)) + table_type=get_table_type(path); + } + if (drop_temporary || access(path,F_OK)) { if (if_exists) store_warning(thd, ER_BAD_TABLE_ERROR, table->real_name); From 161c22cbfbc3ceefa3a17b275983e1675045ba55 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 4 Jan 2003 16:33:42 +0200 Subject: [PATCH 137/220] fixed SET with subselect mysql-test/r/subselect.result: test of SET with subselect mysql-test/t/subselect.test: test of SET with subselect --- mysql-test/r/subselect.result | 7 +++++++ mysql-test/t/subselect.test | 5 +++++ sql/sql_parse.cc | 9 ++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 38a8e0368c6..97191567cc9 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -848,6 +848,13 @@ do @a:=(SELECT a from t); select @a; @a 1 +set @a:=2; +set @a:=(SELECT a from t); +select @a; +@a +1 drop table t; do (SELECT a from t); Table 'test.t' doesn't exist +set @a:=(SELECT a from t); +Table 'test.t' doesn't exist diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index de07df1905b..608657e69d5 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -468,6 +468,11 @@ create table t (a int); insert into t values (1); do @a:=(SELECT a from t); select @a; +set @a:=2; +set @a:=(SELECT a from t); +select @a; drop table t; -- error 1146 do (SELECT a from t); +-- error 1146 +set @a:=(SELECT a from t); \ No newline at end of file diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index e74c7e35328..74c64232cec 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2470,9 +2470,16 @@ mysql_execute_command(THD *thd) break; } case SQLCOM_SET_OPTION: - if (!(res=sql_set_variables(thd, &lex->var_list))) + if (tables && ((res= check_table_access(thd, SELECT_ACL, tables)) || + (res= open_and_lock_tables(thd,tables)))) + break; + fix_tables_pointers(lex->all_selects_list); + if (!(res= sql_set_variables(thd, &lex->var_list))) send_ok(thd); + if (thd->net.report_error) + res= -1; break; + case SQLCOM_UNLOCK_TABLES: unlock_locked_tables(thd); if (thd->options & OPTION_TABLE_LOCK) From e6a76efa292528c97d5db18143d65c70623c4b4c Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 4 Jan 2003 20:33:17 +0500 Subject: [PATCH 138/220] Fix bug with shared memory's variables sql/mysql_priv.h: Fix bugs with shared memory's variables sql/mysqld.cc: Fix bugs with shared memory's variables --- sql/mysql_priv.h | 2 ++ sql/mysqld.cc | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 4d819ef6ae7..d89816a0dd9 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -708,6 +708,8 @@ extern my_bool opt_sql_bin_update, opt_safe_user_create, opt_no_mix_types; extern my_bool opt_safe_show_db, opt_local_infile, lower_case_table_names; extern my_bool opt_slave_compressed_protocol, use_temp_pool; extern my_bool opt_enable_named_pipe; +extern char *shared_memory_base_name; +extern bool opt_enable_shared_memory; extern char f_fyllchar; extern MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index b607bcdb3a1..01dadbb6223 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -345,8 +345,8 @@ arg_cmp_func Arg_comparator::comparator_matrix[4][2] = {&Arg_comparator::compare_int, &Arg_comparator::compare_e_int}, {&Arg_comparator::compare_row, &Arg_comparator::compare_e_row}}; #ifdef HAVE_SMEM -static char *shared_memory_base_name=default_shared_memory_base_name; -static bool opt_enable_shared_memory = 0; +char *shared_memory_base_name=default_shared_memory_base_name; +bool opt_enable_shared_memory = 0; #endif volatile ulong cached_thread_count=0; From 79fba6da8f099566bbf711b592aab60909b1f66d Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 4 Jan 2003 18:19:48 +0200 Subject: [PATCH 139/220] Changed shared lib version to 12 as some structures has changed --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 195cf6be4e1..9e3a8ffc516 100644 --- a/configure.in +++ b/configure.in @@ -10,7 +10,7 @@ AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 DOT_FRM_VERSION=6 # See the libtool docs for information on how to do shared lib versions. -SHARED_LIB_VERSION=11:0:0 +SHARED_LIB_VERSION=12:0:0 # Set all version vars based on $VERSION. How do we do this more elegant ? # Remember that regexps needs to quote [ and ] since this is run through m4 From 492f519035cbb6d942db323d1ff6d484d972379c Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 14:34:06 +0400 Subject: [PATCH 140/220] MacRoman.xml, MacCE.xml: new file --- sql/share/charsets/MacCE.xml | 209 ++++++++++++++++++++++++++++++++ sql/share/charsets/MacRoman.xml | 201 ++++++++++++++++++++++++++++++ 2 files changed, 410 insertions(+) create mode 100644 sql/share/charsets/MacCE.xml create mode 100644 sql/share/charsets/MacRoman.xml diff --git a/sql/share/charsets/MacCE.xml b/sql/share/charsets/MacCE.xml new file mode 100644 index 00000000000..fe64fd18abc --- /dev/null +++ b/sql/share/charsets/MacCE.xml @@ -0,0 +1,209 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 + 01 01 02 01 01 01 01 02 02 01 02 02 01 02 02 01 + 02 01 02 02 01 02 01 02 02 02 02 02 02 01 02 02 + 00 00 01 00 00 00 00 02 00 00 00 02 00 00 02 01 + 02 01 00 00 02 01 00 00 02 01 02 01 02 01 02 01 + 02 01 00 00 02 01 00 00 00 00 00 02 01 01 02 01 + 00 00 00 00 00 00 00 00 02 01 02 01 00 00 02 01 + 02 01 00 00 02 01 02 01 01 02 01 01 02 01 01 01 + 02 01 01 02 01 02 01 02 01 02 02 01 01 02 01 00 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 8A 82 82 8E 88 9A 9F 87 88 8B 8A 8B 8D 8D 8E 90 + 90 93 92 93 95 95 98 97 98 99 9A 9B 9C 9E 9E 9F + A0 A1 AB A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE B0 + B0 B4 B2 B3 B4 FA B6 B7 B8 BA BA BC BC BE BE C0 + C0 C4 C2 C3 C4 CB C6 C7 C8 C9 CA CB CE 9B CE D8 + D0 D1 D2 D3 D4 D5 D6 D7 D8 DA DA DE DC DD DE E0 + E0 E4 E2 E3 E4 E6 E6 87 E9 E9 92 EC EC F0 97 99 + F0 F3 9C F3 F5 F5 F7 F7 F9 F9 FA FD B8 FD AE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 81 83 84 85 86 E7 84 89 80 89 8C 8C 83 8F + 8F 91 EA 91 94 94 96 EE 96 EF 85 CD F2 9D 9D 86 + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA A2 AC AD FE AF + AF B1 B2 B3 B1 B5 B6 B7 FC B9 B9 BB BB BD BD BF + BF C1 C2 C3 C1 C5 C6 C7 C8 C9 CA C5 CC CD CC CF + D0 D1 D2 D3 D4 D5 D6 D7 CF D9 D9 DB DC DD DB DF + DF E1 E2 E3 E1 E5 E5 E7 E8 E8 EA EB EB ED EE EF + ED F1 F2 F1 F4 F4 F6 F6 F8 F8 B5 FB FC FB FE FF + + + + + + + 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F + 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F + 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F + 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F + 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F + 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F + 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F + 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F + 00C4 0100 0101 00C9 0104 00D6 00DC 00E1 0105 010C 00E4 010D 0106 0107 00E9 0179 + 017A 010E 00ED 010F 0112 0113 0116 00F3 0117 00F4 00F6 00F5 00FA 011A 011B 00FC + 2020 00B0 0118 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 0119 00A8 2260 0123 012E + 012F 012A 2264 2265 012B 0136 2202 2211 0142 013B 013C 013D 013E 0139 013A 0145 + 0146 0143 00AC 221A 0144 0147 2206 00AB 00BB 2026 00A0 0148 0150 00D5 0151 014C + 2013 2014 201C 201D 2018 2019 00F7 25CA 014D 0154 0155 0158 2039 203A 0159 0156 + 0157 0160 201A 201E 0161 015A 015B 00C1 0164 0165 00CD 017D 017E 016A 00D3 00D4 + 016B 016E 00DA 016F 0170 0171 0172 0173 00DD 00FD 0137 017B 0141 017C 0122 02C7 + + + + + + + 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 46 47 4A 4C 52 53 55 56 5A 5B 5D 62 62 67 + 6F 70 71 75 79 81 88 89 8A 8B 8D 90 91 92 93 94 + 95 41 46 47 4A 4C 52 53 55 56 5A 5B 5D 62 62 67 + 6F 70 71 75 79 81 88 89 8A 8B 8D 96 97 98 99 9A + 41 41 41 4C 41 67 81 41 41 47 41 47 47 47 4C 8D + 8D 4A 56 4A 4C 4C 4C 67 4C 67 67 67 81 4C 4C 81 + A0 A1 4C A3 A4 A5 A6 75 A8 A9 AA 4C AC AD 53 56 + 56 56 B2 B3 56 5B B6 B7 5D 5D 5D 5D 5D 5D 5D 62 + 62 62 C2 C3 62 62 C6 C7 C8 C9 CA 62 67 67 67 67 + D0 D1 D2 D3 D4 D5 D6 D7 67 71 71 71 DC DD 71 71 + 71 75 E2 E3 75 75 75 41 79 79 56 8D 8D 81 67 67 + 81 81 81 81 81 81 81 81 8B 8B 5B 8D 5D 8D 53 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D + 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D2 D3 D4 D5 D6 + D7 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D + 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D8 D9 DA DB DC + 41 41 41 57 41 8D B2 41 41 4D 41 4D 4D 4D 57 CA + CA 53 6B 53 57 57 57 8D 57 8D 8D 8D B2 57 57 B2 + DD DE 57 DF E0 E1 E2 A7 E3 E4 E5 57 E6 E7 65 6B + 6B 6B E8 E9 6B 75 EA EB 79 79 79 79 79 79 79 85 + 85 85 EC ED 85 85 EE EF F0 F1 F2 85 8D 8D 8D 8D + F3 F4 F5 F6 F7 F8 F9 FA 8D 9F 9F 9F FB FC 9F 9F + 9F A7 FD FE A7 A7 A7 41 BE BE 6B CA CA B2 8D 8D + B2 B2 B2 B2 B2 B2 B2 B2 C6 C6 75 CA 79 CA 65 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 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D + 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D2 D3 D4 D5 D6 + D7 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D + 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D8 D9 DA DB DC + 45 47 47 59 49 91 B6 43 49 4F 45 4F 51 51 59 CE + CE 55 71 55 5B 5B 5D 8F 5D 99 91 97 B8 5F 5F B6 + DD DE 61 DF E0 E1 E2 AD E3 E4 E5 61 E6 E7 67 6F + 6F 6D E8 E9 6D 77 EA EB 7B 81 82 7F 7F 7D 7D 8B + 8B 87 EC ED 87 89 EE EF F0 F1 F2 89 93 97 93 95 + F3 F4 F5 F6 F7 F8 F9 FA 95 A1 A1 A3 FB FC A3 A5 + A5 A9 FD FE A9 AB AB 43 B0 B0 71 CC CC BC 8F 99 + BC B4 B8 B4 BA BA BE BE C8 C8 77 D0 7B D0 67 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 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D + 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D2 D3 D4 D5 D6 + D7 42 4C 4E 54 58 64 66 6A 6C 74 76 7A 84 86 8E + 9C 9E A0 A8 AF B3 C1 C3 C5 C7 CB D8 D9 DA DB DC + 45 47 48 59 49 91 B6 44 4A 4F 46 50 51 52 5A CE + CF 55 72 56 5B 5C 5D 90 5E 9A 92 98 B8 5F 60 B7 + DD DE 61 DF E0 E1 E2 AD E3 E4 E5 62 E6 E7 68 6F + 70 6D E8 E9 6E 77 EA EB 7C 81 82 7F 80 7D 7E 8B + 8C 87 EC ED 88 89 EE EF F0 F1 F2 8A 93 97 94 95 + F3 F4 F5 F6 F7 F8 F9 FA 96 A1 A2 A3 FB FC A4 A5 + A6 A9 FD FE AA AB AC 43 B0 B1 71 CC CD BC 8F 99 + BD B4 B9 B5 BA BB BE BF C8 C9 78 D0 7B D1 67 FF + + + + + + + diff --git a/sql/share/charsets/MacRoman.xml b/sql/share/charsets/MacRoman.xml new file mode 100644 index 00000000000..b7e222edcac --- /dev/null +++ b/sql/share/charsets/MacRoman.xml @@ -0,0 +1,201 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 10 + 20 01 01 01 01 01 01 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 00 00 00 00 00 00 00 02 00 00 00 00 00 00 01 01 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 02 + 00 00 00 00 02 00 00 00 00 00 00 20 01 01 00 00 + 00 00 00 00 00 00 00 00 02 01 00 00 00 00 00 00 + 00 00 00 00 00 20 01 01 01 01 01 01 01 01 01 01 + 00 01 01 01 01 02 00 00 00 00 00 00 00 00 00 00 + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 8A 8C 8D 8E 96 9A 9F 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD BE BF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA 88 8B 9B CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D8 DA DB DC DD DE DF + E0 E1 E2 E3 E4 89 90 87 91 8F 92 94 95 93 97 99 + F0 98 9C 9E 9D F5 F6 F7 F8 F9 FA FB FC FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 E7 CB E5 80 CC 81 82 83 E9 + E6 E8 EA ED EB EC 84 EE F1 EF 85 CD F2 F4 F3 86 + 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 AE 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 D9 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 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + + + + + + + 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F + 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F + 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F + 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F + 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F + 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F + 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F + 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F + 00C4 00C5 00C7 00C9 00D1 00D6 00DC 00E1 00E0 00E2 00E4 00E3 00E5 00E7 00E9 00E8 + 00EA 00EB 00ED 00EC 00EE 00EF 00F1 00F3 00F2 00F4 00F6 00F5 00FA 00F9 00FB 00FC + 2020 00B0 00A2 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 00B4 00A8 2260 00C6 00D8 + 221E 00B1 2264 2265 00A5 00B5 2202 2211 220F 03C0 222B 00AA 00BA 03A9 00E6 00F8 + 00BF 00A1 00AC 221A 0192 2248 2206 00AB 00BB 2026 00A0 00C0 00C3 00D5 0152 0153 + 2013 2014 201C 201D 2018 2019 00F7 25CA 00FF 0178 2044 20AC 2039 203A FB01 FB02 + 2021 00B7 201A 201E 2030 00C2 00CA 00C1 00CB 00C8 00CD 00CE 00CF 00CC 00D3 00D4 + F8FF 00D2 00DA 00DB 00D9 0131 02C6 02DC 00AF 02D8 02D9 02DA 00B8 02DD 02DB 02C7 + + + + + + 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 49 50 52 53 57 59 60 61 67 68 69 70 71 72 + 79 80 81 82 84 85 90 91 92 93 95 A0 A1 A2 A3 A4 + A5 41 49 50 52 53 57 59 60 61 67 68 69 70 71 72 + 79 80 81 82 84 85 90 91 92 93 95 A6 A7 A8 A9 AA + 41 41 50 53 71 72 85 41 41 41 41 41 41 50 53 53 + 53 53 61 61 61 61 71 72 72 72 72 72 85 85 85 85 + AB AC AD AE AF B0 B1 82 B2 B3 B4 B5 B6 B7 48 72 + B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 48 72 + C6 C7 C8 C9 57 CA CB CC CD CE CF 41 41 72 D0 D1 + D2 D3 D4 D5 D6 D7 D8 D9 93 93 DA DB DC DD DE DF + E0 E1 E2 E3 E4 41 53 41 53 53 61 61 61 61 72 72 + F0 72 85 85 85 61 F6 F7 F8 F9 FA FB FC FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81 + 91 93 95 97 9A 9C A6 A8 AA AC B0 B2 B3 B4 B5 B6 + B7 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81 + 91 93 95 97 9A 9C A6 A8 AA AC B0 B8 B9 BA BB BC + 41 41 53 59 7D 81 9C 41 41 41 41 41 41 53 59 59 + 59 59 6A 6A 6A 6A 7D 81 81 81 81 81 9C 9C 9C 9C + BD BE BF C0 C1 C2 C3 97 C4 C5 C6 C7 C8 C9 41 81 + CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 41 81 + D8 D9 DA DB 63 DC DD DE DF E0 E1 41 41 81 81 81 + E2 E3 E4 E5 E6 E7 E8 E9 AC AC EA EB EC ED EE EF + F0 F1 F2 F3 F4 41 59 41 59 59 6A 6A 6A 6A 81 81 + F0 81 9C 9C 9C 6A F6 F7 F8 F9 FA FB FC FD FE 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 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81 + 91 93 95 97 9A 9C A6 A8 AA AC B0 B2 B3 B4 B5 B6 + B7 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81 + 91 93 95 97 9A 9C A6 A8 AA AC B0 B8 B9 BA BB BC + 4B 4D 55 5D 7F 8B A4 45 43 47 4B 49 4D 55 5D 5B + 5F 61 6E 6C 70 72 7F 85 83 87 8B 89 A0 9E A2 A4 + BD BE BF C0 C1 C2 C3 99 C4 C5 C6 C7 C8 C9 4F 8D + CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 4F 8D + D8 D9 DA DB 65 DC DD DE DF E0 E1 43 49 89 8F 8F + E2 E3 E4 E5 E6 E7 E8 E9 AE AE EA EB EC ED EE EF + F0 F1 F2 F3 F4 47 5F 45 61 5B 6E 70 70 6C 85 87 + F0 83 A0 A2 9E 72 F6 F7 F8 F9 FA FB FC FD FE 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 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81 + 91 93 95 97 9A 9C A6 A8 AA AC B0 B2 B3 B4 B5 B6 + B7 42 52 54 58 5A 64 67 69 6B 76 78 7A 7C 7E 82 + 92 94 96 98 9B 9D A7 A9 AB AD B1 B8 B9 BA BB BC + 4B 4D 55 5D 7F 8B A4 46 44 48 4C 4A 4E 56 5E 5C + 60 62 6F 6D 71 73 80 86 84 88 8C 8A A1 9F A3 A5 + BD BE BF C0 C1 C2 C3 99 C4 C5 C6 C7 C8 C9 4F 8D + CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 50 8E + D8 D9 DA DB 65 DC DD DE DF E0 E1 43 49 89 8F 90 + E2 E3 E4 E5 E6 E7 E8 E9 AF AE EA EB EC ED EE EF + F0 F1 F2 F3 F4 47 5F 45 61 5B 6E 70 72 6C 85 87 + F0 83 A0 A2 9E 74 F6 F7 F8 F9 FA FB FC FD FE FF + + + + + + From 9abb2bdef2e581ce4f5c0edfdec7ace686a3bab5 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 14:36:51 +0400 Subject: [PATCH 141/220] MacRoman.xml: charset name was wrong sql/share/charsets/MacRoman.xml: charset name was wrong --- sql/share/charsets/MacRoman.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/share/charsets/MacRoman.xml b/sql/share/charsets/MacRoman.xml index b7e222edcac..b17860f56b2 100644 --- a/sql/share/charsets/MacRoman.xml +++ b/sql/share/charsets/MacRoman.xml @@ -2,7 +2,7 @@ - + From 6a2e341d009c09ffd0dac0ebcd5511383818f863 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 14:47:15 +0400 Subject: [PATCH 142/220] latin1.xml: new file --- sql/share/charsets/latin1.xml | 233 ++++++++++++++++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 sql/share/charsets/latin1.xml diff --git a/sql/share/charsets/latin1.xml b/sql/share/charsets/latin1.xml new file mode 100644 index 00000000000..1b0c63cffc6 --- /dev/null +++ b/sql/share/charsets/latin1.xml @@ -0,0 +1,233 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 02 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 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 + + + + + + + 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F + 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F + 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F + 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F + 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F + 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F + 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F + 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F + 0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F + 0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F + 00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF + 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF + 00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF + 00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF + 00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF + 00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF + + + + + + + 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 5C 43 45 45 45 45 49 49 49 49 + 44 4E 4F 4F 4F 4F 5D D7 D8 55 55 55 59 59 DE DF + 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49 + 44 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 41 41 41 43 45 45 45 45 49 49 49 49 + D0 4E 4F 4F 4F 4F 4F D7 4F 55 55 55 55 59 DE 53 + 41 41 41 41 41 41 41 43 45 45 45 45 49 49 49 49 + D0 4E 4F 4F 4F 4F 4F F7 4F 55 55 55 55 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 5B 5D 5B 43 45 45 45 45 49 49 49 49 + 44 4E 4F 4F 4F 4F 5C D7 5C 55 55 55 59 59 DE DF + 41 41 41 41 5B 5D 5B 43 45 45 45 45 49 49 49 49 + 44 4E 4F 4F 4F 4F 5C F7 5C 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 51 53 57 5B 65 67 69 6B 75 77 79 7B 7D 81 + 8F 91 93 95 98 9A A4 A6 A8 AA AF B3 B4 B5 B6 B7 + B8 41 51 53 57 5B 65 67 69 6B 75 77 79 7B 7D 81 + 8F 91 93 95 98 9A A4 A6 A8 AA AF B9 BA BB BC BF + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + 43 45 47 49 4B 4D 4F 55 5D 5F 61 63 6D 6F 71 73 + 59 7F 83 85 87 89 8B BD 8D 9C 9E A0 A2 AC B1 97 + 43 45 47 49 4B 4D 4F 55 5D 5F 61 63 6D 6F 71 73 + 59 7F 83 85 87 89 8B BE 8D 9C 9E A0 A2 AC B1 AE + + + + + + + 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 51 53 57 5B 65 67 69 6B 75 77 79 7B 7D 81 + 8F 91 93 95 98 9A A4 A6 A8 AA AF B3 B4 B5 B6 B7 + B8 42 52 54 58 5C 66 68 6A 6C 76 78 7A 7C 7E 82 + 90 92 94 96 99 9B A5 A7 A9 AB B0 B9 BA BB BC BF + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + 43 45 47 49 4B 4D 4F 55 5D 5F 61 63 6D 6F 71 73 + 59 7F 83 85 87 89 8B BD 8D 9C 9E A0 A2 AC B1 97 + 44 46 48 4A 4C 4E 50 56 5E 60 62 64 6E 70 72 74 + 5A 80 84 86 88 8A 8C BE 8E 9D 9F A1 A3 AD B2 AE + + + + + + + From a7f79b18074f227269c56f2daf7bd48b931dfdc9 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 14:48:18 +0400 Subject: [PATCH 143/220] latin1.xml: charset name was empty sql/share/charsets/latin1.xml: charset name was empty --- sql/share/charsets/latin1.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/share/charsets/latin1.xml b/sql/share/charsets/latin1.xml index 1b0c63cffc6..c14e369454e 100644 --- a/sql/share/charsets/latin1.xml +++ b/sql/share/charsets/latin1.xml @@ -2,7 +2,7 @@ - + From 5b5fe119b6c168bad840f7654b59269c5ca4b2d1 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 14:52:48 +0400 Subject: [PATCH 144/220] latin2.xml: new file --- sql/share/charsets/latin2.xml | 167 ++++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 sql/share/charsets/latin2.xml diff --git a/sql/share/charsets/latin2.xml b/sql/share/charsets/latin2.xml new file mode 100644 index 00000000000..377ab19e8ad --- /dev/null +++ b/sql/share/charsets/latin2.xml @@ -0,0 +1,167 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 48 01 10 01 10 01 01 10 10 01 01 01 01 10 01 01 + 10 02 10 02 10 02 02 10 10 02 02 02 02 10 02 02 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 10 01 01 01 01 01 01 10 01 01 01 01 01 01 01 10 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 B1 A2 B3 A4 B5 B6 A7 A8 B9 BA BB BC AD BE BF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + D0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 A1 B2 A3 B4 A5 A6 B7 B8 A9 AA AB AC BD AE 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 DF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + F0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF + + + + + + +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F +0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F +0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F +00A0 0104 02D8 0141 00A4 013D 015A 00A7 00A8 0160 015E 0164 0179 00AD 017D 017B +00B0 0105 02DB 0142 00B4 013E 015B 02C7 00B8 0161 015F 0165 017A 02DD 017E 017C +0154 00C1 00C2 0102 00C4 0139 0106 00C7 010C 00C9 0118 00CB 011A 00CD 00CE 010E +0110 0143 0147 00D3 00D4 0150 00D6 00D7 0158 016E 00DA 0170 00DC 00DD 0162 00DF +0155 00E1 00E2 0103 00E4 013A 0107 00E7 010D 00E9 0119 00EB 011B 00ED 00EE 010F +0111 0144 0148 00F3 00F4 0151 00F6 00F7 0159 016F 00FA 0171 00FC 00FD 0163 02D9 + + + + + + + 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 44 45 48 49 4B 4C 4D 4E 4F 50 51 53 54 56 + 58 59 5A 5B 5E 5F 60 61 62 63 64 68 69 6A 6B 6C + 6D 41 44 45 48 49 4B 4C 4D 4E 4F 50 51 53 54 56 + 58 59 5A 5B 5E 5F 60 61 62 63 64 6E 6F 70 71 FF + FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + FF 42 FF 52 FF 51 5C FF FF 5D 5B 5E 65 FF 67 66 + FF 42 FF 52 FF 51 5C FF FF 5D 5B 5E 65 FF 67 66 + 5A 43 43 43 43 51 46 45 47 49 4A 49 49 4E 4E 48 + FF 55 54 57 56 56 56 FF 5A 5F 5F 5F 5F 63 5E FF + 5A 43 43 43 43 51 46 45 47 49 4A 49 49 4E 4E 48 + FF 55 54 57 56 56 56 FF 5A 5F 5F 5F 5F 63 5E 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 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 47 48 4C 4E 53 54 55 56 5A 5B 5C 60 61 64 + 69 6A 6B 6E 72 75 7A 7B 7C 7D 7F 83 84 85 86 87 + 88 41 47 48 4C 4E 53 54 55 56 5A 5B 5C 60 61 64 + 69 6A 6B 6E 72 75 7A 7B 7C 7D 7F 89 8A 8B 8C 00 + 01 78 4E 04 05 06 07 08 09 0A 67 67 56 56 0F 41 + 4E 12 13 67 67 64 78 75 78 67 78 1C 1D 1E 1F FF + 41 56 64 75 5E 6F FF 67 FF 70 71 73 80 FF 81 82 + FF 42 FF 5D FF 41 6F FF FF 70 71 73 80 FF 81 82 + 6C 41 44 45 46 5F 49 4B 4A 4E 51 52 50 56 57 4D + FF 62 63 64 66 67 67 FF 6D 77 75 78 78 7E 74 FF + 64 41 44 45 46 5F 49 4B 4A 4E 51 78 50 56 58 4D + FF 62 63 64 66 67 67 FF 6D 77 75 78 78 7E 74 FF + + + + + + + From a46857d36d088bd91b3d937a3eb4b9218a4d544d Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 15:02:50 +0400 Subject: [PATCH 145/220] cp1257.xml: new file --- sql/share/charsets/cp1257.xml | 229 ++++++++++++++++++++++++++++++++++ 1 file changed, 229 insertions(+) create mode 100644 sql/share/charsets/cp1257.xml diff --git a/sql/share/charsets/cp1257.xml b/sql/share/charsets/cp1257.xml new file mode 100644 index 00000000000..5ac2b746ff9 --- /dev/null +++ b/sql/share/charsets/cp1257.xml @@ -0,0 +1,229 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 01 00 01 00 00 00 00 01 + 00 00 00 00 00 00 00 00 02 00 02 00 00 00 00 02 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 00 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC 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 + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 BA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 BA BB BC BD BE 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 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 + + + + + + + 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F + 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F + 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F + 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F + 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F + 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F + 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F + 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F + 20AC 0000 201A 0000 201E 2026 2020 2021 0000 2030 0000 2039 0000 00A8 02C7 00B8 + 0000 2018 2019 201C 201D 2022 2013 2014 0000 2122 0000 203A 0000 00AF 02DB 0000 + 00A0 0000 00A2 00A3 00A4 0000 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6 + 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6 + 0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B + 0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF + 0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C + 0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 02D9 + + + + + + + 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 46 47 4A 4B 4C 4D 50 51 52 53 54 55 + 56 57 58 59 5B 5C 5F 60 61 4E FF 62 63 64 65 66 + 67 41 43 44 46 47 4A 4B 4C 4D 50 51 52 53 54 55 + 56 57 58 59 5B 5C 5F 60 61 4E FF 68 69 6A 6B FF + FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + 42 4F FF FF FF FF 48 FF 45 FF FF 49 FF FF FF FF + 5A FF FF FF FF FF FF FF 5E FF FF 5D FF FF FF FF + FF 4F FF FF FF FF 48 FF 45 FF FF 49 FF FF FF FF + 5A FF FF FF FF FF FF FF 5E FF FF 5D FF FF FF 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83 + 8F 91 93 97 9E A0 A8 AA AC AE B0 B8 B9 BA BB BC + BD 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83 + 8F 91 93 97 9E A0 A8 AA AC AE B0 BE BF C0 C1 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 DF E0 E1 E2 E3 E4 + E5 E6 E7 E8 E9 EA EB EC 83 ED 93 EE EF F0 F1 41 + F2 F3 F4 F5 F6 F7 F8 F9 83 FA 93 FB FC FD FE 41 + 41 69 41 4F 41 41 57 57 4F 57 B0 57 63 71 69 75 + 97 7D 7D 83 83 83 83 C2 A0 75 97 A0 A0 B0 B0 97 + 41 69 41 4F 41 41 57 57 4F 57 B0 57 63 71 69 75 + 97 7D 7D 83 83 83 83 C3 A0 75 97 A0 A0 B0 B0 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 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83 + 8F 91 93 97 9E A0 A8 AA AC AE B0 B8 B9 BA BB BC + BD 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83 + 8F 91 93 97 9E A0 A8 AA AC AE B0 BE BF C0 C1 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 DF E0 E1 E2 E3 E4 + E5 E6 E7 E8 E9 EA EB EC 85 ED 95 EE EF F0 F1 4B + F2 F3 F4 F5 F6 F7 F8 F9 85 FA 95 FB FC FD FE 4B + 43 6B 45 51 47 49 59 5B 53 5D B2 5F 65 73 6D 77 + 99 7F 81 87 89 8B 8D C2 A2 79 9B A4 A6 B4 B6 9D + 43 6B 45 51 47 49 59 5B 53 5D B2 5F 65 73 6D 77 + 99 7F 81 87 89 8B 8D C3 A2 79 9B A4 A6 B4 B6 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 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83 + 8F 91 93 97 9E A0 A8 AA AC AE B0 B8 B9 BA BB BC + BD 42 4E 50 56 58 62 64 68 6A 70 72 76 7C 7E 84 + 90 92 94 98 9F A1 A9 AB AD AF B1 BE BF C0 C1 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 DF E0 E1 E2 E3 E4 + E5 E6 E7 E8 E9 EA EB EC 85 ED 95 EE EF F0 F1 4B + F2 F3 F4 F5 F6 F7 F8 F9 86 FA 96 FB FC FD FE 4C + 43 6B 45 51 47 49 59 5B 53 5D B2 5F 65 73 6D 77 + 99 7F 81 87 89 8B 8D C2 A2 79 9B A4 A6 B4 B6 9D + 44 6C 46 52 48 4A 5A 5C 54 5E B3 60 66 74 6E 78 + 9A 80 82 88 8A 8C 8E C3 A3 7A 9C A5 A7 B5 B7 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 47 49 4D 4F 57 59 5D 5F 65 67 6B 6F 71 75 + 79 7B 7D 81 85 87 8D 8F 91 93 95 FF FF FF FF FF + FF 42 48 4A 4E 50 58 5A 5E 60 66 68 6C 70 72 76 + 7A 7C 7E 82 86 88 8E 90 92 94 96 FF FF FF FF FF + FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + FF FF FF FF FF FF FF FF FF FF 7F FF FF FF FF FF + FF FF FF FF FF FF FF FF FF FF 80 FF FF FF FF FF + 45 63 43 FF FF FF 53 51 4B FF FF 55 5B 69 61 6D + 83 FF 73 FF 77 FF FF FF 8B FF FF 89 FF 99 97 FF + 46 64 44 FF FF FF 54 52 4C FF FF 56 5C 6A 62 6E + 84 FF 74 FF 78 FF FF FF 8C FF FF 8A FF 9A 98 FF + + + + + + From 9bec592a021f8337afc49bcf93032aee227a9279 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 15:07:45 +0400 Subject: [PATCH 146/220] cp1251.xml: new file --- sql/share/charsets/cp1251.xml | 187 ++++++++++++++++++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 sql/share/charsets/cp1251.xml diff --git a/sql/share/charsets/cp1251.xml b/sql/share/charsets/cp1251.xml new file mode 100644 index 00000000000..18df824dc6b --- /dev/null +++ b/sql/share/charsets/cp1251.xml @@ -0,0 +1,187 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 + 01 01 00 02 00 00 00 00 00 00 01 00 01 01 01 01 + 02 00 00 00 00 00 00 00 00 00 02 00 02 02 02 02 + 00 01 02 01 00 01 00 00 01 00 01 00 00 00 00 01 + 00 00 01 02 02 00 00 00 02 00 02 00 02 01 02 02 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 90 83 82 83 84 85 86 87 88 89 9A 8B 9C 9D 9E 9F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A2 A2 BC A4 B4 A6 A7 B8 A9 BA AB AC AD AE BF + B0 B1 B3 B3 B4 B5 B6 B7 B8 B9 BA BB BC BE 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 F7 F8 F9 FA FB FC FD FE FF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 81 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 80 91 92 93 94 95 96 97 98 99 8A 9B 8C 9D 8E 8F + A0 A1 A1 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B2 A5 B5 B6 B7 A8 B9 AA BB A3 BD BD 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 DF + 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 DF + + + + + + + 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F + 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F + 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F + 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F + 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F + 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F + 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F + 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F + 0402 0403 201A 0453 201E 2026 2020 2021 0000 2030 0409 2039 040A 040C 040B 040F + 0452 2018 2019 201C 201D 2022 2013 2014 0000 2122 0459 203A 045A 045C 045B 045F + 00A0 040E 045E 0408 00A4 0490 00A6 00A7 0401 00A9 0404 00AB 00AC 00AD 00AE 0407 + 00B0 00B1 0406 0456 0491 00B5 00B6 00B7 0451 2116 0454 00BB 0458 0405 0455 0457 + 0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 041A 041B 041C 041D 041E 041F + 0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F + 0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F + 0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F + + + + + + + + 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7C 7D 7E 7F 80 + 81 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 82 83 84 85 FF + FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF + FF FF FF FF FF FF FF FF 61 FF FF FF FF FF FF FF + FF FF FF FF FF FF FF FF 61 FF FF FF FF FF FF FF + 5B 5C 5D 5E 5F 60 62 63 64 65 66 67 68 69 6A 6B + 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B + 5B 5C 5D 5E 5F 60 62 63 64 65 66 67 68 69 6A 6B + 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B + + + + + + + 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D + 5F 61 63 65 67 69 6B 6D 6F 71 73 D3 D4 D5 D6 D7 + D8 41 43 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D + 5F 61 63 65 67 69 6B 6D 6F 71 73 D9 DA DB DC DD + 81 83 DE 83 DF E0 E1 E2 E3 E4 A1 E5 A7 9D B3 C1 + 81 E6 E7 E8 E9 EA EB EC ED EE A1 EF A7 9D B3 C1 + F0 B7 B7 99 F1 7D F2 F3 87 F4 89 F5 F6 F7 F8 95 + F9 FA 93 93 7D FB FC FD 87 FE 89 FF 99 8F 8F 95 + 75 77 79 7B 7F 85 8B 8D 91 97 9B 9F A3 A5 A9 AB + AD AF B1 B5 B9 BB BD BF C3 C5 C7 C9 CB CD CF D1 + 75 77 79 7B 7F 85 8B 8D 91 97 9B 9F A3 A5 A9 AB + AD AF B1 B5 B9 BB BD BF C3 C5 C7 C9 CB CD CF D1 + + + + + + + 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 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D + 5F 61 63 65 67 69 6B 6D 6F 71 73 D3 D4 D5 D6 D7 + D8 42 44 46 48 4A 4C 4E 50 52 54 56 58 5A 5C 5E + 60 62 64 66 68 6A 6C 6E 70 72 74 D9 DA DB DC DD + 81 83 DE 84 DF E0 E1 E2 E3 E4 A1 E5 A7 9D B3 C1 + 82 E6 E7 E8 E9 EA EB EC ED EE A2 EF A8 9E B4 C2 + F0 B7 B8 99 F1 7D F2 F3 87 F4 89 F5 F6 F7 F8 95 + F9 FA 93 94 7E FB FC FD 88 FE 8A FF 9A 8F 90 96 + 75 77 79 7B 7F 85 8B 8D 91 97 9B 9F A3 A5 A9 AB + AD AF B1 B5 B9 BB BD BF C3 C5 C7 C9 CB CD CF D1 + 76 78 7A 7C 80 86 8C 8E 92 98 9C A0 A4 A6 AA AC + AE B0 B2 B6 BA BC BE C0 C4 C6 C8 CA CC CE D0 D2 + + + + + + + From 6715fc38f3474b4391810fe8a6a9db2ef3d372af Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 15:11:00 +0400 Subject: [PATCH 147/220] cp1251.xml: win1251ukr has been added sql/share/charsets/cp1251.xml: win1251ukr has been added --- sql/share/charsets/cp1251.xml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sql/share/charsets/cp1251.xml b/sql/share/charsets/cp1251.xml index 18df824dc6b..5421e3449da 100644 --- a/sql/share/charsets/cp1251.xml +++ b/sql/share/charsets/cp1251.xml @@ -182,6 +182,28 @@ + + + 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 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 C0 C1 C2 C3 C4 + C5 C6 C7 C8 C9 84 CA CB 88 CC 87 CD CE CF D0 8D + D1 D2 8C 8C 84 D3 D4 D5 88 D6 87 D7 D8 D9 DA 8D + 80 81 82 83 85 86 89 8A 8B 8E 8F 90 91 92 93 94 + 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 + 80 81 82 83 85 86 89 8A 8B 8E 8F 90 91 92 93 94 + 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 + + + + From db49a637196ae43f7954194077f059961e51b519 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 15:13:50 +0400 Subject: [PATCH 148/220] latin5.xml: new file --- sql/share/charsets/latin5.xml | 120 ++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 sql/share/charsets/latin5.xml diff --git a/sql/share/charsets/latin5.xml b/sql/share/charsets/latin5.xml new file mode 100644 index 00000000000..87ab65a6e2e --- /dev/null +++ b/sql/share/charsets/latin5.xml @@ -0,0 +1,120 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02 + + + + + + + 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 61 62 63 64 65 66 67 68 FD 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 69 FE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 DD 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 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 49 DE FF + + + + + + +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F +0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F +0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F +00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF +00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF +00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF +011E 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 0130 015E 00DF +00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF +011F 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 0131 015F 00FF + + + + + + + 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 45 46 47 48 4A 4B 4D 4E 4F 50 51 52 + 54 55 56 57 59 5A 5C 5D 5E 5F 60 61 62 63 64 65 + 66 41 42 43 45 46 47 48 4A 4C 4D 4E 4F 50 51 52 + 54 55 56 57 59 5A 5C 5D 5E 5F 60 87 88 89 8A 8B + 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B + 9C 9D 9E 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 C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB + CC CD CE CF D0 D1 D2 44 D3 D4 D5 D6 D7 D8 D9 DA + 49 DB DC DD DE DF 53 E0 E1 E2 E3 E4 5B 4C 58 E5 + CC CD CE CF D0 D1 D2 44 D3 D4 D5 D6 D7 D8 D9 DA + 49 DB DC DD DE DF 53 FA E1 E2 E3 E4 5B 4B 58 FF + + + + + + + From 7a0c78d4e652a2f82ba572751886b30fdbadd72f Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 15:19:58 +0400 Subject: [PATCH 149/220] latin7.xml: new file --- sql/share/charsets/latin7.xml | 168 ++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 sql/share/charsets/latin7.xml diff --git a/sql/share/charsets/latin7.xml b/sql/share/charsets/latin7.xml new file mode 100644 index 00000000000..eae4d501f44 --- /dev/null +++ b/sql/share/charsets/latin7.xml @@ -0,0 +1,168 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 01 20 10 20 10 10 00 00 20 10 20 10 20 10 10 10 + 20 10 10 10 10 10 10 10 20 00 20 10 20 10 10 20 + 48 20 10 10 10 20 10 10 10 10 01 10 10 10 10 01 + 10 10 10 10 10 10 10 10 10 10 02 10 10 10 10 02 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC 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 + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 A8 B9 AA BB BC BD BE 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 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 + + + + + + +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F +0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F +0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F +00A0 201D 00A2 00A3 00A4 201E 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6 +00B0 00B1 00B2 00B3 201C 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6 +0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B +0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF +0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C +0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 2019 + + + + + + + 00 02 03 04 05 06 07 08 09 2E 2F 30 31 32 0A 0B + 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B + 2C 33 34 35 36 37 38 27 39 3A 3B 5D 3C 28 3D 3E + 76 7A 7C 7E 80 81 82 83 84 85 3F 40 5E 5F 60 41 + 42 86 90 92 98 9A A4 A6 AA AC B2 B4 B8 BE C0 C6 + CE D0 D2 D6 E5 E8 EE F0 FA FC DD 43 44 45 46 47 + 48 87 91 93 99 9B A5 A7 AB AD B3 B5 B9 BF C1 C7 + CF D1 D3 D7 E6 E9 EF F1 FB FD DE 49 4A 4B 4C 1C + 01 1D 57 1E 5A 74 71 72 1F 75 20 5B 21 4E 52 51 + 22 55 56 58 59 73 2A 2B 23 E7 24 5C 25 4F 54 26 + 2D FE 66 67 68 FF 4D 69 CC 6A D4 62 6B 29 6C 8E + 6D 61 7D 7F 50 6E 6F 70 CD 7B D5 63 77 78 79 8F + 8C B0 88 94 F4 8A A2 A0 96 9C DF 9E A8 B6 AE BA + DB C2 C4 C8 CA F2 F6 64 EC BC D8 EA F8 E1 E3 DA + 8D B1 89 95 F5 8B A3 A1 97 9D E0 9F A9 B7 AF BB + DC C3 C5 C9 CB F3 F7 65 ED BD D9 EB F9 E2 E4 53 + + + + + + + + + 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 + 30 32 33 34 35 36 37 2B 38 39 3A 5C 3B 2C 3C 3D + 76 7A 7C 7E 80 81 82 83 84 85 3E 3F 5D 5E 5F 40 + 41 86 92 94 9A 9C A6 A8 AC AE B4 B6 BA C0 C2 C8 + D4 D6 D8 DC E3 E6 EE F0 F2 F4 F6 42 43 44 45 46 + 47 87 93 95 9B 9D A7 A9 AD AF B5 B7 BB C1 C3 C9 + D5 D7 D9 DD E4 E7 EF F1 F3 F5 F7 48 49 4A 4B 20 + 75 21 56 22 59 73 70 71 23 74 24 5A 25 4D 51 50 + 26 54 55 57 58 72 2E 2F 27 E5 28 5B 29 4E 53 2A + 31 FE 65 66 67 FF 4C 68 D3 69 DA 61 6A 2D 6B 90 + 6C 60 7D 7F 4F 6D 6E 6F D2 7B DB 62 77 78 79 91 + 8E B2 8A 96 88 8C A4 A2 98 9E F8 A0 AA B8 B0 BE + E1 C4 C6 CA CE D0 CC 63 EC BC DE EA E8 FA FC E0 + 8F B3 8B 97 89 8D A5 A3 99 9F F9 A1 AB B9 B1 BF + E2 C5 C7 CB CF D1 CD 64 ED BD DF EB E9 FB FD 52 + + + + + + + + + 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 + 30 32 33 34 35 36 37 2B 38 39 3A 5C 3B 2C 3C 3D + 76 7A 7C 7E 80 81 82 83 84 85 3E 3F 5D 5E 5F 40 + 41 86 92 94 9A 9C A6 A8 AC AE B4 B6 BA C0 C2 C8 + D4 D6 D8 DC E3 E6 EE F0 F2 F4 F6 42 43 44 45 46 + 47 86 92 94 9A 9C A6 A8 AC AE B4 B6 BA C0 C2 C8 + D4 D6 D8 DC E2 E6 EE F0 F2 F4 F6 48 49 4A 4B 20 + 75 21 56 22 59 73 70 71 23 74 24 5A 25 4D 51 50 + 26 54 55 57 58 72 2E 2F 27 E5 28 5B 29 4E 53 2A + 31 FE 65 66 67 FF 4C 68 2D 69 DA 61 6A 2D 6B 90 + 6C 60 7D 7F 4F 6D 6E 6F D3 7B DB 62 77 78 79 90 + 8E B2 8A 96 88 8C A4 A2 98 9E F8 A0 AA B8 B0 BE + E1 C4 C6 CA CE D0 CC 63 EC BC DE EA E8 FA FC E0 + 8E B2 8A 96 88 8C A4 A2 98 9E F8 A0 AA B8 B0 BE + E1 C4 C6 CA CE D0 CC 64 EC BC DE EA E8 FA FC 52 + + + + + + + From 1fec53cc4c3bdc5cec49d3b24639d00ba8ee023c Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 15:22:21 +0400 Subject: [PATCH 150/220] cp1256.xml: new file --- sql/share/charsets/cp1256.xml | 123 ++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 sql/share/charsets/cp1256.xml diff --git a/sql/share/charsets/cp1256.xml b/sql/share/charsets/cp1256.xml new file mode 100644 index 00000000000..4947839a728 --- /dev/null +++ b/sql/share/charsets/cp1256.xml @@ -0,0 +1,123 @@ + + + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 00 00 + 00 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 00 03 00 02 00 00 00 00 00 00 00 00 01 03 03 00 + 03 10 10 10 10 00 00 00 00 00 00 00 02 00 00 00 + 00 10 00 00 00 00 00 00 00 00 00 10 10 10 00 00 + 10 10 00 00 00 00 00 00 00 00 10 10 00 00 00 10 + 00 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 + 03 03 03 03 03 03 03 00 03 03 03 03 03 03 03 03 + 02 03 02 03 03 03 03 02 02 02 02 02 03 03 02 02 + 03 03 03 03 02 03 03 00 03 02 03 02 02 00 00 00 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 9C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5F 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7F 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 8C 9D 9E 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 + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + + + + + + + 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F + 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F + 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F + 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F + 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F + 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F + 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F + 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F + 20AC 067E 201A 0192 201E 2026 2020 2021 02C6 2030 0000 2039 0152 0686 0698 0000 + 06AF 2018 2019 201C 201D 2022 2013 2014 0000 2122 0000 203A 0153 200C 200D 0000 + 00A0 060C 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 0000 00AB 00AC 00AD 00AE 00AF + 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 061B 00BB 00BC 00BD 00BE 061F + 0000 0621 0622 0623 0624 0625 0626 0627 0628 0629 062A 062B 062C 062D 062E 062F + 0630 0631 0632 0633 0634 0635 0636 00D7 0637 0638 0639 063A 0640 0641 0642 0643 + 00E0 0644 00E2 0645 0646 0647 0648 00E7 00E8 00E9 00EA 00EB 0649 064A 00EE 00EF + 064B 064C 064D 064E 00F4 064F 0650 00F7 0651 00F9 0652 00FB 00FC 200E 200F 0000 + + + + + + + 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 45 47 4A 4C 52 55 57 59 5D 5F 61 63 65 67 + 6C 6E 70 72 74 76 7B 7D 7F 81 83 B9 BA BB BC BD + BE 41 45 47 4A 4C 52 55 57 59 5D 5F 61 63 65 67 + 6C 6E 70 72 74 76 7B 7D 7F 81 83 BF C0 C1 C2 C3 + C4 8E C5 54 C6 C7 C8 C9 CA CB CC CD 6A 92 99 CE + A5 CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 6A DA DB DC + DD B6 DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB + EC ED EE EF F0 F1 F2 F3 F4 F5 B7 F6 F7 F8 F9 B8 + FA 85 86 87 88 89 8A 8B 8C 8D 9F 90 91 93 94 95 + 96 97 98 9A 9B 9C 9D FB 9E 9F A0 A1 AD A2 A3 A4 + 43 A6 44 A7 A8 A9 AA 49 4E 4F 50 51 AB AC 5B 5C + AE AF B0 B1 69 B2 B3 FC B4 78 B5 79 7A FD FE FF + + + + + + + + From cd84555304296f4c3bcbccc405980765465b1208 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 15:27:57 +0400 Subject: [PATCH 151/220] pclatin2.xml, pclatin1.xml: new file Index.xml: pclatin1 sql/share/charsets/Index.xml: pclatin1 --- sql/share/charsets/Index.xml | 2 +- sql/share/charsets/pclatin1.xml | 119 ++++++++++++++++++++++++++++++++ sql/share/charsets/pclatin2.xml | 119 ++++++++++++++++++++++++++++++++ 3 files changed, 239 insertions(+), 1 deletion(-) create mode 100644 sql/share/charsets/pclatin1.xml create mode 100644 sql/share/charsets/pclatin2.xml diff --git a/sql/share/charsets/Index.xml b/sql/share/charsets/Index.xml index 9dd8b43f0b4..4dbd48f621f 100644 --- a/sql/share/charsets/Index.xml +++ b/sql/share/charsets/Index.xml @@ -61,7 +61,7 @@ To make maintaining easier please: cp850 cspc850multilingual ibm850 - + Dutch English French diff --git a/sql/share/charsets/pclatin1.xml b/sql/share/charsets/pclatin1.xml new file mode 100644 index 00000000000..742dcaec459 --- /dev/null +++ b/sql/share/charsets/pclatin1.xml @@ -0,0 +1,119 @@ + + + + + + + + + 00 + 20 30 30 30 30 30 30 20 20 28 28 28 28 28 30 30 + 30 30 30 30 30 30 30 30 30 30 20 30 30 30 30 30 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 30 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 01 01 + 01 02 01 02 02 02 02 02 02 01 01 10 10 10 10 10 + 02 02 02 02 02 01 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 20 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 87 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 84 86 + 82 91 91 93 94 95 96 97 98 94 81 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A4 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 + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 9A 90 41 8E 41 8F 80 45 45 45 49 49 49 8E 8F + 90 92 92 4F 99 4F 55 55 59 99 9A 9B 9C 9D 9E 9F + 41 49 4F 55 A5 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 + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + + + + + + +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000a 000b 000c 000d 000e 000f +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001a 001b 001c 001d 001e 001f +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002a 002b 002c 002d 002e 002f +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003a 003b 003c 003d 003e 003f +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004a 004b 004c 004d 004e 004f +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005a 005b 005c 005d 005e 005f +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006a 006b 006c 006d 006e 006f +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007a 007b 007c 007d 007e 007f +00c7 00fc 00e9 00e2 00e4 00e0 00e5 00e7 00ea 00eb 00e8 00ef 00ee 00ec 00c4 00c5 +00c9 00e6 00c6 00f4 00f6 00f2 00fb 00f9 00ff 00d6 00dc 00a2 00a3 00a5 20a7 0192 +00e1 00ed 00f3 00fa 00f1 00d1 00aa 00ba 00bf 2310 00ac 00bd 00bc 00a1 00ab 00bb +2591 2592 2593 2502 2524 2561 2562 2556 2555 2563 2551 2557 255d 255c 255b 2510 +2514 2534 252c 251c 2500 253c 255e 255f 255a 2554 2569 2566 2560 2550 256c 2567 +2568 2564 2565 2559 2558 2552 2553 256b 256a 2518 250c 2588 2584 258c 2590 2580 +03b1 00df 0393 03c0 03a3 03c3 00b5 03c4 03a6 0398 03a9 03b4 221e 03c6 03b5 2229 +2261 00b1 2265 2264 2320 2321 00f7 2248 00b0 2219 00b7 221a 207f 00b2 25a0 00a0 + + + + + + + 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 43 59 45 41 5C 41 5B 43 45 45 45 49 49 49 5C 5B + 45 5C 5C 4F 5D 4F 55 55 59 5D 59 24 24 24 24 24 + 41 49 4F 55 4E 4E A6 A7 3F A9 AA AB AC 21 22 22 + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + + + + + + diff --git a/sql/share/charsets/pclatin2.xml b/sql/share/charsets/pclatin2.xml new file mode 100644 index 00000000000..4402edcd847 --- /dev/null +++ b/sql/share/charsets/pclatin2.xml @@ -0,0 +1,119 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 + 01 02 02 02 02 02 02 02 02 02 01 02 02 01 01 01 + 01 01 02 02 02 01 02 01 02 01 01 01 02 01 00 02 + 02 02 02 02 01 02 01 02 01 02 00 02 01 01 00 00 + 00 00 00 00 00 01 01 01 02 00 00 00 00 01 02 00 + 00 00 00 00 00 00 01 02 00 00 00 00 00 00 00 00 + 02 01 01 01 02 01 01 01 02 00 00 00 00 01 01 00 + 01 02 01 01 02 02 01 02 01 01 02 01 02 01 02 00 + 00 00 00 00 00 00 00 00 00 00 00 02 01 02 00 48 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 87 81 82 83 84 85 86 87 88 89 8B 8B 8C AB 84 86 + 82 92 92 93 94 96 96 98 98 94 81 9C 9C 88 9E 9F + A0 A1 A2 A3 A5 A5 A7 A7 A9 A9 AA AB 9F B8 AE AF + B0 B1 B2 B3 B4 A0 83 D8 B8 B9 BA BB BC BE BE BF + C0 C1 C2 C3 C4 C5 C7 C7 C8 C9 CA CB CC CD CE CF + D0 D0 D4 89 D4 E5 A1 8C D8 D9 DA DB DC EE 85 DF + A2 E1 93 E4 E4 E5 E7 E7 EA A3 E8 FB EC EC EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 9A 90 B6 8E DE 8F 80 9D D3 8A 8A D7 8D 8E 8F + 90 91 91 E2 99 95 95 97 97 99 9A 9B 9B 9D 9E AC + B5 D6 E0 E9 A4 A4 A6 A6 A8 A8 AA 8D AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 AD B9 BA BB BC BE BD BF + C0 C1 C2 C3 C4 C5 C6 C6 C8 C9 CA CB CC CD CE CF + D1 D1 D2 D3 D2 D5 D6 D7 B7 D9 DA DB DC DD DE DF + E0 E1 E2 E3 E3 D5 E6 E6 E8 E9 E8 EB ED ED DD EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA EB FC FC FE FF + + + + + + + 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F + 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F + 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F + 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F + 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F + 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F + 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F + 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F + 00C7 00FC 00E9 00E2 00E4 016F 0107 00E7 0142 00EB 0150 0151 00EE 0179 00C4 0106 + 00C9 0139 013A 00F4 00F6 013D 013E 015A 015B 00D6 00DC 0164 0165 0141 00D7 010D + 00E1 00ED 00F3 00FA 0104 0105 017D 017E 0118 0119 00AC 017A 010C 015F 00AB 00BB + 2591 2592 2593 2502 2524 00C1 00C2 011A 015E 2563 2551 2557 255D 017B 017C 2510 + 2514 2534 252C 251C 2500 253C 0102 0103 255A 2554 2569 2566 2560 2550 256C 00A4 + 0111 0110 010E 00CB 010F 0147 00CD 00CE 011B 2518 250C 2588 2584 0162 016E 2580 + 00D3 00DF 00D4 0143 0144 0148 0160 0161 0154 00DA 0155 0170 00FD 00DD 0163 00B4 + 00AD 02DD 02DB 02C7 02D8 00A7 00F7 00B8 00B0 00A8 02D9 0171 0158 0159 25A0 00A0 + + + + + + + 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 47 48 4C 4F 54 55 56 57 5A 5B 5C 5E 5F 62 + 67 68 69 6C 71 74 75 76 77 78 7B 90 91 92 93 94 + 95 41 47 48 4C 4F 54 55 56 57 5A 5B 5C 5E 5F 62 + 67 68 69 6C 71 74 75 76 77 78 7B 96 97 98 99 9A + 48 74 4F 41 41 74 48 48 5C 4F 62 62 57 7B 41 48 + 4F 5C 5C 62 62 5C 5C 6C 6C 62 74 71 71 5C 9E 48 + 41 57 62 74 41 41 7B 7B 4F 4F AA 7B 48 6C AE AF + B0 B1 B2 B3 B4 41 41 4F 6C B5 BA BB BC 7B 7B BF + C0 C1 C2 C3 C4 C5 41 41 C8 C9 CA CB CC CD CE CF + 4C 4C 4C 4F 4C 60 57 57 4F D9 DA DB DC 71 74 DF + 62 70 62 60 60 60 6C 6C 69 74 69 74 78 78 71 EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA 74 69 69 FE FF + + + + + + From 94873871e2aff5ecbe1cf6470f986ceba5bb3745 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 15:30:02 +0400 Subject: [PATCH 152/220] ctype-win1250ch.c: cp1250_czech , strings/ctype-win1250ch.c: cp1250_czech , --- strings/ctype-win1250ch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c index 0bc63ab07cc..358cede442c 100644 --- a/strings/ctype-win1250ch.c +++ b/strings/ctype-win1250ch.c @@ -624,7 +624,7 @@ CHARSET_INFO my_charset_win1250ch = 34, /* number */ MY_CS_COMPILED, /* state */ "cp1250", /* cs name */ - "win1250ch", /* name */ + "cp1250_czech", /* name */ "", /* comment */ ctype_win1250ch, to_lower_win1250ch, From 9c2e873c0b76e24a5a9223c95dd4b3992e5b5e66 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 15:31:26 +0400 Subject: [PATCH 153/220] cp1250 --- strings/ctype.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strings/ctype.c b/strings/ctype.c index 5869ee804c6..e49c0b6614f 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -3673,7 +3673,7 @@ static CHARSET_INFO compiled_charsets[] = { 26, /* number */ MY_CS_COMPILED, /* state */ "cp1250", /* cs name */ - "win1250", /* name */ + "cp1250", /* name */ "", /* comment */ ctype_win1250, to_lower_win1250, From 1e4525cf4b83c1189ab1b008bf21ff460085e099 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 15:34:29 +0400 Subject: [PATCH 154/220] cp1250.xml: new file Index.xml: win1250 -> cp1250 sql/share/charsets/Index.xml: win1250 -> cp1250 --- sql/share/charsets/Index.xml | 4 +- sql/share/charsets/cp1250.xml | 121 ++++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 sql/share/charsets/cp1250.xml diff --git a/sql/share/charsets/Index.xml b/sql/share/charsets/Index.xml index 4dbd48f621f..8f472d83fe4 100644 --- a/sql/share/charsets/Index.xml +++ b/sql/share/charsets/Index.xml @@ -256,7 +256,7 @@ To make maintaining easier please: Central European ms-ce windows-1250 - + Hungarian Polish Romanian @@ -265,7 +265,7 @@ To make maintaining easier please: Slovenian Sorbian - + diff --git a/sql/share/charsets/cp1250.xml b/sql/share/charsets/cp1250.xml new file mode 100644 index 00000000000..a863aceffc9 --- /dev/null +++ b/sql/share/charsets/cp1250.xml @@ -0,0 +1,121 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 20 20 10 20 10 10 10 10 20 10 01 10 01 01 01 01 + 20 10 10 10 10 10 10 10 20 10 02 10 02 02 02 02 + 48 10 10 01 10 01 10 01 10 10 01 10 10 10 10 01 + 10 10 10 02 10 10 10 10 10 02 02 10 01 10 02 02 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 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 + 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 + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 8A 9B 8C 8D 8E 8F + 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 + 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 + + + + + + +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F +20AC 0000 201A 0000 201E 2026 2020 2021 0000 2030 0160 2039 015A 0164 017D 0179 +0000 2018 2019 201C 201D 2022 2013 2014 0000 2122 0161 203A 015B 0165 017E 017A +00A0 02C7 02D8 0141 00A4 0104 00A6 00A7 00A8 00A9 015E 00AB 00AC 00AD 00AE 017B +00B0 00B1 02DB 0142 00B4 00B5 00B6 00B7 00B8 0105 015F 00BB 013D 02DD 013E 017C +0154 00C1 00C2 0102 00C4 0139 0106 00C7 010C 00C9 0118 00CB 011A 00CD 00CE 010E +0110 0143 0147 00D3 00D4 0150 00D6 00D7 0158 016E 00DA 0170 00DC 00DD 0162 00DF +0155 00E1 00E2 0103 00E4 013A 0107 00E7 010D 00E9 0119 00EB 011B 00ED 00EE 010F +0111 0144 0148 00F3 00F4 0151 00F6 00F7 0159 016F 00FA 0171 00FC 00FD 0163 02D9 + + + + + + + 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 49 4A 4B 4C 4D 4E 4F 50 52 53 55 + 56 57 58 59 5B 5C 5D 5E 5F 60 61 63 64 65 66 67 + 68 41 42 43 46 49 4A 4B 4C 4D 4E 4F 50 52 53 55 + 56 57 58 59 5B 5C 5D 5E 5F 60 61 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 5A 8B 5A 5B 62 62 + 90 91 92 93 94 95 96 97 98 99 5A 9B 5A 5B 62 62 + 20 A1 A2 50 A4 41 A6 59 A8 A9 59 AB AC AD AE 62 + B0 B1 B2 50 B4 B5 B6 B7 B8 41 59 BB 50 BD 50 62 + 58 41 41 41 41 50 45 43 44 49 49 49 49 4D 4D 46 + 47 53 53 55 55 55 55 D7 58 5C 5C 5C 5C 60 5B 59 + 58 41 41 41 41 50 45 43 44 49 49 49 49 4D 4D 46 + 47 53 53 55 55 55 55 F7 58 5C 5C 5C 5C 60 5B FF + + + + + + + + From c862dad75c3e947b377bedaeb245650c3a0ab7de Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 15:38:43 +0400 Subject: [PATCH 155/220] swe7.xml, ascii.xml: new file Index.xml: usa7 -> ascii sql/share/charsets/Index.xml: usa7 -> ascii --- sql/share/charsets/Index.xml | 2 +- sql/share/charsets/ascii.xml | 119 ++++++++++++++++++++++++++++++++++ sql/share/charsets/swe7.xml | 121 +++++++++++++++++++++++++++++++++++ 3 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 sql/share/charsets/ascii.xml create mode 100644 sql/share/charsets/swe7.xml diff --git a/sql/share/charsets/Index.xml b/sql/share/charsets/Index.xml index 8f472d83fe4..adea783defc 100644 --- a/sql/share/charsets/Index.xml +++ b/sql/share/charsets/Index.xml @@ -145,7 +145,7 @@ To make maintaining easier please: csascii iso-ir-6 iso646-us - + diff --git a/sql/share/charsets/ascii.xml b/sql/share/charsets/ascii.xml new file mode 100644 index 00000000000..67ab57de88f --- /dev/null +++ b/sql/share/charsets/ascii.xml @@ -0,0 +1,119 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + + + + + + +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 + + + + + + + 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 5E 5F + 45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 59 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + + + + + + diff --git a/sql/share/charsets/swe7.xml b/sql/share/charsets/swe7.xml new file mode 100644 index 00000000000..ffa1d90608d --- /dev/null +++ b/sql/share/charsets/swe7.xml @@ -0,0 +1,121 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 01 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 10 + 01 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 20 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + + + + + + + 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 + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 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 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + + + + + + +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +00C9 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 00C4 00D6 00C5 00DC 005F +00E9 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 00E4 00F6 00E5 00FC 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 + + + + + + + 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 + 45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 59 5F + 45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 59 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + + + + + + + + From a50f05749d2c4d2fec51d9f18e2a687cd596e3f1 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 15:50:41 +0400 Subject: [PATCH 156/220] dec8.xml, armscii8.xml, cp866.xml: new file --- sql/share/charsets/armscii8.xml | 119 +++++++++++++++++++++++++++++++ sql/share/charsets/cp866.xml | 122 ++++++++++++++++++++++++++++++++ sql/share/charsets/dec8.xml | 121 +++++++++++++++++++++++++++++++ 3 files changed, 362 insertions(+) create mode 100644 sql/share/charsets/armscii8.xml create mode 100644 sql/share/charsets/cp866.xml create mode 100644 sql/share/charsets/dec8.xml diff --git a/sql/share/charsets/armscii8.xml b/sql/share/charsets/armscii8.xml new file mode 100644 index 00000000000..99ab5eb336d --- /dev/null +++ b/sql/share/charsets/armscii8.xml @@ -0,0 +1,119 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 01 02 01 02 01 02 01 02 01 02 01 02 01 02 + 01 02 01 02 01 02 01 02 01 02 01 02 01 02 01 02 + 01 02 01 02 01 02 01 02 01 02 01 02 01 02 01 02 + 01 02 01 02 01 02 01 02 01 02 01 02 01 02 01 02 + 01 02 01 02 01 02 01 02 01 02 01 02 01 02 10 10 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 AA AB AC AD AE AF + B0 B1 B3 B3 B5 B5 B7 B7 B9 B9 BB BB BD BD BF BF + C1 C1 C3 C3 C5 C5 C7 C7 C9 C9 CB CB CD CD CF CF + D1 D1 D3 D3 D5 D5 D7 D7 D9 D9 DB DB DD DD DF DF + E1 E1 E3 E3 E5 E5 E7 E7 E9 E9 EB EB ED ED EF EF + F1 F1 F3 F3 F5 F5 F7 F7 F9 F9 FB FB FD FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B2 B4 B4 B6 B6 B8 B8 BA BA BC BC BE BE + C0 C0 C2 C2 C4 C4 C6 C6 C8 C8 CA CA CC CC CE CE + D0 D0 D2 D2 D4 D4 D6 D6 D8 D8 DA DA DC DC DE DE + E0 E0 E2 E2 E4 E4 E6 E6 E8 E8 EA EA EC EC EE EE + F0 F0 F2 F2 F4 F4 F6 F6 F8 F8 FA FA FC FC FE FF + + + + + + +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F +0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F +0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F +00A0 2741 00A7 0589 0029 0028 00BB 00AB 2014 002E 055D 002C 002D 055F 2026 055C +055B 055E 0531 0561 0532 0562 0533 0563 0534 0564 0535 0565 0536 0566 0537 0567 +0538 0568 0539 0569 053A 056A 053B 056B 053C 056C 053D 056D 053E 056E 053F 056F +0540 0570 0541 0571 0542 0572 0543 0573 0544 0574 0545 0575 0546 0576 0547 0577 +0548 0578 0549 0579 054A 057A 054B 057B 054C 057C 054D 057D 054E 057E 054F 057F +0550 0580 0551 0581 0552 0582 0553 0583 0554 0584 0555 0585 0556 0586 2019 0027 + + + + + + + 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + + + + + + diff --git a/sql/share/charsets/cp866.xml b/sql/share/charsets/cp866.xml new file mode 100644 index 00000000000..2b050f3c993 --- /dev/null +++ b/sql/share/charsets/cp866.xml @@ -0,0 +1,122 @@ + + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 01 02 01 02 01 02 01 02 00 00 00 00 00 00 00 48 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + A0 A1 A2 A3 A4 A5 86 87 88 89 AA AB AC AD AE AF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + A0 A1 A2 A3 A4 A5 86 87 88 89 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F1 F1 F3 F3 F5 F5 F7 F7 F8 F9 FA FB FC FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + 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 DF + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + F0 F0 F2 F2 F4 F4 F6 F6 F8 F9 FA FB FC FD FE FF + + + + + + + 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F + 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F + 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F + 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F + 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F + 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F + 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F + 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F + 0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 041A 041B 041C 041D 041E 041F + 0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F + 0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F + 2591 2592 2593 2502 2524 2561 2562 2556 2555 2563 2551 2557 255D 255C 255B 2510 + 2514 2534 252C 251C 2500 253C 255E 255F 255A 2554 2569 2566 2560 2550 256C 2567 + 2568 2564 2565 2559 2558 2552 2553 256B 256A 2518 250C 2588 2584 258C 2590 2580 + 0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F + 0401 0451 0404 0454 0407 0457 040E 045E 00B0 2219 00B7 221A 207F 00B2 25A0 00A0 + + + + + + + + 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 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D + 5F 61 63 65 67 69 6B 6D 6F 71 73 BD BE BF C0 C1 + C2 41 43 45 47 49 4B 4D 4F 51 54 55 57 59 5B 5D + 5F 61 63 65 67 69 6B 6D 6F 71 73 C3 C4 C5 C6 C7 + 75 77 79 7B 7D 7F 85 87 89 8D 8F 91 93 95 97 99 + 9B 9D 9F A1 A5 A7 A9 AB AD AF B1 B3 B5 B7 B9 BB + 75 77 79 7B 7D 7F 85 87 89 8D 8F 91 93 95 97 99 + C8 C9 CA 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 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + 9B 9D 9F A1 A5 A7 A9 AB AD AF B1 B3 B5 B7 B9 BB + 81 81 83 83 8B 8B A3 A3 CB CC CD CE CF D0 D1 D2 + + + + + + + diff --git a/sql/share/charsets/dec8.xml b/sql/share/charsets/dec8.xml new file mode 100644 index 00000000000..4e76bbffd14 --- /dev/null +++ b/sql/share/charsets/dec8.xml @@ -0,0 +1,121 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 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 + + + + + + +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F +0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F +0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F +00A0 00A1 00A2 00A3 0000 00A5 0000 00A7 00A4 00A9 00AA 00AB 0000 0000 0000 0000 +00B0 00B1 00B2 00B3 0000 00B5 00B6 00B7 0000 00B9 00BA 00BB 00BC 00BD 0000 00BF +00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF +0000 00D1 00D2 00D3 00D4 00D5 00D6 0152 00D8 00D9 00DA 00DB 00DC 0178 0000 00DF +00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF +0000 00F1 00F2 00F3 00F4 00F5 00F6 0153 00F8 00F9 00FA 00FB 00FC 00FF 0000 0000 + + + + + + + 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 5C 43 45 45 45 45 49 49 49 49 + 44 4E 4F 4F 4F 4F 5D D7 D8 55 55 55 59 59 DE DF + 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49 + 44 4E 4F 4F 4F 4F 5D F7 D8 55 55 55 59 59 DE FF + + + + + + + + From 7525873a613d61a66680b649544901d5b37f294d Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 15:56:37 +0400 Subject: [PATCH 157/220] hebrew.xml, greek.xml: new file --- sql/share/charsets/greek.xml | 120 ++++++++++++++++++++++++++++++++++ sql/share/charsets/hebrew.xml | 120 ++++++++++++++++++++++++++++++++++ 2 files changed, 240 insertions(+) create mode 100644 sql/share/charsets/greek.xml create mode 100644 sql/share/charsets/hebrew.xml diff --git a/sql/share/charsets/greek.xml b/sql/share/charsets/greek.xml new file mode 100644 index 00000000000..eeb22236675 --- /dev/null +++ b/sql/share/charsets/greek.xml @@ -0,0 +1,120 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 48 10 10 10 00 00 10 10 10 10 00 10 10 10 00 10 + 10 10 10 10 10 10 01 10 01 01 01 10 01 10 01 01 + 02 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 01 01 00 01 01 01 01 01 01 01 01 01 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 00 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 DC B7 DD DE DF BB FC BD FD FE + C0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 D2 F3 F4 F5 F6 F7 F8 F9 FA FB DC DD DE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + DA 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 C1 C5 C7 C9 + DB C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D3 D3 D4 D5 D6 D7 D8 D9 DA DB CF D5 D9 FF + + + + + + +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F +0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F +0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F +00A0 02BD 02BC 00A3 0000 0000 00A6 00A7 00A8 00A9 0000 00AB 00AC 00AD 0000 2015 +00B0 00B1 00B2 00B3 0384 0385 0386 00B7 0388 0389 038A 00BB 038C 00BD 038E 038F +0390 0391 0392 0393 0394 0395 0396 0397 0398 0399 039A 039B 039C 039D 039E 039F +03A0 03A1 0000 03A3 03A4 03A5 03A6 03A7 03A8 03A9 03AA 03AB 03AC 03AD 03AE 03AF +03B0 03B1 03B2 03B3 03B4 03B5 03B6 03B7 03B8 03B9 03BA 03BB 03BC 03BD 03BE 03BF +03C0 03C1 03C2 03C3 03C4 03C5 03C6 03C7 03C8 03C9 03CA 03CB 03CC 03CD 03CE 0000 + + + + + + + 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 C1 B7 C5 C7 C9 BB CF BD D5 D9 + C9 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 C9 D5 C1 C5 C7 C9 + D5 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D3 D3 D4 D5 D6 D7 D8 D9 C9 D5 CF D5 D9 FF + + + + + + + diff --git a/sql/share/charsets/hebrew.xml b/sql/share/charsets/hebrew.xml new file mode 100644 index 00000000000..3bf8bec370e --- /dev/null +++ b/sql/share/charsets/hebrew.xml @@ -0,0 +1,120 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 00 00 00 00 00 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + + + + + + +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F +0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F +0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F +00A0 0000 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00D7 00AB 00AC 00AD 00AE 203E +00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00F7 00BB 00BC 00BD 00BE 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 2017 +05D0 05D1 05D2 05D3 05D4 05D5 05D6 05D7 05D8 05D9 05DA 05DB 05DC 05DD 05DE 05DF +05E0 05E1 05E2 05E3 05E4 05E5 05E6 05E7 05E8 05E9 05EA 0000 0000 0000 0000 0000 + + + + + + + 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + + + + + + + From 306569afc2124d348d736edc00cf5982799569ac Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 16:02:32 +0400 Subject: [PATCH 158/220] keybcs2.xml, hp8.xml: new file --- sql/share/charsets/hp8.xml | 120 +++++++++++++++++++++++++++++++++ sql/share/charsets/keybcs2.xml | 120 +++++++++++++++++++++++++++++++++ 2 files changed, 240 insertions(+) create mode 100644 sql/share/charsets/hp8.xml create mode 100644 sql/share/charsets/keybcs2.xml diff --git a/sql/share/charsets/hp8.xml b/sql/share/charsets/hp8.xml new file mode 100644 index 00000000000..036f1cd067c --- /dev/null +++ b/sql/share/charsets/hp8.xml @@ -0,0 +1,120 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 20 20 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 02 10 10 10 10 10 10 02 10 02 02 + 01 10 10 01 02 10 10 02 01 10 01 01 01 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 20 20 20 20 10 10 10 10 10 10 10 10 10 20 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 C8 C0 C9 C1 CD D1 DD A8 A9 AA AB AC CB C3 AF + B0 B2 B2 B3 B5 B5 B7 B7 B8 B9 BA BB BC BD BE BF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D4 D1 D6 D7 D4 D5 D6 D7 CC D9 CE CF C5 DD DE C2 + C4 E2 E2 E4 E4 D5 D9 C6 CA EA EA EC EC C7 EF EF + F1 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B1 B3 B4 B4 B6 B6 B8 B9 BA BB BC BD BE BF + A2 A4 DF AE E0 DC E7 ED A1 A3 E8 AD D8 A5 DA DB + D0 A6 D2 D3 D0 E5 D2 D3 D8 E6 DA DB DC A7 DE DF + E0 E1 E1 E3 E3 E5 E6 E7 E8 E9 E9 EB EB ED EE EE + F0 F0 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + + + + + + +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F +0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F +0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F +00A0 00C0 00C2 00C8 00CA 00CB 00CE 00CF 00B4 02CB 02C6 00A8 02DC 00D9 00DB 20A4 +00AF 00DD 00FD 00B0 00C7 00E7 00D1 00F1 00A1 00BF 00A4 00A3 00A5 00A7 0192 00A2 +00E2 00EA 00F4 00FB 00E1 00E9 00F3 00FA 00E0 00E8 00F2 00F9 00E4 00EB 00F6 00FC +00C5 00EE 00D8 00C6 00E5 00ED 00F8 00E6 00C4 00EC 00D6 00DC 00C9 00EF 00DF 00D4 +00C1 00C3 00E3 00D0 00F0 00CD 00CC 00D3 00D2 00D5 00F5 0160 0161 00DA 0178 00FF +00DE 00FE 00B7 00B5 00B6 00BE 2014 00BC 00BD 00AA 00BA 00AB 25A0 00BB 00B1 0000 + + + + + + + + 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + + + + + + diff --git a/sql/share/charsets/keybcs2.xml b/sql/share/charsets/keybcs2.xml new file mode 100644 index 00000000000..bdbb364822f --- /dev/null +++ b/sql/share/charsets/keybcs2.xml @@ -0,0 +1,120 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 + 01 02 82 02 02 01 01 02 82 81 01 01 02 02 01 01 + 81 02 01 02 02 01 02 01 02 01 01 01 01 01 01 02 + 02 02 02 02 02 01 01 01 02 02 02 01 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 02 02 01 02 01 02 00 02 01 01 01 02 00 02 02 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 87 81 82 83 84 83 86 87 88 88 8D A1 8C 8D 84 A0 + 82 91 91 93 94 A2 96 A3 98 94 81 9B 8C 98 A9 9F + A0 A1 A2 A3 A4 A4 96 93 9B A9 AA AA AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 ED E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE 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 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 68 59 5A 7B 7C 7D 7E 7F + 87 9A 90 85 8E 85 86 80 89 89 8A 8B 9C 8A 8E 8F + 90 92 92 A7 99 95 A6 97 9D 99 9A A8 9C 9D 9E 9F + 8F 8B 95 97 A5 A5 A6 A7 A8 9E AB AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + 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 DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC E8 EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + + + + + + + 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F + 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F + 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F + 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F + 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F + 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F + 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F + 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F + 010C 00FC 00E9 010F 00E4 010E 0164 010D 011B 011A 0139 00CD 013E 013A 00C4 00C1 + 00C9 017E 017D 00F4 00F6 00D3 016F 00DA 00FD 00D6 00DC 0160 013D 00DD 0158 0165 + 00E1 00ED 00F3 00FA 0148 0147 016E 00D4 0161 0159 0155 0154 00BC 00A1 00AB 00BB + 2591 2592 2593 2502 2524 2561 2562 2556 2555 2563 2551 2557 255D 255C 255B 2510 + 2514 2534 252C 251C 2500 253C 255E 255F 255A 2554 2569 2566 2560 2550 256C 2567 + 2568 2564 2565 2559 2558 2552 2553 256B 256A 2518 250C 2588 2584 258C 2590 2580 + 03B1 00DF 0393 03C0 03A3 03C3 00B5 03C4 03A6 0398 03A9 03B4 221E 03C6 03B5 2229 + 2261 00B1 2265 2264 2320 2321 00F7 2248 00B0 2219 00B7 221A 207F 00B2 25A0 00A0 + + + + + + + 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 44 45 47 49 50 51 52 53 54 55 56 57 58 5A + 5E 5F 60 63 66 68 6C 6D 6E 6F 72 90 91 92 93 94 + 95 41 44 45 47 49 50 51 52 53 54 55 56 57 58 5A + 5E 5F 60 63 66 68 6C 6D 6E 6F 72 96 97 98 99 9A + 45 68 49 47 41 47 66 45 49 49 56 53 56 56 41 41 + 49 72 72 5A 5A 5A 68 68 6F 5A 68 63 56 6F 60 66 + 41 53 5A 68 58 58 68 5A 63 60 60 60 A0 A1 A2 A3 + A4 A5 A6 B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC + BD BE BF 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 + 80 65 83 87 88 89 DD 8A 85 8B 84 81 DE 85 82 DF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + + + + + + + From d16824d8a7d851e9db3b16cc9d703c73c88c6896 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 16:14:56 +0400 Subject: [PATCH 159/220] koi8_u.xml, koi8_r.xml: new file Index.xml: these names look more standard sql/share/charsets/Index.xml: these names look more standard --- sql/share/charsets/Index.xml | 8 +-- sql/share/charsets/koi8_r.xml | 119 +++++++++++++++++++++++++++++++++ sql/share/charsets/koi8_u.xml | 120 ++++++++++++++++++++++++++++++++++ 3 files changed, 243 insertions(+), 4 deletions(-) create mode 100644 sql/share/charsets/koi8_r.xml create mode 100644 sql/share/charsets/koi8_u.xml diff --git a/sql/share/charsets/Index.xml b/sql/share/charsets/Index.xml index adea783defc..e744e500cba 100644 --- a/sql/share/charsets/Index.xml +++ b/sql/share/charsets/Index.xml @@ -125,11 +125,11 @@ To make maintaining easier please: - + Cyrillic koi8-ru cskoi8r - + @@ -229,10 +229,10 @@ To make maintaining easier please: - + Cyrillic koi8-u - + diff --git a/sql/share/charsets/koi8_r.xml b/sql/share/charsets/koi8_r.xml new file mode 100644 index 00000000000..aa155e4cf69 --- /dev/null +++ b/sql/share/charsets/koi8_r.xml @@ -0,0 +1,119 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 02 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 01 10 10 10 10 10 10 10 10 10 10 10 10 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + 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 B9 BA BB BC BD BE BF + 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 DF + 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 DF + + + + + + + 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 B3 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 + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + + + + + + +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000a 000b 000c 000d 000e 000f +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001a 001b 001c 001d 001e 001f +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002a 002b 002c 002d 002e 002f +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003a 003b 003c 003d 003e 003f +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004a 004b 004c 004d 004e 004f +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005a 005b 005c 005d 005e 005f +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006a 006b 006c 006d 006e 006f +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007a 007b 007c 007d 007e 007f +2500 2502 250c 2510 2514 2518 251c 2524 252c 2534 253c 2580 2584 2588 258c 2590 +2591 2592 2593 2320 25a0 2219 221a 2248 2264 2265 00a0 2321 00b0 00b2 00b7 00f7 +2550 2551 2552 0451 2553 2554 2555 2556 2557 2558 2559 255a 255b 255c 255d 255e +255f 2560 2561 0401 2562 2563 2564 2565 2566 2567 2568 2569 256a 256b 256c 00a9 +044e 0430 0431 0446 0434 0435 0444 0433 0445 0438 0439 043a 043b 043c 043d 043e +043f 044f 0440 0441 0442 0443 0436 0432 044c 044b 0437 0448 044d 0449 0447 044a +042e 0410 0411 0426 0414 0415 0424 0413 0425 0418 0419 041a 041b 041c 041d 041e +041f 042f 0420 0421 0422 0423 0416 0412 042c 042b 0417 0428 042d 0429 0427 042a + + + + + + + 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 E5 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE + AF B0 B1 E5 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD + FE DF E0 F6 E3 E4 F4 E2 F5 E8 E9 EA EB EC ED EE + EF FF F0 F1 F2 F3 E6 E1 FC FB E7 F8 FD F9 F7 FA + FE DF E0 F6 E3 E4 F4 E2 F5 E8 E9 EA EB EC ED EE + EF FF F0 F1 F2 F3 E6 E1 FC FB E7 F8 FD F9 F7 FA + + + + + + diff --git a/sql/share/charsets/koi8_u.xml b/sql/share/charsets/koi8_u.xml new file mode 100644 index 00000000000..6281a2a14fb --- /dev/null +++ b/sql/share/charsets/koi8_u.xml @@ -0,0 +1,120 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 02 02 10 02 02 10 10 10 10 10 02 10 10 + 10 10 10 01 01 10 01 01 10 10 10 10 10 01 10 10 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 20 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 A3 A4 20 A6 A7 20 20 20 20 20 AD 20 20 + 20 20 20 A3 A4 20 A6 A7 20 20 20 20 20 AD 20 20 + 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 DF + 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 DF + + + + + + + 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 B3 B4 20 B6 B7 20 20 20 20 20 BD 20 20 + 20 20 20 B3 B4 20 B6 B7 20 20 20 20 20 BD 20 20 + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + + + + + + +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F +2500 2502 250C 2510 2514 2518 251C 2524 252C 2534 253C 2580 2584 2588 258C 2590 +2591 2592 2593 2320 25A0 2022 221A 2248 2264 2265 00A0 2321 00B0 00B2 00B7 00F7 +2550 2551 2552 0451 0454 2554 0456 0457 2557 2558 2559 255A 255B 0491 255D 255E +255F 2560 2561 0401 0404 2563 0406 0407 2566 2567 2568 2569 256A 0490 256C 00A9 +044E 0430 0431 0446 0434 0435 0444 0433 0445 0438 0439 043A 043B 043C 043D 043E +043F 044F 0440 0441 0442 0443 0436 0432 044C 044B 0437 0448 044D 0449 0447 044A +042E 0410 0411 0426 0414 0415 0424 0413 0425 0418 0419 041A 041B 041C 041D 041E +041F 042F 0420 0421 0422 0423 0416 0412 042C 042B 0417 0428 042D 0429 0427 042A + + + + + + + 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 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 C0 C1 C2 C3 C4 + C5 C6 C7 88 87 C8 8C 8D C9 CA CB CC CD 84 CE CF + D0 D1 D2 88 87 D3 8C 8D D4 D5 D6 D7 D8 84 D9 DA + A3 80 81 9B 85 86 99 83 9A 8B 8E 8F 90 91 92 93 + 94 A4 95 96 97 98 89 82 A1 A0 8A 9D A2 9E 9C 9F + A3 80 81 9B 85 86 99 83 9A 8B 8E 8F 90 91 92 93 + 94 A4 95 96 97 98 89 82 A1 A0 8A 9D A2 9E 9C 9F + + + + + + + From a10b6c3a06465b3d4ddf1a8f341d0d1c91d17ec8 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 16:44:39 +0400 Subject: [PATCH 160/220] Many files: PRIMARY flag for built-in charsets strings/ctype-big5.c: PRIMARY flag for built-in charsets strings/ctype-bin.c: PRIMARY flag for built-in charsets strings/ctype-euc_kr.c: PRIMARY flag for built-in charsets strings/ctype-gb2312.c: PRIMARY flag for built-in charsets strings/ctype-gbk.c: PRIMARY flag for built-in charsets strings/ctype-sjis.c: PRIMARY flag for built-in charsets strings/ctype-tis620.c: PRIMARY flag for built-in charsets strings/ctype-ujis.c: PRIMARY flag for built-in charsets strings/ctype-utf8.c: PRIMARY flag for built-in charsets strings/ctype.c: PRIMARY flag for built-in charsets --- strings/ctype-big5.c | 2 +- strings/ctype-bin.c | 2 +- strings/ctype-euc_kr.c | 2 +- strings/ctype-gb2312.c | 2 +- strings/ctype-gbk.c | 2 +- strings/ctype-sjis.c | 2 +- strings/ctype-tis620.c | 2 +- strings/ctype-ujis.c | 2 +- strings/ctype-utf8.c | 4 ++-- strings/ctype.c | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index 74ff300c9e9..408c7f8fe35 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -6218,7 +6218,7 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)), CHARSET_INFO my_charset_big5 = { 1, /* number */ - MY_CS_COMPILED, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ "big5", /* cs name */ "big5", /* name */ "", /* comment */ diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index 377e50f3dab..0d7729721ad 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -259,7 +259,7 @@ static int my_wildcmp_bin(CHARSET_INFO *cs, static CHARSET_INFO my_charset_bin_st = { 63, /* number */ - MY_CS_COMPILED|MY_CS_BINSORT,/* state */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_PRIMARY,/* state */ "binary", /* cs name */ "binary", /* name */ "", /* comment */ diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index 6388d4b062f..5a93881a77f 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -8636,7 +8636,7 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)), CHARSET_INFO my_charset_euc_kr = { 19, /* number */ - MY_CS_COMPILED, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ "euc_kr", /* cs name */ "euc_kr", /* name */ "", /* comment */ diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index 77a55f6dadc..d575e48a59a 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -5686,7 +5686,7 @@ my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)), CHARSET_INFO my_charset_gb2312 = { 24, /* number */ - MY_CS_COMPILED, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ "gb2312", /* cs name */ "gb2312", /* name */ "", /* comment */ diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index 004c3c778e0..0094a93e5f8 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -9873,7 +9873,7 @@ my_mb_wc_gbk(CHARSET_INFO *cs __attribute__((unused)), CHARSET_INFO my_charset_gbk = { 28, /* number */ - MY_CS_COMPILED, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ "gbk", /* cs name */ "gbk", /* name */ "", /* comment */ diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index 1e9a5895683..3949be5e215 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -4460,7 +4460,7 @@ my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)), CHARSET_INFO my_charset_sjis = { 13, /* number */ - MY_CS_COMPILED, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ "sjis", /* cs name */ "sjis", /* name */ "", /* comment */ diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index b448ebdd926..7168026eea5 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -688,7 +688,7 @@ void ThNormalize(uchar* ptr, uint field_length, const uchar* from, uint length) CHARSET_INFO my_charset_tis620 = { 18, /* number */ - MY_CS_COMPILED, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ "tis620", /* cs name */ "tis620", /* name */ "", /* comment */ diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index 2c3c8dd11c3..0a0024594e4 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -8430,7 +8430,7 @@ my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, unsigned char *s, unsigned char *e) CHARSET_INFO my_charset_ujis = { 12, /* number */ - MY_CS_COMPILED, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ "ujis", /* cs name */ "ujis", /* name */ "", /* comment */ diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 738bcde92b6..42a70731ab5 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -1958,7 +1958,7 @@ static int my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)) , uint c) CHARSET_INFO my_charset_utf8 = { 33, /* number */ - MY_CS_COMPILED, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ "utf8", /* cs name */ "utf8", /* name */ "", /* comment */ @@ -3025,7 +3025,7 @@ cnv: CHARSET_INFO my_charset_ucs2 = { 35, /* number */ - MY_CS_COMPILED, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ "ucs2", /* cs name */ "ucs2", /* name */ "", /* comment */ diff --git a/strings/ctype.c b/strings/ctype.c index e49c0b6614f..589271baa37 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -2810,7 +2810,7 @@ static CHARSET_INFO compiled_charsets[] = { #ifdef HAVE_CHARSET_latin1 { 8, /* number */ - MY_CS_COMPILED, /* state */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ "latin1", /* cs name */ "latin1", /* name */ "", /* comment */ From 9cb8b57c2572718c285c251004532c132970a56d Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 17:34:24 +0400 Subject: [PATCH 161/220] koi8_ru -> koi8_r charset.conf -> charset.xml bug fix mysql-test/r/ctype_many.result: koi8_ru -> koi8_r mysql-test/t/ctype_many.test: koi8_ru -> koi8_r mysys/charset.c: charset.conf -> charset.xml sql/share/Makefile.am: charset.conf -> charset.xml strings/ctype-simple.c: Bug fix --- mysql-test/r/ctype_many.result | 14 +- mysql-test/t/ctype_many.test | 4 +- mysys/charset.c | 384 ++++++++++++++++++--------------- sql/share/Makefile.am | 3 +- strings/ctype-simple.c | 2 +- 5 files changed, 216 insertions(+), 191 deletions(-) diff --git a/mysql-test/r/ctype_many.result b/mysql-test/r/ctype_many.result index a483145e33a..ec6e0b76772 100644 --- a/mysql-test/r/ctype_many.result +++ b/mysql-test/r/ctype_many.result @@ -1,27 +1,27 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( comment CHAR(32) ASCII NOT NULL, -koi8_ru_f CHAR(32) CHARACTER SET koi8_ru NOT NULL +koi8_ru_f CHAR(32) CHARACTER SET koi8_r NOT NULL ) CHARSET=latin5; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) character set latin1 NOT NULL default '', - `koi8_ru_f` char(32) character set koi8_ru NOT NULL default '' + `koi8_ru_f` char(32) character set koi8_r NOT NULL default '' ) TYPE=MyISAM CHARSET=latin5 ALTER TABLE t1 CHANGE comment comment CHAR(32) CHARACTER SET latin2 NOT NULL; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) character set latin2 NOT NULL default '', - `koi8_ru_f` char(32) character set koi8_ru NOT NULL default '' + `koi8_ru_f` char(32) character set koi8_r NOT NULL default '' ) TYPE=MyISAM CHARSET=latin5 ALTER TABLE t1 ADD latin5_f CHAR(32) NOT NULL; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) character set latin2 NOT NULL default '', - `koi8_ru_f` char(32) character set koi8_ru NOT NULL default '', + `koi8_ru_f` char(32) character set koi8_r NOT NULL default '', `latin5_f` char(32) character set latin5 NOT NULL default '' ) TYPE=MyISAM CHARSET=latin5 ALTER TABLE t1 CHARSET=latin2; @@ -30,7 +30,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) character set latin2 NOT NULL default '', - `koi8_ru_f` char(32) character set koi8_ru NOT NULL default '', + `koi8_ru_f` char(32) character set koi8_r NOT NULL default '', `latin5_f` char(32) character set latin5 NOT NULL default '', `latin2_f` char(32) character set latin2 NOT NULL default '' ) TYPE=MyISAM CHARSET=latin2 @@ -39,7 +39,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) character set latin2 NOT NULL default '', - `koi8_ru_f` char(32) character set koi8_ru NOT NULL default '' + `koi8_ru_f` char(32) character set koi8_r NOT NULL default '' ) TYPE=MyISAM CHARSET=latin2 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('a','LAT SMALL A'); INSERT INTO t1 (koi8_ru_f,comment) VALUES ('b','LAT SMALL B'); @@ -1061,7 +1061,7 @@ CYR SMALL YA CYR CAPIT YA CYR SMALL YA CYR SMALL YA SELECT t11.comment,t12.comment FROM t1 t11,t1 t12 -WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8_ru) +WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8_r) ORDER BY t12.utf8_f,t11.comment,t12.comment; comment comment LAT CAPIT A LAT CAPIT A diff --git a/mysql-test/t/ctype_many.test b/mysql-test/t/ctype_many.test index b02684b2fb8..b5ca63507e8 100644 --- a/mysql-test/t/ctype_many.test +++ b/mysql-test/t/ctype_many.test @@ -2,7 +2,7 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( comment CHAR(32) ASCII NOT NULL, - koi8_ru_f CHAR(32) CHARACTER SET koi8_ru NOT NULL + koi8_ru_f CHAR(32) CHARACTER SET koi8_r NOT NULL ) CHARSET=latin5; SHOW CREATE TABLE t1; @@ -156,7 +156,7 @@ ORDER BY t11.koi8_ru_f,t11.comment,t12.comment; SELECT t11.comment,t12.comment FROM t1 t11,t1 t12 -WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8_ru) +WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8_r) ORDER BY t12.utf8_f,t11.comment,t12.comment; ALTER TABLE t1 ADD ucs2_f CHAR(32) CHARACTER SET ucs2; diff --git a/mysys/charset.c b/mysys/charset.c index f590ee2a49e..c94f2e91817 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -21,6 +21,11 @@ #include #include + +static void set_max_sort_char(CHARSET_INFO *cs); +static my_bool create_fromuni(CHARSET_INFO *cs); + + #define MY_CHARSET_INDEX "Index.xml" const char *charsets_dir = NULL; @@ -34,37 +39,6 @@ static int charset_initialized=0; #define SORT_ORDER_TABLE_SIZE 256 #define TO_UNI_TABLE_SIZE 256 -struct simpleconfig_buf_st { - FILE *f; - char buf[MAX_LINE]; - char *p; -}; - - -static my_bool get_word(struct simpleconfig_buf_st *fb, char *buf) -{ - char *endptr=fb->p; - - for (;;) - { - while (my_isspace(system_charset_info, *endptr)) - ++endptr; - if (*endptr && *endptr != '#') /* Not comment */ - break; /* Found something */ - if ((fgets(fb->buf, sizeof(fb->buf), fb->f)) == NULL) - return TRUE; /* end of file */ - endptr = fb->buf; - } - - while (!my_isspace(system_charset_info, *endptr)) - *buf++= *endptr++; - *buf=0; - fb->p = endptr; - - return FALSE; -} - - char *get_charsets_dir(char *buf) { const char *sharedir = SHAREDIR; @@ -89,13 +63,14 @@ char *get_charsets_dir(char *buf) #define MAX_BUF 1024*16 - +#ifndef DBUG_OFF static void mstr(char *str,const char *src,uint l1,uint l2) { l1 = l1like_range = my_like_range_simple; + cs->wildcmp = my_wildcmp_8bit; + cs->strnncoll = my_strnncoll_simple; + cs->caseup_str = my_caseup_str_8bit; + cs->casedn_str = my_casedn_str_8bit; + cs->caseup = my_caseup_8bit; + cs->casedn = my_casedn_8bit; + cs->tosort = my_tosort_8bit; + cs->strcasecmp = my_strcasecmp_8bit; + cs->strncasecmp = my_strncasecmp_8bit; + cs->mb_wc = my_mb_wc_8bit; + cs->wc_mb = my_wc_mb_8bit; + cs->hash_caseup = my_hash_caseup_simple; + cs->hash_sort = my_hash_sort_simple; + cs->snprintf = my_snprintf_8bit; + cs->strntol = my_strntol_8bit; + cs->strntoul = my_strntoul_8bit; + cs->strntoll = my_strntoll_8bit; + cs->strntoull = my_strntoull_8bit; + cs->strntod = my_strntod_8bit; + cs->mbmaxlen = 1; +} + +static void simple_cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from) +{ + to->number = from->number ? from->number : to->number; + to->state |= from->state; + + if (from->csname) + to->csname=my_strdup(from->csname,MYF(MY_WME)); + + if (from->name) + to->name=my_strdup(from->name,MYF(MY_WME)); + + if (from->ctype) + { + to->ctype = (uchar*) my_once_alloc(CTYPE_TABLE_SIZE,MYF(MY_WME)); + memcpy((char*)to->ctype,(char*)from->ctype,CTYPE_TABLE_SIZE); + } + if (from->to_lower) + { + to->to_lower = (uchar*) my_once_alloc(TO_LOWER_TABLE_SIZE,MYF(MY_WME)); + memcpy((char*)to->to_lower,(char*)from->to_lower,TO_LOWER_TABLE_SIZE); + } + if (from->to_upper) + { + to->to_upper = (uchar*) my_once_alloc(TO_UPPER_TABLE_SIZE,MYF(MY_WME)); + memcpy((char*)to->to_upper,(char*)from->to_upper,TO_UPPER_TABLE_SIZE); + } + if (from->sort_order) + { + to->sort_order=(uchar*) my_once_alloc(SORT_ORDER_TABLE_SIZE,MYF(MY_WME)); + memcpy((char*)to->sort_order,(char*)from->sort_order, SORT_ORDER_TABLE_SIZE); + set_max_sort_char(to); + } + if (from->tab_to_uni) + { + uint sz=TO_UNI_TABLE_SIZE*sizeof(uint16); + to->tab_to_uni=(uint16*)my_once_alloc(sz,MYF(MY_WME)); + memcpy((char*)to->tab_to_uni,(char*)from->tab_to_uni,sz); + create_fromuni(to); + } +} + +static my_bool simple_cs_is_full(CHARSET_INFO *cs) +{ + return + (cs->csname && cs->tab_to_uni && cs->ctype && cs->to_upper && cs->to_lower) + && + (cs->number && cs->name && cs->sort_order); +} + +static int fill_uchar(uchar *a,uint size,const char *str, uint len) +{ + uint i=0; + const char *s, *b, *e=str+len; + + for (s=str ; ssize) + break; + a[i]=my_strntoul(my_charset_latin1,b,s-b,NULL,16); + } + return 0; +} + +static int fill_uint16(uint16 *a,uint size,const char *str, uint len) +{ + uint i=0; + const char *s, *b, *e=str+len; + char buf[6]; + for (s=str ; ssize) + break; + mstr(buf,b,6,s-b); + a[i]=my_strntol(my_charset_latin1,b,s-b,NULL,16); + } + return 0; +} + static int cs_enter(MY_XML_PARSER *st,const char *attr, uint len) { struct my_cs_file_info *i = (struct my_cs_file_info *)st->user_data; @@ -169,21 +280,35 @@ static int cs_leave(MY_XML_PARSER *st,const char *attr, uint len) if (state == _CS_COLLATION) { - if (!all_charsets[i->cs.number]) + if (i->cs.name && (i->cs.number || (i->cs.number=get_charset_number(i->cs.name)))) { - if (!(all_charsets[i->cs.number]= - (CHARSET_INFO*) my_once_alloc(sizeof(CHARSET_INFO),i->myflags))) + if (!all_charsets[i->cs.number]) { - return MY_XML_ERROR; + if (!(all_charsets[i->cs.number]= + (CHARSET_INFO*) my_once_alloc(sizeof(CHARSET_INFO),i->myflags))) + { + return MY_XML_ERROR; + } + bzero((void*)all_charsets[i->cs.number],sizeof(CHARSET_INFO)); } - all_charsets[i->cs.number][0]=i->cs; + + if (!(all_charsets[i->cs.number]->state & MY_CS_COMPILED)) + { + simple_cs_copy_data(all_charsets[i->cs.number],&i->cs); + if (simple_cs_is_full(all_charsets[i->cs.number])) + { + simple_cs_init_functions(all_charsets[i->cs.number]); + all_charsets[i->cs.number]->state |= MY_CS_LOADED; + } + } + i->cs.number=0; + i->cs.name=NULL; + i->cs.state=0; + i->cs.sort_order=NULL; + i->cs.state=0; } - else - { - all_charsets[i->cs.number]->state |= i->cs.state; - } - i->cs.state=0; } + return MY_XML_OK; } @@ -193,12 +318,13 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len) struct my_cs_file_section_st *s; int state = (s=cs_file_sec(st->attr,strlen(st->attr))) ? s->state : 0; - if(0) - { - char str[256]; +#ifndef DBUG_OFF + if(0){ + char str[1024]; mstr(str,attr,len,sizeof(str)-1); printf("VALUE %d %s='%s'\n",state,st->attr,str); } +#endif switch (state) { @@ -206,22 +332,39 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len) i->cs.number = my_strntoul(my_charset_latin1,attr,len,(char**)NULL,0); break; case _CS_COLNAME: - if ((i->cs.name = (char*) my_once_alloc(len+1,i->myflags))) - { - memcpy((char*)i->cs.name,attr,len); - ((char*)(i->cs.name))[len]='\0'; - } + memcpy(i->name,attr,len=min(len,CS_MAX_NM_LEN-1)); + i->name[len]='\0'; + i->cs.name=i->name; break; case _CS_NAME: - if ((i->cs.csname = (char*) my_once_alloc(len+1,i->myflags))) - { - memcpy((char*)i->cs.csname,attr,len); - ((char*)(i->cs.csname))[len]='\0'; - } + memcpy(i->csname,attr,len=min(len,CS_MAX_NM_LEN-1)); + i->csname[len]='\0'; + i->cs.csname=i->csname; break; case _CS_FLAG: if (!strncmp("primary",attr,len)) i->cs.state |= MY_CS_PRIMARY; + break; + case _CS_UPPERMAP: + fill_uchar(i->to_upper,TO_UPPER_TABLE_SIZE,attr,len); + i->cs.to_upper=i->to_upper; + break; + case _CS_LOWERMAP: + fill_uchar(i->to_lower,TO_LOWER_TABLE_SIZE,attr,len); + i->cs.to_lower=i->to_lower; + break; + case _CS_UNIMAP: + fill_uint16(i->tab_to_uni,TO_UNI_TABLE_SIZE,attr,len); + i->cs.tab_to_uni=i->tab_to_uni; + break; + case _CS_COLLMAP: + fill_uchar(i->sort_order,SORT_ORDER_TABLE_SIZE,attr,len); + i->cs.sort_order=i->sort_order; + break; + case _CS_CTYPEMAP: + fill_uchar(i->ctype,CTYPE_TABLE_SIZE,attr,len); + i->cs.ctype=i->ctype; + break; } return MY_XML_OK; } @@ -326,38 +469,6 @@ void free_charsets(void) charset_initialized=0; } - -static my_bool fill_array(uchar *array, int sz, struct simpleconfig_buf_st *fb) -{ - char buf[MAX_LINE]; - while (sz--) - { - if (get_word(fb, buf)) - { - DBUG_PRINT("error",("get_word failed, expecting %d more words", sz + 1)); - return 1; - } - *array++ = (uchar) strtol(buf, NULL, 16); - } - return 0; -} - -static my_bool fill_uint16_array(uint16 *array, int sz, struct simpleconfig_buf_st *fb) -{ - char buf[MAX_LINE]; - while (sz--) - { - if (get_word(fb, buf)) - { - DBUG_PRINT("error",("get_word failed, expecting %d more words", sz + 1)); - return 1; - } - *array++ = (uint16) strtol(buf, NULL, 16); - } - return 0; -} - - static void get_charset_conf_name(const char *cs_name, char *buf) { strxmov(get_charsets_dir(buf), cs_name, ".conf", NullS); @@ -449,96 +560,6 @@ static my_bool create_fromuni(CHARSET_INFO *cs){ } -static my_bool read_charset_file(const char *cs_name, CHARSET_INFO *set, - myf myflags) -{ - struct simpleconfig_buf_st fb; - char buf[FN_REFLEN]; - my_bool result; - DBUG_ENTER("read_charset_file"); - DBUG_PRINT("enter",("cs_name: %s", cs_name)); - - get_charset_conf_name(cs_name, buf); - DBUG_PRINT("info",("file name: %s", buf)); - - if ((fb.f = my_fopen(buf, O_RDONLY, myflags)) == NULL) - DBUG_RETURN(TRUE); - - fb.buf[0] = '\0'; /* Init for get_word */ - fb.p = fb.buf; - - result=FALSE; - if (fill_array(set->ctype, CTYPE_TABLE_SIZE, &fb) || - fill_array(set->to_lower, TO_LOWER_TABLE_SIZE, &fb) || - fill_array(set->to_upper, TO_UPPER_TABLE_SIZE, &fb) || - fill_array(set->sort_order, SORT_ORDER_TABLE_SIZE, &fb) || - fill_uint16_array(set->tab_to_uni,TO_UNI_TABLE_SIZE,&fb)) - result=TRUE; - - my_fclose(fb.f, MYF(0)); - DBUG_RETURN(result); -} - - -static CHARSET_INFO *add_charset(CHARSET_INFO *cs, myf flags) -{ - uchar tmp_ctype[CTYPE_TABLE_SIZE]; - uchar tmp_to_lower[TO_LOWER_TABLE_SIZE]; - uchar tmp_to_upper[TO_UPPER_TABLE_SIZE]; - uchar tmp_sort_order[SORT_ORDER_TABLE_SIZE]; - uint16 tmp_to_uni[TO_UNI_TABLE_SIZE]; - - /* Note: cs->name and cs->number are already initialized */ - - cs->ctype=tmp_ctype; - cs->to_lower=tmp_to_lower; - cs->to_upper=tmp_to_upper; - cs->sort_order=tmp_sort_order; - cs->tab_to_uni=tmp_to_uni; - if (read_charset_file(cs->name, cs, flags)) - return NULL; - - cs->ctype = (uchar*) my_once_alloc(CTYPE_TABLE_SIZE, MYF(MY_WME)); - cs->to_lower = (uchar*) my_once_alloc(TO_LOWER_TABLE_SIZE, MYF(MY_WME)); - cs->to_upper = (uchar*) my_once_alloc(TO_UPPER_TABLE_SIZE, MYF(MY_WME)); - cs->sort_order=(uchar*) my_once_alloc(SORT_ORDER_TABLE_SIZE, MYF(MY_WME)); - cs->tab_to_uni=(uint16*)my_once_alloc(TO_UNI_TABLE_SIZE*sizeof(uint16), MYF(MY_WME)); - memcpy((char*) cs->ctype, (char*) tmp_ctype, sizeof(tmp_ctype)); - memcpy((char*) cs->to_lower, (char*) tmp_to_lower, sizeof(tmp_to_lower)); - memcpy((char*) cs->to_upper, (char*) tmp_to_upper, sizeof(tmp_to_upper)); - memcpy((char*) cs->sort_order, (char*) tmp_sort_order, - sizeof(tmp_sort_order)); - memcpy((char*) cs->tab_to_uni, (char*) tmp_to_uni, sizeof(tmp_to_uni)); - - cs->like_range = my_like_range_simple; - cs->wildcmp = my_wildcmp_8bit; - cs->strnncoll = my_strnncoll_simple; - cs->caseup_str = my_caseup_str_8bit; - cs->casedn_str = my_casedn_str_8bit; - cs->caseup = my_caseup_8bit; - cs->casedn = my_casedn_8bit; - cs->tosort = my_tosort_8bit; - cs->strcasecmp = my_strcasecmp_8bit; - cs->strncasecmp = my_strncasecmp_8bit; - cs->mb_wc = my_mb_wc_8bit; - cs->wc_mb = my_wc_mb_8bit; - cs->hash_caseup = my_hash_caseup_simple; - cs->hash_sort = my_hash_sort_simple; - cs->snprintf = my_snprintf_8bit; - cs->strntol = my_strntol_8bit; - cs->strntoul = my_strntoul_8bit; - cs->strntoll = my_strntoll_8bit; - cs->strntoull = my_strntoull_8bit; - cs->strntod = my_strntod_8bit; - cs->mbmaxlen = 1; - - set_max_sort_char(cs); - create_fromuni(cs); - - return cs; -} - - uint get_charset_number(const char *charset_name) { CHARSET_INFO **cs; @@ -569,6 +590,7 @@ const char *get_charset_name(uint charset_number) static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags) { + char buf[FN_REFLEN]; CHARSET_INFO *cs; /* To make things thread safe we are not allowing other threads to interfere @@ -577,9 +599,13 @@ static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags) pthread_mutex_lock(&THR_LOCK_charset); cs = all_charsets[cs_number]; - if (cs && !(cs->state & (MY_CS_COMPILED | MY_CS_LOADED))) - cs=add_charset(cs, flags); + if (cs && !(cs->state & (MY_CS_COMPILED | MY_CS_LOADED))) + { + strxmov(buf, cs->csname, ".xml", NullS); + read_charset_index(buf,flags); + cs = (cs->state & MY_CS_LOADED) ? cs : NULL; + } pthread_mutex_unlock(&THR_LOCK_charset); return cs; } diff --git a/sql/share/Makefile.am b/sql/share/Makefile.am index a1b506f1ff5..35202ff4722 100644 --- a/sql/share/Makefile.am +++ b/sql/share/Makefile.am @@ -25,8 +25,7 @@ install-data-local: done $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/charsets $(INSTALL_DATA) $(srcdir)/charsets/README $(DESTDIR)$(pkgdatadir)/charsets/README - $(INSTALL_DATA) $(srcdir)/charsets/Index.xml $(DESTDIR)$(pkgdatadir)/charsets/Index.xml - $(INSTALL_DATA) $(srcdir)/charsets/*.conf $(DESTDIR)$(pkgdatadir)/charsets + $(INSTALL_DATA) $(srcdir)/charsets/*.xml $(DESTDIR)$(pkgdatadir)/charsets fix_errors: for lang in @AVAILABLE_LANGUAGES@; \ diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index fa1ece20b3e..49801478504 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -432,7 +432,7 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs, c -= '0'; else if (c>='A' && c<='F') c = c - 'A' + 10; - else if (c>='a' && c<='a') + else if (c>='a' && c<='f') c = c - 'a' + 10; else break; From f28bd4e4b9e747e55dbdd6407b44b92dee3ef0d1 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 17:35:45 +0400 Subject: [PATCH 162/220] ctype.c: koi8_ru -> koi8_r koi8_ukr -> koi8_u usa7 -> ascii strings/ctype.c: koi8_ru -> koi8_r koi8_ukr -> koi8_u usa7 -> ascii --- strings/ctype.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/strings/ctype.c b/strings/ctype.c index 589271baa37..f1bce6671cf 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -3399,8 +3399,8 @@ static CHARSET_INFO compiled_charsets[] = { { 7, /* number */ MY_CS_COMPILED, /* state */ - "koi8_ru", /* cs name */ - "koi8_ru", /* name */ + "koi8_r", /* cs name */ + "koi8_r", /* name */ "", /* comment */ ctype_koi8_ru, to_lower_koi8_ru, @@ -3444,8 +3444,8 @@ static CHARSET_INFO compiled_charsets[] = { { 22, /* number */ MY_CS_COMPILED, /* state */ - "koi8_ukr", /* cs name */ - "koi8_ukr", /* name */ + "koi8_u", /* cs name */ + "koi8_u", /* name */ "", /* comment */ ctype_koi8_ukr, to_lower_koi8_ukr, @@ -3628,7 +3628,7 @@ static CHARSET_INFO compiled_charsets[] = { 11, /* number */ MY_CS_COMPILED, /* state */ "ascii", /* cs name */ - "usa7", /* name */ + "ascii", /* name */ "", /* comment */ ctype_usa7, to_lower_usa7, From 5dc8768a3b7d22c56cc1661d2da7de4368d9dd6b Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 17:48:10 +0400 Subject: [PATCH 163/220] latin5.xml, cp1251.xml: Comments Index.xml: Languages for cp1256 have been added .del-win1251ukr.conf~dc3540b3635ed226: Delete: sql/share/charsets/win1251ukr.conf .del-win1251.conf~b6bb6681f02917b6: Delete: sql/share/charsets/win1251.conf .del-win1250.conf~ea4cecf79a9a2b57: Delete: sql/share/charsets/win1250.conf .del-usa7.conf~7907e7e49aad1374: Delete: sql/share/charsets/usa7.conf .del-swe7.conf~adc4138b9b597e76: Delete: sql/share/charsets/swe7.conf .del-pclatin2.conf~2e905fa7381fd785: Delete: sql/share/charsets/pclatin2.conf .del-macromancsas.conf~cb7d2383e8e4105d: Delete: sql/share/charsets/macromancsas.conf .del-macromancias.conf~c3061c0b22a0a3cb: Delete: sql/share/charsets/macromancias.conf .del-macromanciai.conf~ea8974f393a79edd: Delete: sql/share/charsets/macromanciai.conf .del-macromanbin.conf~b9dcdb2797fbae67: Delete: sql/share/charsets/macromanbin.conf .del-macroman.conf~ee6a39463223b952: Delete: sql/share/charsets/macroman.conf .del-maccecsas.conf~5f1b2bfecf71fa0: Delete: sql/share/charsets/maccecsas.conf .del-maccecias.conf~8a71c3a534e70fdd: Delete: sql/share/charsets/maccecias.conf .del-macceciai.conf~a4b13482b0d7a5c5: Delete: sql/share/charsets/macceciai.conf .del-maccebin.conf~b2b9eab235e1a1ae: Delete: sql/share/charsets/maccebin.conf .del-macce.conf~aa8efe8ce8393c31: Delete: sql/share/charsets/macce.conf .del-latvian1.conf~6c7c5b2a4c896567: Delete: sql/share/charsets/latvian1.conf .del-latvian.conf~a7f7110785a5ff4d: Delete: sql/share/charsets/latvian.conf .del-latin5.conf~be23bc5cf8489338: Delete: sql/share/charsets/latin5.conf .del-latin2.conf~c45310f353a74d9: Delete: sql/share/charsets/latin2.conf .del-latin1csas.conf~e8c5219976bde66b: Delete: sql/share/charsets/latin1csas.conf .del-latin1cias.conf~85465c4ba30e76d8: Delete: sql/share/charsets/latin1cias.conf .del-latin1bin.conf~76f38a539b7dfa9f: Delete: sql/share/charsets/latin1bin.conf .del-latin1.conf~b3d65fc96f2ce181: Delete: sql/share/charsets/latin1.conf .del-koi8_ukr.conf~ce11d6ff8ffc4434: Delete: sql/share/charsets/koi8_ukr.conf .del-koi8_ru.conf~334df7402af862c8: Delete: sql/share/charsets/koi8_ru.conf .del-keybcs2.conf~db3e18f91b2075be: Delete: sql/share/charsets/keybcs2.conf .del-hungarian.conf~3b343f4ff7919cd: Delete: sql/share/charsets/hungarian.conf .del-hp8.conf~4620f2afc37ae747: Delete: sql/share/charsets/hp8.conf .del-hebrew.conf~94ba65846b69f5b7: Delete: sql/share/charsets/hebrew.conf .del-greek.conf~68f2c5692866226d: Delete: sql/share/charsets/greek.conf .del-german1.conf~765a04d69683cefe: Delete: sql/share/charsets/german1.conf .del-estonia.conf~e78f662de664f3ac: Delete: sql/share/charsets/estonia.conf .del-dos.conf~5a4357d3335ba812: Delete: sql/share/charsets/dos.conf .del-dec8.conf~d882c1e5e4566b87: Delete: sql/share/charsets/dec8.conf .del-croat.conf~fb40a3e77604268e: Delete: sql/share/charsets/croat.conf .del-danish.conf~90ffe76b3fa5dd46: Delete: sql/share/charsets/danish.conf .del-cp866.conf~a70093f2be0a509: Delete: sql/share/charsets/cp866.conf .del-cp1257ltlvcsas.conf~2e55f43377962ede: Delete: sql/share/charsets/cp1257ltlvcsas.conf .del-cp1257ltlvcias.conf~883d366fc6aa24a1: Delete: sql/share/charsets/cp1257ltlvcias.conf .del-cp1257ltlvciai.conf~f47460f62dace37e: Delete: sql/share/charsets/cp1257ltlvciai.conf .del-cp1257bin.conf~a34eda136d4d93b0: Delete: sql/share/charsets/cp1257bin.conf .del-cp1257.conf~a47298b64ba2dfc1: Delete: sql/share/charsets/cp1257.conf .del-cp1256.conf~92e4a7b31184387b: Delete: sql/share/charsets/cp1256.conf .del-cp1251csas.conf~9c4b69407a10a136: Delete: sql/share/charsets/cp1251csas.conf .del-cp1251cias.conf~6e9b6b7ebafd497c: Delete: sql/share/charsets/cp1251cias.conf .del-cp1251bin.conf~a7bf1f052611ca00: Delete: sql/share/charsets/cp1251bin.conf .del-cp1251.conf~dfafe742142570: Delete: sql/share/charsets/cp1251.conf .del-armscii8.conf~e612e5fb63e34cd4: Delete: sql/share/charsets/armscii8.conf BitKeeper/deleted/.del-armscii8.conf~e612e5fb63e34cd4: Delete: sql/share/charsets/armscii8.conf BitKeeper/deleted/.del-cp1251.conf~dfafe742142570: Delete: sql/share/charsets/cp1251.conf BitKeeper/deleted/.del-cp1251bin.conf~a7bf1f052611ca00: Delete: sql/share/charsets/cp1251bin.conf BitKeeper/deleted/.del-cp1251cias.conf~6e9b6b7ebafd497c: Delete: sql/share/charsets/cp1251cias.conf BitKeeper/deleted/.del-cp1251csas.conf~9c4b69407a10a136: Delete: sql/share/charsets/cp1251csas.conf BitKeeper/deleted/.del-cp1256.conf~92e4a7b31184387b: Delete: sql/share/charsets/cp1256.conf BitKeeper/deleted/.del-cp1257.conf~a47298b64ba2dfc1: Delete: sql/share/charsets/cp1257.conf BitKeeper/deleted/.del-cp1257bin.conf~a34eda136d4d93b0: Delete: sql/share/charsets/cp1257bin.conf BitKeeper/deleted/.del-cp1257ltlvciai.conf~f47460f62dace37e: Delete: sql/share/charsets/cp1257ltlvciai.conf BitKeeper/deleted/.del-cp1257ltlvcias.conf~883d366fc6aa24a1: Delete: sql/share/charsets/cp1257ltlvcias.conf BitKeeper/deleted/.del-cp1257ltlvcsas.conf~2e55f43377962ede: Delete: sql/share/charsets/cp1257ltlvcsas.conf BitKeeper/deleted/.del-cp866.conf~a70093f2be0a509: Delete: sql/share/charsets/cp866.conf BitKeeper/deleted/.del-danish.conf~90ffe76b3fa5dd46: Delete: sql/share/charsets/danish.conf BitKeeper/deleted/.del-croat.conf~fb40a3e77604268e: Delete: sql/share/charsets/croat.conf BitKeeper/deleted/.del-dec8.conf~d882c1e5e4566b87: Delete: sql/share/charsets/dec8.conf BitKeeper/deleted/.del-dos.conf~5a4357d3335ba812: Delete: sql/share/charsets/dos.conf BitKeeper/deleted/.del-estonia.conf~e78f662de664f3ac: Delete: sql/share/charsets/estonia.conf BitKeeper/deleted/.del-german1.conf~765a04d69683cefe: Delete: sql/share/charsets/german1.conf BitKeeper/deleted/.del-greek.conf~68f2c5692866226d: Delete: sql/share/charsets/greek.conf BitKeeper/deleted/.del-hebrew.conf~94ba65846b69f5b7: Delete: sql/share/charsets/hebrew.conf BitKeeper/deleted/.del-hp8.conf~4620f2afc37ae747: Delete: sql/share/charsets/hp8.conf BitKeeper/deleted/.del-hungarian.conf~3b343f4ff7919cd: Delete: sql/share/charsets/hungarian.conf BitKeeper/deleted/.del-keybcs2.conf~db3e18f91b2075be: Delete: sql/share/charsets/keybcs2.conf BitKeeper/deleted/.del-koi8_ru.conf~334df7402af862c8: Delete: sql/share/charsets/koi8_ru.conf BitKeeper/deleted/.del-koi8_ukr.conf~ce11d6ff8ffc4434: Delete: sql/share/charsets/koi8_ukr.conf BitKeeper/deleted/.del-latin1.conf~b3d65fc96f2ce181: Delete: sql/share/charsets/latin1.conf BitKeeper/deleted/.del-latin1bin.conf~76f38a539b7dfa9f: Delete: sql/share/charsets/latin1bin.conf BitKeeper/deleted/.del-latin1cias.conf~85465c4ba30e76d8: Delete: sql/share/charsets/latin1cias.conf BitKeeper/deleted/.del-latin1csas.conf~e8c5219976bde66b: Delete: sql/share/charsets/latin1csas.conf BitKeeper/deleted/.del-latin2.conf~c45310f353a74d9: Delete: sql/share/charsets/latin2.conf BitKeeper/deleted/.del-latin5.conf~be23bc5cf8489338: Delete: sql/share/charsets/latin5.conf BitKeeper/deleted/.del-latvian.conf~a7f7110785a5ff4d: Delete: sql/share/charsets/latvian.conf BitKeeper/deleted/.del-latvian1.conf~6c7c5b2a4c896567: Delete: sql/share/charsets/latvian1.conf BitKeeper/deleted/.del-macce.conf~aa8efe8ce8393c31: Delete: sql/share/charsets/macce.conf BitKeeper/deleted/.del-maccebin.conf~b2b9eab235e1a1ae: Delete: sql/share/charsets/maccebin.conf BitKeeper/deleted/.del-macceciai.conf~a4b13482b0d7a5c5: Delete: sql/share/charsets/macceciai.conf BitKeeper/deleted/.del-maccecias.conf~8a71c3a534e70fdd: Delete: sql/share/charsets/maccecias.conf BitKeeper/deleted/.del-maccecsas.conf~5f1b2bfecf71fa0: Delete: sql/share/charsets/maccecsas.conf BitKeeper/deleted/.del-macroman.conf~ee6a39463223b952: Delete: sql/share/charsets/macroman.conf BitKeeper/deleted/.del-macromanbin.conf~b9dcdb2797fbae67: Delete: sql/share/charsets/macromanbin.conf BitKeeper/deleted/.del-macromanciai.conf~ea8974f393a79edd: Delete: sql/share/charsets/macromanciai.conf BitKeeper/deleted/.del-macromancias.conf~c3061c0b22a0a3cb: Delete: sql/share/charsets/macromancias.conf BitKeeper/deleted/.del-macromancsas.conf~cb7d2383e8e4105d: Delete: sql/share/charsets/macromancsas.conf BitKeeper/deleted/.del-pclatin2.conf~2e905fa7381fd785: Delete: sql/share/charsets/pclatin2.conf BitKeeper/deleted/.del-swe7.conf~adc4138b9b597e76: Delete: sql/share/charsets/swe7.conf BitKeeper/deleted/.del-usa7.conf~7907e7e49aad1374: Delete: sql/share/charsets/usa7.conf BitKeeper/deleted/.del-win1250.conf~ea4cecf79a9a2b57: Delete: sql/share/charsets/win1250.conf BitKeeper/deleted/.del-win1251.conf~b6bb6681f02917b6: Delete: sql/share/charsets/win1251.conf BitKeeper/deleted/.del-win1251ukr.conf~dc3540b3635ed226: Delete: sql/share/charsets/win1251ukr.conf sql/share/charsets/Index.xml: Languages for cp1256 have been added sql/share/charsets/cp1251.xml: Comments sql/share/charsets/latin5.xml: Comments --- sql/share/charsets/Index.xml | 8 +- sql/share/charsets/armscii8.conf | 93 ----------------------- sql/share/charsets/cp1251.conf | 93 ----------------------- sql/share/charsets/cp1251.xml | 7 ++ sql/share/charsets/cp1251bin.conf | 95 ----------------------- sql/share/charsets/cp1251cias.conf | 99 ------------------------ sql/share/charsets/cp1251csas.conf | 99 ------------------------ sql/share/charsets/cp1256.conf | 94 ----------------------- sql/share/charsets/cp1257.conf | 92 ----------------------- sql/share/charsets/cp1257bin.conf | 96 ------------------------ sql/share/charsets/cp1257ltlvciai.conf | 97 ------------------------ sql/share/charsets/cp1257ltlvcias.conf | 97 ------------------------ sql/share/charsets/cp1257ltlvcsas.conf | 97 ------------------------ sql/share/charsets/cp866.conf | 96 ------------------------ sql/share/charsets/croat.conf | 92 ----------------------- sql/share/charsets/danish.conf | 92 ----------------------- sql/share/charsets/dec8.conf | 92 ----------------------- sql/share/charsets/dos.conf | 93 ----------------------- sql/share/charsets/estonia.conf | 92 ----------------------- sql/share/charsets/german1.conf | 92 ----------------------- sql/share/charsets/greek.conf | 93 ----------------------- sql/share/charsets/hebrew.conf | 93 ----------------------- sql/share/charsets/hp8.conf | 93 ----------------------- sql/share/charsets/hungarian.conf | 92 ----------------------- sql/share/charsets/keybcs2.conf | 91 ---------------------- sql/share/charsets/koi8_ru.conf | 93 ----------------------- sql/share/charsets/koi8_ukr.conf | 92 ----------------------- sql/share/charsets/latin1.conf | 92 ----------------------- sql/share/charsets/latin1bin.conf | 96 ------------------------ sql/share/charsets/latin1cias.conf | 97 ------------------------ sql/share/charsets/latin1csas.conf | 97 ------------------------ sql/share/charsets/latin2.conf | 92 ----------------------- sql/share/charsets/latin5.conf | 96 ------------------------ sql/share/charsets/latin5.xml | 5 ++ sql/share/charsets/latvian.conf | 95 ----------------------- sql/share/charsets/latvian1.conf | 94 ----------------------- sql/share/charsets/macce.conf | 91 ---------------------- sql/share/charsets/maccebin.conf | 96 ------------------------ sql/share/charsets/macceciai.conf | 96 ------------------------ sql/share/charsets/maccecias.conf | 96 ------------------------ sql/share/charsets/maccecsas.conf | 96 ------------------------ sql/share/charsets/macroman.conf | 91 ---------------------- sql/share/charsets/macromanbin.conf | 96 ------------------------ sql/share/charsets/macromanciai.conf | 97 ------------------------ sql/share/charsets/macromancias.conf | 97 ------------------------ sql/share/charsets/macromancsas.conf | 97 ------------------------ sql/share/charsets/pclatin2.conf | 91 ---------------------- sql/share/charsets/swe7.conf | 92 ----------------------- sql/share/charsets/usa7.conf | 92 ----------------------- sql/share/charsets/win1250.conf | 92 ----------------------- sql/share/charsets/win1251.conf | 100 ------------------------- sql/share/charsets/win1251ukr.conf | 95 ----------------------- 52 files changed, 19 insertions(+), 4623 deletions(-) delete mode 100644 sql/share/charsets/armscii8.conf delete mode 100644 sql/share/charsets/cp1251.conf delete mode 100644 sql/share/charsets/cp1251bin.conf delete mode 100644 sql/share/charsets/cp1251cias.conf delete mode 100644 sql/share/charsets/cp1251csas.conf delete mode 100644 sql/share/charsets/cp1256.conf delete mode 100644 sql/share/charsets/cp1257.conf delete mode 100644 sql/share/charsets/cp1257bin.conf delete mode 100644 sql/share/charsets/cp1257ltlvciai.conf delete mode 100644 sql/share/charsets/cp1257ltlvcias.conf delete mode 100644 sql/share/charsets/cp1257ltlvcsas.conf delete mode 100644 sql/share/charsets/cp866.conf delete mode 100644 sql/share/charsets/croat.conf delete mode 100644 sql/share/charsets/danish.conf delete mode 100644 sql/share/charsets/dec8.conf delete mode 100644 sql/share/charsets/dos.conf delete mode 100644 sql/share/charsets/estonia.conf delete mode 100644 sql/share/charsets/german1.conf delete mode 100644 sql/share/charsets/greek.conf delete mode 100644 sql/share/charsets/hebrew.conf delete mode 100644 sql/share/charsets/hp8.conf delete mode 100644 sql/share/charsets/hungarian.conf delete mode 100644 sql/share/charsets/keybcs2.conf delete mode 100644 sql/share/charsets/koi8_ru.conf delete mode 100644 sql/share/charsets/koi8_ukr.conf delete mode 100644 sql/share/charsets/latin1.conf delete mode 100644 sql/share/charsets/latin1bin.conf delete mode 100644 sql/share/charsets/latin1cias.conf delete mode 100644 sql/share/charsets/latin1csas.conf delete mode 100644 sql/share/charsets/latin2.conf delete mode 100644 sql/share/charsets/latin5.conf delete mode 100644 sql/share/charsets/latvian.conf delete mode 100644 sql/share/charsets/latvian1.conf delete mode 100644 sql/share/charsets/macce.conf delete mode 100644 sql/share/charsets/maccebin.conf delete mode 100644 sql/share/charsets/macceciai.conf delete mode 100644 sql/share/charsets/maccecias.conf delete mode 100644 sql/share/charsets/maccecsas.conf delete mode 100644 sql/share/charsets/macroman.conf delete mode 100644 sql/share/charsets/macromanbin.conf delete mode 100644 sql/share/charsets/macromanciai.conf delete mode 100644 sql/share/charsets/macromancias.conf delete mode 100644 sql/share/charsets/macromancsas.conf delete mode 100644 sql/share/charsets/pclatin2.conf delete mode 100644 sql/share/charsets/swe7.conf delete mode 100644 sql/share/charsets/usa7.conf delete mode 100644 sql/share/charsets/win1250.conf delete mode 100644 sql/share/charsets/win1251.conf delete mode 100644 sql/share/charsets/win1251ukr.conf diff --git a/sql/share/charsets/Index.xml b/sql/share/charsets/Index.xml index e744e500cba..fcd46970701 100644 --- a/sql/share/charsets/Index.xml +++ b/sql/share/charsets/Index.xml @@ -327,6 +327,7 @@ To make maintaining easier please: 866 csibm866 ibm866 + DOSCyrillicRussian @@ -445,7 +446,12 @@ To make maintaining easier please: Arabic ms-arab windows-1256 - + + Arabic + Persian + Pakistani + Urdu + diff --git a/sql/share/charsets/armscii8.conf b/sql/share/charsets/armscii8.conf deleted file mode 100644 index 54d2d0fec47..00000000000 --- a/sql/share/charsets/armscii8.conf +++ /dev/null @@ -1,93 +0,0 @@ -# Configuration file for the armscii8 (armenian) character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 01 02 01 02 01 02 01 02 01 02 01 02 01 02 - 01 02 01 02 01 02 01 02 01 02 01 02 01 02 01 02 - 01 02 01 02 01 02 01 02 01 02 01 02 01 02 01 02 - 01 02 01 02 01 02 01 02 01 02 01 02 01 02 01 02 - 01 02 01 02 01 02 01 02 01 02 01 02 01 02 10 10 - -# to_lower array (must have 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 AA AB AC AD AE AF - B0 B1 B3 B3 B5 B5 B7 B7 B9 B9 BB BB BD BD BF BF - C1 C1 C3 C3 C5 C5 C7 C7 C9 C9 CB CB CD CD CF CF - D1 D1 D3 D3 D5 D5 D7 D7 D9 D9 DB DB DD DD DF DF - E1 E1 E3 E3 E5 E5 E7 E7 E9 E9 EB EB ED ED EF EF - F1 F1 F3 F3 F5 F5 F7 F7 F9 F9 FB FB FD FD FE FF - -# to_upper array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B2 B4 B4 B6 B6 B8 B8 BA BA BC BC BE BE - C0 C0 C2 C2 C4 C4 C6 C6 C8 C8 CA CA CC CC CE CE - D0 D0 D2 D2 D4 D4 D6 D6 D8 D8 DA DA DC DC DE DE - E0 E0 E2 E2 E4 E4 E6 E6 E8 E8 EA EA EC EC EE EE - F0 F0 F2 F2 F4 F4 F6 F6 F8 F8 FA FA FC FC FE FF - -# sort_order array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 2741 00A7 0589 0029 0028 00BB 00AB 2014 002E 055D 002C 002D 055F 2026 055C -055B 055E 0531 0561 0532 0562 0533 0563 0534 0564 0535 0565 0536 0566 0537 0567 -0538 0568 0539 0569 053A 056A 053B 056B 053C 056C 053D 056D 053E 056E 053F 056F -0540 0570 0541 0571 0542 0572 0543 0573 0544 0574 0545 0575 0546 0576 0547 0577 -0548 0578 0549 0579 054A 057A 054B 057B 054C 057C 054D 057D 054E 057E 054F 057F -0550 0580 0551 0581 0552 0582 0553 0583 0554 0584 0555 0585 0556 0586 2019 0027 diff --git a/sql/share/charsets/cp1251.conf b/sql/share/charsets/cp1251.conf deleted file mode 100644 index ee72c6e7b27..00000000000 --- a/sql/share/charsets/cp1251.conf +++ /dev/null @@ -1,93 +0,0 @@ -# Configuration file for the cp1251 character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - -# to_lower array (must have 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC 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 F7 F8 F9 FA FB FC FD FE FF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 A8 B9 BA BB BC BD BE BF - 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 DF - 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 DF - -# sort_order array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7C 7D 7E 7F 80 - 81 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 82 83 84 85 FF - FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF 61 FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF 61 FF FF FF FF FF FF FF - 5B 5C 5D 5E 5F 60 62 63 64 65 66 67 68 69 6A 6B - 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B - 5B 5C 5D 5E 5F 60 62 63 64 65 66 67 68 69 6A 6B - 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 0402 0403 201A 0453 201E 2026 2020 2021 0000 2030 0409 2039 040A 040C 040B 040F - 0452 2018 2019 201C 201D 2022 2013 2014 0000 2122 0459 203A 045A 045C 045B 045F - 00A0 040E 045E 0408 00A4 0490 00A6 00A7 0401 00A9 0404 00AB 00AC 00AD 00AE 0407 - 00B0 00B1 0406 0456 0491 00B5 00B6 00B7 0451 2116 0454 00BB 0458 0405 0455 0457 - 0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 041A 041B 041C 041D 041E 041F - 0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F - 0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F - 0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F - diff --git a/sql/share/charsets/cp1251.xml b/sql/share/charsets/cp1251.xml index 5421e3449da..48c525eb797 100644 --- a/sql/share/charsets/cp1251.xml +++ b/sql/share/charsets/cp1251.xml @@ -161,6 +161,13 @@ + 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 diff --git a/sql/share/charsets/cp1251bin.conf b/sql/share/charsets/cp1251bin.conf deleted file mode 100644 index 4c17fee5934..00000000000 --- a/sql/share/charsets/cp1251bin.conf +++ /dev/null @@ -1,95 +0,0 @@ -# -# cp1251 -# Binary sort order -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 01 01 00 02 00 00 00 00 00 00 01 00 01 01 01 01 - 02 00 00 00 00 00 00 00 00 00 02 00 02 02 02 02 - 00 01 02 01 00 01 00 00 01 00 01 00 00 00 00 01 - 00 00 01 02 02 00 00 00 02 00 02 00 02 01 02 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 90 83 82 83 84 85 86 87 88 89 9A 8B 9C 9D 9E 9F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A2 A2 BC A4 B4 A6 A7 B8 A9 BA AB AC AD AE BF - B0 B1 B3 B3 B4 B5 B6 B7 B8 B9 BA BB BC BE 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 F7 F8 F9 FA FB FC FD FE FF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 81 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 80 91 92 93 94 95 96 97 98 99 8A 9B 8C 9D 8E 8F - A0 A1 A1 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B2 A5 B5 B6 B7 A8 B9 AA BB A3 BD BD 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 DF - 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 DF - -# sort_order array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 0402 0403 201A 0453 201E 2026 2020 2021 0000 2030 0409 2039 040A 040C 040B 040F - 0452 2018 2019 201C 201D 2022 2013 2014 0000 2122 0459 203A 045A 045C 045B 045F - 00A0 040E 045E 0408 00A4 0490 00A6 00A7 0401 00A9 0404 00AB 00AC 00AD 00AE 0407 - 00B0 00B1 0406 0456 0491 00B5 00B6 00B7 0451 2116 0454 00BB 0458 0405 0455 0457 - 0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 041A 041B 041C 041D 041E 041F - 0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F - 0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F - 0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F - diff --git a/sql/share/charsets/cp1251cias.conf b/sql/share/charsets/cp1251cias.conf deleted file mode 100644 index 612be640b11..00000000000 --- a/sql/share/charsets/cp1251cias.conf +++ /dev/null @@ -1,99 +0,0 @@ -# -# cp1251 -# Case insensitive, accent sensitive -# Sort order is correct for Belarusian, Bulgarian, Macedonian, -# Russian, Serbian, Mongolian languages. Almost good for Ukrainian, -# except that "CYRILLIC LETTER SOFT SIGN" is not in the end of alphabet, -# but between YERU and E. -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 01 01 00 02 00 00 00 00 00 00 01 00 01 01 01 01 - 02 00 00 00 00 00 00 00 00 00 02 00 02 02 02 02 - 00 01 02 01 00 01 00 00 01 00 01 00 00 00 00 01 - 00 00 01 02 02 00 00 00 02 00 02 00 02 01 02 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 90 83 82 83 84 85 86 87 88 89 9A 8B 9C 9D 9E 9F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A2 A2 BC A4 B4 A6 A7 B8 A9 BA AB AC AD AE BF - B0 B1 B3 B3 B4 B5 B6 B7 B8 B9 BA BB BC BE 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 F7 F8 F9 FA FB FC FD FE FF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 81 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 80 91 92 93 94 95 96 97 98 99 8A 9B 8C 9D 8E 8F - A0 A1 A1 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B2 A5 B5 B6 B7 A8 B9 AA BB A3 BD BD 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 DF - 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 DF - -# sort_order array (must be 256 elements) - 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 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D - 5F 61 63 65 67 69 6B 6D 6F 71 73 D3 D4 D5 D6 D7 - D8 41 43 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D - 5F 61 63 65 67 69 6B 6D 6F 71 73 D9 DA DB DC DD - 81 83 DE 83 DF E0 E1 E2 E3 E4 A1 E5 A7 9D B3 C1 - 81 E6 E7 E8 E9 EA EB EC ED EE A1 EF A7 9D B3 C1 - F0 B7 B7 99 F1 7D F2 F3 87 F4 89 F5 F6 F7 F8 95 - F9 FA 93 93 7D FB FC FD 87 FE 89 FF 99 8F 8F 95 - 75 77 79 7B 7F 85 8B 8D 91 97 9B 9F A3 A5 A9 AB - AD AF B1 B5 B9 BB BD BF C3 C5 C7 C9 CB CD CF D1 - 75 77 79 7B 7F 85 8B 8D 91 97 9B 9F A3 A5 A9 AB - AD AF B1 B5 B9 BB BD BF C3 C5 C7 C9 CB CD CF D1 - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 0402 0403 201A 0453 201E 2026 2020 2021 0000 2030 0409 2039 040A 040C 040B 040F - 0452 2018 2019 201C 201D 2022 2013 2014 0000 2122 0459 203A 045A 045C 045B 045F - 00A0 040E 045E 0408 00A4 0490 00A6 00A7 0401 00A9 0404 00AB 00AC 00AD 00AE 0407 - 00B0 00B1 0406 0456 0491 00B5 00B6 00B7 0451 2116 0454 00BB 0458 0405 0455 0457 - 0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 041A 041B 041C 041D 041E 041F - 0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F - 0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F - 0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F - diff --git a/sql/share/charsets/cp1251csas.conf b/sql/share/charsets/cp1251csas.conf deleted file mode 100644 index b6b2f853ea9..00000000000 --- a/sql/share/charsets/cp1251csas.conf +++ /dev/null @@ -1,99 +0,0 @@ -# -# cp1251 -# Case sensitive, accent sensitive -# Sort order is correct for Belarusian, Bulgarian, Macedonian, -# Russian, Serbian, Mongolian languages. Almost good for Ukrainian, -# except that "CYRILLIC LETTER SOFT SIGN" is not in the end of alphabet, -# but between YERU and E. -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 01 01 00 02 00 00 00 00 00 00 01 00 01 01 01 01 - 02 00 00 00 00 00 00 00 00 00 02 00 02 02 02 02 - 00 01 02 01 00 01 00 00 01 00 01 00 00 00 00 01 - 00 00 01 02 02 00 00 00 02 00 02 00 02 01 02 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 90 83 82 83 84 85 86 87 88 89 9A 8B 9C 9D 9E 9F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A2 A2 BC A4 B4 A6 A7 B8 A9 BA AB AC AD AE BF - B0 B1 B3 B3 B4 B5 B6 B7 B8 B9 BA BB BC BE 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 F7 F8 F9 FA FB FC FD FE FF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 81 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 80 91 92 93 94 95 96 97 98 99 8A 9B 8C 9D 8E 8F - A0 A1 A1 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B2 A5 B5 B6 B7 A8 B9 AA BB A3 BD BD 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 DF - 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 DF - -# sort_order array (must be 256 elements) - 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 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D - 5F 61 63 65 67 69 6B 6D 6F 71 73 D3 D4 D5 D6 D7 - D8 42 44 46 48 4A 4C 4E 50 52 54 56 58 5A 5C 5E - 60 62 64 66 68 6A 6C 6E 70 72 74 D9 DA DB DC DD - 81 83 DE 84 DF E0 E1 E2 E3 E4 A1 E5 A7 9D B3 C1 - 82 E6 E7 E8 E9 EA EB EC ED EE A2 EF A8 9E B4 C2 - F0 B7 B8 99 F1 7D F2 F3 87 F4 89 F5 F6 F7 F8 95 - F9 FA 93 94 7E FB FC FD 88 FE 8A FF 9A 8F 90 96 - 75 77 79 7B 7F 85 8B 8D 91 97 9B 9F A3 A5 A9 AB - AD AF B1 B5 B9 BB BD BF C3 C5 C7 C9 CB CD CF D1 - 76 78 7A 7C 80 86 8C 8E 92 98 9C A0 A4 A6 AA AC - AE B0 B2 B6 BA BC BE C0 C4 C6 C8 CA CC CE D0 D2 - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 0402 0403 201A 0453 201E 2026 2020 2021 0000 2030 0409 2039 040A 040C 040B 040F - 0452 2018 2019 201C 201D 2022 2013 2014 0000 2122 0459 203A 045A 045C 045B 045F - 00A0 040E 045E 0408 00A4 0490 00A6 00A7 0401 00A9 0404 00AB 00AC 00AD 00AE 0407 - 00B0 00B1 0406 0456 0491 00B5 00B6 00B7 0451 2116 0454 00BB 0458 0405 0455 0457 - 0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 041A 041B 041C 041D 041E 041F - 0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F - 0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F - 0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F - diff --git a/sql/share/charsets/cp1256.conf b/sql/share/charsets/cp1256.conf deleted file mode 100644 index 6072551813c..00000000000 --- a/sql/share/charsets/cp1256.conf +++ /dev/null @@ -1,94 +0,0 @@ -# -# Arabic, Persian, Pakistani, Urdu -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 00 00 - 00 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 03 00 02 00 00 00 00 00 00 00 00 01 03 03 00 - 03 10 10 10 10 00 00 00 00 00 00 00 02 00 00 00 - 00 10 00 00 00 00 00 00 00 00 00 10 10 10 00 00 - 10 10 00 00 00 00 00 00 00 00 10 10 00 00 00 10 - 00 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 - 03 03 03 03 03 03 03 00 03 03 03 03 03 03 03 03 - 02 03 02 03 03 03 03 02 02 02 02 02 03 03 02 02 - 03 03 03 03 02 03 03 00 03 02 03 02 02 00 00 00 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 9C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5F 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7F 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 8C 9D 9E 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 - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must be 256 elements) - 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 45 47 4A 4C 52 55 57 59 5D 5F 61 63 65 67 - 6C 6E 70 72 74 76 7B 7D 7F 81 83 B9 BA BB BC BD - BE 41 45 47 4A 4C 52 55 57 59 5D 5F 61 63 65 67 - 6C 6E 70 72 74 76 7B 7D 7F 81 83 BF C0 C1 C2 C3 - C4 8E C5 54 C6 C7 C8 C9 CA CB CC CD 6A 92 99 CE - A5 CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 6A DA DB DC - DD B6 DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB - EC ED EE EF F0 F1 F2 F3 F4 F5 B7 F6 F7 F8 F9 B8 - FA 85 86 87 88 89 8A 8B 8C 8D 9F 90 91 93 94 95 - 96 97 98 9A 9B 9C 9D FB 9E 9F A0 A1 AD A2 A3 A4 - 43 A6 44 A7 A8 A9 AA 49 4E 4F 50 51 AB AC 5B 5C - AE AF B0 B1 69 B2 B3 FC B4 78 B5 79 7A FD FE FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 20AC 067E 201A 0192 201E 2026 2020 2021 02C6 2030 0000 2039 0152 0686 0698 0000 - 06AF 2018 2019 201C 201D 2022 2013 2014 0000 2122 0000 203A 0153 200C 200D 0000 - 00A0 060C 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 0000 00AB 00AC 00AD 00AE 00AF - 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 061B 00BB 00BC 00BD 00BE 061F - 0000 0621 0622 0623 0624 0625 0626 0627 0628 0629 062A 062B 062C 062D 062E 062F - 0630 0631 0632 0633 0634 0635 0636 00D7 0637 0638 0639 063A 0640 0641 0642 0643 - 00E0 0644 00E2 0645 0646 0647 0648 00E7 00E8 00E9 00EA 00EB 0649 064A 00EE 00EF - 064B 064C 064D 064E 00F4 064F 0650 00F7 0651 00F9 0652 00FB 00FC 200E 200F 0000 - diff --git a/sql/share/charsets/cp1257.conf b/sql/share/charsets/cp1257.conf deleted file mode 100644 index 8338f99c83b..00000000000 --- a/sql/share/charsets/cp1257.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the cp1257 character set. - -# The ctype array must have 257 elements. - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 01 01 00 00 00 00 01 00 01 00 00 01 00 00 00 00 - 01 00 00 00 00 00 00 00 01 00 00 01 00 00 01 00 - 02 02 00 00 00 00 02 00 02 00 00 02 00 00 00 00 - 02 00 00 00 00 00 00 00 02 00 00 02 00 00 02 00 - -# The to_lower array must have 256 elements. - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - E0 E1 C2 C3 C4 C5 E6 C7 E8 C9 CA EB CC CD CE CF - F0 D1 D2 D3 D4 D5 D6 D7 F8 D9 DA FB DC DD FE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# The to_upper array must have 256 elements. - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 DF - C0 C1 E2 E3 E4 E5 C6 E7 C8 E9 EA CB EC ED EE EF - D0 F1 F2 F3 F4 F5 F6 F7 D8 F9 FA DB FC FD DE FF - -# The sort_order array must have 256 elements. - 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 46 47 4A 4B 4C 4D 50 51 52 53 54 55 - 56 57 58 59 5B 5C 5F 60 61 4E FF 62 63 64 65 66 - 67 41 43 44 46 47 4A 4B 4C 4D 50 51 52 53 54 55 - 56 57 58 59 5B 5C 5F 60 61 4E FF 68 69 6A 6B FF - FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF - 42 4F FF FF FF FF 48 FF 45 FF FF 49 FF FF FF FF - 5A FF FF FF FF FF FF FF 5E FF FF 5D FF FF FF FF - FF 4F FF FF FF FF 48 FF 45 FF FF 49 FF FF FF FF - 5A FF FF FF FF FF FF FF 5E FF FF 5D FF FF FF FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -20AC 0000 201A 0000 201E 2026 2020 2021 0000 2030 0000 2039 0000 00A8 02C7 00B8 -0000 2018 2019 201C 201D 2022 2013 2014 0000 2122 0000 203A 0000 00AF 02DB 0000 -00A0 0000 00A2 00A3 00A4 0000 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6 -00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6 -0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B -0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF -0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C -0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 02D9 diff --git a/sql/share/charsets/cp1257bin.conf b/sql/share/charsets/cp1257bin.conf deleted file mode 100644 index 032f8a7e05d..00000000000 --- a/sql/share/charsets/cp1257bin.conf +++ /dev/null @@ -1,96 +0,0 @@ -# -# cp1257 character set -# -# Binary sorting order -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 01 00 01 00 00 00 00 01 - 00 00 00 00 00 00 00 00 02 00 02 00 00 00 00 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 00 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC 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 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 BA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 BA BB BC BD BE 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 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 - -# sort_order array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 20AC 0000 201A 0000 201E 2026 2020 2021 0000 2030 0000 2039 0000 00A8 02C7 00B8 - 0000 2018 2019 201C 201D 2022 2013 2014 0000 2122 0000 203A 0000 00AF 02DB 0000 - 00A0 0000 00A2 00A3 00A4 0000 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6 - 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6 - 0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B - 0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF - 0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C - 0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 02D9 - diff --git a/sql/share/charsets/cp1257ltlvciai.conf b/sql/share/charsets/cp1257ltlvciai.conf deleted file mode 100644 index 246ae4d1fe8..00000000000 --- a/sql/share/charsets/cp1257ltlvciai.conf +++ /dev/null @@ -1,97 +0,0 @@ -# -# cp1257 character set -# -# Case-insensitive, accent insensitive sorting order -# For Latvian and Lithuanian languages -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 01 00 01 00 00 00 00 01 - 00 00 00 00 00 00 00 00 02 00 02 00 00 00 00 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 00 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC 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 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 BA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 BA BB BC BD BE 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 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 - -# sort_order array (must be 256 elements) - 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 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83 - 8F 91 93 97 9E A0 A8 AA AC AE B0 B8 B9 BA BB BC - BD 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83 - 8F 91 93 97 9E A0 A8 AA AC AE B0 BE BF C0 C1 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 DF E0 E1 E2 E3 E4 - E5 E6 E7 E8 E9 EA EB EC 83 ED 93 EE EF F0 F1 41 - F2 F3 F4 F5 F6 F7 F8 F9 83 FA 93 FB FC FD FE 41 - 41 69 41 4F 41 41 57 57 4F 57 B0 57 63 71 69 75 - 97 7D 7D 83 83 83 83 C2 A0 75 97 A0 A0 B0 B0 97 - 41 69 41 4F 41 41 57 57 4F 57 B0 57 63 71 69 75 - 97 7D 7D 83 83 83 83 C3 A0 75 97 A0 A0 B0 B0 FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 20AC 0000 201A 0000 201E 2026 2020 2021 0000 2030 0000 2039 0000 00A8 02C7 00B8 - 0000 2018 2019 201C 201D 2022 2013 2014 0000 2122 0000 203A 0000 00AF 02DB 0000 - 00A0 0000 00A2 00A3 00A4 0000 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6 - 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6 - 0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B - 0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF - 0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C - 0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 02D9 - diff --git a/sql/share/charsets/cp1257ltlvcias.conf b/sql/share/charsets/cp1257ltlvcias.conf deleted file mode 100644 index 6e49f5a245d..00000000000 --- a/sql/share/charsets/cp1257ltlvcias.conf +++ /dev/null @@ -1,97 +0,0 @@ -# -# cp1257 character set -# -# Case-insensitive, accent sensitive sorting order -# For Latvian and Lithuanian languages -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 01 00 01 00 00 00 00 01 - 00 00 00 00 00 00 00 00 02 00 02 00 00 00 00 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 00 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC 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 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 BA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 BA BB BC BD BE 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 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 - -# sort_order array (must be 256 elements) - 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 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83 - 8F 91 93 97 9E A0 A8 AA AC AE B0 B8 B9 BA BB BC - BD 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83 - 8F 91 93 97 9E A0 A8 AA AC AE B0 BE BF C0 C1 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 DF E0 E1 E2 E3 E4 - E5 E6 E7 E8 E9 EA EB EC 85 ED 95 EE EF F0 F1 4B - F2 F3 F4 F5 F6 F7 F8 F9 85 FA 95 FB FC FD FE 4B - 43 6B 45 51 47 49 59 5B 53 5D B2 5F 65 73 6D 77 - 99 7F 81 87 89 8B 8D C2 A2 79 9B A4 A6 B4 B6 9D - 43 6B 45 51 47 49 59 5B 53 5D B2 5F 65 73 6D 77 - 99 7F 81 87 89 8B 8D C3 A2 79 9B A4 A6 B4 B6 FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 20AC 0000 201A 0000 201E 2026 2020 2021 0000 2030 0000 2039 0000 00A8 02C7 00B8 - 0000 2018 2019 201C 201D 2022 2013 2014 0000 2122 0000 203A 0000 00AF 02DB 0000 - 00A0 0000 00A2 00A3 00A4 0000 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6 - 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6 - 0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B - 0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF - 0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C - 0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 02D9 - diff --git a/sql/share/charsets/cp1257ltlvcsas.conf b/sql/share/charsets/cp1257ltlvcsas.conf deleted file mode 100644 index 32cd1390bd5..00000000000 --- a/sql/share/charsets/cp1257ltlvcsas.conf +++ /dev/null @@ -1,97 +0,0 @@ -# -# cp1257 character set -# -# Case-sensitive, accent sensitive sorting order -# For Latvian and Lithuanian languages -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 01 00 01 00 00 00 00 01 - 00 00 00 00 00 00 00 00 02 00 02 00 00 00 00 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 00 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC 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 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 BA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 BA BB BC BD BE 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 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 - -# sort_order array (must be 256 elements) - 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 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83 - 8F 91 93 97 9E A0 A8 AA AC AE B0 B8 B9 BA BB BC - BD 42 4E 50 56 58 62 64 68 6A 70 72 76 7C 7E 84 - 90 92 94 98 9F A1 A9 AB AD AF B1 BE BF C0 C1 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 DF E0 E1 E2 E3 E4 - E5 E6 E7 E8 E9 EA EB EC 85 ED 95 EE EF F0 F1 4B - F2 F3 F4 F5 F6 F7 F8 F9 86 FA 96 FB FC FD FE 4C - 43 6B 45 51 47 49 59 5B 53 5D B2 5F 65 73 6D 77 - 99 7F 81 87 89 8B 8D C2 A2 79 9B A4 A6 B4 B6 9D - 44 6C 46 52 48 4A 5A 5C 54 5E B3 60 66 74 6E 78 - 9A 80 82 88 8A 8C 8E C3 A3 7A 9C A5 A7 B5 B7 FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 20AC 0000 201A 0000 201E 2026 2020 2021 0000 2030 0000 2039 0000 00A8 02C7 00B8 - 0000 2018 2019 201C 201D 2022 2013 2014 0000 2122 0000 203A 0000 00AF 02DB 0000 - 00A0 0000 00A2 00A3 00A4 0000 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6 - 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6 - 0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B - 0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF - 0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C - 0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 02D9 - diff --git a/sql/share/charsets/cp866.conf b/sql/share/charsets/cp866.conf deleted file mode 100644 index 0e4dcb3b9bc..00000000000 --- a/sql/share/charsets/cp866.conf +++ /dev/null @@ -1,96 +0,0 @@ -# -# cp866_DOSCyrillicRussian -# Case insensitive, accent sensitive. -# -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 01 02 01 02 01 02 01 02 00 00 00 00 00 00 00 48 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - A0 A1 A2 A3 A4 A5 86 87 88 89 AA AB AC AD AE AF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - A0 A1 A2 A3 A4 A5 86 87 88 89 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F1 F1 F3 F3 F5 F5 F7 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - 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 DF - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - F0 F0 F2 F2 F4 F4 F6 F6 F8 F9 FA FB FC FD FE FF - -# sort_order array (must be 256 elements) - 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 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D - 5F 61 63 65 67 69 6B 6D 6F 71 73 BD BE BF C0 C1 - C2 41 43 45 47 49 4B 4D 4F 51 54 55 57 59 5B 5D - 5F 61 63 65 67 69 6B 6D 6F 71 73 C3 C4 C5 C6 C7 - 75 77 79 7B 7D 7F 85 87 89 8D 8F 91 93 95 97 99 - 9B 9D 9F A1 A5 A7 A9 AB AD AF B1 B3 B5 B7 B9 BB - 75 77 79 7B 7D 7F 85 87 89 8D 8F 91 93 95 97 99 - C8 C9 CA 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 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - 9B 9D 9F A1 A5 A7 A9 AB AD AF B1 B3 B5 B7 B9 BB - 81 81 83 83 8B 8B A3 A3 CB CC CD CE CF D0 D1 D2 - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 041A 041B 041C 041D 041E 041F - 0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F - 0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F - 2591 2592 2593 2502 2524 2561 2562 2556 2555 2563 2551 2557 255D 255C 255B 2510 - 2514 2534 252C 251C 2500 253C 255E 255F 255A 2554 2569 2566 2560 2550 256C 2567 - 2568 2564 2565 2559 2558 2552 2553 256B 256A 2518 250C 2588 2584 258C 2590 2580 - 0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F - 0401 0451 0404 0454 0407 0457 040E 045E 00B0 2219 00B7 221A 207F 00B2 25A0 00A0 - diff --git a/sql/share/charsets/croat.conf b/sql/share/charsets/croat.conf deleted file mode 100644 index bc8c1a376eb..00000000000 --- a/sql/share/charsets/croat.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the croat character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 - 00 00 00 00 00 00 00 00 00 02 00 00 00 02 00 00 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02 - -# to_lower array (must have 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 9A 8B 8C 8D 9E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 8A 9B 9C 9D 8E 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 - 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 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 - -# sort_order array (must have 256 elements) - 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 - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 0104 02D8 0141 00A4 013D 015A 00A7 00A8 0160 015E 0164 0179 00AD 017D 017B -00B0 0105 02DB 0142 00B4 013E 015B 02C7 00B8 0161 015F 0165 017A 02DD 017E 017C -0154 00C1 00C2 0102 00C4 0139 0106 00C7 010C 00C9 0118 00CB 011A 00CD 00CE 010E -0110 0143 0147 00D3 00D4 0150 00D6 00D7 0158 016E 00DA 0170 00DC 00DD 0162 00DF -0155 00E1 00E2 0103 00E4 013A 0107 00E7 010D 00E9 0119 00EB 011B 00ED 00EE 010F -0111 0144 0148 00F3 00F4 0151 00F6 00F7 0159 016F 00FA 0171 00FC 00FD 0163 02D9 diff --git a/sql/share/charsets/danish.conf b/sql/share/charsets/danish.conf deleted file mode 100644 index 1543a64d7c3..00000000000 --- a/sql/share/charsets/danish.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the danish character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02 - -# to_lower array (must have 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 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 - -# sort_order array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 5B 5D 5B 43 45 45 45 45 49 49 49 49 - 44 4E 4F 4F 4F 4F 5C D7 5C 55 55 55 59 59 DE DF - 41 41 41 41 5B 5D 5B 43 45 45 45 45 49 49 49 49 - 44 4E 4F 4F 4F 4F 5C F7 5C 55 55 55 59 59 DE FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF -00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF -00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF -00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF -00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF -00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF diff --git a/sql/share/charsets/dec8.conf b/sql/share/charsets/dec8.conf deleted file mode 100644 index d1ffe45032d..00000000000 --- a/sql/share/charsets/dec8.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the dec8 character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02 - -# to_lower array (must have 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 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 - -# sort_order array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 5C 43 45 45 45 45 49 49 49 49 - 44 4E 4F 4F 4F 4F 5D D7 D8 55 55 55 59 59 DE DF - 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49 - 44 4E 4F 4F 4F 4F 5D F7 D8 55 55 55 59 59 DE FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 00A1 00A2 00A3 0000 00A5 0000 00A7 00A4 00A9 00AA 00AB 0000 0000 0000 0000 -00B0 00B1 00B2 00B3 0000 00B5 00B6 00B7 0000 00B9 00BA 00BB 00BC 00BD 0000 00BF -00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF -0000 00D1 00D2 00D3 00D4 00D5 00D6 0152 00D8 00D9 00DA 00DB 00DC 0178 0000 00DF -00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF -0000 00F1 00F2 00F3 00F4 00F5 00F6 0153 00F8 00F9 00FA 00FB 00FC 00FF 0000 0000 diff --git a/sql/share/charsets/dos.conf b/sql/share/charsets/dos.conf deleted file mode 100644 index 205202711b8..00000000000 --- a/sql/share/charsets/dos.conf +++ /dev/null @@ -1,93 +0,0 @@ -# Configuration file for the dos (aka cp437 DOSLatinUS) character set - -# ctype array (must have 257 elements) - 00 - 20 30 30 30 30 30 30 20 20 28 28 28 28 28 30 30 - 30 30 30 30 30 30 30 30 30 30 20 30 30 30 30 30 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 30 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 01 01 - 01 02 01 02 02 02 02 02 02 01 01 10 10 10 10 10 - 02 02 02 02 02 01 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 20 - -# to_lower array (must have 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 87 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 84 86 - 82 91 91 93 94 95 96 97 98 94 81 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A4 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 - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 9A 90 41 8E 41 8F 80 45 45 45 49 49 49 8E 8F - 90 92 92 4F 99 4F 55 55 59 99 9A 9B 9C 9D 9E 9F - 41 49 4F 55 A5 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 - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 43 59 45 41 5C 41 5B 43 45 45 45 49 49 49 5C 5B - 45 5C 5C 4F 5D 4F 55 55 59 5D 59 24 24 24 24 24 - 41 49 4F 55 4E 4E A6 A7 3F A9 AA AB AC 21 22 22 - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (256 elements) - -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000a 000b 000c 000d 000e 000f -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001a 001b 001c 001d 001e 001f -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002a 002b 002c 002d 002e 002f -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003a 003b 003c 003d 003e 003f -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004a 004b 004c 004d 004e 004f -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005a 005b 005c 005d 005e 005f -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006a 006b 006c 006d 006e 006f -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007a 007b 007c 007d 007e 007f -00c7 00fc 00e9 00e2 00e4 00e0 00e5 00e7 00ea 00eb 00e8 00ef 00ee 00ec 00c4 00c5 -00c9 00e6 00c6 00f4 00f6 00f2 00fb 00f9 00ff 00d6 00dc 00a2 00a3 00a5 20a7 0192 -00e1 00ed 00f3 00fa 00f1 00d1 00aa 00ba 00bf 2310 00ac 00bd 00bc 00a1 00ab 00bb -2591 2592 2593 2502 2524 2561 2562 2556 2555 2563 2551 2557 255d 255c 255b 2510 -2514 2534 252c 251c 2500 253c 255e 255f 255a 2554 2569 2566 2560 2550 256c 2567 -2568 2564 2565 2559 2558 2552 2553 256b 256a 2518 250c 2588 2584 258c 2590 2580 -03b1 00df 0393 03c0 03a3 03c3 00b5 03c4 03a6 0398 03a9 03b4 221e 03c6 03b5 2229 -2261 00b1 2265 2264 2320 2321 00f7 2248 00b0 2219 00b7 221a 207f 00b2 25a0 00a0 diff --git a/sql/share/charsets/estonia.conf b/sql/share/charsets/estonia.conf deleted file mode 100644 index 0226fd1fe82..00000000000 --- a/sql/share/charsets/estonia.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the estonia character set. - -# The ctype array must have 257 elements. - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02 - -# The to_lower array must have 256 elements. - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC 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 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# The to_upper array must have 256 elements. - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 A8 B9 AA BB BC BD BE 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 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 - -# The sort_order array must have 256 elements. - 00 02 03 04 05 06 07 08 09 2E 2F 30 31 32 0A 0B - 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B - 2C 33 34 35 36 37 38 27 39 3A 3B 5D 3C 28 3D 3E - 76 7A 7C 7E 80 81 82 83 84 85 3F 40 5E 5F 60 41 - 42 86 90 92 98 9A A4 A6 AA AC B2 B4 B8 BE C0 C6 - CE D0 D2 D6 E5 E8 EE F0 FA FC DD 43 44 45 46 47 - 48 87 91 93 99 9B A5 A7 AB AD B3 B5 B9 BF C1 C7 - CF D1 D3 D7 E6 E9 EF F1 FB FD DE 49 4A 4B 4C 1C - 01 1D 57 1E 5A 74 71 72 1F 75 20 5B 21 4E 52 51 - 22 55 56 58 59 73 2A 2B 23 E7 24 5C 25 4F 54 26 - 2D FE 66 67 68 FF 4D 69 CC 6A D4 62 6B 29 6C 8E - 6D 61 7D 7F 50 6E 6F 70 CD 7B D5 63 77 78 79 8F - 8C B0 88 94 F4 8A A2 A0 96 9C DF 9E A8 B6 AE BA - DB C2 C4 C8 CA F2 F6 64 EC BC D8 EA F8 E1 E3 DA - 8D B1 89 95 F5 8B A3 A1 97 9D E0 9F A9 B7 AF BB - DC C3 C5 C9 CB F3 F7 65 ED BD D9 EB F9 E2 E4 53 - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 201D 00A2 00A3 00A4 201E 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6 -00B0 00B1 00B2 00B3 201C 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6 -0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B -0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF -0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C -0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 2019 diff --git a/sql/share/charsets/german1.conf b/sql/share/charsets/german1.conf deleted file mode 100644 index 64f27da3499..00000000000 --- a/sql/share/charsets/german1.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the german1 character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02 - -# to_lower array (must have 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 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 - -# sort_order array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 41 41 41 43 45 45 45 45 49 49 49 49 - D0 4E 4F 4F 4F 4F 4F D7 4F 55 55 55 55 59 DE 53 - 41 41 41 41 41 41 41 43 45 45 45 45 49 49 49 49 - D0 4E 4F 4F 4F 4F 4F F7 4F 55 55 55 55 59 DE FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF -00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF -00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF -00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF -00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF -00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF diff --git a/sql/share/charsets/greek.conf b/sql/share/charsets/greek.conf deleted file mode 100644 index 5eb38e2efbe..00000000000 --- a/sql/share/charsets/greek.conf +++ /dev/null @@ -1,93 +0,0 @@ -# Configuration file for the greek character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 48 10 10 10 00 00 10 10 10 10 00 10 10 10 00 10 - 10 10 10 10 10 10 01 10 01 01 01 10 01 10 01 01 - 02 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 00 01 01 01 01 01 01 01 01 01 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 00 - -# to_lower array (must have 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 DC B7 DD DE DF BB FC BD FD FE - C0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 D2 F3 F4 F5 F6 F7 F8 F9 FA FB DC DD DE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - DA 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 C1 C5 C7 C9 - DB C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D3 D3 D4 D5 D6 D7 D8 D9 DA DB CF D5 D9 FF - -# sort_order array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 C1 B7 C5 C7 C9 BB CF BD D5 D9 - C9 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 C9 D5 C1 C5 C7 C9 - D5 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D3 D3 D4 D5 D6 D7 D8 D9 C9 D5 CF D5 D9 FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 02BD 02BC 00A3 0000 0000 00A6 00A7 00A8 00A9 0000 00AB 00AC 00AD 0000 2015 -00B0 00B1 00B2 00B3 0384 0385 0386 00B7 0388 0389 038A 00BB 038C 00BD 038E 038F -0390 0391 0392 0393 0394 0395 0396 0397 0398 0399 039A 039B 039C 039D 039E 039F -03A0 03A1 0000 03A3 03A4 03A5 03A6 03A7 03A8 03A9 03AA 03AB 03AC 03AD 03AE 03AF -03B0 03B1 03B2 03B3 03B4 03B5 03B6 03B7 03B8 03B9 03BA 03BB 03BC 03BD 03BE 03BF -03C0 03C1 03C2 03C3 03C4 03C5 03C6 03C7 03C8 03C9 03CA 03CB 03CC 03CD 03CE 0000 - \ No newline at end of file diff --git a/sql/share/charsets/hebrew.conf b/sql/share/charsets/hebrew.conf deleted file mode 100644 index 84581f6f1bb..00000000000 --- a/sql/share/charsets/hebrew.conf +++ /dev/null @@ -1,93 +0,0 @@ -# Configuration file for the hebrew character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 00 00 00 00 00 - -# to_lower array (must have 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 0000 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00D7 00AB 00AC 00AD 00AE 203E -00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00F7 00BB 00BC 00BD 00BE 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 2017 -05D0 05D1 05D2 05D3 05D4 05D5 05D6 05D7 05D8 05D9 05DA 05DB 05DC 05DD 05DE 05DF -05E0 05E1 05E2 05E3 05E4 05E5 05E6 05E7 05E8 05E9 05EA 0000 0000 0000 0000 0000 - \ No newline at end of file diff --git a/sql/share/charsets/hp8.conf b/sql/share/charsets/hp8.conf deleted file mode 100644 index 07036d6f186..00000000000 --- a/sql/share/charsets/hp8.conf +++ /dev/null @@ -1,93 +0,0 @@ -# Configuration file for the hp8 character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 20 20 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 02 10 10 10 10 10 10 02 10 02 02 - 01 10 10 01 02 10 10 02 01 10 01 01 01 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 20 20 20 20 10 10 10 10 10 10 10 10 10 20 - -# to_lower array (must have 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 C8 C0 C9 C1 CD D1 DD A8 A9 AA AB AC CB C3 AF - B0 B2 B2 B3 B5 B5 B7 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D4 D1 D6 D7 D4 D5 D6 D7 CC D9 CE CF C5 DD DE C2 - C4 E2 E2 E4 E4 D5 D9 C6 CA EA EA EC EC C7 EF EF - F1 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 B1 B1 B3 B4 B4 B6 B6 B8 B9 BA BB BC BD BE BF - A2 A4 DF AE E0 DC E7 ED A1 A3 E8 AD D8 A5 DA DB - D0 A6 D2 D3 D0 E5 D2 D3 D8 E6 DA DB DC A7 DE DF - E0 E1 E1 E3 E3 E5 E6 E7 E8 E9 E9 EB EB ED EE EE - F0 F0 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 00C0 00C2 00C8 00CA 00CB 00CE 00CF 00B4 02CB 02C6 00A8 02DC 00D9 00DB 20A4 -00AF 00DD 00FD 00B0 00C7 00E7 00D1 00F1 00A1 00BF 00A4 00A3 00A5 00A7 0192 00A2 -00E2 00EA 00F4 00FB 00E1 00E9 00F3 00FA 00E0 00E8 00F2 00F9 00E4 00EB 00F6 00FC -00C5 00EE 00D8 00C6 00E5 00ED 00F8 00E6 00C4 00EC 00D6 00DC 00C9 00EF 00DF 00D4 -00C1 00C3 00E3 00D0 00F0 00CD 00CC 00D3 00D2 00D5 00F5 0160 0161 00DA 0178 00FF -00DE 00FE 00B7 00B5 00B6 00BE 2014 00BC 00BD 00AA 00BA 00AB 25A0 00BB 00B1 0000 - diff --git a/sql/share/charsets/hungarian.conf b/sql/share/charsets/hungarian.conf deleted file mode 100644 index dffaff9348d..00000000000 --- a/sql/share/charsets/hungarian.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the hungarian character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 48 - 01 10 01 10 01 01 10 00 00 01 01 01 01 10 01 01 - 10 02 10 02 10 02 02 10 10 02 02 02 02 10 02 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 10 01 01 01 01 01 01 10 01 01 01 01 01 01 01 10 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10 - -# to_lower array (must have 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8B 8B A1 A1 8E A0 - 82 91 92 93 94 A2 96 A3 96 94 81 9B 9C 9D 9E 9F - A0 A1 A2 A3 B5 B6 A6 93 A8 B9 BA BB BC AD BE BF - B0 B1 B2 B3 B4 E1 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - D0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF - A2 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA 96 EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 9A 90 83 84 85 86 87 88 89 8A 8A 8C 8D 8E 8F - 90 91 92 A7 99 95 98 97 98 99 9A 9B 9C 9D 9E 9F - 8F 8D 95 97 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 A0 B2 A2 B4 B5 A5 B7 B8 A9 AA AB AC BD AE 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 DF - E0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA EB CC CD CE CF - F0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF - -# sort_order array (must have 256 elements) - 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 47 48 4C 4E 53 54 55 56 5A 5B 5C 60 61 64 - 69 6A 6B 6E 72 75 7A 7B 7C 7D 7F 83 84 85 86 87 - 88 41 47 48 4C 4E 53 54 55 56 5A 5B 5C 60 61 64 - 69 6A 6B 6E 72 75 7A 7B 7C 7D 7F 89 8A 8B 8C 00 - 01 78 4E 04 05 06 07 08 09 0A 67 67 56 56 0F 41 - 4E 12 13 67 67 64 78 75 78 67 78 1C 1D 1E 1F FF - 41 56 64 75 5E 6F FF 67 FF 70 71 73 80 FF 81 82 - FF 42 FF 5D FF 41 6F FF FF 70 71 73 80 FF 81 82 - 6C 41 44 45 46 5F 49 4B 4A 4E 51 52 50 56 57 4D - FF 62 63 64 66 67 67 FF 6D 77 75 78 78 7E 74 FF - 64 41 44 45 46 5F 49 4B 4A 4E 51 78 50 56 58 4D - FF 62 63 64 66 67 67 FF 6D 77 75 78 78 7E 74 FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 0104 02D8 0141 00A4 013D 015A 00A7 00A8 0160 015E 0164 0179 00AD 017D 017B -00B0 0105 02DB 0142 00B4 013E 015B 02C7 00B8 0161 015F 0165 017A 02DD 017E 017C -0154 00C1 00C2 0102 00C4 0139 0106 00C7 010C 00C9 0118 00CB 011A 00CD 00CE 010E -0110 0143 0147 00D3 00D4 0150 00D6 00D7 0158 016E 00DA 0170 00DC 00DD 0162 00DF -0155 00E1 00E2 0103 00E4 013A 0107 00E7 010D 00E9 0119 00EB 011B 00ED 00EE 010F -0111 0144 0148 00F3 00F4 0151 00F6 00F7 0159 016F 00FA 0171 00FC 00FD 0163 02D9 diff --git a/sql/share/charsets/keybcs2.conf b/sql/share/charsets/keybcs2.conf deleted file mode 100644 index f272960b683..00000000000 --- a/sql/share/charsets/keybcs2.conf +++ /dev/null @@ -1,91 +0,0 @@ -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 01 02 82 02 02 01 01 02 82 81 01 01 02 02 01 01 - 81 02 01 02 02 01 02 01 02 01 01 01 01 01 01 02 - 02 02 02 02 02 01 01 01 02 02 02 01 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 02 02 01 02 01 02 00 02 01 01 01 02 00 02 02 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 87 81 82 83 84 83 86 87 88 88 8D A1 8C 8D 84 A0 - 82 91 91 93 94 A2 96 A3 98 94 81 9B 8C 98 A9 9F - A0 A1 A2 A3 A4 A4 96 93 9B A9 AA AA AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 ED E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 68 59 5A 7B 7C 7D 7E 7F - 87 9A 90 85 8E 85 86 80 89 89 8A 8B 9C 8A 8E 8F - 90 92 92 A7 99 95 A6 97 9D 99 9A A8 9C 9D 9E 9F - 8F 8B 95 97 A5 A5 A6 A7 A8 9E AB AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC E8 EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must be 256 elements) - 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 44 45 47 49 50 51 52 53 54 55 56 57 58 5A - 5E 5F 60 63 66 68 6C 6D 6E 6F 72 90 91 92 93 94 - 95 41 44 45 47 49 50 51 52 53 54 55 56 57 58 5A - 5E 5F 60 63 66 68 6C 6D 6E 6F 72 96 97 98 99 9A - 45 68 49 47 41 47 66 45 49 49 56 53 56 56 41 41 - 49 72 72 5A 5A 5A 68 68 6F 5A 68 63 56 6F 60 66 - 41 53 5A 68 58 58 68 5A 63 60 60 60 A0 A1 A2 A3 - A4 A5 A6 B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC - BD BE BF 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 - 80 65 83 87 88 89 DD 8A 85 8B 84 81 DE 85 82 DF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mappping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 010C 00FC 00E9 010F 00E4 010E 0164 010D 011B 011A 0139 00CD 013E 013A 00C4 00C1 - 00C9 017E 017D 00F4 00F6 00D3 016F 00DA 00FD 00D6 00DC 0160 013D 00DD 0158 0165 - 00E1 00ED 00F3 00FA 0148 0147 016E 00D4 0161 0159 0155 0154 00BC 00A1 00AB 00BB - 2591 2592 2593 2502 2524 2561 2562 2556 2555 2563 2551 2557 255D 255C 255B 2510 - 2514 2534 252C 251C 2500 253C 255E 255F 255A 2554 2569 2566 2560 2550 256C 2567 - 2568 2564 2565 2559 2558 2552 2553 256B 256A 2518 250C 2588 2584 258C 2590 2580 - 03B1 00DF 0393 03C0 03A3 03C3 00B5 03C4 03A6 0398 03A9 03B4 221E 03C6 03B5 2229 - 2261 00B1 2265 2264 2320 2321 00F7 2248 00B0 2219 00B7 221A 207F 00B2 25A0 00A0 - diff --git a/sql/share/charsets/koi8_ru.conf b/sql/share/charsets/koi8_ru.conf deleted file mode 100644 index b1d9755173f..00000000000 --- a/sql/share/charsets/koi8_ru.conf +++ /dev/null @@ -1,93 +0,0 @@ -# Configuration file for the koi8_ru character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 02 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 01 10 10 10 10 10 10 10 10 10 10 10 10 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - -# to_lower array (must have 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - 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 B9 BA BB BC BD BE BF - 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 DF - 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 DF - -# to_upper array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 B3 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 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 E5 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE - AF B0 B1 E5 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD - FE DF E0 F6 E3 E4 F4 E2 F5 E8 E9 EA EB EC ED EE - EF FF F0 F1 F2 F3 E6 E1 FC FB E7 F8 FD F9 F7 FA - FE DF E0 F6 E3 E4 F4 E2 F5 E8 E9 EA EB EC ED EE - EF FF F0 F1 F2 F3 E6 E1 FC FB E7 F8 FD F9 F7 FA - -# Unicode mapping table (256 elements) - -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000a 000b 000c 000d 000e 000f -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001a 001b 001c 001d 001e 001f -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002a 002b 002c 002d 002e 002f -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003a 003b 003c 003d 003e 003f -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004a 004b 004c 004d 004e 004f -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005a 005b 005c 005d 005e 005f -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006a 006b 006c 006d 006e 006f -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007a 007b 007c 007d 007e 007f -2500 2502 250c 2510 2514 2518 251c 2524 252c 2534 253c 2580 2584 2588 258c 2590 -2591 2592 2593 2320 25a0 2219 221a 2248 2264 2265 00a0 2321 00b0 00b2 00b7 00f7 -2550 2551 2552 0451 2553 2554 2555 2556 2557 2558 2559 255a 255b 255c 255d 255e -255f 2560 2561 0401 2562 2563 2564 2565 2566 2567 2568 2569 256a 256b 256c 00a9 -044e 0430 0431 0446 0434 0435 0444 0433 0445 0438 0439 043a 043b 043c 043d 043e -043f 044f 0440 0441 0442 0443 0436 0432 044c 044b 0437 0448 044d 0449 0447 044a -042e 0410 0411 0426 0414 0415 0424 0413 0425 0418 0419 041a 041b 041c 041d 041e -041f 042f 0420 0421 0422 0423 0416 0412 042c 042b 0417 0428 042d 0429 0427 042a diff --git a/sql/share/charsets/koi8_ukr.conf b/sql/share/charsets/koi8_ukr.conf deleted file mode 100644 index 5a552900544..00000000000 --- a/sql/share/charsets/koi8_ukr.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the koi8_ukr character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 02 02 10 02 02 10 10 10 10 10 02 10 10 - 10 10 10 01 01 10 01 01 10 10 10 10 10 01 10 10 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - -# to_lower array (must have 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 20 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 A3 A4 20 A6 A7 20 20 20 20 20 AD 20 20 - 20 20 20 A3 A4 20 A6 A7 20 20 20 20 20 AD 20 20 - 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 DF - 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 DF - -# to_upper array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 B3 B4 20 B6 B7 20 20 20 20 20 BD 20 20 - 20 20 20 B3 B4 20 B6 B7 20 20 20 20 20 BD 20 20 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 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 C0 C1 C2 C3 C4 - C5 C6 C7 88 87 C8 8C 8D C9 CA CB CC CD 84 CE CF - D0 D1 D2 88 87 D3 8C 8D D4 D5 D6 D7 D8 84 D9 DA - A3 80 81 9B 85 86 99 83 9A 8B 8E 8F 90 91 92 93 - 94 A4 95 96 97 98 89 82 A1 A0 8A 9D A2 9E 9C 9F - A3 80 81 9B 85 86 99 83 9A 8B 8E 8F 90 91 92 93 - 94 A4 95 96 97 98 89 82 A1 A0 8A 9D A2 9E 9C 9F - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -2500 2502 250C 2510 2514 2518 251C 2524 252C 2534 253C 2580 2584 2588 258C 2590 -2591 2592 2593 2320 25A0 2022 221A 2248 2264 2265 00A0 2321 00B0 00B2 00B7 00F7 -2550 2551 2552 0451 0454 2554 0456 0457 2557 2558 2559 255A 255B 0491 255D 255E -255F 2560 2561 0401 0404 2563 0406 0407 2566 2567 2568 2569 256A 0490 256C 00A9 -044E 0430 0431 0446 0434 0435 0444 0433 0445 0438 0439 043A 043B 043C 043D 043E -043F 044F 0440 0441 0442 0443 0436 0432 044C 044B 0437 0448 044D 0449 0447 044A -042E 0410 0411 0426 0414 0415 0424 0413 0425 0418 0419 041A 041B 041C 041D 041E -041F 042F 0420 0421 0422 0423 0416 0412 042C 042B 0417 0428 042D 0429 0427 042A diff --git a/sql/share/charsets/latin1.conf b/sql/share/charsets/latin1.conf deleted file mode 100644 index 7cb5cfb3cfd..00000000000 --- a/sql/share/charsets/latin1.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the latin1 character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02 - -# to_lower array (must have 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 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 - -# sort_order array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 5C 43 45 45 45 45 49 49 49 49 - 44 4E 4F 4F 4F 4F 5D D7 D8 55 55 55 59 59 DE DF - 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49 - 44 4E 4F 4F 4F 4F 5D F7 D8 55 55 55 59 59 DE FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF -00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF -00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF -00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF -00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF -00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF diff --git a/sql/share/charsets/latin1bin.conf b/sql/share/charsets/latin1bin.conf deleted file mode 100644 index 37e6350bcb2..00000000000 --- a/sql/share/charsets/latin1bin.conf +++ /dev/null @@ -1,96 +0,0 @@ -# -# Latin1, accent sensitive, case sensitive -# -# Binary sorting order -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 02 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 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 - -# sort_order array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F - 0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F - 00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF - 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF - 00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF - 00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF - 00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF - 00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF - diff --git a/sql/share/charsets/latin1cias.conf b/sql/share/charsets/latin1cias.conf deleted file mode 100644 index 3b0e104aafd..00000000000 --- a/sql/share/charsets/latin1cias.conf +++ /dev/null @@ -1,97 +0,0 @@ -# -# Latin1, accent sensitive, case insensitive -# -# Sorting for Dutch, English, French, German (Duden), -# Italian, Latin, Pogtuguese, Spanish -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 02 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 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 - -# sort_order array (must be 256 elements) - 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 51 53 57 5B 65 67 69 6B 75 77 79 7B 7D 81 - 8F 91 93 95 98 9A A4 A6 A8 AA AF B3 B4 B5 B6 B7 - B8 41 51 53 57 5B 65 67 69 6B 75 77 79 7B 7D 81 - 8F 91 93 95 98 9A A4 A6 A8 AA AF B9 BA BB BC BF - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - 43 45 47 49 4B 4D 4F 55 5D 5F 61 63 6D 6F 71 73 - 59 7F 83 85 87 89 8B BD 8D 9C 9E A0 A2 AC B1 97 - 43 45 47 49 4B 4D 4F 55 5D 5F 61 63 6D 6F 71 73 - 59 7F 83 85 87 89 8B BE 8D 9C 9E A0 A2 AC B1 AE - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F - 0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F - 00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF - 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF - 00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF - 00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF - 00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF - 00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF - diff --git a/sql/share/charsets/latin1csas.conf b/sql/share/charsets/latin1csas.conf deleted file mode 100644 index cb3a1285de8..00000000000 --- a/sql/share/charsets/latin1csas.conf +++ /dev/null @@ -1,97 +0,0 @@ -# -# Latin1, accent sensitive, case sensitive -# -# Sorting for Dutch, English, French, German (Duden), -# Italian, Latin, Pogtuguese, Spanish -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 02 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 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 - -# sort_order array (must be 256 elements) - 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 51 53 57 5B 65 67 69 6B 75 77 79 7B 7D 81 - 8F 91 93 95 98 9A A4 A6 A8 AA AF B3 B4 B5 B6 B7 - B8 42 52 54 58 5C 66 68 6A 6C 76 78 7A 7C 7E 82 - 90 92 94 96 99 9B A5 A7 A9 AB B0 B9 BA BB BC BF - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - 43 45 47 49 4B 4D 4F 55 5D 5F 61 63 6D 6F 71 73 - 59 7F 83 85 87 89 8B BD 8D 9C 9E A0 A2 AC B1 97 - 44 46 48 4A 4C 4E 50 56 5E 60 62 64 6E 70 72 74 - 5A 80 84 86 88 8A 8C BE 8E 9D 9F A1 A3 AD B2 AE - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F - 0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F - 00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF - 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF - 00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF - 00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF - 00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF - 00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF - diff --git a/sql/share/charsets/latin2.conf b/sql/share/charsets/latin2.conf deleted file mode 100644 index cc21af9faa1..00000000000 --- a/sql/share/charsets/latin2.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the latin2 character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 48 01 10 01 10 01 01 10 10 01 01 01 01 10 01 01 - 10 02 10 02 10 02 02 10 10 02 02 02 02 10 02 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 10 01 01 01 01 01 01 10 01 01 01 01 01 01 01 10 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10 - -# to_lower array (must have 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 B1 A2 B3 A4 B5 B6 A7 A8 B9 BA BB BC AD BE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - D0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF - B0 A1 B2 A3 B4 A5 A6 B7 B8 A9 AA AB AC BD AE 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 DF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - F0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF - -# sort_order array (must have 256 elements) - 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 44 45 48 49 4B 4C 4D 4E 4F 50 51 53 54 56 - 58 59 5A 5B 5E 5F 60 61 62 63 64 68 69 6A 6B 6C - 6D 41 44 45 48 49 4B 4C 4D 4E 4F 50 51 53 54 56 - 58 59 5A 5B 5E 5F 60 61 62 63 64 6E 6F 70 71 FF - FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF - FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF - FF 42 FF 52 FF 51 5C FF FF 5D 5B 5E 65 FF 67 66 - FF 42 FF 52 FF 51 5C FF FF 5D 5B 5E 65 FF 67 66 - 5A 43 43 43 43 51 46 45 47 49 4A 49 49 4E 4E 48 - FF 55 54 57 56 56 56 FF 5A 5F 5F 5F 5F 63 5E FF - 5A 43 43 43 43 51 46 45 47 49 4A 49 49 4E 4E 48 - FF 55 54 57 56 56 56 FF 5A 5F 5F 5F 5F 63 5E FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 0104 02D8 0141 00A4 013D 015A 00A7 00A8 0160 015E 0164 0179 00AD 017D 017B -00B0 0105 02DB 0142 00B4 013E 015B 02C7 00B8 0161 015F 0165 017A 02DD 017E 017C -0154 00C1 00C2 0102 00C4 0139 0106 00C7 010C 00C9 0118 00CB 011A 00CD 00CE 010E -0110 0143 0147 00D3 00D4 0150 00D6 00D7 0158 016E 00DA 0170 00DC 00DD 0162 00DF -0155 00E1 00E2 0103 00E4 013A 0107 00E7 010D 00E9 0119 00EB 011B 00ED 00EE 010F -0111 0144 0148 00F3 00F4 0151 00F6 00F7 0159 016F 00FA 0171 00FC 00FD 0163 02D9 diff --git a/sql/share/charsets/latin5.conf b/sql/share/charsets/latin5.conf deleted file mode 100644 index d603d019ce6..00000000000 --- a/sql/share/charsets/latin5.conf +++ /dev/null @@ -1,96 +0,0 @@ -# Configuration file for the latin5 (turkish) character set - -# Note: all accented characters are compared separately (this -# is different from the default latin1 character set, where -# e.g. a = ä = á, etc.). - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02 - -# to_lower array (must have 256 elements) - 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 61 62 63 64 65 66 67 68 FD 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 69 FE DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 DD 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 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 49 DE FF - -# sort_order array (must have 256 elements) - 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 45 46 47 48 4A 4B 4D 4E 4F 50 51 52 - 54 55 56 57 59 5A 5C 5D 5E 5F 60 61 62 63 64 65 - 66 41 42 43 45 46 47 48 4A 4C 4D 4E 4F 50 51 52 - 54 55 56 57 59 5A 5C 5D 5E 5F 60 87 88 89 8A 8B - 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B - 9C 9D 9E 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 C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB - CC CD CE CF D0 D1 D2 44 D3 D4 D5 D6 D7 D8 D9 DA - 49 DB DC DD DE DF 53 E0 E1 E2 E3 E4 5B 4C 58 E5 - CC CD CE CF D0 D1 D2 44 D3 D4 D5 D6 D7 D8 D9 DA - 49 DB DC DD DE DF 53 FA E1 E2 E3 E4 5B 4B 58 FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF -00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF -00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF -011E 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 0130 015E 00DF -00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF -011F 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 0131 015F 00FF diff --git a/sql/share/charsets/latin5.xml b/sql/share/charsets/latin5.xml index 87ab65a6e2e..a072ffc5072 100644 --- a/sql/share/charsets/latin5.xml +++ b/sql/share/charsets/latin5.xml @@ -94,6 +94,11 @@ + 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 diff --git a/sql/share/charsets/latvian.conf b/sql/share/charsets/latvian.conf deleted file mode 100644 index c3dee95d55c..00000000000 --- a/sql/share/charsets/latvian.conf +++ /dev/null @@ -1,95 +0,0 @@ -# Configuration file for the latvian character set. -# Created for case-sensitive record search -# Created accord with windows-1257 (iso-8859-4) codepage -# Created by Andis Grasis & Rihards Grasis e-mail:andis@cata.lv - -# The ctype array must have 257 elements. - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 01 20 10 20 10 10 00 00 20 10 20 10 20 10 10 10 - 20 10 10 10 10 10 10 10 20 00 20 10 20 10 10 20 - 48 20 10 10 10 20 10 10 10 10 01 10 10 10 10 01 - 10 10 10 10 10 10 10 10 10 10 02 10 10 10 10 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10 - -# The to_lower array must have 256 elements. - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC 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 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# The to_upper array must have 256 elements. - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 A8 B9 AA BB BC BD BE 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 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 - -# The sort_order array must have 256 elements. - 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 - 30 32 33 34 35 36 37 2B 38 39 3A 5C 3B 2C 3C 3D - 76 7A 7C 7E 80 81 82 83 84 85 3E 3F 5D 5E 5F 40 - 41 86 92 94 9A 9C A6 A8 AC AE B4 B6 BA C0 C2 C8 - D4 D6 D8 DC E3 E6 EE F0 F2 F4 F6 42 43 44 45 46 - 47 87 93 95 9B 9D A7 A9 AD AF B5 B7 BB C1 C3 C9 - D5 D7 D9 DD E4 E7 EF F1 F3 F5 F7 48 49 4A 4B 20 - 75 21 56 22 59 73 70 71 23 74 24 5A 25 4D 51 50 - 26 54 55 57 58 72 2E 2F 27 E5 28 5B 29 4E 53 2A - 31 FE 65 66 67 FF 4C 68 D3 69 DA 61 6A 2D 6B 90 - 6C 60 7D 7F 4F 6D 6E 6F D2 7B DB 62 77 78 79 91 - 8E B2 8A 96 88 8C A4 A2 98 9E F8 A0 AA B8 B0 BE - E1 C4 C6 CA CE D0 CC 63 EC BC DE EA E8 FA FC E0 - 8F B3 8B 97 89 8D A5 A3 99 9F F9 A1 AB B9 B1 BF - E2 C5 C7 CB CF D1 CD 64 ED BD DF EB E9 FB FD 52 - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 201D 00A2 00A3 00A4 201E 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6 -00B0 00B1 00B2 00B3 201C 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6 -0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B -0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF -0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C -0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 2019 diff --git a/sql/share/charsets/latvian1.conf b/sql/share/charsets/latvian1.conf deleted file mode 100644 index 3094525052d..00000000000 --- a/sql/share/charsets/latvian1.conf +++ /dev/null @@ -1,94 +0,0 @@ -# Configuration file for the latvian character set. -# Created for case-insensitive record search -# Created by Andis & Rihards - -# The ctype array must have 257 elements. - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 10 00 10 10 00 00 00 00 00 10 00 10 10 10 - 00 10 10 10 10 10 10 10 00 00 00 10 00 10 10 00 - 48 00 10 10 10 00 10 10 10 10 01 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10 - -# The to_lower array must have 256 elements. - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC 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 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# The to_upper array must have 256 elements. - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 A8 B9 AA BB BC BD BE 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 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 - -# The sort_order array must have 256 elements. - 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 - 30 32 33 34 35 36 37 2B 38 39 3A 5C 3B 2C 3C 3D - 76 7A 7C 7E 80 81 82 83 84 85 3E 3F 5D 5E 5F 40 - 41 86 92 94 9A 9C A6 A8 AC AE B4 B6 BA C0 C2 C8 - D4 D6 D8 DC E3 E6 EE F0 F2 F4 F6 42 43 44 45 46 - 47 86 92 94 9A 9C A6 A8 AC AE B4 B6 BA C0 C2 C8 - D4 D6 D8 DC E2 E6 EE F0 F2 F4 F6 48 49 4A 4B 20 - 75 21 56 22 59 73 70 71 23 74 24 5A 25 4D 51 50 - 26 54 55 57 58 72 2E 2F 27 E5 28 5B 29 4E 53 2A - 31 FE 65 66 67 FF 4C 68 2D 69 DA 61 6A 2D 6B 90 - 6C 60 7D 7F 4F 6D 6E 6F D3 7B DB 62 77 78 79 90 - 8E B2 8A 96 88 8C A4 A2 98 9E F8 A0 AA B8 B0 BE - E1 C4 C6 CA CE D0 CC 63 EC BC DE EA E8 FA FC E0 - 8E B2 8A 96 88 8C A4 A2 98 9E F8 A0 AA B8 B0 BE - E1 C4 C6 CA CE D0 CC 64 EC BC DE EA E8 FA FC 52 - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F -0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F -00A0 201D 00A2 00A3 00A4 201E 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6 -00B0 00B1 00B2 00B3 201C 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6 -0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B -0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF -0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C -0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 2019 diff --git a/sql/share/charsets/macce.conf b/sql/share/charsets/macce.conf deleted file mode 100644 index f3ac08df087..00000000000 --- a/sql/share/charsets/macce.conf +++ /dev/null @@ -1,91 +0,0 @@ -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 01 01 02 01 01 01 01 02 02 01 02 02 01 02 02 01 - 02 01 02 02 01 02 01 02 02 02 02 02 02 01 02 02 - 00 00 01 00 00 00 00 02 00 00 00 02 00 00 02 01 - 02 01 00 00 02 01 00 00 02 01 02 01 02 01 02 01 - 02 01 00 00 02 01 00 00 00 00 00 02 01 01 02 01 - 00 00 00 00 00 00 00 00 02 01 02 01 00 00 02 01 - 02 01 00 00 02 01 02 01 01 02 01 01 02 01 01 01 - 02 01 01 02 01 02 01 02 01 02 02 01 01 02 01 00 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 8A 82 82 8E 88 9A 9F 87 88 8B 8A 8B 8D 8D 8E 90 - 90 93 92 93 95 95 98 97 98 99 9A 9B 9C 9E 9E 9F - A0 A1 AB A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE B0 - B0 B4 B2 B3 B4 FA B6 B7 B8 BA BA BC BC BE BE C0 - C0 C4 C2 C3 C4 CB C6 C7 C8 C9 CA CB CE 9B CE D8 - D0 D1 D2 D3 D4 D5 D6 D7 D8 DA DA DE DC DD DE E0 - E0 E4 E2 E3 E4 E6 E6 87 E9 E9 92 EC EC F0 97 99 - F0 F3 9C F3 F5 F5 F7 F7 F9 F9 FA FD B8 FD AE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 81 83 84 85 86 E7 84 89 80 89 8C 8C 83 8F - 8F 91 EA 91 94 94 96 EE 96 EF 85 CD F2 9D 9D 86 - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA A2 AC AD FE AF - AF B1 B2 B3 B1 B5 B6 B7 FC B9 B9 BB BB BD BD BF - BF C1 C2 C3 C1 C5 C6 C7 C8 C9 CA C5 CC CD CC CF - D0 D1 D2 D3 D4 D5 D6 D7 CF D9 D9 DB DC DD DB DF - DF E1 E2 E3 E1 E5 E5 E7 E8 E8 EA EB EB ED EE EF - ED F1 F2 F1 F4 F4 F6 F6 F8 F8 B5 FB FC FB FE FF - -# sort_order array (must be 256 elements) - 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 46 47 4A 4C 52 53 55 56 5A 5B 5D 62 62 67 - 6F 70 71 75 79 81 88 89 8A 8B 8D 90 91 92 93 94 - 95 41 46 47 4A 4C 52 53 55 56 5A 5B 5D 62 62 67 - 6F 70 71 75 79 81 88 89 8A 8B 8D 96 97 98 99 9A - 41 41 41 4C 41 67 81 41 41 47 41 47 47 47 4C 8D - 8D 4A 56 4A 4C 4C 4C 67 4C 67 67 67 81 4C 4C 81 - A0 A1 4C A3 A4 A5 A6 75 A8 A9 AA 4C AC AD 53 56 - 56 56 B2 B3 56 5B B6 B7 5D 5D 5D 5D 5D 5D 5D 62 - 62 62 C2 C3 62 62 C6 C7 C8 C9 CA 62 67 67 67 67 - D0 D1 D2 D3 D4 D5 D6 D7 67 71 71 71 DC DD 71 71 - 71 75 E2 E3 75 75 75 41 79 79 56 8D 8D 81 67 67 - 81 81 81 81 81 81 81 81 8B 8B 5B 8D 5D 8D 53 FF - -# Unicode mappping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 00C4 0100 0101 00C9 0104 00D6 00DC 00E1 0105 010C 00E4 010D 0106 0107 00E9 0179 - 017A 010E 00ED 010F 0112 0113 0116 00F3 0117 00F4 00F6 00F5 00FA 011A 011B 00FC - 2020 00B0 0118 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 0119 00A8 2260 0123 012E - 012F 012A 2264 2265 012B 0136 2202 2211 0142 013B 013C 013D 013E 0139 013A 0145 - 0146 0143 00AC 221A 0144 0147 2206 00AB 00BB 2026 00A0 0148 0150 00D5 0151 014C - 2013 2014 201C 201D 2018 2019 00F7 25CA 014D 0154 0155 0158 2039 203A 0159 0156 - 0157 0160 201A 201E 0161 015A 015B 00C1 0164 0165 00CD 017D 017E 016A 00D3 00D4 - 016B 016E 00DA 016F 0170 0171 0172 0173 00DD 00FD 0137 017B 0141 017C 0122 02C7 - diff --git a/sql/share/charsets/maccebin.conf b/sql/share/charsets/maccebin.conf deleted file mode 100644 index f859e64354c..00000000000 --- a/sql/share/charsets/maccebin.conf +++ /dev/null @@ -1,96 +0,0 @@ -# Mac OS Central European, binary sort order -# -# Czech (cs), Hungarian (hu), Polish (pl), Romanian (ro), Croatian (hr), -# Slovak (sk), Slovenian (sl), Sorbian. -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 01 01 02 01 01 01 01 02 02 01 02 02 01 02 02 01 - 02 01 02 02 01 02 01 02 02 02 02 02 02 01 02 02 - 00 00 01 00 00 00 00 02 00 00 00 02 00 00 02 01 - 02 01 00 00 02 01 00 00 02 01 02 01 02 01 02 01 - 02 01 00 00 02 01 00 00 00 00 00 02 01 01 02 01 - 00 00 00 00 00 00 00 00 02 01 02 01 00 00 02 01 - 02 01 00 00 02 01 02 01 01 02 01 01 02 01 01 01 - 02 01 01 02 01 02 01 02 01 02 02 01 01 02 01 00 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 8A 82 82 8E 88 9A 9F 87 88 8B 8A 8B 8D 8D 8E 90 - 90 93 92 93 95 95 98 97 98 99 9A 9B 9C 9E 9E 9F - A0 A1 AB A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE B0 - B0 B4 B2 B3 B4 FA B6 B7 B8 BA BA BC BC BE BE C0 - C0 C4 C2 C3 C4 CB C6 C7 C8 C9 CA CB CE 9B CE D8 - D0 D1 D2 D3 D4 D5 D6 D7 D8 DA DA DE DC DD DE E0 - E0 E4 E2 E3 E4 E6 E6 87 E9 E9 92 EC EC F0 97 99 - F0 F3 9C F3 F5 F5 F7 F7 F9 F9 FA FD B8 FD AE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 81 83 84 85 86 E7 84 89 80 89 8C 8C 83 8F - 8F 91 EA 91 94 94 96 EE 96 EF 85 CD F2 9D 9D 86 - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA A2 AC AD FE AF - AF B1 B2 B3 B1 B5 B6 B7 FC B9 B9 BB BB BD BD BF - BF C1 C2 C3 C1 C5 C6 C7 C8 C9 CA C5 CC CD CC CF - D0 D1 D2 D3 D4 D5 D6 D7 CF D9 D9 DB DC DD DB DF - DF E1 E2 E3 E1 E5 E5 E7 E8 E8 EA EB EB ED EE EF - ED F1 F2 F1 F4 F4 F6 F6 F8 F8 B5 FB FC FB FE FF - -# sort_order array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 00C4 0100 0101 00C9 0104 00D6 00DC 00E1 0105 010C 00E4 010D 0106 0107 00E9 0179 - 017A 010E 00ED 010F 0112 0113 0116 00F3 0117 00F4 00F6 00F5 00FA 011A 011B 00FC - 2020 00B0 0118 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 0119 00A8 2260 0123 012E - 012F 012A 2264 2265 012B 0136 2202 2211 0142 013B 013C 013D 013E 0139 013A 0145 - 0146 0143 00AC 221A 0144 0147 2206 00AB 00BB 2026 00A0 0148 0150 00D5 0151 014C - 2013 2014 201C 201D 2018 2019 00F7 25CA 014D 0154 0155 0158 2039 203A 0159 0156 - 0157 0160 201A 201E 0161 015A 015B 00C1 0164 0165 00CD 017D 017E 016A 00D3 00D4 - 016B 016E 00DA 016F 0170 0171 0172 0173 00DD 00FD 0137 017B 0141 017C 0122 02C7 - diff --git a/sql/share/charsets/macceciai.conf b/sql/share/charsets/macceciai.conf deleted file mode 100644 index d7cdaddc425..00000000000 --- a/sql/share/charsets/macceciai.conf +++ /dev/null @@ -1,96 +0,0 @@ -# Mac OS Central European, case insensitive, accent sensitive -# -# Czech (cs), Hungarian (hu), Polish (pl), Romanian (ro), Croatian (hr), -# Slovak (sk), Slovenian (sl), Sorbian. -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 01 01 02 01 01 01 01 02 02 01 02 02 01 02 02 01 - 02 01 02 02 01 02 01 02 02 02 02 02 02 01 02 02 - 00 00 01 00 00 00 00 02 00 00 00 02 00 00 02 01 - 02 01 00 00 02 01 00 00 02 01 02 01 02 01 02 01 - 02 01 00 00 02 01 00 00 00 00 00 02 01 01 02 01 - 00 00 00 00 00 00 00 00 02 01 02 01 00 00 02 01 - 02 01 00 00 02 01 02 01 01 02 01 01 02 01 01 01 - 02 01 01 02 01 02 01 02 01 02 02 01 01 02 01 00 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 8A 82 82 8E 88 9A 9F 87 88 8B 8A 8B 8D 8D 8E 90 - 90 93 92 93 95 95 98 97 98 99 9A 9B 9C 9E 9E 9F - A0 A1 AB A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE B0 - B0 B4 B2 B3 B4 FA B6 B7 B8 BA BA BC BC BE BE C0 - C0 C4 C2 C3 C4 CB C6 C7 C8 C9 CA CB CE 9B CE D8 - D0 D1 D2 D3 D4 D5 D6 D7 D8 DA DA DE DC DD DE E0 - E0 E4 E2 E3 E4 E6 E6 87 E9 E9 92 EC EC F0 97 99 - F0 F3 9C F3 F5 F5 F7 F7 F9 F9 FA FD B8 FD AE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 81 83 84 85 86 E7 84 89 80 89 8C 8C 83 8F - 8F 91 EA 91 94 94 96 EE 96 EF 85 CD F2 9D 9D 86 - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA A2 AC AD FE AF - AF B1 B2 B3 B1 B5 B6 B7 FC B9 B9 BB BB BD BD BF - BF C1 C2 C3 C1 C5 C6 C7 C8 C9 CA C5 CC CD CC CF - D0 D1 D2 D3 D4 D5 D6 D7 CF D9 D9 DB DC DD DB DF - DF E1 E2 E3 E1 E5 E5 E7 E8 E8 EA EB EB ED EE EF - ED F1 F2 F1 F4 F4 F6 F6 F8 F8 B5 FB FC FB FE FF - -# sort_order array (must be 256 elements) - 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 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D - 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D2 D3 D4 D5 D6 - D7 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D - 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D8 D9 DA DB DC - 41 41 41 57 41 8D B2 41 41 4D 41 4D 4D 4D 57 CA - CA 53 6B 53 57 57 57 8D 57 8D 8D 8D B2 57 57 B2 - DD DE 57 DF E0 E1 E2 A7 E3 E4 E5 57 E6 E7 65 6B - 6B 6B E8 E9 6B 75 EA EB 79 79 79 79 79 79 79 85 - 85 85 EC ED 85 85 EE EF F0 F1 F2 85 8D 8D 8D 8D - F3 F4 F5 F6 F7 F8 F9 FA 8D 9F 9F 9F FB FC 9F 9F - 9F A7 FD FE A7 A7 A7 41 BE BE 6B CA CA B2 8D 8D - B2 B2 B2 B2 B2 B2 B2 B2 C6 C6 75 CA 79 CA 65 FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 00C4 0100 0101 00C9 0104 00D6 00DC 00E1 0105 010C 00E4 010D 0106 0107 00E9 0179 - 017A 010E 00ED 010F 0112 0113 0116 00F3 0117 00F4 00F6 00F5 00FA 011A 011B 00FC - 2020 00B0 0118 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 0119 00A8 2260 0123 012E - 012F 012A 2264 2265 012B 0136 2202 2211 0142 013B 013C 013D 013E 0139 013A 0145 - 0146 0143 00AC 221A 0144 0147 2206 00AB 00BB 2026 00A0 0148 0150 00D5 0151 014C - 2013 2014 201C 201D 2018 2019 00F7 25CA 014D 0154 0155 0158 2039 203A 0159 0156 - 0157 0160 201A 201E 0161 015A 015B 00C1 0164 0165 00CD 017D 017E 016A 00D3 00D4 - 016B 016E 00DA 016F 0170 0171 0172 0173 00DD 00FD 0137 017B 0141 017C 0122 02C7 - diff --git a/sql/share/charsets/maccecias.conf b/sql/share/charsets/maccecias.conf deleted file mode 100644 index 8cefd4cf9ec..00000000000 --- a/sql/share/charsets/maccecias.conf +++ /dev/null @@ -1,96 +0,0 @@ -# Mac OS Central European, case insensitive, accent sensitive -# -# Czech (cs), Hungarian (hu), Polish (pl), Romanian (ro), Croatian (hr), -# Slovak (sk), Slovenian (sl), Sorbian. -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 01 01 02 01 01 01 01 02 02 01 02 02 01 02 02 01 - 02 01 02 02 01 02 01 02 02 02 02 02 02 01 02 02 - 00 00 01 00 00 00 00 02 00 00 00 02 00 00 02 01 - 02 01 00 00 02 01 00 00 02 01 02 01 02 01 02 01 - 02 01 00 00 02 01 00 00 00 00 00 02 01 01 02 01 - 00 00 00 00 00 00 00 00 02 01 02 01 00 00 02 01 - 02 01 00 00 02 01 02 01 01 02 01 01 02 01 01 01 - 02 01 01 02 01 02 01 02 01 02 02 01 01 02 01 00 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 8A 82 82 8E 88 9A 9F 87 88 8B 8A 8B 8D 8D 8E 90 - 90 93 92 93 95 95 98 97 98 99 9A 9B 9C 9E 9E 9F - A0 A1 AB A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE B0 - B0 B4 B2 B3 B4 FA B6 B7 B8 BA BA BC BC BE BE C0 - C0 C4 C2 C3 C4 CB C6 C7 C8 C9 CA CB CE 9B CE D8 - D0 D1 D2 D3 D4 D5 D6 D7 D8 DA DA DE DC DD DE E0 - E0 E4 E2 E3 E4 E6 E6 87 E9 E9 92 EC EC F0 97 99 - F0 F3 9C F3 F5 F5 F7 F7 F9 F9 FA FD B8 FD AE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 81 83 84 85 86 E7 84 89 80 89 8C 8C 83 8F - 8F 91 EA 91 94 94 96 EE 96 EF 85 CD F2 9D 9D 86 - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA A2 AC AD FE AF - AF B1 B2 B3 B1 B5 B6 B7 FC B9 B9 BB BB BD BD BF - BF C1 C2 C3 C1 C5 C6 C7 C8 C9 CA C5 CC CD CC CF - D0 D1 D2 D3 D4 D5 D6 D7 CF D9 D9 DB DC DD DB DF - DF E1 E2 E3 E1 E5 E5 E7 E8 E8 EA EB EB ED EE EF - ED F1 F2 F1 F4 F4 F6 F6 F8 F8 B5 FB FC FB FE FF - -# sort_order array (must be 256 elements) - 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 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D - 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D2 D3 D4 D5 D6 - D7 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D - 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D8 D9 DA DB DC - 45 47 47 59 49 91 B6 43 49 4F 45 4F 51 51 59 CE - CE 55 71 55 5B 5B 5D 8F 5D 99 91 97 B8 5F 5F B6 - DD DE 61 DF E0 E1 E2 AD E3 E4 E5 61 E6 E7 67 6F - 6F 6D E8 E9 6D 77 EA EB 7B 81 82 7F 7F 7D 7D 8B - 8B 87 EC ED 87 89 EE EF F0 F1 F2 89 93 97 93 95 - F3 F4 F5 F6 F7 F8 F9 FA 95 A1 A1 A3 FB FC A3 A5 - A5 A9 FD FE A9 AB AB 43 B0 B0 71 CC CC BC 8F 99 - BC B4 B8 B4 BA BA BE BE C8 C8 77 D0 7B D0 67 FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 00C4 0100 0101 00C9 0104 00D6 00DC 00E1 0105 010C 00E4 010D 0106 0107 00E9 0179 - 017A 010E 00ED 010F 0112 0113 0116 00F3 0117 00F4 00F6 00F5 00FA 011A 011B 00FC - 2020 00B0 0118 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 0119 00A8 2260 0123 012E - 012F 012A 2264 2265 012B 0136 2202 2211 0142 013B 013C 013D 013E 0139 013A 0145 - 0146 0143 00AC 221A 0144 0147 2206 00AB 00BB 2026 00A0 0148 0150 00D5 0151 014C - 2013 2014 201C 201D 2018 2019 00F7 25CA 014D 0154 0155 0158 2039 203A 0159 0156 - 0157 0160 201A 201E 0161 015A 015B 00C1 0164 0165 00CD 017D 017E 016A 00D3 00D4 - 016B 016E 00DA 016F 0170 0171 0172 0173 00DD 00FD 0137 017B 0141 017C 0122 02C7 - diff --git a/sql/share/charsets/maccecsas.conf b/sql/share/charsets/maccecsas.conf deleted file mode 100644 index 8cc1de422f2..00000000000 --- a/sql/share/charsets/maccecsas.conf +++ /dev/null @@ -1,96 +0,0 @@ -# Mac OS Central European, case sensitive, accent sensitive -# -# Czech (cs), Hungarian (hu), Polish (pl), Romanian (ro), Croatian (hr), -# Slovak (sk), Slovenian (sl), Sorbian. -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 01 01 02 01 01 01 01 02 02 01 02 02 01 02 02 01 - 02 01 02 02 01 02 01 02 02 02 02 02 02 01 02 02 - 00 00 01 00 00 00 00 02 00 00 00 02 00 00 02 01 - 02 01 00 00 02 01 00 00 02 01 02 01 02 01 02 01 - 02 01 00 00 02 01 00 00 00 00 00 02 01 01 02 01 - 00 00 00 00 00 00 00 00 02 01 02 01 00 00 02 01 - 02 01 00 00 02 01 02 01 01 02 01 01 02 01 01 01 - 02 01 01 02 01 02 01 02 01 02 02 01 01 02 01 00 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 8A 82 82 8E 88 9A 9F 87 88 8B 8A 8B 8D 8D 8E 90 - 90 93 92 93 95 95 98 97 98 99 9A 9B 9C 9E 9E 9F - A0 A1 AB A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE B0 - B0 B4 B2 B3 B4 FA B6 B7 B8 BA BA BC BC BE BE C0 - C0 C4 C2 C3 C4 CB C6 C7 C8 C9 CA CB CE 9B CE D8 - D0 D1 D2 D3 D4 D5 D6 D7 D8 DA DA DE DC DD DE E0 - E0 E4 E2 E3 E4 E6 E6 87 E9 E9 92 EC EC F0 97 99 - F0 F3 9C F3 F5 F5 F7 F7 F9 F9 FA FD B8 FD AE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 81 83 84 85 86 E7 84 89 80 89 8C 8C 83 8F - 8F 91 EA 91 94 94 96 EE 96 EF 85 CD F2 9D 9D 86 - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA A2 AC AD FE AF - AF B1 B2 B3 B1 B5 B6 B7 FC B9 B9 BB BB BD BD BF - BF C1 C2 C3 C1 C5 C6 C7 C8 C9 CA C5 CC CD CC CF - D0 D1 D2 D3 D4 D5 D6 D7 CF D9 D9 DB DC DD DB DF - DF E1 E2 E3 E1 E5 E5 E7 E8 E8 EA EB EB ED EE EF - ED F1 F2 F1 F4 F4 F6 F6 F8 F8 B5 FB FC FB FE FF - -# sort_order array (must be 256 elements) - 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 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D - 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D2 D3 D4 D5 D6 - D7 42 4C 4E 54 58 64 66 6A 6C 74 76 7A 84 86 8E - 9C 9E A0 A8 AF B3 C1 C3 C5 C7 CB D8 D9 DA DB DC - 45 47 48 59 49 91 B6 44 4A 4F 46 50 51 52 5A CE - CF 55 72 56 5B 5C 5D 90 5E 9A 92 98 B8 5F 60 B7 - DD DE 61 DF E0 E1 E2 AD E3 E4 E5 62 E6 E7 68 6F - 70 6D E8 E9 6E 77 EA EB 7C 81 82 7F 80 7D 7E 8B - 8C 87 EC ED 88 89 EE EF F0 F1 F2 8A 93 97 94 95 - F3 F4 F5 F6 F7 F8 F9 FA 96 A1 A2 A3 FB FC A4 A5 - A6 A9 FD FE AA AB AC 43 B0 B1 71 CC CD BC 8F 99 - BD B4 B9 B5 BA BB BE BF C8 C9 78 D0 7B D1 67 FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 00C4 0100 0101 00C9 0104 00D6 00DC 00E1 0105 010C 00E4 010D 0106 0107 00E9 0179 - 017A 010E 00ED 010F 0112 0113 0116 00F3 0117 00F4 00F6 00F5 00FA 011A 011B 00FC - 2020 00B0 0118 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 0119 00A8 2260 0123 012E - 012F 012A 2264 2265 012B 0136 2202 2211 0142 013B 013C 013D 013E 0139 013A 0145 - 0146 0143 00AC 221A 0144 0147 2206 00AB 00BB 2026 00A0 0148 0150 00D5 0151 014C - 2013 2014 201C 201D 2018 2019 00F7 25CA 014D 0154 0155 0158 2039 203A 0159 0156 - 0157 0160 201A 201E 0161 015A 015B 00C1 0164 0165 00CD 017D 017E 016A 00D3 00D4 - 016B 016E 00DA 016F 0170 0171 0172 0173 00DD 00FD 0137 017B 0141 017C 0122 02C7 - diff --git a/sql/share/charsets/macroman.conf b/sql/share/charsets/macroman.conf deleted file mode 100644 index 11cbee40e94..00000000000 --- a/sql/share/charsets/macroman.conf +++ /dev/null @@ -1,91 +0,0 @@ -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 10 - 20 01 01 01 01 01 01 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 00 00 00 00 00 00 00 02 00 00 00 00 00 00 01 01 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 02 - 00 00 00 00 02 00 00 00 00 00 00 20 01 01 00 00 - 00 00 00 00 00 00 00 00 02 01 00 00 00 00 00 00 - 00 00 00 00 00 20 01 01 01 01 01 01 01 01 01 01 - 00 01 01 01 01 02 00 00 00 00 00 00 00 00 00 00 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 8A 8C 8D 8E 96 9A 9F 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD BE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA 88 8B 9B CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D8 DA DB DC DD DE DF - E0 E1 E2 E3 E4 89 90 87 91 8F 92 94 95 93 97 99 - F0 98 9C 9E 9D F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 E7 CB E5 80 CC 81 82 83 E9 - E6 E8 EA ED EB EC 84 EE F1 EF 85 CD F2 F4 F3 86 - 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 AE 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 D9 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 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must be 256 elements) - 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 49 50 52 53 57 59 60 61 67 68 69 70 71 72 - 79 80 81 82 84 85 90 91 92 93 95 A0 A1 A2 A3 A4 - A5 41 49 50 52 53 57 59 60 61 67 68 69 70 71 72 - 79 80 81 82 84 85 90 91 92 93 95 A6 A7 A8 A9 AA - 41 41 50 53 71 72 85 41 41 41 41 41 41 50 53 53 - 53 53 61 61 61 61 71 72 72 72 72 72 85 85 85 85 - AB AC AD AE AF B0 B1 82 B2 B3 B4 B5 B6 B7 48 72 - B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 48 72 - C6 C7 C8 C9 57 CA CB CC CD CE CF 41 41 72 D0 D1 - D2 D3 D4 D5 D6 D7 D8 D9 93 93 DA DB DC DD DE DF - E0 E1 E2 E3 E4 41 53 41 53 53 61 61 61 61 72 72 - F0 72 85 85 85 61 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mappping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 00C4 00C5 00C7 00C9 00D1 00D6 00DC 00E1 00E0 00E2 00E4 00E3 00E5 00E7 00E9 00E8 - 00EA 00EB 00ED 00EC 00EE 00EF 00F1 00F3 00F2 00F4 00F6 00F5 00FA 00F9 00FB 00FC - 2020 00B0 00A2 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 00B4 00A8 2260 00C6 00D8 - 221E 00B1 2264 2265 00A5 00B5 2202 2211 220F 03C0 222B 00AA 00BA 03A9 00E6 00F8 - 00BF 00A1 00AC 221A 0192 2248 2206 00AB 00BB 2026 00A0 00C0 00C3 00D5 0152 0153 - 2013 2014 201C 201D 2018 2019 00F7 25CA 00FF 0178 2044 20AC 2039 203A FB01 FB02 - 2021 00B7 201A 201E 2030 00C2 00CA 00C1 00CB 00C8 00CD 00CE 00CF 00CC 00D3 00D4 - F8FF 00D2 00DA 00DB 00D9 0131 02C6 02DC 00AF 02D8 02D9 02DA 00B8 02DD 02DB 02C7 - diff --git a/sql/share/charsets/macromanbin.conf b/sql/share/charsets/macromanbin.conf deleted file mode 100644 index d0845c07f2b..00000000000 --- a/sql/share/charsets/macromanbin.conf +++ /dev/null @@ -1,96 +0,0 @@ -# -# Mac OS Roman, accent insensitive, case insensitive -# -# Binary sort order -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 10 - 20 01 01 01 01 01 01 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 00 00 00 00 00 00 00 02 00 00 00 00 00 00 01 01 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 02 - 00 00 00 00 02 00 00 00 00 00 00 20 01 01 01 02 - 00 00 00 00 00 00 00 00 02 01 00 00 00 00 00 00 - 00 00 00 00 00 20 01 01 01 01 01 01 01 01 01 01 - 00 01 01 01 01 02 00 00 00 00 00 00 00 00 00 00 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 8A 8C 8D 8E 96 9A 9F 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD BE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA 88 8B 9B CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D8 DA DB DC DD DE DF - E0 E1 E2 E3 E4 89 90 87 91 8F 92 94 95 93 97 99 - F0 98 9C 9E 9D F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 E7 CB E5 80 CC 81 82 83 E9 - E6 E8 EA ED EB EC 84 EE F1 EF 85 CD F2 F4 F3 86 - 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 AE 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 D9 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 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 00C4 00C5 00C7 00C9 00D1 00D6 00DC 00E1 00E0 00E2 00E4 00E3 00E5 00E7 00E9 00E8 - 00EA 00EB 00ED 00EC 00EE 00EF 00F1 00F3 00F2 00F4 00F6 00F5 00FA 00F9 00FB 00FC - 2020 00B0 00A2 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 00B4 00A8 2260 00C6 00D8 - 221E 00B1 2264 2265 00A5 00B5 2202 2211 220F 03C0 222B 00AA 00BA 03A9 00E6 00F8 - 00BF 00A1 00AC 221A 0192 2248 2206 00AB 00BB 2026 00A0 00C0 00C3 00D5 0152 0153 - 2013 2014 201C 201D 2018 2019 00F7 25CA 00FF 0178 2044 20AC 2039 203A FB01 FB02 - 2021 00B7 201A 201E 2030 00C2 00CA 00C1 00CB 00C8 00CD 00CE 00CF 00CC 00D3 00D4 - F8FF 00D2 00DA 00DB 00D9 0131 02C6 02DC 00AF 02D8 02D9 02DA 00B8 02DD 02DB 02C7 - diff --git a/sql/share/charsets/macromanciai.conf b/sql/share/charsets/macromanciai.conf deleted file mode 100644 index 457e6b4f8d9..00000000000 --- a/sql/share/charsets/macromanciai.conf +++ /dev/null @@ -1,97 +0,0 @@ -# -# Mac OS Roman, accent insensitive, case insensitive -# -# Sort order: Dutch, English, French, German (Duden), -# Italian, Latin, Pogtuguese, Spanish -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 10 - 20 01 01 01 01 01 01 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 00 00 00 00 00 00 00 02 00 00 00 00 00 00 01 01 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 02 - 00 00 00 00 02 00 00 00 00 00 00 20 01 01 01 02 - 00 00 00 00 00 00 00 00 02 01 00 00 00 00 00 00 - 00 00 00 00 00 20 01 01 01 01 01 01 01 01 01 01 - 00 01 01 01 01 02 00 00 00 00 00 00 00 00 00 00 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 8A 8C 8D 8E 96 9A 9F 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD BE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA 88 8B 9B CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D8 DA DB DC DD DE DF - E0 E1 E2 E3 E4 89 90 87 91 8F 92 94 95 93 97 99 - F0 98 9C 9E 9D F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 E7 CB E5 80 CC 81 82 83 E9 - E6 E8 EA ED EB EC 84 EE F1 EF 85 CD F2 F4 F3 86 - 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 AE 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 D9 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 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must be 256 elements) - 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 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81 - 91 93 95 97 9A 9C A6 A8 AA AC B0 B2 B3 B4 B5 B6 - B7 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81 - 91 93 95 97 9A 9C A6 A8 AA AC B0 B8 B9 BA BB BC - 41 41 53 59 7D 81 9C 41 41 41 41 41 41 53 59 59 - 59 59 6A 6A 6A 6A 7D 81 81 81 81 81 9C 9C 9C 9C - BD BE BF C0 C1 C2 C3 97 C4 C5 C6 C7 C8 C9 41 81 - CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 41 81 - D8 D9 DA DB 63 DC DD DE DF E0 E1 41 41 81 81 81 - E2 E3 E4 E5 E6 E7 E8 E9 AC AC EA EB EC ED EE EF - F0 F1 F2 F3 F4 41 59 41 59 59 6A 6A 6A 6A 81 81 - F0 81 9C 9C 9C 6A F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 00C4 00C5 00C7 00C9 00D1 00D6 00DC 00E1 00E0 00E2 00E4 00E3 00E5 00E7 00E9 00E8 - 00EA 00EB 00ED 00EC 00EE 00EF 00F1 00F3 00F2 00F4 00F6 00F5 00FA 00F9 00FB 00FC - 2020 00B0 00A2 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 00B4 00A8 2260 00C6 00D8 - 221E 00B1 2264 2265 00A5 00B5 2202 2211 220F 03C0 222B 00AA 00BA 03A9 00E6 00F8 - 00BF 00A1 00AC 221A 0192 2248 2206 00AB 00BB 2026 00A0 00C0 00C3 00D5 0152 0153 - 2013 2014 201C 201D 2018 2019 00F7 25CA 00FF 0178 2044 20AC 2039 203A FB01 FB02 - 2021 00B7 201A 201E 2030 00C2 00CA 00C1 00CB 00C8 00CD 00CE 00CF 00CC 00D3 00D4 - F8FF 00D2 00DA 00DB 00D9 0131 02C6 02DC 00AF 02D8 02D9 02DA 00B8 02DD 02DB 02C7 - diff --git a/sql/share/charsets/macromancias.conf b/sql/share/charsets/macromancias.conf deleted file mode 100644 index a00d7d412e6..00000000000 --- a/sql/share/charsets/macromancias.conf +++ /dev/null @@ -1,97 +0,0 @@ -# -# Mac OS Roman, accent sensitive, case insensitive -# -# Sort order: Dutch, English, French, German (Duden), -# Italian, Latin, Pogtuguese, Spanish -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 10 - 20 01 01 01 01 01 01 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 00 00 00 00 00 00 00 02 00 00 00 00 00 00 01 01 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 02 - 00 00 00 00 02 00 00 00 00 00 00 20 01 01 01 02 - 00 00 00 00 00 00 00 00 02 01 00 00 00 00 00 00 - 00 00 00 00 00 20 01 01 01 01 01 01 01 01 01 01 - 00 01 01 01 01 02 00 00 00 00 00 00 00 00 00 00 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 8A 8C 8D 8E 96 9A 9F 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD BE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA 88 8B 9B CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D8 DA DB DC DD DE DF - E0 E1 E2 E3 E4 89 90 87 91 8F 92 94 95 93 97 99 - F0 98 9C 9E 9D F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 E7 CB E5 80 CC 81 82 83 E9 - E6 E8 EA ED EB EC 84 EE F1 EF 85 CD F2 F4 F3 86 - 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 AE 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 D9 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 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must be 256 elements) - 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 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81 - 91 93 95 97 9A 9C A6 A8 AA AC B0 B2 B3 B4 B5 B6 - B7 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81 - 91 93 95 97 9A 9C A6 A8 AA AC B0 B8 B9 BA BB BC - 4B 4D 55 5D 7F 8B A4 45 43 47 4B 49 4D 55 5D 5B - 5F 61 6E 6C 70 72 7F 85 83 87 8B 89 A0 9E A2 A4 - BD BE BF C0 C1 C2 C3 99 C4 C5 C6 C7 C8 C9 4F 8D - CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 4F 8D - D8 D9 DA DB 65 DC DD DE DF E0 E1 43 49 89 8F 8F - E2 E3 E4 E5 E6 E7 E8 E9 AE AE EA EB EC ED EE EF - F0 F1 F2 F3 F4 47 5F 45 61 5B 6E 70 70 6C 85 87 - F0 83 A0 A2 9E 72 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 00C4 00C5 00C7 00C9 00D1 00D6 00DC 00E1 00E0 00E2 00E4 00E3 00E5 00E7 00E9 00E8 - 00EA 00EB 00ED 00EC 00EE 00EF 00F1 00F3 00F2 00F4 00F6 00F5 00FA 00F9 00FB 00FC - 2020 00B0 00A2 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 00B4 00A8 2260 00C6 00D8 - 221E 00B1 2264 2265 00A5 00B5 2202 2211 220F 03C0 222B 00AA 00BA 03A9 00E6 00F8 - 00BF 00A1 00AC 221A 0192 2248 2206 00AB 00BB 2026 00A0 00C0 00C3 00D5 0152 0153 - 2013 2014 201C 201D 2018 2019 00F7 25CA 00FF 0178 2044 20AC 2039 203A FB01 FB02 - 2021 00B7 201A 201E 2030 00C2 00CA 00C1 00CB 00C8 00CD 00CE 00CF 00CC 00D3 00D4 - F8FF 00D2 00DA 00DB 00D9 0131 02C6 02DC 00AF 02D8 02D9 02DA 00B8 02DD 02DB 02C7 - diff --git a/sql/share/charsets/macromancsas.conf b/sql/share/charsets/macromancsas.conf deleted file mode 100644 index 1f67148680d..00000000000 --- a/sql/share/charsets/macromancsas.conf +++ /dev/null @@ -1,97 +0,0 @@ -# -# Mac OS Roman, accent sensitive, case sensitive -# -# Sort order: Dutch, English, French, German (Duden), -# Italian, Latin, Pogtuguese, Spanish -# -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 10 - 20 01 01 01 01 01 01 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 00 00 00 00 00 00 00 02 00 00 00 00 00 00 01 01 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 02 - 00 00 00 00 02 00 00 00 00 00 00 20 01 01 01 02 - 00 00 00 00 00 00 00 00 02 01 00 00 00 00 00 00 - 00 00 00 00 00 20 01 01 01 01 01 01 01 01 01 01 - 00 01 01 01 01 02 00 00 00 00 00 00 00 00 00 00 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 8A 8C 8D 8E 96 9A 9F 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD BE BF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA 88 8B 9B CE CF - D0 D1 D2 D3 D4 D5 D6 D7 D8 D8 DA DB DC DD DE DF - E0 E1 E2 E3 E4 89 90 87 91 8F 92 94 95 93 97 99 - F0 98 9C 9E 9D F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 E7 CB E5 80 CC 81 82 83 E9 - E6 E8 EA ED EB EC 84 EE F1 EF 85 CD F2 F4 F3 86 - 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 AE 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 D9 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 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must be 256 elements) - 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 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81 - 91 93 95 97 9A 9C A6 A8 AA AC B0 B2 B3 B4 B5 B6 - B7 42 52 54 58 5A 64 67 69 6B 76 78 7A 7C 7E 82 - 92 94 96 98 9B 9D A7 A9 AB AD B1 B8 B9 BA BB BC - 4B 4D 55 5D 7F 8B A4 46 44 48 4C 4A 4E 56 5E 5C - 60 62 6F 6D 71 73 80 86 84 88 8C 8A A1 9F A3 A5 - BD BE BF C0 C1 C2 C3 99 C4 C5 C6 C7 C8 C9 4F 8D - CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 50 8E - D8 D9 DA DB 65 DC DD DE DF E0 E1 43 49 89 8F 90 - E2 E3 E4 E5 E6 E7 E8 E9 AF AE EA EB EC ED EE EF - F0 F1 F2 F3 F4 47 5F 45 61 5B 6E 70 72 6C 85 87 - F0 83 A0 A2 9E 74 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 00C4 00C5 00C7 00C9 00D1 00D6 00DC 00E1 00E0 00E2 00E4 00E3 00E5 00E7 00E9 00E8 - 00EA 00EB 00ED 00EC 00EE 00EF 00F1 00F3 00F2 00F4 00F6 00F5 00FA 00F9 00FB 00FC - 2020 00B0 00A2 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 00B4 00A8 2260 00C6 00D8 - 221E 00B1 2264 2265 00A5 00B5 2202 2211 220F 03C0 222B 00AA 00BA 03A9 00E6 00F8 - 00BF 00A1 00AC 221A 0192 2248 2206 00AB 00BB 2026 00A0 00C0 00C3 00D5 0152 0153 - 2013 2014 201C 201D 2018 2019 00F7 25CA 00FF 0178 2044 20AC 2039 203A FB01 FB02 - 2021 00B7 201A 201E 2030 00C2 00CA 00C1 00CB 00C8 00CD 00CE 00CF 00CC 00D3 00D4 - F8FF 00D2 00DA 00DB 00D9 0131 02C6 02DC 00AF 02D8 02D9 02DA 00B8 02DD 02DB 02C7 - diff --git a/sql/share/charsets/pclatin2.conf b/sql/share/charsets/pclatin2.conf deleted file mode 100644 index dea8d085595..00000000000 --- a/sql/share/charsets/pclatin2.conf +++ /dev/null @@ -1,91 +0,0 @@ -# ctype array (must be 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00 - 01 02 02 02 02 02 02 02 02 02 01 02 02 01 01 01 - 01 01 02 02 02 01 02 01 02 01 01 01 02 01 00 02 - 02 02 02 02 01 02 01 02 01 02 00 02 01 01 00 00 - 00 00 00 00 00 01 01 01 02 00 00 00 00 01 02 00 - 00 00 00 00 00 00 01 02 00 00 00 00 00 00 00 00 - 02 01 01 01 02 01 01 01 02 00 00 00 00 01 01 00 - 01 02 01 01 02 02 01 02 01 01 02 01 02 01 02 00 - 00 00 00 00 00 00 00 00 00 00 00 02 01 02 00 48 - -# to_lower array (must be 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 87 81 82 83 84 85 86 87 88 89 8B 8B 8C AB 84 86 - 82 92 92 93 94 96 96 98 98 94 81 9C 9C 88 9E 9F - A0 A1 A2 A3 A5 A5 A7 A7 A9 A9 AA AB 9F B8 AE AF - B0 B1 B2 B3 B4 A0 83 D8 B8 B9 BA BB BC BE BE BF - C0 C1 C2 C3 C4 C5 C7 C7 C8 C9 CA CB CC CD CE CF - D0 D0 D4 89 D4 E5 A1 8C D8 D9 DA DB DC EE 85 DF - A2 E1 93 E4 E4 E5 E7 E7 EA A3 E8 FB EC EC EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must be 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 9A 90 B6 8E DE 8F 80 9D D3 8A 8A D7 8D 8E 8F - 90 91 91 E2 99 95 95 97 97 99 9A 9B 9B 9D 9E AC - B5 D6 E0 E9 A4 A4 A6 A6 A8 A8 AA 8D AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 AD B9 BA BB BC BE BD BF - C0 C1 C2 C3 C4 C5 C6 C6 C8 C9 CA CB CC CD CE CF - D1 D1 D2 D3 D2 D5 D6 D7 B7 D9 DA DB DC DD DE DF - E0 E1 E2 E3 E3 D5 E6 E6 E8 E9 E8 EB ED ED DD EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA EB FC FC FE FF - -# sort_order array (must be 256 elements) - 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 47 48 4C 4F 54 55 56 57 5A 5B 5C 5E 5F 62 - 67 68 69 6C 71 74 75 76 77 78 7B 90 91 92 93 94 - 95 41 47 48 4C 4F 54 55 56 57 5A 5B 5C 5E 5F 62 - 67 68 69 6C 71 74 75 76 77 78 7B 96 97 98 99 9A - 48 74 4F 41 41 74 48 48 5C 4F 62 62 57 7B 41 48 - 4F 5C 5C 62 62 5C 5C 6C 6C 62 74 71 71 5C 9E 48 - 41 57 62 74 41 41 7B 7B 4F 4F AA 7B 48 6C AE AF - B0 B1 B2 B3 B4 41 41 4F 6C B5 BA BB BC 7B 7B BF - C0 C1 C2 C3 C4 C5 41 41 C8 C9 CA CB CC CD CE CF - 4C 4C 4C 4F 4C 60 57 57 4F D9 DA DB DC 71 74 DF - 62 70 62 60 60 60 6C 6C 69 74 69 74 78 78 71 EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA 74 69 69 FE FF - -# Unicode mappping (must be 256 elements) - 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F - 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F - 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F - 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F - 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F - 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F - 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F - 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F - 00C7 00FC 00E9 00E2 00E4 016F 0107 00E7 0142 00EB 0150 0151 00EE 0179 00C4 0106 - 00C9 0139 013A 00F4 00F6 013D 013E 015A 015B 00D6 00DC 0164 0165 0141 00D7 010D - 00E1 00ED 00F3 00FA 0104 0105 017D 017E 0118 0119 00AC 017A 010C 015F 00AB 00BB - 2591 2592 2593 2502 2524 00C1 00C2 011A 015E 2563 2551 2557 255D 017B 017C 2510 - 2514 2534 252C 251C 2500 253C 0102 0103 255A 2554 2569 2566 2560 2550 256C 00A4 - 0111 0110 010E 00CB 010F 0147 00CD 00CE 011B 2518 250C 2588 2584 0162 016E 2580 - 00D3 00DF 00D4 0143 0144 0148 0160 0161 0154 00DA 0155 0170 00FD 00DD 0163 00B4 - 00AD 02DD 02DB 02C7 02D8 00A7 00F7 00B8 00B0 00A8 02D9 0171 0158 0159 25A0 00A0 - diff --git a/sql/share/charsets/swe7.conf b/sql/share/charsets/swe7.conf deleted file mode 100644 index 49938800f39..00000000000 --- a/sql/share/charsets/swe7.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the swe7 character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 01 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 10 - 01 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - -# to_lower array (must have 256 elements) - 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 - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 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 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must have 256 elements) - 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 - 45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 59 5F - 45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 59 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -00C9 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 00C4 00D6 00C5 00DC 005F -00E9 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 00E4 00F6 00E5 00FC 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 diff --git a/sql/share/charsets/usa7.conf b/sql/share/charsets/usa7.conf deleted file mode 100644 index 380fc9b5d8b..00000000000 --- a/sql/share/charsets/usa7.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the usa7 character set - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - -# to_lower array (must have 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 5E 5F - 45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 59 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 - 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 DF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 diff --git a/sql/share/charsets/win1250.conf b/sql/share/charsets/win1250.conf deleted file mode 100644 index 0a5b5074bde..00000000000 --- a/sql/share/charsets/win1250.conf +++ /dev/null @@ -1,92 +0,0 @@ -# Configuration file for the win1250 character set. - -# The ctype array must have 257 elements. - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 20 20 10 20 10 10 10 10 20 10 01 10 01 01 01 01 - 20 10 10 10 10 10 10 10 20 10 02 10 02 02 02 02 - 48 10 10 01 10 01 10 01 10 10 01 10 10 10 10 01 - 10 10 10 02 10 10 10 10 10 02 02 10 01 10 02 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10 - -# The to_lower array must have 256 elements. - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 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 - 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 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# The to_upper array must have 256 elements. - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 8A 9B 8C 8D 8E 8F - 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 - 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 - -# The sort_order array must have 256 elements. - 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 49 4A 4B 4C 4D 4E 4F 50 52 53 55 - 56 57 58 59 5B 5C 5D 5E 5F 60 61 63 64 65 66 67 - 68 41 42 43 46 49 4A 4B 4C 4D 4E 4F 50 52 53 55 - 56 57 58 59 5B 5C 5D 5E 5F 60 61 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 5A 8B 5A 5B 62 62 - 90 91 92 93 94 95 96 97 98 99 5A 9B 5A 5B 62 62 - 20 A1 A2 50 A4 41 A6 59 A8 A9 59 AB AC AD AE 62 - B0 B1 B2 50 B4 B5 B6 B7 B8 41 59 BB 50 BD 50 62 - 58 41 41 41 41 50 45 43 44 49 49 49 49 4D 4D 46 - 47 53 53 55 55 55 55 D7 58 5C 5C 5C 5C 60 5B 59 - 58 41 41 41 41 50 45 43 44 49 49 49 49 4D 4D 46 - 47 53 53 55 55 55 55 F7 58 5C 5C 5C 5C 60 5B FF - -# Unicode mapping table (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -20AC 0000 201A 0000 201E 2026 2020 2021 0000 2030 0160 2039 015A 0164 017D 0179 -0000 2018 2019 201C 201D 2022 2013 2014 0000 2122 0161 203A 015B 0165 017E 017A -00A0 02C7 02D8 0141 00A4 0104 00A6 00A7 00A8 00A9 015E 00AB 00AC 00AD 00AE 017B -00B0 00B1 02DB 0142 00B4 00B5 00B6 00B7 00B8 0105 015F 00BB 013D 02DD 013E 017C -0154 00C1 00C2 0102 00C4 0139 0106 00C7 010C 00C9 0118 00CB 011A 00CD 00CE 010E -0110 0143 0147 00D3 00D4 0150 00D6 00D7 0158 016E 00DA 0170 00DC 00DD 0162 00DF -0155 00E1 00E2 0103 00E4 013A 0107 00E7 010D 00E9 0119 00EB 011B 00ED 00EE 010F -0111 0144 0148 00F3 00F4 0151 00F6 00F7 0159 016F 00FA 0171 00FC 00FD 0163 02D9 diff --git a/sql/share/charsets/win1251.conf b/sql/share/charsets/win1251.conf deleted file mode 100644 index 2164cb36b9e..00000000000 --- a/sql/share/charsets/win1251.conf +++ /dev/null @@ -1,100 +0,0 @@ -# Configuration file for the win1251 character set - -# NOTE: this character set is deprecated. Please don't use it -# unless you must because of old tables. -# -# If you want to convert your files to charset cp1251, you can do: -# -# myisamchk -rq --set-character-set-name=cp1251 *.MYI - - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 01 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 02 10 10 10 10 10 10 10 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - -# to_lower array (must have 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC 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 F5 F7 F8 F9 FA FB FC FD FE FF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# to_upper array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 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 A8 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF - D0 D1 D2 D3 D4 D5 D5 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 D7 D8 D9 DA DB DC DD DE DF - -# sort_order array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 A3 A4 A5 A6 A7 C6 A9 AA AB AC AD AE AF - B0 B1 B2 B3 B4 B5 B6 B7 C6 B9 BA BB BC BD BE BF - C0 C1 C2 C3 C4 C5 C7 C8 C9 CA CB CC CD CE CF D0 - D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 - C0 C1 C2 C3 C4 C5 C7 C8 C9 CA CB CC CD CE CF D0 - D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0402 0403 201A 0453 201E 2026 2020 2021 0000 2030 0409 2039 040A 040C 040B 040F -0452 2018 2019 201C 201D 2022 2013 2014 0000 2122 0459 203A 045A 045C 045B 045F -00A0 040E 045E 0408 00A4 0490 00A6 00A7 0401 00A9 0404 00AB 00AC 00AD 00AE 0407 -00B0 00B1 0406 0456 0491 00B5 00B6 00B7 0451 2116 0454 00BB 0458 0405 0455 0457 -0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 041A 041B 041C 041D 041E 041F -0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F -0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F -0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F diff --git a/sql/share/charsets/win1251ukr.conf b/sql/share/charsets/win1251ukr.conf deleted file mode 100644 index da08e4c7d6f..00000000000 --- a/sql/share/charsets/win1251ukr.conf +++ /dev/null @@ -1,95 +0,0 @@ -# Configuration file for the win1251ukr character set - -# it's really, just a cp1251 charset with Ukranian letter -# marked as "letters" - -# ctype array (must have 257 elements) - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 01 10 01 10 10 10 10 01 - 10 10 01 02 10 10 10 10 02 10 02 10 10 10 10 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - -# to_lower array (must have 256 elements) - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 20 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 20 20 A5 20 20 A8 20 AA 20 20 20 20 AF - 20 20 B2 B2 A5 20 20 20 A8 20 AA 20 20 20 20 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 DF - 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 DF - -# to_upper array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 20 20 B4 20 20 B8 20 BA 20 20 20 20 BF - 20 20 B3 B3 B4 20 20 20 B8 20 BA 20 20 20 20 BF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -# sort_order array (must have 256 elements) - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 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 C0 C1 C2 C3 C4 - C5 C6 C7 C8 C9 84 CA CB 88 CC 87 CD CE CF D0 8D - D1 D2 8C 8C 84 D3 D4 D5 88 D6 87 D7 D8 D9 DA 8D - 80 81 82 83 85 86 89 8A 8B 8E 8F 90 91 92 93 94 - 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 - 80 81 82 83 85 86 89 8A 8B 8E 8F 90 91 92 93 94 - 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 - -# Unicode mapping (256 elements) -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -0402 0403 201A 0453 201E 2026 2020 2021 0000 2030 0409 2039 040A 040C 040B 040F -0452 2018 2019 201C 201D 2022 2013 2014 0000 2122 0459 203A 045A 045C 045B 045F -00A0 040E 045E 0408 00A4 0490 00A6 00A7 0401 00A9 0404 00AB 00AC 00AD 00AE 0407 -00B0 00B1 0406 0456 0491 00B5 00B6 00B7 0451 2116 0454 00BB 0458 0405 0455 0457 -0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 041A 041B 041C 041D 041E 041F -0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F -0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F -0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F From f6033157d905de45ec0e2957ba19d9ca9251c401 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 17:56:02 +0400 Subject: [PATCH 164/220] charset.c: debug code has been removed , mysys/charset.c: debug code has been removed , --- mysys/charset.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mysys/charset.c b/mysys/charset.c index c94f2e91817..35651cc59e7 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -244,7 +244,6 @@ static int fill_uint16(uint16 *a,uint size,const char *str, uint len) { uint i=0; const char *s, *b, *e=str+len; - char buf[6]; for (s=str ; ssize) break; - mstr(buf,b,6,s-b); a[i]=my_strntol(my_charset_latin1,b,s-b,NULL,16); } return 0; From 58ad6047d4d821b3b4c9251a62fdb78320d9043a Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 17:57:23 +0400 Subject: [PATCH 165/220] Index.xml: typo fix sql/share/charsets/Index.xml: typo fix --- sql/share/charsets/Index.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/share/charsets/Index.xml b/sql/share/charsets/Index.xml index fcd46970701..1cd40478fba 100644 --- a/sql/share/charsets/Index.xml +++ b/sql/share/charsets/Index.xml @@ -6,7 +6,7 @@ This file lists all of the available character sets. To make maintaining easier please: - keep records sorted by collation number. - - change charset-list.max-id when adding a new collation. + - change charsets.max-id when adding a new collation. From 5a5e086ea7ef713a54f0882551a0e995db22d67f Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 18:18:45 +0400 Subject: [PATCH 166/220] Index.xml: fixes sql/share/charsets/Index.xml: fixes --- sql/share/charsets/Index.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sql/share/charsets/Index.xml b/sql/share/charsets/Index.xml index 1cd40478fba..4e3baf3e875 100644 --- a/sql/share/charsets/Index.xml +++ b/sql/share/charsets/Index.xml @@ -76,7 +76,6 @@ To make maintaining easier please: Western csisolatin1 - csisolatin1 iso-8859-1 iso-ir-100 iso_8859-1 @@ -145,7 +144,7 @@ To make maintaining easier please: csascii iso-ir-6 iso646-us - + From e3c7f4d85ec4caf59fc408cf5643e5dc64e9a3d4 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 20:18:49 +0200 Subject: [PATCH 167/220] A lot of portability fixes. Added rename table for BDB. This fixes a bug in ALTER TABLE with BDB tables. BUILD/SETUP.sh: Enabled uninitalized warnings for debug builds. Build-tools/Do-compile: Added options --no-mysqltest and --no-benchmarks Log time before each stage Removed warnings on some OS (at least hpux11) acinclude.m4: Fixed call to wrong function configure.in: Don't use -O3 as compiler option with aCC innobase/include/univ.i: Removed compiler warning (on Hpux11) innobase/os/os0file.c: Removed compiler warning (on Hpux11) innobase/trx/trx0sys.c: Removed compiler warning (on Hpux11) innobase/trx/trx0trx.c: Removed compiler warning (on Hpux11) innobase/ut/ut0ut.c: Removed compiler warning (with gcc) myisam/mi_check.c: Added missing 'static' myisam/mi_test1.c: Added missing 'static' mysys/my_getopt.c: Added missing 'static' sql/ha_berkeley.cc: Added rename table. This fixes a bug in ALTER TABLE with BDB tables. Fixed compilation problem on OSF1 sql/ha_berkeley.h: Added rename table. This fixes a bug in ALTER TABLE with BDB tables. sql/mini_client.cc: Added reinterpret cast to avoid some warnings. sql/sql_parse.cc: Added reinterpret cast to avoid some warnings. Removed usage of strnlen() as this gave portability problems. sql/sql_union.cc: Added reinterpret cast to avoid some warnings. sql/table.cc: Added reinterpret cast to avoid some warnings. tools/mysqlmanager.c: Added missing 'static' --- BUILD/SETUP.sh | 2 +- Build-tools/Do-compile | 53 ++++++++++++++++++++++++++++++++--------- acinclude.m4 | 2 +- configure.in | 5 +++- innobase/include/univ.i | 1 + innobase/os/os0file.c | 2 +- innobase/trx/trx0sys.c | 6 ++--- innobase/trx/trx0trx.c | 2 +- innobase/ut/ut0ut.c | 1 - myisam/mi_check.c | 2 +- myisam/mi_test1.c | 2 +- mysys/my_getopt.c | 4 ++-- sql/ha_berkeley.cc | 24 +++++++++++++++++-- sql/ha_berkeley.h | 1 + sql/mini_client.cc | 11 ++++++--- sql/sql_parse.cc | 11 +++++---- sql/sql_union.cc | 2 +- sql/table.cc | 2 +- tools/mysqlmanager.c | 2 +- 19 files changed, 99 insertions(+), 36 deletions(-) diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index 859150c3954..9a092b84a8f 100644 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -48,7 +48,7 @@ fast_cflags="-O3 -fno-omit-frame-pointer" # this is one is for someone who thinks 1% speedup is worth not being # able to backtrace reckless_cflags="-O3 -fomit-frame-pointer " -debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX -O1" +debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX -O1 -Wuninitialized" base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti" diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index 52c1951f48f..4351a4f69f4 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -8,7 +8,7 @@ use Getopt::Long; $opt_distribution=$opt_user=$opt_config_env=""; $opt_dbd_options=$opt_perl_options=$opt_config_options=$opt_make_options=$opt_suffix=""; $opt_tmp=$opt_version_suffix=""; -$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_debug=0; +$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=0; $opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=0; GetOptions( @@ -30,7 +30,9 @@ GetOptions( "no-crash-me", "no-perl", "no-strip", - "no-test|no-mysqltest", + "no-test", + "no-mysqltest", + "no-benchmark", "perl-files=s", "perl-options=s", "raid", @@ -148,6 +150,7 @@ select STDOUT; $|=1; info("Compiling MySQL$opt_version_suffix at $host$opt_suffix, stage: $opt_stage\n"); +log_timestamp(); if (-x "$host/bin/mysqladmin") { @@ -161,6 +164,7 @@ kill_all("mysqlmanager"); if ($opt_stage == 0) { + log_timestamp(); print "$host: Removing old distribution\n" if ($opt_debug); if (!$opt_use_old_distribution) { @@ -209,6 +213,7 @@ safe_cd("$pwd/$host/$ver"); if ($opt_stage <= 1) { # Fix files if this is in another timezone than the build host + log_timestamp(); unlink("config.cache"); unlink("bdb/build_unix/config.cache"); unlink("innobase/config.cache"); @@ -252,6 +257,7 @@ if ($opt_stage <= 1) if ($opt_stage <= 2) { my ($command); + log_timestamp(); unlink($opt_distribution) if ($opt_delete && !$opt_use_old_distribution); $command=$make; $command.= " $opt_make_options" if (defined($opt_make_options) && $opt_make_options ne ""); @@ -264,6 +270,7 @@ if ($opt_stage <= 2) if ($opt_stage <= 3) { my $flags= ""; + log_timestamp(); log_system("rm -fr mysql-3* mysql-4* $pwd/$host/*.tar.gz"); log_system("nm -n sql/mysqld | gzip -9 -v 2>&1 > sql/mysqld.sym.gz | cat"); @@ -292,6 +299,7 @@ if (!defined($tar_file)) # if ($opt_stage <= 4 && !$opt_no_test) { + log_timestamp(); rm_all(<$pwd/$host/test/*>); safe_cd("$pwd/$host/test"); safe_system("gunzip < $tar_file | $tar xf -"); @@ -305,8 +313,9 @@ $ENV{"LD_LIBRARY_PATH"}= "$test_dir/lib:" . $ENV{"LD_LIBRARY_PATH"}; # # Run the test suite # -if ($opt_stage <= 5 && !$opt_no_test) +if ($opt_stage <= 5 && !$opt_no_test && !$opt_no_mysqltest) { + log_timestamp(); system("mkdir $bench_tmpdir") if (! -d $bench_tmpdir); safe_cd("${test_dir}/mysql-test"); check_system("./mysql-test-run --warnings --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful"); @@ -315,7 +324,7 @@ if ($opt_stage <= 5 && !$opt_no_test) # # Start the server if we are going to run any of the benchmarks # -if (!$opt_no_test) +if (!$opt_no_test && !$opt_no_benchmark) { my $extra; safe_cd($test_dir); @@ -339,8 +348,10 @@ if (!$opt_no_test) # # Compile and install the required Perl modules # -if ($opt_stage <= 7 && $opt_perl_files && !$opt_no_perl && !$opt_no_test) +if ($opt_stage <= 7 && $opt_perl_files && !$opt_no_perl && !$opt_no_test && + !$opt_no_benchmark) { + log_timestamp(); safe_cd($test_dir); rm_all("perl"); safe_system("mkdir perl"); @@ -376,6 +387,7 @@ if ($opt_stage <= 7 && $opt_perl_files && !$opt_no_perl && !$opt_no_test) # if ($opt_stage <= 8 && !$opt_no_test && !$opt_no_crash_me) { + log_timestamp(); safe_cd("$test_dir/sql-bench"); log_system("rm -f limits/mysql.cfg"); safe_system("perl ./crash-me --force --batch-mode $connect_option"); @@ -384,8 +396,9 @@ if ($opt_stage <= 8 && !$opt_no_test && !$opt_no_crash_me) # # Run sql-bench Benchmarks # -if ($opt_stage <= 9 && !$opt_no_test) +if ($opt_stage <= 9 && !$opt_no_test && !$opt_no_benchmark) { + log_timestamp(); safe_cd("$test_dir/sql-bench"); log_system("rm -f output/*"); $tmp= $opt_fast_benchmark ? "--fast --user root --small-test" : ""; @@ -469,7 +482,13 @@ Do not run the "crash-me" test Do not strip the binaries included in the binary distribution --no-test -Do not run any tests +Do not run any tests. + +--no-benchmark +Do not run the benchmark test (written in perl) + +--no-mysqltest +Do not run the the mysql-test-run test (Same as 'make test') --perl-files=list of files Compile and install the given perl modules. @@ -532,6 +551,7 @@ sub abort my($mail_header_file); print LOG "\n$message\n"; print "$host: $message\n" if ($opt_debug); + print LOG "Aborting\n"; close LOG; if ($opt_user) @@ -547,7 +567,6 @@ sub abort unlink($mail_header_file); unlink("$log.mail"); } - print LOG "Aborting\n"; exit 1; } @@ -689,9 +708,10 @@ sub rm_all sub kill_all { my ($pattern) = @_; - my ($USER,$BSD,$LINUX, $pscmd, $user, $pid); + my ($USER,$BSD,$LINUX, $pscmd, $user, $os, $pid); $user=$ENV{'USER'}; - $BSD = -f '/vmunix' || $ENV{"OS"} eq "SunOS4" || $^O eq 'darwin'; + $os=defined($ENV{'OS'}) ? $ENV{'OS'} : "unknown"; + $BSD = -f '/vmunix' || $os eq "SunOS4" || $^O eq 'darwin'; $LINUX = $^O eq 'linux'; $pscmd = $BSD ? "/bin/ps -auxww" : $LINUX ? "/bin/ps axuw" : "/bin/ps -ef"; @@ -707,7 +727,7 @@ sub kill_all { chop($cand); ($pid_user, $pid) = split(' ', $cand); - next if $pid == $$; + next if $pid eq $$; next process if (! ($cand =~ $pattern) || $pid_user ne $user); print LOG "Killing $_\n"; &killpid($pid); @@ -730,3 +750,14 @@ sub killpid } print LOG "$pid will not die!\n"; } + +# +# return the current date as a string (YYYY-MM-DD HH:MM:SS) +# +sub log_timestamp +{ + my @ta=localtime(time()); + print LOG sprintf("%4d-%02d-%02d %02d:%02d:%02d\n", + $ta[5]+1900, $ta[4]+1, $ta[3], $ta[2], $ta[1], $ta[0]); + +} diff --git a/acinclude.m4 b/acinclude.m4 index 7436b5136a5..cf0233fa38f 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -623,7 +623,7 @@ main() FILE *file=fopen("conftestval", "w"); f = (float) ll; fprintf(file,"%g\n",f); - close(file); + fclose(file); exit (0); }], ac_cv_conv_longlong_to_float=`cat conftestval`, ac_cv_conv_longlong_to_float=0, ifelse([$2], , , ac_cv_conv_longlong_to_float=$2))])dnl if test "$ac_cv_conv_longlong_to_float" = "1" -o "$ac_cv_conv_longlong_to_float" = "yes" diff --git a/configure.in b/configure.in index 9e3a8ffc516..0375cc61235 100644 --- a/configure.in +++ b/configure.in @@ -879,6 +879,7 @@ int main() # MAX_C_OPTIMIZE="-O3" +MAX_CXX_OPTIMIZE="-O3" case $SYSTEM_TYPE in *solaris2.7*) @@ -946,6 +947,8 @@ case $SYSTEM_TYPE in then CFLAGS="$CFLAGS +DD64 -DHAVE_BROKEN_INLINE" CXXFLAGS="$CXXFLAGS +DD64 +O2" + MAX_C_OPTIMIZE="" + MAX_CXX_OPTIMIZE="" fi ;; *rhapsody*) @@ -1404,7 +1407,7 @@ if test "$ac_cv_prog_cxx_g" = "yes" then DEBUG_CXXFLAGS="-g" DEBUG_OPTIMIZE_CXX="-O" - OPTIMIZE_CXXFLAGS="-O3" + OPTIMIZE_CXXFLAGS="$MAX_CXX_OPTIMIZE" else DEBUG_CXXFLAGS="-g" DEBUG_OPTIMIZE_CXX="" diff --git a/innobase/include/univ.i b/innobase/include/univ.i index 43130549eae..bf606efcf64 100644 --- a/innobase/include/univ.i +++ b/innobase/include/univ.i @@ -57,6 +57,7 @@ of the 32-bit x86 assembler in mutex operations. */ Microsoft Visual C++ */ #if !defined(__GNUC__) && !defined(__WIN__) +#undef UNIV_MUST_NOT_INLINE /* Remove compiler warning */ #define UNIV_MUST_NOT_INLINE #endif diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index 9eae358c7fb..fa5482a8cd1 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -2127,7 +2127,7 @@ os_aio_simulated_handle( ulint offs; ulint lowest_offset; byte* combined_buf; - byte* combined_buf2; + byte* combined_buf2= 0; /* Remove warning */ ibool ret; ulint n; ulint i; diff --git a/innobase/trx/trx0sys.c b/innobase/trx/trx0sys.c index 33c962772e8..0c10040847e 100644 --- a/innobase/trx/trx0sys.c +++ b/innobase/trx/trx0sys.c @@ -472,9 +472,9 @@ trx_sys_update_mysql_binlog_offset( if (0 != ut_memcmp(sys_header + field + TRX_SYS_MYSQL_LOG_NAME, file_name, 1 + ut_strlen(file_name))) { - mlog_write_string(sys_header + field - + TRX_SYS_MYSQL_LOG_NAME, - file_name, 1 + ut_strlen(file_name), mtr); + mlog_write_string((byte*) (sys_header + field + + TRX_SYS_MYSQL_LOG_NAME), + (byte*) file_name, 1 + ut_strlen(file_name), mtr); } if (mach_read_from_4(sys_header + field diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c index f0077f941de..d2219ed019f 100644 --- a/innobase/trx/trx0trx.c +++ b/innobase/trx/trx0trx.c @@ -99,7 +99,7 @@ trx_create( trx->mysql_log_file_name = NULL; trx->mysql_log_offset = 0; - trx->mysql_master_log_file_name = ""; + trx->mysql_master_log_file_name = (char*) ""; trx->mysql_master_log_pos = 0; trx->ignore_duplicates_in_insert = FALSE; diff --git a/innobase/ut/ut0ut.c b/innobase/ut/ut0ut.c index ff5d11d84ed..bb5eb662cd7 100644 --- a/innobase/ut/ut0ut.c +++ b/innobase/ut/ut0ut.c @@ -197,7 +197,6 @@ ut_get_year_month_day( *month = (ulint)cal_tm.wMonth; *day = (ulint)cal_tm.wDay; #else - struct tm cal_tm; struct tm* cal_tm_ptr; time_t tm; diff --git a/myisam/mi_check.c b/myisam/mi_check.c index d1165899bea..540f3c92ad3 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -3650,7 +3650,7 @@ void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part, } -ha_checksum mi_byte_checksum(const byte *buf, uint length) +static ha_checksum mi_byte_checksum(const byte *buf, uint length) { ha_checksum crc; const byte *end=buf+length; diff --git a/myisam/mi_test1.c b/myisam/mi_test1.c index bcb9cd172ec..8ea97c8e489 100644 --- a/myisam/mi_test1.c +++ b/myisam/mi_test1.c @@ -57,7 +57,7 @@ int main(int argc,char *argv[]) } -int run_test(const char *filename) +static int run_test(const char *filename) { MI_INFO *file; int i,j,error,deleted,rec_length,uniques=0; diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index b2ee6e0f373..21adb9374ce 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -572,7 +572,7 @@ static longlong eval_num_suffix (char *argument, int *error, char *option_name) In case of an error, set error value in *err. */ -longlong getopt_ll (char *arg, const struct my_option *optp, int *err) +static longlong getopt_ll(char *arg, const struct my_option *optp, int *err) { longlong num; @@ -596,7 +596,7 @@ longlong getopt_ll (char *arg, const struct my_option *optp, int *err) values. */ -static ulonglong getopt_ull (char *arg, const struct my_option *optp, int *err) +static ulonglong getopt_ull(char *arg, const struct my_option *optp, int *err) { ulonglong num; diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 06acf4fa2e3..2154fbd7a32 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -1921,6 +1921,26 @@ int ha_berkeley::delete_table(const char *name) DBUG_RETURN(error); } +int ha_berkeley::rename_table(const char * from, const char * to) +{ + int error; + char from_buff[FN_REFLEN]; + char to_buff[FN_REFLEN]; + + if ((error= db_create(&file, db_env, 0))) + my_errno= error; + else + { + /* On should not do a file->close() after rename returns */ + error= file->rename(file, + fn_format(from_buff, from, "", ha_berkeley_ext, 2 | 4), + NULL, fn_format(to_buff, to, "", ha_berkeley_ext, + 2 | 4), 0); + } + return error; +} + + /* How many seeks it will take to read through the table This is to be comparable to the number returned by records_in_range so @@ -2080,7 +2100,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt) free(stat); stat=0; } - if (key_file[i]->stat(key_file[i], (void*) &stat, 0, 0)) + if ((key_file[i]->stat)(key_file[i], (void*) &stat, 0, 0)) goto err; /* purecov: inspected */ share->rec_per_key[i]= (stat->bt_ndata / (stat->bt_nkeys ? stat->bt_nkeys : 1)); @@ -2093,7 +2113,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt) free(stat); stat=0; } - if (file->stat(file, (void*) &stat, 0, 0)) + if ((file->stat)(file, (void*) &stat, 0, 0)) goto err; /* purecov: inspected */ } pthread_mutex_lock(&share->mutex); diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h index f2a81d123f1..d2dc5e3216d 100644 --- a/sql/ha_berkeley.h +++ b/sql/ha_berkeley.h @@ -152,6 +152,7 @@ class ha_berkeley: public handler int create(const char *name, register TABLE *form, HA_CREATE_INFO *create_info); int delete_table(const char *name); + int rename_table(const char* from, const char* to); THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); diff --git a/sql/mini_client.cc b/sql/mini_client.cc index 5600983817b..38b3c22b91b 100644 --- a/sql/mini_client.cc +++ b/sql/mini_client.cc @@ -542,10 +542,13 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, bzero((char*) &UNIXaddr,sizeof(UNIXaddr)); UNIXaddr.sun_family = AF_UNIX; strmov(UNIXaddr.sun_path, unix_socket); - if (mc_sock_connect(sock,(struct sockaddr *) &UNIXaddr, sizeof(UNIXaddr), + if (mc_sock_connect(sock, + my_reinterpret_cast(struct sockaddr *) (&UNIXaddr), + sizeof(UNIXaddr), mysql->options.connect_timeout) <0) { - DBUG_PRINT("error",("Got error %d on connect to local server",socket_errno)); + DBUG_PRINT("error",("Got error %d on connect to local server", + socket_errno)); net->last_errno=CR_CONNECTION_ERROR; sprintf(net->last_error,ER(net->last_errno),unix_socket,socket_errno); goto error; @@ -632,7 +635,9 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, my_gethostbyname_r_free(); } sock_addr.sin_port = (ushort) htons((ushort) port); - if (mc_sock_connect(sock,(struct sockaddr *) &sock_addr, sizeof(sock_addr), + if (mc_sock_connect(sock, + my_reinterpret_cast(struct sockaddr *) (&sock_addr), + sizeof(sock_addr), mysql->options.connect_timeout) <0) { DBUG_PRINT("error",("Got error %d on connect to '%s'", diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 599c31d43ca..a0336d0b50b 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -497,7 +497,8 @@ check_connections(THD *thd) { vio_in_addr(net->vio,&thd->remote.sin_addr); thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors); - thd->host[strnlen(thd->host, HOSTNAME_LENGTH)]= 0; + /* Cut very long hostnames to avoid possible overflows */ + thd->host[min(strlen(thd->host), HOSTNAME_LENGTH)]= 0; if (connect_errors > max_connect_errors) return(ER_HOST_IS_BLOCKED); } @@ -2012,7 +2013,8 @@ mysql_execute_command(void) goto error; } walk->lock_type= auxi->lock_type; - auxi->table= (TABLE *) walk; // Remember corresponding table + // Store address to table as we need it later + auxi->table= my_reinterpret_cast(TABLE *) (walk); } if (add_item_to_list(new Item_null())) { @@ -2025,7 +2027,8 @@ mysql_execute_command(void) break; /* Fix tables-to-be-deleted-from list to point at opened tables */ for (auxi=(TABLE_LIST*) aux_tables ; auxi ; auxi=auxi->next) - auxi->table= ((TABLE_LIST*) auxi->table)->table; + auxi->table= (my_reinterpret_cast(TABLE_LIST*) (auxi->table))->table; + if (!thd->fatal_error && (result= new multi_delete(thd,aux_tables, table_count))) { @@ -3321,7 +3324,7 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result) } else aux->shared=1; // Mark that it's used twice - aux->table=(TABLE *) cursor; + aux->table= my_reinterpret_cast(TABLE *) (cursor); } } } diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 8cead6596b4..4e36ccafefc 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -52,7 +52,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result) { if (cursor->do_redirect) // False if CUBE/ROLLUP { - cursor->table= ((TABLE_LIST*) cursor->table)->table; + cursor->table= (my_reinterpret_cast(TABLE_LIST*) (cursor->table))->table; cursor->do_redirect= 0; } } diff --git a/sql/table.cc b/sql/table.cc index 62163819599..7e284c89871 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -144,7 +144,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, bzero((char*) keyinfo,n_length); outparam->key_info=keyinfo; outparam->max_key_length= outparam->total_key_length= 0; - key_part= (KEY_PART_INFO*) (keyinfo+keys); + key_part= my_reinterpret_cast(KEY_PART_INFO*) (keyinfo+keys); strpos=disk_buff+6; ulong *rec_per_key; diff --git a/tools/mysqlmanager.c b/tools/mysqlmanager.c index e6fab63c5b3..790a5d56b5a 100644 --- a/tools/mysqlmanager.c +++ b/tools/mysqlmanager.c @@ -1241,7 +1241,7 @@ static void handle_child(int __attribute__((unused)) sig) signal(SIGCHLD,handle_child); } -struct manager_thd* manager_thd_new(Vio* vio) +static struct manager_thd* manager_thd_new(Vio* vio) { struct manager_thd* tmp; if (!(tmp=(struct manager_thd*)my_malloc(sizeof(*tmp), From db060cb713edaccfc447dda687a5e58c5b5b4e7a Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jan 2003 21:58:06 +0200 Subject: [PATCH 168/220] btr0pcur.c: Fix bug: an index cursor can theoretically be restored in a wrong place log0log.c: Fix bug: if combined log file size is >= 2 GB in a 32-bit computer InnoDB can write log to a wrong position innobase/log/log0log.c: Fix bug: if combined log file size is >= 2 GB in a 32-bit computer InnoDB can write log to a wrong position innobase/btr/btr0pcur.c: Fix bug: an index cursor can theoretically be restored in a wrong place --- innobase/btr/btr0pcur.c | 5 +++++ innobase/log/log0log.c | 32 +++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/innobase/btr/btr0pcur.c b/innobase/btr/btr0pcur.c index b2115dfdd6c..7b817d8263d 100644 --- a/innobase/btr/btr0pcur.c +++ b/innobase/btr/btr0pcur.c @@ -292,6 +292,11 @@ btr_pcur_restore_position( mem_heap_free(heap); + /* We have to store position information, modify clock value, etc. + because the cursor may now be on a different page */ + + btr_pcur_store_position(cursor, mtr); + return(FALSE); } diff --git a/innobase/log/log0log.c b/innobase/log/log0log.c index f9b785ccbd5..539cde337bd 100644 --- a/innobase/log/log0log.c +++ b/innobase/log/log0log.c @@ -437,25 +437,29 @@ log_group_calc_lsn_offset( dulint lsn, /* in: lsn, must be within 4 GB of group->lsn */ log_group_t* group) /* in: log group */ { - dulint gr_lsn; - ulint gr_lsn_size_offset; - ulint difference; - ulint group_size; - ulint offset; + dulint gr_lsn; + ib_longlong gr_lsn_size_offset; + ib_longlong difference; + ib_longlong group_size; + ib_longlong offset; ut_ad(mutex_own(&(log_sys->mutex))); + /* If total log file size is > 2 GB we can easily get overflows + with 32-bit integers. Use 64-bit integers instead. */ + gr_lsn = group->lsn; - gr_lsn_size_offset = log_group_calc_size_offset(group->lsn_offset, - group); - group_size = log_group_get_capacity(group); + gr_lsn_size_offset = (ib_longlong) + log_group_calc_size_offset(group->lsn_offset, group); + + group_size = (ib_longlong) log_group_get_capacity(group); if (ut_dulint_cmp(lsn, gr_lsn) >= 0) { - difference = ut_dulint_minus(lsn, gr_lsn); + difference = (ib_longlong) ut_dulint_minus(lsn, gr_lsn); } else { - difference = ut_dulint_minus(gr_lsn, lsn); + difference = (ib_longlong) ut_dulint_minus(gr_lsn, lsn); difference = difference % group_size; @@ -464,7 +468,13 @@ log_group_calc_lsn_offset( offset = (gr_lsn_size_offset + difference) % group_size; - return(log_group_calc_real_offset(offset, group)); + ut_a(offset <= 0xFFFFFFFF); + + /* printf("Offset is %lu gr_lsn_offset is %lu difference is %lu\n", + (ulint)offset,(ulint)gr_lsn_size_offset, (ulint)difference); + */ + + return(log_group_calc_real_offset((ulint)offset, group)); } /*********************************************************************** From 14810ff1d3e7d74167f59c6c4baf1f11491810f7 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Jan 2003 01:48:59 +0200 Subject: [PATCH 169/220] Changed mysql-test to print warnings for not existing table to DROP TABLE Cleaned up test; Removed wrong DROP TABLE commands and use standard table and database names. changed store_warning() -> push_warning_print() BitKeeper/deleted/.del-rpl000016-slave.opt~ef76f85ddcc13b87: Delete: mysql-test/t/rpl000016-slave.opt BitKeeper/deleted/.del-sel000001.test~9567c1646058cc: Delete: mysql-test/t/sel000001.test BitKeeper/deleted/.del-sel000002.test~9f500639572e18e1: Delete: mysql-test/t/sel000002.test BitKeeper/deleted/.del-sel000003.test~63a5512d18cd20a2: Delete: mysql-test/t/sel000003.test BitKeeper/deleted/.del-sel000001.result~383913ae4505ec86: Delete: mysql-test/r/sel000001.result BitKeeper/deleted/.del-sel000002.result~d1787e6fd5dbc1cc: Delete: mysql-test/r/sel000002.result BitKeeper/deleted/.del-sel000003.result~d7b657b1e3a286a7: Delete: mysql-test/r/sel000003.result BitKeeper/deleted/.del-sel000031.result~d49aeac63ad7db4d: Delete: mysql-test/r/sel000031.result BitKeeper/deleted/.del-sel000031.test~50a19a8e204e99bc: Delete: mysql-test/t/sel000031.test BitKeeper/deleted/.del-sel000032.result~6cb30e23cbca9fb0: Delete: mysql-test/r/sel000032.result BitKeeper/deleted/.del-sel000032.test~e32da7c3fc4b7ace: Delete: mysql-test/t/sel000032.test BitKeeper/deleted/.del-rpl000003.result~68d6ee00beaa011: Delete: mysql-test/r/rpl000003.result BitKeeper/deleted/.del-rpl000003.test~b7cfc4c5576fbafd: Delete: mysql-test/t/rpl000003.test client/mysql.cc: Don't yet print information about SQL help client/mysqltest.c: Added test options: --enable_warnings --disable_warnings --enable_info --disable_info configure.in: changed version number of shared libraries mysql-test/include/master-slave.inc: Don't write warnings on init mysql-test/r/backup.result: Updated results mysql-test/r/bdb.result: Updated results mysql-test/r/bigint.result: Updated results mysql-test/r/bool.result: Updated results mysql-test/r/create.result: Updated results mysql-test/r/delete.result: Updated results mysql-test/r/derived.result: Updated results mysql-test/r/distinct.result: Updated results mysql-test/r/drop.result: Updated results mysql-test/r/flush.result: Updated results mysql-test/r/fulltext.result: Updated results mysql-test/r/fulltext_multi.result: Updated results mysql-test/r/fulltext_order_by.result: Updated results mysql-test/r/func_equal.result: Updated results mysql-test/r/func_in.result: Updated results mysql-test/r/func_set.result: Updated results mysql-test/r/gcc296.result: Updated results mysql-test/r/group_by.result: Updated results mysql-test/r/innodb-deadlock.result: Updated results mysql-test/r/innodb.result: Updated results mysql-test/r/innodb_cache.result: Updated results mysql-test/r/innodb_handler.result: Updated results mysql-test/r/insert.result: Updated results mysql-test/r/insert_select.result: Updated results mysql-test/r/isam.result: Updated results mysql-test/r/join_outer.result: Updated results mysql-test/r/key.result: Updated results mysql-test/r/merge.result: Updated results mysql-test/r/multi_update.result: Updated results mysql-test/r/myisam.result: Updated results mysql-test/r/null.result: Updated results mysql-test/r/null_key.result: Updated results mysql-test/r/odbc.result: Updated results mysql-test/r/olap.result: Updated results mysql-test/r/order_by.result: Updated results mysql-test/r/query_cache.result: Updated results mysql-test/r/rename.result: Updated results mysql-test/r/row.result: Updated results mysql-test/r/rpl000001.result: Updated results mysql-test/r/rpl000002.result: Updated results mysql-test/r/rpl000004.result: Updated results mysql-test/r/rpl000005.result: Updated results mysql-test/r/rpl000006.result: Updated results mysql-test/r/rpl000008.result: Updated results mysql-test/r/rpl000009.result: Updated results mysql-test/r/rpl000010.result: Updated results mysql-test/r/rpl000011.result: Updated results mysql-test/r/rpl000012.result: Updated results mysql-test/r/rpl000013.result: Updated results mysql-test/r/rpl_alter.result: Updated results mysql-test/r/rpl_empty_master_crash.result: Updated results mysql-test/r/rpl_redirect.result: Updated results mysql-test/r/rpl_replicate_do.result: Updated results mysql-test/r/rpl_rotate_logs.result: Updated results mysql-test/r/rpl_skip_error.result: Updated results mysql-test/r/rpl_temporary.result: Updated results mysql-test/r/select.result: Updated results mysql-test/r/subselect.result: Updated results mysql-test/r/temp_table.result: Updated results mysql-test/r/type_date.result: Updated results mysql-test/r/type_float.result: Updated results mysql-test/r/union.result: Updated results mysql-test/r/update.result: Updated results mysql-test/r/user_var.result: Updated results mysql-test/r/varbinary.result: Updated results mysql-test/r/variables.result: Updated results mysql-test/r/warnings.result: Updated results mysql-test/t/alias.test: Don't write warnings when initializing test mysql-test/t/alter_table.test: Don't write warnings when initializing test mysql-test/t/analyse.test: Don't write warnings when initializing test mysql-test/t/auto_increment.test: Don't write warnings when initializing test mysql-test/t/backup.test: Don't write warnings when initializing test mysql-test/t/bdb-alter-table-1.test: Don't write warnings when initializing test mysql-test/t/bdb-crash.test: Don't write warnings when initializing test mysql-test/t/bdb-deadlock.test: Don't write warnings when initializing test mysql-test/t/bdb.test: Don't write warnings when initializing test cleaned up test mysql-test/t/bdb_cache.test: Don't write warnings when initializing test mysql-test/t/bench_count_distinct.test: Don't write warnings when initializing test mysql-test/t/bigint.test: Don't write warnings when initializing test mysql-test/t/binary.test: Don't write warnings when initializing test mysql-test/t/bool.test: Don't write warnings when initializing test Changed to use standard table names mysql-test/t/bulk_replace.test: Don't write warnings when initializing test mysql-test/t/case.test: Don't write warnings when initializing test mysql-test/t/check.test: Don't write warnings when initializing test mysql-test/t/compare.test: Don't write warnings when initializing test mysql-test/t/connect.test: Removed empty line mysql-test/t/constraints.test: Don't write warnings when initializing test mysql-test/t/count_distinct.test: Don't write warnings when initializing test mysql-test/t/count_distinct2.test: Don't write warnings when initializing test mysql-test/t/create.test: Don't write warnings when initializing test Cleaned up test mysql-test/t/ctype_latin1_de.test: Don't write warnings when initializing test mysql-test/t/ctype_many.test: Don't write warnings when initializing test mysql-test/t/delayed.test: Don't write warnings when initializing test mysql-test/t/delete.test: Don't write warnings when initializing test Cleaned up test mysql-test/t/derived.test: Don't write warnings when initializing test Cleaned up test mysql-test/t/dirty_close.test: Don't write warnings when initializing test mysql-test/t/distinct.test: Don't write warnings when initializing test Cleaned up test mysql-test/t/drop.test: Don't write warnings when initializing test mysql-test/t/empty_table.test: Don't write warnings when initializing test mysql-test/t/err000001.test: Don't write warnings when initializing test Cleaned up test mysql-test/t/explain.test: Don't write warnings when initializing test mysql-test/t/flush.test: Don't write warnings when initializing test mysql-test/t/foreign_key.test: Don't write warnings when initializing test mysql-test/t/fulltext.test: Don't write warnings when initializing test mysql-test/t/fulltext_cache.test: Don't write warnings when initializing test mysql-test/t/fulltext_distinct.test: Don't write warnings when initializing test mysql-test/t/fulltext_left_join.test: Don't write warnings when initializing test mysql-test/t/fulltext_multi.test: Don't write warnings when initializing test mysql-test/t/fulltext_order_by.test: Don't write warnings when initializing test mysql-test/t/fulltext_update.test: Don't write warnings when initializing test mysql-test/t/func_concat.test: Don't write warnings when initializing test mysql-test/t/func_date_add.test: Don't write warnings when initializing test mysql-test/t/func_encrypt.test: Don't write warnings when initializing test mysql-test/t/func_equal.test: Don't write warnings when initializing test mysql-test/t/func_group.test: Don't write warnings when initializing test mysql-test/t/func_if.test: Don't write warnings when initializing test mysql-test/t/func_in.test: Don't write warnings when initializing test mysql-test/t/func_isnull.test: Don't write warnings when initializing test mysql-test/t/func_like.test: Don't write warnings when initializing test mysql-test/t/func_regexp.test: Don't write warnings when initializing test mysql-test/t/func_set.test: Don't write warnings when initializing test Merged test with other tests mysql-test/t/func_str.test: Don't write warnings when initializing test mysql-test/t/func_time.test: Don't write warnings when initializing test mysql-test/t/func_timestamp.test: Don't write warnings when initializing test mysql-test/t/gcc296.test: Don't write warnings when initializing test Cleaned up test mysql-test/t/grant_cache.test: Don't write warnings when initializing test mysql-test/t/group_by.test: Don't write warnings when initializing test Cleaned up test mysql-test/t/handler.test: Don't write warnings when initializing test mysql-test/t/having.test: Don't write warnings when initializing test mysql-test/t/heap.test: Don't write warnings when initializing test mysql-test/t/heap_auto_increment.test: Don't write warnings when initializing test mysql-test/t/heap_btree.test: Don't write warnings when initializing test mysql-test/t/heap_hash.test: Don't write warnings when initializing test mysql-test/t/innodb-deadlock.test: Don't write warnings when initializing test mysql-test/t/innodb.test: Don't write warnings when initializing test mysql-test/t/innodb_cache.test: Don't write warnings when initializing test mysql-test/t/innodb_handler.test: Don't write warnings when initializing test mysql-test/t/ins000001.test: Don't write warnings when initializing test mysql-test/t/insert.test: Don't write warnings when initializing test cleaned up test. Changed to use standard database and table names mysql-test/t/insert_select.test: Don't write warnings when initializing test Changed to use standard table names mysql-test/t/insert_update.test: Don't write warnings when initializing test mysql-test/t/isam.test: Don't write warnings when initializing test cleaned up test mysql-test/t/join.test: Don't write warnings when initializing test mysql-test/t/join_crash.test: Don't write warnings when initializing test mysql-test/t/join_outer.test: Don't write warnings when initializing test mysql-test/t/key.test: Don't write warnings when initializing test mysql-test/t/key_diff.test: Don't write warnings when initializing test mysql-test/t/key_primary.test: Don't write warnings when initializing test mysql-test/t/keywords.test: Don't write warnings when initializing test mysql-test/t/kill.test: Don't write warnings when initializing test mysql-test/t/limit.test: Don't write warnings when initializing test mysql-test/t/lock.test: Don't write warnings when initializing test mysql-test/t/lock_multi.test: Don't write warnings when initializing test mysql-test/t/lowercase_table.test: Don't write warnings when initializing test mysql-test/t/merge.test: Don't write warnings when initializing test cleaned up test mysql-test/t/multi_update.test: Don't write warnings when initializing test mysql-test/t/myisam.test: Don't write warnings when initializing test mysql-test/t/null.test: Don't write warnings when initializing test mysql-test/t/null_key.test: Don't write warnings when initializing test mysql-test/t/odbc.test: Don't write warnings when initializing test mysql-test/t/olap.test: Don't write warnings when initializing test mysql-test/t/order_by.test: Don't write warnings when initializing test mysql-test/t/order_fill_sortbuf.test: Don't write warnings when initializing test mysql-test/t/query_cache.test: Don't write warnings when initializing test mysql-test/t/raid.test: Don't write warnings when initializing test mysql-test/t/range.test: Don't write warnings when initializing test mysql-test/t/rename.test: Don't write warnings when initializing test mysql-test/t/repair.test: Don't write warnings when initializing test mysql-test/t/replace.test: Don't write warnings when initializing test mysql-test/t/rollback.test: Don't write warnings when initializing test mysql-test/t/row.test: Don't write warnings when initializing test mysql-test/t/rpl000001.test: Don't write warnings when initializing test mysql-test/t/rpl000002.test: Don't write warnings when initializing test mysql-test/t/rpl000004.test: Don't write warnings when initializing test mysql-test/t/rpl000005.test: Don't write warnings when initializing test mysql-test/t/rpl000006.test: Don't write warnings when initializing test mysql-test/t/rpl000008-slave.opt: Don't write warnings when initializing test mysql-test/t/rpl000008.test: Don't write warnings when initializing test mysql-test/t/rpl000009-slave.opt: Don't write warnings when initializing test mysql-test/t/rpl000009.test: Don't write warnings when initializing test mysql-test/t/rpl000010.test: Don't write warnings when initializing test mysql-test/t/rpl000011.test: Don't write warnings when initializing test mysql-test/t/rpl000012.test: Don't write warnings when initializing test mysql-test/t/rpl000013.test: Don't write warnings when initializing test mysql-test/t/rpl000015.test: Don't write warnings when initializing test mysql-test/t/rpl000017.test: Don't write warnings when initializing test mysql-test/t/rpl000018.test: Don't write warnings when initializing test mysql-test/t/rpl_alter.test: Don't write warnings when initializing test mysql-test/t/rpl_empty_master_crash.test: Don't write warnings when initializing test mysql-test/t/rpl_redirect.test: Don't write warnings when initializing test mysql-test/t/rpl_replicate_do.test: Don't write warnings when initializing test mysql-test/t/rpl_rotate_logs.test: Don't write warnings when initializing test mysql-test/t/rpl_skip_error.test: Don't write warnings when initializing test mysql-test/t/rpl_temporary.test: Don't write warnings when initializing test mysql-test/t/sel000033.test: Don't write warnings when initializing test mysql-test/t/sel000100.test: Don't write warnings when initializing test mysql-test/t/select.test: Don't write warnings when initializing test mysql-test/t/select_found.test: Don't write warnings when initializing test mysql-test/t/select_safe.test: Don't write warnings when initializing test mysql-test/t/show_check.test: Don't write warnings when initializing test mysql-test/t/status.test: Don't write warnings when initializing test mysql-test/t/subselect.test: Don't write warnings when initializing test mysql-test/t/symlink.test: Don't write warnings when initializing test mysql-test/t/tablelock.test: Don't write warnings when initializing test mysql-test/t/temp_table.test: Don't write warnings when initializing test mysql-test/t/truncate.test: Don't write warnings when initializing test mysql-test/t/type_blob.test: Don't write warnings when initializing test mysql-test/t/type_date.test: Don't write warnings when initializing test mysql-test/t/type_datetime.test: Don't write warnings when initializing test mysql-test/t/type_decimal.test: Don't write warnings when initializing test mysql-test/t/type_enum.test: Don't write warnings when initializing test mysql-test/t/type_float.test: Don't write warnings when initializing test mysql-test/t/type_ranges.test: Don't write warnings when initializing test mysql-test/t/type_set.test: Don't write warnings when initializing test mysql-test/t/type_time.test: Don't write warnings when initializing test mysql-test/t/type_timestamp.test: Don't write warnings when initializing test mysql-test/t/type_uint.test: Don't write warnings when initializing test mysql-test/t/type_year.test: Don't write warnings when initializing test mysql-test/t/union.test: Don't write warnings when initializing test mysql-test/t/update.test: Don't write warnings when initializing test mysql-test/t/user_var.test: Don't write warnings when initializing test mysql-test/t/varbinary.test: Don't write warnings when initializing test mysql-test/t/variables.test: Don't write warnings when initializing test mysql-test/t/warnings.test: Don't write warnings when initializing test mysys/my_vsnprintf.c: Safety fix readline/terminal.c: Removed compiler warnings sql/ha_berkeley.cc: Indentation changes sql/mysql_priv.h: Change store_warning -> push_warning_printf sql/sql_db.cc: Change store_warning -> push_warning_printf sql/sql_error.cc: Change store_warning -> push_warning_printf sql/sql_table.cc: Change store_warning -> push_warning_printf --- client/mysql.cc | 52 ++++++----- client/mysqltest.c | 87 ++++++++++------- configure.in | 2 +- mysql-test/include/master-slave.inc | 4 + mysql-test/r/backup.result | 2 +- mysql-test/r/bdb.result | 9 -- mysql-test/r/bigint.result | 2 +- mysql-test/r/bool.result | 11 +-- mysql-test/r/create.result | 16 +++- mysql-test/r/delete.result | 1 - mysql-test/r/derived.result | 6 +- mysql-test/r/distinct.result | 5 +- mysql-test/r/drop.result | 5 +- mysql-test/r/flush.result | 5 +- mysql-test/r/fulltext.result | 1 - mysql-test/r/fulltext_multi.result | 1 - mysql-test/r/fulltext_order_by.result | 1 - mysql-test/r/func_equal.result | 2 +- mysql-test/r/func_in.result | 2 +- mysql-test/r/func_set.result | 17 ++++ mysql-test/r/gcc296.result | 16 ++-- mysql-test/r/group_by.result | 5 +- mysql-test/r/innodb-deadlock.result | 3 +- mysql-test/r/innodb.result | 1 - mysql-test/r/innodb_cache.result | 2 +- mysql-test/r/innodb_handler.result | 2 +- mysql-test/r/insert.result | 10 +- mysql-test/r/insert_select.result | 17 ++-- mysql-test/r/isam.result | 2 + mysql-test/r/join_outer.result | 1 - mysql-test/r/key.result | 1 - mysql-test/r/merge.result | 14 ++- mysql-test/r/multi_update.result | 7 +- mysql-test/r/myisam.result | 4 +- mysql-test/r/null.result | 2 +- mysql-test/r/null_key.result | 3 +- mysql-test/r/odbc.result | 2 +- mysql-test/r/olap.result | 18 ++-- mysql-test/r/order_by.result | 1 - mysql-test/r/query_cache.result | 1 + mysql-test/r/rename.result | 2 + mysql-test/r/row.result | 3 +- mysql-test/r/rpl000001.result | 1 - mysql-test/r/rpl000002.result | 2 - mysql-test/r/rpl000003.result | 17 ---- mysql-test/r/rpl000004.result | 5 - mysql-test/r/rpl000005.result | 1 - mysql-test/r/rpl000006.result | 2 - mysql-test/r/rpl000008.result | 28 +++--- mysql-test/r/rpl000009.result | 104 ++++++++++----------- mysql-test/r/rpl000010.result | 2 - mysql-test/r/rpl000011.result | 1 - mysql-test/r/rpl000012.result | 10 +- mysql-test/r/rpl000013.result | 3 +- mysql-test/r/rpl_alter.result | 22 ++--- mysql-test/r/rpl_empty_master_crash.result | 1 - mysql-test/r/rpl_redirect.result | 1 - mysql-test/r/rpl_replicate_do.result | 2 +- mysql-test/r/rpl_rotate_logs.result | 2 - mysql-test/r/rpl_skip_error.result | 1 - mysql-test/r/rpl_temporary.result | 7 +- mysql-test/r/sel000001.result | 7 -- mysql-test/r/sel000002.result | 9 -- mysql-test/r/sel000003.result | 8 -- mysql-test/r/sel000031.result | 12 --- mysql-test/r/sel000032.result | 12 --- mysql-test/r/select.result | 5 +- mysql-test/r/subselect.result | 62 ++++++------ mysql-test/r/temp_table.result | 2 - mysql-test/r/type_date.result | 2 +- mysql-test/r/type_float.result | 2 +- mysql-test/r/union.result | 1 - mysql-test/r/update.result | 2 +- mysql-test/r/user_var.result | 2 +- mysql-test/r/varbinary.result | 2 +- mysql-test/r/variables.result | 3 +- mysql-test/r/warnings.result | 5 + mysql-test/t/alias.test | 3 + mysql-test/t/alter_table.test | 4 +- mysql-test/t/analyse.test | 4 +- mysql-test/t/auto_increment.test | 4 +- mysql-test/t/backup.test | 4 +- mysql-test/t/bdb-alter-table-1.test | 3 + mysql-test/t/bdb-crash.test | 2 + mysql-test/t/bdb-deadlock.test | 2 + mysql-test/t/bdb.test | 11 +-- mysql-test/t/bdb_cache.test | 2 + mysql-test/t/bench_count_distinct.test | 6 ++ mysql-test/t/bigint.test | 8 +- mysql-test/t/binary.test | 4 +- mysql-test/t/bool.test | 14 +-- mysql-test/t/bulk_replace.test | 5 +- mysql-test/t/case.test | 2 + mysql-test/t/check.test | 5 +- mysql-test/t/compare.test | 3 + mysql-test/t/connect.test | 1 - mysql-test/t/constraints.test | 2 + mysql-test/t/count_distinct.test | 3 + mysql-test/t/count_distinct2.test | 2 + mysql-test/t/create.test | 15 ++- mysql-test/t/ctype_latin1_de.test | 2 + mysql-test/t/ctype_many.test | 2 + mysql-test/t/delayed.test | 2 + mysql-test/t/delete.test | 5 +- mysql-test/t/derived.test | 10 +- mysql-test/t/dirty_close.test | 4 + mysql-test/t/distinct.test | 8 +- mysql-test/t/drop.test | 5 +- mysql-test/t/empty_table.test | 3 + mysql-test/t/err000001.test | 32 +++++-- mysql-test/t/explain.test | 2 + mysql-test/t/flush.test | 9 +- mysql-test/t/foreign_key.test | 3 + mysql-test/t/fulltext.test | 3 +- mysql-test/t/fulltext_cache.test | 3 + mysql-test/t/fulltext_distinct.test | 3 + mysql-test/t/fulltext_left_join.test | 3 + mysql-test/t/fulltext_multi.test | 4 +- mysql-test/t/fulltext_order_by.test | 4 +- mysql-test/t/fulltext_update.test | 2 + mysql-test/t/func_concat.test | 3 + mysql-test/t/func_date_add.test | 3 + mysql-test/t/func_encrypt.test | 3 + mysql-test/t/func_equal.test | 6 +- mysql-test/t/func_group.test | 3 + mysql-test/t/func_if.test | 2 + mysql-test/t/func_in.test | 6 +- mysql-test/t/func_isnull.test | 3 + mysql-test/t/func_like.test | 3 + mysql-test/t/func_regexp.test | 3 + mysql-test/t/func_set.test | 18 ++++ mysql-test/t/func_str.test | 2 + mysql-test/t/func_time.test | 2 + mysql-test/t/func_timestamp.test | 3 + mysql-test/t/gcc296.test | 19 ++-- mysql-test/t/grant_cache.test | 5 + mysql-test/t/group_by.test | 13 ++- mysql-test/t/handler.test | 3 + mysql-test/t/having.test | 3 + mysql-test/t/heap.test | 3 + mysql-test/t/heap_auto_increment.test | 3 + mysql-test/t/heap_btree.test | 3 + mysql-test/t/heap_hash.test | 3 + mysql-test/t/innodb-deadlock.test | 6 +- mysql-test/t/innodb.test | 4 +- mysql-test/t/innodb_cache.test | 6 +- mysql-test/t/innodb_handler.test | 5 +- mysql-test/t/ins000001.test | 3 + mysql-test/t/insert.test | 15 ++- mysql-test/t/insert_select.test | 21 +++-- mysql-test/t/insert_update.test | 3 + mysql-test/t/isam.test | 14 ++- mysql-test/t/join.test | 2 + mysql-test/t/join_crash.test | 3 + mysql-test/t/join_outer.test | 3 +- mysql-test/t/key.test | 4 +- mysql-test/t/key_diff.test | 3 + mysql-test/t/key_primary.test | 3 + mysql-test/t/keywords.test | 3 + mysql-test/t/kill.test | 3 + mysql-test/t/limit.test | 3 + mysql-test/t/lock.test | 2 + mysql-test/t/lock_multi.test | 5 +- mysql-test/t/lowercase_table.test | 3 + mysql-test/t/merge.test | 18 ++-- mysql-test/t/multi_update.test | 12 ++- mysql-test/t/myisam.test | 7 +- mysql-test/t/null.test | 6 +- mysql-test/t/null_key.test | 6 +- mysql-test/t/odbc.test | 6 +- mysql-test/t/olap.test | 22 +++-- mysql-test/t/order_by.test | 3 +- mysql-test/t/order_fill_sortbuf.test | 3 + mysql-test/t/query_cache.test | 3 + mysql-test/t/raid.test | 3 + mysql-test/t/range.test | 3 + mysql-test/t/rename.test | 5 + mysql-test/t/repair.test | 3 + mysql-test/t/replace.test | 2 + mysql-test/t/rollback.test | 2 + mysql-test/t/row.test | 9 +- mysql-test/t/rpl000001.test | 2 +- mysql-test/t/rpl000002.test | 3 +- mysql-test/t/rpl000003.test | 14 --- mysql-test/t/rpl000004.test | 6 +- mysql-test/t/rpl000005.test | 2 +- mysql-test/t/rpl000006.test | 2 - mysql-test/t/rpl000008-slave.opt | 2 +- mysql-test/t/rpl000008.test | 41 ++++---- mysql-test/t/rpl000009-slave.opt | 2 +- mysql-test/t/rpl000009.test | 77 ++++++++------- mysql-test/t/rpl000010.test | 10 +- mysql-test/t/rpl000011.test | 2 +- mysql-test/t/rpl000012.test | 8 +- mysql-test/t/rpl000013.test | 6 +- mysql-test/t/rpl000015.test | 2 + mysql-test/t/rpl000016-slave.opt | 1 - mysql-test/t/rpl000017.test | 2 + mysql-test/t/rpl000018.test | 2 + mysql-test/t/rpl_alter.test | 25 ++--- mysql-test/t/rpl_empty_master_crash.test | 3 +- mysql-test/t/rpl_redirect.test | 1 - mysql-test/t/rpl_replicate_do.test | 5 +- mysql-test/t/rpl_rotate_logs.test | 11 ++- mysql-test/t/rpl_skip_error.test | 1 - mysql-test/t/rpl_temporary.test | 12 ++- mysql-test/t/sel000001.test | 18 ---- mysql-test/t/sel000002.test | 17 ---- mysql-test/t/sel000003.test | 18 ---- mysql-test/t/sel000031.test | 20 ---- mysql-test/t/sel000032.test | 20 ---- mysql-test/t/sel000033.test | 2 + mysql-test/t/sel000100.test | 2 + mysql-test/t/select.test | 10 +- mysql-test/t/select_found.test | 4 +- mysql-test/t/select_safe.test | 3 + mysql-test/t/show_check.test | 3 + mysql-test/t/status.test | 3 + mysql-test/t/subselect.test | 49 +++++----- mysql-test/t/symlink.test | 6 +- mysql-test/t/tablelock.test | 3 + mysql-test/t/temp_table.test | 6 +- mysql-test/t/truncate.test | 3 + mysql-test/t/type_blob.test | 7 ++ mysql-test/t/type_date.test | 5 +- mysql-test/t/type_datetime.test | 3 + mysql-test/t/type_decimal.test | 3 + mysql-test/t/type_enum.test | 3 + mysql-test/t/type_float.test | 11 ++- mysql-test/t/type_ranges.test | 2 + mysql-test/t/type_set.test | 3 + mysql-test/t/type_time.test | 4 + mysql-test/t/type_timestamp.test | 3 + mysql-test/t/type_uint.test | 3 + mysql-test/t/type_year.test | 3 + mysql-test/t/union.test | 5 +- mysql-test/t/update.test | 5 +- mysql-test/t/user_var.test | 8 +- mysql-test/t/varbinary.test | 6 +- mysql-test/t/variables.test | 6 +- mysql-test/t/warnings.test | 8 ++ mysys/my_vsnprintf.c | 5 +- readline/terminal.c | 2 +- sql/ha_berkeley.cc | 6 +- sql/mysql_priv.h | 3 +- sql/sql_db.cc | 3 +- sql/sql_error.cc | 32 +++---- sql/sql_table.cc | 4 +- 248 files changed, 1036 insertions(+), 792 deletions(-) delete mode 100644 mysql-test/r/rpl000003.result delete mode 100644 mysql-test/r/sel000001.result delete mode 100644 mysql-test/r/sel000002.result delete mode 100644 mysql-test/r/sel000003.result delete mode 100644 mysql-test/r/sel000031.result delete mode 100644 mysql-test/r/sel000032.result delete mode 100644 mysql-test/t/rpl000003.test delete mode 100644 mysql-test/t/rpl000016-slave.opt delete mode 100644 mysql-test/t/sel000001.test delete mode 100644 mysql-test/t/sel000002.test delete mode 100644 mysql-test/t/sel000003.test delete mode 100644 mysql-test/t/sel000031.test delete mode 100644 mysql-test/t/sel000032.test diff --git a/client/mysql.cc b/client/mysql.cc index 680175f2123..58aee617107 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -389,9 +389,11 @@ int main(int argc,char *argv[]) } } #endif - sprintf(buff, "%s%s", - "Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n", + sprintf(buff, "%s", + "Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n"); +#ifdef NOT_YET "Type 'help [[%]function name[%]]' to get help on usage of function.\n"); +#endif put_info(buff,INFO_INFO); status.exit_status=read_lines(1); // read lines and execute them if (opt_outfile) @@ -663,7 +665,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_nopager= 1; case OPT_MYSQL_PROTOCOL: { - if ((opt_protocol = find_type(argument, &sql_protocol_typelib,0)) == ~(ulong) 0) + if ((opt_protocol = find_type(argument, &sql_protocol_typelib,0)) == + ~(ulong) 0) { fprintf(stderr, "Unknown option to protocol: %s\n", argument); exit(1); @@ -1299,7 +1302,7 @@ You can turn off this feature to get a quicker startup with -A\n\n"); sizeof(char *) * (num_fields*2+1)))) break; - field_names[i][num_fields*2]='\0'; + field_names[i][num_fields*2]= '\0'; j=0; while ((sql_field=mysql_fetch_field(fields))) { @@ -1319,7 +1322,7 @@ You can turn off this feature to get a quicker startup with -A\n\n"); { tee_fprintf(stdout, "Didn't find any fields in table '%s'\n",table_row[0]); - field_names[i]=0; + field_names[i]= 0; } i++; } @@ -1407,17 +1410,15 @@ static int com_server_help(String *buffer __attribute__((unused)), MYSQL_ROW cur; const char *server_cmd= buffer->ptr(); char cmd_buf[100]; + MYSQL_RES *result; + int error; - if (help_arg[0]!='\'') + if (help_arg[0] != '\'') { - (void*)sprintf(cmd_buf,"help \'%s\';",help_arg); + (void) strxnmov(cmd_buf, sizeof(cmd_buf), "help '", help_arg, "'", NullS); server_cmd= cmd_buf; } - MYSQL_RES *result; - ulong timer; - uint error= 0; - if (!status.batch) { old_buffer= *buffer; @@ -1427,26 +1428,24 @@ static int com_server_help(String *buffer __attribute__((unused)), if (!connected && reconnect()) return 1; - timer= start_timer(); - - error= mysql_real_query_for_lazy(server_cmd,strlen(server_cmd)); - if (error) + if ((error= mysql_real_query_for_lazy(server_cmd,strlen(server_cmd)))) return error; - - error= mysql_store_result_for_lazy(&result); - if (error) + if ((error= mysql_store_result_for_lazy(&result))) return error; if (result) { int num_rows= mysql_num_rows(result); - if (num_rows==1) + if (num_rows == 1) { if (!(cur= mysql_fetch_row(result))) - return -1; + { + error= -1; + goto err; + } init_pager(); - if (cur[1][0]=='Y') + if (cur[1][0] == 'Y') { tee_fprintf(PAGER, "\nHelp topic \'%s\'\n", cur[0]); tee_fprintf(PAGER, "%s\n", cur[2]); @@ -1460,17 +1459,19 @@ static int com_server_help(String *buffer __attribute__((unused)), } end_pager(); } - else if (num_rows>1) + else if (num_rows > 1) { put_info("\nMany help items for your request exist", INFO_INFO); put_info("For more specific request please type 'help ' where item is one of next :", INFO_INFO); init_pager(); char last_char= '_'; - while ((cur= mysql_fetch_row(result))){ - if (cur[1][0]!=last_char){ + while ((cur= mysql_fetch_row(result))) + { + if (cur[1][0]!=last_char) + { put_info("-------------------------------------------", INFO_INFO); - put_info(cur[1][0]=='Y' ? + put_info(cur[1][0] == 'Y' ? "categories:" : "functions:", INFO_INFO); put_info("-------------------------------------------", INFO_INFO); } @@ -1486,6 +1487,7 @@ static int com_server_help(String *buffer __attribute__((unused)), } } +err: mysql_free_result(result); return error; } diff --git a/client/mysqltest.c b/client/mysqltest.c index 6a637c0533c..ed95efc282e 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -166,7 +166,8 @@ typedef struct VAR var_reg[10]; /*Perl/shell-like variable registers */ HASH var_hash; -int disable_query_log=0, disable_result_log=0; +my_bool disable_query_log=0, disable_result_log=0, disable_warnings=0; +my_bool disable_info= 1; /* By default off */ struct connection cons[MAX_CONS]; struct connection* cur_con, *next_con, *cons_end; @@ -195,6 +196,8 @@ Q_ENABLE_RESULT_LOG, Q_DISABLE_RESULT_LOG, Q_SERVER_START, Q_SERVER_STOP,Q_REQUIRE_MANAGER, Q_WAIT_FOR_SLAVE_TO_STOP, Q_REQUIRE_VERSION, +Q_ENABLE_WARNINGS, Q_DISABLE_WARNINGS, +Q_ENABLE_INFO, Q_DISABLE_INFO, Q_UNKNOWN, /* Unknown command. */ Q_COMMENT, /* Comments, ignored. */ Q_COMMENT_WITH_COMMAND @@ -253,6 +256,10 @@ const char *command_names[]= "require_manager", "wait_for_slave_to_stop", "require_version", + "enable_warnings", + "disable_warnings", + "enable_info", + "diable_info", 0 }; @@ -2169,17 +2176,17 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags) verbose_msg("query '%s' failed: %d: %s", q->query, mysql_errno(mysql), mysql_error(mysql)); /* - if we do not abort on error, failure to run the query does - not fail the whole test case + if we do not abort on error, failure to run the query does + not fail the whole test case */ goto end; } /*{ verbose_msg("failed in mysql_store_result for query '%s' (%d)", query, - mysql_errno(mysql)); + mysql_errno(mysql)); error = 1; goto end; - }*/ + }*/ } if (q->expected_errno[0]) @@ -2190,39 +2197,49 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags) goto end; } - if (!disable_result_log && res) + if (!disable_result_log) { - int num_fields= mysql_num_fields(res); - MYSQL_FIELD *fields= mysql_fetch_fields(res); - for (i = 0; i < num_fields; i++) + if (res) { - if (i) - dynstr_append_mem(ds, "\t", 1); - dynstr_append(ds, fields[i].name); + int num_fields= mysql_num_fields(res); + MYSQL_FIELD *fields= mysql_fetch_fields(res); + for (i = 0; i < num_fields; i++) + { + if (i) + dynstr_append_mem(ds, "\t", 1); + dynstr_append(ds, fields[i].name); + } + dynstr_append_mem(ds, "\n", 1); + append_result(ds, res); + } + + /* Add all warnings to the result */ + if (!disable_warnings && mysql_warning_count(mysql)) + { + MYSQL_RES *warn_res=0; + uint count= mysql_warning_count(mysql); + if (!mysql_real_query(mysql, "SHOW WARNINGS", 13)) + { + warn_res=mysql_store_result(mysql); + } + if (!warn_res) + verbose_msg("Warning count is %u but didn't get any warnings\n", + count); + else + { + dynstr_append_mem(ds, "Warnings:\n", 10); + append_result(ds, warn_res); + mysql_free_result(warn_res); + } + } + if (!disable_info && mysql_info(mysql)) + { + dynstr_append(ds, "info: "); + dynstr_append(ds, mysql_info(mysql)); + dynstr_append_mem(ds, "\n", 1); } - dynstr_append_mem(ds, "\n", 1); - append_result(ds, res); } - /* Add all warnings to the result */ - if (!disable_result_log && mysql_warning_count(mysql)) - { - MYSQL_RES *warn_res=0; - uint count= mysql_warning_count(mysql); - if (!mysql_real_query(mysql, "SHOW WARNINGS", 13)) - { - warn_res=mysql_store_result(mysql); - } - if (!warn_res) - verbose_msg("Warning count is %u but didn't get any warnings\n", - count); - else - { - dynstr_append_mem(ds, "Warnings:\n", 10); - append_result(ds, warn_res); - mysql_free_result(warn_res); - } - } if (glob_replace) free_replace(); @@ -2431,6 +2448,10 @@ int main(int argc, char** argv) case Q_DISABLE_QUERY_LOG: disable_query_log=1; break; case Q_ENABLE_RESULT_LOG: disable_result_log=0; break; case Q_DISABLE_RESULT_LOG: disable_result_log=1; break; + case Q_ENABLE_WARNINGS: disable_warnings=0; break; + case Q_DISABLE_WARNINGS: disable_warnings=1; break; + case Q_ENABLE_INFO: disable_info=0; break; + case Q_DISABLE_INFO: disable_info=1; break; case Q_SOURCE: do_source(q); break; case Q_SLEEP: do_sleep(q, 0); break; case Q_REAL_SLEEP: do_sleep(q, 1); break; diff --git a/configure.in b/configure.in index 507667b585c..eae4b52fdca 100644 --- a/configure.in +++ b/configure.in @@ -10,7 +10,7 @@ AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 DOT_FRM_VERSION=6 # See the libtool docs for information on how to do shared lib versions. -SHARED_LIB_VERSION=12:0:0 +SHARED_LIB_VERSION=14:0:0 # Set all version vars based on $VERSION. How do we do this more elegant ? # Remember that regexps needs to quote [ and ] since this is run through m4 diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc index 1013cd2cd52..008466c426f 100644 --- a/mysql-test/include/master-slave.inc +++ b/mysql-test/include/master-slave.inc @@ -7,12 +7,16 @@ connection slave; !stop slave; @r/slave-stopped.result show status like 'Slave_running'; connection master; +--disable_warnings drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +--enable_warnings reset master; connection slave; reset slave; # Clean up old test tables +--disable_warnings drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +--enable_warnings start slave; @r/slave-running.result show status like 'Slave_running'; diff --git a/mysql-test/r/backup.result b/mysql-test/r/backup.result index 43d57d2d4f7..e4f41517f94 100644 --- a/mysql-test/r/backup.result +++ b/mysql-test/r/backup.result @@ -1,5 +1,5 @@ set SQL_LOG_BIN=0; -drop table if exists t1; +drop table if exists t1, t2, t3; create table t1(n int); backup table t1 to '../bogus'; Table Op Msg_type Msg_text diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result index ef4dfc307bf..2c7d3136369 100644 --- a/mysql-test/r/bdb.result +++ b/mysql-test/r/bdb.result @@ -797,7 +797,6 @@ select * from t1 where i=1 and j=2; i j 1 2 drop table t1; -drop table if exists t1, t2, t3, t4, t5, t6, t7; create table t1 ( branch_id int auto_increment primary key, @@ -806,7 +805,6 @@ branch_active int not null default 1, unique branch_name(branch_name), index branch_active(branch_active) ) type=bdb; -drop table if exists t2 ; create table t2 ( target_id int auto_increment primary key, @@ -815,7 +813,6 @@ target_active int not null default 1, unique target_name(target_name), index target_active(target_active) ) type=bdb; -drop table if exists t3 ; create table t3 ( platform_id int auto_increment primary key, @@ -824,7 +821,6 @@ platform_active int not null default 1, unique platform_name(platform_name), index platform_active(platform_active) ) type=bdb; -drop table if exists t4 ; create table t4 ( product_id int auto_increment primary key, @@ -834,7 +830,6 @@ product_active int not null default 1, unique product_name(product_name), index product_active(product_active) ) type=bdb; -drop table if exists t5 ; create table t5 ( product_file_id int auto_increment primary key, @@ -847,7 +842,6 @@ file_included int not null default 1, unique product_file(product_id,file_name), index file_included(file_included) ) type=bdb; -drop table if exists t6 ; create table t6 ( file_platform_id int auto_increment primary key, @@ -860,7 +854,6 @@ build_filename varchar(255) not null, archive_filename varchar(255) not null, unique file_platform(product_file_id,platform_id,branch_id) ) type=bdb; -drop table if exists t8 ; create table t8 ( archive_id int auto_increment primary key, @@ -872,7 +865,6 @@ status_id int not null default 1, unique archive(branch_id,target_id,platform_id,product_id), index status_id(status_id) ) type=bdb; -drop table if exists t7 ; create table t7 ( build_id int auto_increment primary key, @@ -1057,7 +1049,6 @@ KINMU_DATE select T1.KINMU_DATE from t1 T1 ,t2 T2 where T1.SYAIN_NO = '12345' and T1.KINMU_DATE = '200106' and T2.SYAIN_NO = T1.SYAIN_NO; KINMU_DATE DROP TABLE t1,t2; -drop table if exists t1; create table t1 (a int(11) not null, b int(11) not null, unique (a,b)) type=bdb; insert into t1 values (1,1), (1,2); select * from t1 where a = 1; diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index 6afa74d20e2..8bc383c6f4c 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -1,3 +1,4 @@ +drop table if exists t1; select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296; 0 256 00000000000000065536 2147483647 -2147483648 2147483648 +4294967296 0 256 65536 2147483647 -2147483648 2147483648 4294967296 @@ -7,7 +8,6 @@ select 9223372036854775807,-009223372036854775808; select +9999999999999999999,-9999999999999999999; +9999999999999999999 -9999999999999999999 10000000000000000000 -10000000000000000000 -drop table if exists t1; create table t1 (a bigint unsigned not null, primary key(a)); insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE); select * from t1; diff --git a/mysql-test/r/bool.result b/mysql-test/r/bool.result index cb82c6baa0f..890c85dc946 100644 --- a/mysql-test/r/bool.result +++ b/mysql-test/r/bool.result @@ -46,10 +46,9 @@ SELECT @a, @b; @a @b 0 6 DROP TABLE t1; -drop table if exists t; -create table t(a int, b int); -insert into t values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1); -select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t; +create table t1 (a int, b int); +insert into t1 values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1); +select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t1; A B nA nB AB n(AB) nAonB AoB n(AoB) nAnB N N N N N N N N N N 0 N 1 N 0 1 1 N N N @@ -60,7 +59,7 @@ N 1 N 0 N N N 1 0 0 0 1 1 0 0 1 1 1 0 0 1 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 0 1 0 0 -select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t; +select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t1; A B nA nB AB n(AB) nAonB AoB n(AoB) nAnB N N N N N N N N N N 0 N 1 N 0 1 1 N N N @@ -71,4 +70,4 @@ N 1 N 0 N N N 1 0 0 0 1 1 0 0 1 1 1 0 0 1 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 0 1 0 0 -drop table t; +drop table t1; diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 6bfda427f78..a32d32a4ab7 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -13,12 +13,15 @@ select * from t1; b -drop table if exists t1; +drop table t1; create table t2 type=heap select * from t1; Table 'test.t1' doesn't exist create table t2 select auto+1 from t1; Table 'test.t1' doesn't exist drop table if exists t1,t2; +Warnings: +Note 1051 Unknown table 't1' +Note 1051 Unknown table 't2' create table t1 (b char(0) not null, index(b)); The used table handler can't index column 'b' create table t1 (a int not null auto_increment,primary key (a)) type=heap; @@ -48,6 +51,8 @@ drop table 1ea10; create table t1 (t1.index int); drop table t1; drop database if exists test_$1; +Warnings: +Note 1008 Can't drop database 'test_$1'. Database doesn't exist create database test_$1; create table test_$1.$test1 (a$1 int, $b int, c$ int); insert into test_$1.$test1 values (1,2,3); @@ -105,12 +110,18 @@ drop table if exists t2; create table t2 (a int, a float) select * from t1; Duplicate column name 'a' drop table if exists t2; +Warnings: +Note 1051 Unknown table 't2' create table t2 (a int) select a as b, a+1 as b from t1; Duplicate column name 'b' drop table if exists t2; +Warnings: +Note 1051 Unknown table 't2' create table t2 (b int) select a as b, a+1 as b from t1; Duplicate column name 'b' drop table if exists t1,t2; +Warnings: +Note 1051 Unknown table 't2' create table t1 (a int not null, b int, primary key(a), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b)); show create table t1; Table Create Table @@ -161,7 +172,6 @@ drop table if exists t1; create table t1 (a int, key(a)); create table t2 (b int, foreign key(b) references t1(a), key(b)); drop table if exists t1,t2; -drop table if exists t1, t2, t3; create table t1(id int not null, name char(20)); insert into t1 values(10,'mysql'),(20,'monty- the creator'); create table t2(id int not null); @@ -200,6 +210,8 @@ select * from t3; id name drop table t2, t3; drop database if exists test_$1; +Warnings: +Note 1008 Can't drop database 'test_$1'. Database doesn't exist create database test_$1; create table test_$1.t3 like t1; create temporary table t3 like test_$1.t3; diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result index 351798b0509..4fa85ea9cbc 100644 --- a/mysql-test/r/delete.result +++ b/mysql-test/r/delete.result @@ -24,7 +24,6 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a)); insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27); delete from t1 where a=27; drop table t1; -drop table if exists t; CREATE TABLE `t` ( `i` int(10) NOT NULL default '0', `i2` int(10) NOT NULL default '0', diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index e2d2b1cb652..4f16e239e15 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -1,3 +1,4 @@ +drop table if exists t1,t2,t3; select * from (select 2 from DUAL) b; 2 2 @@ -5,7 +6,6 @@ SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; Unknown column 'a' in 'field list' SELECT 1 as a FROM (SELECT a UNION SELECT 1) b; Unknown column 'a' in 'field list' -drop table if exists t1,t2,t3; CREATE TABLE t1 (a int not null, b char (10) not null); insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c'); CREATE TABLE t2 (a int not null, b char (10) not null); @@ -60,7 +60,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY x1 ALL NULL NULL NULL NULL 4 1 PRIMARY ALL NULL NULL NULL NULL 4 2 DERIVED x1 ALL NULL NULL NULL NULL 4 -drop table if exists t1.t2,t3; +drop table if exists t2,t3; select * from (select 1) as a; 1 1 @@ -123,7 +123,7 @@ explain select count(*) from t1 as tt1, (select * from t1) as tt2; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away 2 DERIVED tt1 index NULL a 4 NULL 10000 Using index -drop table if exists t1; +drop table t1; SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b; (SELECT * FROM (SELECT 1 as a) as a ) 1 diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index aefcba9ed9d..ae1d9588bc7 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -326,7 +326,6 @@ AND ((t1.id=j_lj_t3.id AND t3_lj.id IS NULL) OR (t1.id=t3.id AND t3.idx=2)); id 2 drop table t1,t2,t3; -drop table if exists t1; create table t1 (a int not null, b int not null, t time); insert into t1 values (1,1,"00:06:15"),(1,2,"00:06:15"),(1,2,"00:30:15"),(1,3,"00:06:15"),(1,3,"00:30:15"); select a,sec_to_time(sum(time_to_sec(t))) from t1 group by a,b; @@ -410,7 +409,7 @@ INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http:// SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid); privatemessageid folderid userid touserid fromuserid title message dateline showsignature iconid messageread readtime receipt deleteprompt multiplerecipients userid usergroupid username password email styleid parentemail coppauser homepage icq aim yahoo signature adminemail showemail invisible usertitle customtitle joindate cookieuser daysprune lastvisit lastactivity lastpost posts timezoneoffset emailnotification buddylist ignorelist pmfolders receivepm emailonpm pmpopup avatarid avatarrevision options birthday maxposts startofweek ipaddress referrerid nosessionhash autorefresh messagepopup inforum ratenum ratetotal allowrate 128 0 33 33 8 :D 996121863 1 0 2 996122850 2 0 0 33 6 Kevin 0 kevin@stileproject.com 1 0 http://www.stileproject.com 1 1 0 Administrator 0 996120694 1 -1 1030996168 1031027028 1030599436 36 -6 0 1 0 1 0 0 15 0000-00-00 -1 1 64.0.0.0 0 1 -1 0 0 4 19 1 -DROP TABLE IF EXISTS t1,t2; +DROP TABLE t1,t2; CREATE TABLE t1 (a int primary key, b int, c int); INSERT t1 VALUES (1,2,3); CREATE TABLE t2 (a int primary key, b int, c int); @@ -418,4 +417,4 @@ INSERT t2 VALUES (3,4,5); SELECT DISTINCT t1.a, t2.b FROM t1, t2 WHERE t1.a=1 ORDER BY t2.c; a b 1 4 -DROP TABLE IF EXISTS t1,t2; +DROP TABLE t1,t2; diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result index 178c3a8cb4f..a9048b65d51 100644 --- a/mysql-test/r/drop.result +++ b/mysql-test/r/drop.result @@ -1,5 +1,4 @@ drop table if exists t1; -drop table if exists t1; drop table t1; Unknown table 't1' create table t1(n int); @@ -13,6 +12,8 @@ select * from t1; n 1 drop database if exists mysqltest; +Warnings: +Note 1008 Can't drop database 'mysqltest'. Database doesn't exist create database mysqltest; drop database if exists mysqltest; create database mysqltest; @@ -25,6 +26,8 @@ drop database if exists mysqltest; create database mysqltest; drop database mysqltest; drop database if exists mysqltest; +Warnings: +Note 1008 Can't drop database 'mysqltest'. Database doesn't exist flush tables with read lock; create database mysqltest; Got one of the listed errors diff --git a/mysql-test/r/flush.result b/mysql-test/r/flush.result index 7080f2b6145..4e7e4769f1b 100644 --- a/mysql-test/r/flush.result +++ b/mysql-test/r/flush.result @@ -1,6 +1,6 @@ -drop table if exists t1; +drop table if exists t1,t2; +drop database if exists mysqltest; create temporary table t1(n int not null primary key); -drop table if exists t2; create table t2(n int); insert into t2 values(3); select * from t1; @@ -11,7 +11,6 @@ drop table t2; Table 't2' was locked with a READ lock and can't be updated drop table t2; unlock tables; -drop database if exists mysqltest; create database mysqltest; create table mysqltest.t1(n int); insert into mysqltest.t1 values (23); diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index a991981bf21..66aa7311542 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -206,7 +206,6 @@ select 8 from t1; 8 8 drop table t1; -drop table if exists t1; create table t1 (a text, fulltext key (a)); insert into t1 values ('aaaa'); repair table t1; diff --git a/mysql-test/r/fulltext_multi.result b/mysql-test/r/fulltext_multi.result index 72b7102fd3f..968b00020e2 100644 --- a/mysql-test/r/fulltext_multi.result +++ b/mysql-test/r/fulltext_multi.result @@ -1,4 +1,3 @@ -use test; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( a int(11) NOT NULL auto_increment, diff --git a/mysql-test/r/fulltext_order_by.result b/mysql-test/r/fulltext_order_by.result index c0e72ff789f..bfee9eba280 100644 --- a/mysql-test/r/fulltext_order_by.result +++ b/mysql-test/r/fulltext_order_by.result @@ -1,4 +1,3 @@ -use test; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( a INT AUTO_INCREMENT PRIMARY KEY, diff --git a/mysql-test/r/func_equal.result b/mysql-test/r/func_equal.result index 32a911eedf8..352b76f2744 100644 --- a/mysql-test/r/func_equal.result +++ b/mysql-test/r/func_equal.result @@ -1,3 +1,4 @@ +drop table if exists t1,t2; select 0<=>0,0.0<=>0.0,"A"<=>"A",NULL<=>NULL; 0<=>0 0.0<=>0.0 "A"<=>"A" NULL<=>NULL 1 1 1 1 @@ -10,7 +11,6 @@ select 1.0<=>0.0,0.0<=>NULL,NULL<=>0.0; select "A"<=>"B","A"<=>NULL,NULL<=>"A"; "A"<=>"B" "A"<=>NULL NULL<=>"A" 0 0 0 -drop table if exists t1,t2; create table t1 (id int, value int); create table t2 (id int, value int); insert into t1 values (1,null); diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index 01d70c7c4c6..006dc8abef0 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -1,3 +1,4 @@ +drop table if exists t1; select 1 in (1,2,3); 1 in (1,2,3) 1 @@ -34,7 +35,6 @@ select 3.5 in (1.5,NULL,3.5); select 10.5 in (1.5,NULL,3.5); 10.5 in (1.5,NULL,3.5) NULL -drop table if exists t1; CREATE TABLE t1 (a int, b int, c int); insert into t1 values (1,2,3), (1,NULL,3); select 1 in (a,b,c) from t1; diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result index 5305c16c5d9..ab72e42eca9 100644 --- a/mysql-test/r/func_set.result +++ b/mysql-test/r/func_set.result @@ -25,3 +25,20 @@ find_in_set("","a,b,c") find_in_set("","a,b,c,") find_in_set("",",a,b,c") select find_in_set("abc","abc"),find_in_set("ab","abc"),find_in_set("abcd","abc"); find_in_set("abc","abc") find_in_set("ab","abc") find_in_set("abcd","abc") 1 0 0 +drop table if exists t1,t2; +create table t1 (id int(10) not null unique); +create table t2 (id int(10) not null primary key, +val int(10) not null); +insert into t1 values (1),(2),(4); +insert into t2 values (1,1),(2,1),(3,1),(4,2); +select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id; +id elt(two.val,'one','two') +1 one +2 one +4 two +select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id; +id elt(two.val,'one','two') +1 one +2 one +4 two +drop table t1,t2; diff --git a/mysql-test/r/gcc296.result b/mysql-test/r/gcc296.result index 8f78f70cc1f..628bbbf3f93 100644 --- a/mysql-test/r/gcc296.result +++ b/mysql-test/r/gcc296.result @@ -1,5 +1,5 @@ -drop table if exists obory; -CREATE TABLE obory ( +drop table if exists t1; +CREATE TABLE t1 ( kodoboru varchar(10) default NULL, obor tinytext, aobor tinytext, @@ -7,14 +7,14 @@ UNIQUE INDEX kodoboru (kodoboru), FULLTEXT KEY obor (obor), FULLTEXT KEY aobor (aobor) ); -INSERT INTO obory VALUES ('0101000000','aaa','AAA'); -INSERT INTO obory VALUES ('0102000000','bbb','BBB'); -INSERT INTO obory VALUES ('0103000000','ccc','CCC'); -INSERT INTO obory VALUES ('0104000000','xxx','XXX'); -select * from obory; +INSERT INTO t1 VALUES ('0101000000','aaa','AAA'); +INSERT INTO t1 VALUES ('0102000000','bbb','BBB'); +INSERT INTO t1 VALUES ('0103000000','ccc','CCC'); +INSERT INTO t1 VALUES ('0104000000','xxx','XXX'); +select * from t1; kodoboru obor aobor 0101000000 aaa AAA 0102000000 bbb BBB 0103000000 ccc CCC 0104000000 xxx XXX -drop table obory; +drop table t1; diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 696d8200b70..aa3de48c09e 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -1,6 +1,6 @@ +drop table if exists t1,t2,t3; SELECT 1 FROM (SELECT 1) as a GROUP BY SUM(1); Invalid use of group function -drop table if exists t1,t2,t3; CREATE TABLE t1 ( spID int(10) unsigned, userID int(10) unsigned, @@ -42,7 +42,7 @@ SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1 userid MIN(t1.score+0.0) 1 1.0 2 2.0 -drop table test.t1,test.t2; +drop table t1,t2; CREATE TABLE t1 ( PID int(10) unsigned DEFAULT '0' NOT NULL auto_increment, payDate date DEFAULT '0000-00-00' NOT NULL, @@ -390,7 +390,6 @@ CONCAT(a, b) count(*) abcdef 1 hijklm 2 DROP TABLE t1; -drop table if exists t1; create table t1 (One int unsigned, Two int unsigned, Three int unsigned, Four int unsigned); insert into t1 values (1,2,1,4),(1,2,2,4),(1,2,3,4),(1,2,4,4),(1,1,1,4),(1,1,2,4),(1,1,3,4),(1,1,4,4),(1,3,1,4),(1,3,2,4),(1,3,3,4),(1,3,4,4); select One, Two, sum(Four) from t1 group by One,Two; diff --git a/mysql-test/r/innodb-deadlock.result b/mysql-test/r/innodb-deadlock.result index db7155f14fb..e1b3e38b243 100644 --- a/mysql-test/r/innodb-deadlock.result +++ b/mysql-test/r/innodb-deadlock.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; create table t1 (id integer, x integer) type=INNODB; insert into t1 values(0, 0); set autocommit=0; @@ -18,7 +18,6 @@ id x 0 2 commit; drop table t1; -drop table if exists t1, t2; create table t1 (id integer, x integer) type=INNODB; create table t2 (b integer, a integer) type=INNODB; insert into t1 values(0, 0), (300, 300); diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 82e678416ad..6a4f807eab9 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1021,7 +1021,6 @@ id code name 7 4 Matt COMMIT; DROP TABLE t1; -drop table if exists t1,t2; create table t1 (n int(10), d int(10)) type=innodb; create table t2 (n int(10), d int(10)) type=innodb; insert into t1 values(1,1),(1,2); diff --git a/mysql-test/r/innodb_cache.result b/mysql-test/r/innodb_cache.result index 47abcb45fe5..7d351a13e16 100644 --- a/mysql-test/r/innodb_cache.result +++ b/mysql-test/r/innodb_cache.result @@ -1,4 +1,4 @@ -drop table if exists t1, t2, t3; +drop table if exists t1,t2,t3; flush status; set autocommit=0; create table t1 (a int not null) type=innodb; diff --git a/mysql-test/r/innodb_handler.result b/mysql-test/r/innodb_handler.result index a55114a0e3d..dc6a265fb29 100644 --- a/mysql-test/r/innodb_handler.result +++ b/mysql-test/r/innodb_handler.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; create table t1 (a int, b char(10), key a(a), key b(a,b)) type=innodb; insert into t1 values (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result index 69b790ff35b..ebd34dd7668 100644 --- a/mysql-test/r/insert.result +++ b/mysql-test/r/insert.result @@ -58,9 +58,9 @@ skr 2 test 1 test 2 drop table t1; -drop database if exists foo; -create database foo; -use foo; +drop database if exists test_$1; +create database test_$1; +use test_$1; create table t1 (c int); -insert into foo.t1 set foo.t1.c = '1'; -drop database foo; +insert into test_$1.t1 set test_$1.t1.c = '1'; +drop database test_$1; diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result index e24c3179a0c..9a65eaee573 100644 --- a/mysql-test/r/insert_select.result +++ b/mysql-test/r/insert_select.result @@ -21,8 +21,7 @@ payoutID 20 22 drop table t1,t2; -DROP TABLE IF EXISTS crash1,crash2; -CREATE TABLE `crash1` ( +CREATE TABLE `t1` ( `numeropost` bigint(20) unsigned NOT NULL default '0', `icone` tinyint(4) unsigned NOT NULL default '0', `numreponse` bigint(20) unsigned NOT NULL auto_increment, @@ -37,7 +36,7 @@ KEY `date` (`date`), KEY `pseudo` (`pseudo`), KEY `numreponse` (`numreponse`) ) TYPE=MyISAM; -CREATE TABLE `crash2` ( +CREATE TABLE `t2` ( `numeropost` bigint(20) unsigned NOT NULL default '0', `icone` tinyint(4) unsigned NOT NULL default '0', `numreponse` bigint(20) unsigned NOT NULL auto_increment, @@ -52,17 +51,17 @@ KEY `date` (`date`), KEY `pseudo` (`pseudo`), KEY `numreponse` (`numreponse`) ) TYPE=MyISAM; -INSERT INTO crash2 +INSERT INTO t2 (numeropost,icone,numreponse,contenu,pseudo,date,ip,signature) VALUES (9,1,56,'test','joce','2001-07-25 13:50:53' ,3649052399,0); -INSERT INTO crash1 (numeropost,icone,contenu,pseudo,date,signature,ip) -SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM crash2 +INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip) +SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM t2 WHERE numeropost=9 ORDER BY numreponse ASC; show variables like '%bulk%'; Variable_name Value bulk_insert_buffer_size 8388608 -INSERT INTO crash1 (numeropost,icone,contenu,pseudo,date,signature,ip) -SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM crash2 +INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip) +SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM t2 WHERE numeropost=9 ORDER BY numreponse ASC; -DROP TABLE IF EXISTS crash1,crash2; +DROP TABLE IF EXISTS t1,t2; diff --git a/mysql-test/r/isam.result b/mysql-test/r/isam.result index e8f7898f1eb..85641055fe6 100644 --- a/mysql-test/r/isam.result +++ b/mysql-test/r/isam.result @@ -38,6 +38,8 @@ Incorrect table definition; There can only be one auto column and it must be def create table t1 (ordid int(8), unique (ordid)) type=isam; Column 'ordid' is used with UNIQUE or INDEX but is not defined as NOT NULL drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' create table t1 (a int not null primary key, b int not null,c int not null, key(b,c)); insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4); create table t2 type=isam select * from t1; diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index b89a6696727..8abe6d517ee 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -181,7 +181,6 @@ SELECT t1.usr_id,t1.uniq_id,t1.increment,t2.usr2_id,t2.c_amount,t2.max FROM t1 L usr_id uniq_id increment usr2_id c_amount max 3 4 84676 NULL NULL NULL drop table t1,t2; -drop table if exists t1,t2,t3,t4; CREATE TABLE t1 ( cod_asig int(11) DEFAULT '0' NOT NULL, desc_larga_cat varchar(80) DEFAULT '' NOT NULL, diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result index 1cd9c9dfe79..9e1f743d132 100644 --- a/mysql-test/r/key.result +++ b/mysql-test/r/key.result @@ -147,7 +147,6 @@ t1 0 e 1 e A 0 NULL NULL BTREE t1 0 b 1 b A NULL NULL NULL YES BTREE t1 1 c 1 c A NULL NULL NULL YES BTREE drop table t1; -DROP TABLE IF EXISTS t1; CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT, UNIQUE (c,i)); INSERT INTO t1 (c) VALUES (NULL),(NULL); diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index d0e595d6551..772ed0349da 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -181,6 +181,8 @@ Can't open file: 't4.MRG'. (errno: 143) create table t5 (a int not null, b char(10), key(a)) type=MERGE UNION=(test.t1,test_2.t2); Incorrect table definition; All MERGE tables must be in the same database drop table if exists t5,t4,t3,t1,t2; +Warnings: +Note 1051 Unknown table 't5' create table t1 (c char(10)) type=myisam; create table t2 (c char(10)) type=myisam; create table t3 (c char(10)) union=(t1,t2) type=merge; @@ -262,7 +264,6 @@ create table t1 (a int not null) type=merge; select * from t1; a drop table t1; -drop table if exists t3, t2, t1; create table t1 (a int not null, b int not null, key(a,b)); create table t2 (a int not null, b int not null, key(a,b)); create table t3 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2); @@ -274,7 +275,6 @@ a b 1 1 1 2 drop table t3,t1,t2; -drop table if exists t6, t5, t4, t3, t2, t1; create table t1 (a int not null, b int not null auto_increment, primary key(a,b)); create table t2 (a int not null, b int not null auto_increment, primary key(a,b)); create table t3 (a int not null, b int not null, key(a,b)) UNION=(t1,t2) INSERT_METHOD=NO; @@ -533,15 +533,14 @@ CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default ' INSERT INTO t1 VALUES (1,1), (2,1); CREATE TABLE t2 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM; INSERT INTO t2 VALUES (1,2), (2,2); -CREATE TABLE t ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2); -select max(b) from t where a = 2; +CREATE TABLE t3 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2); +select max(b) from t3 where a = 2; max(b) NULL select max(b) from t1 where a = 2; max(b) 1 -drop table if exists t,t1,t2; -drop table if exists t1, t2, t3, t4, t5, t6; +drop table if exists t3,t1,t2; create table t1 (a int not null); create table t2 (a int not null); insert into t1 values (1); @@ -561,7 +560,6 @@ a 1 2 drop table if exists t6, t3, t1, t2, t4, t5; -DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 ( fileset_id tinyint(3) unsigned NOT NULL default '0', file_code varchar(32) NOT NULL default '', @@ -595,4 +593,4 @@ EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2 AND file_code = '0000000115' LIMIT 1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 const PRIMARY,files PRIMARY 33 const,const 1 -DROP TABLE IF EXISTS t2, t1; +DROP TABLE t2, t1; diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index b037fc87996..4dbb3c8adb1 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -96,7 +96,7 @@ id mydate 5 2002-05-12 00:00:00 6 2002-06-22 00:00:00 7 2002-07-22 00:00:00 -DROP TABLE IF EXISTS t1,t2,t3; +DROP TABLE t1,t2,t3; CREATE TABLE IF NOT EXISTS `t1` ( `id` int(11) NOT NULL auto_increment, `tst` text, @@ -125,7 +125,7 @@ ID ParId tst tst1 1 1 MySQL MySQL AB 2 2 MSSQL Microsoft 3 3 ORACLE ORACLE -drop table if exists t1, t2 ; +drop table t1, t2 ; create table t1 (n numeric(10)); create table t2 (n numeric(10)); insert into t2 values (1),(2),(4),(8),(16),(32); @@ -251,7 +251,6 @@ n d select * from t2; n d drop table t1,t2; -drop table if exists t1,t2,t3; CREATE TABLE t1 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; INSERT INTO t1 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'),(10,''),(11,''),(12,''),(13,''); CREATE TABLE t2 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; @@ -260,4 +259,4 @@ CREATE TABLE t3 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT INSERT INTO t3 VALUES (1,'jedan'),(2,'dva'); update t1,t2 set t1.naziv="aaaa" where t1.broj=t2.broj; update t1,t2,t3 set t1.naziv="bbbb", t2.naziv="aaaa" where t1.broj=t2.broj and t2.broj=t3.broj; -drop table if exists t1,t2,t3; +drop table t1,t2,t3; diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 6b9c3a53305..f06194bb412 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -83,7 +83,6 @@ OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK DROP TABLE t1; -drop table if exists t1; create table t1 ( t1 char(255), key(t1(250))); insert t1 values ('137513751375137513751375137513751375137569516951695169516951695169516951695169'); insert t1 values ('178417841784178417841784178417841784178403420342034203420342034203420342034203'); @@ -121,7 +120,6 @@ check table t1; Table Op Msg_type Msg_text test.t1 check status OK drop table t1; -drop table if exists t1; create table t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8 int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17 int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int, @@ -286,7 +284,7 @@ insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); -drop table if exists t1; +drop table t1; CREATE TABLE `t1` ( `post_id` mediumint(8) unsigned NOT NULL auto_increment, `topic_id` mediumint(8) unsigned NOT NULL default '0', diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index cdea66cbf58..91af34b6681 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -1,3 +1,4 @@ +drop table if exists t1; select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null; NULL NULL isnull(null) isnull(1/0) isnull(1/0 = null) ifnull(null,1) ifnull(null,"TRUE") ifnull("TRUE","ERROR") 1/0 is null 1 is not null NULL NULL 1 1 1 1 TRUE TRUE 1 1 @@ -34,7 +35,6 @@ NULL AND 0 0 and NULL select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton(""); inet_ntoa(null) inet_aton(null) inet_aton("122.256") inet_aton("122.226.") inet_aton("") NULL NULL NULL NULL NULL -drop table if exists t1; create table t1 (x int); insert into t1 values (null); select * from t1 where x != 0; diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result index 484437959a0..ce3af6c37cd 100644 --- a/mysql-test/r/null_key.result +++ b/mysql-test/r/null_key.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; create table t1 (a int, b int not null,unique key (a,b),index(b)) type=myisam; insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6); explain select * from t1 where a is null; @@ -136,7 +136,6 @@ select * from t1 where b like "6%"; a b c 6 6 0 drop table t1; -DROP TABLE IF EXISTS t1,t2; CREATE TABLE t1 ( id int(10) unsigned NOT NULL auto_increment, uniq_id int(10) unsigned default NULL, diff --git a/mysql-test/r/odbc.result b/mysql-test/r/odbc.result index 30366762cd0..c0b2ada0053 100644 --- a/mysql-test/r/odbc.result +++ b/mysql-test/r/odbc.result @@ -1,7 +1,7 @@ +drop table if exists t1; select {fn length("hello")}, { date "1997-10-20" }; {fn length("hello")} 1997-10-20 5 1997-10-20 -drop table if exists t1; create table t1 (a int not null auto_increment,b int not null,primary key (a,b)); insert into t1 SET A=NULL,B=1; insert into t1 SET a=null,b=2; diff --git a/mysql-test/r/olap.result b/mysql-test/r/olap.result index 52bd83df5ed..428d1052d19 100644 --- a/mysql-test/r/olap.result +++ b/mysql-test/r/olap.result @@ -1,6 +1,6 @@ -drop table if exists sales; -create table sales ( product varchar(32), country varchar(32), year int, profit int); -insert into sales values ( 'Computer', 'India',2000, 1200), +drop table if exists t1; +create table t1 ( product varchar(32), country varchar(32), year int, profit int); +insert into t1 values ( 'Computer', 'India',2000, 1200), ( 'TV', 'United States', 1999, 150), ( 'Calculator', 'United States', 1999,50), ( 'Computer', 'United States', 1999,1500), @@ -14,14 +14,14 @@ insert into sales values ( 'Computer', 'India',2000, 1200), ( 'Computer', 'India', 1999,1200), ( 'Computer', 'United States', 2000,1500), ( 'Calculator', 'United States', 2000,75); -select product, country , year, sum(profit) from sales group by product, country, year with cube; +select product, country , year, sum(profit) from t1 group by product, country, year with cube; This version of MySQL doesn't yet support 'CUBE' -explain select product, country , year, sum(profit) from sales group by product, country, year with cube; +explain select product, country , year, sum(profit) from t1 group by product, country, year with cube; This version of MySQL doesn't yet support 'CUBE' -select product, country , year, sum(profit) from sales group by product, country, year with rollup; +select product, country , year, sum(profit) from t1 group by product, country, year with rollup; This version of MySQL doesn't yet support 'ROLLUP' -explain select product, country , year, sum(profit) from sales group by product, country, year with rollup; +explain select product, country , year, sum(profit) from t1 group by product, country, year with rollup; This version of MySQL doesn't yet support 'ROLLUP' -select product, country , year, sum(profit) from sales group by product, country, year with cube union all select product, country , year, sum(profit) from sales group by product, country, year with rollup; +select product, country , year, sum(profit) from t1 group by product, country, year with cube union all select product, country , year, sum(profit) from t1 group by product, country, year with rollup; This version of MySQL doesn't yet support 'CUBE' -drop table sales; +drop table t1; diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 5645961a178..62db8bf367a 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -222,7 +222,6 @@ DateOfAction TransactionID 1999-07-27 834 1999-07-27 840 drop table t1,t2,t3; -drop table if exists t1; CREATE TABLE t1 ( member_id int(11) NOT NULL auto_increment, inschrijf_datum varchar(20) NOT NULL default '', diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index ad9294e6d3a..17c9c8edbd2 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -2,6 +2,7 @@ flush query cache; flush query cache; reset query cache; flush status; +drop database if exists mysqltest; drop table if exists t1,t2,t3,t11,t21, mysqltest.t1; create table t1 (a int not null); insert into t1 values (1),(2),(3); diff --git a/mysql-test/r/rename.result b/mysql-test/r/rename.result index b2bb659502a..e422fbe49c1 100644 --- a/mysql-test/r/rename.result +++ b/mysql-test/r/rename.result @@ -37,3 +37,5 @@ select * from t3; 3 table 3 3 table 3 drop table if exists t1,t2,t3,t4; +Warnings: +Note 1051 Unknown table 't4' diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result index 1d606fc370c..f3522e05380 100644 --- a/mysql-test/r/row.result +++ b/mysql-test/r/row.result @@ -1,3 +1,4 @@ +drop table if exists t1; select row(1,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)); row(1,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)) 1 @@ -88,7 +89,6 @@ ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,NULL)) NULL SELECT ROW('test',2,ROW(3,33))=ROW('test',2,4); Cardinality error (more/less than 2 columns) -drop table if exists t1; create table t1 ( a int, b int, c int); insert into t1 values (1,2,3), (2,3,1), (3,2,1), (1,2,NULL); select * from t1 where ROW(1,2,3)=ROW(a,b,c); @@ -127,7 +127,6 @@ ROW(1,2,3) IN(row(a,b,c), row(1,2,3)) drop table t1; select ROW(1,1); Cardinality error (more/less than 1 columns) -drop table if exists t1; create table t1 (i int); select 1 from t1 where ROW(1,1); Cardinality error (more/less than 1 columns) diff --git a/mysql-test/r/rpl000001.result b/mysql-test/r/rpl000001.result index 5cee2e6deff..dd569944f0e 100644 --- a/mysql-test/r/rpl000001.result +++ b/mysql-test/r/rpl000001.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1,t2,t3; create table t1 (word char(20) not null); load data infile '../../std_data/words.dat' into table t1; load data local infile 'MYSQL_TEST_DIR/std_data/words.dat' into table t1; diff --git a/mysql-test/r/rpl000002.result b/mysql-test/r/rpl000002.result index 819f43da103..56e34b4874f 100644 --- a/mysql-test/r/rpl000002.result +++ b/mysql-test/r/rpl000002.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1; create table t1 (n int auto_increment primary key); set insert_id = 2000; insert into t1 values (NULL),(NULL),(NULL); @@ -18,7 +17,6 @@ Server_id Host Port Rpl_recovery_rank Master_id 2 127.0.0.1 9999 2 1 drop table t1; stop slave; -drop table if exists t2; create table t2(id int auto_increment primary key, created datetime); set timestamp=12345; insert into t2 set created=now(); diff --git a/mysql-test/r/rpl000003.result b/mysql-test/r/rpl000003.result deleted file mode 100644 index 7c63ada9cdf..00000000000 --- a/mysql-test/r/rpl000003.result +++ /dev/null @@ -1,17 +0,0 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -drop table if exists t1; -create table t1(n int primary key); -insert into t1 values (1),(2),(2); -Duplicate entry '2' for key 1 -insert into t1 values (3); -select * from t1; -n -1 -2 -3 -drop table t1; diff --git a/mysql-test/r/rpl000004.result b/mysql-test/r/rpl000004.result index a677eac36d4..067696345e4 100644 --- a/mysql-test/r/rpl000004.result +++ b/mysql-test/r/rpl000004.result @@ -5,18 +5,13 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; set SQL_LOG_BIN=0; -drop table if exists t1; create table t1 (word char(20) not null, index(word)); load data infile '../../std_data/words.dat' into table t1; -drop table if exists t2; create table t2 (word char(20) not null); load data infile '../../std_data/words.dat' into table t2; create table t3 (word char(20) not null primary key); -drop table if exists t1; load table t1 from master; -drop table if exists t2; load table t2 from master; -drop table if exists t3; load table t3 from master; check table t1; Table Op Msg_type Msg_text diff --git a/mysql-test/r/rpl000005.result b/mysql-test/r/rpl000005.result index 228bb00a1a3..0202e43dcb2 100644 --- a/mysql-test/r/rpl000005.result +++ b/mysql-test/r/rpl000005.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1; CREATE TABLE t1 (name varchar(64), age smallint(3)); INSERT INTO t1 SET name='Andy', age=31; INSERT t1 SET name='Jacob', age=2; diff --git a/mysql-test/r/rpl000006.result b/mysql-test/r/rpl000006.result index e256e0f0136..7209ec3c3d1 100644 --- a/mysql-test/r/rpl000006.result +++ b/mysql-test/r/rpl000006.result @@ -5,13 +5,11 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; set SQL_LOG_BIN=0,timestamp=200006; -drop table if exists t1; create table t1(t timestamp not null,a char(1)); insert into t1 ( a) values ('F'); select unix_timestamp(t) from t1; unix_timestamp(t) 200006 -drop table if exists t1; load table t1 from master; select unix_timestamp(t) from t1; unix_timestamp(t) diff --git a/mysql-test/r/rpl000008.result b/mysql-test/r/rpl000008.result index eb0089da9d6..a88a3c690ed 100644 --- a/mysql-test/r/rpl000008.result +++ b/mysql-test/r/rpl000008.result @@ -5,21 +5,19 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; use test; -drop table if exists foo; -create table foo (n int); -insert into foo values(4); +drop table if exists mysqltest_foo; +drop table if exists mysqltest_bar; +create table mysqltest_foo (n int); +insert into mysqltest_foo values(4); use test; -drop table if exists foo; -create table foo (n int); -insert into foo values(5); -drop table if exists bar; -create table bar (m int); -insert into bar values(15); -drop table if exists choo; -create table choo (k int); -insert into choo values(55); -select foo.n,bar.m,choo.k from foo,bar,choo; +create table mysqltest_foo (n int); +insert into mysqltest_foo values(5); +create table mysqltest_bar (m int); +insert into mysqltest_bar values(15); +create table t1 (k int); +insert into t1 values(55); +select mysqltest_foo.n,mysqltest_bar.m,t1.k from mysqltest_foo,mysqltest_bar,t1; n m k 4 15 55 -drop table if exists foo,bar,choo; -drop table if exists foo,bar,choo; +drop table mysqltest_foo,mysqltest_bar,t1; +drop table mysqltest_foo,mysqltest_bar,t1; diff --git a/mysql-test/r/rpl000009.result b/mysql-test/r/rpl000009.result index 1a1ea309ae9..e67993b53f6 100644 --- a/mysql-test/r/rpl000009.result +++ b/mysql-test/r/rpl000009.result @@ -4,80 +4,78 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop database if exists foo; -create database foo; -drop database if exists bar; -create database bar; -drop table if exists foo.foo; -create table foo.foo (n int); -insert into foo.foo values(4); -drop table if exists foo.foo; -create table foo.foo (n int); -insert into foo.foo values(5); -drop table if exists bar.bar; -create table bar.bar (m int); -insert into bar.bar values(15); -select foo.foo.n,bar.bar.m from foo.foo,bar.bar; +drop database if exists mysqltest2; +create database mysqltest2; +drop database if exists mysqltest; +create database mysqltest; +create table mysqltest2.foo (n int); +insert into mysqltest2.foo values(4); +create table mysqltest2.foo (n int); +insert into mysqltest2.foo values(5); +create table mysqltest.bar (m int); +insert into mysqltest.bar values(15); +select mysqltest2.foo.n,mysqltest.bar.m from mysqltest2.foo,mysqltest.bar; n m 4 15 -drop database if exists bar; -drop database if exists foo; -drop database if exists bar; -drop database if exists foo; +drop database mysqltest; +drop database mysqltest2; set sql_log_bin = 0; -create database foo; -create database bar; +create database mysqltest2; +create database mysqltest; show databases; Database -bar -foo mysql +mysqltest +mysqltest2 test -create table foo.t1(n int, s char(20)); -create table foo.t2(n int, s text); -insert into foo.t1 values (1, 'one'), (2, 'two'), (3, 'three'); -insert into foo.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen'); -create table bar.t1(n int, s char(20)); -create table bar.t2(n int, s text); -insert into bar.t1 values (1, 'one bar'), (2, 'two bar'), (3, 'three bar'); -insert into bar.t2 values (11, 'eleven bar'), (12, 'twelve bar'), -(13, 'thirteen bar'); +create table mysqltest2.t1(n int, s char(20)); +create table mysqltest2.t2(n int, s text); +insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three'); +insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen'); +create table mysqltest.t1(n int, s char(20)); +create table mysqltest.t2(n int, s text); +insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test'); +insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'), +(13, 'thirteen test'); set sql_log_bin = 1; show databases; Database mysql test load data from master; +Warnings: +Note 1008 Can't drop database 'mysqltest'. Database doesn't exist +Note 1008 Can't drop database 'mysqltest2'. Database doesn't exist show databases; Database -bar -foo mysql +mysqltest +mysqltest2 test -use foo; +use mysqltest2; show tables; -Tables_in_foo -use bar; +Tables_in_mysqltest2 +use mysqltest; show tables; -Tables_in_bar +Tables_in_mysqltest t1 t2 -select * from bar.t1; +select * from mysqltest.t1; n s -1 one bar -2 two bar -3 three bar -select * from bar.t2; +1 one test +2 two test +3 three test +select * from mysqltest.t2; n s -11 eleven bar -12 twelve bar -13 thirteen bar -insert into bar.t1 values (4, 'four bar'); -select * from bar.t1; +11 eleven test +12 twelve test +13 thirteen test +insert into mysqltest.t1 values (4, 'four test'); +select * from mysqltest.t1; n s -1 one bar -2 two bar -3 three bar -4 four bar -drop database bar; -drop database foo; +1 one test +2 two test +3 three test +4 four test +drop database mysqltest; +drop database mysqltest2; diff --git a/mysql-test/r/rpl000010.result b/mysql-test/r/rpl000010.result index 6b6b89d1547..65191ea411f 100644 --- a/mysql-test/r/rpl000010.result +++ b/mysql-test/r/rpl000010.result @@ -4,8 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1; -drop table if exists t1; create table t1 (n int not null auto_increment primary key); insert into t1 values(NULL); insert into t1 values(2); diff --git a/mysql-test/r/rpl000011.result b/mysql-test/r/rpl000011.result index bb017076822..dd0fa2fbe74 100644 --- a/mysql-test/r/rpl000011.result +++ b/mysql-test/r/rpl000011.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1; create table t1 (n int); insert into t1 values(1); stop slave; diff --git a/mysql-test/r/rpl000012.result b/mysql-test/r/rpl000012.result index f809fa7fe74..17fb53010ab 100644 --- a/mysql-test/r/rpl000012.result +++ b/mysql-test/r/rpl000012.result @@ -4,18 +4,16 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1,t2,t3; create table t2 (n int); create temporary table t1 (n int); insert into t1 values(1),(2),(3); insert into t2 select * from t1; -drop table if exists test.t3; -create temporary table test.t3 (n int not null); -alter table test.t3 add primary key(n); +create temporary table t3 (n int not null); +alter table t3 add primary key(n); flush logs; insert into t3 values (100); insert into t2 select * from t3; -drop table if exists test.t3; +drop table if exists t3; insert into t2 values (101); create temporary table t1 (n int); insert into t1 values (4),(5); @@ -35,3 +33,5 @@ show status like 'Slave_open_temp_tables'; Variable_name Value Slave_open_temp_tables 0 drop table if exists t1,t2; +Warnings: +Note 1051 Unknown table 't1' diff --git a/mysql-test/r/rpl000013.result b/mysql-test/r/rpl000013.result index 333d769baff..37838bb88e0 100644 --- a/mysql-test/r/rpl000013.result +++ b/mysql-test/r/rpl000013.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t2; create table t2(n int); create temporary table t1 (n int); insert into t1 values(1),(2),(3); @@ -25,3 +24,5 @@ show status like 'Slave_open_temp_tables'; Variable_name Value Slave_open_temp_tables 0 drop table if exists t1,t2; +Warnings: +Note 1051 Unknown table 't1' diff --git a/mysql-test/r/rpl_alter.result b/mysql-test/r/rpl_alter.result index 0b947c0bb70..e7abc3b3b48 100644 --- a/mysql-test/r/rpl_alter.result +++ b/mysql-test/r/rpl_alter.result @@ -4,18 +4,18 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop database if exists d1; -create database d1; -create table d1.t1 ( n int); -alter table d1.t1 add m int; -insert into d1.t1 values (1,2); -create table d1.t2 (n int); -insert into d1.t2 values (45); -rename table d1.t2 to d1.t3, d1.t1 to d1.t2; -select * from d1.t2; +drop database if exists test_$1; +create database test_$1; +create table test_$1.t1 ( n int); +alter table test_$1.t1 add m int; +insert into test_$1.t1 values (1,2); +create table test_$1.t2 (n int); +insert into test_$1.t2 values (45); +rename table test_$1.t2 to test_$1.t3, test_$1.t1 to test_$1.t2; +select * from test_$1.t2; n m 1 2 -select * from d1.t3; +select * from test_$1.t3; n 45 -drop database d1; +drop database test_$1; diff --git a/mysql-test/r/rpl_empty_master_crash.result b/mysql-test/r/rpl_empty_master_crash.result index 267806feb2e..8818029ab99 100644 --- a/mysql-test/r/rpl_empty_master_crash.result +++ b/mysql-test/r/rpl_empty_master_crash.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1; show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space load table t1 from master; diff --git a/mysql-test/r/rpl_redirect.result b/mysql-test/r/rpl_redirect.result index 66c94a00b5f..3807479fb54 100644 --- a/mysql-test/r/rpl_redirect.result +++ b/mysql-test/r/rpl_redirect.result @@ -9,7 +9,6 @@ Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Lo SHOW SLAVE HOSTS; Server_id Host Port Rpl_recovery_rank Master_id 2 127.0.0.1 SLAVE_PORT 2 1 -drop table if exists t1; create table t1 ( n int); insert into t1 values (1),(2),(3),(4); insert into t1 values(5); diff --git a/mysql-test/r/rpl_replicate_do.result b/mysql-test/r/rpl_replicate_do.result index aabda54640c..9ae292c2709 100644 --- a/mysql-test/r/rpl_replicate_do.result +++ b/mysql-test/r/rpl_replicate_do.result @@ -25,4 +25,4 @@ n 4 select * from t11; Table 'test.t11' doesn't exist -drop table if exists t1,t2,t3,t11; +drop table if exists t1,t2,t11; diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result index 2582b875daa..5275ef26b5c 100644 --- a/mysql-test/r/rpl_rotate_logs.result +++ b/mysql-test/r/rpl_rotate_logs.result @@ -22,7 +22,6 @@ s Could not break slave Tried hard flush logs; -drop table if exists t2; create table t2(m int not null auto_increment primary key); insert into t2 values (34),(67),(123); flush logs; @@ -58,7 +57,6 @@ m 1234 create temporary table temp_table (a char(80) not null); insert into temp_table values ("testing temporary tables part 2"); -drop table if exists t3; create table t3 (n int); create table t4 select * from temp_table; show binary logs; diff --git a/mysql-test/r/rpl_skip_error.result b/mysql-test/r/rpl_skip_error.result index 91aae09001f..e52426c381c 100644 --- a/mysql-test/r/rpl_skip_error.result +++ b/mysql-test/r/rpl_skip_error.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1; create table t1 (n int not null primary key); insert into t1 values (1); insert into t1 values (1); diff --git a/mysql-test/r/rpl_temporary.result b/mysql-test/r/rpl_temporary.result index a628936b600..470a6302a2b 100644 --- a/mysql-test/r/rpl_temporary.result +++ b/mysql-test/r/rpl_temporary.result @@ -4,9 +4,8 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1; +drop table if exists t1,t2; create table t1(f int); -drop table if exists t2; create table t2(f int); insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); create temporary table t3(f int); @@ -35,8 +34,7 @@ master-bin.000001 573 Query 1 573 use `test`; insert into t3 select * from t1 wh master-bin.000001 650 Query 1 650 use `test`; drop temporary table t3 master-bin.000001 708 Query 1 708 use `test`; insert into t2 select count(*) from t3 master-bin.000001 781 Query 1 781 use `test`; drop temporary table t3 -drop table if exists t1; -drop table if exists t2; +drop table t1, t2; use test; SET TIMESTAMP=1040323920; create table t1(f int); @@ -72,3 +70,4 @@ select * from t2; f 5 7 +drop table t1,t2; diff --git a/mysql-test/r/sel000001.result b/mysql-test/r/sel000001.result deleted file mode 100644 index 28f6d3d1d5a..00000000000 --- a/mysql-test/r/sel000001.result +++ /dev/null @@ -1,7 +0,0 @@ -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (s CHAR(20) PRIMARY KEY, id INT); -INSERT INTO t1 VALUES ('cat', 1), ('mouse', 3), ('dog', 2), ('snake', 77); -SELECT s, id FROM t1 WHERE s = 'mouse'; -s id -mouse 3 -drop table t1; diff --git a/mysql-test/r/sel000002.result b/mysql-test/r/sel000002.result deleted file mode 100644 index b824de8de4a..00000000000 --- a/mysql-test/r/sel000002.result +++ /dev/null @@ -1,9 +0,0 @@ -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (n INT); -INSERT INTO t1 VALUES (1), (2), (3); -SELECT * FROM t1; -n -1 -2 -3 -drop table t1; diff --git a/mysql-test/r/sel000003.result b/mysql-test/r/sel000003.result deleted file mode 100644 index c3853832f87..00000000000 --- a/mysql-test/r/sel000003.result +++ /dev/null @@ -1,8 +0,0 @@ -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (name CHAR(20) NOT NULL PRIMARY KEY, score SMALLINT NOT NULL, KEY(score)); -INSERT INTO t1 VALUES ('Sasha', 20), ('Matt', 20), ('Monty', 10), ('David', 10), ('Tim', 10), ('Jeremy', 10); -SELECT COUNT(*) as n, score FROM t1 GROUP BY score; -n score -4 10 -2 20 -drop table t1; diff --git a/mysql-test/r/sel000031.result b/mysql-test/r/sel000031.result deleted file mode 100644 index d3f01ab687f..00000000000 --- a/mysql-test/r/sel000031.result +++ /dev/null @@ -1,12 +0,0 @@ -drop table if exists t1,t2; -create table t1 (id int(10) not null unique); -create table t2 (id int(10) not null primary key, -val int(10) not null); -insert into t1 values (1),(2),(4); -insert into t2 values (1,1),(2,1),(3,1),(4,2); -select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id; -id elt(two.val,'one','two') -1 one -2 one -4 two -drop table t1,t2; diff --git a/mysql-test/r/sel000032.result b/mysql-test/r/sel000032.result deleted file mode 100644 index 4cca245d75b..00000000000 --- a/mysql-test/r/sel000032.result +++ /dev/null @@ -1,12 +0,0 @@ -drop table if exists t1,t2; -create table t1 (id int(10) not null unique); -create table t2 (id int(10) not null primary key, -val int(10) not null); -insert into t1 values (1),(2),(4); -insert into t2 values (1,1),(2,1),(3,1),(4,2); -select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id; -id elt(two.val,'one','two') -1 one -2 one -4 two -drop table t1,t2; diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 80aa6046e8d..c70dec6f9eb 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -1,4 +1,3 @@ -use test; drop table if exists t1,t2,t3,t4; CREATE TABLE t1 ( Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, @@ -2493,7 +2492,6 @@ fld1 fld3 period price price2 018601 vacuuming 1001 5987435 234724 018801 inch 1001 5987435 234724 018811 repetitions 1001 5987435 234724 -drop table if exists company; create table t4 ( companynr tinyint(2) unsigned zerofill NOT NULL default '00', companyname char(30) NOT NULL default '', @@ -3478,7 +3476,6 @@ a a a 2 2 2 3 3 3 drop table t1; -drop table if exists t1,t2; CREATE TABLE t1 ( aa char(2), id int(11) NOT NULL auto_increment, t2_id int(11) NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) TYPE=MyISAM; INSERT INTO t1 VALUES ("1",8264,2506),("2",8299,2517),("3",8301,2518),("4",8302,2519),("5",8303,2520),("6",8304,2521),("7",8305,2522); CREATE TABLE t2 ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=MyISAM; @@ -3490,4 +3487,4 @@ aa id t2_id id 4 8302 2519 2519 5 8303 2520 2520 6 8304 2521 2521 -drop table if exists t1,t2; +drop table t1,t2; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 38a8e0368c6..6bf9fd372c3 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -1,3 +1,4 @@ +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12; select (select 2); (select 2) 2 @@ -119,7 +120,6 @@ SELECT (SELECT 1.5,2,'a') = ROW(1.5,'c','a'); SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); (SELECT 1.5,'c','a') = ROW(1.5,2,'a') 0 -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; create table t1 (a int); create table t2 (a int, b int); create table t3 (a int); @@ -310,7 +310,6 @@ W 1 SELECT * FROM t3 WHERE b = (SELECT MIN(b) FROM t3); a b W a -drop table if exists t8; CREATE TABLE `t8` ( `pseudo` varchar(35) character set latin1 NOT NULL default '', `email` varchar(60) character set latin1 NOT NULL default '', @@ -520,7 +519,6 @@ a b 0 10 1 11 drop table t1, t2; -drop table if exists t11, t12, t2; create table t11 (a int NOT NULL, b int, primary key (a)); create table t12 (a int NOT NULL, b int, primary key (a)); create table t2 (a int NOT NULL, b int, primary key (a)); @@ -626,7 +624,6 @@ x y drop table t1, t2, t3; SELECT * FROM (SELECT 1) b WHERE 1 IN (SELECT *); No tables used -drop table if exists t; CREATE TABLE t (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1; INSERT INTO t VALUES (1),(2); SELECT * FROM t WHERE id IN (SELECT 1); @@ -809,45 +806,44 @@ a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c') (select c from t1 where 2 0 b NULL NULL NULL drop table t1,t2; -drop table if exists t; -create table t (a int, b real, c varchar(10)); -insert into t values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b'); -select ROW(1, 1, 'a') IN (select a,b,c from t); -ROW(1, 1, 'a') IN (select a,b,c from t) +create table t1 (a int, b real, c varchar(10)); +insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b'); +select ROW(1, 1, 'a') IN (select a,b,c from t1); +ROW(1, 1, 'a') IN (select a,b,c from t1) 1 -select ROW(1, 2, 'a') IN (select a,b,c from t); -ROW(1, 2, 'a') IN (select a,b,c from t) +select ROW(1, 2, 'a') IN (select a,b,c from t1); +ROW(1, 2, 'a') IN (select a,b,c from t1) NULL -select ROW(1, 1, 'a') IN (select b,a,c from t); -ROW(1, 1, 'a') IN (select b,a,c from t) +select ROW(1, 1, 'a') IN (select b,a,c from t1); +ROW(1, 1, 'a') IN (select b,a,c from t1) 1 -select ROW(1, 1, 'a') IN (select a,b,c from t where a is not null); -ROW(1, 1, 'a') IN (select a,b,c from t where a is not null) +select ROW(1, 1, 'a') IN (select a,b,c from t1 where a is not null); +ROW(1, 1, 'a') IN (select a,b,c from t1 where a is not null) 1 -select ROW(1, 2, 'a') IN (select a,b,c from t where a is not null); -ROW(1, 2, 'a') IN (select a,b,c from t where a is not null) +select ROW(1, 2, 'a') IN (select a,b,c from t1 where a is not null); +ROW(1, 2, 'a') IN (select a,b,c from t1 where a is not null) 0 -select ROW(1, 1, 'a') IN (select b,a,c from t where a is not null); -ROW(1, 1, 'a') IN (select b,a,c from t where a is not null) +select ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null); +ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null) 1 -select ROW(1, 1, 'a') IN (select a,b,c from t where c='b' or c='a'); -ROW(1, 1, 'a') IN (select a,b,c from t where c='b' or c='a') +select ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a'); +ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a') 1 -select ROW(1, 2, 'a') IN (select a,b,c from t where c='b' or c='a'); -ROW(1, 2, 'a') IN (select a,b,c from t where c='b' or c='a') +select ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a'); +ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a') NULL -select ROW(1, 1, 'a') IN (select b,a,c from t where c='b' or c='a'); -ROW(1, 1, 'a') IN (select b,a,c from t where c='b' or c='a') +select ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a'); +ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a') 1 -select ROW(1, 1, 'a') IN (select b,a,c from t limit 2); +select ROW(1, 1, 'a') IN (select b,a,c from t1 limit 2); This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' -drop table t; -create table t (a int); -insert into t values (1); -do @a:=(SELECT a from t); +drop table t1; +create table t1 (a int); +insert into t1 values (1); +do @a:=(SELECT a from t1); select @a; @a 1 -drop table t; -do (SELECT a from t); -Table 'test.t' doesn't exist +drop table t1; +do (SELECT a from t1); +Table 'test.t1' doesn't exist diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result index 7c8d10cf0a6..5568e5b25d8 100644 --- a/mysql-test/r/temp_table.result +++ b/mysql-test/r/temp_table.result @@ -48,7 +48,6 @@ c d e 3 b 2 drop table t1; drop table t1; -drop table if exists t1; CREATE TABLE t1 (pkCrash INTEGER PRIMARY KEY,strCrash VARCHAR(255)); INSERT INTO t1 ( pkCrash, strCrash ) VALUES ( 1, '1'); SELECT CONCAT_WS(pkCrash, strCrash) FROM t1; @@ -77,7 +76,6 @@ insert into t1 values (1),(1); alter table t1 add primary key (a); Duplicate entry '1' for key 1 drop table t1; -drop table if exists t1; CREATE TABLE t1 ( d datetime default NULL ) TYPE=MyISAM; diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 214328eab47..cf6533eef67 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -1,3 +1,4 @@ +drop table if exists t1,t2; create table t1 (a char(16), b date, c datetime); insert into t1 SET a='test 2000-01-01', b='2000-01-01', c='2000-01-01'; select * from t1 where c = '2000-01-01'; @@ -7,7 +8,6 @@ select * from t1 where b = '2000-01-01'; a b c test 2000-01-01 2000-01-01 2000-01-01 00:00:00 drop table t1; -drop table if exists t1,t2; CREATE TABLE t1 (name char(6),cdate date); INSERT INTO t1 VALUES ('name1','1998-01-01'); INSERT INTO t1 VALUES ('name2','1998-01-01'); diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index c6eca3abe8b..8fe91ac88d8 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -1,3 +1,4 @@ +drop table if exists t1; SELECT 10,10.0,10.,.1e+2,100.0e-1; 10 10.0 10. .1e+2 100.0e-1 10 10.0 10 10 10 @@ -7,7 +8,6 @@ SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000; SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1; 1e1 1.e1 1.0e1 1e+1 1.e+1 1.0e+1 1e-1 1.e-1 1.0e-1 10 10 10 10 10 10 0.1 0.1 0.1 -drop table if exists t1; create table t1 (f1 float(24),f2 float(52)); show full columns from t1; Field Type Null Key Default Extra Privileges Comment diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 3930e5e25c1..94f304c77b1 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -170,7 +170,6 @@ testtt tsestset 1 drop table t1; -drop table if exists t1,t2; create table t1 (a int); create table t2 (a int); insert into t1 values (1),(2),(3),(4),(5); diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result index 60c975b540e..159b971440b 100644 --- a/mysql-test/r/update.result +++ b/mysql-test/r/update.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; create table t1 (a int auto_increment , primary key (a)); insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); update t1 set a=a+10 where a > 34; diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 1b0b359c533..6e3b9309351 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -1,10 +1,10 @@ +drop table if exists t1,t2; set @a := foo; Unknown column 'foo' in 'field list' set @a := connection_id() + 3; select @a - connection_id(); @a - connection_id() 3 -drop table if exists t1,t2; CREATE TABLE t1 ( i int not null, v int not null,index (i)); insert into t1 values (1,1),(1,3),(2,1); create table t2 (i int not null, unique (i)); diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result index 7ce0f78da76..2d04da31caa 100644 --- a/mysql-test/r/varbinary.result +++ b/mysql-test/r/varbinary.result @@ -1,3 +1,4 @@ +drop table if exists t1; select 0x41,0x41+0,0x41 | 0x7fffffffffffffff | 0,0xffffffffffffffff | 0 ; 0x41 0x41+0 0x41 | 0x7fffffffffffffff | 0 0xffffffffffffffff | 0 A 65 9223372036854775807 18446744073709551615 @@ -7,7 +8,6 @@ select 0x31+1,concat(0x31)+1,-0xf; select x'31',X'ffff'+0; x'31' X'ffff'+0 1 65535 -drop table if exists t1; create table t1 (ID int(8) unsigned zerofill not null auto_increment,UNIQ bigint(21) unsigned zerofill not null,primary key (ID),unique (UNIQ) ); insert into t1 set UNIQ=0x38afba1d73e6a18a; insert into t1 set UNIQ=123; diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index ed477a8519b..b66d75e2b3a 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; set @`test`=1,@TEST=3,@select=2,@t5=1.23456; select @test,@`select`,@TEST,@not_used; @test @`select` @TEST @not_used @@ -315,7 +315,6 @@ set tmp_table_size=100; set tx_isolation="READ-COMMITTED"; set wait_timeout=100; set log_warnings=1; -DROP TABLE IF EXISTS t1,t2; create table t1 (a int not null auto_increment, primary key(a)); create table t2 (a int not null auto_increment, primary key(a)); insert into t1 values(null),(null),(null); diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index e5713718db0..06be16aad48 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -1,4 +1,6 @@ drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' create table t1 (a int); insert into t1 values (1); insert into t1 values ("hej"); @@ -8,3 +10,6 @@ insert into t1 values ("hej"); insert into t1 values ("hej"),("då"); drop table t1; set SQL_WARNINGS=0; +drop temporary table if exists not_exists; +Warnings: +Note 1051 Unknown table 'not_exists' diff --git a/mysql-test/t/alias.test b/mysql-test/t/alias.test index 5c6813d93aa..64dd481d37d 100644 --- a/mysql-test/t/alias.test +++ b/mysql-test/t/alias.test @@ -1,4 +1,7 @@ +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings + CREATE TABLE t1 ( cont_nr int(11) NOT NULL auto_increment, ver_nr int(11) NOT NULL default '0', diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 1c3987e2a31..64b657f1146 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -1,8 +1,10 @@ # # Test of alter table # - +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 ( col1 int not null auto_increment primary key, col2 varchar(30) not null, diff --git a/mysql-test/t/analyse.test b/mysql-test/t/analyse.test index 68b038c089f..ccbfb56a801 100644 --- a/mysql-test/t/analyse.test +++ b/mysql-test/t/analyse.test @@ -2,7 +2,9 @@ # Test of procedure analyse # +--disable_warnings drop table if exists t1,t2; +--enable_warnings create table t1 (i int, j int); insert into t1 values (1,2), (3,4), (5,6), (7,8); select * from t1 procedure analyse(); @@ -10,4 +12,4 @@ create table t2 select * from t1 procedure analyse(); select * from t2; drop table t1,t2; -EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(); \ No newline at end of file +EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(); diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test index d86466572d8..30979202bd7 100644 --- a/mysql-test/t/auto_increment.test +++ b/mysql-test/t/auto_increment.test @@ -1,8 +1,10 @@ # # Test of auto_increment; The test for BDB tables is in bdb.test # - +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int not null auto_increment,b int, primary key (a)) type=myisam auto_increment=3; insert into t1 values (1,1),(NULL,3),(NULL,4); delete from t1 where a=4; diff --git a/mysql-test/t/backup.test b/mysql-test/t/backup.test index ad332cde646..8939d281eda 100644 --- a/mysql-test/t/backup.test +++ b/mysql-test/t/backup.test @@ -2,7 +2,9 @@ connect (con1,localhost,root,,); connect (con2,localhost,root,,); connection con1; set SQL_LOG_BIN=0; -drop table if exists t1; +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings create table t1(n int); --replace_result "errno = 2" "errno = X" "errno = 22" "errno = X" "errno = 23" "errno = X" backup table t1 to '../bogus'; diff --git a/mysql-test/t/bdb-alter-table-1.test b/mysql-test/t/bdb-alter-table-1.test index 5861c2fe0bf..7537cc358e8 100644 --- a/mysql-test/t/bdb-alter-table-1.test +++ b/mysql-test/t/bdb-alter-table-1.test @@ -2,7 +2,10 @@ # Test of problem when shutting down mysqld at once after ALTER TABLE # -- source include/have_bdb.inc +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) type=BDB; insert into t1 values(1, 't1',4,9); insert into t1 values(2, 'metatable',1,9); diff --git a/mysql-test/t/bdb-crash.test b/mysql-test/t/bdb-crash.test index 0005b631a46..956645b1188 100644 --- a/mysql-test/t/bdb-crash.test +++ b/mysql-test/t/bdb-crash.test @@ -2,7 +2,9 @@ # test for bug reported by Mark Steele +--disable_warnings drop table if exists t1; +--enable_warnings CREATE TABLE t1 ( ChargeID int(10) unsigned DEFAULT '0' NOT NULL auto_increment, ServiceID int(10) unsigned DEFAULT '0' NOT NULL, diff --git a/mysql-test/t/bdb-deadlock.test b/mysql-test/t/bdb-deadlock.test index 5ecfe592ce4..2453c42e49a 100644 --- a/mysql-test/t/bdb-deadlock.test +++ b/mysql-test/t/bdb-deadlock.test @@ -11,7 +11,9 @@ connect (con1,localhost,root,,); connect (con2,localhost,root,,); +--disable_warnings drop table if exists t1,t2; +--enable_warnings connection con1; create table t1 (id integer, x integer) type=BDB; create table t2 (id integer, x integer) type=BDB; diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test index 608d4bf5042..27755e51b7f 100644 --- a/mysql-test/t/bdb.test +++ b/mysql-test/t/bdb.test @@ -4,7 +4,9 @@ # Small basic test with ignore # +--disable_warnings drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; +--enable_warnings create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=bdb; insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); @@ -441,7 +443,6 @@ drop table t1; # This gave a wrong result because the row information was freed too early # -drop table if exists t1, t2, t3, t4, t5, t6, t7; create table t1 ( branch_id int auto_increment primary key, @@ -451,7 +452,6 @@ create table t1 unique branch_name(branch_name), index branch_active(branch_active) ) type=bdb; -drop table if exists t2 ; create table t2 ( target_id int auto_increment primary key, @@ -461,7 +461,6 @@ create table t2 unique target_name(target_name), index target_active(target_active) ) type=bdb; -drop table if exists t3 ; create table t3 ( platform_id int auto_increment primary key, @@ -471,7 +470,6 @@ create table t3 unique platform_name(platform_name), index platform_active(platform_active) ) type=bdb; -drop table if exists t4 ; create table t4 ( product_id int auto_increment primary key, @@ -482,7 +480,6 @@ create table t4 unique product_name(product_name), index product_active(product_active) ) type=bdb; -drop table if exists t5 ; create table t5 ( product_file_id int auto_increment primary key, @@ -496,7 +493,6 @@ create table t5 unique product_file(product_id,file_name), index file_included(file_included) ) type=bdb; -drop table if exists t6 ; create table t6 ( file_platform_id int auto_increment primary key, @@ -510,7 +506,6 @@ create table t6 unique file_platform(product_file_id,platform_id,branch_id) ) type=bdb; -drop table if exists t8 ; create table t8 ( archive_id int auto_increment primary key, @@ -523,7 +518,6 @@ create table t8 unique archive(branch_id,target_id,platform_id,product_id), index status_id(status_id) ) type=bdb; -drop table if exists t7 ; create table t7 ( build_id int auto_increment primary key, @@ -727,7 +721,6 @@ DROP TABLE t1,t2; # Test problem with joining table to itself on a multi-part unique key # -drop table if exists t1; create table t1 (a int(11) not null, b int(11) not null, unique (a,b)) type=bdb; insert into t1 values (1,1), (1,2); select * from t1 where a = 1; diff --git a/mysql-test/t/bdb_cache.test b/mysql-test/t/bdb_cache.test index b1343c5e83e..0d7de75ccf6 100644 --- a/mysql-test/t/bdb_cache.test +++ b/mysql-test/t/bdb_cache.test @@ -4,7 +4,9 @@ # # Without auto_commit. # +--disable_warnings drop table if exists t1, t2, t3; +--enable_warnings flush status; set autocommit=0; create table t1 (a int not null) type=bdb; diff --git a/mysql-test/t/bench_count_distinct.test b/mysql-test/t/bench_count_distinct.test index 9059428bea4..c1adeab2c44 100644 --- a/mysql-test/t/bench_count_distinct.test +++ b/mysql-test/t/bench_count_distinct.test @@ -1,4 +1,10 @@ +# +# Test of count(distinct ..) +# + +--disable_warnings drop table if exists t1; +--enable_warnings create table t1(n int not null, key(n)) delay_key_write = 1; let $1=100; disable_query_log; diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test index 15c61c2c0dc..3dde4b8a2c1 100644 --- a/mysql-test/t/bigint.test +++ b/mysql-test/t/bigint.test @@ -1,3 +1,10 @@ +# +# Initialize + +--disable_warnings +drop table if exists t1; +--enable_warnings + # # Test of reading of bigint values # @@ -11,7 +18,6 @@ select +9999999999999999999,-9999999999999999999; # This will work on 4.0 as we then have internal handling of bigint variables. # -drop table if exists t1; create table t1 (a bigint unsigned not null, primary key(a)); insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE); select * from t1; diff --git a/mysql-test/t/binary.test b/mysql-test/t/binary.test index fc2d91e20fe..0a5dd71f98e 100644 --- a/mysql-test/t/binary.test +++ b/mysql-test/t/binary.test @@ -1,8 +1,10 @@ # # test sort,min and max on binary fields # - +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (name char(20) not null, primary key (name)); create table t2 (name char(20) binary not null, primary key (name)); insert into t1 values ("å"); diff --git a/mysql-test/t/bool.test b/mysql-test/t/bool.test index 10f97fefb73..c001973baeb 100644 --- a/mysql-test/t/bool.test +++ b/mysql-test/t/bool.test @@ -2,7 +2,9 @@ # Test of boolean operations with NULL # +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings SELECT IF(NULL AND 1, 1, 2), IF(1 AND NULL, 1, 2); SELECT NULL AND 1, 1 AND NULL, 0 AND NULL, NULL and 0; @@ -33,19 +35,17 @@ DROP TABLE t1; # Read nA as !A, AB as A && B, AoB as A || B # Result table makes ANSI happy -drop table if exists t; -create table t(a int, b int); -insert into t values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1); +create table t1 (a int, b int); +insert into t1 values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1); # Below test is valid untill we have True/False implemented as 1/0 # To comply to all rules it must show that: n(AB) = nAonB, n(AoB) = nAnB -select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t; +select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t1; # This should work with any internal representation of True/False # Result must be same as above -select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t; +select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t1; - -drop table t; +drop table t1; diff --git a/mysql-test/t/bulk_replace.test b/mysql-test/t/bulk_replace.test index d366004c16f..755d34083f8 100644 --- a/mysql-test/t/bulk_replace.test +++ b/mysql-test/t/bulk_replace.test @@ -1,11 +1,10 @@ # # this is a test of bulk-insert code -# as used by REPLACE -# -# by Monty # +--disable_warnings drop table if exists t1; +--enable_warnings CREATE TABLE t1 (a int, unique (a), b int not null, unique(b), c int not null, index(c)); replace into t1 values (1,1,1),(2,2,2),(3,1,3); select * from t1; diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test index 3ba3a292c77..6131d1500de 100644 --- a/mysql-test/t/case.test +++ b/mysql-test/t/case.test @@ -2,7 +2,9 @@ # Testing of CASE # +--disable_warnings drop table if exists t1; +--enable_warnings select CASE "b" when "a" then 1 when "b" then 2 END; select CASE "c" when "a" then 1 when "b" then 2 END; diff --git a/mysql-test/t/check.test b/mysql-test/t/check.test index 947566e725b..bc61aea2d66 100644 --- a/mysql-test/t/check.test +++ b/mysql-test/t/check.test @@ -1,8 +1,11 @@ connect (con1,localhost,root,,); connect (con2,localhost,root,,); connection con1; +--disable_warnings drop table if exists t1; -#add a lot of keys to slow down check +--enable_warnings + +# Add a lot of keys to slow down check create table t1(n int not null, key(n), key(n), key(n), key(n)); let $1=10000; disable_query_log; diff --git a/mysql-test/t/compare.test b/mysql-test/t/compare.test index 450d9c0961c..e5a2e310866 100644 --- a/mysql-test/t/compare.test +++ b/mysql-test/t/compare.test @@ -2,7 +2,10 @@ # Bug when using comparions of strings and integers. # +--disable_warnings drop table if exists t1; +--enable_warnings + CREATE TABLE t1 (id CHAR(12) not null, PRIMARY KEY (id)); insert into t1 values ('000000000001'),('000000000002'); explain select * from t1 where id=000000000001; diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test index 192d3eaf3e0..7b441ee5f7b 100644 --- a/mysql-test/t/connect.test +++ b/mysql-test/t/connect.test @@ -41,7 +41,6 @@ show tables; #--error 1045 - # check if old password version also works update mysql.user set password=old_password("gambling2") where user="test"; flush privileges; diff --git a/mysql-test/t/constraints.test b/mysql-test/t/constraints.test index 8682cdc42a2..cc796e0abd2 100644 --- a/mysql-test/t/constraints.test +++ b/mysql-test/t/constraints.test @@ -2,7 +2,9 @@ # Testing of constraints # Currently MySQL only ignores the syntax. # +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (a int check (a>0)); insert into t1 values (1); diff --git a/mysql-test/t/count_distinct.test b/mysql-test/t/count_distinct.test index 3d795d44821..c7740e73ee8 100644 --- a/mysql-test/t/count_distinct.test +++ b/mysql-test/t/count_distinct.test @@ -2,7 +2,10 @@ # Problem with count(distinct) # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings + create table t1 (libname varchar(21) not null, city text, primary key (libname)); create table t2 (isbn varchar(21) not null, author text, title text, primary key (isbn)); create table t3 (isbn varchar(21) not null, libname varchar(21) not null, quantity int ,primary key (isbn,libname)); diff --git a/mysql-test/t/count_distinct2.test b/mysql-test/t/count_distinct2.test index d1bea7614c8..9100f622dec 100644 --- a/mysql-test/t/count_distinct2.test +++ b/mysql-test/t/count_distinct2.test @@ -1,4 +1,6 @@ +--disable_warnings drop table if exists t1; +--enable_warnings create table t1(n1 int, n2 int, s char(20), vs varchar(20), t text); insert into t1 values (1,11, 'one','eleven', 'eleven'), diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index e057ffaebb0..0a3bd4e97a1 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -2,7 +2,10 @@ # Check some special create statements. # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (b char(0)); insert into t1 values (""),(null); select * from t1; @@ -12,7 +15,7 @@ create table t1 (b char(0) not null); create table if not exists t1 (b char(0) not null); insert into t1 values (""),(null); select * from t1; -drop table if exists t1; +drop table t1; # # Test of some CREATE TABLE'S that should fail @@ -91,11 +94,14 @@ create table t2 (a int) select * from t1; describe t1; describe t2; drop table if exists t2; -!$1060 create table t2 (a int, a float) select * from t1; +--error 1060 +create table t2 (a int, a float) select * from t1; drop table if exists t2; -!$1060 create table t2 (a int) select a as b, a+1 as b from t1; +--error 1060 +create table t2 (a int) select a as b, a+1 as b from t1; drop table if exists t2; -!$1060 create table t2 (b int) select a as b, a+1 as b from t1; +--error 1060 +create table t2 (b int) select a as b, a+1 as b from t1; drop table if exists t1,t2; # @@ -118,7 +124,6 @@ drop table if exists t1,t2; # Test for CREATE TABLE .. LIKE .. # -drop table if exists t1, t2, t3; create table t1(id int not null, name char(20)); insert into t1 values(10,'mysql'),(20,'monty- the creator'); create table t2(id int not null); diff --git a/mysql-test/t/ctype_latin1_de.test b/mysql-test/t/ctype_latin1_de.test index e829005a229..a4b4b816ec4 100644 --- a/mysql-test/t/ctype_latin1_de.test +++ b/mysql-test/t/ctype_latin1_de.test @@ -1,7 +1,9 @@ # # Test latin_de character set # +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (a char (20) not null, b int not null auto_increment, index (a,b),index(b)); insert into t1 (a) values ('ä'),('ac'),('ae'),('ad'),('Äc'),('aeb'); insert into t1 (a) values ('üc'),('uc'),('ue'),('ud'),('Ü'),('ueb'),('uf'); diff --git a/mysql-test/t/ctype_many.test b/mysql-test/t/ctype_many.test index b02684b2fb8..854d8afd852 100644 --- a/mysql-test/t/ctype_many.test +++ b/mysql-test/t/ctype_many.test @@ -1,4 +1,6 @@ +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings CREATE TABLE t1 ( comment CHAR(32) ASCII NOT NULL, diff --git a/mysql-test/t/delayed.test b/mysql-test/t/delayed.test index 67111ea1734..4cf26b330c6 100644 --- a/mysql-test/t/delayed.test +++ b/mysql-test/t/delayed.test @@ -3,7 +3,9 @@ # (Can't be tested with purify :( ) # +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (a char(10), tmsp timestamp); insert into t1 set a = 1; insert delayed into t1 set a = 2; diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test index 704fb7ada1c..57321739bfb 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -2,7 +2,9 @@ # Check for problems with delete # +--disable_warnings drop table if exists t1; +--enable_warnings CREATE TABLE t1 (a tinyint(3), b tinyint(5)); INSERT INTO t1 VALUES (1,1); INSERT LOW_PRIORITY INTO t1 VALUES (1,2); @@ -36,7 +38,6 @@ insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(2 delete from t1 where a=27; drop table t1; -drop table if exists t; CREATE TABLE `t` ( `i` int(10) NOT NULL default '0', `i2` int(10) NOT NULL default '0', @@ -44,4 +45,4 @@ CREATE TABLE `t` ( ) TYPE=MyISAM CHARSET=latin1; -- error 1054 DELETE FROM t USING t WHERE post='1'; -drop table if exists t; \ No newline at end of file +drop table if exists t; diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index 8767f9209b3..6d1d825a523 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -1,9 +1,13 @@ +# Initialize +--disable_warnings +drop table if exists t1,t2,t3; +--enable_warnings + select * from (select 2 from DUAL) b; -- error 1054 SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; -- error 1054 SELECT 1 as a FROM (SELECT a UNION SELECT 1) b; -drop table if exists t1,t2,t3; CREATE TABLE t1 (a int not null, b char (10) not null); insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c'); CREATE TABLE t2 (a int not null, b char (10) not null); @@ -25,7 +29,7 @@ SELECT 1 FROM (SELECT 1) a WHERE a=2; SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) as a; select * from t1 as x1, (select * from t1) as x2; explain select * from t1 as x1, (select * from t1) as x2; -drop table if exists t1.t2,t3; +drop table if exists t2,t3; select * from (select 1) as a; select a from (select 1 as a) as b; select 1 from (select 1) as a; @@ -45,7 +49,7 @@ while ($1) enable_query_log; SELECT * FROM (SELECT * FROM t1) as b ORDER BY a ASC LIMIT 0,20; explain select count(*) from t1 as tt1, (select * from t1) as tt2; -drop table if exists t1; +drop table t1; SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b; select * from (select 1 as a) b left join (select 2 as a) c using(a); --error 1054 diff --git a/mysql-test/t/dirty_close.test b/mysql-test/t/dirty_close.test index 3ed22f26d5b..f965df8cfea 100644 --- a/mysql-test/t/dirty_close.test +++ b/mysql-test/t/dirty_close.test @@ -3,7 +3,11 @@ connect (con2,localhost,root,,); connection con1; dirty_close con1; connection con2; + +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (n int); insert into t1 values (1),(2),(3); select * from t1; diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test index 7f75b6b1687..859c4042b1d 100644 --- a/mysql-test/t/distinct.test +++ b/mysql-test/t/distinct.test @@ -3,7 +3,9 @@ # Bug with group by and not used fields # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings CREATE TABLE t1 (id int,facility char(20)); CREATE TABLE t2 (facility char(20)); @@ -198,7 +200,6 @@ drop table t1,t2,t3; # This also test the case when one doesn't use all fields in GROUP BY. # -drop table if exists t1; create table t1 (a int not null, b int not null, t time); insert into t1 values (1,1,"00:06:15"),(1,2,"00:06:15"),(1,2,"00:30:15"),(1,3,"00:06:15"),(1,3,"00:30:15"); select a,sec_to_time(sum(time_to_sec(t))) from t1 group by a,b; @@ -261,7 +262,7 @@ INSERT INTO t1 VALUES (128,0,33,33,8,':D','',996121863,1,0,2,996122850,2,0,0); CREATE TABLE t2 (userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) TYPE=MyISAM; INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http://www.stileproject.com','','','','',1,1,0,'Administrator',0,996120694,1,-1,1030996168,1031027028,1030599436,36,'-6',0,'','','',1,0,1,0,0,15,'0000-00-00',-1,1,'64.0.0.0',0,1,-1,0,0,4,19,1); SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid); -DROP TABLE IF EXISTS t1,t2; +DROP TABLE t1,t2; # # test with const_item in ORDER BY @@ -272,5 +273,4 @@ INSERT t1 VALUES (1,2,3); CREATE TABLE t2 (a int primary key, b int, c int); INSERT t2 VALUES (3,4,5); SELECT DISTINCT t1.a, t2.b FROM t1, t2 WHERE t1.a=1 ORDER BY t2.c; -DROP TABLE IF EXISTS t1,t2; - +DROP TABLE t1,t2; diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test index c92f2b1f3b9..307dd45654d 100644 --- a/mysql-test/t/drop.test +++ b/mysql-test/t/drop.test @@ -1,5 +1,8 @@ +# Initialise +--disable_warnings drop table if exists t1; -drop table if exists t1; +--enable_warnings + --error 1051; drop table t1; create table t1(n int); diff --git a/mysql-test/t/empty_table.test b/mysql-test/t/empty_table.test index 9ea79ee157f..db0a8e6a247 100644 --- a/mysql-test/t/empty_table.test +++ b/mysql-test/t/empty_table.test @@ -2,7 +2,10 @@ # Some special cases with empty tables # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr)); select count(*) from t1; select * from t1; diff --git a/mysql-test/t/err000001.test b/mysql-test/t/err000001.test index d9898054a83..b558c90b0c6 100644 --- a/mysql-test/t/err000001.test +++ b/mysql-test/t/err000001.test @@ -2,18 +2,30 @@ # Test some error conditions # +--disable_warnings drop table if exists t1; -!$1146 insert into t1 values(1); -!$1146 delete from t1; -!$1146 update t1 set a=1; +--enable_warnings +--error 1146 +insert into t1 values(1); +--error 1146 +delete from t1; +--error 1146 +update t1 set a=1; create table t1 (a int); -!$1054 select count(test.t1.b) from t1; -!$1109 select count(not_existing_database.t1) from t1; -!$1109 select count(not_existing_database.t1.a) from t1; +--error 1054 +select count(test.t1.b) from t1; +--error 1109 +select count(not_existing_database.t1) from t1; +--error 1109 +select count(not_existing_database.t1.a) from t1; --error 1044,1146 select count(not_existing_database.t1.a) from not_existing_database.t1; -!$1054 select 1 from t1 order by 2; -!$1054 select 1 from t1 group by 2; -!$1054 select 1 from t1 order by t1.b; -!$1054 select count(*),b from t1; +--error 1054 +select 1 from t1 order by 2; +--error 1054 +select 1 from t1 group by 2; +--error 1054 +select 1 from t1 order by t1.b; +--error 1054 +select count(*),b from t1; drop table t1; diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test index 31a01ae1360..3e33d58215e 100644 --- a/mysql-test/t/explain.test +++ b/mysql-test/t/explain.test @@ -1,7 +1,9 @@ # # Test of different EXPLAIN's +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (id int not null, str char(10), unique(str)); insert into t1 values (1, null),(2, null),(3, "foo"),(4, "bar"); select * from t1 where str is null; diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test index 540aa4235cc..44a821b63c2 100644 --- a/mysql-test/t/flush.test +++ b/mysql-test/t/flush.test @@ -9,9 +9,13 @@ connect (con1,localhost,root,,); connect (con2,localhost,root,,); connection con1; -drop table if exists t1; + +--disable_warnings +drop table if exists t1,t2; +drop database if exists mysqltest; +--enable_warnings + create temporary table t1(n int not null primary key); -drop table if exists t2; create table t2(n int); insert into t2 values(3); let $1=100; @@ -44,7 +48,6 @@ reap; #test if drop database will wait until we release the global read lock connection con1; -drop database if exists mysqltest; create database mysqltest; create table mysqltest.t1(n int); insert into mysqltest.t1 values (23); diff --git a/mysql-test/t/foreign_key.test b/mysql-test/t/foreign_key.test index 1afcb546f6a..8c35fd65f74 100644 --- a/mysql-test/t/foreign_key.test +++ b/mysql-test/t/foreign_key.test @@ -2,7 +2,10 @@ # Test syntax of foreign keys # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 ( a int not null references t2, b int not null references t2 (c), diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index 5a64f2614aa..02c407abd6c 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -2,7 +2,9 @@ # Test of fulltext index # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)); INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'), @@ -166,7 +168,6 @@ drop table t1; # ERROR 1030: Got error 127 from table handler # -drop table if exists t1; create table t1 (a text, fulltext key (a)); insert into t1 values ('aaaa'); repair table t1; diff --git a/mysql-test/t/fulltext_cache.test b/mysql-test/t/fulltext_cache.test index 0b15e57a97b..15f32fdb5a0 100644 --- a/mysql-test/t/fulltext_cache.test +++ b/mysql-test/t/fulltext_cache.test @@ -2,7 +2,10 @@ # Bugreport due to Roy Nasser # +--disable_warnings drop table if exists t1, t2; +--enable_warnings + CREATE TABLE t1 ( id int(10) unsigned NOT NULL auto_increment, q varchar(255) default NULL, diff --git a/mysql-test/t/fulltext_distinct.test b/mysql-test/t/fulltext_distinct.test index 86e2f7ca1b4..2ccfb94c819 100644 --- a/mysql-test/t/fulltext_distinct.test +++ b/mysql-test/t/fulltext_distinct.test @@ -3,7 +3,10 @@ # bug reported by Tibor Simko # +--disable_warnings DROP TABLE IF EXISTS t1, t2; +--enable_warnings + CREATE TABLE t1 ( id mediumint unsigned NOT NULL auto_increment, tag char(6) NOT NULL default '', diff --git a/mysql-test/t/fulltext_left_join.test b/mysql-test/t/fulltext_left_join.test index bcf7cbcc505..4fce8ee287e 100644 --- a/mysql-test/t/fulltext_left_join.test +++ b/mysql-test/t/fulltext_left_join.test @@ -2,7 +2,10 @@ # Test for bug from Jean-Cédric COSTA # +--disable_warnings drop table if exists t1, t2; +--enable_warnings + CREATE TABLE t1 ( id VARCHAR(255) NOT NULL PRIMARY KEY, sujet VARCHAR(255), diff --git a/mysql-test/t/fulltext_multi.test b/mysql-test/t/fulltext_multi.test index 233c243146e..c312a5938b2 100644 --- a/mysql-test/t/fulltext_multi.test +++ b/mysql-test/t/fulltext_multi.test @@ -1,6 +1,8 @@ # several FULLTEXT indexes in one table test -use test; +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings + CREATE TABLE t1 ( a int(11) NOT NULL auto_increment, b text, diff --git a/mysql-test/t/fulltext_order_by.test b/mysql-test/t/fulltext_order_by.test index 3b60ee77db2..f8afe49d95d 100644 --- a/mysql-test/t/fulltext_order_by.test +++ b/mysql-test/t/fulltext_order_by.test @@ -1,5 +1,7 @@ -use test; +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings + CREATE TABLE t1 ( a INT AUTO_INCREMENT PRIMARY KEY, message CHAR(20), diff --git a/mysql-test/t/fulltext_update.test b/mysql-test/t/fulltext_update.test index 9e2ce3ccba5..a1d133ba3fe 100644 --- a/mysql-test/t/fulltext_update.test +++ b/mysql-test/t/fulltext_update.test @@ -2,7 +2,9 @@ # Test for bug by voi@ims.at # +--disable_warnings drop table if exists test; +--enable_warnings CREATE TABLE test ( gnr INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, url VARCHAR(80) DEFAULT '' NOT NULL, diff --git a/mysql-test/t/func_concat.test b/mysql-test/t/func_concat.test index d6da1d6a603..147367a6d27 100644 --- a/mysql-test/t/func_concat.test +++ b/mysql-test/t/func_concat.test @@ -2,7 +2,10 @@ # Test of problem with CONCAT_WS() and long separators. # +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings + CREATE TABLE t1 ( number INT NOT NULL, alpha CHAR(6) NOT NULL ); INSERT INTO t1 VALUES (1413006,'idlfmv'), (1413065,'smpsfz'),(1413127,'sljrhx'),(1413304,'qerfnd'); diff --git a/mysql-test/t/func_date_add.test b/mysql-test/t/func_date_add.test index c0250c6ece4..35acfe84bee 100644 --- a/mysql-test/t/func_date_add.test +++ b/mysql-test/t/func_date_add.test @@ -2,7 +2,10 @@ # Test of DATE_ADD # +--disable_warnings drop table if exists t1; +--enable_warnings + CREATE TABLE t1 ( visitor_id int(10) unsigned DEFAULT '0' NOT NULL, group_id int(10) unsigned DEFAULT '0' NOT NULL, diff --git a/mysql-test/t/func_encrypt.test b/mysql-test/t/func_encrypt.test index 3b6acc54ec9..fbb71f850e2 100644 --- a/mysql-test/t/func_encrypt.test +++ b/mysql-test/t/func_encrypt.test @@ -1,6 +1,9 @@ -- source include/have_openssl.inc +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (x blob); insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','The quick red fox jumped over the lazy brown dog')); insert into t1 values (des_encrypt('a','The quick red fox jumped over the lazy brown dog')); diff --git a/mysql-test/t/func_equal.test b/mysql-test/t/func_equal.test index 0d7a4ed9778..cbf589ffcc2 100644 --- a/mysql-test/t/func_equal.test +++ b/mysql-test/t/func_equal.test @@ -1,3 +1,8 @@ +# Initialise +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + # # Testing of the <=> operator # @@ -15,7 +20,6 @@ select "A"<=>"B","A"<=>NULL,NULL<=>"A"; # Test with tables # -drop table if exists t1,t2; create table t1 (id int, value int); create table t2 (id int, value int); diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 8a9a5655e1b..b6511779f51 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -2,7 +2,10 @@ # simple test of all group functions # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (grp int, a bigint unsigned, c char(10) not null); insert into t1 values (1,1,"a"); insert into t1 values (2,2,"b"); diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test index 85553d1a2fd..21e5836c781 100644 --- a/mysql-test/t/func_if.test +++ b/mysql-test/t/func_if.test @@ -1,7 +1,9 @@ # # Init section # +--disable_warnings drop table if exists t1; +--enable_warnings # # Simple IF tests diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index 7bbc560276f..723f1707a42 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -1,3 +1,7 @@ +# Initialise +--disable_warnings +drop table if exists t1; +--enable_warnings # # test of IN (NULL) # @@ -14,7 +18,7 @@ select NULL in (1.5,2.5,3.5); select 1.5 in (1.5,NULL,3.5); select 3.5 in (1.5,NULL,3.5); select 10.5 in (1.5,NULL,3.5); -drop table if exists t1; + CREATE TABLE t1 (a int, b int, c int); insert into t1 values (1,2,3), (1,NULL,3); select 1 in (a,b,c) from t1; diff --git a/mysql-test/t/func_isnull.test b/mysql-test/t/func_isnull.test index bd3bcd8d04c..506efada0eb 100644 --- a/mysql-test/t/func_isnull.test +++ b/mysql-test/t/func_isnull.test @@ -2,7 +2,10 @@ # test of ISNULL() # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (id int auto_increment primary key not null, mydate date not null); insert into t1 values (0,"2002-05-01"),(0,"2002-05-01"),(0,"2002-05-01"); flush tables; diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test index 09746fcc817..47590ae7559 100644 --- a/mysql-test/t/func_like.test +++ b/mysql-test/t/func_like.test @@ -2,7 +2,10 @@ # Test of like # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a varchar(10), key(a)); insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); select * from t1 where a like "abc%"; diff --git a/mysql-test/t/func_regexp.test b/mysql-test/t/func_regexp.test index 7fbe4000cfc..6e5d601844e 100644 --- a/mysql-test/t/func_regexp.test +++ b/mysql-test/t/func_regexp.test @@ -2,7 +2,10 @@ # Some regexp tests # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (s1 char(64),s2 char(64)); insert into t1 values('aaa','aaa'); diff --git a/mysql-test/t/func_set.test b/mysql-test/t/func_set.test index cb1aa543d43..60d67a77562 100644 --- a/mysql-test/t/func_set.test +++ b/mysql-test/t/func_set.test @@ -15,3 +15,21 @@ select export_set(9,"Y","N","-",5),export_set(9,"Y","N"),export_set(9,"Y","N","" select elt(2,1),field(NULL,"a","b","c"); select find_in_set("","a,b,c"),find_in_set("","a,b,c,"),find_in_set("",",a,b,c"); select find_in_set("abc","abc"),find_in_set("ab","abc"),find_in_set("abcd","abc"); + +# +# test for a bug with elt() +# + +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + +create table t1 (id int(10) not null unique); +create table t2 (id int(10) not null primary key, +val int(10) not null); +insert into t1 values (1),(2),(4); +insert into t2 values (1,1),(2,1),(3,1),(4,2); + +select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id; +select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id; +drop table t1,t2; diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index 97b771e7363..7e94f47f1e3 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -4,7 +4,9 @@ # ----------- # Testing string functions +--disable_warnings drop table if exists t1; +--enable_warnings select 'hello',"'hello'",'""hello""','''h''e''l''l''o''',"hel""lo",'hel\'lo'; select 'hello' 'monty'; diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 2e913bdf943..903b80eb12a 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -1,7 +1,9 @@ # # time functions # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings select from_days(to_days("960101")),to_days(960201)-to_days("19960101"),to_days(date_add(curdate(), interval 1 day))-to_days(curdate()),weekday("1997-11-29"); select period_add("9602",-12),period_diff(199505,"9404") ; diff --git a/mysql-test/t/func_timestamp.test b/mysql-test/t/func_timestamp.test index 74e541f782d..8583c16073d 100644 --- a/mysql-test/t/func_timestamp.test +++ b/mysql-test/t/func_timestamp.test @@ -2,7 +2,10 @@ # Tests that depend on the timestamp and the TZ variable # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (Zeit time, Tag tinyint not null, Monat tinyint not null, Jahr smallint not null, index(Tag), index(Monat), index(Jahr) ); insert into t1 values ("09:26:00",16,9,1998),("09:26:00",16,9,1998); diff --git a/mysql-test/t/gcc296.test b/mysql-test/t/gcc296.test index 7c72b57ca54..ebca4dbc897 100644 --- a/mysql-test/t/gcc296.test +++ b/mysql-test/t/gcc296.test @@ -1,6 +1,9 @@ #try to crash gcc 2.96 -drop table if exists obory; -CREATE TABLE obory ( +--disable_warnings +drop table if exists t1; +--enable_warnings + +CREATE TABLE t1 ( kodoboru varchar(10) default NULL, obor tinytext, aobor tinytext, @@ -8,10 +11,10 @@ CREATE TABLE obory ( FULLTEXT KEY obor (obor), FULLTEXT KEY aobor (aobor) ); -INSERT INTO obory VALUES ('0101000000','aaa','AAA'); -INSERT INTO obory VALUES ('0102000000','bbb','BBB'); -INSERT INTO obory VALUES ('0103000000','ccc','CCC'); -INSERT INTO obory VALUES ('0104000000','xxx','XXX'); +INSERT INTO t1 VALUES ('0101000000','aaa','AAA'); +INSERT INTO t1 VALUES ('0102000000','bbb','BBB'); +INSERT INTO t1 VALUES ('0103000000','ccc','CCC'); +INSERT INTO t1 VALUES ('0104000000','xxx','XXX'); -select * from obory; -drop table obory; +select * from t1; +drop table t1; diff --git a/mysql-test/t/grant_cache.test b/mysql-test/t/grant_cache.test index 09ce1021fbf..84091d9b830 100644 --- a/mysql-test/t/grant_cache.test +++ b/mysql-test/t/grant_cache.test @@ -3,12 +3,17 @@ # # Test grants with query cache # +--disable_warnings drop table if exists test.t1,mysqltest.t1,mysqltest.t2; +--enable_warnings + reset query cache; flush status; connect (root,localhost,root,,test,0,master.sock); connection root; +--disable_warnings create database if not exists mysqltest; +--enable_warnings create table mysqltest.t1 (a int,b int,c int); create table mysqltest.t2 (a int,b int,c int); diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 4682463c11f..a34c3a12363 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1,10 +1,18 @@ +# Initialise +--disable_warnings +drop table if exists t1,t2,t3; +--enable_warnings + +# +# Simple test without tables + -- error 1111 SELECT 1 FROM (SELECT 1) as a GROUP BY SUM(1); + # # Test of group (Failed for Lars Hoss ) # -drop table if exists t1,t2,t3; CREATE TABLE t1 ( spID int(10) unsigned, userID int(10) unsigned, @@ -40,7 +48,7 @@ INSERT INTO t2 VALUES (3,'name','pass','mail','Y','v','n','adr','1','1','1'); SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID GROUP BY t2.userid; SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid; SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid; -drop table test.t1,test.t2; +drop table t1,t2; # # Bug in GROUP BY, by Nikki Chumakov @@ -288,7 +296,6 @@ SELECT 1 FROM t1 GROUP BY CONCAT(a, b); INSERT INTO t1 values ('hij','klm'); SELECT CONCAT(a, b),count(*) FROM t1 GROUP BY 1; DROP TABLE t1; -drop table if exists t1; # # Test problem with ORDER BY on a SUM() column diff --git a/mysql-test/t/handler.test b/mysql-test/t/handler.test index 4f1b11c80ff..2b0a6a7be8d 100644 --- a/mysql-test/t/handler.test +++ b/mysql-test/t/handler.test @@ -2,7 +2,10 @@ # test of HANDLER ... # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int, b char(10), key a(a), key b(a,b)); insert into t1 values (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test index 7f0a1225bda..4bd56400f98 100644 --- a/mysql-test/t/having.test +++ b/mysql-test/t/having.test @@ -1,7 +1,10 @@ # test of problems with having (Reported by Mark Rogers) # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (a int); select count(a) as b from t1 where a=0 having b > 0; insert into t1 values (null); diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test index f8b27d09a19..cd5dbd5afbe 100644 --- a/mysql-test/t/heap.test +++ b/mysql-test/t/heap.test @@ -2,7 +2,10 @@ # Test of heap tables. # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int not null,b int not null, primary key (a)) type=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a=1 or a=0; diff --git a/mysql-test/t/heap_auto_increment.test b/mysql-test/t/heap_auto_increment.test index 8a0d19d9183..6f392f6830d 100644 --- a/mysql-test/t/heap_auto_increment.test +++ b/mysql-test/t/heap_auto_increment.test @@ -2,7 +2,10 @@ # Test of auto_increment; The test for BDB tables is in bdb.test # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int not null auto_increment,b int, primary key (a)) type=heap auto_increment=3; insert into t1 values (1,1),(NULL,3),(NULL,4); delete from t1 where a=4; diff --git a/mysql-test/t/heap_btree.test b/mysql-test/t/heap_btree.test index 5c0002fede4..3c2ff249415 100644 --- a/mysql-test/t/heap_btree.test +++ b/mysql-test/t/heap_btree.test @@ -2,7 +2,10 @@ # Test of heap tables. # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int not null,b int not null, primary key using BTREE (a)) type=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a=1 or a=0; diff --git a/mysql-test/t/heap_hash.test b/mysql-test/t/heap_hash.test index 5dbd2b4a928..7b375fdfa3c 100644 --- a/mysql-test/t/heap_hash.test +++ b/mysql-test/t/heap_hash.test @@ -2,7 +2,10 @@ # Test of heap tables. # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int not null,b int not null, primary key using HASH (a)) type=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a=1 or a=0; diff --git a/mysql-test/t/innodb-deadlock.test b/mysql-test/t/innodb-deadlock.test index 2648d6cdf9c..ba4ec4a9ae4 100644 --- a/mysql-test/t/innodb-deadlock.test +++ b/mysql-test/t/innodb-deadlock.test @@ -2,7 +2,10 @@ connect (con1,localhost,root,,); connect (con2,localhost,root,,); -drop table if exists t1; + +--disable_warnings +drop table if exists t1,t2; +--enable_warnings # # Testing of FOR UPDATE @@ -36,7 +39,6 @@ select * from t1; commit; drop table t1; -drop table if exists t1, t2; # # Testing of FOR UPDATE # diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index eb5b0c9efd2..e875bf883c7 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -4,7 +4,10 @@ # Small basic test with ignore # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=innodb; insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); @@ -664,7 +667,6 @@ DROP TABLE t1; # # Test of multi-table-update # -drop table if exists t1,t2; create table t1 (n int(10), d int(10)) type=innodb; create table t2 (n int(10), d int(10)) type=innodb; insert into t1 values(1,1),(1,2); diff --git a/mysql-test/t/innodb_cache.test b/mysql-test/t/innodb_cache.test index 9066a5f19ba..8a08c19703d 100644 --- a/mysql-test/t/innodb_cache.test +++ b/mysql-test/t/innodb_cache.test @@ -1,10 +1,14 @@ -- source include/have_innodb.inc -- source include/have_query_cache.inc +# Initialise +--disable_warnings +drop table if exists t1,t2,t3; +--enable_warnings + # # Without auto_commit. # -drop table if exists t1, t2, t3; flush status; set autocommit=0; create table t1 (a int not null) type=innodb; diff --git a/mysql-test/t/innodb_handler.test b/mysql-test/t/innodb_handler.test index 6b85be9c7ab..49178a6b6b7 100644 --- a/mysql-test/t/innodb_handler.test +++ b/mysql-test/t/innodb_handler.test @@ -4,7 +4,10 @@ # test of HANDLER ... # -drop table if exists t1; +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + create table t1 (a int, b char(10), key a(a), key b(a,b)) type=innodb; insert into t1 values (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), diff --git a/mysql-test/t/ins000001.test b/mysql-test/t/ins000001.test index 4d75b4e7fe3..afcd27ebfca 100644 --- a/mysql-test/t/ins000001.test +++ b/mysql-test/t/ins000001.test @@ -1,5 +1,8 @@ use test; +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (email varchar(50)); insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'), ('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com'); diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test index 9b06b522028..bfa8aac7a1f 100644 --- a/mysql-test/t/insert.test +++ b/mysql-test/t/insert.test @@ -2,7 +2,10 @@ # Test of refering to old values # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int not null); insert into t1 values (1); insert into t1 values (a+2); @@ -54,9 +57,11 @@ drop table t1; # Test of mysqld crash with fully qualified column names # -drop database if exists foo; -create database foo; -use foo; +--disable_warnings +drop database if exists test_$1; +--enable_warnings +create database test_$1; +use test_$1; create table t1 (c int); -insert into foo.t1 set foo.t1.c = '1'; -drop database foo; +insert into test_$1.t1 set test_$1.t1.c = '1'; +drop database test_$1; diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test index 42f65858d77..8fcb22e4684 100644 --- a/mysql-test/t/insert_select.test +++ b/mysql-test/t/insert_select.test @@ -2,7 +2,10 @@ # Problem with INSERT ... SELECT # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLINT UNSIGNED NOT NULL); insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12); create table t2 (payoutID SMALLINT UNSIGNED NOT NULL PRIMARY KEY); @@ -12,13 +15,13 @@ insert into t2 (payoutID) SELECT payoutID+10 FROM t1; insert ignore into t2 (payoutID) SELECT payoutID+10 FROM t1; select * from t2; drop table t1,t2; + # # bug in bulk insert optimization # test case by Fournier Jocelyn # -DROP TABLE IF EXISTS crash1,crash2; -CREATE TABLE `crash1` ( +CREATE TABLE `t1` ( `numeropost` bigint(20) unsigned NOT NULL default '0', `icone` tinyint(4) unsigned NOT NULL default '0', `numreponse` bigint(20) unsigned NOT NULL auto_increment, @@ -34,7 +37,7 @@ CREATE TABLE `crash1` ( KEY `numreponse` (`numreponse`) ) TYPE=MyISAM; -CREATE TABLE `crash2` ( +CREATE TABLE `t2` ( `numeropost` bigint(20) unsigned NOT NULL default '0', `icone` tinyint(4) unsigned NOT NULL default '0', `numreponse` bigint(20) unsigned NOT NULL auto_increment, @@ -50,21 +53,21 @@ CREATE TABLE `crash2` ( KEY `numreponse` (`numreponse`) ) TYPE=MyISAM; -INSERT INTO crash2 +INSERT INTO t2 (numeropost,icone,numreponse,contenu,pseudo,date,ip,signature) VALUES (9,1,56,'test','joce','2001-07-25 13:50:53' ,3649052399,0); -INSERT INTO crash1 (numeropost,icone,contenu,pseudo,date,signature,ip) -SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM crash2 +INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip) +SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM t2 WHERE numeropost=9 ORDER BY numreponse ASC; show variables like '%bulk%'; -INSERT INTO crash1 (numeropost,icone,contenu,pseudo,date,signature,ip) -SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM crash2 +INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip) +SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM t2 WHERE numeropost=9 ORDER BY numreponse ASC; -DROP TABLE IF EXISTS crash1,crash2; +DROP TABLE IF EXISTS t1,t2; diff --git a/mysql-test/t/insert_update.test b/mysql-test/t/insert_update.test index 6c92774113a..f40391554cc 100644 --- a/mysql-test/t/insert_update.test +++ b/mysql-test/t/insert_update.test @@ -1,4 +1,7 @@ +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings + CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE (A), UNIQUE(B)); INSERT t1 VALUES (1,2,10), (3,4,20); INSERT t1 VALUES (5,6,30) ON DUPLICATE KEY UPDATE c=c+100; diff --git a/mysql-test/t/isam.test b/mysql-test/t/isam.test index c7308c4b999..fc2dbac439c 100644 --- a/mysql-test/t/isam.test +++ b/mysql-test/t/isam.test @@ -1,6 +1,8 @@ -- source include/have_isam.inc +--disable_warnings drop table if exists t1,t2; +--enable_warnings # # Test possible problem with rows that are about 65535 bytes long @@ -41,10 +43,14 @@ drop table t1; # # Test of some CREATE TABLE's that should fail # -!$1121 create table t1 (a int,b text, index(a)) type=isam; -!$1073 create table t1 (a int,b text, index(b)) type=isam; -!$1075 create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=isam; -!$1121 create table t1 (ordid int(8), unique (ordid)) type=isam; +--error 1121 +create table t1 (a int,b text, index(a)) type=isam; +--error 1073 +create table t1 (a int,b text, index(b)) type=isam; +--error 1075 +create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=isam; +--error 1121 +create table t1 (ordid int(8), unique (ordid)) type=isam; drop table if exists t1; # diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index 18006e8fd22..653b4271fe8 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -1,7 +1,9 @@ # # This failed for lia Perminov # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings create table t1 (id int primary key); create table t2 (id int); diff --git a/mysql-test/t/join_crash.test b/mysql-test/t/join_crash.test index 4606b23f726..ada6e56e664 100644 --- a/mysql-test/t/join_crash.test +++ b/mysql-test/t/join_crash.test @@ -2,7 +2,10 @@ # This test gave a core dump # +--disable_warnings DROP TABLE IF EXISTS t1,t2,t3,t4; +--enable_warnings + CREATE TABLE t1 ( project_id int(11) NOT NULL auto_increment, project_row_lock int(11) NOT NULL default '0', diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test index af5f377afb5..bfeb5bbb06b 100644 --- a/mysql-test/t/join_outer.test +++ b/mysql-test/t/join_outer.test @@ -2,7 +2,9 @@ # test of left outer join # +--disable_warnings drop table if exists t1,t2,t3,t4,t5; +--enable_warnings CREATE TABLE t1 ( grp int(11) default NULL, @@ -109,7 +111,6 @@ drop table t1,t2; # Test of LEFT JOIN with const tables (failed for frankie@etsetb.upc.es) # -drop table if exists t1,t2,t3,t4; CREATE TABLE t1 ( cod_asig int(11) DEFAULT '0' NOT NULL, desc_larga_cat varchar(80) DEFAULT '' NOT NULL, diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test index 1996c793880..4fd8cc86dd5 100644 --- a/mysql-test/t/key.test +++ b/mysql-test/t/key.test @@ -2,7 +2,10 @@ # This failed for Elizabeth Mattijsen # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings + CREATE TABLE t1 ( ID CHAR(32) NOT NULL, name CHAR(32) NOT NULL, @@ -173,7 +176,6 @@ drop table t1; # Problem with UNIQUE() with NULL parts and auto increment # -DROP TABLE IF EXISTS t1; CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT, UNIQUE (c,i)); INSERT INTO t1 (c) VALUES (NULL),(NULL); diff --git a/mysql-test/t/key_diff.test b/mysql-test/t/key_diff.test index 60afb5f81a4..b4e4339ae33 100644 --- a/mysql-test/t/key_diff.test +++ b/mysql-test/t/key_diff.test @@ -1,7 +1,10 @@ # # Check on condition on different length keys. +--disable_warnings drop table if exists t1; +--enable_warnings + CREATE TABLE t1 ( a char(5) NOT NULL, b char(4) NOT NULL, diff --git a/mysql-test/t/key_primary.test b/mysql-test/t/key_primary.test index 2cdb117128f..816365c517c 100644 --- a/mysql-test/t/key_primary.test +++ b/mysql-test/t/key_primary.test @@ -2,7 +2,10 @@ # test of primary key conversions # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (t1 char(3) primary key); insert into t1 values("ABC"); insert into t1 values("ABA"); diff --git a/mysql-test/t/keywords.test b/mysql-test/t/keywords.test index 3bd757aa069..e7ec63afe54 100644 --- a/mysql-test/t/keywords.test +++ b/mysql-test/t/keywords.test @@ -2,7 +2,10 @@ # Test keywords as fields # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (time time, date date, timestamp timestamp); insert into t1 values ("12:22:22","97:02:03","1997-01-02"); select * from t1; diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test index 6bcc43ac916..65d4f27059f 100644 --- a/mysql-test/t/kill.test +++ b/mysql-test/t/kill.test @@ -11,7 +11,10 @@ connect (con2, localhost, root,,); #remember id of con1 connection con1; +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (kill_id int); insert into t1 values(connection_id()); diff --git a/mysql-test/t/limit.test b/mysql-test/t/limit.test index d4f6ce186cf..88a9831aa68 100644 --- a/mysql-test/t/limit.test +++ b/mysql-test/t/limit.test @@ -2,7 +2,10 @@ # Test of update and delete with limit # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int primary key, b int not null); insert into t1 () values (); -- Testing default values insert into t1 values (1,1),(2,1),(3,1); diff --git a/mysql-test/t/lock.test b/mysql-test/t/lock.test index 385713174d2..0868cf2c4b1 100644 --- a/mysql-test/t/lock.test +++ b/mysql-test/t/lock.test @@ -2,7 +2,9 @@ # Testing of table locking # +--disable_warnings drop table if exists t1,t2; +--enable_warnings CREATE TABLE t1 ( `id` int(11) NOT NULL default '0', `id2` int(11) NOT NULL default '0', `id3` int(11) NOT NULL default '0', `dummy1` char(30) default NULL, PRIMARY KEY (`id`,`id2`), KEY `index_id3` (`id3`)) TYPE=MyISAM; insert into t1 (id,id2) values (1,1),(1,2),(1,3); LOCK TABLE t1 WRITE; diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test index 792ae956e2a..0c6c59d0444 100644 --- a/mysql-test/t/lock_multi.test +++ b/mysql-test/t/lock_multi.test @@ -6,8 +6,11 @@ # -- source include/not_embedded.inc +--disable_warnings drop table if exists t1; -#test to see if select will get the lock ahead of low priority update +--enable_warnings + +# Test to see if select will get the lock ahead of low priority update connect (locker,localhost,root,,); connect (reader,localhost,root,,); diff --git a/mysql-test/t/lowercase_table.test b/mysql-test/t/lowercase_table.test index 0d04e6c7df7..f3a747c4d61 100644 --- a/mysql-test/t/lowercase_table.test +++ b/mysql-test/t/lowercase_table.test @@ -2,7 +2,10 @@ # Test of --lower-case-table-names # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings + create table T1 (id int primary key, Word varchar(40) not null, Index(Word)); INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c'); SELECT * FROM t1; diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 39c33ef8684..f84e10b0e3c 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -2,7 +2,10 @@ # test of MERGE TABLES # +--disable_warnings drop table if exists t1,t2,t3,t4,t5,t6; +--enable_warnings + create table t1 (a int not null primary key auto_increment, message char(20)); create table t2 (a int not null primary key auto_increment, message char(20)); INSERT INTO t1 (message) VALUES ("Testing"),("table"),("t1"); @@ -49,6 +52,7 @@ select * from t4; create table t5 (a int not null, b char(10), key(a)) type=MERGE UNION=(test.t1,test_2.t2); # Because of windows, it's important that we drop the merge tables first! +# This should give a warning on table t5 drop table if exists t5,t4,t3,t1,t2; create table t1 (c char(10)) type=myisam; @@ -110,10 +114,9 @@ select * from t1; drop table t1; # -# Bug found by Monty. +# Bug in flush tables combined with MERGE tables # -drop table if exists t3, t2, t1; create table t1 (a int not null, b int not null, key(a,b)); create table t2 (a int not null, b int not null, key(a,b)); create table t3 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2); @@ -127,7 +130,6 @@ drop table t3,t1,t2; # [phi] testing INSERT_METHOD stuff # -drop table if exists t6, t5, t4, t3, t2, t1; # first testing of common stuff with new parameters create table t1 (a int not null, b int not null auto_increment, primary key(a,b)); create table t2 (a int not null, b int not null auto_increment, primary key(a,b)); @@ -181,15 +183,14 @@ CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default ' INSERT INTO t1 VALUES (1,1), (2,1); CREATE TABLE t2 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM; INSERT INTO t2 VALUES (1,2), (2,2); -CREATE TABLE t ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2); -select max(b) from t where a = 2; +CREATE TABLE t3 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2); +select max(b) from t3 where a = 2; select max(b) from t1 where a = 2; -drop table if exists t,t1,t2; +drop table if exists t3,t1,t2; # # temporary merge tables # -drop table if exists t1, t2, t3, t4, t5, t6; create table t1 (a int not null); create table t2 (a int not null); insert into t1 values (1); @@ -208,7 +209,6 @@ drop table if exists t6, t3, t1, t2, t4, t5; # testing merge::records_in_range and optimizer # -DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 ( fileset_id tinyint(3) unsigned NOT NULL default '0', file_code varchar(32) NOT NULL default '', @@ -235,5 +235,5 @@ EXPLAIN SELECT * FROM t1 WHERE fileset_id = 2 AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1; EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2 AND file_code = '0000000115' LIMIT 1; -DROP TABLE IF EXISTS t2, t1; +DROP TABLE t2, t1; diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 29239a022ec..6156da82ec0 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -2,7 +2,10 @@ # Test of update statement that uses many tables. # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings + create table t1(id1 int not null auto_increment primary key, t char(12)); create table t2(id2 int not null, t char(12)); create table t3(id3 int not null, t char(12), index(id3)); @@ -99,7 +102,7 @@ INSERT INTO t3 VALUES (1,'2002-02-04 00:00:00'),(3,'2002-05-12 00:00:00'),(5,'20 00:00:00'),(7,'2002-07-22 00:00:00'); delete t1,t2,t3 from t1,t2,t3 where to_days(now())-to_days(t3.mydate)>=30 and t3.id=t1.id and t3.id=t2.id; select * from t3; -DROP TABLE IF EXISTS t1,t2,t3; +DROP TABLE t1,t2,t3; CREATE TABLE IF NOT EXISTS `t1` ( `id` int(11) NOT NULL auto_increment, @@ -127,8 +130,7 @@ select * from t2; UPDATE t2, t1 SET t2.tst = t1.tst, t2.tst1 = t1.tst1 WHERE t2.ParId = t1.Id; select * from t2; - -drop table if exists t1, t2 ; +drop table t1, t2 ; create table t1 (n numeric(10)); create table t2 (n numeric(10)); @@ -220,7 +222,7 @@ DELETE t1, t2 FROM t1 a,t2 b where a.n=b.n; select * from t1; select * from t2; drop table t1,t2; -drop table if exists t1,t2,t3; + CREATE TABLE t1 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; INSERT INTO t1 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'),(10,''),(11,''),(12,''),(13,''); CREATE TABLE t2 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; @@ -229,4 +231,4 @@ CREATE TABLE t3 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT INSERT INTO t3 VALUES (1,'jedan'),(2,'dva'); update t1,t2 set t1.naziv="aaaa" where t1.broj=t2.broj; update t1,t2,t3 set t1.naziv="bbbb", t2.naziv="aaaa" where t1.broj=t2.broj and t2.broj=t3.broj; -drop table if exists t1,t2,t3; +drop table t1,t2,t3; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 9c261ebf5bb..780a060e204 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -2,7 +2,10 @@ # Test bugs in the MyISAM code # +--disable_warnings drop table if exists t1; +--enable_warnings + CREATE TABLE t1 ( STRING_DATA char(255) default NULL, KEY string_data (STRING_DATA) @@ -82,7 +85,6 @@ DROP TABLE t1; # in ha_myisam::repair, and index size is changed (decreased). # -drop table if exists t1; create table t1 ( t1 char(255), key(t1(250))); insert t1 values ('137513751375137513751375137513751375137569516951695169516951695169516951695169'); insert t1 values ('178417841784178417841784178417841784178403420342034203420342034203420342034203'); @@ -121,7 +123,6 @@ drop table t1; # test of myisam with huge number of packed fields # -drop table if exists t1; create table t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8 int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17 int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int, @@ -286,7 +287,7 @@ insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); -drop table if exists t1; +drop table t1; # # Test of REPAIR that once failed diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test index ad32e0be6ff..087ef81e13e 100644 --- a/mysql-test/t/null.test +++ b/mysql-test/t/null.test @@ -1,3 +1,8 @@ +# Initialise +--disable_warnings +drop table if exists t1; +--enable_warnings + # # Testing of NULL in a lot of different places # @@ -15,7 +20,6 @@ SELECT (NULL OR NULL) IS NULL; select NULL AND 0, 0 and NULL; select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton(""); -drop table if exists t1; create table t1 (x int); insert into t1 values (null); select * from t1 where x != 0; diff --git a/mysql-test/t/null_key.test b/mysql-test/t/null_key.test index b1cbd5cdfb0..18d0d368891 100644 --- a/mysql-test/t/null_key.test +++ b/mysql-test/t/null_key.test @@ -1,7 +1,10 @@ # # Check null keys -drop table if exists t1; +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + create table t1 (a int, b int not null,unique key (a,b),index(b)) type=myisam; insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6); explain select * from t1 where a is null; @@ -51,7 +54,6 @@ drop table t1; # The following failed for Matt Loschert # -DROP TABLE IF EXISTS t1,t2; CREATE TABLE t1 ( id int(10) unsigned NOT NULL auto_increment, uniq_id int(10) unsigned default NULL, diff --git a/mysql-test/t/odbc.test b/mysql-test/t/odbc.test index 3e0fc214d3e..9aac5948359 100644 --- a/mysql-test/t/odbc.test +++ b/mysql-test/t/odbc.test @@ -1,3 +1,8 @@ +# Initialise +--disable_warnings +drop table if exists t1; +--enable_warnings + # # Test some ODBC compatibility # @@ -8,7 +13,6 @@ select {fn length("hello")}, { date "1997-10-20" }; # Test retreiving row with last insert_id value. # -drop table if exists t1; create table t1 (a int not null auto_increment,b int not null,primary key (a,b)); insert into t1 SET A=NULL,B=1; insert into t1 SET a=null,b=2; diff --git a/mysql-test/t/olap.test b/mysql-test/t/olap.test index 8fe547db615..99bb2656001 100644 --- a/mysql-test/t/olap.test +++ b/mysql-test/t/olap.test @@ -1,6 +1,9 @@ -drop table if exists sales; -create table sales ( product varchar(32), country varchar(32), year int, profit int); -insert into sales values ( 'Computer', 'India',2000, 1200), +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table t1 ( product varchar(32), country varchar(32), year int, profit int); +insert into t1 values ( 'Computer', 'India',2000, 1200), ( 'TV', 'United States', 1999, 150), ( 'Calculator', 'United States', 1999,50), ( 'Computer', 'United States', 1999,1500), @@ -15,13 +18,14 @@ insert into sales values ( 'Computer', 'India',2000, 1200), ( 'Computer', 'United States', 2000,1500), ( 'Calculator', 'United States', 2000,75); --error 1235 -select product, country , year, sum(profit) from sales group by product, country, year with cube; +select product, country , year, sum(profit) from t1 group by product, country, year with cube; --error 1235 -explain select product, country , year, sum(profit) from sales group by product, country, year with cube; +explain select product, country , year, sum(profit) from t1 group by product, country, year with cube; --error 1235 -select product, country , year, sum(profit) from sales group by product, country, year with rollup; +select product, country , year, sum(profit) from t1 group by product, country, year with rollup; --error 1235 -explain select product, country , year, sum(profit) from sales group by product, country, year with rollup; +explain select product, country , year, sum(profit) from t1 group by product, country, year with rollup; --error 1235 -select product, country , year, sum(profit) from sales group by product, country, year with cube union all select product, country , year, sum(profit) from sales group by product, country, year with rollup; -drop table sales; +select product, country , year, sum(profit) from t1 group by product, country, year with cube union all select product, country , year, sum(profit) from t1 group by product, country, year with rollup; +drop table t1; + diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 0ee6f901aae..b797ba6efc3 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -2,7 +2,9 @@ # Bug with order by # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings CREATE TABLE t1 ( id int(6) DEFAULT '0' NOT NULL, @@ -168,7 +170,6 @@ drop table t1,t2,t3; #bug reported by Wouter de Jong -drop table if exists t1; CREATE TABLE t1 ( member_id int(11) NOT NULL auto_increment, inschrijf_datum varchar(20) NOT NULL default '', diff --git a/mysql-test/t/order_fill_sortbuf.test b/mysql-test/t/order_fill_sortbuf.test index 6419f2a93df..37620ebe331 100644 --- a/mysql-test/t/order_fill_sortbuf.test +++ b/mysql-test/t/order_fill_sortbuf.test @@ -3,7 +3,10 @@ # rows MySQL needs to use a merge during the sort phase. # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + CREATE TABLE `t1` ( `id` int(11) NOT NULL default '0', `id2` int(11) NOT NULL default '0', diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index eeaf1a83d1a..e1df5fa7b3b 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -10,7 +10,10 @@ flush query cache; # This crashed in some versions flush query cache; # This crashed in some versions reset query cache; flush status; +--disable_warnings +drop database if exists mysqltest; drop table if exists t1,t2,t3,t11,t21, mysqltest.t1; +--enable_warnings # # First simple test diff --git a/mysql-test/t/raid.test b/mysql-test/t/raid.test index 8b608c1069f..38c740201bc 100644 --- a/mysql-test/t/raid.test +++ b/mysql-test/t/raid.test @@ -5,7 +5,10 @@ show variables like "have_raid"; # Test of raided tables # +--disable_warnings DROP TABLE IF EXISTS t1,t2; +--enable_warnings + CREATE TABLE t1 ( id int unsigned not null auto_increment primary key, c char(255) not null diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 278807eeea4..31b3ced6cc6 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -2,7 +2,10 @@ # Problem med range optimizer # +--disable_warnings drop table if exists t1; +--enable_warnings + CREATE TABLE t1 ( event_date date DEFAULT '0000-00-00' NOT NULL, type int(11) DEFAULT '0' NOT NULL, diff --git a/mysql-test/t/rename.test b/mysql-test/t/rename.test index ce4651d8de3..48a9cb401d9 100644 --- a/mysql-test/t/rename.test +++ b/mysql-test/t/rename.test @@ -2,7 +2,10 @@ # Test of rename table # +--disable_warnings drop table if exists t0,t1,t2,t3,t4; +--enable_warnings + create table t0 SELECT 1,"table 1"; create table t2 SELECT 2,"table 2"; create table t3 SELECT 3,"table 3"; @@ -29,4 +32,6 @@ rename table t3 to t4, t5 to t3, t1 to t2, t4 to t1; select * from t1; select * from t2; select * from t3; + +# This should give a warning for t4 drop table if exists t1,t2,t3,t4; diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test index 6d79014b23d..bdc5a57a07c 100644 --- a/mysql-test/t/repair.test +++ b/mysql-test/t/repair.test @@ -2,7 +2,10 @@ # Test of repair table # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 SELECT 1,"table 1"; repair table t1 use_frm; drop table if exists t1; diff --git a/mysql-test/t/replace.test b/mysql-test/t/replace.test index e9e01615a62..7aeb2475ab5 100644 --- a/mysql-test/t/replace.test +++ b/mysql-test/t/replace.test @@ -4,7 +4,9 @@ # Test of REPLACE with ISAM and MyISAM and HEAP # +--disable_warnings drop table if exists t1; +--enable_warnings CREATE TABLE t1 ( gesuchnr int(11) DEFAULT '0' NOT NULL, diff --git a/mysql-test/t/rollback.test b/mysql-test/t/rollback.test index bd37e69ae23..1673f1648d3 100644 --- a/mysql-test/t/rollback.test +++ b/mysql-test/t/rollback.test @@ -2,7 +2,9 @@ # This test should fail as MyISAM doesn't have rollback # +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (n int not null primary key) type=myisam; begin work; diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test index 593e2342856..099eaa95c77 100644 --- a/mysql-test/t/row.test +++ b/mysql-test/t/row.test @@ -1,3 +1,8 @@ +# Initialise +--disable_warnings +drop table if exists t1; +--enable_warnings + select row(1,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)); select row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)); select row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3)); @@ -33,7 +38,7 @@ SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,3)); SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,NULL)); -- error 1239 SELECT ROW('test',2,ROW(3,33))=ROW('test',2,4); -drop table if exists t1; + create table t1 ( a int, b int, c int); insert into t1 values (1,2,3), (2,3,1), (3,2,1), (1,2,NULL); select * from t1 where ROW(1,2,3)=ROW(a,b,c); @@ -47,7 +52,7 @@ drop table t1; -- error 1239 select ROW(1,1); -drop table if exists t1; + create table t1 (i int); -- error 1239 select 1 from t1 where ROW(1,1); diff --git a/mysql-test/t/rpl000001.test b/mysql-test/t/rpl000001.test index ce6897e63e1..3975f14e523 100644 --- a/mysql-test/t/rpl000001.test +++ b/mysql-test/t/rpl000001.test @@ -1,5 +1,5 @@ source include/master-slave.inc; -drop table if exists t1,t2,t3; + create table t1 (word char(20) not null); load data infile '../../std_data/words.dat' into table t1; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR diff --git a/mysql-test/t/rpl000002.test b/mysql-test/t/rpl000002.test index 5fabe0d2c59..803eb069b66 100644 --- a/mysql-test/t/rpl000002.test +++ b/mysql-test/t/rpl000002.test @@ -1,5 +1,5 @@ source include/master-slave.inc; -drop table if exists t1; + create table t1 (n int auto_increment primary key); set insert_id = 2000; insert into t1 values (NULL),(NULL),(NULL); @@ -12,7 +12,6 @@ drop table t1; sync_slave_with_master; stop slave; connection master; -drop table if exists t2; create table t2(id int auto_increment primary key, created datetime); set timestamp=12345; insert into t2 set created=now(); diff --git a/mysql-test/t/rpl000003.test b/mysql-test/t/rpl000003.test deleted file mode 100644 index f994ed94371..00000000000 --- a/mysql-test/t/rpl000003.test +++ /dev/null @@ -1,14 +0,0 @@ -source include/master-slave.inc; -drop table if exists t1; -create table t1(n int primary key); -!insert into t1 values (1),(2),(2); -insert into t1 values (3); -save_master_pos; -connection slave; -sync_with_master; -select * from t1; -connection master; -drop table t1; -save_master_pos; -connection slave; -sync_with_master; diff --git a/mysql-test/t/rpl000004.test b/mysql-test/t/rpl000004.test index 705e0d51b7b..8fc2977faab 100644 --- a/mysql-test/t/rpl000004.test +++ b/mysql-test/t/rpl000004.test @@ -1,18 +1,14 @@ source include/master-slave.inc; + set SQL_LOG_BIN=0; -drop table if exists t1; create table t1 (word char(20) not null, index(word)); load data infile '../../std_data/words.dat' into table t1; -drop table if exists t2; create table t2 (word char(20) not null); load data infile '../../std_data/words.dat' into table t2; create table t3 (word char(20) not null primary key); connection slave; -drop table if exists t1; load table t1 from master; -drop table if exists t2; load table t2 from master; -drop table if exists t3; load table t3 from master; check table t1; select count(*) from t2; diff --git a/mysql-test/t/rpl000005.test b/mysql-test/t/rpl000005.test index 1cfea242b69..ae713633df3 100644 --- a/mysql-test/t/rpl000005.test +++ b/mysql-test/t/rpl000005.test @@ -1,5 +1,5 @@ source include/master-slave.inc; -drop table if exists t1; + CREATE TABLE t1 (name varchar(64), age smallint(3)); INSERT INTO t1 SET name='Andy', age=31; INSERT t1 SET name='Jacob', age=2; diff --git a/mysql-test/t/rpl000006.test b/mysql-test/t/rpl000006.test index ad8622c2a81..c6438062bb7 100644 --- a/mysql-test/t/rpl000006.test +++ b/mysql-test/t/rpl000006.test @@ -5,12 +5,10 @@ source include/master-slave.inc; # Don't log table creating to the slave as we want to test LOAD TABLE set SQL_LOG_BIN=0,timestamp=200006; -drop table if exists t1; create table t1(t timestamp not null,a char(1)); insert into t1 ( a) values ('F'); select unix_timestamp(t) from t1; connection slave; -drop table if exists t1; load table t1 from master; select unix_timestamp(t) from t1; diff --git a/mysql-test/t/rpl000008-slave.opt b/mysql-test/t/rpl000008-slave.opt index 79b3bf6174b..177f89e0910 100644 --- a/mysql-test/t/rpl000008-slave.opt +++ b/mysql-test/t/rpl000008-slave.opt @@ -1 +1 @@ ---replicate-ignore-table=test.foo +--replicate-ignore-table=test.mysqltest_foo diff --git a/mysql-test/t/rpl000008.test b/mysql-test/t/rpl000008.test index 12760008b6d..ea782b99d28 100644 --- a/mysql-test/t/rpl000008.test +++ b/mysql-test/t/rpl000008.test @@ -1,29 +1,36 @@ -#this one assumes we are ignoring updates on table foo, but doing -#the ones on all other tables +# This one assumes we are ignoring updates on table mysqltest_foo, but doing +# the ones on all other tables + source include/master-slave.inc; connection slave; + +# +# For this test we must be in the test database +# use test; -drop table if exists foo; -create table foo (n int); -insert into foo values(4); + +--disable_warnings +drop table if exists mysqltest_foo; +drop table if exists mysqltest_bar; +--enable_warnings + +create table mysqltest_foo (n int); +insert into mysqltest_foo values(4); connection master; use test; -drop table if exists foo; -create table foo (n int); -insert into foo values(5); -drop table if exists bar; -create table bar (m int); -insert into bar values(15); -drop table if exists choo; -create table choo (k int); -insert into choo values(55); +create table mysqltest_foo (n int); +insert into mysqltest_foo values(5); +create table mysqltest_bar (m int); +insert into mysqltest_bar values(15); +create table t1 (k int); +insert into t1 values(55); save_master_pos; connection slave; sync_with_master; -select foo.n,bar.m,choo.k from foo,bar,choo; +select mysqltest_foo.n,mysqltest_bar.m,t1.k from mysqltest_foo,mysqltest_bar,t1; connection master; -drop table if exists foo,bar,choo; +drop table mysqltest_foo,mysqltest_bar,t1; save_master_pos; connection slave; sync_with_master; -drop table if exists foo,bar,choo; +drop table mysqltest_foo,mysqltest_bar,t1; diff --git a/mysql-test/t/rpl000009-slave.opt b/mysql-test/t/rpl000009-slave.opt index 245e310c5d8..c015c02ba78 100644 --- a/mysql-test/t/rpl000009-slave.opt +++ b/mysql-test/t/rpl000009-slave.opt @@ -1 +1 @@ ---replicate-wild-do-table=bar.% +--replicate-wild-do-table=mysqltest.% diff --git a/mysql-test/t/rpl000009.test b/mysql-test/t/rpl000009.test index 3d0827718ec..d5cb14350a6 100644 --- a/mysql-test/t/rpl000009.test +++ b/mysql-test/t/rpl000009.test @@ -1,36 +1,34 @@ -# This one assumes we are ignoring updates on tables in database foo, but doing -# the ones in database bar +# This one assumes we are ignoring updates on tables in database mysqltest2, +# but doing the ones in database mysqltest source include/master-slave.inc; -drop database if exists foo; -create database foo; -drop database if exists bar; -create database bar; +--disable_warnings +drop database if exists mysqltest2; +create database mysqltest2; +drop database if exists mysqltest; +create database mysqltest; +--enable_warnings + save_master_pos; connection slave; sync_with_master; -drop table if exists foo.foo; -create table foo.foo (n int); -insert into foo.foo values(4); +create table mysqltest2.foo (n int); +insert into mysqltest2.foo values(4); connection master; -drop table if exists foo.foo; -create table foo.foo (n int); -insert into foo.foo values(5); -drop table if exists bar.bar; -create table bar.bar (m int); -insert into bar.bar values(15); +create table mysqltest2.foo (n int); +insert into mysqltest2.foo values(5); +create table mysqltest.bar (m int); +insert into mysqltest.bar values(15); save_master_pos; connection slave; sync_with_master; -select foo.foo.n,bar.bar.m from foo.foo,bar.bar; +select mysqltest2.foo.n,mysqltest.bar.m from mysqltest2.foo,mysqltest.bar; connection master; -drop database if exists bar; -drop database if exists foo; +drop database mysqltest; +drop database mysqltest2; save_master_pos; connection slave; sync_with_master; -drop database if exists bar; -drop database if exists foo; # Now let's test load data from master @@ -38,19 +36,19 @@ drop database if exists foo; connection master; set sql_log_bin = 0; -create database foo; -create database bar; +create database mysqltest2; +create database mysqltest; show databases; -create table foo.t1(n int, s char(20)); -create table foo.t2(n int, s text); -insert into foo.t1 values (1, 'one'), (2, 'two'), (3, 'three'); -insert into foo.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen'); +create table mysqltest2.t1(n int, s char(20)); +create table mysqltest2.t2(n int, s text); +insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three'); +insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen'); -create table bar.t1(n int, s char(20)); -create table bar.t2(n int, s text); -insert into bar.t1 values (1, 'one bar'), (2, 'two bar'), (3, 'three bar'); -insert into bar.t2 values (11, 'eleven bar'), (12, 'twelve bar'), - (13, 'thirteen bar'); +create table mysqltest.t1(n int, s char(20)); +create table mysqltest.t2(n int, s text); +insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test'); +insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'), + (13, 'thirteen test'); set sql_log_bin = 1; save_master_pos; connection slave; @@ -62,26 +60,25 @@ load data from master; # Now let's check if we have the right tables and the right data in them show databases; -use foo; +use mysqltest2; show tables; -use bar; +use mysqltest; show tables; -select * from bar.t1; -select * from bar.t2; +select * from mysqltest.t1; +select * from mysqltest.t2; # Now let's see if replication works connection master; -insert into bar.t1 values (4, 'four bar'); +insert into mysqltest.t1 values (4, 'four test'); save_master_pos; connection slave; sync_with_master; -select * from bar.t1; +select * from mysqltest.t1; # Now time for cleanup connection master; -drop database bar; -drop database foo; +drop database mysqltest; +drop database mysqltest2; save_master_pos; connection slave; sync_with_master; - diff --git a/mysql-test/t/rpl000010.test b/mysql-test/t/rpl000010.test index 05a211fbd85..0725214694a 100644 --- a/mysql-test/t/rpl000010.test +++ b/mysql-test/t/rpl000010.test @@ -1,10 +1,8 @@ -#this tests the offset off by 22 mystery bug -#must run slave with --disconnect-slave-event-count=1 --master-connect-retry=1 +# This tests the offset off by 22 mystery bug +# Must run slave with --disconnect-slave-event-count=1 --master-connect-retry=1 + source include/master-slave.inc; -connection slave; -drop table if exists t1; -connection master; -drop table if exists t1; + create table t1 (n int not null auto_increment primary key); insert into t1 values(NULL); insert into t1 values(2); diff --git a/mysql-test/t/rpl000011.test b/mysql-test/t/rpl000011.test index dc84741694c..3b00afe10e4 100644 --- a/mysql-test/t/rpl000011.test +++ b/mysql-test/t/rpl000011.test @@ -1,5 +1,5 @@ source include/master-slave.inc; -drop table if exists t1; + create table t1 (n int); insert into t1 values(1); sync_slave_with_master; diff --git a/mysql-test/t/rpl000012.test b/mysql-test/t/rpl000012.test index 9f8ba9a4f91..7f440eaaa13 100644 --- a/mysql-test/t/rpl000012.test +++ b/mysql-test/t/rpl000012.test @@ -1,18 +1,16 @@ source include/master-slave.inc; connection master; -drop table if exists t1,t2,t3; create table t2 (n int); create temporary table t1 (n int); insert into t1 values(1),(2),(3); insert into t2 select * from t1; -drop table if exists test.t3; -create temporary table test.t3 (n int not null); -alter table test.t3 add primary key(n); +create temporary table t3 (n int not null); +alter table t3 add primary key(n); flush logs; insert into t3 values (100); insert into t2 select * from t3; -drop table if exists test.t3; +drop table if exists t3; insert into t2 values (101); connection master1; create temporary table t1 (n int); diff --git a/mysql-test/t/rpl000013.test b/mysql-test/t/rpl000013.test index 14619796e01..94d5feb3925 100644 --- a/mysql-test/t/rpl000013.test +++ b/mysql-test/t/rpl000013.test @@ -3,7 +3,7 @@ save_master_pos; connection slave; sync_with_master; connection master; -drop table if exists t2; + create table t2(n int); create temporary table t1 (n int); insert into t1 values(1),(2),(3); @@ -31,6 +31,10 @@ show status like 'Slave_open_temp_tables'; # connect (master2,localhost,root,,); connection master2; + +# We will get a warning for t1 as this is a temporary table that doesn't +# exist in this connection. + drop table if exists t1,t2; save_master_pos; connection slave; diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl000015.test index 37155d33f08..9573dfd8fb3 100644 --- a/mysql-test/t/rpl000015.test +++ b/mysql-test/t/rpl000015.test @@ -23,7 +23,9 @@ sync_with_master; --replace_result $MASTER_MYPORT MASTER_PORT show slave status; connection master; +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (n int); insert into t1 values (10),(45),(90); sync_slave_with_master; diff --git a/mysql-test/t/rpl000016-slave.opt b/mysql-test/t/rpl000016-slave.opt deleted file mode 100644 index f27601e0d7d..00000000000 --- a/mysql-test/t/rpl000016-slave.opt +++ /dev/null @@ -1 +0,0 @@ --O max_binlog_size=2048 diff --git a/mysql-test/t/rpl000017.test b/mysql-test/t/rpl000017.test index 3bff9b4cbd8..f38e109cb19 100644 --- a/mysql-test/t/rpl000017.test +++ b/mysql-test/t/rpl000017.test @@ -7,7 +7,9 @@ grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaa connection slave; start slave; connection master; +--disable_warnings drop table if exists t1; +--enable_warnings create table t1(n int); insert into t1 values(24); sync_slave_with_master; diff --git a/mysql-test/t/rpl000018.test b/mysql-test/t/rpl000018.test index e992f7938eb..b8c09ed431d 100644 --- a/mysql-test/t/rpl000018.test +++ b/mysql-test/t/rpl000018.test @@ -13,7 +13,9 @@ reset slave; start slave; connection master; show binary logs; +--disable_warnings drop table if exists t1; +--enable_warnings create table t1(n int); insert into t1 values (3351); sync_slave_with_master; diff --git a/mysql-test/t/rpl_alter.test b/mysql-test/t/rpl_alter.test index 710dd2d09d6..6b8cf773150 100644 --- a/mysql-test/t/rpl_alter.test +++ b/mysql-test/t/rpl_alter.test @@ -1,19 +1,22 @@ source include/master-slave.inc; -drop database if exists d1; -create database d1; -create table d1.t1 ( n int); -alter table d1.t1 add m int; -insert into d1.t1 values (1,2); -create table d1.t2 (n int); -insert into d1.t2 values (45); -rename table d1.t2 to d1.t3, d1.t1 to d1.t2; +--disable_warnings +drop database if exists test_$1; +--enable_warnings +create database test_$1; + +create table test_$1.t1 ( n int); +alter table test_$1.t1 add m int; +insert into test_$1.t1 values (1,2); +create table test_$1.t2 (n int); +insert into test_$1.t2 values (45); +rename table test_$1.t2 to test_$1.t3, test_$1.t1 to test_$1.t2; save_master_pos; connection slave; sync_with_master; -select * from d1.t2; -select * from d1.t3; +select * from test_$1.t2; +select * from test_$1.t3; connection master; -drop database d1; +drop database test_$1; save_master_pos; connection slave; sync_with_master; diff --git a/mysql-test/t/rpl_empty_master_crash.test b/mysql-test/t/rpl_empty_master_crash.test index afa76ce10bb..9d5a7a173b0 100644 --- a/mysql-test/t/rpl_empty_master_crash.test +++ b/mysql-test/t/rpl_empty_master_crash.test @@ -1,6 +1,7 @@ source include/master-slave.inc; -drop table if exists t1; + show slave status; + # # Load table should not succeed on the master as this is not a slave # diff --git a/mysql-test/t/rpl_redirect.test b/mysql-test/t/rpl_redirect.test index 4082542f295..181d200b761 100644 --- a/mysql-test/t/rpl_redirect.test +++ b/mysql-test/t/rpl_redirect.test @@ -19,7 +19,6 @@ rpl_probe; #turn on master/slave query direction auto-magic enable_rpl_parse; -drop table if exists t1; create table t1 ( n int); insert into t1 values (1),(2),(3),(4); disable_rpl_parse; diff --git a/mysql-test/t/rpl_replicate_do.test b/mysql-test/t/rpl_replicate_do.test index 0800062dc05..dcb3c5034fd 100644 --- a/mysql-test/t/rpl_replicate_do.test +++ b/mysql-test/t/rpl_replicate_do.test @@ -2,9 +2,12 @@ # updates on t1 source include/master-slave.inc; +--disable_warnings drop table if exists t11; connection slave; drop table if exists t11; +--enable_warnings + create table t2 (n int); insert into t2 values(4); connection master; @@ -24,7 +27,7 @@ select * from t2; --error 1146 select * from t11; connection master; -drop table if exists t1,t2,t3,t11; +drop table if exists t1,t2,t11; save_master_pos; connection slave; sync_with_master; diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test index c552936d93f..025e07382ba 100644 --- a/mysql-test/t/rpl_rotate_logs.test +++ b/mysql-test/t/rpl_rotate_logs.test @@ -1,5 +1,5 @@ # -# Test are run with max_binlog_size=2048 to force automatic rotation of the +# Test is run with max_binlog_size=2048 to force automatic rotation of the # binary log # Tests done: # - Check that slaves reports correct failures if master.info has strange @@ -8,14 +8,18 @@ # - Ensure that temporary tables works over flush logs and binary log # changes # - Test creating a duplicate key error and recover from it -# + connect (master,localhost,root,,test,0,master.sock); +--disable_warnings drop table if exists t1, t2, t3, t4; +--enable_warnings connect (slave,localhost,root,,test,0,slave.sock); system cat /dev/null > var/slave-data/master.info; system chmod 000 var/slave-data/master.info; connection slave; +--disable_warnings drop table if exists t1, t2, t3, t4; +--enable_warnings --error 1201 start slave; system chmod 600 var/slave-data/master.info; @@ -46,7 +50,6 @@ show slave status; select * from t1; connection master; flush logs; -drop table if exists t2; create table t2(m int not null auto_increment primary key); insert into t2 values (34),(67),(123); flush logs; @@ -102,7 +105,7 @@ connection master; create temporary table temp_table (a char(80) not null); insert into temp_table values ("testing temporary tables part 2"); let $1=100; -drop table if exists t3; + create table t3 (n int); disable_query_log; while ($1) diff --git a/mysql-test/t/rpl_skip_error.test b/mysql-test/t/rpl_skip_error.test index d43c59ef024..86c89c70314 100644 --- a/mysql-test/t/rpl_skip_error.test +++ b/mysql-test/t/rpl_skip_error.test @@ -1,5 +1,4 @@ source include/master-slave.inc; -drop table if exists t1; create table t1 (n int not null primary key); save_master_pos; diff --git a/mysql-test/t/rpl_temporary.test b/mysql-test/t/rpl_temporary.test index 1cb53c77f1f..75519b75f75 100644 --- a/mysql-test/t/rpl_temporary.test +++ b/mysql-test/t/rpl_temporary.test @@ -3,9 +3,11 @@ source include/master-slave.inc; connect (con1,localhost,root,,); connect (con2,localhost,root,,); -drop table if exists t1; +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + create table t1(f int); -drop table if exists t2; create table t2(f int); insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); @@ -38,8 +40,7 @@ select * from t2; show binlog events; -drop table if exists t1; -drop table if exists t2; +drop table t1, t2; use test; SET TIMESTAMP=1040323920; @@ -74,4 +75,5 @@ SET TIMESTAMP=1040324224; SET @@session.pseudo_thread_id=2; drop temporary table t3; -select * from t2; \ No newline at end of file +select * from t2; +drop table t1,t2; diff --git a/mysql-test/t/sel000001.test b/mysql-test/t/sel000001.test deleted file mode 100644 index 77355f8d535..00000000000 --- a/mysql-test/t/sel000001.test +++ /dev/null @@ -1,18 +0,0 @@ -# sel000001 -# -# Versions -# -------- -# 3.22 -# 3.23 -# -# Description -# ----------- -# This test is just a simple select. -# Testing WHERE clause. -# - -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (s CHAR(20) PRIMARY KEY, id INT); -INSERT INTO t1 VALUES ('cat', 1), ('mouse', 3), ('dog', 2), ('snake', 77); -SELECT s, id FROM t1 WHERE s = 'mouse'; -drop table t1; diff --git a/mysql-test/t/sel000002.test b/mysql-test/t/sel000002.test deleted file mode 100644 index 9a89db2821c..00000000000 --- a/mysql-test/t/sel000002.test +++ /dev/null @@ -1,17 +0,0 @@ -# sel000002 -# -# Versions -# -------- -# 3.22 -# 3.23 -# -# Description -# ----------- -# This test is just a simple select. -# - -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (n INT); -INSERT INTO t1 VALUES (1), (2), (3); -SELECT * FROM t1; -drop table t1; diff --git a/mysql-test/t/sel000003.test b/mysql-test/t/sel000003.test deleted file mode 100644 index a3f6a7337c2..00000000000 --- a/mysql-test/t/sel000003.test +++ /dev/null @@ -1,18 +0,0 @@ -# sel000003 -# -# Versions -# -------- -# 3.22 -# 3.23 -# -# Description -# ----------- -# This test is just a simple select. -# Testing count() function and GROUP BY clause. -# - -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (name CHAR(20) NOT NULL PRIMARY KEY, score SMALLINT NOT NULL, KEY(score)); -INSERT INTO t1 VALUES ('Sasha', 20), ('Matt', 20), ('Monty', 10), ('David', 10), ('Tim', 10), ('Jeremy', 10); -SELECT COUNT(*) as n, score FROM t1 GROUP BY score; -drop table t1; diff --git a/mysql-test/t/sel000031.test b/mysql-test/t/sel000031.test deleted file mode 100644 index 29bafbb3040..00000000000 --- a/mysql-test/t/sel000031.test +++ /dev/null @@ -1,20 +0,0 @@ -# sel000031 -# -# Versions -# -------- -# 3.22 -# 3.23 -# -# Description -# ----------- -# test for a bug with elt() and order by - -drop table if exists t1,t2; -create table t1 (id int(10) not null unique); -create table t2 (id int(10) not null primary key, -val int(10) not null); -insert into t1 values (1),(2),(4); -insert into t2 values (1,1),(2,1),(3,1),(4,2); - -select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id; -drop table t1,t2; diff --git a/mysql-test/t/sel000032.test b/mysql-test/t/sel000032.test deleted file mode 100644 index d31ba69e9d8..00000000000 --- a/mysql-test/t/sel000032.test +++ /dev/null @@ -1,20 +0,0 @@ -# sel000032 -# -# Versions -# -------- -# 3.22 -# 3.23 -# -# Description -# ----------- -# test for a bug with elt() - -drop table if exists t1,t2; -create table t1 (id int(10) not null unique); -create table t2 (id int(10) not null primary key, -val int(10) not null); -insert into t1 values (1),(2),(4); -insert into t2 values (1,1),(2,1),(3,1),(4,2); - -select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id; -drop table t1,t2; diff --git a/mysql-test/t/sel000033.test b/mysql-test/t/sel000033.test index 165e43ad9f8..72e096311ce 100644 --- a/mysql-test/t/sel000033.test +++ b/mysql-test/t/sel000033.test @@ -9,7 +9,9 @@ # ----------- # test for a bug with in() and unique key +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (id int(10) primary key); insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9); diff --git a/mysql-test/t/sel000100.test b/mysql-test/t/sel000100.test index cedb78b17e7..2f9c06d5cf4 100644 --- a/mysql-test/t/sel000100.test +++ b/mysql-test/t/sel000100.test @@ -1,4 +1,6 @@ +--disable_warnings DROP TABLE IF EXISTS t1,t2; +--enable_warnings CREATE TABLE t1 ( ID int(11) NOT NULL auto_increment, diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 7ea86845cb0..d4effd2026c 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -6,9 +6,9 @@ # Simple select test # -use test; - +--disable_warnings drop table if exists t1,t2,t3,t4; +--enable_warnings CREATE TABLE t1 ( Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, @@ -1489,8 +1489,6 @@ select t2.fld1,fld3,period,price,price2 from t2,t3 where t2.fld1>= 18201 and t2. # We need another table for join stuff.. # -drop table if exists company; - create table t4 ( companynr tinyint(2) unsigned zerofill NOT NULL default '00', companyname char(30) NOT NULL default '', @@ -1800,10 +1798,10 @@ select * from t1 natural right join (t1 as t2 left join t1 as t3 using (a)); select * from t1 natural join (t1 as t2 left join t1 as t3 using (a)); select * from (t1 as t2 left join t1 as t3 using (a)) natural join t1; drop table t1; -drop table if exists t1,t2; + CREATE TABLE t1 ( aa char(2), id int(11) NOT NULL auto_increment, t2_id int(11) NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) TYPE=MyISAM; INSERT INTO t1 VALUES ("1",8264,2506),("2",8299,2517),("3",8301,2518),("4",8302,2519),("5",8303,2520),("6",8304,2521),("7",8305,2522); CREATE TABLE t2 ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=MyISAM; INSERT INTO t2 VALUES (2517), (2518), (2519), (2520), (2521), (2522); select * from t1, t2 WHERE t1.t2_id = t2.id and t1.t2_id > 0 order by t1.id LIMIT 0, 5; -drop table if exists t1,t2; +drop table t1,t2; diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test index fb57224dd19..06624d50a43 100644 --- a/mysql-test/t/select_found.test +++ b/mysql-test/t/select_found.test @@ -1,8 +1,10 @@ # # Testing of found_rows() # - +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (a int not null auto_increment, b int not null, primary key(a)); insert into t1 (b) values (2),(3),(5),(5),(5),(6),(7),(9); select SQL_CALC_FOUND_ROWS * from t1; diff --git a/mysql-test/t/select_safe.test b/mysql-test/t/select_safe.test index e76b7558997..cd8bce6369c 100644 --- a/mysql-test/t/select_safe.test +++ b/mysql-test/t/select_safe.test @@ -2,7 +2,10 @@ # test of safe selects # +--disable_warnings drop table if exists t1; +--enable_warnings + SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=4, SQL_MAX_JOIN_SIZE=9; create table t1 (a int primary key, b char(20)); insert into t1 values(1,"test"); diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index eb15eac8bad..a21436637d1 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -2,7 +2,10 @@ # Test of some show commands # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (a int not null primary key, b int not null,c int not null, key(b,c)); insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4); check table t1 fast; diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test index cffca437cf1..90d7f814359 100644 --- a/mysql-test/t/status.test +++ b/mysql-test/t/status.test @@ -13,7 +13,10 @@ flush status; show status like 'Table_lock%'; connection con1; SET SQL_LOG_BIN=0; +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1(n int) type=myisam; insert into t1 values(1); connection con2; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index de07df1905b..21cb748b2a0 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -1,3 +1,8 @@ +# Initialise +--disable_warnings +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12; +--enable_warnings + select (select 2); explain select (select 2); SELECT (SELECT 1) UNION SELECT (SELECT 2); @@ -46,7 +51,6 @@ SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); SELECT (SELECT 1.5,2,'a') = ROW(1.5,'c','a'); SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; create table t1 (a int); create table t2 (a int, b int); create table t3 (a int); @@ -134,8 +138,6 @@ SELECT * FROM t1 WHERE b = (SELECT MIN(b) FROM t1); SELECT * FROM t2 WHERE b = (SELECT MIN(b) FROM t2); SELECT * FROM t3 WHERE b = (SELECT MIN(b) FROM t3); -drop table if exists t8; - CREATE TABLE `t8` ( `pseudo` varchar(35) character set latin1 NOT NULL default '', `email` varchar(60) character set latin1 NOT NULL default '', @@ -294,7 +296,7 @@ select * from t1; drop table t1, t2; #multi-delete with subselects -drop table if exists t11, t12, t2; + create table t11 (a int NOT NULL, b int, primary key (a)); create table t12 (a int NOT NULL, b int, primary key (a)); create table t2 (a int NOT NULL, b int, primary key (a)); @@ -364,7 +366,7 @@ drop table t1, t2, t3; -- error 1096 SELECT * FROM (SELECT 1) b WHERE 1 IN (SELECT *); -drop table if exists t; + CREATE TABLE t (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1; INSERT INTO t VALUES (1),(2); SELECT * FROM t WHERE id IN (SELECT 1); @@ -448,26 +450,25 @@ select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t1 where a=t2.a) from t2; drop table t1,t2; -drop table if exists t; -create table t (a int, b real, c varchar(10)); -insert into t values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b'); -select ROW(1, 1, 'a') IN (select a,b,c from t); -select ROW(1, 2, 'a') IN (select a,b,c from t); -select ROW(1, 1, 'a') IN (select b,a,c from t); -select ROW(1, 1, 'a') IN (select a,b,c from t where a is not null); -select ROW(1, 2, 'a') IN (select a,b,c from t where a is not null); -select ROW(1, 1, 'a') IN (select b,a,c from t where a is not null); -select ROW(1, 1, 'a') IN (select a,b,c from t where c='b' or c='a'); -select ROW(1, 2, 'a') IN (select a,b,c from t where c='b' or c='a'); -select ROW(1, 1, 'a') IN (select b,a,c from t where c='b' or c='a'); +create table t1 (a int, b real, c varchar(10)); +insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b'); +select ROW(1, 1, 'a') IN (select a,b,c from t1); +select ROW(1, 2, 'a') IN (select a,b,c from t1); +select ROW(1, 1, 'a') IN (select b,a,c from t1); +select ROW(1, 1, 'a') IN (select a,b,c from t1 where a is not null); +select ROW(1, 2, 'a') IN (select a,b,c from t1 where a is not null); +select ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null); +select ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a'); +select ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a'); +select ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a'); -- error 1235 -select ROW(1, 1, 'a') IN (select b,a,c from t limit 2); -drop table t; +select ROW(1, 1, 'a') IN (select b,a,c from t1 limit 2); +drop table t1; -create table t (a int); -insert into t values (1); -do @a:=(SELECT a from t); +create table t1 (a int); +insert into t1 values (1); +do @a:=(SELECT a from t1); select @a; -drop table t; +drop table t1; -- error 1146 -do (SELECT a from t); +do (SELECT a from t1); diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test index 586761921b8..67126930e60 100644 --- a/mysql-test/t/symlink.test +++ b/mysql-test/t/symlink.test @@ -3,10 +3,14 @@ disable_query_log; show variables like "have_symlink"; enable_query_log; +--disable_warnings +drop table if exists t1,t2,t7,t8,t9; +--enable_warnings + # # First create little data to play with # -drop table if exists t1,t2,t7,t8,t9; + create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)); create table t2 (a int not null auto_increment, b char(16) not null, primary key (a)); insert into t1 (b) values ("test"),("test1"),("test2"),("test3"); diff --git a/mysql-test/t/tablelock.test b/mysql-test/t/tablelock.test index fa8c4f03675..fbc5d685096 100644 --- a/mysql-test/t/tablelock.test +++ b/mysql-test/t/tablelock.test @@ -2,7 +2,10 @@ # Test of lock tables # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 ( n int auto_increment primary key); lock tables t1 write; insert into t1 values(NULL); diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test index 665e690a322..03b6fa35bfa 100644 --- a/mysql-test/t/temp_table.test +++ b/mysql-test/t/temp_table.test @@ -2,7 +2,10 @@ # Test of temporary tables # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + CREATE TABLE t1 (c int not null, d char (10) not null); insert into t1 values(1,""),(2,"a"),(3,"b"); CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null); @@ -34,7 +37,6 @@ drop table t1; # Test CONCAT_WS with temporary tables # -drop table if exists t1; CREATE TABLE t1 (pkCrash INTEGER PRIMARY KEY,strCrash VARCHAR(255)); INSERT INTO t1 ( pkCrash, strCrash ) VALUES ( 1, '1'); SELECT CONCAT_WS(pkCrash, strCrash) FROM t1; @@ -74,8 +76,6 @@ drop table t1; # In MySQL 4.0.4 doing a GROUP BY on a NULL column created a disk based # temporary table when a memory based one would be good enough. -drop table if exists t1; - CREATE TABLE t1 ( d datetime default NULL ) TYPE=MyISAM; diff --git a/mysql-test/t/truncate.test b/mysql-test/t/truncate.test index eeb79f497fa..dd80baba269 100644 --- a/mysql-test/t/truncate.test +++ b/mysql-test/t/truncate.test @@ -1,7 +1,10 @@ # # Test of truncate # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a integer, b integer,c1 CHAR(10)); insert into t1 (a) values (1),(2); truncate table t1; diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test index 234daeabc2b..6a55c61f8a1 100644 --- a/mysql-test/t/type_blob.test +++ b/mysql-test/t/type_blob.test @@ -1,7 +1,10 @@ # # Basic cleanup # +--disable_warnings drop table if exists t1,t2,t3,t4,t5,t6,t7; +--enable_warnings + # # Check syntax for creating BLOB/TEXT @@ -23,7 +26,11 @@ drop table t1,t2,t3 CREATE TABLE t1 (a char(257) default "hello"); --error 1101 CREATE TABLE t2 (a blob default "hello"); + +# Safety to be able to continue with other tests if above fails +--disable_warnings drop table if exists t1,t2; +--enable_warnings # # test of full join with blob diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test index 68c2d55aac9..6319a3990e6 100644 --- a/mysql-test/t/type_date.test +++ b/mysql-test/t/type_date.test @@ -1,6 +1,10 @@ # # test of problem with date fields # +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + create table t1 (a char(16), b date, c datetime); insert into t1 SET a='test 2000-01-01', b='2000-01-01', c='2000-01-01'; select * from t1 where c = '2000-01-01'; @@ -11,7 +15,6 @@ drop table t1; # problem with date conversions # -drop table if exists t1,t2; CREATE TABLE t1 (name char(6),cdate date); INSERT INTO t1 VALUES ('name1','1998-01-01'); INSERT INTO t1 VALUES ('name2','1998-01-01'); diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index 991f11e86ea..f791cd76d34 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -2,7 +2,10 @@ # testing different DATETIME ranges # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (t datetime); insert into t1 values(101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959); select * from t1; diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test index 7f73ec34e3a..9b10e8943ad 100644 --- a/mysql-test/t/type_decimal.test +++ b/mysql-test/t/type_decimal.test @@ -1,6 +1,9 @@ # bug in decimal() with negative numbers by kaido@tradenet.ee +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings + CREATE TABLE t1 ( id int(11) DEFAULT '0' NOT NULL auto_increment, datatype_id int(11) DEFAULT '0' NOT NULL, diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test index 8f399e4364e..49ba73acaa8 100644 --- a/mysql-test/t/type_enum.test +++ b/mysql-test/t/type_enum.test @@ -2,7 +2,10 @@ # Problem with many enums # +--disable_warnings DROP TABLE if exists t1; +--enable_warnings + CREATE TABLE t1 ( field enum('001001','001004','001010','001018','001019','001020','001021','001027','001028','001029','001030','001031','001100','002003','002004','002005','002007','002008','002009','002012','002013','002014','003002','003003','003004','003005','003006','003007','003008','003009','003010','003011','003012','003013','003014','003015','003016','003017','003018','003019','004002','004003','004005','004006','004007','004008','004010','004012','004014','004016','004017','004020','004021','004022','004023','004024','004025','004026','006002','006004','006006','006010','006011','006012','006013','006014','007001','007002','007003','007004','007005','007006','007007','007008','007009','007010','007011','007012','007013','007014','007015','007016','007017','007018','007019','007020','007021','007022','007023','007024','007025','007026','007027','007028','007029','007030','007031','007032','007033','007034','007035','007036','007037','007038','007039','007040','007043','007044','009001','009002','009004','009005','009006','009007','009008','009009','009010','009011','009012','009013','010002','010003','010004','010005','010006','010007','010008','010009','010010','010011','010012','010013','010015','010016','010017','010018','010019','010020','010021','010022','010023','010024','010025','010026','010027','010028','011001','011002','011003','011004','011006','011012','011013','011014','011015','011016','012017','012018','012019','012023','012027','012028','012029','012030','012031','012032','012033','012034','012035','012036','012037','012038','012039','014001','016002','016003','016004','016007','016010','016011','016016','016019','016020','016021','016022','016023','016024','016026','016027','016028','016029','016030','016031','016032','016033','016034','017002','018001','019002','019004','020001','020003','020004','020005','020006','020007','020008','020009','022001','022002','022003','023001','023002','023003','023004','023005','023006','023007','023008','023010','023011','023012','023017','023019','023020','023021','023025','023026','023027','023028','023029','023030','023031','023032','023033','023034','023035','025001','025003','025004','025005','025006','025007','025008','025009','025010','025011','025012','025013','025014','025015','025016','025017','025018','025019','025020','025021','025022','025023','025024','025025','025026','025027','025028','025029','025030','025031','025032','025033','025034','025035','025036','025037','025038','025039','025040','025041','025042','025043','025044','025045','025046','025047','025048','025049','025050','025051','025052','025053','025054','025055','025056','025057','025058','025059','025060','025061','025062','025063','027001','027002','027011','035008','035012','036001','037001','037003','037004','037005','037006','037007','037008','037009','038004','038005','038006','038007','038009','039001','039002','039003','039004','039005','039006','046001','046002','046003','046004','046005','046007','046008','046009','046010','046011','046012','046013','046014','047001','047002','048001','051001','051002','051003','051004','052001','052002','052005','053015','053016','053019','053020','053023','053024','053026','053028','053029','053033','053034','053036','053037','053038','053039','053041','053042','053043','053045','053046','053047','053048','053051','053052','053054','053055','053056','053057','053068','053069','053070','053073','053074','053075','053086','053094','053095','053096','053097','053098','053099','053100','053101','053102','053103','053104','053105','053107','053122','053123','053124','053125','053127','053128','054001','054002','054003','054004','054005','054006','054007','054009','054010','056001','056002','056003','056004','056005','056006','056009','056010','056011','056016','056017','056018','056019','056020','056021','056022','057001','057002','057003','057004','058002','058003','058004','058005','060001','060003','060004','060005','060006','060007','061002','061003','061004','061005','061006','069006','069007','069010','069011','069012','069013','069014','069015','069016','069017','069018','069020','069021','069022','069023','069024','071002','071003','071004','071005','071006','071008','071011','071013','071020','071021','071022','072001','073001','073002','073003','073004','074001','074002','074003','074004','074005','074006','074007','074008','074009','074010','074011','074012','075001','075007','076101','076102','076103','077001','077002','077003','077004','077006','077007','077008','077009','078005','079002','079003','079004','079005','079006','079007','081001','082006','082007','082011','082013','082014','082015','082016','082017','082021','082022','082023','082024','082025','082026','082027','082028','082029','082030','082031','082032','082033','082034','082035','082036','082037','082038','082039','082040','082041','082042','082043','082044','084001','084002','084003','084004','084005','084007','084008','084009','084011','084013','084014','084016','084017','084027','084031','084032','084033','084035','084036','084037','084038','084039','084040','084041','084042','084043','084044','084045','084046','084047','084048','084049','084050','084051','085001','085002','085003','085004','085005','085006','085007','085009','085011','085012','085013','085014','085015','085016','085017','085018','085019','085020','085021','085022','085023','085028','085029','085030','085031','085033','085034','085035','085036','085037','085038','085040','085041','085042','085043','085044','085045','085046','085047','085048','085063','085064','085065','085068','085070','085071','085073','085082','085083','085086','085088','085089','085090','085091','085092','085093','085094','085095','085096','085097','085098','085099','085100','085101','085102','085103','085104','085105','085106','085107','085108','085109','085110','085111','085112','085113','085115','085119','085120','085121','085122','085123','085124','085125','085126','085127','085128','085129','085130','085132','085133','085134','085135','085136','085137','086001','086002','086003','086004','086005','088001','088003','088005','088006','088007','088008','088009','089001','090001','090002','090003','090004','090005','090006','090007','090008','090009','090010','090013','090015','090016','090017','090018','090019','090022','090027','090028','091001','091002','091005','091008','091009','091010','091011','091012','091013','091014','091015','091016','091017','091018','093001','093003','093098','093100','093102','093104','093141','093142','093146','093151','093153','093167','093168','093176','094001','094002','094004','094005','095004','099001','099002','100001','101001','102002','102003','105001','105002','106001','113001','113002','113003','113004','113005','113006','113007','113008','113009','113010','113011','113012','113013','113014','113015','113016','113017','113018','113019','113020','113021','113022','113023','113024','113025','113026','113027','113028','114001','115001','115002','115003','115004','115005','115006','115007','115008','115009','115010','115011','115012','115013','115014','115015','115016','115017','115018','115020','115021','115022','115023','115025','115026','115027','115028','115029','115030','115031','115032','115033','115034','115035','115036','115039','115040','115041','115042','115043','115044','115045','115046','115047','115048','115049','115050','115051','115052','115053','115054','115055','115056','115057','115059','115060','115061','115062','115063','115064','115065','115066','115067','115068','115069','115070','115071','115072','115073','115075','115076','115081','115082','115085','115086','115087','115088','115095','115096','115097','115098','115099','115101','115102','115103','115104','115105','115106','115108','115109','115110','115111','115112','115113','115114','115115','115116','115117','115118','115119','115120','115121','115122','116001','116002','116003','116004','116005','116006','116007','116008','116009','116010','116011','116012','117001','117002','117003','123001','124010','124014','124015','124019','124024','124025','124026','124027','124028','124029','124030','124031','124032','124033','124035','124036','124037','124038','124039','124040','124041','124042','124043','124044','124045','124046','124047','124048','124049','124050','124051','124052','124053','124054','124055','124056','124057','124058','124059','124060','124061','124062','124063','124064','124065','126001','126002','126003','126004','126005','126006','126007','126008','126009','126010','126011','126012','130001','132001','132002','132003','133001','133008','133009','133010','133011','133012','133013','133014','133015','133016','133017','133018','133019','133020','133021','133022','133023','133024','133025','133027','133028','133029','133030','133031','134001','135001','135002','135003','135004','135005','135006','135007','135008','135009','135010','136001','137009','137010','137011','137012','137013','137014','137015','137016','137017','137018','137019','138001','138002','138003','138004','139001','139003','140001','141001','141002','141003','141006','141007','141008','141009','141011','141012','141014','141015','141016','141017','141018','141019','141020','141021','141022','141023','141024','141025','141026','141027','141028','142001','142002','142003','142004','142005','142006','142007','142008','142010','142011','142012','144001','145001','145002','145003','145004','145005','145006','145007','145008','145009','145010','145011','145012','145013','145014','145015','145016','147001','150003','150005','150009','150013','150014','150015','150016','150017','150020','150021','152001','152002','152003','152004','152005','152006','152007','154001','154002','154003','155001','155002','155003','155004','155005','155006','159001','159002','159003','159004','160001','160002','160003','161001','162001','162002','162003','162004','162007','162010','162011','162012','163001','163002','163003','163005','163010','163011','163014','163015','163016','165001','165002','165003','165004','165005','165006','165007','165008','165009','165010','165011','165012','165013','165014','165015','165016','165017','165018','165019','165020','165021','165022','165023','165024','165025','165026','165027','165028','165029','165030','165031','165032','165033','165034','165035','165036','167001','168001','168002','168003','168004','168005','168007','168008','168009','168010','168011','168012','168013','168014','169001','169002','169003','169007','169008','169009','169010','170001','171001','171002','171003','171004','171005','171006','171007','171008','171009','172001','174001','174002','174003','176001','176002','176003','177001','177002','179001','179002','179003','179004','179005','179006','179007','179008','179009','179010','179011','179012','179013','179014','179015','179016','179017','179018','179019','179020','179021','179022','179023','179024','179025','179026','179027','179028','179029','179030','179031','179032','179033','179034','179035','179036','179037','179038','179039','179040','179041','179042','179043','179044','179045','179046','179047','180001','180010','180012','180013','180014','180015','180016','180017','180018','180019','180020','180021','180022','180023','180024','180025','180026','180027','180028','180030','180031','180032','180033','180034','180035','180036','180037','180038','180039','180041','180042','180043','180044','180045','180046','180047','180048','180049','180050','180051','180052','180053','180054','180055','180056','180057','180058','180059','180060','180061','180062','180063','180064','180065','180066','180067','180068','180069','180070','180071','182001','184001','184002','184005','184006','184007','184008','184009','184010','184011','185001','185003','187001','188001','188002','188003','188004','188005','188006','188007','188008','188009','188010','188011','191001','191002','192002','194001','194002','194003','194004','194005','194006','194007','195001','195002','195003','195004','195005','195006','195007','196001','196002','197001','197002','197003','197004','197005','197006','198001','198003','198004','198005','198006','198007','198008','198009','198010','198011','198012','198013','198014','198015','198016','198017','201001','201002','201005','202001','203001','203002','203003','203017','203018','203019','204001','204002','204003','205001','208001','208002','208003','208004','208005','209001','209002','209003','210001','210002','210003','210004','210005','210006','210007','210008','210009','210010','210011','210012','210013','211017','212001','212002','212003','212004','212005','212006','212007','212008','212009','212010','212011','212012','212013','218001','218003','218004','218006','218007','218008','218009','218011','218015','218016','218017','218018','218019','218020','218021','218022','218023','218024','218025','218026','218027','218028','218029','218030','218031','218032','218033','218034','218035','218036','221001','221002','221003','221004','221005','221006','221007','221008','221009','221010','221011','221012','221013','223001','223002','223003','224001','224002','224003','224006','224007','224008','225001','225002','225003','225004','225005','225006','225007','225008','225009','225010','225011','225012','225013','226001','226002','226003','226004','226005','226006','226007','226008','226009','227001','227002','227003','227004','227005','227006','227007','227008','227009','227010','227011','227012','227013','227014','227015','227016','227017','227018','227019','227020','227021','227022','227023','227024','227025','227026','227027','227028','227029','227030','227031','227032','227033','227034','227035','227036','227037','227038','227039','227040','227041','227042','227043','227044','227045','227046','227047','227048','227049','227050','227051','227052','227053','227054','227055','227056','227057','227058','227059','227060','227061','227062','227063','227064','227065','227066','227067','227068','227069','227070','227071','227072','227073','227074','227075','227076','227077','227078','227079','227080','227081','227082','227083','227084','227085','227086','227087','227088','227089','227090','227091','227092','227093','227094','227095','227096','227097','227098','227099','227100','227101','227102','227103','227104','227105','227106','227107','227108','227109','227110','227111','227112','227113','227114','227115','227116','227117','227118','227119','227120','227122','227123','227124','227125','227126','227127','227128','227129','227130','227131','227132','227133','227134','227135','227136','227137','227138','227139','227140','227141','227142','227143','227144','227145','227146','227147','227148','227149','227150','227151','227152','228001','229001','229002','229003','229004','229005','230001','230002','232001','233001','233002','233003','233004','233005','233006','233007','233008','234001','234002','234003','234004','234005','234006','234007','234008','234009','234010','234011','234012','234013','234014','234015','234016','234017','234018','234019','234020','234021','234022','234023','234024','234025','234026','234027','234028','234029','234030','235001','235002','235003','235004','235005','236001','236002','236003','237001','238002','238003','238004','238005','238006','238007','238008','333013','333014','333015','333016','333017','333018','333019','333020','333021','333022','333023','333024','333025','333030','333031','333032','333033','333034','333035','334001','334002','334003','334004','334005','334006','334007','336004','337001','337002','337003','337004','339001','339002','343001','344001','344002','344003','344004','344005','345001','345002','345003','347001','347002','348001','348002','348003','348004','348005','349001','349002','349003','350001','353001','353002','353003','353004','355001','355002','355003','355004','355005','355006','356001','358001','359001','359002','360001','360002','360003','360004','360005','366001','366002','366003','366004','369001','373001','373002','373003','373004','373005','373006','373007','373008','373009','373010','373011','373012','373013','373014','373015','373016','373017','373018','373019','373020','373021','374001','374002','374003','374004','374005','374006','374007','374008','374009','374010','374011','374012','374013','374014','374015','374016','376001','376002','376003','376004','376005','376006','376007','376008','376009','376010','376011','376012','376013','376016','376017','376018','376019','376020','376021','379003','382001','382002','383001','384001','384002','385001','385002','386001','386002','386003','386004','386005','386006','386007','386008','386009','386010','386011','386012','386013','386014','387001','389001','389002','389003','389004','392001','393001','393002','393003','393004','395001','396001','397001','397002','399001','399002','399003','400001','400002','401001','401002','401003','402001','402002','402003','402004','402005','403001','403002','403003','504001','504002','504004','504005','504006','504007','504008','504009','504010','504011','504012','504013','504014','504017','504018','504019','504021','504022','504023','504024','504025','506001','506002','508001','508002','511001','511002','511003','511004','511005','511006','511007','511008','511009','511010','511011','511012','511013','511014','511017','511018','511020','511021','511022','511024','511028','511029','513001','513002','513003','513004','514001','515001','515002','515003','515007','515008','515009','515010','515011','515012','515013','515014','515015','518001','518002','518003','520001','520002','521001','521002','521003','521004','521005','521006','521007','521008','521009','521010','521011','521012','521013','521014','521015','521016','523001','523002','523003','523004','523005','523006','523007','524001','700001','701001','701002','701003','702001','702002','702003','702004','702005','702006','702007','702008','703001','703002','703003','704001','704002','704003','704004','705001','706001','706002','707001','707002','707003','708001','709001','709002','710001','710002','711001','711002','712001','713001','713002','714001','714002','715001','716001','718001','718002','719001','719002','991001','991002','991003','991004','991005','991006','991007','991008','992001','995001','996001','996002','996003','998001','998002','998003','998004','998005','998006','998007','999001','999002','011017','011018','034001','034002','071010','208006','239001','519001','519003','126013','184012','053071','374017','374018','374019','374020','374021','404001','405002','405001','405003','405007','405006','405005','405004','240011','240010','240009','240008','240007','240006','240005','240004','240003','240002','240001','240012','240013','240014','240015','240016','240017','357001','235006','235007','712002','355008','355007','056023','999999','046015','019005','126014','241003','241002','241001','240018','240020','240019','242001','242002','242003','242004','242005','242006','089002','406001','406002','406003','406004','406005','406006','243001','243002','243003','243004','243005','243006','243007','243008','010030','010029','407001','407006','407005','407004','407003','407002','408001','366005','133032','016035','077010','996004','025064','011019','407007','407008','407009','409001','115123','504026','039007','039009','039008','039010','039011','039012','180072','240021','240023','408002','405008','235008','525001','525002','525003','525004','410001','410002','410003','410004','410005','410006','410007','410008','410009','410010','410011','410012','410013','410014','410015','410016','344006','240031','240030','240029','240028','240027','240026','240025','240024','240034','240033','240032','410017','410018','411001','411002','411003','411004','411005','411006','411007','411008','203020','203021','203022','412001','412002','412003','412004','069025','244001','244002','244009','244008','244007','244006','244005','244004','244003','244015','244014','244013','244012','244011','244010','244016','244017','240042','240041','240040','240039','240038','240037','240036','240035','405009','405010','240043','504034','504033','504032','504031','504030','504029','504028','504027','504042','504041','504040','504039','504038','504037','504036','504035','800001','410019','410020','410021','244018','244019','244020','399004','413001','504043','198018','198019','344007','082045','010031','010032','010033','010034','010035','504044','515016','801002','801003','801004','801005','802001','801001','414001','414002','414003','141029','141030','803001','803002','803003','803004','803005','803006','803007','803008','803009','803010','803011','803012','803013','803014','803015','803016','803017','410022','410023','803018','803019','803020','415002','415001','244021','011020','011023','011022','011021','025065','165037','165038','165039','416001','416002','416003','417001','418001','504045','803022','803021','240022','419001','420001','804010','804009','804008','804007','804006','804005','804004','804003','804002','804001','804020','804019','804018','804017','804016','804015','804014','804013','804012','804011','804024','804021','804023','804022','511019','511016','511015','511032','511031','511030','511027','511026','511025','511033','511023','133034','133033','169011','344008','344009','244022','244026','244025','244030','244023','244024','244027','244028','244029','244031','082046','082047','082048','126015','126016','416004','416005','421001','421002','016037','016036','115124','115125','115126','240049','240048','240047','240046','240045','240044','244032','244033','422001','422002','422003','422004','422005','184013','239002','805001','805002','805003','805004','805005','056024','423001','344010','235009','212014','056025','056026','802002','244034','244035','244036','244037','244038','244039','515017','504046','203015','245002','245001','071023','056027','056028','056029','056030','056031','056032','424001','056034','056033','805006','805007','805008','805009','805010','422008','422007','422006','422010','422009','422011','209004','150022','150023','100002','056035','023036','185004','185005','246001','247001','247002','425001','416006','165042','165041','165040','165043','010040','010039','010038','010037','010036','422012','422013','422014','422015','426000','248001','248002','248003','248004','248005','249001','249002','249003','249004','249005','249006','250007','250001','250002','250003','250004','250005','250006','250008','250009','250010','250011','250012','250013','251001','251002','422016','422017','422018','806001','806002','116013','235010','235011','091026','091027','091028','091029','091019','091020','091021','091022','091023','091024','091025','252001','243009','249007','249008','249009','011024','011025','427001','428002','428001','169012','429001','429002','429003') DEFAULT '001001' NOT NULL, KEY field (field) diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test index 23941ad2913..f6281ca6c21 100644 --- a/mysql-test/t/type_float.test +++ b/mysql-test/t/type_float.test @@ -2,11 +2,14 @@ # ----------- # Numeric floating point. +--disable_warnings +drop table if exists t1; +--enable_warnings + SELECT 10,10.0,10.,.1e+2,100.0e-1; SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000; SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1; -drop table if exists t1; create table t1 (f1 float(24),f2 float(52)); show full columns from t1; insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150); @@ -44,6 +47,8 @@ drop table t1; # Errors -!$1063 create table t1 (f float(54)); # Should give an error +--error 1063 +create table t1 (f float(54)); # Should give an error +--disable_warnings drop table if exists t1; - +--enable_warnings diff --git a/mysql-test/t/type_ranges.test b/mysql-test/t/type_ranges.test index a07a1d97f37..53bfb063b2c 100644 --- a/mysql-test/t/type_ranges.test +++ b/mysql-test/t/type_ranges.test @@ -2,7 +2,9 @@ # Test ranges for all types and some other basic tests # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings CREATE TABLE t1 ( auto int(5) unsigned DEFAULT 0 NOT NULL auto_increment, diff --git a/mysql-test/t/type_set.test b/mysql-test/t/type_set.test index 7f1a75e5dbd..4505e3f747b 100644 --- a/mysql-test/t/type_set.test +++ b/mysql-test/t/type_set.test @@ -2,7 +2,10 @@ # Test of SET with space # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a set (' ','a','b') not null); show create table t1; drop table t1; diff --git a/mysql-test/t/type_time.test b/mysql-test/t/type_time.test index 2496ec36915..2f342f8bf67 100644 --- a/mysql-test/t/type_time.test +++ b/mysql-test/t/type_time.test @@ -1,7 +1,11 @@ # # testing of the TIME column type # + +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (t time); insert into t1 values("10:22:33"),("12:34:56.78"),(10),(1234),(123456.78),(1234559.99),("1"),("1:23"),("1:23:45"), ("10.22"), ("-10 1:22:33.45"),("20 10:22:33"),("1999-02-03 20:33:34"); insert t1 values (30),(1230),("1230"),("12:30"),("12:30:35"),("1 12:30:31.32"); diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test index c51d439fde4..1c9275ecd0a 100644 --- a/mysql-test/t/type_timestamp.test +++ b/mysql-test/t/type_timestamp.test @@ -2,7 +2,10 @@ # Test timestamp # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + CREATE TABLE t1 (a int, t timestamp); CREATE TABLE t2 (a int, t datetime); SET TIMESTAMP=1234; diff --git a/mysql-test/t/type_uint.test b/mysql-test/t/type_uint.test index 32bcd61ecdb..b4c88eae95d 100644 --- a/mysql-test/t/type_uint.test +++ b/mysql-test/t/type_uint.test @@ -2,7 +2,10 @@ # test of unsigned int # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (this int unsigned); insert into t1 values (1); insert into t1 values (-1); diff --git a/mysql-test/t/type_year.test b/mysql-test/t/type_year.test index 8f4f23badb4..9922df447fc 100644 --- a/mysql-test/t/type_year.test +++ b/mysql-test/t/type_year.test @@ -1,7 +1,10 @@ # # Test year # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (y year,y2 year(2)); insert into t1 values (0,0),(1999,1999),(2000,2000),(2001,2001),(70,70),(69,69); select * from t1; diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index 449bafbdef6..b46f54c5c41 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -2,7 +2,10 @@ # Test of unions # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings + CREATE TABLE t1 (a int not null, b char (10) not null); insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c'); CREATE TABLE t2 (a int not null, b char (10) not null); @@ -88,7 +91,7 @@ SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION SELECT pseudo FROM t1 WHERE pse SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION ALL SELECT pseudo FROM t1 WHERE pseudo1='joce'; SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION SELECT 1; drop table t1; -drop table if exists t1,t2; + create table t1 (a int); create table t2 (a int); insert into t1 values (1),(2),(3),(4),(5); diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test index 24620982cda..31d22c1f850 100644 --- a/mysql-test/t/update.test +++ b/mysql-test/t/update.test @@ -2,7 +2,10 @@ # test of updating of keys # -drop table if exists t1; +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + create table t1 (a int auto_increment , primary key (a)); insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); update t1 set a=a+10 where a > 34; diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index bb1a9b59611..6260db8c370 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -1,11 +1,15 @@ -error 1054; +# Initialise +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + +--error 1054 set @a := foo; set @a := connection_id() + 3; select @a - connection_id(); # Check using and setting variables with SELECT DISTINCT -drop table if exists t1,t2; CREATE TABLE t1 ( i int not null, v int not null,index (i)); insert into t1 values (1,1),(1,3),(2,1); create table t2 (i int not null, unique (i)); diff --git a/mysql-test/t/varbinary.test b/mysql-test/t/varbinary.test index cc9ee99b7f9..d58954a189b 100644 --- a/mysql-test/t/varbinary.test +++ b/mysql-test/t/varbinary.test @@ -1,3 +1,8 @@ +# Initialise +--disable_warnings +drop table if exists t1; +--enable_warnings + # # varbinary as string and number # @@ -10,7 +15,6 @@ select x'31',X'ffff'+0; # Test of hex constants in WHERE: # -drop table if exists t1; create table t1 (ID int(8) unsigned zerofill not null auto_increment,UNIQ bigint(21) unsigned zerofill not null,primary key (ID),unique (UNIQ) ); insert into t1 set UNIQ=0x38afba1d73e6a18a; insert into t1 set UNIQ=123; diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 5863cb97d57..39aa5a20a71 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -1,7 +1,10 @@ # # test variables # -drop table if exists t1; +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + set @`test`=1,@TEST=3,@select=2,@t5=1.23456; select @test,@`select`,@TEST,@not_used; set @test_int=10,@test_double=1e-10,@test_string="abcdeghi",@test_string2="abcdefghij",@select=NULL; @@ -229,7 +232,6 @@ set log_warnings=1; # key buffer # -DROP TABLE IF EXISTS t1,t2; create table t1 (a int not null auto_increment, primary key(a)); create table t2 (a int not null auto_increment, primary key(a)); insert into t1 values(null),(null),(null); diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test index 5fb536def71..eeb45eaba56 100644 --- a/mysql-test/t/warnings.test +++ b/mysql-test/t/warnings.test @@ -1,7 +1,10 @@ # # Test some warnings # +--disable-warnings drop table if exists t1; +--enable-warnings + create table t1 (a int); insert into t1 values (1); insert into t1 values ("hej"); @@ -11,3 +14,8 @@ insert into t1 values ("hej"); insert into t1 values ("hej"),("då"); drop table t1; set SQL_WARNINGS=0; + +# +# Test other warnings + +drop temporary table if exists not_exists; diff --git a/mysys/my_vsnprintf.c b/mysys/my_vsnprintf.c index 2af5bf8903d..f6c91c0c329 100644 --- a/mysys/my_vsnprintf.c +++ b/mysys/my_vsnprintf.c @@ -24,8 +24,11 @@ int my_snprintf(char* to, size_t n, const char* fmt, ...) { va_list args; + int result; va_start(args,fmt); - return my_vsnprintf(to, n, fmt, args); + result= my_vsnprintf(to, n, fmt, args); + va_end(args); + return result; } int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) diff --git a/readline/terminal.c b/readline/terminal.c index 397b10a1d46..23cba49940d 100644 --- a/readline/terminal.c +++ b/readline/terminal.c @@ -85,7 +85,7 @@ static int tcap_initialized; extern # endif /* __EMX__ || NEED_EXTERN_PC */ char PC; -char *BC, *UP; +const char *BC, *UP; #endif /* __linux__ */ /* Some strings to control terminal actions. These are output by tputs (). */ diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index adc2e0db195..5d57e9cdf9b 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -512,7 +512,8 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked) file->app_private= (void*) (table->key_info+table->primary_key); if ((error= txn_begin(db_env, 0, (DB_TXN**) &transaction, 0)) || (error= (file->open(file, transaction, - fn_format(name_buff, name, "", ha_berkeley_ext, 2 | 4), + fn_format(name_buff, name, "", ha_berkeley_ext, + 2 | 4), "main", DB_BTREE, open_mode, 0))) || (error= transaction->commit(transaction, 0))) { @@ -1950,10 +1951,13 @@ int ha_berkeley::rename_table(const char * from, const char * to) if ((error= db_create(&file, db_env, 0))) my_errno= error; else + { + /* On should not do a file->close() after rename returns */ error= file->rename(file, fn_format(from_buff, from, "", ha_berkeley_ext, 2 | 4), NULL, fn_format(to_buff, to, "", ha_berkeley_ext, 2 | 4), 0); + } return error; } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index fa9514c63b7..182e69653f8 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -527,7 +527,8 @@ int check_insert_fields(THD *thd,TABLE *table,List &fields, /* sql_error.cc */ void push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, uint code, const char *msg); -void store_warning(THD *thd, uint errcode, ...); +void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level, + uint code, const char *format, ...); void mysql_reset_errors(THD *thd); my_bool mysqld_show_warnings(THD *thd, ulong levels_to_show); diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 7ff4caf356c..d4bd521cca5 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -333,7 +333,8 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) } else { - store_warning(thd,ER_DB_DROP_EXISTS,db); + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_DB_DROP_EXISTS, ER(ER_DB_DROP_EXISTS), db); if (!silent) send_ok(thd,0); } diff --git a/sql/sql_error.cc b/sql/sql_error.cc index c9684855b86..5508be5167a 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -105,31 +105,29 @@ void push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, uint code, } /* - Store warning to the list + Push the warning/error to error list if there is still room in the list + + SYNOPSIS + push_warning_printf() + thd Thread handle + level Severity of warning (note, warning, error ...) + code Error number + msg Clear error message */ -void store_warning(THD *thd, uint errcode, ...) +void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level, + uint code, const char *format, ...) { -#if TESTS_TO_BE_FIXED va_list args; - const char *format; char warning[ERRMSGSIZE+20]; - DBUG_ENTER("store_warning"); - DBUG_PRINT("enter",("warning: %u",errcode)); + DBUG_ENTER("push_warning_printf"); + DBUG_PRINT("enter",("warning: %u", code)); - va_start(args,errcode); - if (errcode) - format= ER(errcode); - else - { - format=va_arg(args,char*); - errcode= ER_UNKNOWN_ERROR; - } - (void) vsprintf (warning,format,args); + va_start(args,format); + my_vsnprintf(warning, sizeof(warning), format, args); va_end(args); - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, errcode, warning); + push_warning(thd, level, code, warning); DBUG_VOID_RETURN; -#endif } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 1f4657fb55f..7f46311cd85 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -184,7 +184,9 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, if (drop_temporary || access(path,F_OK)) { if (if_exists) - store_warning(thd, ER_BAD_TABLE_ERROR, table->real_name); + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), + table->real_name); else error= 1; } From f4f3adc0ada31edddc3f96cac9b2897147588a86 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Jan 2003 02:41:53 +0200 Subject: [PATCH 170/220] merge post fix --- mysql-test/r/func_str.result | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 429574575f1..b3468586f32 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -170,8 +170,8 @@ quote(concat('abc\'', '\\cba')) select quote(1/0), quote('\0\Z'); quote(1/0) quote('\0\Z') NULL '\0\Z' -select length(quote(concat(char(0), "test"))); -length(quote(concat(char(0), "test"))) +select length(quote(concat(char(0),"test"))); +length(quote(concat(char(0),"test"))) 8 select reverse(""); reverse("") From ef62b4c948d68108c0945ebde33540b03b392a6d Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Jan 2003 11:44:18 +0200 Subject: [PATCH 171/220] Updated test results --- mysql-test/r/subselect.result | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 29f70973611..04bf0575db3 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -852,3 +852,5 @@ select @a; drop table t1; do (SELECT a from t1); Table 'test.t1' doesn't exist +set @a:=(SELECT a from t1); +Table 'test.t1' doesn't exist From 9497c997041e20baab3ebaa985c9e29235fdf0ca Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Jan 2003 22:07:25 +0200 Subject: [PATCH 172/220] buf0buf.c, buf0buf.ic, buf0buf.h: Reduce memory usage of the buffer headers Many files: Merge InnoDB-4.1 with AWE support sql/mysqld.cc: Merge InnoDB-4.1 with AWE support sql/set_var.cc: Merge InnoDB-4.1 with AWE support sql/ha_innodb.h: Merge InnoDB-4.1 with AWE support sql/ha_innodb.cc: Merge InnoDB-4.1 with AWE support innobase/btr/btr0cur.c: Merge InnoDB-4.1 with AWE support innobase/btr/btr0pcur.c: Merge InnoDB-4.1 with AWE support innobase/buf/buf0flu.c: Merge InnoDB-4.1 with AWE support innobase/buf/buf0lru.c: Merge InnoDB-4.1 with AWE support innobase/buf/buf0rea.c: Merge InnoDB-4.1 with AWE support innobase/include/btr0pcur.h: Merge InnoDB-4.1 with AWE support innobase/include/buf0lru.h: Merge InnoDB-4.1 with AWE support innobase/include/log0recv.h: Merge InnoDB-4.1 with AWE support innobase/include/os0proc.h: Merge InnoDB-4.1 with AWE support innobase/include/srv0srv.h: Merge InnoDB-4.1 with AWE support innobase/log/log0log.c: Merge InnoDB-4.1 with AWE support innobase/log/log0recv.c: Merge InnoDB-4.1 with AWE support innobase/os/os0file.c: Merge InnoDB-4.1 with AWE support innobase/os/os0proc.c: Merge InnoDB-4.1 with AWE support innobase/srv/srv0srv.c: Merge InnoDB-4.1 with AWE support innobase/srv/srv0start.c: Merge InnoDB-4.1 with AWE support innobase/trx/trx0sys.c: Merge InnoDB-4.1 with AWE support innobase/trx/trx0trx.c: Merge InnoDB-4.1 with AWE support innobase/ut/ut0ut.c: Merge InnoDB-4.1 with AWE support innobase/include/buf0buf.h: Reduce memory usage of the buffer headers innobase/include/buf0buf.ic: Reduce memory usage of the buffer headers innobase/buf/buf0buf.c: Reduce memory usage of the buffer headers --- innobase/btr/btr0cur.c | 7 +- innobase/btr/btr0pcur.c | 42 +++- innobase/buf/buf0buf.c | 307 ++++++++++++++++++++---- innobase/buf/buf0flu.c | 46 +++- innobase/buf/buf0lru.c | 62 ++++- innobase/buf/buf0rea.c | 2 +- innobase/include/btr0pcur.h | 3 + innobase/include/buf0buf.h | 120 ++++++++-- innobase/include/buf0buf.ic | 119 +++++---- innobase/include/buf0lru.h | 4 +- innobase/include/log0recv.h | 7 +- innobase/include/os0proc.h | 70 ++++++ innobase/include/srv0srv.h | 3 + innobase/log/log0log.c | 36 ++- innobase/log/log0recv.c | 24 +- innobase/os/os0file.c | 2 +- innobase/os/os0proc.c | 464 +++++++++++++++++++++++++++++++++++- innobase/srv/srv0srv.c | 38 ++- innobase/srv/srv0start.c | 41 +++- innobase/trx/trx0sys.c | 6 +- innobase/trx/trx0trx.c | 2 +- innobase/ut/ut0ut.c | 1 + sql/ha_innodb.cc | 23 +- sql/ha_innodb.h | 3 +- sql/mysqld.cc | 5 + sql/set_var.cc | 1 + 26 files changed, 1252 insertions(+), 186 deletions(-) diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c index 24f0447d55d..e1d12c9adc4 100644 --- a/innobase/btr/btr0cur.c +++ b/innobase/btr/btr0cur.c @@ -291,6 +291,7 @@ btr_cur_search_to_nth_level( && latch_mode <= BTR_MODIFY_LEAF && info->last_hash_succ && !estimate && mode != PAGE_CUR_LE_OR_EXTENDS + && srv_use_adaptive_hash_indexes && btr_search_guess_on_hash(index, info, tuple, mode, latch_mode, cursor, has_search_latch, mtr)) { @@ -495,9 +496,11 @@ retry_page_get: cursor->up_bytes = up_bytes; #ifdef BTR_CUR_ADAPT - btr_search_info_update(index, cursor); -#endif + if (srv_use_adaptive_hash_indexes) { + btr_search_info_update(index, cursor); + } +#endif ut_ad(cursor->up_match != ULINT_UNDEFINED || mode != PAGE_CUR_GE); ut_ad(cursor->up_match != ULINT_UNDEFINED diff --git a/innobase/btr/btr0pcur.c b/innobase/btr/btr0pcur.c index b2115dfdd6c..13efacb9da3 100644 --- a/innobase/btr/btr0pcur.c +++ b/innobase/btr/btr0pcur.c @@ -95,7 +95,9 @@ btr_pcur_store_position( ut_a(cursor->latch_mode != BTR_NO_LATCHES); if (page_get_n_recs(page) == 0) { - /* It must be an empty index tree */ + /* It must be an empty index tree; NOTE that in this case + we do not store the modify_clock, but always do a search + if we restore the cursor position */ ut_a(btr_page_get_next(page, mtr) == FIL_NULL && btr_page_get_prev(page, mtr) == FIL_NULL); @@ -128,12 +130,13 @@ btr_pcur_store_position( } else { cursor->rel_pos = BTR_PCUR_ON; } - + cursor->old_stored = BTR_PCUR_OLD_STORED; cursor->old_rec = dict_tree_copy_rec_order_prefix(tree, rec, &(cursor->old_rec_buf), &(cursor->buf_size)); + cursor->block_when_stored = buf_block_align(page); cursor->modify_clock = buf_frame_get_modify_clock(page); } @@ -205,6 +208,9 @@ btr_pcur_restore_position( if (cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE || cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE) { + /* In these cases we do not try an optimistic restoration, + but always do a search */ + if (cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE) { from_left = TRUE; } else { @@ -214,6 +220,10 @@ btr_pcur_restore_position( btr_cur_open_at_index_side(from_left, btr_pcur_get_btr_cur(cursor)->index, latch_mode, btr_pcur_get_btr_cur(cursor), mtr); + + cursor->block_when_stored = + buf_block_align(btr_pcur_get_page(cursor)); + return(FALSE); } @@ -224,8 +234,9 @@ btr_pcur_restore_position( if (latch_mode == BTR_SEARCH_LEAF || latch_mode == BTR_MODIFY_LEAF) { /* Try optimistic restoration */ - if (buf_page_optimistic_get(latch_mode, page, - cursor->modify_clock, mtr)) { + if (buf_page_optimistic_get(latch_mode, + cursor->block_when_stored, page, + cursor->modify_clock, mtr)) { cursor->pos_state = BTR_PCUR_IS_POSITIONED; buf_page_dbg_add_level(page, SYNC_TREE_NODE); @@ -270,8 +281,6 @@ btr_pcur_restore_position( btr_pcur_open_with_no_init(btr_pcur_get_btr_cur(cursor)->index, tuple, mode, latch_mode, cursor, 0, mtr); - - cursor->old_stored = BTR_PCUR_OLD_STORED; /* Restore the old search mode */ cursor->search_mode = old_mode; @@ -280,11 +289,18 @@ btr_pcur_restore_position( && btr_pcur_is_on_user_rec(cursor, mtr) && 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor))) { - /* We have to store the NEW value for the modify clock, since - the cursor can now be on a different page! */ + /* We have to store the NEW value for the modify clock, since + the cursor can now be on a different page! But we can retain + the value of old_rec */ + + cursor->modify_clock = + buf_frame_get_modify_clock(btr_pcur_get_page(cursor)); + + cursor->block_when_stored = + buf_block_align(btr_pcur_get_page(cursor)); + + cursor->old_stored = BTR_PCUR_OLD_STORED; - cursor->modify_clock = buf_frame_get_modify_clock( - buf_frame_align(btr_pcur_get_rec(cursor))); mem_heap_free(heap); return(TRUE); @@ -292,6 +308,12 @@ btr_pcur_restore_position( mem_heap_free(heap); + /* We have to store new position information, modify_clock etc., + to the cursor because it can now be on a different page, the record + under it may have been removed, etc. */ + + btr_pcur_store_position(cursor, mtr); + return(FALSE); } diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c index c9a5ec5307f..58c4ca5271b 100644 --- a/innobase/buf/buf0buf.c +++ b/innobase/buf/buf0buf.c @@ -196,7 +196,29 @@ If a new page is referenced in the buf_pool, and several pages of its random access area (for instance, 32 consecutive pages in a tablespace) have recently been referenced, we may predict that the whole area may be needed in the near future, and issue -the read requests for the whole area. */ +the read requests for the whole area. + + AWE implementation + ------------------ + +By a 'block' we mean the buffer header of type buf_block_t. By a 'page' +we mean the physical 16 kB memory area allocated from RAM for that block. +By a 'frame' we mean a 16 kB area in the virtual address space of the +process, in the frame_mem of buf_pool. + +We can map pages to the frames of the buffer pool. + +1) A buffer block allocated to use as a non-data page, e.g., to the lock +table, is always mapped to a frame. +2) A bufferfixed or io-fixed data page is always mapped to a frame. +3) When we need to map a block to frame, we look from the list +awe_LRU_free_mapped and try to unmap its last block, but note that +bufferfixed or io-fixed pages cannot be unmapped. +4) For every frame in the buffer pool there is always a block whose page is +mapped to it. When we create the buffer pool, we map the first elements +in the free list to the frames. +5) When we have AWE enabled, we disable adaptive hash indexes. +*/ buf_pool_t* buf_pool = NULL; /* The buffer buf_pool of the database */ @@ -346,12 +368,15 @@ void buf_block_init( /*===========*/ buf_block_t* block, /* in: pointer to control block */ - byte* frame) /* in: pointer to buffer frame */ + byte* frame) /* in: pointer to buffer frame, or NULL if in + the case of AWE there is no frame */ { block->state = BUF_BLOCK_NOT_USED; block->frame = frame; + block->awe_info = NULL; + block->modify_clock = ut_dulint_zero; block->file_page_was_freed = FALSE; @@ -364,29 +389,37 @@ buf_block_init( rw_lock_create(&(block->read_lock)); rw_lock_set_level(&(block->read_lock), SYNC_NO_ORDER_CHECK); +#ifdef UNIV_SYNC_DEBUG rw_lock_create(&(block->debug_latch)); rw_lock_set_level(&(block->debug_latch), SYNC_NO_ORDER_CHECK); +#endif } /************************************************************************ -Creates a buffer buf_pool object. */ -static +Creates the buffer pool. */ + buf_pool_t* -buf_pool_create( -/*============*/ +buf_pool_init( +/*==========*/ /* out, own: buf_pool object, NULL if not - enough memory */ + enough memory or error */ ulint max_size, /* in: maximum size of the buf_pool in blocks */ - ulint curr_size) /* in: current size to use, must be <= + ulint curr_size, /* in: current size to use, must be <= max_size, currently must be equal to max_size */ + ulint n_frames) /* in: number of frames; if AWE is used, + this is the size of the address space window + where physical memory pages are mapped; if + AWE is not used then this must be the same + as max_size */ { byte* frame; ulint i; buf_block_t* block; ut_a(max_size == curr_size); + ut_a(srv_use_awe || n_frames == max_size); buf_pool = mem_alloc(sizeof(buf_pool_t)); @@ -396,8 +429,38 @@ buf_pool_create( mutex_set_level(&(buf_pool->mutex), SYNC_BUF_POOL); mutex_enter(&(buf_pool->mutex)); - - buf_pool->frame_mem = ut_malloc(UNIV_PAGE_SIZE * (max_size + 1)); + + if (srv_use_awe) { + /*----------------------------------------*/ + /* Allocate the virtual address space window, i.e., the + buffer pool frames */ + + buf_pool->frame_mem = os_awe_allocate_virtual_mem_window( + UNIV_PAGE_SIZE * (n_frames + 1)); + + /* Allocate the physical memory for AWE and the AWE info array + for buf_pool */ + + if ((curr_size % ((1024 * 1024) / UNIV_PAGE_SIZE)) != 0) { + + fprintf(stderr, +"InnoDB: AWE: Error: physical memory must be allocated in full megabytes.\n" +"InnoDB: Trying to allocate %lu database pages.\n", + curr_size); + + return(NULL); + } + + if (!os_awe_allocate_physical_mem(&(buf_pool->awe_info), + curr_size / ((1024 * 1024) / UNIV_PAGE_SIZE))) { + + return(NULL); + } + /*----------------------------------------*/ + } else { + buf_pool->frame_mem = ut_malloc( + UNIV_PAGE_SIZE * (n_frames + 1)); + } if (buf_pool->frame_mem == NULL) { @@ -414,21 +477,60 @@ buf_pool_create( buf_pool->max_size = max_size; buf_pool->curr_size = curr_size; + buf_pool->n_frames = n_frames; + /* Align pointer to the first frame */ frame = ut_align(buf_pool->frame_mem, UNIV_PAGE_SIZE); - buf_pool->frame_zero = frame; + buf_pool->frame_zero = frame; buf_pool->high_end = frame + UNIV_PAGE_SIZE * curr_size; - /* Init block structs and assign frames for them */ + if (srv_use_awe) { + /*----------------------------------------*/ + /* Map an initial part of the allocated physical memory to + the window */ + + os_awe_map_physical_mem_to_window(buf_pool->frame_zero, + n_frames * + (UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE), + buf_pool->awe_info); + /*----------------------------------------*/ + } + + buf_pool->blocks_of_frames = ut_malloc(sizeof(void*) * n_frames); + + if (buf_pool->blocks_of_frames == NULL) { + + return(NULL); + } + + /* Init block structs and assign frames for them; in the case of + AWE there are less frames than blocks. Then we assign the frames + to the first blocks (we already mapped the memory above). We also + init the awe_info for every block. */ + for (i = 0; i < max_size; i++) { block = buf_pool_get_nth_block(buf_pool, i); + + if (i < n_frames) { + frame = buf_pool->frame_zero + i * UNIV_PAGE_SIZE; + *(buf_pool->blocks_of_frames + i) = block; + } else { + frame = NULL; + } + buf_block_init(block, frame); - frame = frame + UNIV_PAGE_SIZE; + + if (srv_use_awe) { + /*----------------------------------------*/ + block->awe_info = buf_pool->awe_info + + i * (UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE); + /*----------------------------------------*/ + } } - + buf_pool->page_hash = hash_create(2 * max_size); buf_pool->n_pend_reads = 0; @@ -438,12 +540,14 @@ buf_pool_create( buf_pool->n_pages_read = 0; buf_pool->n_pages_written = 0; buf_pool->n_pages_created = 0; - + buf_pool->n_pages_awe_remapped = 0; + buf_pool->n_page_gets = 0; buf_pool->n_page_gets_old = 0; buf_pool->n_pages_read_old = 0; buf_pool->n_pages_written_old = 0; buf_pool->n_pages_created_old = 0; + buf_pool->n_pages_awe_remapped_old = 0; /* 2. Initialize flushing fields ---------------------------- */ @@ -466,40 +570,120 @@ buf_pool_create( buf_pool->LRU_old = NULL; + UT_LIST_INIT(buf_pool->awe_LRU_free_mapped); + /* Add control blocks to the free list */ UT_LIST_INIT(buf_pool->free); + for (i = 0; i < curr_size; i++) { block = buf_pool_get_nth_block(buf_pool, i); - /* Wipe contents of page to eliminate a Purify warning */ - memset(block->frame, '\0', UNIV_PAGE_SIZE); + if (block->frame) { + /* Wipe contents of frame to eliminate a Purify + warning */ - UT_LIST_ADD_FIRST(free, buf_pool->free, block); + memset(block->frame, '\0', UNIV_PAGE_SIZE); + + if (srv_use_awe) { + /* Add to the list of blocks mapped to + frames */ + + UT_LIST_ADD_LAST(awe_LRU_free_mapped, + buf_pool->awe_LRU_free_mapped, block); + } + } + + UT_LIST_ADD_LAST(free, buf_pool->free, block); } mutex_exit(&(buf_pool->mutex)); - btr_search_sys_create(curr_size * UNIV_PAGE_SIZE / sizeof(void*) / 64); + if (srv_use_adaptive_hash_indexes) { + btr_search_sys_create( + curr_size * UNIV_PAGE_SIZE / sizeof(void*) / 64); + } else { + /* Create only a small dummy system */ + btr_search_sys_create(1000); + } return(buf_pool); } /************************************************************************ -Initializes the buffer buf_pool of the database. */ +Maps the page of block to a frame, if not mapped yet. Unmaps some page +from the end of the awe_LRU_free_mapped. */ void -buf_pool_init( -/*==========*/ - ulint max_size, /* in: maximum size of the buf_pool in blocks */ - ulint curr_size) /* in: current size to use, must be <= - max_size */ +buf_awe_map_page_to_frame( +/*======================*/ + buf_block_t* block, /* in: block whose page should be + mapped to a frame */ + ibool add_to_mapped_list) /* in: TRUE if we in the case + we need to map the page should also + add the block to the + awe_LRU_free_mapped list */ { - ut_a(buf_pool == NULL); + buf_block_t* bck; - buf_pool_create(max_size, curr_size); + ut_ad(mutex_own(&(buf_pool->mutex))); + ut_ad(block); - ut_ad(buf_validate()); + if (block->frame) { + + return; + } + + /* Scan awe_LRU_free_mapped from the end and try to find a block + which is not bufferfixed or io-fixed */ + + bck = UT_LIST_GET_LAST(buf_pool->awe_LRU_free_mapped); + + while (bck) { + if (bck->state == BUF_BLOCK_FILE_PAGE + && (bck->buf_fix_count != 0 || bck->io_fix != 0)) { + + /* We have to skip this */ + bck = UT_LIST_GET_PREV(awe_LRU_free_mapped, bck); + } else { + /* We can map block to the frame of bck */ + + os_awe_map_physical_mem_to_window( + bck->frame, + UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE, + block->awe_info); + + block->frame = bck->frame; + + *(buf_pool->blocks_of_frames + + (((ulint)(block->frame + - buf_pool->frame_zero)) + >> UNIV_PAGE_SIZE_SHIFT)) + = block; + + bck->frame = NULL; + UT_LIST_REMOVE(awe_LRU_free_mapped, + buf_pool->awe_LRU_free_mapped, + bck); + + if (add_to_mapped_list) { + UT_LIST_ADD_FIRST(awe_LRU_free_mapped, + buf_pool->awe_LRU_free_mapped, + block); + } + + buf_pool->n_pages_awe_remapped++; + + return; + } + } + + fprintf(stderr, +"InnoDB: AWE: Fatal error: cannot find a page to unmap\n" +"InnoDB: awe_LRU_free_mapped list length %lu\n", + UT_LIST_GET_LEN(buf_pool->awe_LRU_free_mapped)); + + ut_a(0); } /************************************************************************ @@ -508,7 +692,9 @@ UNIV_INLINE buf_block_t* buf_block_alloc(void) /*=================*/ - /* out, own: the allocated block */ + /* out, own: the allocated block; also if AWE + is used it is guaranteed that the page is + mapped to a frame */ { buf_block_t* block; @@ -846,6 +1032,19 @@ loop: } } + /* If AWE is enabled and the page is not mapped to a frame, then + map it */ + + if (block->frame == NULL) { + ut_a(srv_use_awe); + + /* We set second parameter TRUE because the block is in the + LRU list and we must put it to awe_LRU_free_mapped list once + mapped to a frame */ + + buf_awe_map_page_to_frame(block, TRUE); + } + #ifdef UNIV_SYNC_DEBUG buf_block_buf_fix_inc_debug(block, file, line); #else @@ -940,28 +1139,27 @@ buf_page_optimistic_get_func( /*=========================*/ /* out: TRUE if success */ ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH */ - buf_frame_t* guess, /* in: guessed frame */ + buf_block_t* block, /* in: guessed buffer block */ + buf_frame_t* guess, /* in: guessed frame; note that AWE may move + frames */ dulint modify_clock,/* in: modify clock value if mode is ..._GUESS_ON_CLOCK */ char* file, /* in: file name */ ulint line, /* in: line where called */ mtr_t* mtr) /* in: mini-transaction */ { - buf_block_t* block; ibool accessed; ibool success; ulint fix_type; - ut_ad(mtr && guess); + ut_ad(mtr && block); ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH)); - - buf_pool->n_page_gets++; - - block = buf_block_align(guess); mutex_enter(&(buf_pool->mutex)); - if (block->state != BUF_BLOCK_FILE_PAGE) { + /* If AWE is used, block may have a different frame now, e.g., NULL */ + + if (block->state != BUF_BLOCK_FILE_PAGE || block->frame != guess) { mutex_exit(&(buf_pool->mutex)); @@ -1054,12 +1252,15 @@ buf_page_optimistic_get_func( #ifdef UNIV_IBUF_DEBUG ut_a(ibuf_count_get(block->space, block->offset) == 0); #endif + buf_pool->n_page_gets++; + return(TRUE); } /************************************************************************ This is used to get access to a known database page, when no waiting can be -done. */ +done. For example, if a search in an adaptive hash index leads us to this +frame. */ ibool buf_page_get_known_nowait( @@ -1078,13 +1279,11 @@ buf_page_get_known_nowait( ut_ad(mtr); ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH)); - - buf_pool->n_page_gets++; - - block = buf_block_align(guess); mutex_enter(&(buf_pool->mutex)); + block = buf_block_align(guess); + if (block->state == BUF_BLOCK_REMOVE_HASH) { /* Another thread is just freeing the block from the LRU list of the buffer pool: do not try to access this page; this @@ -1152,6 +1351,8 @@ buf_page_get_known_nowait( ut_a((mode == BUF_KEEP_OLD) || (ibuf_count_get(block->space, block->offset) == 0)); #endif + buf_pool->n_page_gets++; + return(TRUE); } @@ -1732,7 +1933,7 @@ buf_print(void) ut_ad(buf_pool); - size = buf_pool_get_curr_size() / UNIV_PAGE_SIZE; + size = buf_pool->curr_size; index_ids = mem_alloc(sizeof(dulint) * size); counts = mem_alloc(sizeof(ulint) * size); @@ -1847,7 +2048,7 @@ buf_print_io( return; } - size = buf_pool_get_curr_size() / UNIV_PAGE_SIZE; + size = buf_pool->curr_size; mutex_enter(&(buf_pool->mutex)); @@ -1866,6 +2067,15 @@ buf_print_io( buf += sprintf(buf, "Modified db pages %lu\n", UT_LIST_GET_LEN(buf_pool->flush_list)); + if (srv_use_awe) { + buf += sprintf(buf, + "AWE: Buffer pool memory frames %lu\n", + buf_pool->n_frames); + + buf += sprintf(buf, + "AWE: Database pages and free buffers mapped in frames %lu\n", + UT_LIST_GET_LEN(buf_pool->awe_LRU_free_mapped)); + } buf += sprintf(buf, "Pending reads %lu \n", buf_pool->n_pend_reads); @@ -1891,6 +2101,13 @@ buf_print_io( (buf_pool->n_pages_written - buf_pool->n_pages_written_old) / time_elapsed); + if (srv_use_awe) { + buf += sprintf(buf, "AWE: %.2f page remaps/s\n", + (buf_pool->n_pages_awe_remapped + - buf_pool->n_pages_awe_remapped_old) + / time_elapsed); + } + if (buf_pool->n_page_gets > buf_pool->n_page_gets_old) { buf += sprintf(buf, "Buffer pool hit rate %lu / 1000\n", 1000 @@ -1906,6 +2123,7 @@ buf_print_io( buf_pool->n_pages_read_old = buf_pool->n_pages_read; buf_pool->n_pages_created_old = buf_pool->n_pages_created; buf_pool->n_pages_written_old = buf_pool->n_pages_written; + buf_pool->n_pages_awe_remapped_old = buf_pool->n_pages_awe_remapped; mutex_exit(&(buf_pool->mutex)); } @@ -1922,6 +2140,7 @@ buf_refresh_io_stats(void) buf_pool->n_pages_read_old = buf_pool->n_pages_read; buf_pool->n_pages_created_old = buf_pool->n_pages_created; buf_pool->n_pages_written_old = buf_pool->n_pages_written; + buf_pool->n_pages_awe_remapped_old = buf_pool->n_pages_awe_remapped; } /************************************************************************* diff --git a/innobase/buf/buf0flu.c b/innobase/buf/buf0flu.c index 78bde60c9b2..02587487a92 100644 --- a/innobase/buf/buf0flu.c +++ b/innobase/buf/buf0flu.c @@ -24,6 +24,7 @@ Created 11/11/1995 Heikki Tuuri #include "log0log.h" #include "os0file.h" #include "trx0sys.h" +#include "srv0srv.h" /* When flushed, dirty blocks are searched in neigborhoods of this size, and flushed along with the original page. */ @@ -103,7 +104,7 @@ buf_flush_ready_for_replace( /*========================*/ /* out: TRUE if can replace immediately */ buf_block_t* block) /* in: buffer control block, must be in state - BUF_BLOCK_FILE_PAGE and in the LRU list*/ + BUF_BLOCK_FILE_PAGE and in the LRU list */ { ut_ad(mutex_own(&(buf_pool->mutex))); ut_ad(block->state == BUF_BLOCK_FILE_PAGE); @@ -134,7 +135,6 @@ buf_flush_ready_for_flush( if ((ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) > 0) && (block->io_fix == 0)) { - if (flush_type != BUF_FLUSH_LRU) { return(TRUE); @@ -436,6 +436,20 @@ buf_flush_try_page( && block && buf_flush_ready_for_flush(block, flush_type)) { block->io_fix = BUF_IO_WRITE; + + /* If AWE is enabled and the page is not mapped to a frame, + then map it */ + + if (block->frame == NULL) { + ut_a(srv_use_awe); + + /* We set second parameter TRUE because the block is + in the LRU list and we must put it to + awe_LRU_free_mapped list once mapped to a frame */ + + buf_awe_map_page_to_frame(block, TRUE); + } + block->flush_type = flush_type; if (buf_pool->n_flush[flush_type] == 0) { @@ -486,6 +500,20 @@ buf_flush_try_page( ..._ready_for_flush). */ block->io_fix = BUF_IO_WRITE; + + /* If AWE is enabled and the page is not mapped to a frame, + then map it */ + + if (block->frame == NULL) { + ut_a(srv_use_awe); + + /* We set second parameter TRUE because the block is + in the LRU list and we must put it to + awe_LRU_free_mapped list once mapped to a frame */ + + buf_awe_map_page_to_frame(block, TRUE); + } + block->flush_type = flush_type; if (buf_pool->n_flush[flush_type] == 0) { @@ -511,6 +539,20 @@ buf_flush_try_page( && buf_flush_ready_for_flush(block, flush_type)) { block->io_fix = BUF_IO_WRITE; + + /* If AWE is enabled and the page is not mapped to a frame, + then map it */ + + if (block->frame == NULL) { + ut_a(srv_use_awe); + + /* We set second parameter TRUE because the block is + in the LRU list and we must put it to + awe_LRU_free_mapped list once mapped to a frame */ + + buf_awe_map_page_to_frame(block, TRUE); + } + block->flush_type = flush_type; if (buf_pool->n_flush[block->flush_type] == 0) { diff --git a/innobase/buf/buf0lru.c b/innobase/buf/buf0lru.c index 2ec1506c522..051aa0191f6 100644 --- a/innobase/buf/buf0lru.c +++ b/innobase/buf/buf0lru.c @@ -132,7 +132,13 @@ buf_LRU_search_and_free_block( mutex_exit(&(buf_pool->mutex)); - btr_search_drop_page_hash_index(block->frame); + /* Remove possible adaptive hash index built on the + page; in the case of AWE the block may not have a + frame at all */ + + if (block->frame) { + btr_search_drop_page_hash_index(block->frame); + } mutex_enter(&(buf_pool->mutex)); @@ -196,7 +202,9 @@ list. */ buf_block_t* buf_LRU_get_free_block(void) /*========================*/ - /* out: the free control block */ + /* out: the free control block; also if AWE is + used, it is guaranteed that the block has its + page mapped to a frame when we return */ { buf_block_t* block = NULL; ibool freed; @@ -257,6 +265,22 @@ loop: block = UT_LIST_GET_FIRST(buf_pool->free); UT_LIST_REMOVE(free, buf_pool->free, block); + + if (srv_use_awe) { + if (block->frame) { + /* Remove from the list of mapped pages */ + + UT_LIST_REMOVE(awe_LRU_free_mapped, + buf_pool->awe_LRU_free_mapped, block); + } else { + /* We map the page to a frame; second param + FALSE below because we do not want it to be + added to the awe_LRU_free_mapped list */ + + buf_awe_map_page_to_frame(block, FALSE); + } + } + block->state = BUF_BLOCK_READY_FOR_USE; mutex_exit(&(buf_pool->mutex)); @@ -429,6 +453,13 @@ buf_LRU_remove_block( /* Remove the block from the LRU list */ UT_LIST_REMOVE(LRU, buf_pool->LRU, block); + if (srv_use_awe && block->frame) { + /* Remove from the list of mapped pages */ + + UT_LIST_REMOVE(awe_LRU_free_mapped, + buf_pool->awe_LRU_free_mapped, block); + } + /* If the LRU list is so short that LRU_old not defined, return */ if (UT_LIST_GET_LEN(buf_pool->LRU) < BUF_LRU_OLD_MIN_LEN) { @@ -475,6 +506,13 @@ buf_LRU_add_block_to_end_low( UT_LIST_ADD_LAST(LRU, buf_pool->LRU, block); + if (srv_use_awe && block->frame) { + /* Add to the list of mapped pages */ + + UT_LIST_ADD_LAST(awe_LRU_free_mapped, + buf_pool->awe_LRU_free_mapped, block); + } + if (UT_LIST_GET_LEN(buf_pool->LRU) >= BUF_LRU_OLD_MIN_LEN) { buf_pool->LRU_old_len++; @@ -518,6 +556,15 @@ buf_LRU_add_block_low( block->old = old; cl = buf_pool_clock_tic(); + if (srv_use_awe && block->frame) { + /* Add to the list of mapped pages; for simplicity we always + add to the start, even if the user would have set 'old' + TRUE */ + + UT_LIST_ADD_FIRST(awe_LRU_free_mapped, + buf_pool->awe_LRU_free_mapped, block); + } + if (!old || (UT_LIST_GET_LEN(buf_pool->LRU) < BUF_LRU_OLD_MIN_LEN)) { UT_LIST_ADD_FIRST(LRU, buf_pool->LRU, block); @@ -613,6 +660,13 @@ buf_LRU_block_free_non_file_page( memset(block->frame, '\0', UNIV_PAGE_SIZE); #endif UT_LIST_ADD_FIRST(free, buf_pool->free, block); + + if (srv_use_awe && block->frame) { + /* Add to the list of mapped pages */ + + UT_LIST_ADD_FIRST(awe_LRU_free_mapped, + buf_pool->awe_LRU_free_mapped, block); + } } /********************************************************************** @@ -639,7 +693,9 @@ buf_LRU_block_remove_hashed_page( buf_pool->freed_page_clock += 1; - buf_frame_modify_clock_inc(block->frame); + /* Note that if AWE is enabled the block may not have a frame at all */ + + buf_block_modify_clock_inc(block); HASH_DELETE(buf_block_t, hash, buf_pool->page_hash, buf_page_address_fold(block->space, block->offset), diff --git a/innobase/buf/buf0rea.c b/innobase/buf/buf0rea.c index 475a5bd9cbd..bb6670296b9 100644 --- a/innobase/buf/buf0rea.c +++ b/innobase/buf/buf0rea.c @@ -576,7 +576,7 @@ buf_read_recv_pages( os_aio_print_debug = FALSE; - while (buf_pool->n_pend_reads >= RECV_POOL_N_FREE_BLOCKS / 2) { + while (buf_pool->n_pend_reads >= recv_n_pool_free_frames / 2) { os_aio_simulated_wake_handler_threads(); os_thread_sleep(500000); diff --git a/innobase/include/btr0pcur.h b/innobase/include/btr0pcur.h index 9d07dd0de18..81f19af4d40 100644 --- a/innobase/include/btr0pcur.h +++ b/innobase/include/btr0pcur.h @@ -466,6 +466,9 @@ struct btr_pcur_struct{ BTR_PCUR_AFTER, depending on whether cursor was on, before, or after the old_rec record */ + buf_block_t* block_when_stored;/* buffer block when the position was + stored; note that if AWE is on, frames + may move */ dulint modify_clock; /* the modify clock value of the buffer block when the cursor position was stored */ diff --git a/innobase/include/buf0buf.h b/innobase/include/buf0buf.h index 395f88a2c7c..c7db3d9bcc9 100644 --- a/innobase/include/buf0buf.h +++ b/innobase/include/buf0buf.h @@ -30,6 +30,7 @@ Created 11/5/1995 Heikki Tuuri #include "sync0rw.h" #include "hash0hash.h" #include "ut0byte.h" +#include "os0proc.h" /* Flags for flush types */ #define BUF_FLUSH_LRU 1 @@ -58,23 +59,34 @@ extern ibool buf_debug_prints;/* If this is set TRUE, the program occurs */ /************************************************************************ -Initializes the buffer pool of the database. */ +Creates the buffer pool. */ -void +buf_pool_t* buf_pool_init( /*==========*/ - ulint max_size, /* in: maximum size of the pool in blocks */ - ulint curr_size); /* in: current size to use, must be <= + /* out, own: buf_pool object, NULL if not + enough memory or error */ + ulint max_size, /* in: maximum size of the buf_pool in + blocks */ + ulint curr_size, /* in: current size to use, must be <= + max_size, currently must be equal to max_size */ + ulint n_frames); /* in: number of frames; if AWE is used, + this is the size of the address space window + where physical memory pages are mapped; if + AWE is not used then this must be the same + as max_size */ /************************************************************************* -Gets the current size of buffer pool in bytes. */ +Gets the current size of buffer buf_pool in bytes. In the case of AWE, the +size of AWE window (= the frames). */ UNIV_INLINE ulint buf_pool_get_curr_size(void); /*========================*/ /* out: size in bytes */ /************************************************************************* -Gets the maximum size of buffer pool in bytes. */ +Gets the maximum size of buffer pool in bytes. In the case of AWE, the +size of AWE window (= the frames). */ UNIV_INLINE ulint buf_pool_get_max_size(void); @@ -138,8 +150,8 @@ improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed as LA! */ NOTE! The following macros should be used instead of buf_page_optimistic_get_func, to improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed as LA! */ -#define buf_page_optimistic_get(LA, G, MC, MTR) buf_page_optimistic_get_func(\ - LA, G, MC, IB__FILE__, __LINE__, MTR) +#define buf_page_optimistic_get(LA, BL, G, MC, MTR) buf_page_optimistic_get_func(\ + LA, BL, G, MC, IB__FILE__, __LINE__, MTR) /************************************************************************ This is the general function used to get optimistic access to a database page. */ @@ -149,7 +161,9 @@ buf_page_optimistic_get_func( /*=========================*/ /* out: TRUE if success */ ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH */ - buf_frame_t* guess, /* in: guessed frame */ + buf_block_t* block, /* in: guessed block */ + buf_frame_t* guess, /* in: guessed frame; note that AWE may move + frames */ dulint modify_clock,/* in: modify clock value if mode is ..._GUESS_ON_CLOCK */ char* file, /* in: file name */ @@ -350,6 +364,16 @@ buf_frame_modify_clock_inc( /* out: new value */ buf_frame_t* frame); /* in: pointer to a frame */ /************************************************************************ +Increments the modify clock of a frame by 1. The caller must (1) own the +buf_pool mutex and block bufferfix count has to be zero, (2) or own an x-lock +on the block. */ +UNIV_INLINE +dulint +buf_block_modify_clock_inc( +/*=======================*/ + /* out: new value */ + buf_block_t* block); /* in: block */ +/************************************************************************ Returns the value of the modify clock. The caller must have an s-lock or x-lock on the block. */ UNIV_INLINE @@ -428,7 +452,7 @@ UNIV_INLINE buf_frame_t* buf_frame_align( /*============*/ - /* out: pointer to block */ + /* out: pointer to frame */ byte* ptr); /* in: pointer to a frame */ /*********************************************************************** Checks if a pointer points to the block array of the buffer pool (blocks, not @@ -505,6 +529,19 @@ buf_pool_invalidate(void); --------------------------- LOWER LEVEL ROUTINES ------------------------- =========================================================================*/ +/************************************************************************ +Maps the page of block to a frame, if not mapped yet. Unmaps some page +from the end of the awe_LRU_free_mapped. */ + +void +buf_awe_map_page_to_frame( +/*======================*/ + buf_block_t* block, /* in: block whose page should be + mapped to a frame */ + ibool add_to_mapped_list);/* in: TRUE if we in the case + we need to map the page should also + add the block to the + awe_LRU_free_mapped list */ /************************************************************************* Adds latch level info for the rw-lock protecting the buffer frame. This should be called in the debug version after a successful latching of a @@ -638,7 +675,16 @@ struct buf_block_struct{ byte* frame; /* pointer to buffer frame which is of size UNIV_PAGE_SIZE, and aligned to an address divisible by - UNIV_PAGE_SIZE */ + UNIV_PAGE_SIZE; if AWE is used, this + will be NULL for the pages which are + currently not mapped into the virtual + address space window of the buffer + pool */ + os_awe_t* awe_info; /* if AWE is used, then an array of + awe page infos for + UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE + (normally = 4) physical memory + pages; otherwise NULL */ ulint space; /* space id of the page */ ulint offset; /* page number within the space */ ulint lock_hash_val; /* hashed value of the page address @@ -691,6 +737,10 @@ struct buf_block_struct{ /* node of the free block list */ UT_LIST_NODE_T(buf_block_t) LRU; /* node of the LRU list */ + UT_LIST_NODE_T(buf_block_t) awe_LRU_free_mapped; + /* in the AWE version node in the + list of free and LRU blocks which are + mapped to a frame */ ulint LRU_position; /* value which monotonically decreases (or may stay constant if the block is in the old blocks) toward @@ -758,11 +808,12 @@ struct buf_block_struct{ BTR_SEARCH_RIGHT_SIDE in hash indexing */ /* 6. Debug fields */ - +#ifdef UNIV_SYNC_DEBUG rw_lock_t debug_latch; /* in the debug version, each thread which bufferfixes the block acquires an s-latch here; so we can use the debug utilities in sync0rw */ +#endif ibool file_page_was_freed; /* this is set to TRUE when fsp frees a page in buffer pool */ @@ -781,16 +832,36 @@ struct buf_pool_struct{ struct and control blocks, except the read-write lock in them */ byte* frame_mem; /* pointer to the memory area which - was allocated for the frames */ + was allocated for the frames; in AWE + this is the virtual address space + window where we map pages stored + in physical memory */ byte* frame_zero; /* pointer to the first buffer frame: this may differ from frame_mem, because this is aligned by the frame size */ - byte* high_end; /* pointer to the end of the - buffer pool */ + byte* high_end; /* pointer to the end of the buffer + frames */ + ulint n_frames; /* number of frames */ buf_block_t* blocks; /* array of buffer control blocks */ + buf_block_t** blocks_of_frames;/* inverse mapping which can be used + to retrieve the buffer control block + of a frame; this is an array which + lists the blocks of frames in the + order frame_zero, + frame_zero + UNIV_PAGE_SIZE, ... + a control block is always assigned + for each frame, even if the frame does + not contain any data; note that in AWE + there are more control blocks than + buffer frames */ + os_awe_t* awe_info; /* if AWE is used, AWE info for the + physical 4 kB memory pages associated + with buffer frames */ ulint max_size; /* number of control blocks == maximum pool size in pages */ - ulint curr_size; /* current pool size in pages */ + ulint curr_size; /* current pool size in pages; + currently always the same as + max_size */ hash_table_t* page_hash; /* hash table of the file pages */ ulint n_pend_reads; /* number of pending read operations */ @@ -802,11 +873,14 @@ struct buf_pool_struct{ ulint n_pages_created;/* number of pages created in the pool with no read */ ulint n_page_gets; /* number of page gets performed; - also successful seraches through + also successful searches through the adaptive hash index are counted as page gets; this field is NOT protected by the buffer pool mutex */ + ulint n_pages_awe_remapped; /* if AWE is enabled, the + number of remaps of blocks to + buffer frames */ ulint n_page_gets_old;/* n_page_gets when buf_print was last time called: used to calculate hit rate */ @@ -815,6 +889,7 @@ struct buf_pool_struct{ ulint n_pages_written_old;/* number write operations */ ulint n_pages_created_old;/* number of pages created in the pool with no read */ + ulint n_pages_awe_remapped_old; /* 2. Page flushing algorithm fields */ UT_LIST_BASE_NODE_T(buf_block_t) flush_list; @@ -847,7 +922,10 @@ struct buf_pool_struct{ /* 3. LRU replacement algorithm fields */ UT_LIST_BASE_NODE_T(buf_block_t) free; - /* base node of the free block list */ + /* base node of the free block list; + in the case of AWE, at the start are + always free blocks for which the + physical memory is mapped to a frame */ UT_LIST_BASE_NODE_T(buf_block_t) LRU; /* base node of the LRU list */ buf_block_t* LRU_old; /* pointer to the about 3/8 oldest @@ -859,6 +937,12 @@ struct buf_pool_struct{ see buf0lru.c for the restrictions on this value; not defined if LRU_old == NULL */ + UT_LIST_BASE_NODE_T(buf_block_t) awe_LRU_free_mapped; + /* list of those blocks which are + in the LRU list or the free list, and + where the page is mapped to a frame; + thus, frames allocated, e.g., to the + locki table, are not in this list */ }; /* States of a control block */ diff --git a/innobase/include/buf0buf.ic b/innobase/include/buf0buf.ic index 7227c79dc6a..d4e7122f3f9 100644 --- a/innobase/include/buf0buf.ic +++ b/innobase/include/buf0buf.ic @@ -36,25 +36,27 @@ buf_block_peek_if_too_old( } /************************************************************************* -Gets the current size of buffer buf_pool in bytes. */ +Gets the current size of buffer buf_pool in bytes. In the case of AWE, the +size of AWE window (= the frames). */ UNIV_INLINE ulint buf_pool_get_curr_size(void) /*========================*/ /* out: size in bytes */ { - return((buf_pool->curr_size) * UNIV_PAGE_SIZE); + return((buf_pool->n_frames) * UNIV_PAGE_SIZE); } /************************************************************************* -Gets the maximum size of buffer buf_pool in bytes. */ +Gets the maximum size of buffer buf_pool in bytes. In the case of AWE, the +size of AWE window (= the frames). */ UNIV_INLINE ulint buf_pool_get_max_size(void) /*=======================*/ /* out: size in bytes */ { - return((buf_pool->max_size) * UNIV_PAGE_SIZE); + return((buf_pool->n_frames) * UNIV_PAGE_SIZE); } /*********************************************************************** @@ -207,54 +209,24 @@ buf_block_align( frame_zero = buf_pool->frame_zero; - ut_ad((ulint)ptr >= (ulint)frame_zero); - - block = buf_pool_get_nth_block(buf_pool, ((ulint)(ptr - frame_zero)) - >> UNIV_PAGE_SIZE_SHIFT); - if (block < buf_pool->blocks - || block >= buf_pool->blocks + buf_pool->max_size) { + if ((ulint)ptr < (ulint)frame_zero + || (ulint)ptr > (ulint)(buf_pool->high_end)) { + ut_print_timestamp(stderr); fprintf(stderr, -"InnoDB: Error: trying to access a stray pointer %lx\n" -"InnoDB: buf pool start is at %lx, number of pages %lu\n", (ulint)ptr, - (ulint)frame_zero, buf_pool->max_size); +" InnoDB: Error: trying to access a stray pointer %lx\n" +"InnoDB: buf pool start is at %lx, end at %lx\n" +"InnoDB: Probable reason is database corruption or memory\n" +"InnoDB: corruption. If this happens in an InnoDB database recovery,\n" +"InnoDB: you can look from section 6.1 at http://www.innodb.com/ibman.html\n" +"InnoDB: how to force recovery.\n", + (ulint)ptr, (ulint)frame_zero, + (ulint)(buf_pool->high_end)); ut_a(0); } - - return(block); -} - -/*********************************************************************** -Gets the block to whose frame the pointer is pointing to. Does not -require a file page to be bufferfixed. */ -UNIV_INLINE -buf_block_t* -buf_block_align_low( -/*================*/ - /* out: pointer to block */ - byte* ptr) /* in: pointer to a frame */ -{ - buf_block_t* block; - buf_frame_t* frame_zero; - - ut_ad(ptr); - - frame_zero = buf_pool->frame_zero; - - ut_ad((ulint)ptr >= (ulint)frame_zero); - - block = buf_pool_get_nth_block(buf_pool, ((ulint)(ptr - frame_zero)) - >> UNIV_PAGE_SIZE_SHIFT); - if (block < buf_pool->blocks - || block >= buf_pool->blocks + buf_pool->max_size) { - - fprintf(stderr, -"InnoDB: Error: trying to access a stray pointer %lx\n" -"InnoDB: buf pool start is at %lx, number of pages %lu\n", (ulint)ptr, - (ulint)frame_zero, buf_pool->max_size); - ut_a(0); - } - + + block = *(buf_pool->blocks_of_frames + (((ulint)(ptr - frame_zero)) + >> UNIV_PAGE_SIZE_SHIFT)); return(block); } @@ -264,7 +236,7 @@ UNIV_INLINE buf_frame_t* buf_frame_align( /*============*/ - /* out: pointer to block */ + /* out: pointer to frame */ byte* ptr) /* in: pointer to a frame */ { buf_frame_t* frame; @@ -273,14 +245,19 @@ buf_frame_align( frame = ut_align_down(ptr, UNIV_PAGE_SIZE); - if (((ulint)frame - < (ulint)(buf_pool->frame_zero)) - || ((ulint)frame > (ulint)(buf_pool_get_nth_block(buf_pool, - buf_pool->max_size - 1)->frame))) { + if (((ulint)frame < (ulint)(buf_pool->frame_zero)) + || (ulint)frame >= (ulint)(buf_pool->high_end)) { + + ut_print_timestamp(stderr); fprintf(stderr, -"InnoDB: Error: trying to access a stray pointer %lx\n" -"InnoDB: buf pool start is at %lx, number of pages %lu\n", (ulint)ptr, - (ulint)(buf_pool->frame_zero), buf_pool->max_size); +" InnoDB: Error: trying to access a stray pointer %lx\n" +"InnoDB: buf pool start is at %lx, end at %lx\n" +"InnoDB: Probable reason is database corruption or memory\n" +"InnoDB: corruption. If this happens in an InnoDB database recovery,\n" +"InnoDB: you can look from section 6.1 at http://www.innodb.com/ibman.html\n" +"InnoDB: how to force recovery.\n", + (ulint)ptr, (ulint)(buf_pool->frame_zero), + (ulint)(buf_pool->high_end)); ut_a(0); } @@ -469,7 +446,7 @@ buf_frame_modify_clock_inc( ut_ad(frame); - block = buf_block_align_low(frame); + block = buf_block_align(frame); ut_ad((mutex_own(&(buf_pool->mutex)) && (block->buf_fix_count == 0)) || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE)); @@ -479,6 +456,25 @@ buf_frame_modify_clock_inc( return(block->modify_clock); } +/************************************************************************ +Increments the modify clock of a frame by 1. The caller must (1) own the +buf_pool mutex and block bufferfix count has to be zero, (2) or own an x-lock +on the block. */ +UNIV_INLINE +dulint +buf_block_modify_clock_inc( +/*=======================*/ + /* out: new value */ + buf_block_t* block) /* in: block */ +{ + ut_ad((mutex_own(&(buf_pool->mutex)) && (block->buf_fix_count == 0)) + || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE)); + + UT_DULINT_INC(block->modify_clock); + + return(block->modify_clock); +} + /************************************************************************ Returns the value of the modify clock. The caller must have an s-lock or x-lock on the block. */ @@ -508,15 +504,16 @@ void buf_block_buf_fix_inc_debug( /*========================*/ buf_block_t* block, /* in: block to bufferfix */ - char* file, /* in: file name */ - ulint line) /* in: line */ + char* file __attribute__ ((unused)), /* in: file name */ + ulint line __attribute__ ((unused))) /* in: line */ { +#ifdef UNIV_SYNC_DEBUG ibool ret; - + ret = rw_lock_s_lock_func_nowait(&(block->debug_latch), file, line); ut_ad(ret == TRUE); - +#endif block->buf_fix_count++; } diff --git a/innobase/include/buf0lru.h b/innobase/include/buf0lru.h index 946b6c4e31d..6a3c948507d 100644 --- a/innobase/include/buf0lru.h +++ b/innobase/include/buf0lru.h @@ -53,7 +53,9 @@ LRU list to the free list. */ buf_block_t* buf_LRU_get_free_block(void); /*=========================*/ - /* out: the free control block */ + /* out: the free control block; also if AWE is + used, it is guaranteed that the block has its + page mapped to a frame when we return */ /********************************************************************** Puts a block back to the free list. */ diff --git a/innobase/include/log0recv.h b/innobase/include/log0recv.h index 7418e4abf1b..bef42cfec1c 100644 --- a/innobase/include/log0recv.h +++ b/innobase/include/log0recv.h @@ -355,12 +355,7 @@ in the debug version: spaces with an odd number as the id are replicate spaces */ #define RECV_REPLICA_SPACE_ADD 1 -/* This many blocks must be left free in the buffer pool when we scan -the log and store the scanned log records in the buffer pool: we will -use these free blocks to read in pages when we start applying the -log records to the database. */ - -#define RECV_POOL_N_FREE_BLOCKS (ut_min(256, buf_pool_get_curr_size() / 8)) +extern ulint recv_n_pool_free_frames; #ifndef UNIV_NONINL #include "log0recv.ic" diff --git a/innobase/include/os0proc.h b/innobase/include/os0proc.h index 79750e5c1f7..08510db4366 100644 --- a/innobase/include/os0proc.h +++ b/innobase/include/os0proc.h @@ -15,6 +15,76 @@ Created 9/30/1995 Heikki Tuuri typedef void* os_process_t; typedef unsigned long int os_process_id_t; +/* The cell type in os_awe_allocate_mem page info */ +#ifdef __NT__ +typedef ULONG_PTR os_awe_t; +#else +typedef ulint os_awe_t; +#endif + +/* Physical page size when Windows AWE is used. This is the normal +page size of an Intel x86 processor. We cannot use AWE with 2 MB or 4 MB +pages. */ +#define OS_AWE_X86_PAGE_SIZE 4096 + +/******************************************************************** +Windows AWE support. Tries to enable the "lock pages in memory" privilege for +the current process so that the current process can allocate memory-locked +virtual address space to act as the window where AWE maps physical memory. */ + +ibool +os_awe_enable_lock_pages_in_mem(void); +/*=================================*/ + /* out: TRUE if success, FALSE if error; + prints error info to stderr if no success */ +/******************************************************************** +Allocates physical RAM memory up to 64 GB in an Intel 32-bit x86 +processor. */ + +ibool +os_awe_allocate_physical_mem( +/*=========================*/ + /* out: TRUE if success */ + os_awe_t** page_info, /* out, own: array of opaque data containing + the info for allocated physical memory pages; + each allocated 4 kB physical memory page has + one slot of type os_awe_t in the array */ + ulint n_megabytes); /* in: number of megabytes to allocate */ +/******************************************************************** +Allocates a window in the virtual address space where we can map then +pages of physical memory. */ + +byte* +os_awe_allocate_virtual_mem_window( +/*===============================*/ + /* out, own: allocated memory, or NULL if did not + succeed */ + ulint size); /* in: virtual memory allocation size in bytes, must + be < 2 GB */ +/******************************************************************** +With this function you can map parts of physical memory allocated with +the ..._allocate_physical_mem to the virtual address space allocated with +the previous function. Intel implements this so that the process page +tables are updated accordingly. A test on a 1.5 GHz AMD processor and XP +showed that this takes < 1 microsecond, much better than the estimated 80 us +for copying a 16 kB page memory to memory. But, the operation will at least +partially invalidate the translation lookaside buffer (TLB) of all +processors. Under a real-world load the performance hit may be bigger. */ + +ibool +os_awe_map_physical_mem_to_window( +/*==============================*/ + /* out: TRUE if success; the function + calls exit(1) in case of an error */ + byte* ptr, /* in: a page-aligned pointer to + somewhere in the virtual address + space window; we map the physical mem + pages here */ + ulint n_mem_pages, /* in: number of 4 kB mem pages to + map */ + os_awe_t* page_info); /* in: array of page infos for those + pages; each page has one slot in the + array */ /******************************************************************** Converts the current process id to a number. It is not guaranteed that the number is unique. In Linux returns the 'process number' of the current diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h index ad6f71f7a3a..bc0960ae023 100644 --- a/innobase/include/srv0srv.h +++ b/innobase/include/srv0srv.h @@ -61,6 +61,7 @@ extern ulint srv_flush_log_at_trx_commit; extern byte srv_latin1_ordering[256];/* The sort order table of the latin1 character set */ extern ulint srv_pool_size; +extern ulint srv_awe_window_size; extern ulint srv_mem_pool_size; extern ulint srv_lock_table_size; @@ -86,6 +87,8 @@ extern ibool srv_use_doublewrite_buf; extern ibool srv_set_thread_priorities; extern int srv_query_thread_priority; +extern ibool srv_use_awe; +extern ibool srv_use_adaptive_hash_indexes; /*-------------------------------------------*/ extern ulint srv_n_rows_inserted; diff --git a/innobase/log/log0log.c b/innobase/log/log0log.c index f9b785ccbd5..bdfce783a43 100644 --- a/innobase/log/log0log.c +++ b/innobase/log/log0log.c @@ -437,25 +437,29 @@ log_group_calc_lsn_offset( dulint lsn, /* in: lsn, must be within 4 GB of group->lsn */ log_group_t* group) /* in: log group */ { - dulint gr_lsn; - ulint gr_lsn_size_offset; - ulint difference; - ulint group_size; - ulint offset; + dulint gr_lsn; + ib_longlong gr_lsn_size_offset; + ib_longlong difference; + ib_longlong group_size; + ib_longlong offset; ut_ad(mutex_own(&(log_sys->mutex))); + /* If total log file size is > 2 GB we can easily get overflows + with 32-bit integers. Use 64-bit integers instead. */ + gr_lsn = group->lsn; - gr_lsn_size_offset = log_group_calc_size_offset(group->lsn_offset, - group); - group_size = log_group_get_capacity(group); + gr_lsn_size_offset = (ib_longlong) + log_group_calc_size_offset(group->lsn_offset, group); + + group_size = (ib_longlong) log_group_get_capacity(group); if (ut_dulint_cmp(lsn, gr_lsn) >= 0) { - difference = ut_dulint_minus(lsn, gr_lsn); + difference = (ib_longlong) ut_dulint_minus(lsn, gr_lsn); } else { - difference = ut_dulint_minus(gr_lsn, lsn); + difference = (ib_longlong) ut_dulint_minus(gr_lsn, lsn); difference = difference % group_size; @@ -464,7 +468,13 @@ log_group_calc_lsn_offset( offset = (gr_lsn_size_offset + difference) % group_size; - return(log_group_calc_real_offset(offset, group)); + ut_a(offset <= 0xFFFFFFFF); + + /* printf("Offset is %lu gr_lsn_offset is %lu difference is %lu\n", + (ulint)offset,(ulint)gr_lsn_size_offset, (ulint)difference); + */ + + return(log_group_calc_real_offset((ulint)offset, group)); } /*********************************************************************** @@ -3054,8 +3064,8 @@ log_check_log_recs( ut_memcpy(scan_buf, start, end - start); recv_scan_log_recs(TRUE, - buf_pool_get_curr_size() - - RECV_POOL_N_FREE_BLOCKS * UNIV_PAGE_SIZE, + (buf_pool->n_frames - + recv_n_pool_free_frames) * UNIV_PAGE_SIZE, FALSE, scan_buf, end - start, ut_dulint_align_down(buf_start_lsn, OS_FILE_LOG_BLOCK_SIZE), diff --git a/innobase/log/log0recv.c b/innobase/log/log0recv.c index dfe67c444b4..3945b47933d 100644 --- a/innobase/log/log0recv.c +++ b/innobase/log/log0recv.c @@ -71,6 +71,14 @@ ulint recv_previous_parsed_rec_is_multi = 0; ulint recv_max_parsed_page_no = 0; +/* This many frames must be left free in the buffer pool when we scan +the log and store the scanned log records in the buffer pool: we will +use these free frames to read in pages when we start applying the +log records to the database. */ + +ulint recv_n_pool_free_frames = 256; + + /************************************************************ Creates the recovery system. */ @@ -1018,10 +1026,10 @@ recv_recover_page( block = buf_block_align(page); if (just_read_in) { - /* Move the ownership of the x-latch on the page to this OS - thread, so that we can acquire a second x-latch on it. This - is needed for the operations to the page to pass the debug - checks. */ + /* Move the ownership of the x-latch on the page to + this OS thread, so that we can acquire a second + x-latch on it. This is needed for the operations to + the page to pass the debug checks. */ rw_lock_x_lock_move_ownership(&(block->lock)); } @@ -2362,8 +2370,8 @@ recv_group_scan_log_recs( group, start_lsn, end_lsn); finished = recv_scan_log_recs(TRUE, - buf_pool_get_curr_size() - - RECV_POOL_N_FREE_BLOCKS * UNIV_PAGE_SIZE, + (buf_pool->n_frames + - recv_n_pool_free_frames) * UNIV_PAGE_SIZE, TRUE, log_sys->buf, RECV_SCAN_SIZE, start_lsn, contiguous_lsn, group_scanned_lsn); @@ -3001,8 +3009,8 @@ ask_again: read_offset % UNIV_PAGE_SIZE, len, buf, NULL); ret = recv_scan_log_recs(TRUE, - buf_pool_get_curr_size() - - RECV_POOL_N_FREE_BLOCKS * UNIV_PAGE_SIZE, + (buf_pool->n_frames - + recv_n_pool_free_frames) * UNIV_PAGE_SIZE, TRUE, buf, len, start_lsn, &dummy_lsn, &scanned_lsn); diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index fa5482a8cd1..9eae358c7fb 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -2127,7 +2127,7 @@ os_aio_simulated_handle( ulint offs; ulint lowest_offset; byte* combined_buf; - byte* combined_buf2= 0; /* Remove warning */ + byte* combined_buf2; ibool ret; ulint n; ulint i; diff --git a/innobase/os/os0proc.c b/innobase/os/os0proc.c index 1ee448a4a44..61db7bd13b2 100644 --- a/innobase/os/os0proc.c +++ b/innobase/os/os0proc.c @@ -12,11 +12,469 @@ Created 9/30/1995 Heikki Tuuri #include "os0proc.ic" #endif -#ifdef __WIN__ -#include +#include "ut0mem.h" +#include "ut0byte.h" + + +/* +How to get AWE to compile on Windows? +------------------------------------- + +the Visual C++ has to be relatively recent and _WIN32_WINNT has to be +defined to a value >= 0x0500 when windows.h is included. An easy way +to accomplish that is to put + +#define _WIN32_WINNT 0x0500 + +to the start of file \mysql\include\config-win.h + +Where does AWE work? +------------------- + +See the error message in os_awe_allocate_physical_mem(). + +How to assign privileges for mysqld to use AWE? +----------------------------------------------- + +See the error message in os_awe_enable_lock_pages_in_mem(). + +Use Windows AWE functions in this order +--------------------------------------- + +(1) os_awe_enable_lock_pages_in_mem(); +(2) os_awe_allocate_physical_mem(); +(3) os_awe_allocate_virtual_mem_window(); +(4) os_awe_map_physical_mem_to_window(). + +To test 'AWE' in a computer which does not have the AWE API, +you can compile with UNIV_SIMULATE_AWE defined in this file. +*/ + +#ifdef UNIV_SIMULATE_AWE +/* If we simulate AWE, we allocate the 'physical memory' here */ +byte* os_awe_simulate_mem; +ulint os_awe_simulate_mem_size; +os_awe_t* os_awe_simulate_page_info; +byte* os_awe_simulate_window; +ulint os_awe_simulate_window_size; +/* In simulated AWE the following contains a NULL pointer or a pointer +to a mapped 'physical page' for each 4 kB page in the AWE window */ +byte** os_awe_simulate_map; #endif -#include "ut0mem.h" +#ifdef __NT__ +os_awe_t* os_awe_page_info; +ulint os_awe_n_pages; +byte* os_awe_window; +ulint os_awe_window_size; +#endif + +/******************************************************************** +Windows AWE support. Tries to enable the "lock pages in memory" privilege for +the current process so that the current process can allocate memory-locked +virtual address space to act as the window where AWE maps physical memory. */ + +ibool +os_awe_enable_lock_pages_in_mem(void) +/*=================================*/ + /* out: TRUE if success, FALSE if error; + prints error info to stderr if no success */ +{ +#ifdef UNIV_SIMULATE_AWE + + return(TRUE); + +#elif defined(__NT__) + struct { + DWORD Count; + LUID_AND_ATTRIBUTES Privilege[1]; + } Info; + HANDLE hProcess; + HANDLE Token; + BOOL Result; + + hProcess = GetCurrentProcess(); + + /* Open the token of the current process */ + + Result = OpenProcessToken(hProcess, + TOKEN_ADJUST_PRIVILEGES, + &Token); + if (Result != TRUE) { + fprintf(stderr, + "InnoDB: AWE: Cannot open process token, error %lu\n", + (ulint)GetLastError()); + return(FALSE); + } + + Info.Count = 1; + + Info.Privilege[0].Attributes = SE_PRIVILEGE_ENABLED; + + /* Get the local unique identifier (LUID) of the SE_LOCK_MEMORY + privilege */ + + Result = LookupPrivilegeValue(NULL, SE_LOCK_MEMORY_NAME, + &(Info.Privilege[0].Luid)); + if (Result != TRUE) { + fprintf(stderr, + "InnoDB: AWE: Cannot get local privilege value for %s, error %lu.\n", + SE_LOCK_MEMORY_NAME, (ulint)GetLastError()); + + return(FALSE); + } + + /* Try to adjust the privilege */ + + Result = AdjustTokenPrivileges(Token, FALSE, + (PTOKEN_PRIVILEGES)&Info, + 0, NULL, NULL); + /* Check the result */ + + if (Result != TRUE) { + fprintf(stderr, + "InnoDB: AWE: Cannot adjust process token privileges, error %u.\n", + GetLastError()); + return(FALSE); + } else if (GetLastError() != ERROR_SUCCESS) { + fprintf(stderr, +"InnoDB: AWE: Cannot enable SE_LOCK_MEMORY privilege, error %lu.\n" +"InnoDB: In Windows XP Home you cannot use AWE. In Windows 2000 and XP\n" +"InnoDB: Professional you must go to the Control Panel, to\n" +"InnoDB: Security Settings, to Local Policies, and enable\n" +"InnoDB: the 'lock pages in memory' privilege for the user who runs\n" +"InnoDB: the MySQL server.\n", GetLastError()); + + return(FALSE); + } + + CloseHandle(Token); + + return(TRUE); +#else +#ifdef __WIN__ + fprintf(stderr, +"InnoDB: AWE: Error: to use AWE you must use a ...-nt MySQL executable.\n"); +#endif + return(FALSE); +#endif +} + +/******************************************************************** +Allocates physical RAM memory up to 64 GB in an Intel 32-bit x86 +processor. */ + +ibool +os_awe_allocate_physical_mem( +/*=========================*/ + /* out: TRUE if success */ + os_awe_t** page_info, /* out, own: array of opaque data containing + the info for allocated physical memory pages; + each allocated 4 kB physical memory page has + one slot of type os_awe_t in the array */ + ulint n_megabytes) /* in: number of megabytes to allocate */ +{ +#ifdef UNIV_SIMULATE_AWE + os_awe_simulate_page_info = ut_malloc(sizeof(os_awe_t) * + n_megabytes * ((1024 * 1024) / OS_AWE_X86_PAGE_SIZE)); + + os_awe_simulate_mem = ut_align(ut_malloc( + 4096 + 1024 * 1024 * n_megabytes), + 4096); + os_awe_simulate_mem_size = n_megabytes * 1024 * 1024; + + *page_info = os_awe_simulate_page_info; + + return(TRUE); + +#elif defined(__NT__) + BOOL bResult; + ULONG_PTR NumberOfPages; /* Question: why does Windows + use the name ULONG_PTR for + a scalar integer type? Maybe + because we may also refer to + &NumberOfPages? */ + ULONG_PTR NumberOfPagesInitial; + SYSTEM_INFO sSysInfo; + int PFNArraySize; + + if (n_megabytes > 64 * 1024) { + + fprintf(stderr, +"InnoDB: AWE: Error: tried to allocate %lu MB.\n" +"InnoDB: AWE cannot allocate more than 64 GB in any computer.\n", n_megabytes); + + return(FALSE); + } + + GetSystemInfo(&sSysInfo); /* fill the system information structure */ + + if ((ulint)OS_AWE_X86_PAGE_SIZE != (ulint)sSysInfo.dwPageSize) { + fprintf(stderr, +"InnoDB: AWE: Error: this computer has a page size of %lu.\n" +"InnoDB: Should be 4096 bytes for InnoDB AWE support to work.\n", + (ulint)sSysInfo.dwPageSize); + + return(FALSE); + } + + /* Calculate the number of pages of memory to request */ + + NumberOfPages = n_megabytes * ((1024 * 1024) / OS_AWE_X86_PAGE_SIZE); + + /* Calculate the size of page_info for allocated physical pages */ + + PFNArraySize = NumberOfPages * sizeof(ULONG_PTR); + + *page_info = (ULONG_PTR*)HeapAlloc(GetProcessHeap(), 0, PFNArraySize); + + if (*page_info == NULL) { + fprintf(stderr, +"InnoDB: AWE: Failed to allocate page info array from process heap, error %lu\n", + (ulint)GetLastError()); + + return(FALSE); + } + + ut_total_allocated_memory += PFNArraySize; + + /* Enable this process' privilege to lock pages to physical memory */ + + if (!os_awe_enable_lock_pages_in_mem()) { + + return(FALSE); + } + + /* Allocate the physical memory */ + + NumberOfPagesInitial = NumberOfPages; + + os_awe_page_info = *page_info; + os_awe_n_pages = (ulint)NumberOfPages; + + /* Compilation note: if the compiler complains the function is not + defined, see the note at the start of this file */ + + bResult = AllocateUserPhysicalPages(GetCurrentProcess(), + &NumberOfPages, + *page_info); + if (bResult != TRUE) { + fprintf(stderr, +"InnoDB: AWE: Cannot allocate physical pages, error %lu.\n", + (ulint)GetLastError()); + + return(FALSE); + } + + if (NumberOfPagesInitial != NumberOfPages) { + fprintf(stderr, +"InnoDB: AWE: Error: allocated only %lu pages of %lu requested.\n" +"InnoDB: Check that you have enough free RAM.\n" +"InnoDB: In Windows XP Professional and 2000 Professional\n" +"InnoDB: Windows PAE size is max 4 GB. In 2000 and .NET" +"InnoDB: Advanced Servers and 2000 Datacenter Server it is 32 GB,\n" +"InnoDB: and in .NET Datacenter Server it is 64 GB.\n" +"InnoDB: A Microsoft web page said that the processor must be an Intel\n" +"InnoDB: processor.", + (ulint)NumberOfPages, + (ulint)NumberOfPagesInitial); + + return(FALSE); + } + + fprintf(stderr, +"InnoDB: Using Address Windowing Extensions (AWE); allocated %lu MB\n", + n_megabytes); + + return(TRUE); +#else + return(FALSE); +#endif +} + +/******************************************************************** +Allocates a window in the virtual address space where we can map then +pages of physical memory. */ + +byte* +os_awe_allocate_virtual_mem_window( +/*===============================*/ + /* out, own: allocated memory, or NULL if did not + succeed */ + ulint size) /* in: virtual memory allocation size in bytes, must + be < 2 GB */ +{ +#ifdef UNIV_SIMULATE_AWE + ulint i; + + os_awe_simulate_window = ut_align(ut_malloc(4096 + size), 4096); + os_awe_simulate_window_size = size; + + os_awe_simulate_map = ut_malloc(sizeof(byte*) * (size / 4096)); + + for (i = 0; i < (size / 4096); i++) { + *(os_awe_simulate_map + i) = NULL; + } + + return(os_awe_simulate_window); + +#elif defined(__NT__) + byte* ptr; + + if (size > 0x7FFFFFFFFF) { + fprintf(stderr, +"InnoDB: AWE: Cannot allocate %lu bytes of virtual memory\n", size); + + return(NULL); + } + + ptr = VirtualAlloc(NULL, (SIZE_T)size, MEM_RESERVE | MEM_PHYSICAL, + PAGE_READWRITE); + if (ptr == NULL) { + fprintf(stderr, +"InnoDB: AWE: Cannot allocate %lu bytes of virtual memory, error %lu\n", + size, (ulint)GetLastError()); + + return(NULL); + } + + os_awe_window = ptr; + os_awe_window_size = size; + + ut_total_allocated_memory += size; + + return(ptr); +#else + return(NULL); +#endif +} + +/******************************************************************** +With this function you can map parts of physical memory allocated with +the ..._allocate_physical_mem to the virtual address space allocated with +the previous function. Intel implements this so that the process page +tables are updated accordingly. A test on a 1.5 GHz AMD processor and XP +showed that this takes < 1 microsecond, much better than the estimated 80 us +for copying a 16 kB page memory to memory. But, the operation will at least +partially invalidate the translation lookaside buffer (TLB) of all +processors. Under a real-world load the performance hit may be bigger. */ + +ibool +os_awe_map_physical_mem_to_window( +/*==============================*/ + /* out: TRUE if success; the function + calls exit(1) in case of an error */ + byte* ptr, /* in: a page-aligned pointer to + somewhere in the virtual address + space window; we map the physical mem + pages here */ + ulint n_mem_pages, /* in: number of 4 kB mem pages to + map */ + os_awe_t* page_info) /* in: array of page infos for those + pages; each page has one slot in the + array */ +{ +#ifdef UNIV_SIMULATE_AWE + ulint i; + byte** map; + byte* page; + byte* phys_page; + + ut_a(ptr >= os_awe_simulate_window); + ut_a(ptr < os_awe_simulate_window + os_awe_simulate_window_size); + ut_a(page_info >= os_awe_simulate_page_info); + ut_a(page_info < os_awe_simulate_page_info + + (os_awe_simulate_mem_size / 4096)); + + /* First look if some other 'physical pages' are mapped at ptr, + and copy them back to where they were if yes */ + + map = os_awe_simulate_map + + ((ulint)(ptr - os_awe_simulate_window)) / 4096; + page = ptr; + + for (i = 0; i < n_mem_pages; i++) { + if (*map != NULL) { + ut_memcpy(*map, page, 4096); + } + map++; + page += 4096; + } + + /* Then copy to ptr the 'physical pages' determined by page_info; we + assume page_info is a segment of the array we created at the start */ + + phys_page = os_awe_simulate_mem + + (ulint)(page_info - os_awe_simulate_page_info) + * 4096; + + ut_memcpy(ptr, phys_page, n_mem_pages * 4096); + + /* Update the map */ + + map = os_awe_simulate_map + + ((ulint)(ptr - os_awe_simulate_window)) / 4096; + + for (i = 0; i < n_mem_pages; i++) { + *map = phys_page; + + map++; + phys_page += 4096; + } + + return(TRUE); + +#elif defined(__NT__) + BOOL bResult; + ULONG_PTR n_pages; + + n_pages = (ULONG_PTR)n_mem_pages; + + if (!(ptr >= os_awe_window)) { + fprintf(stderr, +"InnoDB: AWE: Error: trying to map to address %lx but AWE window start %lx\n", + (ulint)ptr, (ulint)os_awe_window); + ut_a(0); + } + + if (!(ptr <= os_awe_window + os_awe_window_size - UNIV_PAGE_SIZE)) { + fprintf(stderr, +"InnoDB: AWE: Error: trying to map to address %lx but AWE window end %lx\n", + (ulint)ptr, (ulint)os_awe_window + os_awe_window_size); + ut_a(0); + } + + if (!(page_info >= os_awe_page_info)) { + fprintf(stderr, +"InnoDB: AWE: Error: trying to map page info at %lx but array start %lx\n", + (ulint)page_info, (ulint)os_awe_page_info); + ut_a(0); + } + + if (!(page_info <= os_awe_page_info + (os_awe_n_pages - 4))) { + fprintf(stderr, +"InnoDB: AWE: Error: trying to map page info at %lx but array end %lx\n", + (ulint)page_info, (ulint)(os_awe_page_info + os_awe_n_pages)); + ut_a(0); + } + + bResult = MapUserPhysicalPages((PVOID)ptr, n_pages, page_info); + + if (bResult != TRUE) { + ut_print_timestamp(stderr); + fprintf(stderr, +" InnoDB: AWE: Mapping of %lu physical pages to address %lx failed,\n" +"InnoDB: error %lu.\n" +"InnoDB: Cannot continue operation.\n", + n_mem_pages, (ulint)ptr, (ulint)GetLastError()); + exit(1); + } + + return(TRUE); +#else + return(FALSE); +#endif +} /******************************************************************** Converts the current process id to a number. It is not guaranteed that the diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index f9eba721cbc..56971ab86eb 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -140,9 +140,14 @@ byte srv_latin1_ordering[256] /* The sort order table of the latin1 , 0xD8, 0x55, 0x55, 0x55, 0x59, 0x59, 0xDE, 0xFF }; -ulint srv_pool_size = ULINT_MAX; /* size in database pages; - MySQL originally sets this - value in megabytes */ +ulint srv_pool_size = ULINT_MAX; /* size in pages; MySQL inits + this to size in kilobytes but + we normalize this to pages in + srv_boot() */ +ulint srv_awe_window_size = 0; /* size in pages; MySQL inits + this to bytes, but we + normalize it to pages in + srv_boot() */ ulint srv_mem_pool_size = ULINT_MAX; /* size in bytes */ ulint srv_lock_table_size = ULINT_MAX; @@ -218,6 +223,13 @@ ibool srv_use_doublewrite_buf = TRUE; ibool srv_set_thread_priorities = TRUE; int srv_query_thread_priority = 0; + +/* TRUE if the Address Windowing Extensions of Windows are used; then we must +disable adaptive hash indexes */ +ibool srv_use_awe = FALSE; +ibool srv_use_adaptive_hash_indexes = TRUE; + + /*-------------------------------------------*/ ulint srv_n_spin_wait_rounds = 20; ulint srv_spin_wait_delay = 5; @@ -1956,9 +1968,19 @@ srv_normalize_init_values(void) srv_log_buffer_size = srv_log_buffer_size / UNIV_PAGE_SIZE; - srv_pool_size = srv_pool_size / UNIV_PAGE_SIZE; + srv_pool_size = srv_pool_size / (UNIV_PAGE_SIZE / 1024); + + srv_awe_window_size = srv_awe_window_size / UNIV_PAGE_SIZE; - srv_lock_table_size = 20 * srv_pool_size; + if (srv_use_awe) { + /* If we are using AWE we must save memory in the 32-bit + address space of the process, and cannot bind the lock + table size to the real buffer pool size. */ + + srv_lock_table_size = 20 * srv_awe_window_size; + } else { + srv_lock_table_size = 20 * srv_pool_size; + } return(DB_SUCCESS); } @@ -2323,6 +2345,12 @@ srv_sprintf_innodb_monitor( "Total memory allocated %lu; in additional pool allocated %lu\n", ut_total_allocated_memory, mem_pool_get_reserved(mem_comm_pool)); + if (srv_use_awe) { + buf += sprintf(buf, + "In addition to that %lu MB of AWE memory allocated\n", + srv_pool_size / ((1024 * 1024) / UNIV_PAGE_SIZE)); + } + buf_print_io(buf, buf_end); buf = buf + strlen(buf); ut_a(buf < buf_end + 1500); diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index ec674b69256..e1d436a879c 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -935,6 +935,7 @@ innobase_start_or_create_for_mysql(void) /*====================================*/ /* out: DB_SUCCESS or error code */ { + buf_pool_t* ret; ibool create_new_db; ibool log_file_created; ibool log_created = FALSE; @@ -970,6 +971,11 @@ innobase_start_or_create_for_mysql(void) #ifdef UNIV_MEM_DEBUG fprintf(stderr, "InnoDB: !!!!!!!!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!!!!!!!\n"); +#endif + +#ifdef UNIV_SIMULATE_AWE + fprintf(stderr, +"InnoDB: !!!!!!!!!!!!!! UNIV_SIMULATE_AWE switched on !!!!!!!!!!!!!!!!!\n"); #endif if (srv_sizeof_trx_t_in_ha_innodb_cc != (ulint)sizeof(trx_t)) { @@ -1002,6 +1008,17 @@ innobase_start_or_create_for_mysql(void) srv_startup_is_before_trx_rollback_phase = TRUE; os_aio_use_native_aio = FALSE; +#if !defined(__NT__) && !defined(UNIV_SIMULATE_AWE) + if (srv_use_awe) { + + fprintf(stderr, +"InnoDB: Error: You have specified innodb_buffer_pool_awe_mem_mb\n" +"InnoDB: in my.cnf, but AWE can only be used in Windows 2000 and later.\n"); + + return(DB_ERROR); + } +#endif + #ifdef __WIN__ if (os_get_os_version() == OS_WIN95 || os_get_os_version() == OS_WIN31 @@ -1057,6 +1074,9 @@ innobase_start_or_create_for_mysql(void) return(DB_ERROR); } + /* Note that the call srv_boot() also changes the values of + srv_pool_size etc. to the units used by InnoDB internally */ + err = srv_boot(); if (err != DB_SUCCESS) { @@ -1088,7 +1108,26 @@ innobase_start_or_create_for_mysql(void) fil_init(SRV_MAX_N_OPEN_FILES); - buf_pool_init(srv_pool_size, srv_pool_size); + if (srv_use_awe) { + fprintf(stderr, +"InnoDB: Using AWE: Memory window is %lu MB and AWE memory is %lu MB\n", + srv_awe_window_size / ((1024 * 1024) / UNIV_PAGE_SIZE), + srv_pool_size / ((1024 * 1024) / UNIV_PAGE_SIZE)); + + /* We must disable adaptive hash indexes because they do not + tolerate remapping of pages in AWE */ + + srv_use_adaptive_hash_indexes = FALSE; + ret = buf_pool_init(srv_pool_size, srv_pool_size, + srv_awe_window_size); + } else { + ret = buf_pool_init(srv_pool_size, srv_pool_size, + srv_pool_size); + } + + if (ret == NULL) { + return(DB_ERROR); + } fsp_init(); log_init(); diff --git a/innobase/trx/trx0sys.c b/innobase/trx/trx0sys.c index 0c10040847e..33c962772e8 100644 --- a/innobase/trx/trx0sys.c +++ b/innobase/trx/trx0sys.c @@ -472,9 +472,9 @@ trx_sys_update_mysql_binlog_offset( if (0 != ut_memcmp(sys_header + field + TRX_SYS_MYSQL_LOG_NAME, file_name, 1 + ut_strlen(file_name))) { - mlog_write_string((byte*) (sys_header + field - + TRX_SYS_MYSQL_LOG_NAME), - (byte*) file_name, 1 + ut_strlen(file_name), mtr); + mlog_write_string(sys_header + field + + TRX_SYS_MYSQL_LOG_NAME, + file_name, 1 + ut_strlen(file_name), mtr); } if (mach_read_from_4(sys_header + field diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c index d2219ed019f..f0077f941de 100644 --- a/innobase/trx/trx0trx.c +++ b/innobase/trx/trx0trx.c @@ -99,7 +99,7 @@ trx_create( trx->mysql_log_file_name = NULL; trx->mysql_log_offset = 0; - trx->mysql_master_log_file_name = (char*) ""; + trx->mysql_master_log_file_name = ""; trx->mysql_master_log_pos = 0; trx->ignore_duplicates_in_insert = FALSE; diff --git a/innobase/ut/ut0ut.c b/innobase/ut/ut0ut.c index bb5eb662cd7..ff5d11d84ed 100644 --- a/innobase/ut/ut0ut.c +++ b/innobase/ut/ut0ut.c @@ -197,6 +197,7 @@ ut_get_year_month_day( *month = (ulint)cal_tm.wMonth; *day = (ulint)cal_tm.wDay; #else + struct tm cal_tm; struct tm* cal_tm_ptr; time_t tm; diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index bab5152725f..0d56f216b3b 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -82,7 +82,8 @@ are declared in mysqld.cc: */ long innobase_mirrored_log_groups, innobase_log_files_in_group, innobase_log_file_size, innobase_log_buffer_size, - innobase_buffer_pool_size, innobase_additional_mem_pool_size, + innobase_buffer_pool_size, innobase_buffer_pool_awe_mem_mb, + innobase_additional_mem_pool_size, innobase_file_io_threads, innobase_lock_wait_timeout, innobase_thread_concurrency, innobase_force_recovery; @@ -753,7 +754,25 @@ innobase_init(void) srv_log_buffer_size = (ulint) innobase_log_buffer_size; srv_flush_log_at_trx_commit = (ulint) innobase_flush_log_at_trx_commit; - srv_pool_size = (ulint) innobase_buffer_pool_size; + /* We set srv_pool_size here in units of 1 kB. InnoDB internally + changes the value so that it becomes the number of database pages. */ + + if (innobase_buffer_pool_awe_mem_mb == 0) { + /* Careful here: we first convert the signed long int to ulint + and only after that divide */ + + srv_pool_size = ((ulint) innobase_buffer_pool_size) / 1024; + } else { + srv_use_awe = TRUE; + srv_pool_size = (ulint) + (1024 * innobase_buffer_pool_awe_mem_mb); + srv_awe_window_size = (ulint) innobase_buffer_pool_size; + + /* Note that what the user specified as + innodb_buffer_pool_size is actually the AWE memory window + size in this case, and the real buffer pool size is + determined by .._awe_mem_mb. */ + } srv_mem_pool_size = (ulint) innobase_additional_mem_pool_size; diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h index d2639f39c5b..86fb5d1947b 100644 --- a/sql/ha_innodb.h +++ b/sql/ha_innodb.h @@ -178,7 +178,8 @@ extern char *innobase_home, *innobase_tmpdir, *innobase_logdir; extern long innobase_lock_scan_time; extern long innobase_mirrored_log_groups, innobase_log_files_in_group; extern long innobase_log_file_size, innobase_log_buffer_size; -extern long innobase_buffer_pool_size, innobase_additional_mem_pool_size; +extern long innobase_buffer_pool_size, innobase_buffer_pool_awe_mem_mb, + innobase_additional_mem_pool_size; extern long innobase_file_io_threads, innobase_lock_wait_timeout; extern long innobase_force_recovery, innobase_thread_concurrency; extern char *innobase_data_home_dir, *innobase_data_file_path; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 833cfb34c81..d6a5c0b8412 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3194,6 +3194,7 @@ enum options { OPT_INNODB_LOG_FILE_SIZE, OPT_INNODB_LOG_BUFFER_SIZE, OPT_INNODB_BUFFER_POOL_SIZE, + OPT_INNODB_BUFFER_POOL_AWE_MEM_MB, OPT_INNODB_ADDITIONAL_MEM_POOL_SIZE, OPT_INNODB_FILE_IO_THREADS, OPT_INNODB_LOCK_WAIT_TIMEOUT, @@ -3753,6 +3754,10 @@ struct my_option my_long_options[] = "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.", (gptr*) &innobase_buffer_pool_size, (gptr*) &innobase_buffer_pool_size, 0, GET_LONG, REQUIRED_ARG, 8*1024*1024L, 1024*1024L, ~0L, 0, 1024*1024L, 0}, + {"innodb_buffer_pool_awe_mem_mb", OPT_INNODB_BUFFER_POOL_AWE_MEM_MB, + "If Windows AWE is used, the size of InnoDB buffer pool allocated from the AWE memory.", + (gptr*) &innobase_buffer_pool_awe_mem_mb, (gptr*) &innobase_buffer_pool_awe_mem_mb, 0, + GET_LONG, REQUIRED_ARG, 0, 0, 63000, 0, 1, 0}, {"innodb_additional_mem_pool_size", OPT_INNODB_ADDITIONAL_MEM_POOL_SIZE, "Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.", (gptr*) &innobase_additional_mem_pool_size, diff --git a/sql/set_var.cc b/sql/set_var.cc index a067bab01d7..fc268d314ba 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -449,6 +449,7 @@ struct show_var_st init_vars[]= { #ifdef HAVE_INNOBASE_DB {"innodb_additional_mem_pool_size", (char*) &innobase_additional_mem_pool_size, SHOW_LONG }, {"innodb_buffer_pool_size", (char*) &innobase_buffer_pool_size, SHOW_LONG }, + {"innodb_buffer_pool_awe_mem_mb", (char*) &innobase_buffer_pool_awe_mem_mb, SHOW_LONG }, {"innodb_data_file_path", (char*) &innobase_data_file_path, SHOW_CHAR_PTR}, {"innodb_data_home_dir", (char*) &innobase_data_home_dir, SHOW_CHAR_PTR}, {"innodb_file_io_threads", (char*) &innobase_file_io_threads, SHOW_LONG }, From ec8526bd15888d8e9013505ea8986ce245843cfa Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jan 2003 12:30:54 +0400 Subject: [PATCH 173/220] charset.c: memory leak fix I will move my_once_strdup to my_alloc.c later. mysys/charset.c: memory leak fix I will move my_once_strdup to my_alloc.c later. --- mysys/charset.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/mysys/charset.c b/mysys/charset.c index 35651cc59e7..ce853cc6f54 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -172,16 +172,26 @@ static void simple_cs_init_functions(CHARSET_INFO *cs) cs->mbmaxlen = 1; } +/* FIXME: BAR: move to more proper place, my_alloc.c I suppose */ +static char *my_once_strdup(const char *src,myf myflags) +{ + uint len=strlen(src); + char *dst=my_once_alloc(len+1,myflags); + if (dst) + memcpy(dst,src,len+1); + return dst; +} + static void simple_cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from) { to->number = from->number ? from->number : to->number; to->state |= from->state; if (from->csname) - to->csname=my_strdup(from->csname,MYF(MY_WME)); + to->csname=my_once_strdup(from->csname,MYF(MY_WME)); if (from->name) - to->name=my_strdup(from->name,MYF(MY_WME)); + to->name=my_once_strdup(from->name,MYF(MY_WME)); if (from->ctype) { From 64dc734dee09157bf0c4c9bd84ba6b16754e27e1 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jan 2003 11:45:06 +0200 Subject: [PATCH 174/220] Fixed that derived tables are properly droped mysys/my_init.c: Move my_once_free() up to not get warnings for this from safemalloc. sql/item_row.cc: Removed compiler warnings sql/sql_select.cc: split fix_tables_pointer() into two functions to be able to reuse code sql/sql_select.h: split fix_tables_pointer() into two functions to be able to reuse code --- mysys/my_init.c | 2 +- sql/item_row.cc | 2 +- sql/mysql_priv.h | 3 +- sql/sql_base.cc | 43 ++++++++++++++++--- sql/sql_class.cc | 2 +- sql/sql_class.h | 2 +- sql/sql_derived.cc | 101 ++++++++++++++++++++++++--------------------- sql/sql_parse.cc | 6 ++- sql/sql_select.cc | 21 ++++++---- sql/sql_select.h | 1 + 10 files changed, 117 insertions(+), 66 deletions(-) diff --git a/mysys/my_init.c b/mysys/my_init.c index 2f5088d5b9e..ae7f78b7445 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -121,6 +121,7 @@ void my_end(int infoflag) } } free_charsets(); + my_once_free(); if (infoflag & MY_GIVE_INFO || info_file != stderr) { #ifdef HAVE_GETRUSAGE @@ -163,7 +164,6 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", pthread_mutex_destroy(&THR_LOCK_malloc); pthread_mutex_destroy(&THR_LOCK_open); DBUG_POP(); /* Must be done before my_thread_end */ - my_once_free(); my_thread_end(); my_thread_global_end(); #endif diff --git a/sql/item_row.cc b/sql/item_row.cc index c62ab60c0cd..355228e45df 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -18,7 +18,7 @@ #include "assert.h" Item_row::Item_row(List &arg): - Item(), array_holder(1), used_tables_cache(0), const_item_cache(1) + Item(), used_tables_cache(0), array_holder(1), const_item_cache(1) { //TODO: think placing 2-3 component items in item (as it done for function) diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 1e0f7884176..655e4d7b972 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -579,8 +579,7 @@ bool rm_temporary_table(enum db_type base, char *path); void free_io_cache(TABLE *entry); void intern_close_table(TABLE *entry); bool close_thread_table(THD *thd, TABLE **table_ptr); -void close_thread_tables(THD *thd,bool locked=0); -bool close_thread_table(THD *thd, TABLE **table_ptr); +void close_thread_tables(THD *thd, bool locked=0, bool skip_derived=0); void close_temporary_tables(THD *thd); TABLE_LIST * find_table_in_list(TABLE_LIST *table, const char *db_name, const char *table_name); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 08016d2df8c..b5178076258 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -19,6 +19,7 @@ #include "mysql_priv.h" #include "sql_acl.h" +#include "sql_select.h" #include #include #include @@ -307,7 +308,8 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh, close_old_data_files(thd,thd->open_tables,1,1); bool found=1; /* Wait until all threads has closed all the tables we had locked */ - DBUG_PRINT("info", ("Waiting for others threads to close their open tables")); + DBUG_PRINT("info", + ("Waiting for others threads to close their open tables")); while (found && ! thd->killed) { found=0; @@ -348,12 +350,40 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh, } -/* Put all tables used by thread in free list */ +/* + Close all tables used by thread -void close_thread_tables(THD *thd, bool locked) + SYNOPSIS + close_thread_tables() + thd Thread handler + lock_in_use Set to 1 (0 = default) if caller has a lock on + LOCK_open + skip_derived Set to 1 (0 = default) if we should not free derived + tables. + + IMPLEMENTATION + Unlocks tables and frees derived tables. + Put all normal tables used by thread in free list. +*/ + +void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived) { DBUG_ENTER("close_thread_tables"); + if (thd->derived_tables && !skip_derived) + { + TABLE *table, *next; + /* + Close all derived tables generated from questions like + SELECT * from (select * from t1)) + */ + for (table= thd->derived_tables ; table ; table= next) + { + next= table->next; + free_tmp_table(thd, table); + } + thd->derived_tables= 0; + } if (thd->locked_tables) { ha_commit_stmt(thd); // If select statement @@ -364,10 +394,11 @@ void close_thread_tables(THD *thd, bool locked) if (thd->lock) { - mysql_unlock_tables(thd, thd->lock); thd->lock=0; + mysql_unlock_tables(thd, thd->lock); + thd->lock=0; } /* VOID(pthread_sigmask(SIG_SETMASK,&thd->block_signals,NULL)); */ - if (!locked) + if (!lock_in_use) VOID(pthread_mutex_lock(&LOCK_open)); safe_mutex_assert_owner(&LOCK_open); @@ -386,7 +417,7 @@ void close_thread_tables(THD *thd, bool locked) /* Tell threads waiting for refresh that something has happened */ VOID(pthread_cond_broadcast(&COND_refresh)); } - if (!locked) + if (!lock_in_use) VOID(pthread_mutex_unlock(&LOCK_open)); /* VOID(pthread_sigmask(SIG_SETMASK,&thd->signals,NULL)); */ DBUG_VOID_RETURN; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 3ca1f4827ff..ab789370660 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -90,7 +90,7 @@ THD::THD():user_time(0), fatal_error(0), db_length=query_length=col_access=0; query_error=0; next_insert_id=last_insert_id=0; - open_tables=temporary_tables=handler_tables=0; + open_tables= temporary_tables= handler_tables= derived_tables= 0; current_tablenr=0; handler_items=0; tmp_table=0; diff --git a/sql/sql_class.h b/sql/sql_class.h index bc72e6324e9..253ec3d2918 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -442,7 +442,7 @@ public: handler_tables - list of tables that were opened with HANDLER OPEN and are still in use by this thread */ - TABLE *open_tables,*temporary_tables, *handler_tables; + TABLE *open_tables,*temporary_tables, *handler_tables, *derived_tables; // TODO: document the variables below MYSQL_LOCK *lock; /* Current locks */ MYSQL_LOCK *locked_tables; /* Tables locked with LOCK */ diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 1ddaedeb480..0a2e2947add 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (C) 2002-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 @@ -17,7 +17,7 @@ /* Derived tables - These were introduced by Monty and Sinisa + These were introduced by Sinisa */ @@ -38,17 +38,26 @@ static const char *any_db="*any*"; // Special symbol for check_access t TABLE_LIST for the upper SELECT IMPLEMENTATION - - Derived table is resolved with temporary table. It is created based on the - queries defined. After temporary table is created, if this is not EXPLAIN, - then the entire unit / node is deleted. unit is deleted if UNION is used - for derived table and node is deleted is it is a simple SELECT. + Derived table is resolved with temporary table. It is created based on the + queries defined. After temporary table is created, if this is not EXPLAIN, + then the entire unit / node is deleted. unit is deleted if UNION is used + for derived table and node is deleted is it is a simple SELECT. - After table creation, the above TABLE_LIST is updated with a new table. + After table creation, the above TABLE_LIST is updated with a new table. - This function is called before any command containing derived table is executed. + This function is called before any command containing derived table + is executed. - TODO: To move creation of derived tables IN open_and_lock_tables() + Derived tables is stored in thd->derived_tables and freed in + close_thread_tables() + + TODO + Move creation of derived tables in open_and_lock_tables() + + RETURN + 0 ok + 1 Error + -1 Error and error message given */ @@ -57,21 +66,21 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) SELECT_LEX *sl= unit->first_select(); List item_list; TABLE *table; - int res= 0; + int res; select_union *derived_result; TABLE_LIST *tables= (TABLE_LIST *)sl->table_list.first; TMP_TABLE_PARAM tmp_table_param; bool is_union=sl->next_select() && sl->next_select()->linkage == UNION_TYPE; - DBUG_ENTER("mysql_derived"); SELECT_LEX_NODE *save_current_select= lex->current_select; + DBUG_ENTER("mysql_derived"); - -/* - In create_total_list, derived tables have to be treated in case of EXPLAIN, - This is because unit/node is not deleted in that case. Current code in this - function has to be improved to recognize better when this function is called - from derived tables and when from other functions. -*/ + /* + In create_total_list, derived tables have to be treated in case of + EXPLAIN, This is because unit/node is not deleted in that + case. Current code in this function has to be improved to + recognize better when this function is called from derived tables + and when from other functions. + */ if (is_union && unit->create_total_list(thd, lex, &tables)) DBUG_RETURN(-1); @@ -92,30 +101,21 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) { if (is_union) { -/* - The following code is a re-do of fix_tables_pointers() found in sql_select.cc - for UNION's within derived tables. The only difference is in navigation, as in - derived tables we care for this level only. + /* + The following code is a re-do of fix_tables_pointers() found + in sql_select.cc for UNION's within derived tables. The only + difference is in navigation, as in derived tables we care for + this level only. - fix_tables_pointers makes sure that in UNION's we do not open single table twice - if found in different SELECT's. - -*/ - for (SELECT_LEX *sel= sl; - sel; - sel= sel->next_select()) - { - for (TABLE_LIST *cursor= (TABLE_LIST *)sel->table_list.first; - cursor; - cursor=cursor->next) - cursor->table= cursor->table_list->table; - } + */ + for (SELECT_LEX *sel= sl; sel; sel= sel->next_select()) + relink_tables(sel); } lex->current_select= sl; if (setup_fields(thd,tables,item_list,0,0,1)) { - res=-1; + res= -1; goto exit; } bzero((char*) &tmp_table_param,sizeof(tmp_table_param)); @@ -127,7 +127,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) TMP_TABLE_ALL_COLUMNS), HA_POS_ERROR))) { - res=-1; + res= -1; goto exit; } @@ -142,7 +142,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) sl->options&= ~OPTION_FOUND_ROWS; if (is_union) - res=mysql_union(thd,lex,derived_result,unit); + res= mysql_union(thd,lex,derived_result,unit); else res= mysql_select(thd, tables, sl->item_list, sl->where, (ORDER *) sl->order_list.first, @@ -153,9 +153,12 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) if (!res) { -// Here we entirely fix both TABLE_LIST and list of SELECT's as there were no derived tables + /* + Here we entirely fix both TABLE_LIST and list of SELECT's as + there were no derived tables + */ if (derived_result->flush()) - res=1; + res= 1; else { t->real_name=table->real_name; @@ -164,23 +167,29 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t) table->tmp_table=TMP_TABLE; if (lex->describe) { + // to fix a problem in EXPLAIN if (tables) - tables->table_list->table=tables->table; // to fix a problem in EXPLAIN + tables->table_list->table=tables->table; } else unit->exclude(); - t->db=(char *)""; - t->derived=(SELECT_LEX *)1; // just in case ... + t->db= (char *)""; + t->derived=(SELECT_LEX *) 1; // just in case ... table->file->info(HA_STATUS_VARIABLE); } } delete derived_result; } if (res) - free_tmp_table(thd,table); + free_tmp_table(thd, table); + else + { + table->next= thd->derived_tables; + thd->derived_tables= table; + } exit: lex->current_select= save_current_select; - close_thread_tables(thd); + close_thread_tables(thd, 0, 1); } DBUG_RETURN(res); } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b2f08b4e0d4..f6e21e421d9 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1390,7 +1390,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, send_error(thd, ER_UNKNOWN_COM_ERROR); break; } - if (thd->lock || thd->open_tables) + if (thd->lock || thd->open_tables || thd->derived_tables) { thd->proc_info="closing tables"; close_thread_tables(thd); /* Free tables */ @@ -1534,9 +1534,11 @@ mysql_execute_command(THD *thd) for (SELECT_LEX *sl= lex->all_selects_list; sl; sl= sl->next_select_in_list()) + { for (TABLE_LIST *cursor= sl->get_table_list(); cursor; cursor= cursor->next) + { if (cursor->derived && (res=mysql_derived(thd, lex, (SELECT_LEX_UNIT *) cursor->derived, @@ -1546,6 +1548,8 @@ mysql_execute_command(THD *thd) send_error(thd,thd->killed ? ER_SERVER_SHUTDOWN : 0); DBUG_VOID_RETURN; } + } + } } if ((&lex->select_lex != lex->all_selects_list && lex->unit.create_total_list(thd, lex, &tables)) || diff --git a/sql/sql_select.cc b/sql/sql_select.cc index b57e45a1a52..c5a4362c71e 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -184,6 +184,16 @@ int handle_select(THD *thd, LEX *lex, select_result *result) return res; } + +void relink_tables(SELECT_LEX *select_lex) +{ + for (TABLE_LIST *cursor= (TABLE_LIST *) select_lex->table_list.first; + cursor; + cursor=cursor->next) + cursor->table= cursor->table_list->table; +} + + void fix_tables_pointers(SELECT_LEX *select_lex) { if (select_lex->next_select_in_list()) @@ -192,18 +202,15 @@ void fix_tables_pointers(SELECT_LEX *select_lex) for (SELECT_LEX *sl= select_lex; sl; sl= sl->next_select_in_list()) - { - for (TABLE_LIST *cursor= (TABLE_LIST *)sl->table_list.first; - cursor; - cursor=cursor->next) - cursor->table= cursor->table_list->table; - } + relink_tables(sl); } } + /* - Inline function to setup clauses without sum functions + Function to setup clauses without sum functions */ + inline int setup_without_group(THD *thd, TABLE_LIST *tables, List &fields, List &all_fields, diff --git a/sql/sql_select.h b/sql/sql_select.h index 1fbe2052831..e30bba830eb 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -374,3 +374,4 @@ public: bool cp_buffer_from_ref(TABLE_REF *ref); bool error_if_full_join(JOIN *join); +void relink_tables(SELECT_LEX *select_lex); From b3b66f640841e459e18a3d4300766b56f0cf3bc8 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jan 2003 16:53:10 +0200 Subject: [PATCH 175/220] Portability fixes Fixed test suite for HPUX 10.20 and MacOSX Build-tools/Do-compile: Added timeout to mysqladmin shutdown commands Kill old running mysqld started by earlier runs Removed run time warning from LD_LIBRARY_PATH client/mysqladmin.c: Return 1 if pid file isn't deleted on shutdown. Fix error message if pid file is not deleted client/mysqltest.c: Always allow --debug flag (Makes it easier to run mysql-test-run) mysql-test/mysql-test-run.sh: A lot of safety fixes. This fixes some problems with test suite for HPUX 10.20 and MacOSX sql-bench/bench-init.pl.sh: Allow tests to change time limit. sql-bench/crash-me.sh: Indentation cleanups Added DROP for a created table sql-bench/test-alter-table.sh: Added default time limit Changed test to be estimated to get down run time. Fixed that add_multi_col is detected sql-bench/test-insert.sh: Comment cleanup sql/mysql_priv.h: Removed not needed prototype. sql/mysqld.cc: Removed DBUG warnings Removed default argument for clean_up() and made it static. More comments. Ignore SIGHUP during shutdown sql/net_pkg.cc: More comments sql/slave.cc: Added DBUG_PRINT messages --- Build-tools/Do-compile | 27 +++++--- client/mysqladmin.c | 62 +++++++++++------ client/mysqltest.c | 8 +-- mysql-test/mysql-test-run.sh | 33 ++++++--- sql-bench/bench-init.pl.sh | 5 +- sql-bench/crash-me.sh | 126 +++++++++++++++++++--------------- sql-bench/test-alter-table.sh | 43 ++++++++++-- sql-bench/test-insert.sh | 7 +- sql/mysql_priv.h | 1 - sql/mysqld.cc | 43 +++++++----- sql/net_pkg.cc | 5 +- sql/slave.cc | 2 + 12 files changed, 233 insertions(+), 129 deletions(-) diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index 4351a4f69f4..8695c72b913 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -135,6 +135,7 @@ $ENV{'MYSQL_UNIX_PORT'}=$mysql_unix_port="$opt_tmp/mysql$opt_suffix.build"; $ENV{"PERL5LIB"}="$pwd/$host/perl5:$pwd/$host/perl5/site_perl"; $slave_port=$mysql_tcp_port+16; $manager_port=$mysql_tcp_port+1; +$mysqladmin_args="--no-defaults -u root --connect_timeout=5 --shutdown_timeout=20"; if ($opt_stage == 0) { @@ -154,13 +155,18 @@ log_timestamp(); if (-x "$host/bin/mysqladmin") { - log_system("$host/bin/mysqladmin --no-defaults -u root -S $mysql_unix_port -s shutdown"); - log_system("$host/bin/mysqladmin --no-defaults -u root -P $mysql_tcp_port -h $host -s shutdown"); - log_system("$host/bin/mysqladmin --no-defaults -u root -P $slave_port -h $host -s shutdown"); - log_system("$host/bin/mysqladmin --no-defaults -u root -P 9306 -h $host -s shutdown"); - log_system("$host/bin/mysqladmin --no-defaults -u root -P 9307 -h $host -s shutdown"); + log_system("$host/bin/mysqladmin $mysqladmin_args -S $mysql_unix_port -s shutdown"); + log_system("$host/bin/mysqladmin $mysqladmin_args -P $mysql_tcp_port -h $host -s shutdown"); + log_system("$host/bin/mysqladmin $mysqladmin_args -P $slave_port -h $host -s shutdown"); + log_system("$host/bin/mysqladmin $mysqladmin_args -P 9306 -h $host -s shutdown"); + log_system("$host/bin/mysqladmin $mysqladmin_args -P 9307 -h $host -s shutdown"); } kill_all("mysqlmanager"); +# +# Kill all old processes that are in the build directories +# This is to find any old mysqld servers left from previous builds +kill_all("$pwd/host/mysql"); +kill_all("$pwd/host/test"); if ($opt_stage == 0) { @@ -308,8 +314,9 @@ if ($opt_stage <= 4 && !$opt_no_test) $tar_file =~ /(mysql[^\/]*)\.tar/; $ver=$1; $test_dir="$pwd/$host/test/$ver"; -$ENV{"LD_LIBRARY_PATH"}= "$test_dir/lib:" . $ENV{"LD_LIBRARY_PATH"}; - +$ENV{"LD_LIBRARY_PATH"}= ("$test_dir/lib" . + (defined($ENV{"LD_LIBRARY_PATH"}) ? + ":" . $ENV{"LD_LIBRARY_PATH"} : "")); # # Run the test suite # @@ -328,7 +335,7 @@ if (!$opt_no_test && !$opt_no_benchmark) { my $extra; safe_cd($test_dir); - log_system("./bin/mysqladmin --no-defaults -u root -S $mysql_unix_port -s shutdown") || info("There was no mysqld running\n"); + log_system("./bin/mysqladmin $mysqladmin_args -S $mysql_unix_port -s shutdown") || info("There was no mysqld running\n"); sleep(2); log_system("rm -f ./data/mysql/*"); check_system("scripts/mysql_install_db --no-defaults --skip-locking","https://order"); @@ -418,7 +425,7 @@ if ($opt_stage <= 9 && !$opt_no_test && !$opt_no_benchmark) rm_all($bench_tmpdir); rm_all("$opt_tmp") if ($new_opt_tmp); -log_system("$pwd/$host/bin/mysqladmin --no-defaults -S $mysql_unix_port -u root shutdown"); +log_system("$pwd/$host/bin/mysqladmin $mysqladmin_args -S $mysql_unix_port -u root shutdown"); print LOG "ok\n"; close LOG; print "$host: ok\n"; @@ -429,7 +436,7 @@ exit 0; sub usage { print < -#define ADMIN_VERSION "8.38" +#define ADMIN_VERSION "8.39" #define MAX_MYSQL_VAR 128 #define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */ #define MAX_TRUNC_LENGTH 3 @@ -70,8 +70,8 @@ static void print_relative_header(); static void print_relative_line(); static void truncate_names(); static my_bool get_pidfile(MYSQL *mysql, char *pidfile); -static void wait_pidfile(char *pidfile, time_t last_modified, - struct stat *pidfile_status); +static my_bool wait_pidfile(char *pidfile, time_t last_modified, + struct stat *pidfile_status); static void store_values(MYSQL_RES *result); /* @@ -481,7 +481,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) printf("Shutdown signal sent to server; Waiting for pid file to disappear\n"); /* Wait until pid file is gone */ - wait_pidfile(pidfile, last_modified, &pidfile_status); + if (wait_pidfile(pidfile, last_modified, &pidfile_status)) + return -1; } break; } @@ -1110,34 +1111,51 @@ static my_bool get_pidfile(MYSQL *mysql, char *pidfile) return 1; /* Error */ } +/* + Return 1 if pid file didn't disappear or change +*/ -static void wait_pidfile(char *pidfile, time_t last_modified, - struct stat *pidfile_status) +static my_bool wait_pidfile(char *pidfile, time_t last_modified, + struct stat *pidfile_status) { char buff[FN_REFLEN]; - int fd = -1; - uint count=0; + int error= 1; + uint count= 0; + DBUG_ENTER("wait_pidfile"); system_filename(buff, pidfile); - while (count++ <= opt_shutdown_timeout && !interrupted && - (!last_modified || (last_modified == pidfile_status->st_mtime)) && - (fd= my_open(buff, O_RDONLY, MYF(0))) >= 0) + do { - if (!my_close(fd,MYF(0))) - fd= -1; + int fd; + if ((fd= my_open(buff, O_RDONLY, MYF(0))) < 0) + { + error= 0; + break; + } + (void) my_close(fd,MYF(0)); + if (last_modified && !stat(pidfile, pidfile_status)) + { + if (last_modified != pidfile_status->st_mtime) + { + /* File changed; Let's assume that mysqld did restart */ + if (opt_verbose) + printf("pid file '%s' changed while waiting for it to disappear!\nmysqld did probably restart\n", + buff); + error= 0; + break; + } + } + if (count++ == opt_shutdown_timeout) + break; sleep(1); - if (last_modified && stat(pidfile, pidfile_status)) - last_modified= 0; - } - if (opt_verbose && last_modified && - last_modified != pidfile_status->st_mtime) - printf("Warning; pid file '%s' changed while waiting for it to disappear!\n", - buff); - if (fd >= 0) + } while (!interrupted); + + if (error) { - my_close(fd,MYF(0)); + DBUG_PRINT("warning",("Pid file didn't disappear")); fprintf(stderr, "Warning; Aborted waiting on pid file: '%s' after %d seconds\n", buff, count-1); } + DBUG_RETURN(error); } diff --git a/client/mysqltest.c b/client/mysqltest.c index 20d277ca969..fe99dda1ac3 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -42,7 +42,7 @@ **********************************************************************/ -#define MTEST_VERSION "1.25" +#define MTEST_VERSION "1.26" #include #include @@ -1797,10 +1797,8 @@ int read_query(struct st_query** q_ptr) static struct my_option my_long_options[] = { -#ifndef DBUG_OFF {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"database", 'D', "Database to use.", (gptr*) &db, (gptr*) &db, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"basedir", 'b', "Basedir for tests", (gptr*) &opt_basedir, @@ -1893,7 +1891,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), { switch(optid) { case '#': +#ifndef DBUG_OFF DBUG_PUSH(argument ? argument : "d:t:S:i:O,/tmp/mysqltest.trace"); +#endif break; case 'r': record = 1; @@ -1971,7 +1971,7 @@ int parse_args(int argc, char **argv) default_argv= argv; if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) - exit(ho_error); + exit(1); if (argc > 1) { diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 5c80e7d538a..408c76d8602 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -88,6 +88,7 @@ sleep_until_file_created () wait_for_pid() { pid=$1 + #$WAIT_PID pid $SLEEP_TIME_FOR_DELETE } # No paths below as we can't be sure where the program is! @@ -343,9 +344,9 @@ while test $# -gt 0; do ;; --debug) EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \ - --debug=d:t:i:O,$MYSQL_TEST_DIR/var/log/master.trace" + --debug=d:t:i:A,$MYSQL_TEST_DIR/var/log/master.trace" EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT \ - --debug=d:t:i:O,$MYSQL_TEST_DIR/var/log/slave.trace" + --debug=d:t:i:A,$MYSQL_TEST_DIR/var/log/slave.trace" EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT --debug" ;; --fast) @@ -419,6 +420,7 @@ if [ x$SOURCE_DIST = x1 ] ; then fi MYSQLADMIN="$BASEDIR/client/mysqladmin" + WAIT_PID="$BASEDIR/extra/mysql_waitpid" MYSQL_MANAGER_CLIENT="$BASEDIR/client/mysqlmanagerc" MYSQL_MANAGER="$BASEDIR/tools/mysqlmanager" MYSQL_MANAGER_PWGEN="$BASEDIR/client/mysqlmanager-pwgen" @@ -435,6 +437,7 @@ else fi MYSQL_TEST="$BASEDIR/bin/mysqltest" MYSQLADMIN="$BASEDIR/bin/mysqladmin" + WAIT_PID="$BASEDIR/bin/mysql_waitpid" MYSQL_MANAGER="$BASEDIR/bin/mysqlmanager" MYSQL_MANAGER_CLIENT="$BASEDIR/bin/mysqlmanagerc" MYSQL_MANAGER_PWGEN="$BASEDIR/bin/mysqlmanager-pwgen" @@ -749,9 +752,9 @@ manager_term() { pid=$1 ident=$2 - shift if [ $USE_MANAGER = 0 ] ; then - $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=5 --shutdown_timeout=20 shutdown >> $MYSQL_MANAGER_LOG 2>&1 + # Shutdown time must be high as slave may be in reconnect + $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1 res=$? # Some systems require an extra connect $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1 @@ -873,8 +876,8 @@ start_slave() [ x$SKIP_SLAVE = x1 ] && return eval "this_slave_running=\$SLAVE$1_RUNNING" [ x$this_slave_running = 1 ] && return - #when testing fail-safe replication, we will have more than one slave - #in this case, we start secondary slaves with an argument + # When testing fail-safe replication, we will have more than one slave + # in this case, we start secondary slaves with an argument slave_ident="slave$1" if [ -n "$1" ] ; then @@ -982,9 +985,12 @@ EOF mysql_start () { - $ECHO "Starting MySQL daemon" - start_master - start_slave +# We should not start the deamon here as we don't know the argumens +# for the test. Better to let the test start the deamon + +# $ECHO "Starting MySQL daemon" +# start_master +# start_slave cd $MYSQL_TEST_DIR return 1 } @@ -1085,8 +1091,6 @@ run_testcase () slave_init_script=$TESTDIR/$tname-slave.sh slave_master_info_file=$TESTDIR/$tname-slave-master-info.opt echo $tname > $CURRENT_TEST - echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR - echo "CURRENT_TEST: $tname" >> $MASTER_MYERR SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0` if [ $USE_MANAGER = 1 ] ; then many_slaves=`$EXPR \( $tname : rpl_failsafe \) != 0` @@ -1123,13 +1127,17 @@ run_testcase () then EXTRA_MASTER_OPT=`$CAT $master_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"` stop_master + echo "CURRENT_TEST: $tname" >> $MASTER_MYERR start_master else if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] ; then EXTRA_MASTER_OPT="" stop_master + echo "CURRENT_TEST: $tname" >> $MASTER_MYERR start_master + else + echo "CURRENT_TEST: $tname" >> $MASTER_MYERR fi fi @@ -1159,7 +1167,10 @@ run_testcase () if [ x$do_slave_restart = x1 ] ; then stop_slave + echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR start_slave + else + echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR fi if [ x$many_slaves = x1 ]; then start_slave 1 diff --git a/sql-bench/bench-init.pl.sh b/sql-bench/bench-init.pl.sh index 9b999ee7f95..b7d2b962e13 100644 --- a/sql-bench/bench-init.pl.sh +++ b/sql-bench/bench-init.pl.sh @@ -48,7 +48,10 @@ $opt_optimization="None"; $opt_hw=""; $opt_threads=5; -$opt_time_limit=10*60; # Don't wait more than 10 min for some tests +if (!defined($opt_time_limit)) +{ + $opt_time_limit=10*60; # Don't wait more than 10 min for some tests +} $log_prog_args=join(" ", skip_arguments(\@ARGV,"comments","cmp","server", "user", "host", "database", "password", diff --git a/sql-bench/crash-me.sh b/sql-bench/crash-me.sh index ea18431f8da..130816de0be 100644 --- a/sql-bench/crash-me.sh +++ b/sql-bench/crash-me.sh @@ -39,7 +39,7 @@ # as such, and clarify ones such as "mediumint" with comments such as # "3-byte int" or "same as xxx". -$version="1.59"; +$version="1.60"; use DBI; use Getopt::Long; @@ -50,7 +50,7 @@ $opt_server="mysql"; $opt_host="localhost"; $opt_database="test"; $opt_dir="limits"; $opt_user=$opt_password="";$opt_verbose=""; $opt_debug=$opt_help=$opt_Information=$opt_restart=$opt_force=$opt_quick=0; -$opt_log_all_queries=$opt_fix_limit_file=$opt_batch_mode=0; +$opt_log_all_queries=$opt_fix_limit_file=$opt_batch_mode=$opt_version=0; $opt_db_start_cmd=""; # the db server start command $opt_check_server=0; # Check if server is alive before each query $opt_sleep=10; # time to sleep while starting the db server @@ -68,8 +68,10 @@ GetOptions("Information","help","server=s","debug","user=s","password=s", "database=s","restart","force","quick","log-all-queries","comment=s", "host=s","fix-limit-file","dir=s","db-start-cmd=s","sleep=s","suffix=s", "batch-mode","config-file=s","log-queries-to-file=s","check-server", +"version", "verbose!" => \$opt_verbose) || usage(); usage() if ($opt_help || $opt_Information); +version() && exit(0) if ($opt_version); $opt_suffix = '-'.$opt_suffix if (length($opt_suffix) != 0); $opt_config_file = "$pwd/$opt_dir/$opt_server$opt_suffix.cfg" @@ -1190,7 +1192,7 @@ else # Test: NOROUND { - my $resultat = 'undefined'; + my $result = 'undefined'; my $error; print "NOROUND: "; save_incomplete('func_extra_noround','Function NOROUND'); @@ -1199,21 +1201,25 @@ else $error = safe_query_l('func_extra_noround',"select noround(22.6) $end_query"); if ($error ne 1) # syntax error -- noround is not supported { - $resultat = 'no' - } else # Ok, now check if it really works - { + $result = 'no' + } + else # Ok, now check if it really works + { $error=safe_query_l('func_extra_noround', ["create table crash_me_nr (a int)", "insert into crash_me_nr values(noround(10.2))", "drop table crash_me_nr $drop_attr"]); - if ($error eq 1) { - $resultat = "syntax only"; - } else { - $resultat = 'yes'; - } - } - print "$resultat\n"; - save_config_data('func_extra_noround',$resultat,"Function NOROUND"); + if ($error == 1) + { + $result= "syntax only"; + } + else + { + $result= 'yes'; + } + } + print "$result\n"; + save_config_data('func_extra_noround',$result,"Function NOROUND"); } check_parenthesis("func_sql_","CURRENT_USER"); @@ -1377,7 +1383,7 @@ if ($limits{'type_sql_date'} eq 'yes') # Test: WEEK() { - my $resultat="no"; + my $result="no"; my $error; print "WEEK:"; save_incomplete('func_odbc_week','WEEK'); @@ -1388,17 +1394,17 @@ if ($limits{'type_sql_date'} eq 'yes') # and 0 - EURO weeks if ($error == -1) { if ($last_result == 4) { - $resultat = 'USA'; + $result = 'USA'; } else { - $resultat='error'; + $result='error'; add_log('func_odbc_week', " must return 4 or 5, but $last_result"); } } elsif ($error == 0) { - $resultat = 'EURO'; + $result = 'EURO'; } - print " $resultat\n"; - save_config_data('func_odbc_week',$resultat,"WEEK"); + print " $result\n"; + save_config_data('func_odbc_week',$result,"WEEK"); } my $insert_query ='insert into crash_me_d values('. @@ -1498,7 +1504,7 @@ if ($limits{'type_sql_date'} eq 'yes') # NOT id BETWEEN a and b if ($limits{'func_where_not_between'} eq 'yes') { - my $resultat = 'error'; + my $result = 'error'; my $err; my $key='not_id_between'; my $prompt='NOT ID BETWEEN interprets as ID NOT BETWEEN'; @@ -1512,15 +1518,15 @@ if ($limits{'func_where_not_between'} eq 'yes') 5,0); if ($err eq 1) { if (not defined($last_result)) { - $resultat='no'; + $result='no'; }; }; if ( $err eq 0) { - $resultat = 'yes'; + $result = 'yes'; }; safe_query_l($key,["drop table crash_me_b"]); - save_config_data($key,$resultat,$prompt); - print "$resultat\n"; + save_config_data($key,$result,$prompt); + print "$result\n"; }; @@ -2018,37 +2024,44 @@ report("views","views", # Test: foreign key { - my $resultat = 'undefined'; + my $result = 'undefined'; my $error; print "foreign keys: "; save_incomplete('foreign_key','foreign keys'); # 1) check if foreign keys are supported - safe_query_l('foreign_key',create_table("crash_me_qf",["a integer not null"], - ["primary key (a)"])); - $error = safe_query_l('foreign_key', - create_table("crash_me_qf2",["a integer not null", - "foreign key (a) references crash_me_qf (a)"], [])); - - if ($error eq 1) # OK -- syntax is supported + safe_query_l('foreign_key', + create_table("crash_me_qf", + ["a integer not null"], + ["primary key (a)"])); + $error= safe_query_l('foreign_key', + create_table("crash_me_qf2", + ["a integer not null", + "foreign key (a) references crash_me_qf (a)"], + [])); + + if ($error == 1) # OK -- syntax is supported { - $resultat = 'error'; + $result = 'error'; # now check if foreign key really works safe_query_l('foreign_key', "insert into crash_me_qf values (1)"); - if (safe_query_l('foreign_key', "insert into crash_me_qf2 values (2)") eq 1) + if (safe_query_l('foreign_key', "insert into crash_me_qf2 values (2)") eq 1) { - $resultat = 'syntax only'; - } else { - $resultat = 'yes'; - } - - } else { - $resultat = "no"; - } - safe_query_l('foreign_key', - "drop table crash_me_qf2 $drop_attr","drop table crash_me_qf $drop_attr"); - print "$resultat\n"; - save_config_data('foreign_key',$resultat,"foreign keys"); + $result = 'syntax only'; + } + else + { + $result = 'yes'; + } + } + else + { + $result = "no"; + } + safe_query_l('foreign_key', "drop table crash_me_qf2 $drop_attr"); + safe_query_l('foreign_key', "drop table crash_me_qf $drop_attr"); + print "$result\n"; + save_config_data('foreign_key',$result,"foreign keys"); } report("Create SCHEMA","create_schema", @@ -2607,7 +2620,7 @@ sub detect_null_position sub check_parenthesis { my $prefix=shift; my $fn=shift; - my $resultat='no'; + my $result='no'; my $param_name=$prefix.lc($fn); my $r; @@ -2616,18 +2629,18 @@ sub check_parenthesis { add_log($param_name,$safe_query_log); if ($r == 1) { - $resultat="yes"; + $result="yes"; } else{ $r = safe_query("select $fn() $end_query"); add_log($param_name,$safe_query_log); if ( $r == 1) { - $resultat="with_parenthesis"; + $result="with_parenthesis"; } } - save_config_data($param_name,$resultat,$fn); + save_config_data($param_name,$result,$fn); } sub check_constraint { @@ -2699,10 +2712,16 @@ sub make_date { } +sub version +{ + print "$0 Ver $version\n"; +} + + sub usage { + version(); print <finish; } diff --git a/sql-bench/test-alter-table.sh b/sql-bench/test-alter-table.sh index cc6453188de..f338792e9ef 100644 --- a/sql-bench/test-alter-table.sh +++ b/sql-bench/test-alter-table.sh @@ -27,6 +27,7 @@ $opt_start_field_count=8; # start with this many fields $opt_loop_count=20; # How many tests to do $opt_row_count=1000; # Rows in the table $opt_field_count=1000; # Add until this many fields. +$opt_time_limit=10*60; # Don't wait more than 10 min for some tests chomp($pwd = `pwd`); $pwd = "." if ($pwd eq ''); require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n"; @@ -113,10 +114,9 @@ if ($opt_fast) } else { - $add=1 if (!$limits{'alter_add_multi_col'}); + $add=1 if (!$limits->{'alter_add_multi_col'}); } - $count=0; while ($field_count < $opt_field_count) { @@ -131,19 +131,43 @@ while ($field_count < $opt_field_count) $tmp="" if (!$multi_add); # Adabas } do_query($dbh,"ALTER TABLE bench " . substr($fields,1)); + $end_time=new Benchmark; + last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$count, + $opt_field_count/$add+1)); } $end_time=new Benchmark; -print "Time for alter_table_add ($count): " . +if ($estimated) +{ print "Estimated time"; } +else +{ print "Time"; } +print " for alter_table_add ($count): " . timestr(timediff($end_time, $loop_time),"all") . "\n\n"; +# +# If estimated, fix table to have known number of fields +# +if ($estimated && $field_count < $opt_field_count) +{ + $fields=""; + $tmp="ADD "; + while ($field_count < $opt_field_count) + { + $field_count++; + $fields.=",$tmp i${field_count} integer"; + $tmp="" if (!$multi_add); # Adabas + } + do_query($dbh,"ALTER TABLE bench " . substr($fields,1)); +} + #### #### Test adding and deleting index on the first $opt_start_fields #### $loop_time=new Benchmark; -for ($i=1; $i < $opt_start_field_count ; $i++) +$count= 0; +for ($i=1; $i <= $opt_start_field_count ; $i++) { $dbh->do("CREATE INDEX bench_ind$i ON bench (i${i})") || die $DBI::errstr; } @@ -153,7 +177,7 @@ print "Time for create_index ($opt_start_field_count): " . timestr(timediff($end_time, $loop_time),"all") . "\n\n"; $loop_time=new Benchmark; -for ($i=1; $i < $opt_start_field_count ; $i++) +for ($i=1; $i <= $opt_start_field_count ; $i++) { $dbh->do($server->drop_index("bench","bench_ind$i")) || die $DBI::errstr; } @@ -182,10 +206,17 @@ while ($field_count > $opt_start_field_count) } $dbh->do("ALTER TABLE bench " . substr($fields,1) . $server->{'drop_attr'}) || die $DBI::errstr; + $end_time=new Benchmark; + last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$count, + $opt_field_count/$add+1)); } $end_time=new Benchmark; -print "Time for alter_table_drop ($count): " . +if ($estimated) +{ print "Estimated time"; } +else +{ print "Time"; } +print " for alter_table_drop ($count): " . timestr(timediff($end_time, $loop_time),"all") . "\n\n"; skip_dropcol: diff --git a/sql-bench/test-insert.sh b/sql-bench/test-insert.sh index 085d7cce7f3..38014f7cddf 100644 --- a/sql-bench/test-insert.sh +++ b/sql-bench/test-insert.sh @@ -21,10 +21,11 @@ # $opt_loop_count rows in random order # # changes made for Oracle compatibility -# - $limits{'func_odbc_mod'} is OK from crash-me, but it fails here so set we +# - $limits->{'func_odbc_mod'} is OK from crash-me, but it fails here so set we # set it to 0 in server-cfg -# - the default server config runs out of rollback segments, so I added a couple -# of disconnect/connects to reset +# - the default server config runs out of rollback segments, so we added a +# couple of disconnect/connects to reset +# ##################### Standard benchmark inits ############################## use DBI; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 3cf6bb2c1a5..2a8b263bf28 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -772,7 +772,6 @@ uint calc_week(TIME *ltime, bool with_year, bool sunday_first_day_of_week, void find_date(char *pos,uint *vek,uint flag); TYPELIB *convert_strings_to_array_type(my_string *typelibs, my_string *end); TYPELIB *typelib(List &strings); -void clean_up(bool print_message=1); ulong get_form_pos(File file, uchar *head, TYPELIB *save_names); ulong make_new_entry(File file,uchar *fileinfo,TYPELIB *formnames, const char *newname); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 61ae07c01e7..e7190f575db 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -470,6 +470,7 @@ extern "C" pthread_handler_decl(handle_slave,arg); static uint set_maximum_open_files(uint max_file_limit); #endif static ulong find_bit_type(const char *x, TYPELIB *bit_lib); +static void clean_up(bool print_message); /**************************************************************************** ** Code to end mysqld @@ -742,13 +743,13 @@ void kill_mysql(void) #if defined(OS2) extern "C" void kill_server(int sig_ptr) -#define RETURN_FROM_KILL_SERVER return +#define RETURN_FROM_KILL_SERVER DBUG_RETURN #elif !defined(__WIN__) static void *kill_server(void *sig_ptr) -#define RETURN_FROM_KILL_SERVER return 0 +#define RETURN_FROM_KILL_SERVER DBUG_RETURN(0) #else static void __cdecl kill_server(int sig_ptr) -#define RETURN_FROM_KILL_SERVER return +#define RETURN_FROM_KILL_SERVER DBUG_RETURN #endif { int sig=(int) (long) sig_ptr; // This is passed a int @@ -827,7 +828,7 @@ extern "C" sig_handler print_signal_warning(int sig) void unireg_end(void) { - clean_up(); + clean_up(1); my_thread_end(); #ifdef SIGNALS_DONT_BREAK_READ exit(0); @@ -842,7 +843,7 @@ extern "C" void unireg_abort(int exit_code) DBUG_ENTER("unireg_abort"); if (exit_code) sql_print_error("Aborting\n"); - clean_up(); /* purecov: inspected */ + clean_up(1); /* purecov: inspected */ DBUG_PRINT("quit",("done with cleanup in unireg_abort")); my_thread_end(); exit(exit_code); /* purecov: inspected */ @@ -887,12 +888,12 @@ void clean_up(bool print_message) regex_end(); #endif + if (print_message && errmesg) + sql_print_error(ER(ER_SHUTDOWN_COMPLETE),my_progname); #if !defined(__WIN__) && !defined(EMBEDDED_LIBRARY) if (!opt_bootstrap) (void) my_delete(pidfile_name,MYF(0)); // This may not always exist #endif - if (print_message && errmesg) - sql_print_error(ER(ER_SHUTDOWN_COMPLETE),my_progname); x_free((gptr) my_errmsg[ERRMAPP]); /* Free messages */ DBUG_PRINT("quit", ("Error messages freed")); /* Tell main we are ready */ @@ -902,6 +903,10 @@ void clean_up(bool print_message) /* do the broadcast inside the lock to ensure that my_end() is not called */ (void) pthread_cond_broadcast(&COND_thread_count); (void) pthread_mutex_unlock(&LOCK_thread_count); + /* + The following lines may never be executed as the main thread may have + killed us + */ DBUG_PRINT("quit", ("done with cleanup")); } /* clean_up */ @@ -1481,7 +1486,7 @@ static void init_signals(void) /* Change limits so that we will get a core file */ struct rlimit rl; rl.rlim_cur = rl.rlim_max = RLIM_INFINITY; - if (setrlimit(RLIMIT_CORE, &rl)) + if (setrlimit(RLIMIT_CORE, &rl) && global_system_variables.log_warnings) sql_print_error("Warning: setrlimit could not change the size of core files to 'infinity'; We may not be able to generate a core file on signals"); } #endif @@ -1550,8 +1555,11 @@ extern "C" void *signal_hand(void *arg __attribute__((unused))) my_thread_init(); // Init new thread DBUG_ENTER("signal_hand"); SIGNAL_THD; - /* Setup alarm handler */ - init_thr_alarm(max_connections+max_insert_delayed_threads); + /* + Setup alarm handler + The two extra handlers are for slave threads + */ + init_thr_alarm(max_connections+max_insert_delayed_threads+2); #if SIGINT != THR_KILL_SIGNAL (void) sigemptyset(&set); // Setup up SIGINT for debug (void) sigaddset(&set,SIGINT); // For debugging @@ -1639,12 +1647,15 @@ extern "C" void *signal_hand(void *arg __attribute__((unused))) } break; case SIGHUP: - reload_acl_and_cache((THD*) 0, - (REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST | - REFRESH_STATUS | REFRESH_GRANT | REFRESH_THREADS | - REFRESH_HOSTS), - (TABLE_LIST*) 0); // Flush logs - mysql_print_status((THD*) 0); // Send debug some info + if (!abort_loop) + { + reload_acl_and_cache((THD*) 0, + (REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST | + REFRESH_STATUS | REFRESH_GRANT | + REFRESH_THREADS | REFRESH_HOSTS), + (TABLE_LIST*) 0); // Flush logs + mysql_print_status((THD*) 0); // Send debug some info + } break; #ifdef USE_ONE_SIGNAL_HAND case THR_SERVER_ALARM: diff --git a/sql/net_pkg.cc b/sql/net_pkg.cc index afedba6a259..30cad3a4177 100644 --- a/sql/net_pkg.cc +++ b/sql/net_pkg.cc @@ -134,7 +134,10 @@ net_printf(NET *net, uint errcode, ...) { if (thd && thd->bootstrap) { - /* In bootstrap it's ok to print on stderr */ + /* + In bootstrap it's ok to print on stderr + This may also happen when we get an error from a slave thread + */ fprintf(stderr,"ERROR: %d %s\n",errcode,text_pos); thd->fatal_error=1; } diff --git a/sql/slave.cc b/sql/slave.cc index d254221e726..455b574b355 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -376,6 +376,7 @@ int terminate_slave_threads(MASTER_INFO* mi,int thread_mask,bool skip_lock) } if ((thread_mask & (SLAVE_IO|SLAVE_FORCE_ALL)) && mi->slave_running) { + DBUG_PRINT("info",("Terminating IO thread")); mi->abort_slave=1; if ((error=terminate_slave_thread(mi->io_thd,io_lock, io_cond_lock, @@ -386,6 +387,7 @@ int terminate_slave_threads(MASTER_INFO* mi,int thread_mask,bool skip_lock) } if ((thread_mask & (SLAVE_SQL|SLAVE_FORCE_ALL)) && mi->rli.slave_running) { + DBUG_PRINT("info",("Terminating SQL thread")); DBUG_ASSERT(mi->rli.sql_thd != 0) ; mi->rli.abort_slave=1; if ((error=terminate_slave_thread(mi->rli.sql_thd,sql_lock, From 4b7013dd20da3e787f0c4c3a861704684cfdc96f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jan 2003 19:04:41 +0200 Subject: [PATCH 176/220] Added new program, mysql_waitpid. --- extra/Makefile.am | 2 +- extra/mysql_waitpid.c | 86 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 extra/mysql_waitpid.c diff --git a/extra/Makefile.am b/extra/Makefile.am index 2d7dc95f616..8e4491969b5 100644 --- a/extra/Makefile.am +++ b/extra/Makefile.am @@ -18,7 +18,7 @@ INCLUDES = @MT_INCLUDES@ -I$(srcdir)/../include -I../include -I.. LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \ ../dbug/libdbug.a ../strings/libmystrings.a bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \ - resolve_stack_dump mysql_install + resolve_stack_dump mysql_install mysql_waitpid # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/extra/mysql_waitpid.c b/extra/mysql_waitpid.c new file mode 100644 index 00000000000..6e307209fda --- /dev/null +++ b/extra/mysql_waitpid.c @@ -0,0 +1,86 @@ +#include +#include +#include +#include +#include +#include + +static const char *VER= "1.0"; +static char *progname; +static int verbose= 0; + +void usage(void); + +static struct my_option my_long_options[] = +{ + {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, + 0, 0, 0, 0, 0}, + {"help", 'I', "Synonym for -?.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, + 0, 0, 0, 0, 0}, + {"verbose", 'v', + "Be more verbose. Give a warning, if kill can't handle signal 0.", 0, 0, 0, + GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"version", 'V', "Print version information and exit.", 0, 0, 0, + GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} +}; + +static my_bool +get_one_option(int optid, const struct my_option *opt __attribute__((unused)), + char *argument __attribute__((unused))) +{ + switch(optid) { + case 'V': + printf("%s version %s by Jani Tolonen\n", progname, VER); + exit(-1); + case 'I': + case '?': + usage(); + } + return 0; +} + + +int main(int argc, char *argv[]) +{ + int pid= 0, t= 0, sig= 0; + + progname= argv[0]; + + if (handle_options(&argc, &argv, my_long_options, get_one_option)) + exit(-1); + if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 || + (t= atoi(argv[1])) <= 0) + usage(); + for (; t >= 0; t--) + { + if (kill((pid_t) pid, sig)) + { + if (errno == EINVAL) + { + if (verbose) + printf("WARNING: kill couldn't handle signal 0, using signal 1.\n"); + sig= 1; + t++; + continue; + } + return 0; + } + sleep(1); + } + return 1; +} + +void usage(void) +{ + printf("%s version %s by Jani Tolonen\n\n", progname, VER); + printf("usage: %s [options] #pid #time\n\n", progname); + printf("Description: Waits for a program, which program id is #pid, to\n"); + printf("terminate within #time seconds. If the program terminates within\n"); + printf("this time, or if the #pid no longer exists, value 0 is returned.\n"); + printf("Otherwise 1 is returned. Both #pid and #time must be positive\n"); + printf("integer arguments.\n\n"); + printf("Options:\n"); + my_print_help(my_long_options); + exit(-1); +} From 9ac310e1b85d2b2f2e83e8c7ca4af2e7086bb0b4 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jan 2003 21:20:43 +0200 Subject: [PATCH 177/220] mem0pool.c: Remove the warning message that mem allocation spills from the additional mem pool to the OS; this does not hit performance with modern malloc libraries innobase/mem/mem0pool.c: Remove the warning message that mem allocation spills from the additional mem pool to the OS; this does not hit performance with modern malloc libraries --- innobase/mem/mem0pool.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/innobase/mem/mem0pool.c b/innobase/mem/mem0pool.c index 1c32a4d02a6..382e505b63f 100644 --- a/innobase/mem/mem0pool.c +++ b/innobase/mem/mem0pool.c @@ -259,19 +259,6 @@ mem_pool_fill_free_list( /* We come here when we have run out of space in the memory pool: */ - if (mem_out_of_mem_err_msg_count % 1000000000 == 0) { - /* We do not print the message every time: */ - - ut_print_timestamp(stderr); - - fprintf(stderr, - " InnoDB: Out of memory in additional memory pool.\n" - "InnoDB: InnoDB will start allocating memory from the OS.\n" - "InnoDB: You may get better performance if you configure a bigger\n" - "InnoDB: value in the MySQL my.cnf file for\n" - "InnoDB: innodb_additional_mem_pool_size.\n"); - } - mem_out_of_mem_err_msg_count++; return(FALSE); From 7ffc2004a810ccd497c7adac5e92673fd9cd11d5 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jan 2003 23:32:25 +0200 Subject: [PATCH 178/220] Enchanced my_once..() functions. Cleaned up charset.c Removed non fatal memory leak in charset.c include/my_sys.h: Enchanced my_once..() functions. mysys/charset.c: Moved my_once_strdup() to my_once.cc Added usage of my_once_memdup() A lot of indentation changes. mysys/my_once.c: Enchanced my_once..() functions. --- include/my_sys.h | 2 + mysys/charset.c | 332 ++++++++++++++++++++++++----------------------- mysys/my_once.c | 19 +++ 3 files changed, 188 insertions(+), 165 deletions(-) diff --git a/include/my_sys.h b/include/my_sys.h index ab5dedc0ba1..f11afb08b36 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -505,6 +505,8 @@ extern int my_setwd(const char *dir,myf MyFlags); extern int my_lock(File fd,int op,my_off_t start, my_off_t length,myf MyFlags); extern gptr my_once_alloc(uint Size,myf MyFlags); extern void my_once_free(void); +extern char *my_once_strdup(const char *src,myf myflags); +extern char *my_once_memdup(const char *src, uint len, myf myflags); extern my_string my_tempnam(const char *dir,const char *pfx,myf MyFlags); extern File my_open(const char *FileName,int Flags,myf MyFlags); extern File my_register_filename(File fd, const char *FileName, diff --git a/mysys/charset.c b/mysys/charset.c index ce853cc6f54..cfb5b0264ce 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -28,7 +28,7 @@ static my_bool create_fromuni(CHARSET_INFO *cs); #define MY_CHARSET_INDEX "Index.xml" -const char *charsets_dir = NULL; +const char *charsets_dir= NULL; static int charset_initialized=0; #define MAX_LINE 1024 @@ -39,9 +39,10 @@ static int charset_initialized=0; #define SORT_ORDER_TABLE_SIZE 256 #define TO_UNI_TABLE_SIZE 256 + char *get_charsets_dir(char *buf) { - const char *sharedir = SHAREDIR; + const char *sharedir= SHAREDIR; DBUG_ENTER("get_charsets_dir"); if (charsets_dir != NULL) @@ -56,7 +57,7 @@ char *get_charsets_dir(char *buf) NullS); } convert_dirname(buf,buf,NullS); - DBUG_PRINT("info",("charsets dir='%s'", buf)); + DBUG_PRINT("info",("charsets dir: '%s'", buf)); DBUG_RETURN(strend(buf)); } @@ -66,7 +67,7 @@ char *get_charsets_dir(char *buf) #ifndef DBUG_OFF static void mstr(char *str,const char *src,uint l1,uint l2) { - l1 = l1str; s++) + { if (!strncmp(attr,s->str,len)) return s; + } return NULL; } @@ -172,106 +175,90 @@ static void simple_cs_init_functions(CHARSET_INFO *cs) cs->mbmaxlen = 1; } -/* FIXME: BAR: move to more proper place, my_alloc.c I suppose */ -static char *my_once_strdup(const char *src,myf myflags) -{ - uint len=strlen(src); - char *dst=my_once_alloc(len+1,myflags); - if (dst) - memcpy(dst,src,len+1); - return dst; -} static void simple_cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from) { - to->number = from->number ? from->number : to->number; - to->state |= from->state; + to->number= from->number ? from->number : to->number; + to->state|= from->state; if (from->csname) - to->csname=my_once_strdup(from->csname,MYF(MY_WME)); + to->csname= my_once_strdup(from->csname,MYF(MY_WME)); if (from->name) - to->name=my_once_strdup(from->name,MYF(MY_WME)); + to->name= my_once_strdup(from->name,MYF(MY_WME)); if (from->ctype) - { - to->ctype = (uchar*) my_once_alloc(CTYPE_TABLE_SIZE,MYF(MY_WME)); - memcpy((char*)to->ctype,(char*)from->ctype,CTYPE_TABLE_SIZE); - } + to->ctype= (uchar*) my_once_memdup((char*) from->ctype, + CTYPE_TABLE_SIZE, MYF(MY_WME)); if (from->to_lower) - { - to->to_lower = (uchar*) my_once_alloc(TO_LOWER_TABLE_SIZE,MYF(MY_WME)); - memcpy((char*)to->to_lower,(char*)from->to_lower,TO_LOWER_TABLE_SIZE); - } + to->to_lower= (uchar*) my_once_memdup((char*) from->to_lower, + TO_LOWER_TABLE_SIZE, MYF(MY_WME)); if (from->to_upper) - { - to->to_upper = (uchar*) my_once_alloc(TO_UPPER_TABLE_SIZE,MYF(MY_WME)); - memcpy((char*)to->to_upper,(char*)from->to_upper,TO_UPPER_TABLE_SIZE); - } + to->to_upper= (uchar*) my_once_memdup((char*) from->to_upper, + TO_UPPER_TABLE_SIZE, MYF(MY_WME)); if (from->sort_order) { - to->sort_order=(uchar*) my_once_alloc(SORT_ORDER_TABLE_SIZE,MYF(MY_WME)); - memcpy((char*)to->sort_order,(char*)from->sort_order, SORT_ORDER_TABLE_SIZE); + to->sort_order= (uchar*) my_once_memdup((char*) from->sort_order, + SORT_ORDER_TABLE_SIZE, + MYF(MY_WME)); set_max_sort_char(to); } if (from->tab_to_uni) { uint sz=TO_UNI_TABLE_SIZE*sizeof(uint16); - to->tab_to_uni=(uint16*)my_once_alloc(sz,MYF(MY_WME)); - memcpy((char*)to->tab_to_uni,(char*)from->tab_to_uni,sz); + to->tab_to_uni= (uint16*) my_once_memdup((char*)from->tab_to_uni, sz, + MYF(MY_WME)); create_fromuni(to); } } + static my_bool simple_cs_is_full(CHARSET_INFO *cs) { - return - (cs->csname && cs->tab_to_uni && cs->ctype && cs->to_upper && cs->to_lower) - && - (cs->number && cs->name && cs->sort_order); + return ((cs->csname && cs->tab_to_uni && cs->ctype && cs->to_upper && + cs->to_lower) && + (cs->number && cs->name && cs->sort_order)); } + static int fill_uchar(uchar *a,uint size,const char *str, uint len) { - uint i=0; + uint i= 0; const char *s, *b, *e=str+len; - for (s=str ; s size) break; - if (i>size) - break; - a[i]=my_strntoul(my_charset_latin1,b,s-b,NULL,16); + a[i]= my_strntoul(my_charset_latin1,b,s-b,NULL,16); } return 0; } static int fill_uint16(uint16 *a,uint size,const char *str, uint len) { - uint i=0; + uint i= 0; const char *s, *b, *e=str+len; - for (s=str ; s size) break; - if (i>size) - break; - a[i]=my_strntol(my_charset_latin1,b,s-b,NULL,16); + a[i]= my_strntol(my_charset_latin1,b,s-b,NULL,16); } return 0; } + static int cs_enter(MY_XML_PARSER *st,const char *attr, uint len) { - struct my_cs_file_info *i = (struct my_cs_file_info *)st->user_data; - struct my_cs_file_section_st *s = cs_file_sec(attr,len); + struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; + struct my_cs_file_section_st *s= cs_file_sec(attr,len); if ( s && (s->state == _CS_CHARSET)) { @@ -280,23 +267,23 @@ static int cs_enter(MY_XML_PARSER *st,const char *attr, uint len) return MY_XML_OK; } + static int cs_leave(MY_XML_PARSER *st,const char *attr, uint len) { - struct my_cs_file_info *i = (struct my_cs_file_info *)st->user_data; - struct my_cs_file_section_st *s = cs_file_sec(attr,len); - int state = s ? s->state : 0; + struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; + struct my_cs_file_section_st *s= cs_file_sec(attr,len); + int state= s ? s->state : 0; if (state == _CS_COLLATION) { - if (i->cs.name && (i->cs.number || (i->cs.number=get_charset_number(i->cs.name)))) + if (i->cs.name && (i->cs.number || + (i->cs.number=get_charset_number(i->cs.name)))) { if (!all_charsets[i->cs.number]) { if (!(all_charsets[i->cs.number]= (CHARSET_INFO*) my_once_alloc(sizeof(CHARSET_INFO),i->myflags))) - { return MY_XML_ERROR; - } bzero((void*)all_charsets[i->cs.number],sizeof(CHARSET_INFO)); } @@ -309,22 +296,22 @@ static int cs_leave(MY_XML_PARSER *st,const char *attr, uint len) all_charsets[i->cs.number]->state |= MY_CS_LOADED; } } - i->cs.number=0; - i->cs.name=NULL; - i->cs.state=0; - i->cs.sort_order=NULL; - i->cs.state=0; + i->cs.number= 0; + i->cs.name= NULL; + i->cs.state= 0; + i->cs.sort_order= NULL; + i->cs.state= 0; } } - return MY_XML_OK; } + static int cs_value(MY_XML_PARSER *st,const char *attr, uint len) { - struct my_cs_file_info *i = (struct my_cs_file_info *)st->user_data; + struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; struct my_cs_file_section_st *s; - int state = (s=cs_file_sec(st->attr,strlen(st->attr))) ? s->state : 0; + int state= (s=cs_file_sec(st->attr,strlen(st->attr))) ? s->state : 0; #ifndef DBUG_OFF if(0){ @@ -334,49 +321,49 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len) } #endif - switch (state) - { - case _CS_ID: - i->cs.number = my_strntoul(my_charset_latin1,attr,len,(char**)NULL,0); - break; - case _CS_COLNAME: - memcpy(i->name,attr,len=min(len,CS_MAX_NM_LEN-1)); - i->name[len]='\0'; - i->cs.name=i->name; - break; - case _CS_NAME: - memcpy(i->csname,attr,len=min(len,CS_MAX_NM_LEN-1)); - i->csname[len]='\0'; - i->cs.csname=i->csname; - break; - case _CS_FLAG: - if (!strncmp("primary",attr,len)) - i->cs.state |= MY_CS_PRIMARY; - break; - case _CS_UPPERMAP: - fill_uchar(i->to_upper,TO_UPPER_TABLE_SIZE,attr,len); - i->cs.to_upper=i->to_upper; - break; - case _CS_LOWERMAP: - fill_uchar(i->to_lower,TO_LOWER_TABLE_SIZE,attr,len); - i->cs.to_lower=i->to_lower; - break; - case _CS_UNIMAP: - fill_uint16(i->tab_to_uni,TO_UNI_TABLE_SIZE,attr,len); - i->cs.tab_to_uni=i->tab_to_uni; - break; - case _CS_COLLMAP: - fill_uchar(i->sort_order,SORT_ORDER_TABLE_SIZE,attr,len); - i->cs.sort_order=i->sort_order; - break; - case _CS_CTYPEMAP: - fill_uchar(i->ctype,CTYPE_TABLE_SIZE,attr,len); - i->cs.ctype=i->ctype; - break; + switch (state) { + case _CS_ID: + i->cs.number= my_strntoul(my_charset_latin1,attr,len,(char**)NULL,0); + break; + case _CS_COLNAME: + memcpy(i->name,attr,len=min(len,CS_MAX_NM_LEN-1)); + i->name[len]='\0'; + i->cs.name=i->name; + break; + case _CS_NAME: + memcpy(i->csname,attr,len=min(len,CS_MAX_NM_LEN-1)); + i->csname[len]='\0'; + i->cs.csname=i->csname; + break; + case _CS_FLAG: + if (!strncmp("primary",attr,len)) + i->cs.state|= MY_CS_PRIMARY; + break; + case _CS_UPPERMAP: + fill_uchar(i->to_upper,TO_UPPER_TABLE_SIZE,attr,len); + i->cs.to_upper=i->to_upper; + break; + case _CS_LOWERMAP: + fill_uchar(i->to_lower,TO_LOWER_TABLE_SIZE,attr,len); + i->cs.to_lower=i->to_lower; + break; + case _CS_UNIMAP: + fill_uint16(i->tab_to_uni,TO_UNI_TABLE_SIZE,attr,len); + i->cs.tab_to_uni=i->tab_to_uni; + break; + case _CS_COLLMAP: + fill_uchar(i->sort_order,SORT_ORDER_TABLE_SIZE,attr,len); + i->cs.sort_order=i->sort_order; + break; + case _CS_CTYPEMAP: + fill_uchar(i->ctype,CTYPE_TABLE_SIZE,attr,len); + i->cs.ctype=i->ctype; + break; } return MY_XML_OK; } + static my_bool read_charset_index(const char *filename, myf myflags) { char *buf; @@ -385,10 +372,10 @@ static my_bool read_charset_index(const char *filename, myf myflags) MY_XML_PARSER p; struct my_cs_file_info i; - if (! (buf = (char *)my_malloc(MAX_BUF,myflags))) + if (!(buf= (char *)my_malloc(MAX_BUF,myflags))) return FALSE; - strmov(get_charsets_dir(buf),filename); + strmov(get_charsets_dir(buf), filename); if ((fd=my_open(buf,O_RDONLY,myflags)) < 0) { @@ -405,18 +392,18 @@ static my_bool read_charset_index(const char *filename, myf myflags) my_xml_set_leave_handler(&p,cs_leave); my_xml_set_user_data(&p,(void*)&i); - if (MY_XML_OK!=my_xml_parse(&p,buf,len)) + if (my_xml_parse(&p,buf,len) != MY_XML_OK) { - /* +#ifdef NOT_YET printf("ERROR at line %d pos %d '%s'\n", - my_xml_error_lineno(&p)+1, - my_xml_error_pos(&p), - my_xml_error_string(&p)); - */ + my_xml_error_lineno(&p)+1, + my_xml_error_pos(&p), + my_xml_error_string(&p)); +#endif } - + my_xml_parser_free(&p); - + my_free(buf, myflags); return FALSE; } @@ -429,7 +416,7 @@ static void set_max_sort_char(CHARSET_INFO *cs) return; max_char=cs->sort_order[(uchar) cs->max_sort_char]; - for (i = 0; i < 256; i++) + for (i= 0; i < 256; i++) { if ((uchar) cs->sort_order[i] > max_char) { @@ -445,14 +432,14 @@ static my_bool init_available_charsets(myf myflags) /* We have to use charset_initialized to not lock on THR_LOCK_charset inside get_internal_charset... - */ + */ if (!charset_initialized) { CHARSET_INFO **cs; - /* - To make things thread safe we are not allowing other threads to interfere - while we may changing the cs_info_table - */ + /* + To make things thread safe we are not allowing other threads to interfere + while we may changing the cs_info_table + */ pthread_mutex_lock(&THR_LOCK_charset); bzero(&all_charsets,sizeof(all_charsets)); @@ -464,7 +451,7 @@ static my_bool init_available_charsets(myf myflags) if (*cs) set_max_sort_char(*cs); } - error = read_charset_index(MY_CHARSET_INDEX,myflags); + error= read_charset_index(MY_CHARSET_INDEX,myflags); charset_initialized=1; pthread_mutex_unlock(&THR_LOCK_charset); } @@ -477,14 +464,17 @@ void free_charsets(void) charset_initialized=0; } + static void get_charset_conf_name(const char *cs_name, char *buf) { strxmov(get_charsets_dir(buf), cs_name, ".conf", NullS); } -typedef struct { - int nchars; - MY_UNI_IDX uidx; + +typedef struct +{ + int nchars; + MY_UNI_IDX uidx; } uni_idx; #define PLANE_SIZE 0x100 @@ -493,16 +483,18 @@ typedef struct { static int pcmp(const void * f, const void * s) { - const uni_idx *F=(const uni_idx*)f; - const uni_idx *S=(const uni_idx*)s; + const uni_idx *F= (const uni_idx*) f; + const uni_idx *S= (const uni_idx*) s; int res; - if(!(res=((S->nchars)-(F->nchars)))) + if (!(res=((S->nchars)-(F->nchars)))) res=((F->uidx.from)-(S->uidx.to)); return res; } -static my_bool create_fromuni(CHARSET_INFO *cs){ + +static my_bool create_fromuni(CHARSET_INFO *cs) +{ uni_idx idx[PLANE_NUM]; int i,n; @@ -510,14 +502,14 @@ static my_bool create_fromuni(CHARSET_INFO *cs){ bzero(idx,sizeof(idx)); /* Count number of characters in each plane */ - for(i=0;i<0x100;i++) + for (i=0; i< 0x100; i++) { uint16 wc=cs->tab_to_uni[i]; int pl= PLANE_NUMBER(wc); - if(wc || !i) + if (wc || !i) { - if(!idx[pl].nchars) + if (!idx[pl].nchars) { idx[pl].uidx.from=wc; idx[pl].uidx.to=wc; @@ -533,34 +525,37 @@ static my_bool create_fromuni(CHARSET_INFO *cs){ /* Sort planes in descending order */ qsort(&idx,PLANE_NUM,sizeof(uni_idx),&pcmp); - for(i=0;itab_to_uni[ch]; - if(wc>=idx[i].uidx.from && wc<=idx[i].uidx.to && wc) + if (wc >= idx[i].uidx.from && wc <= idx[i].uidx.to && wc) { - int ofs=wc-idx[i].uidx.from; - idx[i].uidx.tab[ofs]=ch; + int ofs= wc - idx[i].uidx.from; + idx[i].uidx.tab[ofs]= ch; } } } /* Allocate and fill reverse table for each plane */ n=i; - cs->tab_from_uni=(MY_UNI_IDX*)my_once_alloc(sizeof(MY_UNI_IDX)*(n+1),MYF(MY_WME)); - for(i=0;itab_from_uni[i]=idx[i].uidx; + cs->tab_from_uni= (MY_UNI_IDX*) my_once_alloc(sizeof(MY_UNI_IDX)*(n+1), + MYF(MY_WME)); + for (i=0; i< n; i++) + cs->tab_from_uni[i]= idx[i].uidx; /* Set end-of-list marker */ bzero(&cs->tab_from_uni[i],sizeof(MY_UNI_IDX)); @@ -574,10 +569,11 @@ uint get_charset_number(const char *charset_name) if (init_available_charsets(MYF(0))) /* If it isn't initialized */ return 0; - for (cs = all_charsets; cs < all_charsets+255; ++cs) + for (cs= all_charsets; cs < all_charsets+255; ++cs) + { if ( cs[0] && cs[0]->name && !strcmp(cs[0]->name, charset_name)) return cs[0]->number; - + } return 0; /* this mimics find_type() */ } @@ -589,7 +585,7 @@ const char *get_charset_name(uint charset_number) return "?"; cs=all_charsets[charset_number]; - if ( cs && (cs->number==charset_number) && cs->name ) + if (cs && (cs->number == charset_number) && cs->name ) return (char*) cs->name; return (char*) "?"; /* this mimics find_type() */ @@ -598,7 +594,7 @@ const char *get_charset_name(uint charset_number) static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags) { - char buf[FN_REFLEN]; + char buf[FN_REFLEN]; CHARSET_INFO *cs; /* To make things thread safe we are not allowing other threads to interfere @@ -606,13 +602,13 @@ static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags) */ pthread_mutex_lock(&THR_LOCK_charset); - cs = all_charsets[cs_number]; + cs= all_charsets[cs_number]; if (cs && !(cs->state & (MY_CS_COMPILED | MY_CS_LOADED))) { strxmov(buf, cs->csname, ".xml", NullS); read_charset_index(buf,flags); - cs = (cs->state & MY_CS_LOADED) ? cs : NULL; + cs= (cs->state & MY_CS_LOADED) ? cs : NULL; } pthread_mutex_unlock(&THR_LOCK_charset); return cs; @@ -653,14 +649,16 @@ my_bool set_default_charset(uint cs, myf flags) CHARSET_INFO *new_charset; DBUG_ENTER("set_default_charset"); DBUG_PRINT("enter",("character set: %d",(int) cs)); - new_charset = get_charset(cs, flags); + + new_charset= get_charset(cs, flags); if (!new_charset) { DBUG_PRINT("error",("Couldn't set default character set")); DBUG_RETURN(TRUE); /* error */ } - default_charset_info = new_charset; - system_charset_info = new_charset; + default_charset_info= new_charset; + system_charset_info= new_charset; + DBUG_RETURN(FALSE); } @@ -680,23 +678,26 @@ CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags) return cs; } + my_bool set_default_charset_by_name(const char *cs_name, myf flags) { CHARSET_INFO *new_charset; DBUG_ENTER("set_default_charset_by_name"); DBUG_PRINT("enter",("character set: %s", cs_name)); - new_charset = get_charset_by_name(cs_name, flags); + + new_charset= get_charset_by_name(cs_name, flags); if (!new_charset) { DBUG_PRINT("error",("Couldn't set default character set")); DBUG_RETURN(TRUE); /* error */ } - default_charset_info = new_charset; - system_charset_info = new_charset; + default_charset_info= new_charset; + system_charset_info= new_charset; DBUG_RETURN(FALSE); } + /* Only append name if it doesn't exist from before */ static my_bool charset_in_string(const char *name, DYNAMIC_STRING *s) @@ -708,13 +709,14 @@ static my_bool charset_in_string(const char *name, DYNAMIC_STRING *s) if (! pos[length] || pos[length] == ' ') return TRUE; /* Already existed */ } - return FALSE; } + static void charset_append(DYNAMIC_STRING *s, const char *name) { - if (!charset_in_string(name, s)) { + if (!charset_in_string(name, s)) + { dynstr_append(s, name); dynstr_append(s, " "); } @@ -724,7 +726,7 @@ static void charset_append(DYNAMIC_STRING *s, const char *name) /* Returns a dynamically-allocated string listing the character sets requested. The caller is responsible for freeing the memory. */ -char * list_charsets(myf want_flags) +char *list_charsets(myf want_flags) { DYNAMIC_STRING s; char *p; @@ -735,7 +737,7 @@ char * list_charsets(myf want_flags) if (want_flags & MY_CS_COMPILED) { CHARSET_INFO **cs; - for (cs = all_charsets; cs < all_charsets+255; cs++) + for (cs= all_charsets; cs < all_charsets+255; cs++) { if (cs[0]) { @@ -766,19 +768,19 @@ char * list_charsets(myf want_flags) if (want_flags & (MY_CS_INDEX|MY_CS_LOADED)) { CHARSET_INFO **cs; - for (cs = all_charsets; cs < all_charsets + 255; cs++) + for (cs= all_charsets; cs < all_charsets + 255; cs++) if (cs[0] && cs[0]->name && (cs[0]->state & want_flags) ) charset_append(&s, cs[0]->name); } if (s.length) { - s.str[s.length - 1] = '\0'; /* chop trailing space */ - p = my_strdup(s.str, MYF(MY_WME)); + s.str[s.length - 1]= '\0'; /* chop trailing space */ + p= my_strdup(s.str, MYF(MY_WME)); } else { - p = my_strdup("", MYF(MY_WME)); + p= my_strdup("", MYF(MY_WME)); } dynstr_free(&s); diff --git a/mysys/my_once.c b/mysys/my_once.c index 1250ce24994..e1c728897aa 100644 --- a/mysys/my_once.c +++ b/mysys/my_once.c @@ -78,6 +78,25 @@ gptr my_once_alloc(unsigned int Size, myf MyFlags) } /* my_once_alloc */ +char *my_once_strdup(const char *src,myf myflags) +{ + uint len=strlen(src)+1; + char *dst=my_once_alloc(len, myflags); + if (dst) + memcpy(dst, src, len); + return dst; +} + + +char *my_once_memdup(const char *src, uint len, myf myflags) +{ + char *dst=my_once_alloc(len, myflags); + if (dst) + memcpy(dst, src, len); + return dst; +} + + /* Deallocate everything used by my_once_alloc From 02b7a30774400c65b21d27d87f5b2f2b26804150 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jan 2003 23:46:30 -0200 Subject: [PATCH 179/220] Fix embedded server crash sql/sql_show.cc: fix embedded server crash --- sql/sql_show.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index a11abf75506..50ee78c1ebc 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1217,6 +1217,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables, case SHOW_RPL_STATUS: net_store_data(&packet2, rpl_status_type[(int)rpl_status]); break; +#ifndef EMBEDDED_LIBRARY case SHOW_SLAVE_RUNNING: { LOCK_ACTIVE_MI; @@ -1226,6 +1227,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables, UNLOCK_ACTIVE_MI; break; } +#endif case SHOW_OPENTABLES: net_store_data(&packet2,(uint32) cached_tables()); break; From dbbfface5cd16290a6b1a155280623f9166ea923 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jan 2003 18:53:46 -0800 Subject: [PATCH 180/220] Protocol conversion tests --- tests/client_test.c | 1060 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 1015 insertions(+), 45 deletions(-) diff --git a/tests/client_test.c b/tests/client_test.c index d5e13dd3b43..b31268376ef 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -83,7 +83,7 @@ static void print_error(const char *msg) fprintf(stderr,"\n [MySQL-%s]",mysql->server_version); else fprintf(stderr,"\n [MySQL]"); - fprintf(stderr," %s\n",mysql_error(mysql)); + fprintf(stderr,"[%d] %s\n",mysql_errno(mysql),mysql_error(mysql)); } else if(msg) fprintf(stderr, " [MySQL] %s\n", msg); } @@ -97,7 +97,8 @@ static void print_st_error(MYSQL_STMT *stmt, const char *msg) else fprintf(stderr,"\n [MySQL]"); - fprintf(stderr," %s\n",mysql_stmt_error(stmt)); + fprintf(stderr,"[%d] %s\n",mysql_stmt_errno(stmt), + mysql_stmt_error(stmt)); } else if(msg) fprintf(stderr, " [MySQL] %s\n", msg); } @@ -106,18 +107,8 @@ static void client_disconnect(); #define myerror(msg) print_error(msg) #define mysterror(stmt, msg) print_st_error(stmt, msg) -#define myassert(exp) \ - if(!exp) {\ - client_disconnect(); \ - fprintf(stderr,"\n"); \ - assert(exp); \ -} -#define myassert_r(exp) \ - if(exp) {\ - client_disconnect(); \ - fprintf(stderr,"\n"); \ - assert(!(exp)); \ -} +#define myassert(exp) assert(exp) +#define myassert_r(exp) assert(!(exp)) #define myquery(r) \ { \ @@ -239,6 +230,9 @@ static void client_query() rc = mysql_query(mysql,"INSERT INTO myclient_test(name) VALUES('deleted')"); myquery(rc); + rc = mysql_query(mysql,"INSERT INTO myclient_test(name) VALUES('deleted')"); + myquery(rc); + rc = mysql_query(mysql,"UPDATE myclient_test SET name='updated' WHERE name='deleted'"); myquery(rc); @@ -343,10 +337,11 @@ int my_process_result_set(MYSQL_RES *result) my_print_dashes(result); if (mysql_errno(mysql) != 0) - fprintf(stderr, "\n mysql_fetch_row() failed\n"); + fprintf(stderr, "\n\tmysql_fetch_row() failed\n"); else - fprintf(stdout,"\n %d rows returned", row_count); - return(row_count); + fprintf(stdout,"\n\t%d %s returned\n", row_count, + row_count == 1 ? "row" : "rows"); + return row_count; } /******************************************************** @@ -388,7 +383,8 @@ uint my_process_stmt_result(MYSQL_STMT *stmt) { fputc('\t',stdout); fputc('|',stdout); - + + mysql_field_seek(result,0); for (i=0; i < field_count; i++) { field = mysql_fetch_field(result); @@ -404,9 +400,30 @@ uint my_process_stmt_result(MYSQL_STMT *stmt) row_count++; } my_print_dashes(result); - fprintf(stdout,"\n %d rows returned", row_count); + fprintf(stdout,"\n\t%d %s returned\n", row_count, + row_count == 1 ? "row" : "rows"); mysql_free_result(result); + return row_count; +} +/******************************************************** +* process the stmt result set * +*********************************************************/ +uint my_stmt_result(const char *query, unsigned long length) +{ + MYSQL_STMT *stmt; + uint row_count; + int rc; + + stmt= mysql_prepare(mysql,query,length); + mystmt_init(stmt); + + rc = mysql_execute(stmt); + mystmt(stmt,rc); + + row_count= my_process_stmt_result(stmt); + mysql_stmt_close(stmt); + return row_count; } @@ -1175,24 +1192,26 @@ static void test_fetch_null() rc = mysql_commit(mysql); myquery(rc); - rc = mysql_query(mysql,"INSERT INTO test_fetch_null(col11) VALUES(1000)"); + rc = mysql_query(mysql,"INSERT INTO test_fetch_null(col11) VALUES(1000),(88),(389789)"); myquery(rc); rc = mysql_commit(mysql); myquery(rc); /* fetch */ - for (i=0; i < 10; i++) + for (i=0; i <= 10; i++) { bind[i].buffer_type=FIELD_TYPE_LONG; length[i]=99; bind[i].length= (long *)&length[i]; } - bind[i].buffer_type=FIELD_TYPE_LONG; - bind[i].buffer=(gptr)&nData; + bind[i-1].buffer=(gptr)&nData; strcpy((char *)query , "SELECT * FROM test_fetch_null"); - stmt = mysql_prepare(mysql, query, strlen(query)); + + myassert(3 == my_stmt_result(query,50)); + + stmt = mysql_prepare(mysql, query, 50); mystmt_init(stmt); rc = mysql_bind_result(stmt,bind); @@ -1201,20 +1220,21 @@ static void test_fetch_null() rc = mysql_execute(stmt); mystmt(stmt, rc); - rc = mysql_fetch(stmt); - mystmt(stmt,rc); - - for (i=0; i < 10; i++) + rc= 0; + while (mysql_fetch(stmt) != MYSQL_NO_DATA) { - fprintf(stdout, "\n data[%d]: %s", i, length[i] == MYSQL_NULL_DATA ? "NULL" : "NOT NULL"); - myassert(length[i] == MYSQL_NULL_DATA); + rc++; + for (i=0; i < 10; i++) + { + fprintf(stdout, "\n data[%d] : %s", i, + length[i] == MYSQL_NULL_DATA ? "NULL" : "NOT NULL"); + myassert(length[i] == MYSQL_NULL_DATA); + } + fprintf(stdout, "\n data[%d]: %d", i, nData); + myassert(nData == 1000 || nData == 88 || nData == 389789); + myassert(length[i] == 4); } - fprintf(stdout, "\n data[%d]: %d", i, nData); - myassert(nData == 1000); - - rc = mysql_fetch(stmt); - myassert(rc == MYSQL_NO_DATA); - + myassert(rc == 3); mysql_stmt_close(stmt); } @@ -2603,6 +2623,8 @@ static void test_fetch_date() bind[6].buffer=(gptr)&ts_6; bind[6].length=(long *)&ts6_length; + myassert(1 == my_stmt_result("SELECT * FROM test_bind_result",50)); + stmt = mysql_prepare(mysql, "SELECT * FROM test_bind_result", 50); mystmt_init(stmt); @@ -2611,7 +2633,7 @@ static void test_fetch_date() rc = mysql_execute(stmt); mystmt(stmt, rc); - + ts_4[0]='\0'; rc = mysql_fetch(stmt); mystmt(stmt,rc); @@ -2628,7 +2650,7 @@ static void test_fetch_date() myassert(d_length == 10); myassert(strcmp(time,"12:49:00")==0); - myassert(d_length == 8); + myassert(t_length == 8); myassert(strcmp(ts,"2002-01-02 17:46:59")==0); myassert(ts_length == 19); @@ -2651,6 +2673,942 @@ static void test_fetch_date() mysql_stmt_close(stmt); } +/******************************************************** +* to test fetching of str to all types * +*********************************************************/ +static void test_fetch_str() +{ + MYSQL_STMT *stmt; + int rc, i, round, bit; + long data[10], length[10]; + float f_data; + double d_data; + char s_data[10]; + MYSQL_BIND bind[7]; + + myheader("test_fetch_str"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_str"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_bind_str(c1 char(10),\ + c2 char(10),\ + c3 char(20),\ + c4 char(20),\ + c5 char(30),\ + c6 char(40),\ + c7 char(20))"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + stmt = mysql_prepare(mysql,"INSERT INTO test_bind_str VALUES(?,?,?,?,?,?,?)",100); + myquery(rc); + + verify_param_count(stmt, 7); + + round= 0; + for (i=0; i < 7; i++) + { + bind[i].buffer_type= MYSQL_TYPE_LONG; + bind[i].buffer= (void *)&data[i]; + data[i]= round+i+1; + round= (round +10)*10; + } + rc = mysql_bind_param(stmt, bind); + mystmt(stmt,rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_commit(mysql); + myquery(rc); + + mysql_stmt_close(stmt); + + myassert(1 == my_stmt_result("SELECT * FROM test_bind_str",50)); + + stmt = mysql_prepare(mysql,"SELECT * FROM test_bind_str",50); + myquery(rc); + + for (i=0; i < 7; i++) + { + bind[i].buffer= (void *)&data[i]; + bind[i].length= (long *)&length[i]; + } + bind[0].buffer_type= MYSQL_TYPE_TINY; + bind[1].buffer_type= MYSQL_TYPE_SHORT; + bind[2].buffer_type= MYSQL_TYPE_LONG; + bind[3].buffer_type= MYSQL_TYPE_LONGLONG; + + bind[4].buffer_type= MYSQL_TYPE_FLOAT; + bind[4].buffer= (void *)&f_data; + + bind[5].buffer_type= MYSQL_TYPE_DOUBLE; + bind[5].buffer= (void *)&d_data; + + bind[6].buffer_type= MYSQL_TYPE_STRING; + bind[6].buffer= (void *)&s_data; + + rc = mysql_bind_result(stmt, bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + fprintf(stdout, "\n tiny : %ld(%ld)", data[0], length[0]); + fprintf(stdout, "\n short : %ld(%ld)", data[1], length[1]); + fprintf(stdout, "\n int : %ld(%ld)", data[2], length[2]); + fprintf(stdout, "\n longlong : %ld(%ld)", data[3], length[3]); + fprintf(stdout, "\n float : %f(%ld)", f_data, length[4]); + fprintf(stdout, "\n double : %g(%ld)", d_data, length[5]); + fprintf(stdout, "\n char : %s(%ld)", s_data, length[6]); + + round= 0; + bit= 1; + + for (i=0; i < 4; i++) + { + myassert(data[i] == round+i+1); + myassert(length[i] == bit); + round= (round+10)*10; + bit<<= 1; + } + + /* FLOAT */ + myassert((int)f_data == round+1+i); + myassert(length[4] == 4); + + /* DOUBLE */ + round= (round+10)*10; + myassert((int)d_data == round+2+i); + myassert(length[5] == 8); + + /* CHAR */ + round= (round+10)*10; + { + char buff[20]; + int len= sprintf(buff,"%d", round+3+i); + myassert(strcmp(s_data,buff)==0); + myassert(length[6] == len); + } + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} + +/******************************************************** +* to test fetching of long to all types * +*********************************************************/ +static void test_fetch_long() +{ + MYSQL_STMT *stmt; + int rc, i, round, bit; + long data[10], length[10]; + float f_data; + double d_data; + char s_data[10]; + MYSQL_BIND bind[7]; + + myheader("test_fetch_long"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_long"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_bind_long(c1 int unsigned,\ + c2 int unsigned,\ + c3 int,\ + c4 int,\ + c5 int,\ + c6 int unsigned,\ + c7 int)"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + stmt = mysql_prepare(mysql,"INSERT INTO test_bind_long VALUES(?,?,?,?,?,?,?)",100); + myquery(rc); + + verify_param_count(stmt, 7); + + round= 0; + for (i=0; i < 7; i++) + { + bind[i].buffer_type= MYSQL_TYPE_LONG; + bind[i].buffer= (void *)&data[i]; + data[i]= round+i+1; + round= (round +10)*10; + } + rc = mysql_bind_param(stmt, bind); + mystmt(stmt,rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_commit(mysql); + myquery(rc); + + mysql_stmt_close(stmt); + + myassert(1 == my_stmt_result("SELECT * FROM test_bind_long",50)); + + stmt = mysql_prepare(mysql,"SELECT * FROM test_bind_long",50); + myquery(rc); + + for (i=0; i < 7; i++) + { + bind[i].buffer= (void *)&data[i]; + bind[i].length= (long *)&length[i]; + } + bind[0].buffer_type= MYSQL_TYPE_TINY; + bind[1].buffer_type= MYSQL_TYPE_SHORT; + bind[2].buffer_type= MYSQL_TYPE_LONG; + bind[3].buffer_type= MYSQL_TYPE_LONGLONG; + + bind[4].buffer_type= MYSQL_TYPE_FLOAT; + bind[4].buffer= (void *)&f_data; + + bind[5].buffer_type= MYSQL_TYPE_DOUBLE; + bind[5].buffer= (void *)&d_data; + + bind[6].buffer_type= MYSQL_TYPE_STRING; + bind[6].buffer= (void *)&s_data; + + rc = mysql_bind_result(stmt, bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + fprintf(stdout, "\n tiny : %ld(%ld)", data[0], length[0]); + fprintf(stdout, "\n short : %ld(%ld)", data[1], length[1]); + fprintf(stdout, "\n int : %ld(%ld)", data[2], length[2]); + fprintf(stdout, "\n longlong : %ld(%ld)", data[3], length[3]); + fprintf(stdout, "\n float : %f(%ld)", f_data, length[4]); + fprintf(stdout, "\n double : %g(%ld)", d_data, length[5]); + fprintf(stdout, "\n char : %s(%ld)", s_data, length[6]); + + round= 0; + bit= 1; + + for (i=0; i < 4; i++) + { + myassert(data[i] == round+i+1); + myassert(length[i] == bit); + round= (round+10)*10; + bit<<= 1; + } + + /* FLOAT */ + myassert((int)f_data == round+1+i); + myassert(length[4] == 4); + + /* DOUBLE */ + round= (round+10)*10; + myassert((int)d_data == round+2+i); + myassert(length[5] == 8); + + /* CHAR */ + round= (round+10)*10; + { + char buff[20]; + int len= sprintf(buff,"%d", round+3+i); + myassert(strcmp(s_data,buff)==0); + myassert(length[6] == len); + } + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} + +/******************************************************** +* to test fetching of short to all types * +*********************************************************/ +static void test_fetch_short() +{ + MYSQL_STMT *stmt; + int rc, i, round, bit; + long data[10], length[10]; + float f_data; + double d_data; + char s_data[10]; + MYSQL_BIND bind[7]; + + myheader("test_fetch_short"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_long"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_bind_long(c1 smallint unsigned,\ + c2 smallint,\ + c3 smallint unsigned,\ + c4 smallint,\ + c5 smallint,\ + c6 smallint,\ + c7 smallint unsigned)"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + stmt = mysql_prepare(mysql,"INSERT INTO test_bind_long VALUES(?,?,?,?,?,?,?)",100); + myquery(rc); + + verify_param_count(stmt, 7); + + round= 0; + for (i=0; i < 7; i++) + { + bind[i].buffer_type= MYSQL_TYPE_LONG; + bind[i].buffer= (void *)&data[i]; + data[i]= round+i+1; + round= (round +10)*2; + } + rc = mysql_bind_param(stmt, bind); + mystmt(stmt,rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_commit(mysql); + myquery(rc); + + mysql_stmt_close(stmt); + + myassert(1 == my_stmt_result("SELECT * FROM test_bind_long",50)); + + stmt = mysql_prepare(mysql,"SELECT * FROM test_bind_long",50); + myquery(rc); + + for (i=0; i < 7; i++) + { + bind[i].buffer= (void *)&data[i]; + bind[i].length= (long *)&length[i]; + } + bind[0].buffer_type= MYSQL_TYPE_TINY; + bind[1].buffer_type= MYSQL_TYPE_SHORT; + bind[2].buffer_type= MYSQL_TYPE_LONG; + bind[3].buffer_type= MYSQL_TYPE_LONGLONG; + + bind[4].buffer_type= MYSQL_TYPE_FLOAT; + bind[4].buffer= (void *)&f_data; + + bind[5].buffer_type= MYSQL_TYPE_DOUBLE; + bind[5].buffer= (void *)&d_data; + + bind[6].buffer_type= MYSQL_TYPE_STRING; + bind[6].buffer= (void *)&s_data; + + rc = mysql_bind_result(stmt, bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + fprintf(stdout, "\n tiny : %ld(%ld)", data[0], length[0]); + fprintf(stdout, "\n short : %ld(%ld)", data[1], length[1]); + fprintf(stdout, "\n int : %ld(%ld)", data[2], length[2]); + fprintf(stdout, "\n longlong : %ld(%ld)", data[3], length[3]); + fprintf(stdout, "\n float : %f(%ld)", f_data, length[4]); + fprintf(stdout, "\n double : %g(%ld)", d_data, length[5]); + fprintf(stdout, "\n char : %s(%ld)", s_data, length[6]); + + round= 0; + bit= 1; + + for (i=0; i < 4; i++) + { + myassert(data[i] == round+i+1); + myassert(length[i] == bit); + round= (round+10)*2; + bit<<= 1; + } + + /* FLOAT */ + myassert((int)f_data == round+1+i); + myassert(length[4] == 4); + + /* DOUBLE */ + round= (round+10)*2; + myassert((int)d_data == round+2+i); + myassert(length[5] == 8); + + /* CHAR */ + round= (round+10)*2; + { + char buff[20]; + int len= sprintf(buff,"%d", round+3+i); + myassert(strcmp(s_data,buff)==0); + myassert(length[6] == len); + } + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} + +/******************************************************** +* to test fetching of tiny to all types * +*********************************************************/ +static void test_fetch_tiny() +{ + MYSQL_STMT *stmt; + int rc, i, bit; + long data[10], length[10]; + float f_data; + double d_data; + char s_data[10]; + MYSQL_BIND bind[7]; + + myheader("test_fetch_tiny"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_long"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_bind_long(c1 tinyint unsigned,\ + c2 tinyint,\ + c3 tinyint unsigned,\ + c4 tinyint,\ + c5 tinyint,\ + c6 tinyint,\ + c7 tinyint unsigned)"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + stmt = mysql_prepare(mysql,"INSERT INTO test_bind_long VALUES(?,?,?,?,?,?,?)",100); + myquery(rc); + + verify_param_count(stmt, 7); + + rc= 10; + for (i=0; i < 7; i++) + { + bind[i].buffer_type= MYSQL_TYPE_LONG; + bind[i].buffer= (void *)&data[i]; + data[i]= rc+i; + rc+= 10; + } + rc = mysql_bind_param(stmt, bind); + mystmt(stmt,rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_commit(mysql); + myquery(rc); + + mysql_stmt_close(stmt); + + myassert(1 == my_stmt_result("SELECT * FROM test_bind_long",50)); + + stmt = mysql_prepare(mysql,"SELECT * FROM test_bind_long",50); + myquery(rc); + + for (i=0; i < 7; i++) + { + bind[i].buffer= (void *)&data[i]; + bind[i].length= (long *)&length[i]; + } + bind[0].buffer_type= MYSQL_TYPE_TINY; + bind[1].buffer_type= MYSQL_TYPE_SHORT; + bind[2].buffer_type= MYSQL_TYPE_LONG; + bind[3].buffer_type= MYSQL_TYPE_LONGLONG; + + bind[4].buffer_type= MYSQL_TYPE_FLOAT; + bind[4].buffer= (void *)&f_data; + + bind[5].buffer_type= MYSQL_TYPE_DOUBLE; + bind[5].buffer= (void *)&d_data; + + bind[6].buffer_type= MYSQL_TYPE_STRING; + bind[6].buffer= (void *)&s_data; + + rc = mysql_bind_result(stmt, bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + fprintf(stdout, "\n tiny : %ld(%ld)", data[0], length[0]); + fprintf(stdout, "\n short : %ld(%ld)", data[1], length[1]); + fprintf(stdout, "\n int : %ld(%ld)", data[2], length[2]); + fprintf(stdout, "\n longlong : %ld(%ld)", data[3], length[3]); + fprintf(stdout, "\n float : %f(%ld)", f_data, length[4]); + fprintf(stdout, "\n double : %g(%ld)", d_data, length[5]); + fprintf(stdout, "\n char : %s(%ld)", s_data, length[6]); + + bit= 1; + rc= 10; + for (i=0; i < 4; i++) + { + myassert(data[i] == rc+i); + myassert(length[i] == bit); + bit<<= 1; + rc+= 10; + } + + /* FLOAT */ + rc+= i; + myassert((int)f_data == rc); + myassert(length[4] == 4); + + /* DOUBLE */ + rc+= 11; + myassert((int)d_data == rc); + myassert(length[5] == 8); + + /* CHAR */ + rc+= 11; + { + char buff[20]; + int len= sprintf(buff,"%d", rc); + myassert(strcmp(s_data,buff)==0); + myassert(length[6] == len); + } + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} + +/******************************************************** +* to test fetching of longlong to all types * +*********************************************************/ +static void test_fetch_bigint() +{ + MYSQL_STMT *stmt; + int rc, i, round, bit; + long data[10], length[10]; + float f_data; + double d_data; + char s_data[10]; + MYSQL_BIND bind[7]; + + myheader("test_fetch_bigint"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_long"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_bind_long(c1 bigint,\ + c2 bigint,\ + c3 bigint unsigned,\ + c4 bigint unsigned,\ + c5 bigint unsigned,\ + c6 bigint unsigned,\ + c7 bigint unsigned)"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + stmt = mysql_prepare(mysql,"INSERT INTO test_bind_long VALUES(?,?,?,?,?,?,?)",100); + myquery(rc); + + verify_param_count(stmt, 7); + + round= 0; + for (i=0; i < 7; i++) + { + bind[i].buffer_type= MYSQL_TYPE_LONG; + bind[i].buffer= (void *)&data[i]; + data[i]= round+i+1; + round= (round +10)*10; + } + rc = mysql_bind_param(stmt, bind); + mystmt(stmt,rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_commit(mysql); + myquery(rc); + + mysql_stmt_close(stmt); + + myassert(1 == my_stmt_result("SELECT * FROM test_bind_long",50)); + + stmt = mysql_prepare(mysql,"SELECT * FROM test_bind_long",50); + myquery(rc); + + for (i=0; i < 7; i++) + { + bind[i].buffer= (void *)&data[i]; + bind[i].length= (long *)&length[i]; + } + bind[0].buffer_type= MYSQL_TYPE_TINY; + bind[1].buffer_type= MYSQL_TYPE_SHORT; + bind[2].buffer_type= MYSQL_TYPE_LONG; + bind[3].buffer_type= MYSQL_TYPE_LONGLONG; + + bind[4].buffer_type= MYSQL_TYPE_FLOAT; + bind[4].buffer= (void *)&f_data; + + bind[5].buffer_type= MYSQL_TYPE_DOUBLE; + bind[5].buffer= (void *)&d_data; + + bind[6].buffer_type= MYSQL_TYPE_STRING; + bind[6].buffer= (void *)&s_data; + + rc = mysql_bind_result(stmt, bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + fprintf(stdout, "\n tiny : %ld(%ld)", data[0], length[0]); + fprintf(stdout, "\n short : %ld(%ld)", data[1], length[1]); + fprintf(stdout, "\n int : %ld(%ld)", data[2], length[2]); + fprintf(stdout, "\n longlong : %ld(%ld)", data[3], length[3]); + fprintf(stdout, "\n float : %f(%ld)", f_data, length[4]); + fprintf(stdout, "\n double : %g(%ld)", d_data, length[5]); + fprintf(stdout, "\n char : %s(%ld)", s_data, length[6]); + + round= 0; + bit= 1; + + for (i=0; i < 4; i++) + { + myassert(data[i] == round+i+1); + myassert(length[i] == bit); + round= (round+10)*10; + bit<<= 1; + } + + /* FLOAT */ + myassert((int)f_data == round+1+i); + myassert(length[4] == 4); + + /* DOUBLE */ + round= (round+10)*10; + myassert((int)d_data == round+2+i); + myassert(length[5] == 8); + + /* CHAR */ + round= (round+10)*10; + { + char buff[20]; + int len= sprintf(buff,"%d", round+3+i); + myassert(strcmp(s_data,buff)==0); + myassert(length[6] == len); + } + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} + +/******************************************************** +* to test fetching of float to all types * +*********************************************************/ +static void test_fetch_float() +{ + MYSQL_STMT *stmt; + int rc, i, round, bit; + long data[10], length[10]; + float f_data; + double d_data; + char s_data[10]; + MYSQL_BIND bind[7]; + + myheader("test_fetch_float"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_long"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_bind_long(c1 float(3),\ + c2 float,\ + c3 float unsigned,\ + c4 float,\ + c5 float,\ + c6 float,\ + c7 float(10) unsigned)"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + stmt = mysql_prepare(mysql,"INSERT INTO test_bind_long VALUES(?,?,?,?,?,?,?)",100); + myquery(rc); + + verify_param_count(stmt, 7); + + round= 0; + for (i=0; i < 7; i++) + { + bind[i].buffer_type= MYSQL_TYPE_LONG; + bind[i].buffer= (void *)&data[i]; + data[i]= round+i+1; + round= (round +10)*2; + } + rc = mysql_bind_param(stmt, bind); + mystmt(stmt,rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_commit(mysql); + myquery(rc); + + mysql_stmt_close(stmt); + + myassert(1 == my_stmt_result("SELECT * FROM test_bind_long",50)); + + stmt = mysql_prepare(mysql,"SELECT * FROM test_bind_long",50); + myquery(rc); + + for (i=0; i < 7; i++) + { + bind[i].buffer= (void *)&data[i]; + bind[i].length= (long *)&length[i]; + } + bind[0].buffer_type= MYSQL_TYPE_TINY; + bind[1].buffer_type= MYSQL_TYPE_SHORT; + bind[2].buffer_type= MYSQL_TYPE_LONG; + bind[3].buffer_type= MYSQL_TYPE_LONGLONG; + + bind[4].buffer_type= MYSQL_TYPE_FLOAT; + bind[4].buffer= (void *)&f_data; + + bind[5].buffer_type= MYSQL_TYPE_DOUBLE; + bind[5].buffer= (void *)&d_data; + + bind[6].buffer_type= MYSQL_TYPE_STRING; + bind[6].buffer= (void *)&s_data; + + rc = mysql_bind_result(stmt, bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + fprintf(stdout, "\n tiny : %ld(%ld)", data[0], length[0]); + fprintf(stdout, "\n short : %ld(%ld)", data[1], length[1]); + fprintf(stdout, "\n int : %ld(%ld)", data[2], length[2]); + fprintf(stdout, "\n longlong : %ld(%ld)", data[3], length[3]); + fprintf(stdout, "\n float : %f(%ld)", f_data, length[4]); + fprintf(stdout, "\n double : %g(%ld)", d_data, length[5]); + fprintf(stdout, "\n char : %s(%ld)", s_data, length[6]); + + round= 0; + bit= 1; + + for (i=0; i < 4; i++) + { + myassert(data[i] == round+i+1); + myassert(length[i] == bit); + round= (round+10)*2; + bit<<= 1; + } + + /* FLOAT */ + myassert((int)f_data == round+1+i); + myassert(length[4] == 4); + + /* DOUBLE */ + round= (round+10)*2; + myassert((int)d_data == round+2+i); + myassert(length[5] == 8); + + /* CHAR */ + round= (round+10)*2; + { + char buff[20]; + int len= sprintf(buff,"%d", round+3+i); + myassert(strcmp(s_data,buff)==0); + myassert(length[6] == len); + } + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} + +/******************************************************** +* to test fetching of double to all types * +*********************************************************/ +static void test_fetch_double() +{ + MYSQL_STMT *stmt; + int rc, i, round, bit; + long data[10], length[10]; + float f_data; + double d_data; + char s_data[10]; + MYSQL_BIND bind[7]; + + myheader("test_fetch_double"); + + init_bind(bind); + rc = mysql_query(mysql,"DROP TABLE IF EXISTS test_bind_long"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + rc = mysql_query(mysql,"CREATE TABLE test_bind_long(c1 double(5,2),\ + c2 double unsigned,\ + c3 double unsigned,\ + c4 double unsigned,\ + c5 double unsigned,\ + c6 double unsigned,\ + c7 double unsigned)"); + myquery(rc); + + rc = mysql_commit(mysql); + myquery(rc); + + stmt = mysql_prepare(mysql,"INSERT INTO test_bind_long VALUES(?,?,?,?,?,?,?)",100); + myquery(rc); + + verify_param_count(stmt, 7); + + round= 0; + for (i=0; i < 7; i++) + { + bind[i].buffer_type= MYSQL_TYPE_LONG; + bind[i].buffer= (void *)&data[i]; + data[i]= round+i+1; + round= (round +10)*10; + } + rc = mysql_bind_param(stmt, bind); + mystmt(stmt,rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_commit(mysql); + myquery(rc); + + mysql_stmt_close(stmt); + + myassert(1 == my_stmt_result("SELECT * FROM test_bind_long",50)); + + stmt = mysql_prepare(mysql,"SELECT * FROM test_bind_long",50); + myquery(rc); + + for (i=0; i < 7; i++) + { + bind[i].buffer= (void *)&data[i]; + bind[i].length= (long *)&length[i]; + } + bind[0].buffer_type= MYSQL_TYPE_TINY; + bind[1].buffer_type= MYSQL_TYPE_SHORT; + bind[2].buffer_type= MYSQL_TYPE_LONG; + bind[3].buffer_type= MYSQL_TYPE_LONGLONG; + + bind[4].buffer_type= MYSQL_TYPE_STRING; + bind[4].buffer= (void *)&s_data; + + bind[5].buffer_type= MYSQL_TYPE_FLOAT; + bind[5].buffer= (void *)&f_data; + + bind[6].buffer_type= MYSQL_TYPE_DOUBLE; + bind[6].buffer= (void *)&d_data; + + rc = mysql_bind_result(stmt, bind); + mystmt(stmt, rc); + + rc = mysql_execute(stmt); + mystmt(stmt, rc); + + rc = mysql_fetch(stmt); + mystmt(stmt,rc); + + fprintf(stdout, "\n tiny : %ld(%ld)", data[0], length[0]); + fprintf(stdout, "\n short : %ld(%ld)", data[1], length[1]); + fprintf(stdout, "\n int : %ld(%ld)", data[2], length[2]); + fprintf(stdout, "\n longlong : %ld(%ld)", data[3], length[3]); + fprintf(stdout, "\n float : %f(%ld)", f_data, length[5]); + fprintf(stdout, "\n double : %g(%ld)", d_data, length[6]); + fprintf(stdout, "\n char : %s(%ld)", s_data, length[4]); + + round= 0; + bit= 1; + + for (i=0; i < 4; i++) + { + myassert(data[i] == round+i+1); + myassert(length[i] == bit); + round= (round+10)*10; + bit<<= 1; + } + /* CHAR */ + { + char buff[20]; + int len= sprintf(buff,"%d", round+1+i); + myassert(strcmp(s_data,buff)==0); + myassert(length[4] == len); + } + + /* FLOAT */ + round= (round+10)*10; + myassert((int)f_data == round+2+i); + myassert(length[5] == 4); + + /* DOUBLE */ + round= (round+10)*10; + myassert((int)d_data == round+3+i); + myassert(length[6] == 8); + + rc = mysql_fetch(stmt); + myassert(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); +} /******************************************************** * to test simple prepare with all possible types * @@ -3479,6 +4437,12 @@ static void test_func_fields() mysql_free_result(result); } +/* Multiple stmts .. */ +static void test_multi_stmt() +{ +} + + static struct my_option myctest_long_options[] = { {"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, @@ -3586,13 +4550,18 @@ int main(int argc, char **argv) MY_INIT(argv[0]); get_options(argc,argv); - client_connect(); /* connect to server */ - test_select_prepare(); - test_prepare(); - test_prepare_simple(); + client_connect(); /* connect to server */ + client_query(); /* simple client query test */ test_bind_result(); /* result bind test */ test_fetch_null(); /* to fetch null data */ - test_fetch_date(); + test_fetch_date(); /* to fetch date,time and timestamp */ + test_fetch_str(); /* to fetch string to all types */ + test_fetch_long(); /* to fetch long to all types */ + test_fetch_short(); /* to fetch short to all types */ + test_fetch_tiny(); /* to fetch tiny to all types */ + test_fetch_bigint(); /* to fetch bigint to all types */ + test_fetch_float(); /* to fetch float to all types */ + test_fetch_double(); /* to fetch double to all types */ test_bind_result_ext(); /* result bind test - extension */ test_bind_result_ext1(); /* result bind test - extension */ test_select_direct(); /* direct select - protocol_simple debug */ @@ -3618,7 +4587,7 @@ int main(int argc, char **argv) test_select(); test_select_show(); test_null(); /* test null data handling */ - test_simple_update(); + test_simple_update(); /* simple prepare - update */ test_prepare_resultset(); test_prepare_noparam();/* prepare without parameters */ test_select(); /* simple prepare-select */ @@ -3643,7 +4612,7 @@ int main(int argc, char **argv) test_prepare_ext(); /* test prepare with all types conversion -- TODO */ test_prepare_syntax();/* syntax check for prepares */ test_prepare_field_result(); /* prepare meta info */ - test_prepare_resultset(); + test_prepare_resultset(); /* prepare meta info test */ test_field_names(); /* test for field names */ test_field_flags(); /* test to help .NET provider team */ test_long_data_str(); /* long data handling */ @@ -3656,6 +4625,7 @@ int main(int argc, char **argv) test_func_fields(); /* FUNCTION field info */ /*test_stmt_close(); */ /* mysql_stmt_close() test -- hangs */ test_prepare_field_result(); /* prepare meta info */ + test_multi_stmt(); /* multi stmt test */ client_disconnect(); /* disconnect from server */ fprintf(stdout,"\n\nSUCCESS !!!\n"); From e3494520c9d88a8b44b6237cfdb141fd85760c7f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jan 2003 18:57:39 -0800 Subject: [PATCH 181/220] Code cleaup to fix the conversion routines - binary protocol --- include/mysql.h | 4 +-- libmysql/libmysql.c | 80 ++++++++++++++++++--------------------------- 2 files changed, 34 insertions(+), 50 deletions(-) diff --git a/include/mysql.h b/include/mysql.h index e43136f8f69..d9da2bde73c 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -439,13 +439,12 @@ typedef struct st_mysql_bind { long *length; /* output length pointer */ gptr buffer; /* buffer */ - unsigned long buffer_length; /* buffer length */ enum enum_field_types buffer_type; /* buffer type */ - enum enum_field_types field_type; /* field type */ my_bool is_null; /* NULL indicator */ my_bool is_long_data; /* long data indicator */ /* The following are for internal use. Set by mysql_bind_param */ + unsigned long buffer_length; /* buffer length */ long bind_length; /* Default length of data */ my_bool long_ended; /* All data supplied for long */ unsigned int param_number; /* For null count and error messages */ @@ -511,6 +510,7 @@ MYSQL_RES *STDCALL mysql_prepare_result(MYSQL_STMT *stmt); #define MYSQL_NO_DATA 100 #define MYSQL_NEED_DATA 99 #define MYSQL_NULL_DATA (-1) +#define MYSQL_LONG_DATA (-2) #define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 5cae0a3813d..4425d41f85f 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -4097,8 +4097,7 @@ static my_bool store_param(MYSQL_STMT *stmt, MYSQL_BIND *param) DBUG_PRINT("enter",("type: %d, buffer:%lx, length: %d", param->buffer_type, param->buffer ? param->buffer : "0", *param->length)); - if (param->is_null || param->buffer_type == MYSQL_TYPE_NULL || - *param->length == MYSQL_NULL_DATA) + if (param->is_null || *param->length == MYSQL_NULL_DATA) store_param_null(net, param); else { @@ -4190,7 +4189,7 @@ int STDCALL mysql_execute(MYSQL_STMT *stmt) for (param= stmt->params; param < param_end; param++) { /* Check for long data which has not been propery given/terminated */ - if (param->is_long_data) + if (param->is_long_data || *param->length == MYSQL_LONG_DATA) { if (!param->long_ended) DBUG_RETURN(MYSQL_NEED_DATA); @@ -4281,7 +4280,7 @@ my_bool STDCALL mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind) /* Setup data copy functions for the different supported types */ switch (param->buffer_type) { case MYSQL_TYPE_NULL: - param->is_null=1; + param->is_null= 1; break; case MYSQL_TYPE_TINY: param->bind_length= 1; @@ -4412,41 +4411,32 @@ mysql_send_long_data(MYSQL_STMT *stmt, uint param_number, 1 Error (Can't alloc net->buffer) ****************************************************************************/ - -static ulong get_field_length(uint type) +/* Return the default binary data length for the common types */ +static unsigned int get_binary_length(uint type) { - ulong length; - - switch (type) { - + switch(type) { case MYSQL_TYPE_TINY: - length= 1; - break; + return 1; case MYSQL_TYPE_SHORT: case MYSQL_TYPE_YEAR: - length= 2; - break; + return 2; case MYSQL_TYPE_LONG: case MYSQL_TYPE_FLOAT: - length= 4; - break; + return 4; case MYSQL_TYPE_LONGLONG: case MYSQL_TYPE_DOUBLE: - length= 8; - break; + return 8; default: - length= 0; + return 0; } - return length; } +/* Convert Numeric to buffer types */ static void send_data_long(MYSQL_BIND *param, longlong value) { char *buffer= param->buffer; - *param->length= get_field_length(param->buffer_type); switch(param->buffer_type) { - case MYSQL_TYPE_TINY: *param->buffer= (uchar) value; break; @@ -4480,13 +4470,12 @@ static void send_data_long(MYSQL_BIND *param, longlong value) } } +/* Convert Double to buffer types */ static void send_data_double(MYSQL_BIND *param, double value) { char *buffer= param->buffer; - *param->length= get_field_length(param->buffer_type); switch(param->buffer_type) { - case MYSQL_TYPE_TINY: *buffer= (uchar)value; break; @@ -4520,63 +4509,64 @@ static void send_data_double(MYSQL_BIND *param, double value) } } -static void send_data_str(MYSQL_BIND *param, char *value, uint src_length) +/* Convert string to buffer types */ +static void send_data_str(MYSQL_BIND *param, char *value, uint length) { char *buffer= param->buffer; - *param->length= get_field_length(param->buffer_type); switch(param->buffer_type) { - case MYSQL_TYPE_TINY: - *buffer= (char)*value; + { + uchar data= (uchar)my_strntol(system_charset_info,value,length,NULL,10); + *buffer= data; break; + } case MYSQL_TYPE_SHORT: { - short data= (short)sint2korr(value); + short data= (short)my_strntol(system_charset_info,value,length,NULL,10); int2store(buffer, data); break; } case MYSQL_TYPE_LONG: { - int32 data= (int32)sint4korr(value); + int32 data= (int32)my_strntol(system_charset_info,value,length,NULL,10); int4store(buffer, data); break; } case MYSQL_TYPE_LONGLONG: { - longlong data= sint8korr(value); + longlong data= my_strntoll(system_charset_info,value,length,NULL,10); int8store(buffer, data); break; } case MYSQL_TYPE_FLOAT: { - float data; - float4get(data, value); + float data = (float)my_strntod(system_charset_info,value,length,NULL); float4store(buffer, data); break; } case MYSQL_TYPE_DOUBLE: { - double data; - float8get(data, value); + double data= my_strntod(system_charset_info,value,length,NULL); float8store(buffer, data); break; } default: - *param->length= src_length; - memcpy(buffer, value, src_length); - buffer[src_length]='\0'; + *param->length= length; + memcpy(buffer, value, length); + buffer[length]='\0'; } } +/* Fetch data to buffers */ static my_bool fetch_results(MYSQL_STMT *stmt, MYSQL_BIND *param, uint field_type, uchar **row) { ulong length; - - length= get_field_length(field_type); + + length= (ulong)get_binary_length(field_type); + switch (field_type) { - case MYSQL_TYPE_TINY: { uchar value= (uchar) **row; @@ -4813,27 +4803,21 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind) /* Setup data copy functions for the different supported types */ switch (param->buffer_type) { case MYSQL_TYPE_TINY: - param->bind_length= 1; param->fetch_result= fetch_result_tinyint; break; case MYSQL_TYPE_SHORT: - param->bind_length= 2; param->fetch_result= fetch_result_short; break; case MYSQL_TYPE_LONG: - param->bind_length= 4; param->fetch_result= fetch_result_int32; break; case MYSQL_TYPE_LONGLONG: - param->bind_length= 8; param->fetch_result= fetch_result_int64; break; case MYSQL_TYPE_FLOAT: - param->bind_length= 4; param->fetch_result= fetch_result_float; break; case MYSQL_TYPE_DOUBLE: - param->bind_length= 8; param->fetch_result= fetch_result_double; break; case MYSQL_TYPE_TINY_BLOB: @@ -4842,7 +4826,6 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind) case MYSQL_TYPE_BLOB: case MYSQL_TYPE_VAR_STRING: case MYSQL_TYPE_STRING: - param->bind_length= 0; param->fetch_result= fetch_result_str; break; default: @@ -4852,6 +4835,7 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind) } if (!param->length) param->length= ¶m->bind_length; + *param->length= (long)get_binary_length(param->buffer_type); } stmt->res_buffers= 1; DBUG_RETURN(0); From db67a2ee6149b16c4976ddd510e62d35c6eb8a9f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jan 2003 18:59:08 -0800 Subject: [PATCH 182/220] Simple misc cases - warnings --- mysql-test/r/create.result | 2 +- mysql-test/r/warnings.result | 17 +++++++++++++++++ mysql-test/t/create.test | 2 +- mysql-test/t/warnings.test | 7 +++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index a32d32a4ab7..ea553b5ac58 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1,4 +1,4 @@ -drop table if exists t1,t2; +drop table if exists t1,t2,t3; create table t1 (b char(0)); insert into t1 values (""),(null); select * from t1; diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index 06be16aad48..f2a105827da 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -13,3 +13,20 @@ set SQL_WARNINGS=0; drop temporary table if exists not_exists; Warnings: Note 1051 Unknown table 'not_exists' +drop table if exists not_exists_table; +Warnings: +Note 1051 Unknown table 'not_exists_table' +show warnings limit 1; +Level Code Message +Note 1051 Unknown table 'not_exists_table' +drop database if exists not_exists_db; +Warnings: +Note 1008 Can't drop database 'not_exists_db'. Database doesn't exist +show count(*) warnings; +@@session.warning_count +1 +create table t1(id int); +create table if not exists t1(id int); +select @@warning_count; +@@warning_count +0 diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 0a3bd4e97a1..70a589c4be6 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -3,7 +3,7 @@ # --disable_warnings -drop table if exists t1,t2; +drop table if exists t1,t2,t3; --enable_warnings create table t1 (b char(0)); diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test index eeb45eaba56..8cff8706c43 100644 --- a/mysql-test/t/warnings.test +++ b/mysql-test/t/warnings.test @@ -19,3 +19,10 @@ set SQL_WARNINGS=0; # Test other warnings drop temporary table if exists not_exists; +drop table if exists not_exists_table; +show warnings limit 1; +drop database if exists not_exists_db; +show count(*) warnings; +create table t1(id int); +create table if not exists t1(id int); +select @@warning_count; From 544fd6571449549f9244436ff5e9e41cabfe500b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jan 2003 12:48:49 +0400 Subject: [PATCH 183/220] resolving type conflict of BC and UP variables on FreeBSD --- readline/tcap.h | 2 +- readline/terminal.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/readline/tcap.h b/readline/tcap.h index 4606520bf87..c58cfbf492e 100644 --- a/readline/tcap.h +++ b/readline/tcap.h @@ -42,7 +42,7 @@ #endif extern char PC; -extern const char *UP, *BC; +extern const char *UPc, *BCc; extern short ospeed; diff --git a/readline/terminal.c b/readline/terminal.c index 23cba49940d..51c566f327e 100644 --- a/readline/terminal.c +++ b/readline/terminal.c @@ -85,7 +85,7 @@ static int tcap_initialized; extern # endif /* __EMX__ || NEED_EXTERN_PC */ char PC; -const char *BC, *UP; +const char *BCc, *UPc; #endif /* __linux__ */ /* Some strings to control terminal actions. These are output by tputs (). */ @@ -434,8 +434,8 @@ _rl_init_terminal_io (terminal_name) tgoto if _rl_term_IC or _rl_term_DC is defined, but just in case we change that later... */ PC = '\0'; - BC = (char*)(_rl_term_backspace = "\b"); - UP = (char*)_rl_term_up; + BCc = (char*)(_rl_term_backspace = "\b"); + UPc = (char*)_rl_term_up; return 0; } @@ -445,8 +445,8 @@ _rl_init_terminal_io (terminal_name) /* Set up the variables that the termcap library expects the application to provide. */ PC = _rl_term_pc ? *_rl_term_pc : 0; - BC = (char*)_rl_term_backspace; - UP = (char*)_rl_term_up; + BCc = (char*)_rl_term_backspace; + UPc = (char*)_rl_term_up; if (!_rl_term_cr) _rl_term_cr = "\r"; From 1543bad3e7db362981ba89987878f60e7d70cca9 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jan 2003 11:24:39 +0200 Subject: [PATCH 184/220] Fix for bug in LOAD DATA INFILE and replication Fix for SHOW VARIABLES in embedded server Docs/internals.texi: Added documentation for join_buffer_size configure.in: Changed version number sql/log_event.cc: Fix for bug in LOAD DATA INFILE sql/log_event.h: Fix for bug in LOAD DATA INFILE sql/slave.cc: Fix for bug in LOAD DATA INFILE sql/sql_show.cc: Fix for SHOW VARIABLES in embedded server --- Docs/internals.texi | 73 ++++++++++++++++++++++++++++++++++++++++++++- configure.in | 2 +- sql/log_event.cc | 56 ++++++++++++++++++++++++++++++---- sql/log_event.h | 5 ++-- sql/slave.cc | 6 ---- sql/sql_show.cc | 2 ++ 6 files changed, 129 insertions(+), 15 deletions(-) diff --git a/Docs/internals.texi b/Docs/internals.texi index 6719bd4a6fa..a94158f84f8 100644 --- a/Docs/internals.texi +++ b/Docs/internals.texi @@ -96,13 +96,84 @@ cached for each user/database combination. Many use of @code{GROUP BY} or @code{DISTINCT} caches all found rows in a @code{HEAP} table. (This is a very quick in-memory table with hash index.) -@item Join Row Cache +@item Join buffer Cache For every full join in a @code{SELECT} statement (a full join here means there were no keys that one could use to find the next table in a list), the found rows are cached in a join cache. One @code{SELECT} query can use many join caches in the worst case. @end table +@node join_buffer_size, flush tables, caching, Top +@subchapter How MySQL uses the join_buffer cache + +Basic information about @code{join_buffer_size}: + +@itemize @bullet +@item +It's only used in the case when join type is of type @code{ALL} or +@code{index}; In other words: no possible keys can be used. +@item +A join buffer is never allocated for the first not-const table, +even it it would be of type @code{ALL}/@code{index}. +@item +The buffer is allocated when we need to do a each full join between two +tables and freed after the query is done. +@item +Accepted row combinations of tables before the @code{ALL}/@code{index} +able is stored in the cache and is used to compare against each read +row in the @code{ALL} table. +@item +We only store the used fields in the join_buffer cache, not the +whole rows. +@end itemize + +Assume you have the following join: + +@example +Table name Type +t1 range +t2 ref +t3 @code{ALL} +@end example + +The join is then done as follows: + +@example +- While rows in t1 matching range + - Read through all rows in t2 according to reference key + - Store used fields form t1,t2 in cache + - If cache is full + - Read through all rows in t3 + - Compare t3 row against all t1,t2 combination in cache + - If rows satisfying join condition, send it to client + - Empty cache + +- Read through all rows in t3 + - Compare t3 row against all stored t1,t2 combinations in cache + - If rows satisfying join condition, send it to client +@end example + +The above means that table t3 is scanned + +@example +(size-of-stored-row(t1,t2) * accepted-row-cominations(t1,t2))/ +join_buffer_size+1 +@end example +times. + +Some conclusions: + +@itemize @bullet +@item +The larger the join_buff_size, the fewer scans of t3. +If @code{join_buff_size} is already large enough to hold all previous row +combinations then there is no speed to gain by making it bigger. +@item +If there is several tables of @code{ALL}/@code{index} then the we +allocate one @code{join_buffer_size buffer} for each of them and use the +same algorithm described above to handle it. (In other words, we store +the same row combination several times into different buffers) +@end itemize @node flush tables, filesort, caching, Top @chapter How MySQL Handles @code{FLUSH TABLES} diff --git a/configure.in b/configure.in index 0375cc61235..06dc6e03fb6 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! -AM_INIT_AUTOMAKE(mysql, 4.0.8-gamma) +AM_INIT_AUTOMAKE(mysql, 4.0.9-gamma) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 diff --git a/sql/log_event.cc b/sql/log_event.cc index d451a5bc46c..3c2c2fd27b1 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -206,7 +206,19 @@ Log_event::Log_event(const char* buf, bool old_format) int Log_event::exec_event(struct st_relay_log_info* rli) { - if (rli) // QQ When is this not true ? + /* + rli is null when (as far as I (Guilhem) know) + the caller is + Load_log_event::exec_event *and* that one is called from + Execute_load_log_event::exec_event. + In this case, we don't do anything here ; + Execute_load_log_event::exec_event will call Log_event::exec_event + again later with the proper rli. + Strictly speaking, if we were sure that rli is null + only in the case discussed above, 'if (rli)' is useless here. + But as we are not 100% sure, keep it for now. + */ + if (rli) { if (rli->inside_transaction) rli->inc_pending(get_event_len()); @@ -1773,8 +1785,34 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli) return Log_event::exec_event(rli); } +/* + Does the data loading job when executing a LOAD DATA on the slave -int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli) + SYNOPSIS + Load_log_event::exec_event + net + rli + use_rli_only_for_errors - if set to 1, rli is provided to + Load_log_event::exec_event only for this + function to have RPL_LOG_NAME and + rli->last_slave_error, both being used by + error reports. rli's position advancing + is skipped (done by the caller which is + Execute_load_log_event::exec_event). + - if set to 0, rli is provided for full use, + i.e. for error reports and position + advancing. + + DESCRIPTION + Does the data loading job when executing a LOAD DATA on the slave + + RETURN VALUE + 0 Success + 1 Failure +*/ + +int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, + bool use_rli_only_for_errors) { init_sql_alloc(&thd->mem_root, 8192,0); thd->db = rewrite_db((char*)db); @@ -1836,8 +1874,12 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli) TL_WRITE)) thd->query_error = 1; if (thd->cuted_fields) + /* + log_pos is the position of the LOAD + event in the master log + */ sql_print_error("Slave: load data infile at position %s in log \ -'%s' produced %d warning(s)", llstr(rli->master_log_pos,llbuff), RPL_LOG_NAME, +'%s' produced %d warning(s)", llstr(log_pos,llbuff), RPL_LOG_NAME, thd->cuted_fields ); if (net) net->pkt_nr= thd->net.pkt_nr; @@ -1877,7 +1919,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli) return 1; } - return Log_event::exec_event(rli); + return ( use_rli_only_for_errors ? 0 : Log_event::exec_event(rli) ); } @@ -2132,7 +2174,11 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli) save_options = thd->options; thd->options &= ~ (ulong) (OPTION_BIN_LOG); lev->thd = thd; - if (lev->exec_event(0,0)) + /* + lev->exec_event should use rli only for errors + i.e. should not advance rli's position + */ + if (lev->exec_event(0,rli,1)) { slave_print_error(rli,my_errno, "Failed executing load from '%s'", fname); thd->options = save_options; diff --git a/sql/log_event.h b/sql/log_event.h index 69a70d535ec..5b9f30b3afd 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -417,9 +417,10 @@ public: const char* get_db() { return db; } int exec_event(struct st_relay_log_info* rli) { - return exec_event(thd->slave_net,rli); + return exec_event(thd->slave_net,rli,0); } - int exec_event(NET* net, struct st_relay_log_info* rli); + int exec_event(NET* net, struct st_relay_log_info* rli, + bool use_rli_only_for_errors); #else void print(FILE* file, bool short_form = 0, char* last_db = 0); #endif diff --git a/sql/slave.cc b/sql/slave.cc index 455b574b355..b8689a28a54 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2343,12 +2343,6 @@ static int process_io_rotate(MASTER_INFO *mi, Rotate_log_event *rev) memcpy(mi->master_log_name, rev->new_log_ident, rev->ident_len+1); mi->master_log_pos= rev->pos; - - pthread_mutex_lock(&mi->rli.data_lock); - memcpy(mi->rli.master_log_name, rev->new_log_ident, rev->ident_len+1); - mi->rli.master_log_pos= rev->pos; - pthread_mutex_unlock(&mi->rli.data_lock); - DBUG_PRINT("info", ("master_log_pos: '%s' %d", mi->master_log_name, (ulong) mi->master_log_pos)); #ifndef DBUG_OFF diff --git a/sql/sql_show.cc b/sql/sql_show.cc index a11abf75506..04d3f13a8d0 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1217,6 +1217,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables, case SHOW_RPL_STATUS: net_store_data(&packet2, rpl_status_type[(int)rpl_status]); break; +#ifndef EMBEDDED_LIBRARY case SHOW_SLAVE_RUNNING: { LOCK_ACTIVE_MI; @@ -1226,6 +1227,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables, UNLOCK_ACTIVE_MI; break; } +#endif case SHOW_OPENTABLES: net_store_data(&packet2,(uint32) cached_tables()); break; From 8ef72be7aca1dd2fe4ed6658a7e38e2c79ee9ad6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jan 2003 13:38:11 +0400 Subject: [PATCH 185/220] COLLATE is field attribute not field type --- sql/sql_yacc.yy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index bcee15c13cf..587538fe0e2 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1231,7 +1231,8 @@ attribute: | opt_primary KEY_SYM { Lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG; } | UNIQUE_SYM { Lex->type|= UNIQUE_FLAG; } | UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_FLAG; } - | COMMENT_SYM text_literal { Lex->comment= $2; }; + | COMMENT_SYM text_literal { Lex->comment= $2; } + | COLLATE_SYM charset_name { Lex->charset=$2; }; charset_name: @@ -1278,7 +1279,6 @@ opt_binary: YYABORT; } } - | COLLATE_SYM charset_name { Lex->charset=$2; } | CHAR_SYM SET charset_name { Lex->charset=$3; } ; opt_primary: From fe47e5358c61b9cf78aa0ed515a74f9537834114 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jan 2003 15:39:15 +0400 Subject: [PATCH 186/220] New function to search for charset using charset name rather than collation name --- include/my_sys.h | 1 + mysys/charset.c | 39 ++++++++++++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/include/my_sys.h b/include/my_sys.h index f11afb08b36..975990ca7fc 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -206,6 +206,7 @@ extern const char *get_charset_name(uint cs_number); extern CHARSET_INFO *get_charset(uint cs_number, myf flags); extern my_bool set_default_charset(uint cs, myf flags); extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags); +extern CHARSET_INFO *get_charset_by_csname(const char *cs_name, myf flags); extern my_bool set_default_charset_by_name(const char *cs_name, myf flags); extern void free_charsets(void); extern char *list_charsets(myf want_flags); /* my_free() this string... */ diff --git a/mysys/charset.c b/mysys/charset.c index cfb5b0264ce..dbeb2969f0e 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -615,14 +615,6 @@ static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags) } -static CHARSET_INFO *get_internal_charset_by_name(const char *name, myf flags) -{ - uint cs_number=get_charset_number(name); - return cs_number ? get_internal_charset(cs_number,flags) : NULL; -} - - - CHARSET_INFO *get_charset(uint cs_number, myf flags) { CHARSET_INFO *cs; @@ -664,10 +656,39 @@ my_bool set_default_charset(uint cs, myf flags) CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags) { + uint cs_number; CHARSET_INFO *cs; (void) init_available_charsets(MYF(0)); /* If it isn't initialized */ - cs=get_internal_charset_by_name(cs_name, flags); + cs_number=get_charset_number(cs_name); + cs= cs_number ? get_internal_charset(cs_number,flags) : NULL; + + if (!cs && (flags & MY_WME)) + { + char index_file[FN_REFLEN]; + strmov(get_charsets_dir(index_file),MY_CHARSET_INDEX); + my_error(EE_UNKNOWN_CHARSET, MYF(ME_BELL), cs_name, index_file); + } + + return cs; +} + + +CHARSET_INFO *get_charset_by_csname(const char *cs_name, myf flags) +{ + CHARSET_INFO *cs=NULL; + CHARSET_INFO **css; + (void) init_available_charsets(MYF(0)); /* If it isn't initialized */ + + for (css= all_charsets; css < all_charsets+255; ++css) + { + if ( css[0] && css[0]->csname && !strcmp(css[0]->csname, cs_name)) + { + cs= css[0]->number ? get_internal_charset(css[0]->number,flags) : NULL; + break; + } + } + if (!cs && (flags & MY_WME)) { char index_file[FN_REFLEN]; From 1c334ec0c588da5f93dff2e75f7c64c22c204c60 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jan 2003 15:43:03 +0400 Subject: [PATCH 187/220] charset.c: find only primary collations mysys/charset.c: find only primary collations --- mysys/charset.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mysys/charset.c b/mysys/charset.c index dbeb2969f0e..8d852fd99c2 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -682,7 +682,8 @@ CHARSET_INFO *get_charset_by_csname(const char *cs_name, myf flags) for (css= all_charsets; css < all_charsets+255; ++css) { - if ( css[0] && css[0]->csname && !strcmp(css[0]->csname, cs_name)) + if ( css[0] && (css[0]->state & MY_CS_PRIMARY) && + css[0]->csname && !strcmp(css[0]->csname, cs_name)) { cs= css[0]->number ? get_internal_charset(css[0]->number,flags) : NULL; break; From a2b668962ba13bd95590e51a509d241f8667af8f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jan 2003 16:25:42 +0400 Subject: [PATCH 188/220] fix for readline building --- readline/tcap.h | 2 +- readline/terminal.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/readline/tcap.h b/readline/tcap.h index c58cfbf492e..58ab894d93e 100644 --- a/readline/tcap.h +++ b/readline/tcap.h @@ -42,7 +42,7 @@ #endif extern char PC; -extern const char *UPc, *BCc; +extern char *UP, *BC; extern short ospeed; diff --git a/readline/terminal.c b/readline/terminal.c index 51c566f327e..397b10a1d46 100644 --- a/readline/terminal.c +++ b/readline/terminal.c @@ -85,7 +85,7 @@ static int tcap_initialized; extern # endif /* __EMX__ || NEED_EXTERN_PC */ char PC; -const char *BCc, *UPc; +char *BC, *UP; #endif /* __linux__ */ /* Some strings to control terminal actions. These are output by tputs (). */ @@ -434,8 +434,8 @@ _rl_init_terminal_io (terminal_name) tgoto if _rl_term_IC or _rl_term_DC is defined, but just in case we change that later... */ PC = '\0'; - BCc = (char*)(_rl_term_backspace = "\b"); - UPc = (char*)_rl_term_up; + BC = (char*)(_rl_term_backspace = "\b"); + UP = (char*)_rl_term_up; return 0; } @@ -445,8 +445,8 @@ _rl_init_terminal_io (terminal_name) /* Set up the variables that the termcap library expects the application to provide. */ PC = _rl_term_pc ? *_rl_term_pc : 0; - BCc = (char*)_rl_term_backspace; - UPc = (char*)_rl_term_up; + BC = (char*)_rl_term_backspace; + UP = (char*)_rl_term_up; if (!_rl_term_cr) _rl_term_cr = "\r"; From 3bc97a7f660a464625d3605d58bfca45c05b338b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jan 2003 16:29:31 +0400 Subject: [PATCH 189/220] Renamed to look in common style --- sql/sql_yacc.yy | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 587538fe0e2..6e32805310f 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -633,7 +633,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %type charset_name charset_name_or_default - opt_db_default_character_set + opt_default_charset %type internal_variable_name @@ -857,7 +857,7 @@ create: lex->key_list.push_back(new Key($2,$4.str, $5, lex->col_list)); lex->col_list.empty(); } - | CREATE DATABASE opt_if_not_exists ident opt_db_default_character_set + | CREATE DATABASE opt_if_not_exists ident opt_default_charset { LEX *lex=Lex; lex->sql_command=SQLCOM_CREATE_DB; @@ -1236,15 +1236,7 @@ attribute: charset_name: - BINARY - { - if (!($$=get_charset_by_name("binary",MYF(0)))) - { - net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,"binary"); - YYABORT; - } - } - | ident + ident { if (!($$=get_charset_by_name($1.str,MYF(0)))) { @@ -1261,7 +1253,7 @@ opt_default: /* empty */ {} | DEFAULT {}; -opt_db_default_character_set: +opt_default_charset: /* empty */ { $$=default_charset_info; } | opt_default CHAR_SYM SET charset_name_or_default { $$=$4; } | opt_default CHARSET charset_name_or_default { $$=$3; }; @@ -1408,7 +1400,7 @@ alter: } alter_list {} - | ALTER DATABASE ident opt_db_default_character_set + | ALTER DATABASE ident opt_default_charset { LEX *lex=Lex; lex->sql_command=SQLCOM_ALTER_DB; From 86a7b72f7fef2dc13b528fb12b37d0e8a877808e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jan 2003 15:43:56 +0200 Subject: [PATCH 190/220] Fixed a couple of bugs. --- extra/mysql_waitpid.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/extra/mysql_waitpid.c b/extra/mysql_waitpid.c index 6e307209fda..14d3f893c60 100644 --- a/extra/mysql_waitpid.c +++ b/extra/mysql_waitpid.c @@ -5,9 +5,9 @@ #include #include -static const char *VER= "1.0"; +static const char *VER= "1.1"; static char *progname; -static int verbose= 0; +static my_bool verbose; void usage(void); @@ -18,8 +18,8 @@ static struct my_option my_long_options[] = {"help", 'I', "Synonym for -?.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"verbose", 'v', - "Be more verbose. Give a warning, if kill can't handle signal 0.", 0, 0, 0, - GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + "Be more verbose. Give a warning, if kill can't handle signal 0.", + (gptr*) &verbose, (gptr*) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Print version information and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 || (t= atoi(argv[1])) <= 0) usage(); - for (; t >= 0; t--) + for (; t > 0; t--) { if (kill((pid_t) pid, sig)) { From dc5ce03f7f0f926190b07b294f2a79cc68fd12d4 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jan 2003 19:42:31 +0400 Subject: [PATCH 191/220] Fix for the bug about point(subselect(...)) sql/item_strfunc.cc: null_value-s was indefined here --- sql/item_strfunc.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index d2b0e89254e..7818a23fcd8 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2666,6 +2666,9 @@ Functions to concatinate various spatial objects String *Item_func_point::val_str(String *str) { + double x= args[0]->val(); + double y= args[1]->val(); + if ( (null_value = (args[0]->null_value || args[1]->null_value || str->realloc(1+4+8+8)))) @@ -2674,8 +2677,8 @@ String *Item_func_point::val_str(String *str) str->length(0); str->q_append((char)Geometry::wkbNDR); str->q_append((uint32)Geometry::wkbPoint); - str->q_append((double)args[0]->val()); - str->q_append((double)args[1]->val()); + str->q_append(x); + str->q_append(y); return str; } @@ -2707,11 +2710,10 @@ String *Item_func_spatial_collection::val_str(String *str) for (i = 0; i < arg_count; ++i) { + String *res = args[i]->val_str(&arg_value); if (args[i]->null_value) goto ret; - String *res = args[i]->val_str(&arg_value); - if ( coll_type == Geometry::wkbGeometryCollection ) { /* From 3a8d0b7df57a722d85de55e7446ce708ed808581 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jan 2003 19:40:35 +0100 Subject: [PATCH 192/220] ft_nlq_search.c: no _mi_search_next() bug fixed myisam/ft_nlq_search.c: no _mi_search_next() bug fixed --- myisam/ft_nlq_search.c | 1 + 1 file changed, 1 insertion(+) diff --git a/myisam/ft_nlq_search.c b/myisam/ft_nlq_search.c index 8c5d504b8d5..95ff700f815 100644 --- a/myisam/ft_nlq_search.c +++ b/myisam/ft_nlq_search.c @@ -97,6 +97,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) r=_mi_search(aio->info, aio->keyinfo, aio->keybuff, keylen, SEARCH_FIND | SEARCH_PREFIX, aio->key_root); + aio->info->update|= HA_STATE_AKTIV; /* for _mi_test_if_changed() */ while (!r) { From 106d4fe2fb051fce3b2ad553868fe8f69b078444 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jan 2003 00:10:36 +0200 Subject: [PATCH 193/220] srv0srv.c, mem0pool.c, mem0pool.h, buf0buf.h, buf0buf.c: Make smaller buffer headers and the lock table; fix AWE high_end bug innobase/buf/buf0buf.c: Make smaller buffer headers and the lock table; fix AWE high_end bug innobase/include/buf0buf.h: Make smaller buffer headers and the lock table; fix AWE high_end bug innobase/include/mem0pool.h: Make smaller buffer headers and the lock table; fix AWE high_end bug innobase/mem/mem0pool.c: Make smaller buffer headers and the lock table; fix AWE high_end bug innobase/srv/srv0srv.c: Make smaller buffer headers and the lock table; fix AWE high_end bug --- innobase/buf/buf0buf.c | 31 +++++++++++++++++++++---------- innobase/include/buf0buf.h | 8 -------- innobase/include/mem0pool.h | 2 ++ innobase/mem/mem0pool.c | 13 ------------- innobase/srv/srv0srv.c | 8 +++++++- 5 files changed, 30 insertions(+), 32 deletions(-) diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c index 58c4ca5271b..4c77a374210 100644 --- a/innobase/buf/buf0buf.c +++ b/innobase/buf/buf0buf.c @@ -385,9 +385,6 @@ buf_block_init( rw_lock_create(&(block->lock)); ut_ad(rw_lock_validate(&(block->lock))); - - rw_lock_create(&(block->read_lock)); - rw_lock_set_level(&(block->read_lock), SYNC_NO_ORDER_CHECK); #ifdef UNIV_SYNC_DEBUG rw_lock_create(&(block->debug_latch)); @@ -484,7 +481,7 @@ buf_pool_init( frame = ut_align(buf_pool->frame_mem, UNIV_PAGE_SIZE); buf_pool->frame_zero = frame; - buf_pool->high_end = frame + UNIV_PAGE_SIZE * curr_size; + buf_pool->high_end = frame + UNIV_PAGE_SIZE * n_frames; if (srv_use_awe) { /*----------------------------------------*/ @@ -1099,8 +1096,26 @@ loop: } else if (rw_latch == RW_NO_LATCH) { if (must_read) { - rw_lock_x_lock(&(block->read_lock)); - rw_lock_x_unlock(&(block->read_lock)); + /* Let us wait until the read operation + completes */ + + for (;;) { + mutex_enter(&(buf_pool->mutex)); + + if (block->io_fix == BUF_IO_READ) { + + mutex_exit(&(buf_pool->mutex)); + + /* Sleep 20 milliseconds */ + + os_thread_sleep(20000); + } else { + + mutex_exit(&(buf_pool->mutex)); + + break; + } + } } fix_type = MTR_MEMO_BUF_FIX; @@ -1523,8 +1538,6 @@ buf_page_init_for_read( is completed. The x-lock is cleared by the io-handler thread. */ rw_lock_x_lock_gen(&(block->lock), BUF_IO_READ); - - rw_lock_x_lock_gen(&(block->read_lock), BUF_IO_READ); mutex_exit(&(buf_pool->mutex)); @@ -1747,9 +1760,7 @@ buf_page_io_complete( buf_pool->n_pend_reads--; buf_pool->n_pages_read++; - rw_lock_x_unlock_gen(&(block->lock), BUF_IO_READ); - rw_lock_x_unlock_gen(&(block->read_lock), BUF_IO_READ); if (buf_debug_prints) { printf("Has read "); diff --git a/innobase/include/buf0buf.h b/innobase/include/buf0buf.h index c7db3d9bcc9..81eeb7fced8 100644 --- a/innobase/include/buf0buf.h +++ b/innobase/include/buf0buf.h @@ -693,14 +693,6 @@ struct buf_block_struct{ record lock hash table */ rw_lock_t lock; /* read-write lock of the buffer frame */ - rw_lock_t read_lock; /* rw-lock reserved when a page read - to the frame is requested; a thread - can wait for this rw-lock if it wants - to wait for the read to complete; - the usual way is to wait for lock, - but if the thread just wants a - bufferfix and no latch on the page, - then it can wait for this rw-lock */ buf_block_t* hash; /* node used in chaining to the page hash table */ ibool check_index_page_at_flush; diff --git a/innobase/include/mem0pool.h b/innobase/include/mem0pool.h index 43707bd5f61..51c53afe788 100644 --- a/innobase/include/mem0pool.h +++ b/innobase/include/mem0pool.h @@ -19,6 +19,8 @@ typedef struct mem_pool_struct mem_pool_t; /* The common memory pool */ extern mem_pool_t* mem_comm_pool; +extern ulint mem_out_of_mem_err_msg_count; + /* Memory area header */ struct mem_area_struct{ diff --git a/innobase/mem/mem0pool.c b/innobase/mem/mem0pool.c index 1c32a4d02a6..382e505b63f 100644 --- a/innobase/mem/mem0pool.c +++ b/innobase/mem/mem0pool.c @@ -259,19 +259,6 @@ mem_pool_fill_free_list( /* We come here when we have run out of space in the memory pool: */ - if (mem_out_of_mem_err_msg_count % 1000000000 == 0) { - /* We do not print the message every time: */ - - ut_print_timestamp(stderr); - - fprintf(stderr, - " InnoDB: Out of memory in additional memory pool.\n" - "InnoDB: InnoDB will start allocating memory from the OS.\n" - "InnoDB: You may get better performance if you configure a bigger\n" - "InnoDB: value in the MySQL my.cnf file for\n" - "InnoDB: innodb_additional_mem_pool_size.\n"); - } - mem_out_of_mem_err_msg_count++; return(FALSE); diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index 56971ab86eb..6612b2006eb 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -1979,7 +1979,7 @@ srv_normalize_init_values(void) srv_lock_table_size = 20 * srv_awe_window_size; } else { - srv_lock_table_size = 20 * srv_pool_size; + srv_lock_table_size = 5 * srv_pool_size; } return(DB_SUCCESS); @@ -2345,6 +2345,12 @@ srv_sprintf_innodb_monitor( "Total memory allocated %lu; in additional pool allocated %lu\n", ut_total_allocated_memory, mem_pool_get_reserved(mem_comm_pool)); + + if (mem_out_of_mem_err_msg_count > 0) { + buf += sprintf(buf, + "Mem allocation has spilled out of additional mem pool %lu times\n"); + } + if (srv_use_awe) { buf += sprintf(buf, "In addition to that %lu MB of AWE memory allocated\n", From c2c98f918e445984dc03240650a61f4f90f4b662 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jan 2003 00:13:47 +0200 Subject: [PATCH 194/220] os0proc.c: Fix typos innobase/os/os0proc.c: Fix typos --- innobase/os/os0proc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/innobase/os/os0proc.c b/innobase/os/os0proc.c index 61db7bd13b2..635c89c10a3 100644 --- a/innobase/os/os0proc.c +++ b/innobase/os/os0proc.c @@ -271,11 +271,11 @@ os_awe_allocate_physical_mem( "InnoDB: AWE: Error: allocated only %lu pages of %lu requested.\n" "InnoDB: Check that you have enough free RAM.\n" "InnoDB: In Windows XP Professional and 2000 Professional\n" -"InnoDB: Windows PAE size is max 4 GB. In 2000 and .NET" +"InnoDB: Windows PAE size is max 4 GB. In 2000 and .NET\n" "InnoDB: Advanced Servers and 2000 Datacenter Server it is 32 GB,\n" "InnoDB: and in .NET Datacenter Server it is 64 GB.\n" "InnoDB: A Microsoft web page said that the processor must be an Intel\n" -"InnoDB: processor.", +"InnoDB: processor.\n", (ulint)NumberOfPages, (ulint)NumberOfPagesInitial); From aef11cc9ba86be713834ce0cb4282d4dcf284b23 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jan 2003 00:29:49 +0200 Subject: [PATCH 195/220] buf0buf.c: Add a sanity check awe mem >= buf pool size innobase/buf/buf0buf.c: Add a sanity check awe mem >= buf pool size --- innobase/buf/buf0buf.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c index 4c77a374210..3c6ec424434 100644 --- a/innobase/buf/buf0buf.c +++ b/innobase/buf/buf0buf.c @@ -418,6 +418,15 @@ buf_pool_init( ut_a(max_size == curr_size); ut_a(srv_use_awe || n_frames == max_size); + if (n_frames > curr_size) { + fprintf(stderr, +"InnoDB: AWE: Error: you must specify in my.cnf .._awe_mem_mb larger\n" +"InnoDB: than .._buffer_pool_size. Now the former is %lu pages,\n" +"InnoDB: the latter %lu pages.\n", curr_size, n_frames); + + return(NULL); + } + buf_pool = mem_alloc(sizeof(buf_pool_t)); /* 1. Initialize general fields From b5e37b242e23c1fed48007e0ec6f9eb7ecc34758 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jan 2003 02:19:14 +0200 Subject: [PATCH 196/220] Don't count NULL values in cardinalty for MyISAM tables. Free row buffer cache after each query for MyISAM tables. Added table join option FORCE INDEX Fixed core dump bug when connecting with hostname that could not be resolved. include/my_base.h: Don't count NULL values in cardinalty myisam/mi_check.c: Don't count NULL values in cardinalty myisam/mi_extra.c: Free row buffer cache after each query myisam/mi_open.c: Avoid realloc if cache size doesn't change myisam/mi_search.c: Don't count NULL values in cardinalty myisam/myisamdef.h: Change buffer length from uint to uint32 to make it more portable/predictable mysql-test/r/myisam.result: Test case for cardinality with NULL keys and FORCE INDEX mysql-test/t/myisam.test: Test case for cardinality with NULL keys and FORCE INDEX sql/lex.h: Added table join option FORCE INDEX sql/mysql_priv.h: Added table join option FORCE INDEX sql/opt_range.cc: Added table join option FORCE INDEX sql/sql_base.cc: Added table join option FORCE INDEX sql/sql_lex.h: Added table join option FORCE INDEX sql/sql_parse.cc: Added table join option FORCE INDEX Don't use strlen() on hostname without first checking if it's not NULL sql/sql_select.cc: Added table join option FORCE INDEX sql/sql_yacc.yy: Added table join option FORCE INDEX sql/table.h: Added table join option FORCE INDEX --- include/my_base.h | 1 + myisam/mi_check.c | 3 ++- myisam/mi_extra.c | 5 ++++ myisam/mi_open.c | 14 +++++++--- myisam/mi_search.c | 47 +++++++++++++++++++++++++------- myisam/myisamdef.h | 4 +-- mysql-test/r/myisam.result | 44 +++++++++++++++++++++++++++++- mysql-test/t/myisam.test | 26 +++++++++++++++++- sql/lex.h | 1 + sql/mysql_priv.h | 6 ++++- sql/opt_range.cc | 4 ++- sql/sql_base.cc | 6 +++-- sql/sql_lex.h | 2 +- sql/sql_parse.cc | 36 +++++++++++++++++++------ sql/sql_select.cc | 3 ++- sql/sql_yacc.yy | 55 ++++++++++++++++++++++++-------------- sql/table.h | 2 ++ 17 files changed, 207 insertions(+), 52 deletions(-) diff --git a/include/my_base.h b/include/my_base.h index bcb8c8d6a2f..feb5259ef08 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -263,6 +263,7 @@ enum ha_base_keytype { #define MBR_EQUAL 8192 #define MBR_DATA 16384 #define SEARCH_NULL_ARE_EQUAL 32768 /* NULL in keys are equal */ +#define SEARCH_NULL_ARE_NOT_EQUAL 65536 /* NULL in keys are not equal */ /* bits in opt_flag */ #define QUICK_USED 1 diff --git a/myisam/mi_check.c b/myisam/mi_check.c index 540f3c92ad3..b65e963bcb7 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -601,7 +601,8 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, if (*keys != 1L) /* not first_key */ { uint diff; - _mi_key_cmp(keyinfo->seg,info->lastkey,key,USE_WHOLE_KEY,SEARCH_FIND, + _mi_key_cmp(keyinfo->seg,info->lastkey,key,USE_WHOLE_KEY, + SEARCH_FIND | SEARCH_NULL_ARE_NOT_EQUAL, &diff); param->unique_count[diff-1]++; } diff --git a/myisam/mi_extra.c b/myisam/mi_extra.c index 8429b22dad4..75057dd4e6a 100644 --- a/myisam/mi_extra.c +++ b/myisam/mi_extra.c @@ -55,12 +55,17 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) /* Free buffers and reset the following flags: EXTRA_CACHE, EXTRA_WRITE_CACHE, EXTRA_KEYREAD, EXTRA_QUICK + + If the row buffer cache is large (for dynamic tables), reduce it + to save memory. */ if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED)) { info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); error=end_io_cache(&info->rec_cache); } + if (share->base.blobs) + mi_alloc_rec_buff(info, -1, &info->rec_buff); #if defined(HAVE_MMAP) && defined(HAVE_MADVICE) if (info->opt_flag & MEMMAP_USED) madvise(share->file_map,share->state.state.data_file_length,MADV_RANDOM); diff --git a/myisam/mi_open.c b/myisam/mi_open.c index aeacf81d90a..0da5ebabf40 100644 --- a/myisam/mi_open.c +++ b/myisam/mi_open.c @@ -559,28 +559,36 @@ err: DBUG_RETURN (NULL); } /* mi_open */ + byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf) { uint extra; + uint32 old_length; + LINT_INIT(old_length); - if (! *buf || length > mi_get_rec_buff_len(info, *buf)) + if (! *buf || length > (old_length=mi_get_rec_buff_len(info, *buf))) { byte *newptr = *buf; /* to simplify initial init of info->rec_buf in mi_open and mi_extra */ if (length == (ulong) -1) + { length= max(info->s->base.pack_reclength+info->s->base.pack_bits, info->s->base.max_key_length); + /* Avoid unnecessary realloc */ + if (newptr && length == old_length) + return newptr; + } extra= ((info->s->options & HA_OPTION_PACK_RECORD) ? ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+ MI_REC_BUFF_OFFSET : 0); if (extra && newptr) - newptr-=MI_REC_BUFF_OFFSET; + newptr-= MI_REC_BUFF_OFFSET; if (!(newptr=(byte*) my_realloc((gptr)newptr, length+extra+8, MYF(MY_ALLOW_ZERO_PTR)))) return newptr; - *((uint *)newptr)=length; + *((uint32 *) newptr)= (uint32) length; *buf= newptr+(extra ? MI_REC_BUFF_OFFSET : 0); } return *buf; diff --git a/myisam/mi_search.c b/myisam/mi_search.c index d57fd1bb5b2..41d53e76241 100644 --- a/myisam/mi_search.c +++ b/myisam/mi_search.c @@ -260,9 +260,11 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, uchar *key, uint key_len, uint nextflag, uchar **ret_pos, uchar *buff, my_bool *last_key) { - /* my_flag is raw comparison result to be changed according to - SEARCH_NO_FIND,SEARCH_LAST and HA_REVERSE_SORT flags. - flag is the value returned by _mi_key_cmp and as treated as final */ + /* + my_flag is raw comparison result to be changed according to + SEARCH_NO_FIND,SEARCH_LAST and HA_REVERSE_SORT flags. + flag is the value returned by _mi_key_cmp and as treated as final + */ int flag=0, my_flag=-1; uint nod_flag, length, len, matched, cmplen, kseg_len; uint prefix_len,suffix_len; @@ -695,13 +697,29 @@ static int compare_bin(uchar *a, uint a_length, uchar *b, uint b_length, } - /* - ** Compare two keys - ** Returns <0, 0, >0 acording to which is bigger - ** Key_length specifies length of key to use. Number-keys can't - ** be splited - ** If flag <> SEARCH_FIND compare also position - */ +/* + Compare two keys + + SYNOPSIS + _mi_key_cmp() + keyseg Key segments of key to compare + a First key to compare, in format from _mi_pack_key() + This is normally key specified by user + b Second key to compare. This is always from a row + key_length Length of key to compare. This can be shorter than + a to just compare sub keys + next_flag How keys should be compared + If bit SEARCH_FIND is not set the keys includes the row + position and this should also be compared + + NOTES + Number-keys can't be splited + + RETURN VALUES + <0 If a < b + 0 If a == b + >0 If a > b +*/ #define FCMP(A,B) ((int) (A) - (int) (B)) @@ -738,6 +756,15 @@ int _mi_key_cmp(register MI_KEYSEG *keyseg, register uchar *a, { if (nextflag == (SEARCH_FIND | SEARCH_UPDATE)) nextflag=SEARCH_SAME; /* Allow duplicate keys */ + else if (nextflag & SEARCH_NULL_ARE_NOT_EQUAL) + { + /* + This is only used from mi_check() to calculate cardinality. + It can't be used when searching for a key as this would cause + compare of (a,b) and (b,a) to return the same value. + */ + return -1; + } next_key_length=key_length; continue; /* To next key part */ } diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h index 07744e11e5f..601a9a40aea 100644 --- a/myisam/myisamdef.h +++ b/myisam/myisamdef.h @@ -358,7 +358,7 @@ struct st_myisam_info { #define MI_DYN_ALIGN_SIZE 4 /* Align blocks on this */ #define MI_MAX_DYN_HEADER_BYTE 13 /* max header byte for dynamic rows */ #define MI_MAX_BLOCK_LENGTH ((((ulong) 1 << 24)-1) & (~ (ulong) (MI_DYN_ALIGN_SIZE-1))) -#define MI_REC_BUFF_OFFSET ALIGN_SIZE(MI_DYN_DELETE_BLOCK_HEADER+sizeof(uint)) +#define MI_REC_BUFF_OFFSET ALIGN_SIZE(MI_DYN_DELETE_BLOCK_HEADER+sizeof(uint32)) #define MEMMAP_EXTRA_MARGIN 7 /* Write this as a suffix for file */ @@ -529,7 +529,7 @@ extern byte *mi_alloc_rec_buff(MI_INFO *,ulong, byte**); ((((info)->s->options & HA_OPTION_PACK_RECORD) && (buf)) ? \ (buf) - MI_REC_BUFF_OFFSET : (buf)) #define mi_get_rec_buff_len(info,buf) \ - (*((uint *)(mi_get_rec_buff_ptr(info,buf)))) + (*((uint32 *)(mi_get_rec_buff_ptr(info,buf)))) extern ulong _mi_rec_unpack(MI_INFO *info,byte *to,byte *from, ulong reclength); diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 4a0eb47efb7..3a3558eedcb 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; CREATE TABLE t1 ( STRING_DATA char(255) default NULL, KEY STRING_DATA (STRING_DATA) @@ -318,3 +318,45 @@ CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255)); ALTER TABLE t1 ADD INDEX t1 (a, b, c); Specified key was too long. Max key length is 500 DROP TABLE t1; +CREATE TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a)); +INSERT into t1 values (0, null, 0), (0, null, 1), (0, null, 2), (0, null,3), (1,1,4); +create table t2 (a int not null, b int, c int, key(b), key(c), key(a)); +INSERT into t2 values (1,1,1), (2,2,2); +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +show index from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 1 b 1 b A 5 NULL NULL YES BTREE +t1 1 c 1 c A 5 NULL NULL YES BTREE +t1 1 a 1 a A 1 NULL NULL BTREE +t1 1 a 2 b A 5 NULL NULL YES BTREE +t1 1 c_2 1 c A 5 NULL NULL YES BTREE +t1 1 c_2 2 a A 5 NULL NULL BTREE +explain select * from t1,t2 where t1.a=t2.a; +table type possible_keys key key_len ref rows Extra +t1 ALL a NULL NULL NULL 5 +t2 ALL a NULL NULL NULL 2 Using where +explain select * from t1,t2 force index(a) where t1.a=t2.a; +table type possible_keys key key_len ref rows Extra +t2 ALL a NULL NULL NULL 2 +t1 ALL a NULL NULL NULL 5 Using where +explain select * from t1 force index(a),t2 force index(a) where t1.a=t2.a; +table type possible_keys key key_len ref rows Extra +t2 ALL a NULL NULL NULL 2 +t1 ref a a 4 t2.a 3 +explain select * from t1,t2 where t1.b=t2.b; +table type possible_keys key key_len ref rows Extra +t2 ALL b NULL NULL NULL 2 +t1 ref b b 5 t2.b 1 Using where +explain select * from t1,t2 force index(c) where t1.a=t2.a; +table type possible_keys key key_len ref rows Extra +t1 ALL a NULL NULL NULL 5 +t2 ALL NULL NULL NULL NULL 2 Using where +explain select * from t1 where a=0 or a=2; +table type possible_keys key key_len ref rows Extra +t1 ALL a NULL NULL NULL 5 Using where +explain select * from t1 force index (a) where a=0 or a=2; +table type possible_keys key key_len ref rows Extra +t1 range a a 4 NULL 4 Using where +drop table t1,t2; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 1265d809149..c96a21e73dd 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -2,7 +2,13 @@ # Test bugs in the MyISAM code # -drop table if exists t1; +# Initialise +drop table if exists t1,t2; + +# +# Test problem with CHECK TABLE; +# + CREATE TABLE t1 ( STRING_DATA char(255) default NULL, KEY STRING_DATA (STRING_DATA) @@ -326,3 +332,21 @@ CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255)); ALTER TABLE t1 ADD INDEX t1 (a, b, c); DROP TABLE t1; +# +# Test of cardinality of keys with NULL +# + +CREATE TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a)); +INSERT into t1 values (0, null, 0), (0, null, 1), (0, null, 2), (0, null,3), (1,1,4); +create table t2 (a int not null, b int, c int, key(b), key(c), key(a)); +INSERT into t2 values (1,1,1), (2,2,2); +optimize table t1; +show index from t1; +explain select * from t1,t2 where t1.a=t2.a; +explain select * from t1,t2 force index(a) where t1.a=t2.a; +explain select * from t1 force index(a),t2 force index(a) where t1.a=t2.a; +explain select * from t1,t2 where t1.b=t2.b; +explain select * from t1,t2 force index(c) where t1.a=t2.a; +explain select * from t1 where a=0 or a=2; +explain select * from t1 force index (a) where a=0 or a=2; +drop table t1,t2; diff --git a/sql/lex.h b/sql/lex.h index 826b9b4a9ef..82ed322af83 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -151,6 +151,7 @@ static SYMBOL symbols[] = { { "FLOAT8", SYM(DOUBLE_SYM),0,0}, { "FLUSH", SYM(FLUSH_SYM),0,0}, { "FOREIGN", SYM(FOREIGN),0,0}, + { "FORCE", SYM(FORCE_SYM),0,0}, { "RAID_TYPE", SYM(RAID_TYPE),0,0}, { "RAID_CHUNKS", SYM(RAID_CHUNKS),0,0}, { "RAID_CHUNKSIZE", SYM(RAID_CHUNKSIZE),0,0}, diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 2a8b263bf28..75bf4e97634 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -226,6 +226,10 @@ void debug_sync_point(const char* lock_name, uint lock_timeout); #define SHOW_LOG_STATUS_FREE "FREE" #define SHOW_LOG_STATUS_INUSE "IN USE" +/* Options to add_table_to_list() */ +#define TL_OPTION_UPDATING 1 +#define TL_OPTION_FORCE_INDEX 2 + /* Some portable defines */ #define portable_sizeof_char_ptr 8 @@ -509,7 +513,7 @@ bool add_field_to_list(char *field_name, enum enum_field_types type, void store_position_for_column(const char *name); bool add_to_list(SQL_LIST &list,Item *group,bool asc=0); TABLE_LIST *add_table_to_list(Table_ident *table,LEX_STRING *alias, - bool updating, + ulong table_option, thr_lock_type flags=TL_UNLOCK, List *use_index=0, List *ignore_index=0); diff --git a/sql/opt_range.cc b/sql/opt_range.cc index a18c0178b5d..c607e71c01b 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -605,12 +605,14 @@ int SQL_SELECT::test_quick_select(key_map keys_to_use, table_map prev_tables, records++; /* purecov: inspected */ scan_time=(double) records / TIME_FOR_COMPARE+1; read_time=(double) head->file->scan_time()+ scan_time + 1.0; + if (head->force_index) + scan_time= read_time= DBL_MAX; if (limit < records) read_time=(double) records+scan_time+1; // Force to use index else if (read_time <= 2.0 && !force_quick_range) DBUG_RETURN(0); /* No need for quick select */ - DBUG_PRINT("info",("Time to scan table: %ld",(long) read_time)); + DBUG_PRINT("info",("Time to scan table: %g", read_time)); keys_to_use&=head->keys_in_use_for_query; if (keys_to_use) diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 7b7c8c01aab..54c3e40244a 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -752,7 +752,7 @@ TABLE *reopen_name_locked_table(THD* thd, TABLE_LIST* table_list) table->tablenr=thd->current_tablenr++; table->used_fields=0; table->const_table=0; - table->outer_join=table->null_row=table->maybe_null=0; + table->outer_join= table->null_row= table->maybe_null= table->force_index= 0; table->status=STATUS_NO_RECORD; table->keys_in_use_for_query= table->keys_in_use; table->used_keys= table->keys_for_keyread; @@ -910,7 +910,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name, table->tablenr=thd->current_tablenr++; table->used_fields=0; table->const_table=0; - table->outer_join=table->null_row=table->maybe_null=0; + table->outer_join= table->null_row= table->maybe_null= table->force_index= 0; table->status=STATUS_NO_RECORD; table->keys_in_use_for_query= table->keys_in_use; table->used_keys= table->keys_for_keyread; @@ -981,6 +981,7 @@ bool reopen_table(TABLE *table,bool locked) tmp.status= table->status; tmp.keys_in_use_for_query= tmp.keys_in_use; tmp.used_keys= tmp.keys_for_keyread; + tmp.force_index= tmp.force_index; /* Get state */ tmp.key_length= table->key_length; @@ -1888,6 +1889,7 @@ bool setup_tables(TABLE_LIST *tables) table->maybe_null=test(table->outer_join=table_list->outer_join); table->tablenr=tablenr; table->map= (table_map) 1 << tablenr; + table->force_index= table_list->force_index; if (table_list->use_index) { key_map map= get_key_map_from_key_list(table, diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 54e72fafdd5..a905871e629 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -110,7 +110,7 @@ typedef struct st_select_lex char *db,*db1,*table1,*db2,*table2; /* For outer join using .. */ Item *where,*having; ha_rows select_limit,offset_limit; - ulong options; + ulong options, table_join_options; List expr_list; List when_list; SQL_LIST order_list,table_list,group_list; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index a0336d0b50b..5bf3a1c0bcd 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -498,7 +498,8 @@ check_connections(THD *thd) vio_in_addr(net->vio,&thd->remote.sin_addr); thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors); /* Cut very long hostnames to avoid possible overflows */ - thd->host[min(strlen(thd->host), HOSTNAME_LENGTH)]= 0; + if (thd->host) + thd->host[min(strlen(thd->host), HOSTNAME_LENGTH)]= 0; if (connect_errors > max_connect_errors) return(ER_HOST_IS_BLOCKED); } @@ -3158,12 +3159,30 @@ bool add_to_list(SQL_LIST &list,Item *item,bool asc) } +/* + Add a table to list of used tables + + SYNOPSIS + add_table_to_list() + table Table to add + alias alias for table (or null if no alias) + table_options A set of the following bits: + TL_OPTION_UPDATING Table will be updated + TL_OPTION_FORCE_INDEX Force usage of index + lock_type How table should be locked + use_index List of indexed used in USE INDEX + ignore_index List of indexed used in IGNORE INDEX + + RETURN + 0 Error + # Pointer to TABLE_LIST element added to the total table list +*/ + TABLE_LIST *add_table_to_list(Table_ident *table, LEX_STRING *alias, - bool updating, - thr_lock_type flags, + ulong table_options, + thr_lock_type lock_type, List *use_index, - List *ignore_index - ) + List *ignore_index) { register TABLE_LIST *ptr; THD *thd=current_thd; @@ -3211,8 +3230,9 @@ TABLE_LIST *add_table_to_list(Table_ident *table, LEX_STRING *alias, } ptr->real_name=table->table.str; ptr->real_name_length=table->table.length; - ptr->lock_type=flags; - ptr->updating=updating; + ptr->lock_type= lock_type; + ptr->updating= test(table_options & TL_OPTION_UPDATING); + ptr->force_index= test(table_options & TL_OPTION_FORCE_INDEX); if (use_index) ptr->use_index=(List *) thd->memdup((gptr) use_index, sizeof(*use_index)); @@ -3221,7 +3241,7 @@ TABLE_LIST *add_table_to_list(Table_ident *table, LEX_STRING *alias, sizeof(*ignore_index)); /* check that used name is unique */ - if (flags != TL_IGNORE) + if (lock_type != TL_IGNORE) { for (TABLE_LIST *tables=(TABLE_LIST*) thd->lex.select->table_list.first ; tables ; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 28aa21e94ce..237197ba6be 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2057,7 +2057,8 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count, !(s->quick && best_key && s->quick->index == best_key->key && best_max_key_part >= s->table->quick_key_parts[best_key->key]) && !((s->table->file->table_flags() & HA_TABLE_SCAN_ON_INDEX) && - s->table->used_keys && best_key)) + s->table->used_keys && best_key) && + !(s->table->force_index && best_key)) { // Check full join if (s->on_expr) { diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index e26e57b8bbd..0e93f048406 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2001 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 @@ -198,6 +198,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token FIRST_SYM %token FIXED_SYM %token FLOAT_NUM +%token FORCE_SYM %token FOREIGN %token FROM %token FULL @@ -735,7 +736,8 @@ create: lex->sql_command= SQLCOM_CREATE_TABLE; if (!add_table_to_list($5, ($2 & HA_LEX_CREATE_TMP_TABLE ? - &tmp_table_alias : (LEX_STRING*) 0),1)) + &tmp_table_alias : (LEX_STRING*) 0), + TL_OPTION_UPDATING)) YYABORT; lex->create_list.empty(); lex->key_list.empty(); @@ -751,7 +753,7 @@ create: { LEX *lex=Lex; lex->sql_command= SQLCOM_CREATE_INDEX; - if (!add_table_to_list($6,NULL,1)) + if (!add_table_to_list($6, NULL, TL_OPTION_UPDATING)) YYABORT; lex->create_list.empty(); lex->key_list.empty(); @@ -1171,7 +1173,7 @@ alter: LEX *lex=Lex; lex->sql_command = SQLCOM_ALTER_TABLE; lex->name=0; - if (!add_table_to_list($4, NULL,1)) + if (!add_table_to_list($4, NULL, TL_OPTION_UPDATING)) YYABORT; lex->drop_primary=0; lex->create_list.empty(); @@ -1442,8 +1444,9 @@ table_to_table_list: table_to_table: table_ident TO_SYM table_ident - { if (!add_table_to_list($1,NULL,1,TL_IGNORE) || - !add_table_to_list($3,NULL,1,TL_IGNORE)) + { + if (!add_table_to_list($1, NULL, TL_OPTION_UPDATING, TL_IGNORE) || + !add_table_to_list($3, NULL, TL_OPTION_UPDATING, TL_IGNORE)) YYABORT; }; @@ -2127,11 +2130,13 @@ join_table: { SELECT_LEX *sel=Select; sel->use_index_ptr=sel->ignore_index_ptr=0; + sel->table_join_options= 0; } table_ident opt_table_alias opt_key_definition { SELECT_LEX *sel=Select; - if (!($$=add_table_to_list($2,$3,0,TL_UNLOCK, sel->use_index_ptr, + if (!($$=add_table_to_list($2, $3, sel->table_join_options, + TL_UNLOCK, sel->use_index_ptr, sel->ignore_index_ptr))) YYABORT; } @@ -2150,12 +2155,20 @@ opt_key_definition: sel->use_index= *$2; sel->use_index_ptr= &sel->use_index; } + | FORCE_SYM key_usage_list + { + SELECT_LEX *sel=Select; + sel->use_index= *$2; + sel->use_index_ptr= &sel->use_index; + sel->table_join_options|= TL_OPTION_FORCE_INDEX; + } | IGNORE_SYM key_usage_list { SELECT_LEX *sel=Select; sel->ignore_index= *$2; sel->ignore_index_ptr= &sel->ignore_index; - }; + } + ; key_usage_list: key_or_index { Select->interval_list.empty(); } '(' key_usage_list2 ')' @@ -2443,7 +2456,7 @@ drop: lex->drop_list.empty(); lex->drop_list.push_back(new Alter_drop(Alter_drop::KEY, $3.str)); - if (!add_table_to_list($5,NULL, 1)) + if (!add_table_to_list($5, NULL, TL_OPTION_UPDATING)) YYABORT; } | DROP DATABASE if_exists ident @@ -2467,7 +2480,7 @@ table_list: table_name: table_ident - { if (!add_table_to_list($1,NULL,1)) YYABORT; }; + { if (!add_table_to_list($1,NULL,TL_OPTION_UPDATING)) YYABORT; }; if_exists: /* empty */ { $$= 0; } @@ -2678,7 +2691,8 @@ delete: single_multi: FROM table_ident { - if (!add_table_to_list($2, NULL, 1, Lex->lock_option)) + if (!add_table_to_list($2, NULL, TL_OPTION_UPDATING, + Lex->lock_option)) YYABORT; } where_clause opt_order_clause @@ -2699,13 +2713,14 @@ table_wild_list: table_wild_one: ident opt_wild { - if (!add_table_to_list(new Table_ident($1), NULL, 1, - Lex->lock_option)) + if (!add_table_to_list(new Table_ident($1), NULL, + TL_OPTION_UPDATING, Lex->lock_option)) YYABORT; } | ident '.' ident opt_wild { - if (!add_table_to_list(new Table_ident($1,$3,0), NULL, 1, + if (!add_table_to_list(new Table_ident($1,$3,0), NULL, + TL_OPTION_UPDATING, Lex->lock_option)) YYABORT; } @@ -2774,7 +2789,7 @@ show_param: Lex->sql_command= SQLCOM_SHOW_FIELDS; if ($5) $4->change_db($5); - if (!add_table_to_list($4,NULL,0)) + if (!add_table_to_list($4, NULL, 0)) YYABORT; } | NEW_SYM MASTER_SYM FOR_SYM SLAVE WITH MASTER_LOG_FILE_SYM EQ @@ -2807,7 +2822,7 @@ show_param: Lex->sql_command= SQLCOM_SHOW_KEYS; if ($4) $3->change_db($4); - if (!add_table_to_list($3,NULL,0)) + if (!add_table_to_list($3, NULL, 0)) YYABORT; } | STATUS_SYM wild @@ -2834,7 +2849,7 @@ show_param: | CREATE TABLE_SYM table_ident { Lex->sql_command = SQLCOM_SHOW_CREATE; - if(!add_table_to_list($3, NULL,0)) + if(!add_table_to_list($3, NULL, 0)) YYABORT; } | MASTER_SYM STATUS_SYM @@ -2879,7 +2894,7 @@ describe: lex->wild=0; lex->verbose=0; lex->sql_command=SQLCOM_SHOW_FIELDS; - if (!add_table_to_list($2, NULL,0)) + if (!add_table_to_list($2, NULL, 0)) YYABORT; } opt_describe_column {} @@ -2999,14 +3014,14 @@ load: LOAD DATA_SYM load_data_lock opt_local INFILE TEXT_STRING opt_duplicate INTO TABLE_SYM table_ident opt_field_term opt_line_term opt_ignore_lines opt_field_spec { - if (!add_table_to_list($11,NULL,1)) + if (!add_table_to_list($11, NULL, TL_OPTION_UPDATING)) YYABORT; } | LOAD TABLE_SYM table_ident FROM MASTER_SYM { Lex->sql_command = SQLCOM_LOAD_MASTER_TABLE; - if (!add_table_to_list($3,NULL,1)) + if (!add_table_to_list($3, NULL, TL_OPTION_UPDATING)) YYABORT; } diff --git a/sql/table.h b/sql/table.h index 3a08cd11a2a..c3f469115b5 100644 --- a/sql/table.h +++ b/sql/table.h @@ -91,6 +91,7 @@ struct st_table { my_bool copy_blobs; /* copy_blobs when storing */ my_bool null_row; /* All columns are null */ my_bool maybe_null,outer_join; /* Used with OUTER JOIN */ + my_bool force_index; my_bool distinct,const_table,no_rows; my_bool key_read, bulk_insert; my_bool crypted; @@ -157,6 +158,7 @@ typedef struct st_table_list bool straight; /* optimize with prev table */ bool updating; /* for replicate-do/ignore table */ bool do_redirect; /* To get the struct in UNION's */ + bool force_index; /* Prefer index over table scan */ } TABLE_LIST; From cd2f741d5d2cc52928668c6ce1f77052d1ca8a3b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jan 2003 03:12:17 +0200 Subject: [PATCH 197/220] Add TYPE as an alias for specifying key type --- sql/sql_yacc.yy | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index bcee15c13cf..77325bad3a0 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1356,6 +1356,7 @@ opt_unique_or_fulltext: key_alg: /* empty */ { $$= HA_KEY_ALG_UNDEF; } | USING opt_btree_or_rtree { $$= $2; }; + | TYPE opt_btree_or_rtree { $$= $2; }; opt_btree_or_rtree: BTREE_SYM { $$= HA_KEY_ALG_BTREE; } From 6fb06a7aca02d04c14cae3b9ee4ef1714ece432c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jan 2003 14:35:01 +0400 Subject: [PATCH 198/220] fixed order_by test to make it repeatable --- mysql-test/r/order_by.result | 26 +++++++++++++------------- mysql-test/t/order_by.test | 10 +++++----- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 1f6f958b5b0..9bacae92945 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -513,7 +513,7 @@ KEY FieldKey (FieldKey), KEY LongField (FieldKey,LongVal), KEY StringField (FieldKey,StringVal(32)) ); -INSERT INTO t1 VALUES ('0',3,'0'),('1',2,'1'),('1',1,'3'), ('1',0,'2'); +INSERT INTO t1 VALUES ('0',3,'0'),('0',2,'1'),('0',1,'2'),('1',2,'1'),('1',1,'3'), ('1',0,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('3',2,'1'),('3',1,'2'),('3','3','3'); EXPLAIN SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref FieldKey,LongField,StringField LongField 36 const 2 Using where @@ -522,20 +522,20 @@ FieldKey LongVal StringVal 1 0 2 1 1 3 1 2 1 -EXPLAIN SELECT * FROM t1 WHERE FieldKey > '0' ORDER BY LongVal; +EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range FieldKey,LongField,StringField FieldKey 36 NULL 3 Using where; Using filesort -SELECT * FROM t1 WHERE FieldKey > '0' ORDER BY LongVal; +1 SIMPLE t1 range FieldKey,LongField,StringField FieldKey 36 NULL 4 Using where; Using filesort +SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal; FieldKey LongVal StringVal -1 0 2 -1 1 3 -1 2 1 -EXPLAIN SELECT * FROM t1 WHERE FieldKey > '0' ORDER BY FieldKey, LongVal; +3 1 2 +3 2 1 +3 3 3 +EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range FieldKey,LongField,StringField LongField 36 NULL 3 Using where -SELECT * FROM t1 WHERE FieldKey > '0' ORDER BY FieldKey, LongVal; +1 SIMPLE t1 range FieldKey,LongField,StringField LongField 36 NULL 4 Using where +SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal; FieldKey LongVal StringVal -1 0 2 -1 1 3 -1 2 1 +3 1 2 +3 2 1 +3 3 3 DROP TABLE t1; diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index e87262042bf..c6bc7e9f868 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -344,11 +344,11 @@ CREATE TABLE t1 ( KEY LongField (FieldKey,LongVal), KEY StringField (FieldKey,StringVal(32)) ); -INSERT INTO t1 VALUES ('0',3,'0'),('1',2,'1'),('1',1,'3'), ('1',0,'2'); +INSERT INTO t1 VALUES ('0',3,'0'),('0',2,'1'),('0',1,'2'),('1',2,'1'),('1',1,'3'), ('1',0,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('3',2,'1'),('3',1,'2'),('3','3','3'); EXPLAIN SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal; SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal; -EXPLAIN SELECT * FROM t1 WHERE FieldKey > '0' ORDER BY LongVal; -SELECT * FROM t1 WHERE FieldKey > '0' ORDER BY LongVal; -EXPLAIN SELECT * FROM t1 WHERE FieldKey > '0' ORDER BY FieldKey, LongVal; -SELECT * FROM t1 WHERE FieldKey > '0' ORDER BY FieldKey, LongVal; +EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal; +SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal; +EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal; +SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal; DROP TABLE t1; From 6383a27b5323c8e033efd608e3f387d013d312ef Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jan 2003 15:37:59 +0400 Subject: [PATCH 199/220] Separating CHARSET and COLLATION terms mysql-test/r/alter_table.result: SHOW FIELDS and SHOW CREATE TABLE now displays collation mysql-test/r/create.result: SHOW FIELDS and SHOW CREATE TABLE now displays collation mysql-test/r/innodb.result: SHOW FIELDS and SHOW CREATE TABLE now displays collation mysql-test/r/isam.result: SHOW FIELDS and SHOW CREATE TABLE now displays collation mysql-test/r/select.result: SHOW FIELDS and SHOW CREATE TABLE now displays collation mysql-test/r/show_check.result: SHOW FIELDS and SHOW CREATE TABLE now displays collation mysql-test/r/type_blob.result: SHOW FIELDS and SHOW CREATE TABLE now displays collation mysql-test/r/type_float.result: SHOW FIELDS and SHOW CREATE TABLE now displays collation mysql-test/r/type_ranges.result: SHOW FIELDS and SHOW CREATE TABLE now displays collation sql/field.cc: In field type charset rather than collation name is displayed sql/sql_db.cc: COLLATE clause has been added into SHOW CREATE DATABASE sql/sql_lex.cc: Detect charset names rather than collation names sql/sql_show.cc: COLLATION field has been added into SHOW FIELDS sql/sql_yacc.yy: COLLATE syntax has been added in CREATE TABLE/DATABASE --- mysql-test/r/alter_table.result | 14 +-- mysql-test/r/create.result | 38 +++---- mysql-test/r/innodb.result | 4 +- mysql-test/r/isam.result | 16 +-- mysql-test/r/select.result | 30 +++--- mysql-test/r/show_check.result | 54 +++++----- mysql-test/r/type_blob.result | 40 ++++---- mysql-test/r/type_float.result | 32 +++--- mysql-test/r/type_ranges.result | 170 ++++++++++++++++---------------- sql/field.cc | 2 +- sql/sql_db.cc | 10 +- sql/sql_lex.cc | 2 +- sql/sql_show.cc | 19 +++- sql/sql_yacc.yy | 57 ++++++++--- 14 files changed, 270 insertions(+), 218 deletions(-) diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index cba486109ac..a4be4195ac8 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -50,10 +50,10 @@ PRIMARY KEY (GROUP_ID,LANG_ID), KEY NAME (NAME)); ALTER TABLE t1 CHANGE NAME NAME CHAR(80) not null; SHOW FULL COLUMNS FROM t1; -Field Type Null Key Default Extra Privileges Comment -GROUP_ID int(10) unsigned PRI 0 select,insert,update,references -LANG_ID smallint(5) unsigned PRI 0 select,insert,update,references -NAME char(80) character set latin1 MUL select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +GROUP_ID int(10) unsigned binary PRI 0 select,insert,update,references +LANG_ID smallint(5) unsigned binary PRI 0 select,insert,update,references +NAME char(80) character set latin1 latin1 MUL select,insert,update,references DROP TABLE t1; create table t1 (n int); insert into t1 values(9),(3),(12),(10); @@ -118,7 +118,7 @@ create table t1 (i int unsigned not null auto_increment primary key); alter table t1 rename t2; alter table t2 rename t1, add c char(10) comment "no comment"; show columns from t1; -Field Type Null Key Default Extra -i int(10) unsigned PRI NULL auto_increment -c char(10) character set latin1 YES NULL +Field Type Collation Null Key Default Extra +i int(10) unsigned binary PRI NULL auto_increment +c char(10) character set latin1 latin1 YES NULL drop table t1; diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index a32d32a4ab7..affda14b4ba 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -75,37 +75,37 @@ drop table t1,t2; create table t1(x varchar(50) ); create table t2 select x from t1 where 1=2; describe t1; -Field Type Null Key Default Extra -x varchar(50) character set latin1 YES NULL +Field Type Collation Null Key Default Extra +x varchar(50) character set latin1 latin1 YES NULL describe t2; -Field Type Null Key Default Extra -x char(50) character set latin1 YES NULL +Field Type Collation Null Key Default Extra +x char(50) character set latin1 latin1 YES NULL drop table t2; create table t2 select now() as a , curtime() as b, curdate() as c , 1+1 as d , 1.0 + 1 as e , 33333333333333333 + 3 as f; describe t2; -Field Type Null Key Default Extra -a datetime 0000-00-00 00:00:00 -b time 00:00:00 -c date 0000-00-00 -d bigint(17) 0 -e double(18,1) 0.0 -f bigint(17) 0 +Field Type Collation Null Key Default Extra +a datetime latin1 0000-00-00 00:00:00 +b time latin1 00:00:00 +c date latin1 0000-00-00 +d bigint(17) binary 0 +e double(18,1) binary 0.0 +f bigint(17) binary 0 drop table t2; create table t2 select CAST("2001-12-29" AS DATE) as d, CAST("20:45:11" AS TIME) as t, CAST("2001-12-29 20:45:11" AS DATETIME) as dt; describe t2; -Field Type Null Key Default Extra -d date 0000-00-00 -t time 00:00:00 -dt datetime 0000-00-00 00:00:00 +Field Type Collation Null Key Default Extra +d date latin1 0000-00-00 +t time latin1 00:00:00 +dt datetime latin1 0000-00-00 00:00:00 drop table t1,t2; create table t1 (a tinyint); create table t2 (a int) select * from t1; describe t1; -Field Type Null Key Default Extra -a tinyint(4) YES NULL +Field Type Collation Null Key Default Extra +a tinyint(4) binary YES NULL describe t2; -Field Type Null Key Default Extra -a int(11) YES NULL +Field Type Collation Null Key Default Extra +a int(11) binary YES NULL drop table if exists t2; create table t2 (a int, a float) select * from t1; Duplicate column name 'a' diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 6a4f807eab9..110b8707bc8 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -918,8 +918,8 @@ id select_type table type possible_keys key key_len ref rows Extra drop table t1; create table t1 (t int not null default 1, key (t)) type=innodb; desc t1; -Field Type Null Key Default Extra -t int(11) MUL 1 +Field Type Collation Null Key Default Extra +t int(11) binary MUL 1 drop table t1; CREATE TABLE t1 ( number bigint(20) NOT NULL default '0', diff --git a/mysql-test/r/isam.result b/mysql-test/r/isam.result index 85641055fe6..7871e899773 100644 --- a/mysql-test/r/isam.result +++ b/mysql-test/r/isam.result @@ -64,15 +64,15 @@ Table Op Msg_type Msg_text test.t2 check error Table 't2' was not locked with LOCK TABLES test.t1 check status OK show columns from t1; -Field Type Null Key Default Extra -a int(11) PRI 0 -b int(11) MUL 0 -c int(11) 0 +Field Type Collation Null Key Default Extra +a int(11) binary PRI 0 +b int(11) binary MUL 0 +c int(11) binary 0 show full columns from t1; -Field Type Null Key Default Extra Privileges Comment -a int(11) PRI 0 select,insert,update,references -b int(11) MUL 0 select,insert,update,references -c int(11) 0 select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +a int(11) binary PRI 0 select,insert,update,references +b int(11) binary MUL 0 select,insert,update,references +c int(11) binary 0 select,insert,update,references show index from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 0 PRIMARY 1 a A 4 NULL NULL BTREE diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index c70dec6f9eb..bba10f408cb 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -3217,23 +3217,23 @@ Tables_in_test (s%) show tables from test like "t?"; Tables_in_test (t?) show full columns from t2; -Field Type Null Key Default Extra Privileges Comment -auto int(11) PRI NULL auto_increment select,insert,update,references -fld1 int(6) unsigned zerofill UNI 000000 select,insert,update,references -companynr tinyint(2) unsigned zerofill 00 select,insert,update,references -fld3 char(30) character set latin1 MUL select,insert,update,references -fld4 char(35) character set latin1 select,insert,update,references -fld5 char(35) character set latin1 select,insert,update,references -fld6 char(4) character set latin1 select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +auto int(11) binary PRI NULL auto_increment select,insert,update,references +fld1 int(6) unsigned zerofill binary UNI 000000 select,insert,update,references +companynr tinyint(2) unsigned zerofill binary 00 select,insert,update,references +fld3 char(30) character set latin1 latin1 MUL select,insert,update,references +fld4 char(35) character set latin1 latin1 select,insert,update,references +fld5 char(35) character set latin1 latin1 select,insert,update,references +fld6 char(4) character set latin1 latin1 select,insert,update,references show full columns from t2 from test like 'f%'; -Field Type Null Key Default Extra Privileges Comment -fld1 int(6) unsigned zerofill UNI 000000 select,insert,update,references -fld3 char(30) character set latin1 MUL select,insert,update,references -fld4 char(35) character set latin1 select,insert,update,references -fld5 char(35) character set latin1 select,insert,update,references -fld6 char(4) character set latin1 select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +fld1 int(6) unsigned zerofill binary UNI 000000 select,insert,update,references +fld3 char(30) character set latin1 latin1 MUL select,insert,update,references +fld4 char(35) character set latin1 latin1 select,insert,update,references +fld5 char(35) character set latin1 latin1 select,insert,update,references +fld6 char(4) character set latin1 latin1 select,insert,update,references show full columns from t2 from test like 's%'; -Field Type Null Key Default Extra Privileges Comment +Field Type Collation Null Key Default Extra Privileges Comment show keys from t2; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 2e8d7d19465..94170638730 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -98,10 +98,10 @@ t1 CREATE TABLE `t1` ( `c` int(11) NOT NULL default '0' COMMENT 'int column' ) TYPE=MyISAM CHARSET=latin1 COMMENT='it''s a table' show full columns from t1; -Field Type Null Key Default Extra Privileges Comment -test_set set('val1','val2','val3') character set latin1 select,insert,update,references -name char(20) character set latin1 YES O'Brien select,insert,update,references O'Brien as default -c int(11) 0 select,insert,update,references int column +Field Type Collation Null Key Default Extra Privileges Comment +test_set set('val1','val2','val3') character set latin1 latin1 select,insert,update,references +name char(20) character set latin1 latin1 YES O'Brien select,insert,update,references O'Brien as default +c int(11) binary 0 select,insert,update,references int column drop table t1; create table t1 (a int not null, unique aa (a)); show create table t1; @@ -155,34 +155,34 @@ t1 CREATE TABLE `t1` ( drop table t1; create table t1 (a decimal(9,2), b decimal (9,0), e double(9,2), f double(5,0), h float(3,2), i float(3,0)); show columns from t1; -Field Type Null Key Default Extra -a decimal(9,2) YES NULL -b decimal(9,0) YES NULL -e double(9,2) YES NULL -f double(5,0) YES NULL -h float(3,2) YES NULL -i float(3,0) YES NULL +Field Type Collation Null Key Default Extra +a decimal(9,2) binary YES NULL +b decimal(9,0) binary YES NULL +e double(9,2) binary YES NULL +f double(5,0) binary YES NULL +h float(3,2) binary YES NULL +i float(3,0) binary YES NULL show full columns from t1; -Field Type Null Key Default Extra Privileges Comment -a decimal(9,2) YES NULL select,insert,update,references -b decimal(9,0) YES NULL select,insert,update,references -e double(9,2) YES NULL select,insert,update,references -f double(5,0) YES NULL select,insert,update,references -h float(3,2) YES NULL select,insert,update,references -i float(3,0) YES NULL select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +a decimal(9,2) binary YES NULL select,insert,update,references +b decimal(9,0) binary YES NULL select,insert,update,references +e double(9,2) binary YES NULL select,insert,update,references +f double(5,0) binary YES NULL select,insert,update,references +h float(3,2) binary YES NULL select,insert,update,references +i float(3,0) binary YES NULL select,insert,update,references drop table t1; create table t1 (c decimal, d double, f float, r real); show columns from t1; -Field Type Null Key Default Extra -c decimal(10,0) YES NULL -d double YES NULL -f float YES NULL -r double YES NULL +Field Type Collation Null Key Default Extra +c decimal(10,0) binary YES NULL +d double binary YES NULL +f float binary YES NULL +r double binary YES NULL drop table t1; create table t1 (c decimal(3,3), d double(3,3), f float(3,3)); show columns from t1; -Field Type Null Key Default Extra -c decimal(4,3) YES NULL -d double(4,3) YES NULL -f float(4,3) YES NULL +Field Type Collation Null Key Default Extra +c decimal(4,3) binary YES NULL +d double(4,3) binary YES NULL +f float(4,3) binary YES NULL drop table t1; diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index ba8d4f770f6..3248e3c5c80 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -1,22 +1,22 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7; CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000)); show columns from t1; -Field Type Null Key Default Extra -a blob YES NULL -b text character set latin1 YES NULL -c blob YES NULL -d mediumtext character set latin1 YES NULL -e longtext character set latin1 YES NULL +Field Type Collation Null Key Default Extra +a blob binary YES NULL +b text character set latin1 latin1 YES NULL +c blob binary YES NULL +d mediumtext character set latin1 latin1 YES NULL +e longtext character set latin1 latin1 YES NULL CREATE TABLE t2 (a char(257), b varchar(70000) binary, c varchar(70000000)); Warnings: Warning 1244 Converting column 'a' from CHAR to TEXT Warning 1244 Converting column 'b' from CHAR to BLOB Warning 1244 Converting column 'c' from CHAR to TEXT show columns from t2; -Field Type Null Key Default Extra -a text character set latin1 YES NULL -b mediumblob YES NULL -c longtext character set latin1 YES NULL +Field Type Collation Null Key Default Extra +a text character set latin1 latin1 YES NULL +b mediumblob binary YES NULL +c longtext character set latin1 latin1 YES NULL create table t3 (a long, b long byte); show create TABLE t3; Table Create Table @@ -69,18 +69,18 @@ insert into t1 values (NULL,NULL,NULL,NULL); update t1 set c="",b=null where c="1"; lock tables t1 READ; show full fields from t1; -Field Type Null Key Default Extra Privileges Comment -t text character set latin1 YES NULL select,insert,update,references -c varchar(10) character set latin1 YES NULL select,insert,update,references -b blob YES NULL select,insert,update,references -d varchar(10) binary YES NULL select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +t text character set latin1 latin1 YES NULL select,insert,update,references +c varchar(10) character set latin1 latin1 YES NULL select,insert,update,references +b blob binary YES NULL select,insert,update,references +d varchar(10) binary binary YES NULL select,insert,update,references lock tables t1 WRITE; show full fields from t1; -Field Type Null Key Default Extra Privileges Comment -t text character set latin1 YES NULL select,insert,update,references -c varchar(10) character set latin1 YES NULL select,insert,update,references -b blob YES NULL select,insert,update,references -d varchar(10) binary YES NULL select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +t text character set latin1 latin1 YES NULL select,insert,update,references +c varchar(10) character set latin1 latin1 YES NULL select,insert,update,references +b blob binary YES NULL select,insert,update,references +d varchar(10) binary binary YES NULL select,insert,update,references unlock tables; select t from t1 where t like "hello"; t diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index 8fe91ac88d8..3914114d92c 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -10,9 +10,9 @@ SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1; 10 10 10 10 10 10 0.1 0.1 0.1 create table t1 (f1 float(24),f2 float(52)); show full columns from t1; -Field Type Null Key Default Extra Privileges Comment -f1 float YES NULL select,insert,update,references -f2 double YES NULL select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +f1 float binary YES NULL select,insert,update,references +f2 double binary YES NULL select,insert,update,references insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150); insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150); select * from t1; @@ -69,19 +69,19 @@ min(a) drop table t1; create table t1 (f float, f2 float(24), f3 float(6,2), d double, d2 float(53), d3 double(10,3), de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(5,6)); show full columns from t1; -Field Type Null Key Default Extra Privileges Comment -f float YES NULL select,insert,update,references -f2 float YES NULL select,insert,update,references -f3 float(6,2) YES NULL select,insert,update,references -d double YES NULL select,insert,update,references -d2 double YES NULL select,insert,update,references -d3 double(10,3) YES NULL select,insert,update,references -de decimal(10,0) YES NULL select,insert,update,references -de2 decimal(6,0) YES NULL select,insert,update,references -de3 decimal(5,2) YES NULL select,insert,update,references -n decimal(10,0) YES NULL select,insert,update,references -n2 decimal(8,0) YES NULL select,insert,update,references -n3 decimal(7,6) YES NULL select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +f float binary YES NULL select,insert,update,references +f2 float binary YES NULL select,insert,update,references +f3 float(6,2) binary YES NULL select,insert,update,references +d double binary YES NULL select,insert,update,references +d2 double binary YES NULL select,insert,update,references +d3 double(10,3) binary YES NULL select,insert,update,references +de decimal(10,0) binary YES NULL select,insert,update,references +de2 decimal(6,0) binary YES NULL select,insert,update,references +de3 decimal(5,2) binary YES NULL select,insert,update,references +n decimal(10,0) binary YES NULL select,insert,update,references +n2 decimal(8,0) binary YES NULL select,insert,update,references +n3 decimal(7,6) binary YES NULL select,insert,update,references drop table t1; create table t1 (a decimal(7,3) not null, key (a)); insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1"); diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result index ea2863aefce..b570513a5e7 100644 --- a/mysql-test/r/type_ranges.result +++ b/mysql-test/r/type_ranges.result @@ -38,31 +38,31 @@ KEY (ulonglong,ulong), KEY (options,flags) ); show full fields from t1; -Field Type Null Key Default Extra Privileges Comment -auto int(5) unsigned PRI NULL auto_increment select,insert,update,references -string varchar(10) character set latin1 YES hello select,insert,update,references -tiny tinyint(4) MUL 0 select,insert,update,references -short smallint(6) MUL 1 select,insert,update,references -medium mediumint(8) MUL 0 select,insert,update,references -long_int int(11) 0 select,insert,update,references -longlong bigint(13) MUL 0 select,insert,update,references -real_float float(13,1) MUL 0.0 select,insert,update,references -real_double double(16,4) YES NULL select,insert,update,references -utiny tinyint(3) unsigned MUL 0 select,insert,update,references -ushort smallint(5) unsigned zerofill MUL 00000 select,insert,update,references -umedium mediumint(8) unsigned MUL 0 select,insert,update,references -ulong int(11) unsigned MUL 0 select,insert,update,references -ulonglong bigint(13) unsigned MUL 0 select,insert,update,references -time_stamp timestamp YES NULL select,insert,update,references -date_field date YES NULL select,insert,update,references -time_field time YES NULL select,insert,update,references -date_time datetime YES NULL select,insert,update,references -blob_col blob YES NULL select,insert,update,references -tinyblob_col tinyblob YES NULL select,insert,update,references -mediumblob_col mediumblob select,insert,update,references -longblob_col longblob select,insert,update,references -options enum('one','two','tree') character set latin1 MUL one select,insert,update,references -flags set('one','two','tree') character set latin1 select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +auto int(5) unsigned binary PRI NULL auto_increment select,insert,update,references +string varchar(10) character set latin1 latin1 YES hello select,insert,update,references +tiny tinyint(4) binary MUL 0 select,insert,update,references +short smallint(6) binary MUL 1 select,insert,update,references +medium mediumint(8) binary MUL 0 select,insert,update,references +long_int int(11) binary 0 select,insert,update,references +longlong bigint(13) binary MUL 0 select,insert,update,references +real_float float(13,1) binary MUL 0.0 select,insert,update,references +real_double double(16,4) binary YES NULL select,insert,update,references +utiny tinyint(3) unsigned binary MUL 0 select,insert,update,references +ushort smallint(5) unsigned zerofill binary MUL 00000 select,insert,update,references +umedium mediumint(8) unsigned binary MUL 0 select,insert,update,references +ulong int(11) unsigned binary MUL 0 select,insert,update,references +ulonglong bigint(13) unsigned binary MUL 0 select,insert,update,references +time_stamp timestamp latin1 YES NULL select,insert,update,references +date_field date latin1 YES NULL select,insert,update,references +time_field time latin1 YES NULL select,insert,update,references +date_time datetime latin1 YES NULL select,insert,update,references +blob_col blob binary YES NULL select,insert,update,references +tinyblob_col tinyblob binary YES NULL select,insert,update,references +mediumblob_col mediumblob binary select,insert,update,references +longblob_col longblob binary select,insert,update,references +options enum('one','two','tree') character set latin1 latin1 MUL one select,insert,update,references +flags set('one','two','tree') character set latin1 latin1 select,insert,update,references show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 0 PRIMARY 1 auto A 0 NULL NULL BTREE @@ -168,57 +168,57 @@ drop table t2; create table t2 select * from t1; update t2 set string="changed" where auto=16; show full columns from t1; -Field Type Null Key Default Extra Privileges Comment -auto int(5) unsigned MUL NULL auto_increment select,insert,update,references -string varchar(10) character set latin1 YES new defaul select,insert,update,references -tiny tinyint(4) MUL 0 select,insert,update,references -short smallint(6) MUL 0 select,insert,update,references -medium mediumint(8) MUL 0 select,insert,update,references -long_int int(11) 0 select,insert,update,references -longlong bigint(13) MUL 0 select,insert,update,references -real_float float(13,1) MUL 0.0 select,insert,update,references -real_double double(16,4) YES NULL select,insert,update,references -utiny tinyint(3) unsigned 0 select,insert,update,references -ushort smallint(5) unsigned zerofill 00000 select,insert,update,references -umedium mediumint(8) unsigned MUL 0 select,insert,update,references -ulong int(11) unsigned MUL 0 select,insert,update,references -ulonglong bigint(13) unsigned MUL 0 select,insert,update,references -time_stamp timestamp YES NULL select,insert,update,references -date_field varchar(10) character set latin1 YES NULL select,insert,update,references -time_field time YES NULL select,insert,update,references -date_time datetime YES NULL select,insert,update,references -new_blob_col varchar(20) character set latin1 YES NULL select,insert,update,references -tinyblob_col tinyblob YES NULL select,insert,update,references -mediumblob_col mediumblob select,insert,update,references -options enum('one','two','tree') character set latin1 MUL one select,insert,update,references -flags set('one','two','tree') character set latin1 select,insert,update,references -new_field varchar(10) character set latin1 new select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +auto int(5) unsigned binary MUL NULL auto_increment select,insert,update,references +string varchar(10) character set latin1 latin1 YES new defaul select,insert,update,references +tiny tinyint(4) binary MUL 0 select,insert,update,references +short smallint(6) binary MUL 0 select,insert,update,references +medium mediumint(8) binary MUL 0 select,insert,update,references +long_int int(11) binary 0 select,insert,update,references +longlong bigint(13) binary MUL 0 select,insert,update,references +real_float float(13,1) binary MUL 0.0 select,insert,update,references +real_double double(16,4) binary YES NULL select,insert,update,references +utiny tinyint(3) unsigned binary 0 select,insert,update,references +ushort smallint(5) unsigned zerofill binary 00000 select,insert,update,references +umedium mediumint(8) unsigned binary MUL 0 select,insert,update,references +ulong int(11) unsigned binary MUL 0 select,insert,update,references +ulonglong bigint(13) unsigned binary MUL 0 select,insert,update,references +time_stamp timestamp latin1 YES NULL select,insert,update,references +date_field varchar(10) character set latin1 latin1 YES NULL select,insert,update,references +time_field time latin1 YES NULL select,insert,update,references +date_time datetime latin1 YES NULL select,insert,update,references +new_blob_col varchar(20) character set latin1 latin1 YES NULL select,insert,update,references +tinyblob_col tinyblob binary YES NULL select,insert,update,references +mediumblob_col mediumblob binary select,insert,update,references +options enum('one','two','tree') character set latin1 latin1 MUL one select,insert,update,references +flags set('one','two','tree') character set latin1 latin1 select,insert,update,references +new_field varchar(10) character set latin1 latin1 new select,insert,update,references show full columns from t2; -Field Type Null Key Default Extra Privileges Comment -auto int(5) unsigned 0 select,insert,update,references -string varchar(10) character set latin1 YES new defaul select,insert,update,references -tiny tinyint(4) 0 select,insert,update,references -short smallint(6) 0 select,insert,update,references -medium mediumint(8) 0 select,insert,update,references -long_int int(11) 0 select,insert,update,references -longlong bigint(13) 0 select,insert,update,references -real_float float(13,1) 0.0 select,insert,update,references -real_double double(16,4) YES NULL select,insert,update,references -utiny tinyint(3) unsigned 0 select,insert,update,references -ushort smallint(5) unsigned zerofill 00000 select,insert,update,references -umedium mediumint(8) unsigned 0 select,insert,update,references -ulong int(11) unsigned 0 select,insert,update,references -ulonglong bigint(13) unsigned 0 select,insert,update,references -time_stamp timestamp YES NULL select,insert,update,references -date_field varchar(10) character set latin1 YES NULL select,insert,update,references -time_field time YES NULL select,insert,update,references -date_time datetime YES NULL select,insert,update,references -new_blob_col varchar(20) character set latin1 YES NULL select,insert,update,references -tinyblob_col tinyblob YES NULL select,insert,update,references -mediumblob_col mediumblob select,insert,update,references -options enum('one','two','tree') character set latin1 one select,insert,update,references -flags set('one','two','tree') character set latin1 select,insert,update,references -new_field varchar(10) character set latin1 new select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +auto int(5) unsigned binary 0 select,insert,update,references +string varchar(10) character set latin1 latin1 YES new defaul select,insert,update,references +tiny tinyint(4) binary 0 select,insert,update,references +short smallint(6) binary 0 select,insert,update,references +medium mediumint(8) binary 0 select,insert,update,references +long_int int(11) binary 0 select,insert,update,references +longlong bigint(13) binary 0 select,insert,update,references +real_float float(13,1) binary 0.0 select,insert,update,references +real_double double(16,4) binary YES NULL select,insert,update,references +utiny tinyint(3) unsigned binary 0 select,insert,update,references +ushort smallint(5) unsigned zerofill binary 00000 select,insert,update,references +umedium mediumint(8) unsigned binary 0 select,insert,update,references +ulong int(11) unsigned binary 0 select,insert,update,references +ulonglong bigint(13) unsigned binary 0 select,insert,update,references +time_stamp timestamp latin1 YES NULL select,insert,update,references +date_field varchar(10) character set latin1 latin1 YES NULL select,insert,update,references +time_field time latin1 YES NULL select,insert,update,references +date_time datetime latin1 YES NULL select,insert,update,references +new_blob_col varchar(20) character set latin1 latin1 YES NULL select,insert,update,references +tinyblob_col tinyblob binary YES NULL select,insert,update,references +mediumblob_col mediumblob binary select,insert,update,references +options enum('one','two','tree') character set latin1 latin1 one select,insert,update,references +flags set('one','two','tree') character set latin1 latin1 select,insert,update,references +new_field varchar(10) character set latin1 latin1 new select,insert,update,references select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null))); auto auto 16 16 @@ -228,12 +228,12 @@ auto auto 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 from t1; show full columns from t2; -Field Type Null Key Default Extra Privileges Comment -auto bigint(17) unsigned PRI 0 select,insert,update,references -t1 bigint(1) 0 select,insert,update,references -t2 char(1) character set latin1 select,insert,update,references -t3 mediumtext character set latin1 select,insert,update,references -t4 mediumblob select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +auto bigint(17) unsigned binary PRI 0 select,insert,update,references +t1 bigint(1) binary 0 select,insert,update,references +t2 char(1) character set latin1 latin1 select,insert,update,references +t3 mediumtext character set latin1 latin1 select,insert,update,references +t4 mediumblob binary select,insert,update,references select * from t2; auto t1 t2 t3 t4 11 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb @@ -251,10 +251,10 @@ create table t3 select * from t1, t2; Duplicate column name 'c' create table t3 select t1.c AS c1, t2.c AS c2,1 as "const" from t1, t2; show full columns from t3; -Field Type Null Key Default Extra Privileges Comment -c1 int(11) YES NULL select,insert,update,references -c2 int(11) YES NULL select,insert,update,references -const bigint(1) 0 select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +c1 int(11) binary YES NULL select,insert,update,references +c2 int(11) binary YES NULL select,insert,update,references +const bigint(1) binary 0 select,insert,update,references drop table t1,t2,t3; create table t1 ( myfield INT NOT NULL, UNIQUE INDEX (myfield), unique (myfield), index(myfield)); drop table t1; diff --git a/sql/field.cc b/sql/field.cc index 5f99171b04a..21330a2ffaa 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -258,7 +258,7 @@ void Field_str::add_binary_or_charset(String &res) const if (binary()) len=cs->snprintf(cs,end,len," binary"); else - len=cs->snprintf(cs,end,len," character set %s",field_charset->name); + len=cs->snprintf(cs,end,len," character set %s",field_charset->csname); res.length(oldlen+len); } } diff --git a/sql/sql_db.cc b/sql/sql_db.cc index d4bd521cca5..f14fe50b200 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -676,9 +676,13 @@ int mysqld_show_create_db(THD *thd, const char *dbname, to=strxmov(to,"`",dbname,"`", NullS); if (create.table_charset) - to= strxmov(to," /*!40100 DEFAULT CHARACTER SET ", - create.table_charset->name,"*/",NullS); - + { + int cl= (create.table_charset->state & MY_CS_PRIMARY) ? 0 : 1; + to= strxmov(to," /*!40100" + " DEFAULT CHARACTER SET ",create.table_charset->csname, + cl ? " COLLATE " : "", cl ? create.table_charset->name : "", + " */",NullS); + } protocol->store(path, (uint) (to-path)); if (protocol->write()) diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index c7595c7ec5c..c7c7a97cdc2 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -558,7 +558,7 @@ int yylex(void *arg, void *yythd) */ if ((yylval->lex_str.str[0]=='_') && - (lex->charset=get_charset_by_name(yylval->lex_str.str+1,MYF(0)))) + (lex->charset=get_charset_by_csname(yylval->lex_str.str+1,MYF(0)))) return(UNDERSCORE_CHARSET); else return(IDENT); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index c66764d673f..b01555effa8 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -676,6 +676,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, List field_list; field_list.push_back(new Item_empty_string("Field",NAME_LEN)); field_list.push_back(new Item_empty_string("Type",40)); + field_list.push_back(new Item_empty_string("Collation",40)); field_list.push_back(new Item_empty_string("Null",1)); field_list.push_back(new Item_empty_string("Key",3)); field_list.push_back(item=new Item_empty_string("Default",NAME_LEN)); @@ -721,6 +722,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, protocol->store(field->field_name); field->sql_type(type); protocol->store(type.ptr(), type.length()); + protocol->store(field->charset()->name); pos=(byte*) ((flags & NOT_NULL_FLAG) && field->type() != FIELD_TYPE_TIMESTAMP ? @@ -1050,6 +1052,16 @@ store_create_info(THD *thd, TABLE *table, String *packet) bool has_default = (field->type() != FIELD_TYPE_BLOB && field->type() != FIELD_TYPE_TIMESTAMP && field->unireg_check != Field::NEXT_NUMBER); + + /* + For string types dump collation name only if + collation is not primary for the given charset + */ + if (!field->binary() && !(field->charset()->state & MY_CS_PRIMARY)) + { + packet->append(" collate ",9); + packet->append(field->charset()->name); + } if (flags & NOT_NULL_FLAG) packet->append(" NOT NULL", 9); @@ -1162,7 +1174,12 @@ store_create_info(THD *thd, TABLE *table, String *packet) if (table->table_charset) { packet->append(" CHARSET="); - packet->append(table->table_charset->name); + packet->append(table->table_charset->csname); + if (!(table->table_charset->state & MY_CS_PRIMARY)) + { + packet->append(" COLLATE="); + packet->append(table->table_charset->name); + } } if (table->min_rows) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 6e32805310f..e83b4da728f 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -633,7 +633,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %type charset_name charset_name_or_default - opt_default_charset + collation_name + collation_name_or_default %type internal_variable_name @@ -857,13 +858,14 @@ create: lex->key_list.push_back(new Key($2,$4.str, $5, lex->col_list)); lex->col_list.empty(); } - | CREATE DATABASE opt_if_not_exists ident opt_default_charset + | CREATE DATABASE opt_if_not_exists ident + { Lex->create_info.table_charset=NULL; } + opt_create_database_options { LEX *lex=Lex; lex->sql_command=SQLCOM_CREATE_DB; lex->name=$4.str; lex->create_info.options=$3; - lex->create_info.table_charset=$5; } | CREATE udf_func_type UDF_SYM ident { @@ -907,6 +909,22 @@ opt_as: /* empty */ {} | AS {}; +opt_create_database_options: + /* empty */ {} + | create_database_options {}; + +create_database_options: + create_database_option {} + | create_database_options create_database_option {}; + +create_database_option: + COLLATE_SYM collation_name_or_default + { Lex->create_info.table_charset=$2; } + | opt_default CHAR_SYM SET charset_name_or_default + { Lex->create_info.table_charset=$4; } + | opt_default CHARSET charset_name_or_default + { Lex->create_info.table_charset=$3; }; + opt_table_options: /* empty */ { $$= 0; } | table_options { $$= $1;}; @@ -974,6 +992,11 @@ create_table_option: Lex->create_info.table_charset= $5; Lex->create_info.used_fields|= HA_CREATE_USED_CHARSET; } + | COLLATE_SYM opt_equal collation_name_or_default + { + Lex->create_info.table_charset= $3; + Lex->create_info.used_fields|= HA_CREATE_USED_CHARSET; + } | INSERT_METHOD opt_equal merge_insert_types { Lex->create_info.merge_insert_method= $3; Lex->create_info.used_fields|= HA_CREATE_USED_INSERT_METHOD;} | DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING { Lex->create_info.data_file_name= $4.str; } | INDEX DIRECTORY_SYM opt_equal TEXT_STRING { Lex->create_info.index_file_name= $4.str; }; @@ -1232,13 +1255,13 @@ attribute: | UNIQUE_SYM { Lex->type|= UNIQUE_FLAG; } | UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_FLAG; } | COMMENT_SYM text_literal { Lex->comment= $2; } - | COLLATE_SYM charset_name { Lex->charset=$2; }; + | COLLATE_SYM collation_name { Lex->charset=$2; }; charset_name: ident { - if (!($$=get_charset_by_name($1.str,MYF(0)))) + if (!($$=get_charset_by_csname($1.str,MYF(0)))) { net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,$1.str); YYABORT; @@ -1249,15 +1272,24 @@ charset_name_or_default: charset_name { $$=$1; } | DEFAULT { $$=NULL; } ; +collation_name: + ident + { + if (!($$=get_charset_by_name($1.str,MYF(0)))) + { + net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,$1.str); + YYABORT; + } + }; + +collation_name_or_default: + collation_name { $$=$1; } + | DEFAULT { $$=NULL; } ; + opt_default: /* empty */ {} | DEFAULT {}; -opt_default_charset: - /* empty */ { $$=default_charset_info; } - | opt_default CHAR_SYM SET charset_name_or_default { $$=$4; } - | opt_default CHARSET charset_name_or_default { $$=$3; }; - opt_binary: /* empty */ { Lex->charset=NULL; } | ASCII_SYM { Lex->charset=my_charset_latin1; } @@ -1400,12 +1432,11 @@ alter: } alter_list {} - | ALTER DATABASE ident opt_default_charset + | ALTER DATABASE ident opt_create_database_options { LEX *lex=Lex; lex->sql_command=SQLCOM_ALTER_DB; lex->name=$3.str; - lex->create_info.table_charset=$4; }; @@ -1892,7 +1923,7 @@ expr_expr: { $$= new Item_date_add_interval($1,$4,$5,0); } | expr '-' INTERVAL_SYM expr interval { $$= new Item_date_add_interval($1,$4,$5,1); } - | expr COLLATE_SYM charset_name + | expr COLLATE_SYM collation_name { $$= new Item_func_set_collation($1,$3); }; /* expressions that begin with 'expr' that do NOT follow IN_SYM */ From 5a5c618ee40249cf4f50ce698bb2ec682acd82ab Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jan 2003 16:38:23 +0400 Subject: [PATCH 200/220] do not call get_charset_by_name() with string "DEFAULT" --- sql/sql_db.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sql/sql_db.cc b/sql/sql_db.cc index f14fe50b200..1c441ea7a26 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -114,10 +114,12 @@ static bool load_db_opt(const char *path, HA_CREATE_INFO *create) { if (!strncmp(buf,"default-character-set", (pos-buf))) { - if (!(create->table_charset=get_charset_by_name(pos+1, MYF(0)))) + if (strcmp(pos+1,"DEFAULT")) { - sql_print_error(ER(ER_UNKNOWN_CHARACTER_SET), - pos+1); + if (!(create->table_charset=get_charset_by_name(pos+1, MYF(0)))) + { + sql_print_error(ER(ER_UNKNOWN_CHARACTER_SET),pos+1); + } } } } From 90bf0f97350714e9dbf0724ab5efb76c598149d0 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jan 2003 17:27:13 +0400 Subject: [PATCH 201/220] koi8u.xml, koi8r.xml: new file --- sql/share/charsets/koi8r.xml | 119 ++++++++++++++++++++++++++++++++++ sql/share/charsets/koi8u.xml | 120 +++++++++++++++++++++++++++++++++++ 2 files changed, 239 insertions(+) create mode 100644 sql/share/charsets/koi8r.xml create mode 100644 sql/share/charsets/koi8u.xml diff --git a/sql/share/charsets/koi8r.xml b/sql/share/charsets/koi8r.xml new file mode 100644 index 00000000000..dae780f14fc --- /dev/null +++ b/sql/share/charsets/koi8r.xml @@ -0,0 +1,119 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 02 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 01 10 10 10 10 10 10 10 10 10 10 10 10 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + 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 B9 BA BB BC BD BE BF + 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 DF + 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 DF + + + + + + + 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 B3 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 + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + + + + + + +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000a 000b 000c 000d 000e 000f +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001a 001b 001c 001d 001e 001f +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002a 002b 002c 002d 002e 002f +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003a 003b 003c 003d 003e 003f +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004a 004b 004c 004d 004e 004f +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005a 005b 005c 005d 005e 005f +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006a 006b 006c 006d 006e 006f +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007a 007b 007c 007d 007e 007f +2500 2502 250c 2510 2514 2518 251c 2524 252c 2534 253c 2580 2584 2588 258c 2590 +2591 2592 2593 2320 25a0 2219 221a 2248 2264 2265 00a0 2321 00b0 00b2 00b7 00f7 +2550 2551 2552 0451 2553 2554 2555 2556 2557 2558 2559 255a 255b 255c 255d 255e +255f 2560 2561 0401 2562 2563 2564 2565 2566 2567 2568 2569 256a 256b 256c 00a9 +044e 0430 0431 0446 0434 0435 0444 0433 0445 0438 0439 043a 043b 043c 043d 043e +043f 044f 0440 0441 0442 0443 0436 0432 044c 044b 0437 0448 044d 0449 0447 044a +042e 0410 0411 0426 0414 0415 0424 0413 0425 0418 0419 041a 041b 041c 041d 041e +041f 042f 0420 0421 0422 0423 0416 0412 042c 042b 0417 0428 042d 0429 0427 042a + + + + + + + 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 E5 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE + AF B0 B1 E5 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD + FE DF E0 F6 E3 E4 F4 E2 F5 E8 E9 EA EB EC ED EE + EF FF F0 F1 F2 F3 E6 E1 FC FB E7 F8 FD F9 F7 FA + FE DF E0 F6 E3 E4 F4 E2 F5 E8 E9 EA EB EC ED EE + EF FF F0 F1 F2 F3 E6 E1 FC FB E7 F8 FD F9 F7 FA + + + + + + diff --git a/sql/share/charsets/koi8u.xml b/sql/share/charsets/koi8u.xml new file mode 100644 index 00000000000..e6cba068997 --- /dev/null +++ b/sql/share/charsets/koi8u.xml @@ -0,0 +1,120 @@ + + + + + + + + + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 02 02 10 02 02 10 10 10 10 10 02 10 10 + 10 10 10 01 01 10 01 01 10 10 10 10 10 01 10 10 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + + + + + + + 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 20 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 A3 A4 20 A6 A7 20 20 20 20 20 AD 20 20 + 20 20 20 A3 A4 20 A6 A7 20 20 20 20 20 AD 20 20 + 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 DF + 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 DF + + + + + + + 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 B3 B4 20 B6 B7 20 20 20 20 20 BD 20 20 + 20 20 20 B3 B4 20 B6 B7 20 20 20 20 20 BD 20 20 + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + + + + + + +0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F +0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F +0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F +0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F +0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F +0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F +0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F +0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F +2500 2502 250C 2510 2514 2518 251C 2524 252C 2534 253C 2580 2584 2588 258C 2590 +2591 2592 2593 2320 25A0 2022 221A 2248 2264 2265 00A0 2321 00B0 00B2 00B7 00F7 +2550 2551 2552 0451 0454 2554 0456 0457 2557 2558 2559 255A 255B 0491 255D 255E +255F 2560 2561 0401 0404 2563 0406 0407 2566 2567 2568 2569 256A 0490 256C 00A9 +044E 0430 0431 0446 0434 0435 0444 0433 0445 0438 0439 043A 043B 043C 043D 043E +043F 044F 0440 0441 0442 0443 0436 0432 044C 044B 0437 0448 044D 0449 0447 044A +042E 0410 0411 0426 0414 0415 0424 0413 0425 0418 0419 041A 041B 041C 041D 041E +041F 042F 0420 0421 0422 0423 0416 0412 042C 042B 0417 0428 042D 0429 0427 042A + + + + + + + 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 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 C0 C1 C2 C3 C4 + C5 C6 C7 88 87 C8 8C 8D C9 CA CB CC CD 84 CE CF + D0 D1 D2 88 87 D3 8C 8D D4 D5 D6 D7 D8 84 D9 DA + A3 80 81 9B 85 86 99 83 9A 8B 8E 8F 90 91 92 93 + 94 A4 95 96 97 98 89 82 A1 A0 8A 9D A2 9E 9C 9F + A3 80 81 9B 85 86 99 83 9A 8B 8E 8F 90 91 92 93 + 94 A4 95 96 97 98 89 82 A1 A0 8A 9D A2 9E 9C 9F + + + + + + + From 49fc3a76e01600e1831afb1b9b83eb938e4a954a Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jan 2003 17:39:02 +0400 Subject: [PATCH 202/220] euc_kr, koi8_r and koi8_u have been renamed so that now all charset names don't have "_" sign. --- mysql-test/r/ctype_many.result | 14 +++++++------- mysql-test/t/ctype_many.test | 4 ++-- sql/share/charsets/Index.xml | 16 ++++++++-------- strings/ctype-euc_kr.c | 4 ++-- strings/ctype.c | 8 ++++---- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/mysql-test/r/ctype_many.result b/mysql-test/r/ctype_many.result index ec6e0b76772..3a9d0ec5da5 100644 --- a/mysql-test/r/ctype_many.result +++ b/mysql-test/r/ctype_many.result @@ -1,27 +1,27 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( comment CHAR(32) ASCII NOT NULL, -koi8_ru_f CHAR(32) CHARACTER SET koi8_r NOT NULL +koi8_ru_f CHAR(32) CHARACTER SET koi8r NOT NULL ) CHARSET=latin5; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) character set latin1 NOT NULL default '', - `koi8_ru_f` char(32) character set koi8_r NOT NULL default '' + `koi8_ru_f` char(32) character set koi8r NOT NULL default '' ) TYPE=MyISAM CHARSET=latin5 ALTER TABLE t1 CHANGE comment comment CHAR(32) CHARACTER SET latin2 NOT NULL; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) character set latin2 NOT NULL default '', - `koi8_ru_f` char(32) character set koi8_r NOT NULL default '' + `koi8_ru_f` char(32) character set koi8r NOT NULL default '' ) TYPE=MyISAM CHARSET=latin5 ALTER TABLE t1 ADD latin5_f CHAR(32) NOT NULL; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) character set latin2 NOT NULL default '', - `koi8_ru_f` char(32) character set koi8_r NOT NULL default '', + `koi8_ru_f` char(32) character set koi8r NOT NULL default '', `latin5_f` char(32) character set latin5 NOT NULL default '' ) TYPE=MyISAM CHARSET=latin5 ALTER TABLE t1 CHARSET=latin2; @@ -30,7 +30,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) character set latin2 NOT NULL default '', - `koi8_ru_f` char(32) character set koi8_r NOT NULL default '', + `koi8_ru_f` char(32) character set koi8r NOT NULL default '', `latin5_f` char(32) character set latin5 NOT NULL default '', `latin2_f` char(32) character set latin2 NOT NULL default '' ) TYPE=MyISAM CHARSET=latin2 @@ -39,7 +39,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) character set latin2 NOT NULL default '', - `koi8_ru_f` char(32) character set koi8_r NOT NULL default '' + `koi8_ru_f` char(32) character set koi8r NOT NULL default '' ) TYPE=MyISAM CHARSET=latin2 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('a','LAT SMALL A'); INSERT INTO t1 (koi8_ru_f,comment) VALUES ('b','LAT SMALL B'); @@ -1061,7 +1061,7 @@ CYR SMALL YA CYR CAPIT YA CYR SMALL YA CYR SMALL YA SELECT t11.comment,t12.comment FROM t1 t11,t1 t12 -WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8_r) +WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8r) ORDER BY t12.utf8_f,t11.comment,t12.comment; comment comment LAT CAPIT A LAT CAPIT A diff --git a/mysql-test/t/ctype_many.test b/mysql-test/t/ctype_many.test index a807185ce44..5530eee0dbe 100644 --- a/mysql-test/t/ctype_many.test +++ b/mysql-test/t/ctype_many.test @@ -4,7 +4,7 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( comment CHAR(32) ASCII NOT NULL, - koi8_ru_f CHAR(32) CHARACTER SET koi8_r NOT NULL + koi8_ru_f CHAR(32) CHARACTER SET koi8r NOT NULL ) CHARSET=latin5; SHOW CREATE TABLE t1; @@ -158,7 +158,7 @@ ORDER BY t11.koi8_ru_f,t11.comment,t12.comment; SELECT t11.comment,t12.comment FROM t1 t11,t1 t12 -WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8_r) +WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8r) ORDER BY t12.utf8_f,t11.comment,t12.comment; ALTER TABLE t1 ADD ucs2_f CHAR(32) CHARACTER SET ucs2; diff --git a/sql/share/charsets/Index.xml b/sql/share/charsets/Index.xml index 4e3baf3e875..e6cea7bc615 100644 --- a/sql/share/charsets/Index.xml +++ b/sql/share/charsets/Index.xml @@ -124,11 +124,11 @@ To make maintaining easier please: - + Cyrillic - koi8-ru + koi8-r cskoi8r - + @@ -211,11 +211,11 @@ To make maintaining easier please: - + Korean - euckr + euc_kr euc-kr - + @@ -228,10 +228,10 @@ To make maintaining easier please: - + Cyrillic koi8-u - + diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index 5a93881a77f..814f43166c4 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -8637,8 +8637,8 @@ CHARSET_INFO my_charset_euc_kr = { 19, /* number */ MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ - "euc_kr", /* cs name */ - "euc_kr", /* name */ + "euckr", /* cs name */ + "euckr", /* name */ "", /* comment */ ctype_euc_kr, to_lower_euc_kr, diff --git a/strings/ctype.c b/strings/ctype.c index f1bce6671cf..61fb57d9ac3 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -3399,8 +3399,8 @@ static CHARSET_INFO compiled_charsets[] = { { 7, /* number */ MY_CS_COMPILED, /* state */ - "koi8_r", /* cs name */ - "koi8_r", /* name */ + "koi8r", /* cs name */ + "koi8r", /* name */ "", /* comment */ ctype_koi8_ru, to_lower_koi8_ru, @@ -3444,8 +3444,8 @@ static CHARSET_INFO compiled_charsets[] = { { 22, /* number */ MY_CS_COMPILED, /* state */ - "koi8_u", /* cs name */ - "koi8_u", /* name */ + "koi8u", /* cs name */ + "koi8u", /* name */ "", /* comment */ ctype_koi8_ukr, to_lower_koi8_ukr, From ac2aea8c4a36175e844bbc884dfd5d38167cf181 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jan 2003 17:41:25 +0400 Subject: [PATCH 203/220] .del-koi8_u.xml~ec104975f7e009bf: Delete: sql/share/charsets/koi8_u.xml .del-koi8_r.xml~f95ebf1fb19f94cf: Delete: sql/share/charsets/koi8_r.xml BitKeeper/deleted/.del-koi8_r.xml~f95ebf1fb19f94cf: Delete: sql/share/charsets/koi8_r.xml BitKeeper/deleted/.del-koi8_u.xml~ec104975f7e009bf: Delete: sql/share/charsets/koi8_u.xml --- sql/share/charsets/koi8_r.xml | 119 --------------------------------- sql/share/charsets/koi8_u.xml | 120 ---------------------------------- 2 files changed, 239 deletions(-) delete mode 100644 sql/share/charsets/koi8_r.xml delete mode 100644 sql/share/charsets/koi8_u.xml diff --git a/sql/share/charsets/koi8_r.xml b/sql/share/charsets/koi8_r.xml deleted file mode 100644 index aa155e4cf69..00000000000 --- a/sql/share/charsets/koi8_r.xml +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 02 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 01 10 10 10 10 10 10 10 10 10 10 10 10 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - - - - - - - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - 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 B9 BA BB BC BD BE BF - 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 DF - 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 DF - - - - - - - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 B3 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 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - - - - - - -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000a 000b 000c 000d 000e 000f -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001a 001b 001c 001d 001e 001f -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002a 002b 002c 002d 002e 002f -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003a 003b 003c 003d 003e 003f -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004a 004b 004c 004d 004e 004f -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005a 005b 005c 005d 005e 005f -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006a 006b 006c 006d 006e 006f -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007a 007b 007c 007d 007e 007f -2500 2502 250c 2510 2514 2518 251c 2524 252c 2534 253c 2580 2584 2588 258c 2590 -2591 2592 2593 2320 25a0 2219 221a 2248 2264 2265 00a0 2321 00b0 00b2 00b7 00f7 -2550 2551 2552 0451 2553 2554 2555 2556 2557 2558 2559 255a 255b 255c 255d 255e -255f 2560 2561 0401 2562 2563 2564 2565 2566 2567 2568 2569 256a 256b 256c 00a9 -044e 0430 0431 0446 0434 0435 0444 0433 0445 0438 0439 043a 043b 043c 043d 043e -043f 044f 0440 0441 0442 0443 0436 0432 044c 044b 0437 0448 044d 0449 0447 044a -042e 0410 0411 0426 0414 0415 0424 0413 0425 0418 0419 041a 041b 041c 041d 041e -041f 042f 0420 0421 0422 0423 0416 0412 042c 042b 0417 0428 042d 0429 0427 042a - - - - - - - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F - 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F - A0 A1 A2 E5 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE - AF B0 B1 E5 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD - FE DF E0 F6 E3 E4 F4 E2 F5 E8 E9 EA EB EC ED EE - EF FF F0 F1 F2 F3 E6 E1 FC FB E7 F8 FD F9 F7 FA - FE DF E0 F6 E3 E4 F4 E2 F5 E8 E9 EA EB EC ED EE - EF FF F0 F1 F2 F3 E6 E1 FC FB E7 F8 FD F9 F7 FA - - - - - - diff --git a/sql/share/charsets/koi8_u.xml b/sql/share/charsets/koi8_u.xml deleted file mode 100644 index 6281a2a14fb..00000000000 --- a/sql/share/charsets/koi8_u.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - 00 - 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 - 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 - 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 - 10 10 10 02 02 10 02 02 10 10 10 10 10 02 10 10 - 10 10 10 01 01 10 01 01 10 10 10 10 10 01 10 10 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 - - - - - - - 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 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F - 20 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F - 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 A3 A4 20 A6 A7 20 20 20 20 20 AD 20 20 - 20 20 20 A3 A4 20 A6 A7 20 20 20 20 20 AD 20 20 - 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 DF - 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 DF - - - - - - - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - 20 20 20 B3 B4 20 B6 B7 20 20 20 20 20 BD 20 20 - 20 20 20 B3 B4 20 B6 B7 20 20 20 20 20 BD 20 20 - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF - F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - - - - - - -0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F -0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F -0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F -0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F -0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F -0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F -0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F -0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F -2500 2502 250C 2510 2514 2518 251C 2524 252C 2534 253C 2580 2584 2588 258C 2590 -2591 2592 2593 2320 25A0 2022 221A 2248 2264 2265 00A0 2321 00B0 00B2 00B7 00F7 -2550 2551 2552 0451 0454 2554 0456 0457 2557 2558 2559 255A 255B 0491 255D 255E -255F 2560 2561 0401 0404 2563 0406 0407 2566 2567 2568 2569 256A 0490 256C 00A9 -044E 0430 0431 0446 0434 0435 0444 0433 0445 0438 0439 043A 043B 043C 043D 043E -043F 044F 0440 0441 0442 0443 0436 0432 044C 044B 0437 0448 044D 0449 0447 044A -042E 0410 0411 0426 0414 0415 0424 0413 0425 0418 0419 041A 041B 041C 041D 041E -041F 042F 0420 0421 0422 0423 0416 0412 042C 042B 0417 0428 042D 0429 0427 042A - - - - - - - 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 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F - 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F - 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F - 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 C0 C1 C2 C3 C4 - C5 C6 C7 88 87 C8 8C 8D C9 CA CB CC CD 84 CE CF - D0 D1 D2 88 87 D3 8C 8D D4 D5 D6 D7 D8 84 D9 DA - A3 80 81 9B 85 86 99 83 9A 8B 8E 8F 90 91 92 93 - 94 A4 95 96 97 98 89 82 A1 A0 8A 9D A2 9E 9C 9F - A3 80 81 9B 85 86 99 83 9A 8B 8E 8F 90 91 92 93 - 94 A4 95 96 97 98 89 82 A1 A0 8A 9D A2 9E 9C 9F - - - - - - - From f7ff1cca148b8cb0742f3d23c0e05e797c673dc0 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jan 2003 22:42:31 +0200 Subject: [PATCH 204/220] Post merge fix Allow empty key list in USE|IGNORE|FORCE INDEX() mysql-test/r/myisam.result: New explain format mysql-test/t/myisam.test: test of index() mysys/my_handler.c: Updated ha_key_cmp() to be as latest _mi_key_cmp() in 4.0 sql/sql_lex.cc: Post merge fix sql/sql_lex.h: Post merge fix sql/sql_parse.cc: Post merge fix sql/sql_yacc.yy: Post merge fix for FORCE INDEX () Allow empty key list in USE|IGNORE|FORCE INDEX() --- mysql-test/r/myisam.result | 44 ++++++++++--------- mysql-test/t/myisam.test | 2 + mysys/my_handler.c | 87 ++++++++++++++++++++++---------------- sql/sql_lex.cc | 8 +++- sql/sql_lex.h | 4 +- sql/sql_parse.cc | 28 ++++++++++-- sql/sql_yacc.yy | 23 +++++++--- 7 files changed, 129 insertions(+), 67 deletions(-) diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 3d4b1dbd46d..23610be36c4 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -332,29 +332,35 @@ t1 1 a 2 b A 5 NULL NULL YES BTREE t1 1 c_2 1 c A 5 NULL NULL YES BTREE t1 1 c_2 2 a A 5 NULL NULL BTREE explain select * from t1,t2 where t1.a=t2.a; -table type possible_keys key key_len ref rows Extra -t1 ALL a NULL NULL NULL 5 -t2 ALL a NULL NULL NULL 2 Using where +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a NULL NULL NULL 5 +1 SIMPLE t2 ALL a NULL NULL NULL 2 Using where explain select * from t1,t2 force index(a) where t1.a=t2.a; -table type possible_keys key key_len ref rows Extra -t2 ALL a NULL NULL NULL 2 -t1 ALL a NULL NULL NULL 5 Using where +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL a NULL NULL NULL 2 +1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where explain select * from t1 force index(a),t2 force index(a) where t1.a=t2.a; -table type possible_keys key key_len ref rows Extra -t2 ALL a NULL NULL NULL 2 -t1 ref a a 4 t2.a 3 +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL a NULL NULL NULL 2 +1 SIMPLE t1 ref a a 4 t2.a 3 explain select * from t1,t2 where t1.b=t2.b; -table type possible_keys key key_len ref rows Extra -t2 ALL b NULL NULL NULL 2 -t1 ref b b 5 t2.b 1 Using where +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL b NULL NULL NULL 2 +1 SIMPLE t1 ref b b 5 t2.b 1 Using where explain select * from t1,t2 force index(c) where t1.a=t2.a; -table type possible_keys key key_len ref rows Extra -t1 ALL a NULL NULL NULL 5 -t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a NULL NULL NULL 5 +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where explain select * from t1 where a=0 or a=2; -table type possible_keys key key_len ref rows Extra -t1 ALL a NULL NULL NULL 5 Using where +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where explain select * from t1 force index (a) where a=0 or a=2; -table type possible_keys key key_len ref rows Extra -t1 range a a 4 NULL 4 Using where +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 4 NULL 4 Using where +explain select * from t1 where c=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref c,c_2 c 5 const 1 Using where +explain select * from t1 use index() where c=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where drop table t1,t2; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 7b541d98cef..ed08b1cbacb 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -349,4 +349,6 @@ explain select * from t1,t2 where t1.b=t2.b; explain select * from t1,t2 force index(c) where t1.a=t2.a; explain select * from t1 where a=0 or a=2; explain select * from t1 force index (a) where a=0 or a=2; +explain select * from t1 where c=1; +explain select * from t1 use index() where c=1; drop table t1,t2; diff --git a/mysys/my_handler.c b/mysys/my_handler.c index 2d51ab13f69..2fd7f1fcdee 100644 --- a/mysys/my_handler.c +++ b/mysys/my_handler.c @@ -40,15 +40,33 @@ static int compare_bin(uchar *a, uint a_length, uchar *b, uint b_length, return (int) (a_length-b_length); } -#define FCMP(A,B) ((int) (A) - (int) (B)) /* Compare two keys - Returns <0, 0, >0 acording to which is bigger - Key_length specifies length of key to use. Number-keys can't be splited - If flag <> SEARCH_FIND compare also position + + SYNOPSIS + ha_key_cmp() + keyseg Key segments of key to compare + a First key to compare, in format from _mi_pack_key() + This is normally key specified by user + b Second key to compare. This is always from a row + key_length Length of key to compare. This can be shorter than + a to just compare sub keys + next_flag How keys should be compared + If bit SEARCH_FIND is not set the keys includes the row + position and this should also be compared + + NOTES + Number-keys can't be splited + + RETURN VALUES + <0 If a < b + 0 If a == b + >0 If a > b */ +#define FCMP(A,B) ((int) (A) - (int) (B)) + int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, register uchar *b, uint key_length, uint nextflag, uint *diff_pos) @@ -59,9 +77,10 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, uint32 u_1,u_2; float f_1,f_2; double d_1,d_2; + uint next_key_length; *diff_pos=0; - for ( ; (int) key_length >0 ; keyseg++) + for ( ; (int) key_length >0 ; key_length=next_key_length, keyseg++) { uchar *end; uint piks=! (keyseg->flag & HA_NO_SORT); @@ -81,10 +100,21 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, { if (nextflag == (SEARCH_FIND | SEARCH_UPDATE)) nextflag=SEARCH_SAME; /* Allow duplicate keys */ + else if (nextflag & SEARCH_NULL_ARE_NOT_EQUAL) + { + /* + This is only used from mi_check() to calculate cardinality. + It can't be used when searching for a key as this would cause + compare of (a,b) and (b,a) to return the same value. + */ + return -1; + } + next_key_length=key_length; continue; /* To next key part */ } } end= a+ min(keyseg->length,key_length); + next_key_length=key_length-keyseg->length; switch ((enum ha_base_keytype) keyseg->type) { case HA_KEYTYPE_TEXT: /* Ascii; Key is converted */ @@ -93,12 +123,12 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, int a_length,b_length,pack_length; get_key_length(a_length,a); get_key_pack_length(b_length,pack_length,b); - key_length-= b_length + pack_length; + next_key_length=key_length-b_length-pack_length; if (piks && - (flag= mi_compare_text(keyseg->charset,a,a_length,b,b_length, - (my_bool) ((nextflag & SEARCH_PREFIX) && - key_length <= 0)))) + (flag=mi_compare_text(keyseg->charset,a,a_length,b,b_length, + (my_bool) ((nextflag & SEARCH_PREFIX) && + next_key_length <= 0)))) return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a+=a_length; b+=b_length; @@ -107,7 +137,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, else { uint length=(uint) (end-a), a_length=length, b_length=length; - key_length-= keyseg->length; if (!(nextflag & SEARCH_PREFIX)) { while (a_length && a[a_length-1] == ' ') @@ -116,9 +145,9 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, b_length--; } if (piks && - (flag= mi_compare_text(keyseg->charset,a,a_length,b,b_length, - (my_bool) ((nextflag & SEARCH_PREFIX) && - key_length <= 0)))) + (flag= mi_compare_text(keyseg->charset, a, a_length, b, b_length, + (my_bool) ((nextflag & SEARCH_PREFIX) && + next_key_length <= 0)))) return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a=end; b+=length; @@ -130,12 +159,12 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, int a_length,b_length,pack_length; get_key_length(a_length,a); get_key_pack_length(b_length,pack_length,b); - key_length-= b_length + pack_length; + next_key_length=key_length-b_length-pack_length; if (piks && (flag=compare_bin(a,a_length,b,b_length, (my_bool) ((nextflag & SEARCH_PREFIX) && - key_length <= 0)))) + next_key_length <= 0)))) return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a+=a_length; b+=b_length; @@ -144,11 +173,10 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, else { uint length=keyseg->length; - key_length-= keyseg->length; if (piks && (flag=compare_bin(a,length,b,length, (my_bool) ((nextflag & SEARCH_PREFIX) && - key_length <= 0)))) + next_key_length <= 0)))) return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a+=length; b+=length; @@ -159,12 +187,12 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, int a_length,b_length,pack_length; get_key_length(a_length,a); get_key_pack_length(b_length,pack_length,b); - key_length-= b_length + pack_length; + next_key_length=key_length-b_length-pack_length; if (piks && (flag= mi_compare_text(keyseg->charset,a,a_length,b,b_length, (my_bool) ((nextflag & SEARCH_PREFIX) && - key_length <= 0)))) + next_key_length <= 0)))) return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a+=a_length; b+=b_length; @@ -176,12 +204,12 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, int a_length,b_length,pack_length; get_key_length(a_length,a); get_key_pack_length(b_length,pack_length,b); - key_length-= b_length + pack_length; + next_key_length=key_length-b_length-pack_length; if (piks && (flag=compare_bin(a,a_length,b,b_length, (my_bool) ((nextflag & SEARCH_PREFIX) && - key_length <= 0)))) + next_key_length <= 0)))) return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a+=a_length; b+=b_length; @@ -196,7 +224,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b++; - key_length-= keyseg->length; break; } case HA_KEYTYPE_SHORT_INT: @@ -206,7 +233,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b+= 2; /* sizeof(short int); */ - key_length-= keyseg->length; break; case HA_KEYTYPE_USHORT_INT: { @@ -217,7 +243,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b+=2; /* sizeof(short int); */ - key_length-= keyseg->length; break; } case HA_KEYTYPE_LONG_INT: @@ -227,7 +252,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b+= 4; /* sizeof(long int); */ - key_length-= keyseg->length; break; case HA_KEYTYPE_ULONG_INT: u_1= mi_sint4korr(a); @@ -236,7 +260,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b+= 4; /* sizeof(long int); */ - key_length-= keyseg->length; break; case HA_KEYTYPE_INT24: l_1=mi_sint3korr(a); @@ -245,7 +268,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b+= 3; - key_length-= keyseg->length; break; case HA_KEYTYPE_UINT24: l_1=mi_uint3korr(a); @@ -254,7 +276,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b+= 3; - key_length-= keyseg->length; break; case HA_KEYTYPE_FLOAT: mi_float4get(f_1,a); @@ -263,7 +284,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b+= 4; /* sizeof(float); */ - key_length-= keyseg->length; break; case HA_KEYTYPE_DOUBLE: mi_float8get(d_1,a); @@ -272,13 +292,12 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b+= 8; /* sizeof(double); */ - key_length-= keyseg->length; break; case HA_KEYTYPE_NUM: /* Numeric key */ { int swap_flag= 0; int alength,blength; - + if (keyseg->flag & HA_REVERSE_SORT) { swap(uchar*,a,b); @@ -289,7 +308,7 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, { alength= *a++; blength= *b++; end=a+alength; - key_length-= blength + 1; + next_key_length=key_length-blength-1; } else { @@ -298,9 +317,7 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, /* remove pre space from keys */ for ( ; alength && *a == ' ' ; a++, alength--) ; for ( ; blength && *b == ' ' ; b++, blength--) ; - key_length-= keyseg->length; } - if (piks) { if (*a == '-') @@ -350,7 +367,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b+= 8; - key_length-= keyseg->length; break; } case HA_KEYTYPE_ULONGLONG: @@ -362,7 +378,6 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a= end; b+= 8; - key_length-= keyseg->length; break; } #endif diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index c7595c7ec5c..d22d5b8e0af 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1171,13 +1171,14 @@ List* st_select_lex_node::get_use_index() { return 0; } List* st_select_lex_node::get_ignore_index() { return 0; } TABLE_LIST *st_select_lex_node::add_table_to_list(THD *thd, Table_ident *table, LEX_STRING *alias, - bool updating, + ulong table_join_options, thr_lock_type flags, List *use_index, List *ignore_index) { return 0; } +ulong st_select_lex_node::get_table_join_options() { return 0; } /* This is used for UNION & subselect to create a new table list of all used @@ -1334,6 +1335,11 @@ List* st_select_lex::get_ignore_index() return ignore_index_ptr; } +ulong st_select_lex::get_table_join_options() +{ + return table_join_options; +} + /* There are st_select_lex::add_table_to_list & st_select_lex::set_lock_for_tables in sql_parse.cc diff --git a/sql/sql_lex.h b/sql/sql_lex.h index b32e4489b01..4b6ac927f07 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -243,7 +243,7 @@ public: virtual List* get_item_list(); virtual List* get_use_index(); virtual List* get_ignore_index(); - virtual ulong table_join_options(); + virtual ulong get_table_join_options(); virtual TABLE_LIST *add_table_to_list(THD *thd, Table_ident *table, LEX_STRING *alias, ulong table_options, @@ -375,7 +375,7 @@ public: List* get_item_list(); List* get_use_index(); List* get_ignore_index(); - ulong table_join_options(); + ulong get_table_join_options(); TABLE_LIST* add_table_to_list(THD *thd, Table_ident *table, LEX_STRING *alias, ulong table_options, diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ce8bd41d3a6..81fb5a6d12c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3598,11 +3598,30 @@ bool add_to_list(THD *thd, SQL_LIST &list,Item *item,bool asc) } +/* + Add a table to list of used tables + + SYNOPSIS + add_table_to_list() + table Table to add + alias alias for table (or null if no alias) + table_options A set of the following bits: + TL_OPTION_UPDATING Table will be updated + TL_OPTION_FORCE_INDEX Force usage of index + lock_type How table should be locked + use_index List of indexed used in USE INDEX + ignore_index List of indexed used in IGNORE INDEX + + RETURN + 0 Error + # Pointer to TABLE_LIST element added to the total table list +*/ + TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, Table_ident *table, LEX_STRING *alias, - bool updating, - thr_lock_type flags, + ulong table_options, + thr_lock_type lock_type, List *use_index, List *ignore_index) { @@ -3659,8 +3678,9 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, } ptr->real_name=table->table.str; ptr->real_name_length=table->table.length; - ptr->lock_type=flags; - ptr->updating=updating; + ptr->lock_type= lock_type; + ptr->updating= test(table_options & TL_OPTION_UPDATING); + ptr->force_index= test(table_options & TL_OPTION_FORCE_INDEX); ptr->derived= (SELECT_LEX_UNIT *) table->sel; if (use_index) ptr->use_index=(List *) thd->memdup((gptr) use_index, diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 106fa61e535..79cadff3cc1 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1359,7 +1359,7 @@ opt_unique_or_fulltext: key_alg: /* empty */ { $$= HA_KEY_ALG_UNDEF; } | USING opt_btree_or_rtree { $$= $2; }; - | TYPE opt_btree_or_rtree { $$= $2; }; + | TYPE_SYM opt_btree_or_rtree { $$= $2; }; opt_btree_or_rtree: BTREE_SYM { $$= HA_KEY_ALG_BTREE; } @@ -2516,14 +2516,14 @@ join_table: { SELECT_LEX *sel= Select->select_lex(); sel->use_index_ptr=sel->ignore_index_ptr=0; - sel->table_join_ptions= 0; + sel->table_join_options= 0; } table_ident opt_table_alias opt_key_definition { LEX *lex= Lex; SELECT_LEX_NODE *sel= lex->current_select; if (!($$= sel->add_table_to_list(lex->thd, $2, $3, - lex->table_join_options(), + sel->get_table_join_options(), lex->lock_option, sel->get_use_index(), sel->get_ignore_index()))) @@ -2569,6 +2569,13 @@ opt_key_definition: sel->use_index= *$2; sel->use_index_ptr= &sel->use_index; } + | FORCE_SYM key_usage_list + { + SELECT_LEX *sel= Select->select_lex(); + sel->use_index= *$2; + sel->use_index_ptr= &sel->use_index; + sel->table_join_options|= TL_OPTION_FORCE_INDEX; + } | IGNORE_SYM key_usage_list { SELECT_LEX *sel= Select->select_lex(); @@ -2578,8 +2585,14 @@ opt_key_definition: key_usage_list: key_or_index { Select->select_lex()->interval_list.empty(); } - '(' key_usage_list2 ')' - { $$= &Select->select_lex()->interval_list; }; + '(' key_list_or_empty ')' + { $$= &Select->select_lex()->interval_list; } + ; + +key_list_or_empty: + /* empty */ {} + | key_usage_list2 {} + ; key_usage_list2: key_usage_list2 ',' ident From 6a2fbae6770fdd2ed31583df6d91d401b2123ed7 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jan 2003 17:56:34 -0800 Subject: [PATCH 205/220] Remove/change unwanted variables in client protocol Add missed mysql_stmt_affected_rows() sql_yacc.yy : Fix the compilation error .. bison 1.75 sql/sql_yacc.yy: Fix the compilarion error .. bison 1.75 --- include/mysql.h | 14 +++++++------- libmysql/libmysql.c | 30 ++++++++++++++++++++++-------- sql/sql_prepare.cc | 5 ++++- sql/sql_yacc.yy | 2 +- 4 files changed, 34 insertions(+), 17 deletions(-) diff --git a/include/mysql.h b/include/mysql.h index d9da2bde73c..ce321f5b5ea 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -501,16 +501,16 @@ int STDCALL mysql_multi_query(MYSQL *mysql,const char *query, unsigned long len); MYSQL_RES *STDCALL mysql_next_result(MYSQL *mysql); MYSQL_RES *STDCALL mysql_prepare_result(MYSQL_STMT *stmt); +my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt); /* new status messages */ -#define MYSQL_SUCCESS 0 -#define MYSQL_WARNING 1 -#define MYSQL_STATUS_ERROR 2 -#define MYSQL_NO_DATA 100 -#define MYSQL_NEED_DATA 99 -#define MYSQL_NULL_DATA (-1) -#define MYSQL_LONG_DATA (-2) +#define MYSQL_SUCCESS 0 +#define MYSQL_STATUS_ERROR 1 +#define MYSQL_NO_DATA 100 +#define MYSQL_NEED_DATA 99 +#define MYSQL_NULL_DATA (-1) +#define MYSQL_LONG_DATA (-2) #define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 4425d41f85f..7757050aad7 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -4097,7 +4097,8 @@ static my_bool store_param(MYSQL_STMT *stmt, MYSQL_BIND *param) DBUG_PRINT("enter",("type: %d, buffer:%lx, length: %d", param->buffer_type, param->buffer ? param->buffer : "0", *param->length)); - if (param->is_null || *param->length == MYSQL_NULL_DATA) + if (param->buffer_type == MYSQL_TYPE_NULL || + *param->length == MYSQL_NULL_DATA) store_param_null(net, param); else { @@ -4189,7 +4190,7 @@ int STDCALL mysql_execute(MYSQL_STMT *stmt) for (param= stmt->params; param < param_end; param++) { /* Check for long data which has not been propery given/terminated */ - if (param->is_long_data || *param->length == MYSQL_LONG_DATA) + if (*param->length == MYSQL_LONG_DATA) { if (!param->long_ended) DBUG_RETURN(MYSQL_NEED_DATA); @@ -4224,6 +4225,14 @@ ulong STDCALL mysql_param_count(MYSQL_STMT * stmt) DBUG_RETURN(stmt->param_count); } +/* + Return total affected rows from the last statement +*/ + +my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt) +{ + return stmt->mysql->last_used_con->affected_rows; +} /* Setup the parameter data buffers from application @@ -4257,7 +4266,7 @@ my_bool STDCALL mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind) param++) { param->param_number= count++; - if (param->is_long_data && + if (param->length && *param->length == MYSQL_LONG_DATA && (param->buffer_type < MYSQL_TYPE_TINY_BLOB || param->buffer_type > MYSQL_TYPE_STRING)) { @@ -4280,7 +4289,7 @@ my_bool STDCALL mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind) /* Setup data copy functions for the different supported types */ switch (param->buffer_type) { case MYSQL_TYPE_NULL: - param->is_null= 1; + param->bind_length= MYSQL_NULL_DATA; break; case MYSQL_TYPE_TINY: param->bind_length= 1; @@ -4688,7 +4697,7 @@ static my_bool fetch_results(MYSQL_STMT *stmt, MYSQL_BIND *param, */ sprintf(stmt->last_error, ER(stmt->last_errno= CR_UNSUPPORTED_PARAM_TYPE), - param->buffer_type, param->param_number); + param->buffer_type, param->param_number); return 1; } arg_length= 0; @@ -4788,6 +4797,11 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind) DBUG_ASSERT(stmt != 0); #ifdef CHECK_EXTRA_ARGUMENTS + if (stmt->state == MY_ST_UNKNOWN) + { + set_stmt_error(stmt, CR_NO_PREPARE_STMT); + DBUG_RETURN(1); + } if (!bind) { set_stmt_error(stmt, CR_NULL_POINTER); @@ -4914,9 +4928,9 @@ int STDCALL mysql_fetch(MYSQL_STMT *stmt) mysql->status= MYSQL_STATUS_READY; if (res < 0) /* Network error */ { - set_stmt_errmsg(stmt,(char *)mysql->net.last_error, - mysql->net.last_errno); - DBUG_RETURN(MYSQL_STATUS_ERROR); + set_stmt_errmsg(stmt,(char *)mysql->net.last_error, + mysql->net.last_errno); + DBUG_RETURN(1); } DBUG_PRINT("info", ("end of data")); DBUG_RETURN(MYSQL_NO_DATA); /* no more data */ diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 93004ce2937..092f7c7a497 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -321,9 +321,12 @@ static bool setup_params_data(PREP_STMT *stmt) if (!param->long_data_supplied) { if (IS_PARAM_NULL(pos,param_no)) - param->maybe_null=param->null_value=1; + param->maybe_null= param->null_value= 1; else + { + param->maybe_null= param->null_value= 0; param->setup_param_func(param,&read_pos); + } } param_no++; } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 8fa17f0d5ed..0985859caae 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1382,7 +1382,7 @@ opt_unique_or_fulltext: key_alg: /* empty */ { $$= HA_KEY_ALG_UNDEF; } - | USING opt_btree_or_rtree { $$= $2; }; + | USING opt_btree_or_rtree { $$= $2; } | TYPE_SYM opt_btree_or_rtree { $$= $2; }; opt_btree_or_rtree: From 408c41e9749e6af677cceb901e9ebd3449b80a52 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jan 2003 18:32:08 -0800 Subject: [PATCH 206/220] Added prepared statements sample from manual as a test --- tests/client_test.c | 202 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 177 insertions(+), 25 deletions(-) diff --git a/tests/client_test.c b/tests/client_test.c index b31268376ef..6f7473cf4b5 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -2,7 +2,7 @@ client_test.c - description ------------------------- begin : Sun Feb 3 2002 - copyright : (C) MySQL AB 1995-2002, www.mysql.com + copyright : (C) MySQL AB 1995-2003, www.mysql.com author : venu ( venu@mysql.com ) ***************************************************************************/ @@ -364,7 +364,7 @@ uint my_process_stmt_result(MYSQL_STMT *stmt) return 0; } - field_count= stmt->field_count; + field_count= mysql_num_fields(result); for(i=0; i < field_count; i++) { buffer[i].buffer_type= MYSQL_TYPE_STRING; @@ -390,6 +390,8 @@ uint my_process_stmt_result(MYSQL_STMT *stmt) field = mysql_fetch_field(result); if(length[i] == MYSQL_NULL_DATA) fprintf(stdout, " %-*s |", (int) field->max_length, "NULL"); + else if (length[i] == 0) + data[i][0]='\0'; /* unmodified buffer */ else if (IS_NUM(field->type)) fprintf(stdout, " %*s |", (int) field->max_length, data[i]); else @@ -1591,6 +1593,7 @@ static void test_long_data() MYSQL_STMT *stmt; int rc, int_data; char *data=NullS; + long length; MYSQL_RES *result; MYSQL_BIND bind[3]; @@ -1626,10 +1629,11 @@ static void test_long_data() bind[0].buffer=(char *)&int_data; bind[0].buffer_type=FIELD_TYPE_LONG; - bind[1].is_long_data=1; /* specify long data suppy during run-time */ /* Non string or binary type, error */ bind[1].buffer_type=FIELD_TYPE_LONG; + bind[1].length=&length; + length= MYSQL_LONG_DATA; /* specify long data suppy during run-time */ rc = mysql_bind_param(stmt,bind); fprintf(stdout," mysql_bind_param() returned: %d\n",rc); mystmt_r(stmt, rc); @@ -1699,7 +1703,7 @@ static void test_long_data_str() MYSQL_STMT *stmt; int rc, i; char data[255]; - long length; + long length, length1; MYSQL_RES *result; MYSQL_BIND bind[2]; @@ -1732,8 +1736,9 @@ static void test_long_data_str() bind[0].buffer_type = FIELD_TYPE_LONG; bind[1].buffer=data; /* string data */ - bind[1].is_long_data=1; /* specify long data suppy during run-time */ bind[1].buffer_type=FIELD_TYPE_STRING; + bind[1].length= &length1; + length1= MYSQL_LONG_DATA; rc = mysql_bind_param(stmt,bind); mystmt(stmt, rc); @@ -1798,9 +1803,9 @@ static void test_long_data_str() static void test_long_data_str1() { MYSQL_STMT *stmt; - int rc; + int rc, i; char data[255]; - int length, i; + long length, length1; MYSQL_RES *result; MYSQL_BIND bind[2]; @@ -1830,8 +1835,9 @@ static void test_long_data_str1() verify_param_count(stmt,2); bind[0].buffer=data; /* string data */ - bind[0].is_long_data=1; /* specify long data suppy during run-time */ + bind[0].length= &length1; bind[0].buffer_type=FIELD_TYPE_STRING; + length1= MYSQL_LONG_DATA; bind[1] = bind[0]; bind[1].buffer_type=FIELD_TYPE_BLOB; @@ -1894,7 +1900,7 @@ static void test_long_data_str1() myassert(1 == my_process_result_set(result)); mysql_free_result(result); - sprintf(data,"%d",i*length); + sprintf(data,"%ld",(long)i*length); verify_col_data("test_long_data_str","length(longstr)",data); sprintf(data,"%d",i*2); @@ -1910,7 +1916,7 @@ static void test_long_data_bin() MYSQL_STMT *stmt; int rc; char data[255]; - int length; + long length, length1; MYSQL_RES *result; MYSQL_BIND bind[2]; @@ -1943,8 +1949,9 @@ static void test_long_data_bin() bind[0].buffer_type = FIELD_TYPE_LONG; bind[1].buffer=data; /* string data */ - bind[1].is_long_data=1; /* specify long data suppy during run-time */ bind[1].buffer_type=FIELD_TYPE_LONG_BLOB; + bind[1].length= &length1; + length1= MYSQL_LONG_DATA; rc = mysql_bind_param(stmt,bind); mystmt(stmt, rc); @@ -4442,6 +4449,155 @@ static void test_multi_stmt() { } +/******************************************************** +* to test simple sample - manual * +*********************************************************/ +static void test_manual_sample() +{ + unsigned int param_count; + MYSQL_BIND bind[3]; + MYSQL_STMT *stmt; + short small_data; + int int_data; + char str_data[50], query[255]; + long length; + ulonglong affected_rows; + + myheader("test_manual_sample"); + + /* + Sample which is incorporated directly in the manual under Prepared + statements section (Example from mysql_execute() + */ + + mysql_autocommit(mysql, 1); + if (mysql_query(mysql,"DROP TABLE IF EXISTS test_table")) + { + fprintf(stderr, "\n drop table failed"); + fprintf(stderr, "\n %s", mysql_error(mysql)); + exit(0); + } + if (mysql_query(mysql,"CREATE TABLE test_table(col1 int, col2 varchar(50), \ + col3 smallint,\ + col4 timestamp(14))")) + { + fprintf(stderr, "\n create table failed"); + fprintf(stderr, "\n %s", mysql_error(mysql)); + exit(0); + } + + /* Prepare a insert query with 3 parameters */ + strcpy(query, "INSERT INTO test_table(col1,col2,col3) values(?,?,?)"); + if(!(stmt = mysql_prepare(mysql,query,strlen(query)))) + { + fprintf(stderr, "\n prepare, insert failed"); + fprintf(stderr, "\n %s", mysql_error(mysql)); + exit(0); + } + fprintf(stdout, "\n prepare, insert successful"); + + /* Get the parameter count from the statement */ + param_count= mysql_param_count(stmt); + + fprintf(stdout, "\n total parameters in insert: %d", param_count); + if (param_count != 3) /* validate parameter count */ + { + fprintf(stderr, "\n invalid parameter count returned by MySQL"); + exit(0); + } + + /* Bind the data for the parameters */ + + /* INTEGER PART */ + memset(bind,0,sizeof(bind)); + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= (void *)&int_data; + + /* STRING PART */ + bind[1].buffer_type= MYSQL_TYPE_VAR_STRING; + bind[1].buffer= (void *)str_data; + bind[1].buffer_length= sizeof(str_data); + + /* SMALLINT PART */ + bind[2].buffer_type= MYSQL_TYPE_SHORT; + bind[2].buffer= (void *)&small_data; + bind[2].length= (long *)&length; + + /* Bind the buffers */ + if (mysql_bind_param(stmt, bind)) + { + fprintf(stderr, "\n param bind failed"); + fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); + exit(0); + } + + /* Specify the data */ + int_data= 10; /* integer */ + strcpy(str_data,"MySQL"); /* string */ + /* INSERT SMALLINT data as NULL */ + length= MYSQL_NULL_DATA; + + /* Execute the insert statement - 1*/ + if (mysql_execute(stmt)) + { + fprintf(stderr, "\n execute 1 failed"); + fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); + exit(0); + } + + /* Get the total rows affected */ + affected_rows= mysql_stmt_affected_rows(stmt); + + fprintf(stdout, "\n total affected rows: %lld", affected_rows); + if (affected_rows != 1) /* validate affected rows */ + { + fprintf(stderr, "\n invalid affected rows by MySQL"); + exit(0); + } + + /* Re-execute the insert, by changing the values */ + int_data= 1000; + strcpy(str_data,"The most popular open source database"); + small_data= 1000; /* smallint */ + length= 0; + + /* Execute the insert statement - 2*/ + if (mysql_execute(stmt)) + { + fprintf(stderr, "\n execute 2 failed"); + fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); + exit(0); + } + + /* Get the total rows affected */ + affected_rows= mysql_stmt_affected_rows(stmt); + + fprintf(stdout, "\n total affected rows: %lld", affected_rows); + if (affected_rows != 1) /* validate affected rows */ + { + fprintf(stderr, "\n invalid affected rows by MySQL"); + exit(0); + } + + /* Close the statement */ + if (mysql_stmt_close(stmt)) + { + fprintf(stderr, "\n failed while closing the statement"); + fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); + exit(0); + } + myassert(2 == my_stmt_result("SELECT * FROM test_table",50)); + + /* DROP THE TABLE */ + if (mysql_query(mysql,"DROP TABLE test_table")) + { + fprintf(stderr, "\n drop table failed"); + fprintf(stderr, "\n %s", mysql_error(mysql)); + exit(0); + } + fprintf(stdout, "Success !!!"); +} + static struct my_option myctest_long_options[] = { @@ -4552,6 +4708,7 @@ int main(int argc, char **argv) client_connect(); /* connect to server */ client_query(); /* simple client query test */ + test_manual_sample(); /* sample in the manual */ test_bind_result(); /* result bind test */ test_fetch_null(); /* to fetch null data */ test_fetch_date(); /* to fetch date,time and timestamp */ @@ -4566,9 +4723,9 @@ int main(int argc, char **argv) test_bind_result_ext1(); /* result bind test - extension */ test_select_direct(); /* direct select - protocol_simple debug */ test_select_prepare(); /* prepare select - protocol_prep debug */ - test_select_direct(); /* direct select - protocol_simple debug */ - test_select(); - test_select_version(); + test_select_direct(); /* direct select - protocol_simple debug */ + test_select(); /* simple select test */ + test_select_version(); /* select with variables */ test_set_variable(); /* set variable prepare */ #if NOT_USED test_select_meta(); /* select param meta information */ @@ -4576,19 +4733,14 @@ int main(int argc, char **argv) test_insert_meta(); /* insert param meta information */ #endif test_simple_update(); /* simple update test */ - test_func_fields(); - test_long_data(); - test_insert(); - test_set_variable(); - test_tran_innodb(); - test_select_version(); - test_select_simple(); - test_debug_example(); - test_select(); - test_select_show(); + test_func_fields(); /* test for new 4.1 MYSQL_FIELD members */ + test_long_data(); /* test for sending text data in chunks */ + test_insert(); /* simple insert test - prepare */ + test_set_variable(); /* prepare with set variables */ + test_tran_innodb(); /* test for mysql_commit(), rollback() and autocommit() */ + test_select_show(); /* prepare - show test */ test_null(); /* test null data handling */ test_simple_update(); /* simple prepare - update */ - test_prepare_resultset(); test_prepare_noparam();/* prepare without parameters */ test_select(); /* simple prepare-select */ test_insert(); /* prepare with insert */ From f00289c43105a539c5db456f097803100c2b68ba Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 10 Jan 2003 16:34:53 +0400 Subject: [PATCH 207/220] xml.c: new file --- strings/xml.c | 374 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 374 insertions(+) create mode 100644 strings/xml.c diff --git a/strings/xml.c b/strings/xml.c new file mode 100644 index 00000000000..4f6301249ae --- /dev/null +++ b/strings/xml.c @@ -0,0 +1,374 @@ +/* Copyright (C) 2000 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "my_global.h" +#include "m_string.h" +#include "my_xml.h" + + +#define MY_XML_EOF 'E' +#define MY_XML_STRING 'S' +#define MY_XML_IDENT 'I' +#define MY_XML_EQ '=' +#define MY_XML_LT '<' +#define MY_XML_GT '>' +#define MY_XML_SLASH '/' +#define MY_XML_COMMENT 'C' +#define MY_XML_TEXT 'T' +#define MY_XML_QUESTION '?' +#define MY_XML_EXCLAM '!' + +typedef struct xml_attr_st +{ + const char *beg; + const char *end; +} MY_XML_ATTR; + +static const char *lex2str(int lex) +{ + switch(lex) + { + case MY_XML_EOF: return "EOF"; + case MY_XML_STRING: return "STRING"; + case MY_XML_IDENT: return "IDENT"; + case MY_XML_EQ: return "'='"; + case MY_XML_LT: return "'<'"; + case MY_XML_GT: return "'>'"; + case MY_XML_SLASH: return "'/'"; + case MY_XML_COMMENT: return "COMMENT"; + case MY_XML_TEXT: return "TEXT"; + case MY_XML_QUESTION: return "'?'"; + case MY_XML_EXCLAM: return "'!'"; + } + return "UNKNOWN"; +} + +static void my_xml_norm_text(MY_XML_ATTR *a) +{ + for ( ; (a->beg < a->end) && strchr(" \t\r\n",a->beg[0]) ; a->beg++ ); + for ( ; (a->beg < a->end) && strchr(" \t\r\n",a->end[-1]) ; a->end-- ); +} + + +static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a) +{ + int lex; + + for( ; ( p->cur < p->end) && strchr(" \t\r\n",p->cur[0]) ; p->cur++); + + if (p->cur >= p->end) + { + a->beg=p->end; + a->end=p->end; + lex=MY_XML_EOF; + goto ret; + } + + a->beg=p->cur; + a->end=p->cur; + + if (!memcmp(p->cur,"", 3); p->cur++); + if(!memcmp(p->cur, "-->", 3)) + p->cur+=3; + a->end=p->cur; + lex=MY_XML_COMMENT; + } + else if (strchr("?=/<>!",p->cur[0])) + { + p->cur++; + a->end=p->cur; + lex=a->beg[0]; + } + else if ( (p->cur[0]=='"') || (p->cur[0]=='\'') ) + { + p->cur++; + for( ; ( p->cur < p->end ) && (p->cur[0]!=a->beg[0]); p->cur++); + a->end=p->cur; + if (a->beg[0]==p->cur[0])p->cur++; + a->beg++; + my_xml_norm_text(a); + lex=MY_XML_STRING; + } + else + { + for( ; (p->cur < p->end) && !strchr("?'\"=/<> \t\r\n", p->cur[0]); p->cur++); + a->end=p->cur; + my_xml_norm_text(a); + lex=MY_XML_IDENT; + } + +#if 0 + printf("LEX=%s[%d]\n",lex2str(lex),a->end-a->beg); +#endif + +ret: + return lex; +} + + +static int my_xml_value(MY_XML_PARSER *st, const char *str, uint len) +{ + return (st->value) ? (st->value)(st,str,len) : MY_XML_OK; +} + + +static int my_xml_enter(MY_XML_PARSER *st, const char *str, uint len) +{ + if ( (st->attrend-st->attr+len+1)>sizeof(st->attr)) + { + sprintf(st->errstr,"To deep XML"); + return MY_XML_ERROR; + } + if (st->attrend > st->attr) + { + st->attrend[0]='.'; + st->attrend++; + } + memcpy(st->attrend,str,len); + st->attrend+=len; + st->attrend[0]='\0'; + return st->enter ? st->enter(st,st->attr,st->attrend-st->attr) : MY_XML_OK; +} + +static void mstr(char *s,const char *src,uint l1, uint l2) +{ + l1 = l1attrend; (e>p->attr) && (e[0]!='.') ; e--); + glen = (e[0]=='.') ? (p->attrend-e-1) : p->attrend-e; + + if (str && (slen != glen)) + { + mstr(s,str,sizeof(s)-1,slen); + mstr(g,e+1,sizeof(g)-1,glen), + sprintf(p->errstr,"'' unexpected ('' wanted)",s,g); + return MY_XML_ERROR; + } + + rc = p->leave ? p->leave(p,p->attr,p->attrend-p->attr) : MY_XML_OK; + + *e='\0'; + p->attrend=e; + + return rc; +} + + +int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len) +{ + p->attrend=p->attr; + p->beg=str; + p->cur=str; + p->end=str+len; + + while ( p->cur < p->end ) + { + MY_XML_ATTR a; + if(p->cur[0]=='<') + { + int lex; + int question=0; + int exclam=0; + + lex=my_xml_scan(p,&a); + + if (MY_XML_COMMENT==lex) + { + continue; + } + + lex=my_xml_scan(p,&a); + + if (MY_XML_SLASH==lex) + { + if(MY_XML_IDENT!=(lex=my_xml_scan(p,&a))) + { + sprintf(p->errstr,"1: %s unexpected (ident wanted)",lex2str(lex)); + return MY_XML_ERROR; + } + if(MY_XML_OK!=my_xml_leave(p,a.beg,a.end-a.beg)) + return MY_XML_ERROR; + lex=my_xml_scan(p,&a); + goto gt; + } + + if (MY_XML_EXCLAM==lex) + { + lex=my_xml_scan(p,&a); + exclam=1; + } + else if (MY_XML_QUESTION==lex) + { + lex=my_xml_scan(p,&a); + question=1; + } + + if (MY_XML_IDENT==lex) + { + if(MY_XML_OK!=my_xml_enter(p,a.beg,a.end-a.beg)) + return MY_XML_ERROR; + } + else + { + sprintf(p->errstr,"3: %s unexpected (ident or '/' wanted)",lex2str(lex)); + return MY_XML_ERROR; + } + + while ((MY_XML_IDENT==(lex=my_xml_scan(p,&a))) || (MY_XML_STRING==lex)) + { + MY_XML_ATTR b; + if(MY_XML_EQ==(lex=my_xml_scan(p,&b))) + { + lex=my_xml_scan(p,&b); + if ( (lex==MY_XML_IDENT) || (lex=MY_XML_STRING) ) + { + if((MY_XML_OK!=my_xml_enter(p,a.beg,a.end-a.beg)) || + (MY_XML_OK!=my_xml_value(p,b.beg,b.end-b.beg)) || + (MY_XML_OK!=my_xml_leave(p,a.beg,a.end-a.beg))) + return MY_XML_ERROR; + } + else + { + sprintf(p->errstr,"4: %s unexpected (ident or string wanted)",lex2str(lex)); + return MY_XML_ERROR; + } + } + else if ( (MY_XML_STRING==lex) || (MY_XML_IDENT==lex) ) + { + if((MY_XML_OK!=my_xml_enter(p,a.beg,a.end-a.beg)) || + (MY_XML_OK!=my_xml_leave(p,a.beg,a.end-a.beg))) + return MY_XML_ERROR; + } + else + break; + } + + if (lex==MY_XML_SLASH) + { + if(MY_XML_OK!=my_xml_leave(p,NULL,0)) + return MY_XML_ERROR; + lex=my_xml_scan(p,&a); + } + +gt: + if (question) + { + if (lex!=MY_XML_QUESTION) + { + sprintf(p->errstr,"6: %s unexpected ('?' wanted)",lex2str(lex)); + return MY_XML_ERROR; + } + if(MY_XML_OK!=my_xml_leave(p,NULL,0)) + return MY_XML_ERROR; + lex=my_xml_scan(p,&a); + } + + if (exclam) + { + if(MY_XML_OK!=my_xml_leave(p,NULL,0)) + return MY_XML_ERROR; + } + + if (lex!=MY_XML_GT) + { + sprintf(p->errstr,"5: %s unexpected ('>' wanted)",lex2str(lex)); + return MY_XML_ERROR; + } + } + else + { + a.beg=p->cur; + for ( ; (p->cur < p->end) && (p->cur[0]!='<') ; p->cur++); + a.end=p->cur; + + my_xml_norm_text(&a); + if (a.beg!=a.end) + { + my_xml_value(p,a.beg,a.end-a.beg); + } + } + } + return MY_XML_OK; +} + +void my_xml_parser_create(MY_XML_PARSER *p) +{ + bzero((void*)p,sizeof(p[0])); +} + +void my_xml_parser_free(MY_XML_PARSER *p __attribute__((unused))) +{ +} + +void my_xml_set_value_handler(MY_XML_PARSER *p, int (*action)(MY_XML_PARSER *p, const char *s, uint l)) +{ + p->value=action; +} + +void my_xml_set_enter_handler(MY_XML_PARSER *p, int (*action)(MY_XML_PARSER *p, const char *s, uint l)) +{ + p->enter=action; +} + +void my_xml_set_leave_handler(MY_XML_PARSER *p, int (*action)(MY_XML_PARSER *p, const char *s, uint l)) +{ + p->leave=action; +} + +void my_xml_set_user_data(MY_XML_PARSER *p, void *user_data) +{ + p->user_data=user_data; +} + +const char *my_xml_error_string(MY_XML_PARSER *p) +{ + return p->errstr; +} + + +uint my_xml_error_pos(MY_XML_PARSER *p) +{ + const char *beg=p->beg; + const char *s; + for ( s=p->beg ; scur; s++) + if (s[0]=='\n') + beg=s; + return p->cur-beg; +} + +uint my_xml_error_lineno(MY_XML_PARSER *p) +{ + uint res=0; + const char *s; + for ( s=p->beg ; scur; s++) + if (s[0]=='\n') + res++; + return res; +} From c6ad5a4ad20719e571326dac3e3d89cc05f95150 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 10 Jan 2003 17:01:55 +0400 Subject: [PATCH 208/220] xml.c has been moved to /strings from /mysys This is to reuse code to generate charset related C files from ther descriptions written in XML files --- libmysql/Makefile.shared | 4 ++-- mysys/Makefile.am | 2 +- strings/Makefile.am | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared index 4d8b703fb2d..1aba7bbed43 100644 --- a/libmysql/Makefile.shared +++ b/libmysql/Makefile.shared @@ -42,7 +42,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \ ctype-big5.lo ctype-czech.lo ctype-euc_kr.lo \ ctype-win1250ch.lo ctype-utf8.lo \ ctype-gb2312.lo ctype-gbk.lo ctype-latin1_de.lo \ - ctype-sjis.lo ctype-tis620.lo ctype-ujis.lo + ctype-sjis.lo ctype-tis620.lo ctype-ujis.lo xml.lo mystringsextra= strto.c dbugobjects = dbug.lo # IT IS IN SAFEMALLOC.C sanity.lo @@ -58,7 +58,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \ mf_loadpath.lo my_pthread.lo my_thr_init.lo \ thr_mutex.lo mulalloc.lo string.lo default.lo \ my_compress.lo array.lo my_once.lo list.lo my_net.lo \ - charset.lo xml.lo hash.lo mf_iocache.lo \ + charset.lo hash.lo mf_iocache.lo \ mf_iocache2.lo my_seek.lo \ my_pread.lo mf_cache.lo my_vsnprintf.lo md5.lo sha1.lo\ my_getopt.lo my_gethostbyname.lo my_port.lo diff --git a/mysys/Makefile.am b/mysys/Makefile.am index c8b7987a506..cd823186a2b 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -50,7 +50,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\ my_getopt.c my_mkdir.c \ default.c my_compress.c checksum.c raid.cc \ my_net.c my_semaphore.c my_port.c \ - my_vsnprintf.c charset.c xml.c my_bitmap.c my_bit.c md5.c \ + my_vsnprintf.c charset.c my_bitmap.c my_bit.c md5.c \ my_gethostbyname.c rijndael.c my_aes.c sha1.c \ my_handler.c EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \ diff --git a/strings/Makefile.am b/strings/Makefile.am index ac0b6d7f1e0..c2684769cff 100644 --- a/strings/Makefile.am +++ b/strings/Makefile.am @@ -22,19 +22,19 @@ pkglib_LIBRARIES = libmystrings.a # Exact one of ASSEMBLER_X if ASSEMBLER_x86 ASRCS = strings-x86.s longlong2str-x86.s -CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c +CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c xml.c else if ASSEMBLER_sparc32 # These file MUST all be on the same line!! Otherwise automake # generats a very broken makefile ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s -CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c +CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c xml.c else #no assembler ASRCS = # These file MUST all be on the same line!! Otherwise automake # generats a very broken makefile -CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c +CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c xml.c endif endif @@ -44,7 +44,7 @@ noinst_PROGRAMS = conf_to_src EXTRA_DIST = ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-win1250ch.c \ ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-utf8.c \ ctype-tis620.c ctype-ujis.c ctype-latin1_de.c \ - strto.c strings-x86.s \ + xml.c strto.c strings-x86.s \ longlong2str.c longlong2str-x86.s \ strxmov.c bmove_upp.c strappend.c strcont.c strend.c \ strfill.c strcend.c is_prefix.c strstr.c strinstr.c \ From a1f84c11160ff26892ad9931354d3be341b71496 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 10 Jan 2003 17:05:17 +0400 Subject: [PATCH 209/220] .del-xml.c~d20ceb97a91fcc2d: Delete: mysys/xml.c xml.c: Rename: BitKeeper/deleted/.del-xml.c~d20ceb97a91fcc2d -> mysys/xml.c It is actually moved to /strings BitKeeper/deleted/.del-xml.c~d20ceb97a91fcc2d: Delete: mysys/xml.c --- mysys/xml.c | 374 ---------------------------------------------------- 1 file changed, 374 deletions(-) delete mode 100644 mysys/xml.c diff --git a/mysys/xml.c b/mysys/xml.c deleted file mode 100644 index 4f6301249ae..00000000000 --- a/mysys/xml.c +++ /dev/null @@ -1,374 +0,0 @@ -/* Copyright (C) 2000 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#include "my_global.h" -#include "m_string.h" -#include "my_xml.h" - - -#define MY_XML_EOF 'E' -#define MY_XML_STRING 'S' -#define MY_XML_IDENT 'I' -#define MY_XML_EQ '=' -#define MY_XML_LT '<' -#define MY_XML_GT '>' -#define MY_XML_SLASH '/' -#define MY_XML_COMMENT 'C' -#define MY_XML_TEXT 'T' -#define MY_XML_QUESTION '?' -#define MY_XML_EXCLAM '!' - -typedef struct xml_attr_st -{ - const char *beg; - const char *end; -} MY_XML_ATTR; - -static const char *lex2str(int lex) -{ - switch(lex) - { - case MY_XML_EOF: return "EOF"; - case MY_XML_STRING: return "STRING"; - case MY_XML_IDENT: return "IDENT"; - case MY_XML_EQ: return "'='"; - case MY_XML_LT: return "'<'"; - case MY_XML_GT: return "'>'"; - case MY_XML_SLASH: return "'/'"; - case MY_XML_COMMENT: return "COMMENT"; - case MY_XML_TEXT: return "TEXT"; - case MY_XML_QUESTION: return "'?'"; - case MY_XML_EXCLAM: return "'!'"; - } - return "UNKNOWN"; -} - -static void my_xml_norm_text(MY_XML_ATTR *a) -{ - for ( ; (a->beg < a->end) && strchr(" \t\r\n",a->beg[0]) ; a->beg++ ); - for ( ; (a->beg < a->end) && strchr(" \t\r\n",a->end[-1]) ; a->end-- ); -} - - -static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a) -{ - int lex; - - for( ; ( p->cur < p->end) && strchr(" \t\r\n",p->cur[0]) ; p->cur++); - - if (p->cur >= p->end) - { - a->beg=p->end; - a->end=p->end; - lex=MY_XML_EOF; - goto ret; - } - - a->beg=p->cur; - a->end=p->cur; - - if (!memcmp(p->cur,"", 3); p->cur++); - if(!memcmp(p->cur, "-->", 3)) - p->cur+=3; - a->end=p->cur; - lex=MY_XML_COMMENT; - } - else if (strchr("?=/<>!",p->cur[0])) - { - p->cur++; - a->end=p->cur; - lex=a->beg[0]; - } - else if ( (p->cur[0]=='"') || (p->cur[0]=='\'') ) - { - p->cur++; - for( ; ( p->cur < p->end ) && (p->cur[0]!=a->beg[0]); p->cur++); - a->end=p->cur; - if (a->beg[0]==p->cur[0])p->cur++; - a->beg++; - my_xml_norm_text(a); - lex=MY_XML_STRING; - } - else - { - for( ; (p->cur < p->end) && !strchr("?'\"=/<> \t\r\n", p->cur[0]); p->cur++); - a->end=p->cur; - my_xml_norm_text(a); - lex=MY_XML_IDENT; - } - -#if 0 - printf("LEX=%s[%d]\n",lex2str(lex),a->end-a->beg); -#endif - -ret: - return lex; -} - - -static int my_xml_value(MY_XML_PARSER *st, const char *str, uint len) -{ - return (st->value) ? (st->value)(st,str,len) : MY_XML_OK; -} - - -static int my_xml_enter(MY_XML_PARSER *st, const char *str, uint len) -{ - if ( (st->attrend-st->attr+len+1)>sizeof(st->attr)) - { - sprintf(st->errstr,"To deep XML"); - return MY_XML_ERROR; - } - if (st->attrend > st->attr) - { - st->attrend[0]='.'; - st->attrend++; - } - memcpy(st->attrend,str,len); - st->attrend+=len; - st->attrend[0]='\0'; - return st->enter ? st->enter(st,st->attr,st->attrend-st->attr) : MY_XML_OK; -} - -static void mstr(char *s,const char *src,uint l1, uint l2) -{ - l1 = l1attrend; (e>p->attr) && (e[0]!='.') ; e--); - glen = (e[0]=='.') ? (p->attrend-e-1) : p->attrend-e; - - if (str && (slen != glen)) - { - mstr(s,str,sizeof(s)-1,slen); - mstr(g,e+1,sizeof(g)-1,glen), - sprintf(p->errstr,"'' unexpected ('' wanted)",s,g); - return MY_XML_ERROR; - } - - rc = p->leave ? p->leave(p,p->attr,p->attrend-p->attr) : MY_XML_OK; - - *e='\0'; - p->attrend=e; - - return rc; -} - - -int my_xml_parse(MY_XML_PARSER *p,const char *str, uint len) -{ - p->attrend=p->attr; - p->beg=str; - p->cur=str; - p->end=str+len; - - while ( p->cur < p->end ) - { - MY_XML_ATTR a; - if(p->cur[0]=='<') - { - int lex; - int question=0; - int exclam=0; - - lex=my_xml_scan(p,&a); - - if (MY_XML_COMMENT==lex) - { - continue; - } - - lex=my_xml_scan(p,&a); - - if (MY_XML_SLASH==lex) - { - if(MY_XML_IDENT!=(lex=my_xml_scan(p,&a))) - { - sprintf(p->errstr,"1: %s unexpected (ident wanted)",lex2str(lex)); - return MY_XML_ERROR; - } - if(MY_XML_OK!=my_xml_leave(p,a.beg,a.end-a.beg)) - return MY_XML_ERROR; - lex=my_xml_scan(p,&a); - goto gt; - } - - if (MY_XML_EXCLAM==lex) - { - lex=my_xml_scan(p,&a); - exclam=1; - } - else if (MY_XML_QUESTION==lex) - { - lex=my_xml_scan(p,&a); - question=1; - } - - if (MY_XML_IDENT==lex) - { - if(MY_XML_OK!=my_xml_enter(p,a.beg,a.end-a.beg)) - return MY_XML_ERROR; - } - else - { - sprintf(p->errstr,"3: %s unexpected (ident or '/' wanted)",lex2str(lex)); - return MY_XML_ERROR; - } - - while ((MY_XML_IDENT==(lex=my_xml_scan(p,&a))) || (MY_XML_STRING==lex)) - { - MY_XML_ATTR b; - if(MY_XML_EQ==(lex=my_xml_scan(p,&b))) - { - lex=my_xml_scan(p,&b); - if ( (lex==MY_XML_IDENT) || (lex=MY_XML_STRING) ) - { - if((MY_XML_OK!=my_xml_enter(p,a.beg,a.end-a.beg)) || - (MY_XML_OK!=my_xml_value(p,b.beg,b.end-b.beg)) || - (MY_XML_OK!=my_xml_leave(p,a.beg,a.end-a.beg))) - return MY_XML_ERROR; - } - else - { - sprintf(p->errstr,"4: %s unexpected (ident or string wanted)",lex2str(lex)); - return MY_XML_ERROR; - } - } - else if ( (MY_XML_STRING==lex) || (MY_XML_IDENT==lex) ) - { - if((MY_XML_OK!=my_xml_enter(p,a.beg,a.end-a.beg)) || - (MY_XML_OK!=my_xml_leave(p,a.beg,a.end-a.beg))) - return MY_XML_ERROR; - } - else - break; - } - - if (lex==MY_XML_SLASH) - { - if(MY_XML_OK!=my_xml_leave(p,NULL,0)) - return MY_XML_ERROR; - lex=my_xml_scan(p,&a); - } - -gt: - if (question) - { - if (lex!=MY_XML_QUESTION) - { - sprintf(p->errstr,"6: %s unexpected ('?' wanted)",lex2str(lex)); - return MY_XML_ERROR; - } - if(MY_XML_OK!=my_xml_leave(p,NULL,0)) - return MY_XML_ERROR; - lex=my_xml_scan(p,&a); - } - - if (exclam) - { - if(MY_XML_OK!=my_xml_leave(p,NULL,0)) - return MY_XML_ERROR; - } - - if (lex!=MY_XML_GT) - { - sprintf(p->errstr,"5: %s unexpected ('>' wanted)",lex2str(lex)); - return MY_XML_ERROR; - } - } - else - { - a.beg=p->cur; - for ( ; (p->cur < p->end) && (p->cur[0]!='<') ; p->cur++); - a.end=p->cur; - - my_xml_norm_text(&a); - if (a.beg!=a.end) - { - my_xml_value(p,a.beg,a.end-a.beg); - } - } - } - return MY_XML_OK; -} - -void my_xml_parser_create(MY_XML_PARSER *p) -{ - bzero((void*)p,sizeof(p[0])); -} - -void my_xml_parser_free(MY_XML_PARSER *p __attribute__((unused))) -{ -} - -void my_xml_set_value_handler(MY_XML_PARSER *p, int (*action)(MY_XML_PARSER *p, const char *s, uint l)) -{ - p->value=action; -} - -void my_xml_set_enter_handler(MY_XML_PARSER *p, int (*action)(MY_XML_PARSER *p, const char *s, uint l)) -{ - p->enter=action; -} - -void my_xml_set_leave_handler(MY_XML_PARSER *p, int (*action)(MY_XML_PARSER *p, const char *s, uint l)) -{ - p->leave=action; -} - -void my_xml_set_user_data(MY_XML_PARSER *p, void *user_data) -{ - p->user_data=user_data; -} - -const char *my_xml_error_string(MY_XML_PARSER *p) -{ - return p->errstr; -} - - -uint my_xml_error_pos(MY_XML_PARSER *p) -{ - const char *beg=p->beg; - const char *s; - for ( s=p->beg ; scur; s++) - if (s[0]=='\n') - beg=s; - return p->cur-beg; -} - -uint my_xml_error_lineno(MY_XML_PARSER *p) -{ - uint res=0; - const char *s; - for ( s=p->beg ; scur; s++) - if (s[0]=='\n') - res++; - return res; -} From 0a16d590774b5f6dd9973e6afb035eaf193c4f53 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 10 Jan 2003 11:18:43 -0800 Subject: [PATCH 210/220] Prepared statements - Doc to be incorporated in manual --- Docs/prepare.texi | 1422 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1422 insertions(+) create mode 100755 Docs/prepare.texi diff --git a/Docs/prepare.texi b/Docs/prepare.texi new file mode 100755 index 00000000000..7a526800213 --- /dev/null +++ b/Docs/prepare.texi @@ -0,0 +1,1422 @@ +\input texinfo @c -*-texinfo-*- +@c Copyright 1997-2002 TcX AB, Detron HB and MySQL Finland AB +@c +@c This manual is NOT distributed under a GPL style license. +@c Use of the manual is subject to the following terms: +@c - Conversion to other formats is allowed, but the actual +@c content may not be altered or edited in any way. +@c - You may create a printed copy for your own personal use. +@c - For all other uses, such as selling printed copies or +@c using (parts of) the manual in another publication, +@c prior written agreement from MySQL AB is required. +@c +@c Please e-mail docs@mysql.com for more information or if +@c you are interested in doing a translation. +@c +@c ********************************************************* +@c Note that @node names are used on our web site. +@c So do not change node names without checking +@c Makefile.am and SitePages first. +@c ********************************************************* +@c +@c %**start of header + +@c there's a better way to do this... i just don't know it yet +@c sed will remove the "@c ifnusphere " to make this valid +@c ifnusphere @set nusphere 1 + +@setfilename prepare.info + +@c We want the types in the same index +@c @syncodeindex tp fn + +@c Get version information. This file is generated by the Makefile!! +@include include.texi + +@ifclear tex-debug +@c This removes the black squares in the right margin +@finalout +@end ifclear + +@c Set background for HTML +@set _body_tags BGCOLOR=#FFFFFF TEXT=#000000 LINK=#101090 VLINK=#7030B0 +@c Set some style elements for the manual in HTML form. 'suggested' +@c natural language colors: aqua, black, blue, fuchsia, gray, green, +@c lime, maroon, navy, olive, purple, red, silver, teal, white, and +@c yellow. From Steeve Buehler +@set _extra_head + +@settitle MySQL Prepared Statements + +@c We want single-sided heading format, with chapters on new pages. To +@c get double-sided format change 'on' below to 'odd' +@ifclear nusphere +@setchapternewpage on +@end ifclear + +@ifset nusphere +@setchapternewpage odd +@end ifset + +@c @paragraphindent 0 + +@ifset nusphere +@smallbook +@end ifset + +@c @titlepage +@c @sp 10 +@c @center @titlefont{MySQL Prepared Statements} +@c @sp 10 +@c @right Copyright @copyright{} 1995-2003 MySQL AB +@c blank page after title page makes page 1 be a page front. +@c also makes the back of the title page blank. +@c @page +@c @end titlepage + +@c Short contents, blank page, long contents. +@c until i can figure out the blank page, no short contents. +@c @shortcontents +@c @page +@c @page +@contents + +@c This should be added. The HTML conversion also needs a MySQL version +@c number somewhere. + +@iftex +@c change this to double if you want formatting for double-sided +@c printing +@headings single +@end iftex + +@c @node Top, MySQL C API, (dir), (dir) + +@c @menu +@c * MySQL C API:: +@c @end menu + +@c @node MySQL C API, , Top, Top +@c @chapter MySQL C API + +@c @menu +@c * Prepared statements:: +@c @end menu + +@node Top, MySQL prepared statements, (dir), (dir) + +@menu +* MySQL prepared statements:: +@end menu + +@node MySQL prepared statements, , Top, Top +@chapter MySQL Prepared Statements + +@menu +* C Prepared statements:: +* C Prepared statement datatypes:: +* C Prepared statements function overview:: +* C Prepared statement functions:: +@end menu + +@node C Prepared statements, C Prepared statement datatypes, MySQL prepared statements, MySQL prepared statements +@subsection C Prepared Statements + +@sp 1 + +From MySQL 4.1 and above, you can also make use of the prepared +statements using the statement handler 'MYSQL_STMT', which supports +simultanious query executions along with input and output binding. + +@sp 1 + +Prepared execution is an efficient way to execute a statement more than +once. The statement is first parsed, or prepared. This is executed one +or more times at a later time using the statement handle that is +returned during the prepare. + +@sp 1 + +Another advantage of prepared statements is that, it uses a binary protocol +which makes the data tranfer between client and server in a more efficient +way than the old MySQL protocol. + +@sp 1 + +Prepared execution is faster than direct execution for statements +executed more than once, primarly becuase the query is parsed only +once; In the case of direct execution, the query is parsed every +time. Prepared execution also can provide a reduction in the network +traffic becuase during the execute call, it only sends the data for the +parameters. + + + +@node C Prepared statement datatypes, C Prepared statements function overview, C Prepared statements, MySQL prepared statements +@subsection C Prepared Statements DataTypes + +Prepared statements mainly uses the following two @code{MYSQL_STMT} and +@code{MYSQL_BIND} structures: +@sp 1 + +@table @code +@tindex MYSQL C type +@item MYSQL_STMT +This structure represents a statement handle to prepared statements.It +is used for all statement related functions. + +@sp 1 + +The statement is initialized when the query is prepared using +@code{mysql_prepare()}. + +@sp 1 + +One connection can have 'n' statement handles, and the limit depends up on +the system resources. + +@sp 1 + +@tindex MYSQL_BIND C type +@item MYSQL_BIND +This structure is used in order to bind parameter buffers inorder to +send the parameters data to @code{mysql_execute()} call; as well as to +bind row buffers to fetch the result set data using @code{mysql_fetch()}. +@end table + +@sp 1 + +@noindent +The @code{MYSQL_BIND} structure contains the members listed here: + + +@table @code +@item enum enum_field_types buffer_type [input] +The type of the buffer. The @code{type} value must be one of the following: + + +@itemize @bullet +@item @code{MYSQL_TYPE_TINY} +@item @code{MYSQL_TYPE_SHORT} +@item @code{MYSQL_TYPE_LONG} +@item @code{MYSQL_TYPE_LONGLONG} +@item @code{MYSQL_TYPE_FLOAT} +@item @code{MYSQL_TYPE_DOUBLE} +@item @code{MYSQL_TYPE_STRING} +@item @code{MYSQL_TYPE_VAR_STRING} +@item @code{MYSQL_TYPE_TINY_BLOB} +@item @code{MYSQL_TYPE_MEDIUM_BLOB} +@item @code{MYSQL_TYPE_LONG_BLOB} +@item @code{MYSQL_TYPE_BLOB} +@end itemize +@sp 1 + +@item void *buffer [input/output] +A pointer to a buffer for the parameters data in case if it is used to +supply parameters data or pointer to a buffer in which to return the +data when the structure is used for result set bind. + +@sp 1 + +@item long *length [input/output] +Pointer to the buffer for the parameter's length. When the structure is +used as a input parameter data binding, then this argument points to a +buffer that, when @code{mysql_execute()} is called, contains one of the +following: + +@itemize @bullet +@item +The length of the parameter value stored in *buffer. This is ignored +except for character or binary C data. +@item +MYSQL_NULL_DATA. The parameter value is NULL. +@item +MYSQL_LONG_DATA. The parameter value is a long data and is supplied in +chunks through @code{mysql_send_long_data()}. +@end itemize + +If the length is a null pointer, then the protocol assumes that all +input parameter values are non-NULL and that character and binary data +are null terminated. + + +When this structure is used in output binding, then @code{mysql_fetch()} +return the following values in the length buffer: + +@itemize @bullet +@item +The length of the data that is returned +@item +MYSQL_NULL_DATA, indicating the data returned is a NULL data. +@end itemize + + +@c @item bool is_null [input] +@c To indicate the parameter data is NULL. This is same as supplying +@c MYSQL_NULL_DATA, -1 as the length in length pointer. + + +@c @item bool is_long_data [input] +@c To indicate the parameter data is a long data, and the data will be +@c supplied in chunks through @code{mysql_send_long_data()}.This is also +@c same as supplying MYSQL_LONG_DATA, -2 as the length in length pointer. +@c @end table +@end table + + +@node C Prepared statements function overview, C Prepared statement functions, C Prepared statement datatypes, MySQL prepared statements +@subsection C Prepared Statements Function Overview + +@cindex C Prepared statements API, functions +@cindex functions, C Prepared statements API + +The functions available in the prepared statements are listed here and +are described in greater detail in the later section. +@xref{C Prepared statement functions}. + +@multitable @columnfractions .32 .68 +@item @strong{Function} @tab @strong{Description} + +@item @strong{mysql_prepare()} @tab Prepares an SQL string for execution. + +@item @strong{mysql_param_count()} @tab Returns the number of parameters in a prepared SQL statement. + +@item @strong{mysql_prepare_result()} @tab Returns prepared statement meta information in the form of resultset. + +@item @strong{mysql_bind_param()} @tab Binds a buffer to parameter markers in a prepared SQL statement. + +@item @strong{mysql_execute()} @tab Executes the prepared statement. + +@item @strong{mysql_stmt_affected_rows()} @tab Returns the number of rows changes/deleted/inserted by the last UPDATE,DELETE,or INSERT query + +@item @strong{mysql_bind_result()} @tab Binds application data buffers to columns in the resultset. + +@item @strong{mysql_fetch()} @tab Fetches the next rowset of data from the result set and returns data for all bound columns. + +@item @strong{mysql_stmt_close()} @tab Frees memory used by prepared statement. + +@item @strong{mysql_stmt_errno()} @tab Returns the error number for the last statement execution. + +@item @strong{mysql_stmt_error()} @tab Returns the error message for the last statement execution. + +@item @strong{mysql_send_long_data()} @tab Sends long data in chunks to server. + +@c TO BE MOVED TO MAIN C API FUCTIONS +@item @strong{mysql_commit()} @tab Commits the transaction. + +@item @strong{mysql_rollback()} @tab Rollbacks the transaction. + +@item @strong{mysql_autocommit()} @tab Toggles the autocommit mode to on/off. + +@item @strong{mysql_more_results()} @tab Returns if there are any more results exists + +@item @strong{mysql_next_result()} @tab Returns/Initiates the next result in the multi-query executions + +@end multitable + +@sp 1 +Call @code{mysql_prepare()} to prepare and initialize the statement +handle, then call @code{mysql_bind_param()} to supply the parameters +data, and then call @code{mysql_execute()} to execute the query. You can +repeat the @code{mysql_execute()} by changing parameter values from the +respective buffer supplied through @code{mysql_bind_param()}. + +@sp 1 + + +In case if the query is a SELECT statement or any other query which +results in a resultset, then mysql_prepare() will also return the result +set meta data information in the form of @code{MYSQL_RES } result set +through @code{mysql_prepare_result()}. + +@sp 1 + +You can supply the result buffers using @code{mysql_bind_result()}, so +that the @code{mysql_fetch()} will automatically returns data to this +buffers. This is row by row fetching. + +@sp 1 + +You can also send the text or binary data in chunks to server using +@code{mysql_send_long_data()}, by specifying the option is_long_data=1 +or length=MYSQL_LONG_DATA or -2 in the MYSQL_BIND structure supplied +with @code{mysql_bind_param()}. + +@sp 1 + +Once the statement execution is over, it must be freed using +@code{mysql_stmt_close} so that it frees all the alloced resources for +the statement handle. + + +@subsubheading Execution Steps: + +To prepare and execute a statement, the application: + +@itemize @bullet +@item +Calls @strong{mysql_prepare()} and passes it a string containing the SQL +statement. On a successful prepare, mysql_prepare returns the valid statement +handle back to the application +@item +If the query results in a resultset, then @strong{mysql_prepare_result} +returns the result set meta info.. +@item +Sets the values of any parameters using @strong{mysql_bind_param}. All +parameters must be set; else it will return an error or produce +un-expected results +@item +Calls @strong{mysql_execute} to execute the statement. +@item +Repeat steps 2 and 3 as necessary, by changing the parameter values and +re-executing the statement. +@item +Bind the data buffers to return the row values, if it is a result set +query; using @strong{mysql_bind_result()}. +@item +Fetch the data to buffers row by row by calling @strong{mysql_fetch()} +repetedely until no more rows found. +@item +When @strong{mysql_prepare()} is called, in the MySQL client/server protocol: +@itemize @minus +@item +Server parses the query and sends the ok status back to client by +assinging a statement id. It also sends total number of parameters, +columns count and its meta information if it is a result set oriented +query. All syntax and symantecs of the query is checked during this call +by the server. +@item +Client uses this statement id for the further executions, so that server +identifies the statement back from the pool of statements. Now, client +allocates a statement handle with this id and returns back to +application. +@end itemize +@item +When @strong{mysql_execute()} is called, in the MySQL client/server protocol: +@itemize @minus +@item +Client uses the statement handle and sends the parameters data to +server. +@item +Server identifies the statement using the id provided by the client, and +replaces the parameter markers with the newly supplied data and executes +the query. If it results in a result set, then sends the data back to +client, else sends an OK status with total number of rows +changes/deleted/inserted. +@end itemize +@item +When @strong{mysql_fetch()} is called, in the MySQL client/server protocol: +@itemize @minus +@item +Client reads the data from the packet row by row and places it to +application data buffers by doing the necessary conversions. If the +application buffer type is same as that of field type, then the +conversions are stright forward. +@end itemize +@end itemize + + + +You can get the statement error code and message using +@code{mysql_stmt_errno()} and @code{mysql_stmt_error()} respectively. + + +@node C Prepared statement functions, , C Prepared statements function overview, MySQL prepared statements +@subsection C Prepared Statement Function Descriptions + +You need to use the following functions when you want to prepare and +execute the queries. + + +@menu +* mysql_prepare:: +* mysql_param_count:: +* mysql_prepare_result:: +* mysql_bind_param:: +* mysql_execute:: +* mysql_stmt_affected_rows:: +* mysql_bind_result:: +* mysql_fetch:: +* mysql_send_long_data:: +* mysql_stmt_close:: +* mysql_stmt_errno:: +* mysql_stmt_error:: +* mysql_commit:: +* mysql_rollback:: +* mysql_autocommit:: +@end menu + +@node mysql_prepare, mysql_param_count, C Prepared statement functions, C Prepared statement functions +@subsubsection @code{mysql_prepare()} + +@findex @code{mysql_prepare()} + +@code{MYSQL_STMT * mysql_prepare(MYSQL *mysql, const char *query, unsigned +long length)} + +@subsubheading Description + +Prepares the SQL query pointed to by the null-terminated string +'query'. The query must consist of a single SQL statement. You should +not add a terminating semicolon (`;`) or \g to the statement. + +@sp 1 +The application can include one or more parameter markers in the SQL +statement. To include a parameter marker, the appication embeds a +question mark (@code{?}) into the SQL string at the appropriate +position. + +@sp 1 +The markers are legal only in certain places in SQL statements. For +example, they are not allowed in the select list(the list of columns to +be returned by a SELECT statement), nor are they allowed as both +operands of a binary operator such as the equal sign (=), becuase it +would be impossible to determine the parameter type. In general, +parameters are legal only in Data Manipulation Languange(DML) +statements, and not in Data Defination Language(DDL) statements. + +@sp 1 +The parameter markers are then bound to application variables using +@code{mysql_bind_param()}. + + + +@subsubheading Return Values + +@code{MYSQL_STMT} if the prepare was successful. NULL if an error +occured. + +@subsubheading Errors + +If the prepare is not successful, i.e. when @code{mysql_prepare()} returned a +NULL statement, errors can be obtained by calling @code{mysql_error()}. + + +@subsubheading Example + +For the usage of @code{mysql_prepare()} refer to the Example from +@ref{mysql_execute,mysql_execute()}. + + + + +@node mysql_param_count, mysql_prepare_result, mysql_prepare, C Prepared statement functions +@subsubsection @code{mysql_param_count()} + +@findex @code{mysql_param_count()} + +@code{unsigned int mysql_param_count(MYSQL_STMT *stmt)} + +@subsubheading Description + +Returns the number of parameter markers present from the prepared query. + +@subsubheading Return Values + +An unsigned integer representing the number of parameters in a +statement. + +@subsubheading Errors + +None + +@subsubheading Example + +For the usage of @code{mysql_param_count()} refer to the Example from +@ref{mysql_execute,mysql_execute()}. + + + +@node mysql_prepare_result, mysql_bind_param, mysql_param_count, C Prepared statement functions +@subsubsection @code{mysql_prepare_result()} + + +@findex @code{mysql_prepare_result}. + +@code{MYSQL_RES *mysql_prepare_result(MYSQL_STMT *stmt)} + +@subsubheading Description + +If the @code{mysql_prepare()} resulted in a result set query, then +@code{mysql_prepare_result()} returns the result set meta data in the form of +@code{MYSQL_RES} structure; which can further be used to process the +meta information such as total number of fields and individual field +information. This resulted result set can be passed as an argument to +any of the field based APIs in order to process the result set meta data +information such as: + +@itemize @minus +@item +mysql_num_fields() +@item +mysql_fetch_field() +@item +mysql_fetch_field_direct() +@item +mysql_fetch_fields() +@item +mysql_field_count() +@item +mysql_field_seek() +@item +mysql_field_tell() and +@item +mysql_free_result() +@end itemize + + +@subsubheading Return Values + +A @code{MYSQL_RES} result structure. NULL if no meta information exists from +the prepared query. + + +@subsubheading Errors + +None + + +@subsubheading Example + +For the usage of @code{mysql_prepare_result()} refer to the Example from +@ref{mysql_fetch,mysql_fetch()} + + + +@node mysql_bind_param, mysql_execute, mysql_prepare_result, C Prepared statement functions +@subsubsection @code{mysql_bind_param()} + +@findex @code{mysql_bind_param()} + +@code{int mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *bind)} + +@subsubheading Description + +@code{mysql_bind_param} is used to bind data for the parameter markers +in the SQL statement from @code{mysql_prepare}. It uses the structure +MYSQL_BIND to supply the data. + +The supported buffer types are: + +@itemize @bullet +@item +MYSQL_TYPE_TINY +@item +MYSQL_TYPE_SHORT +@item +MYSQL_TYPE_LONG +@item +MYSQL_TYPE_LONGLONG +@item +MYSQL_TYPE_FLOAT +@item +MYSQL_TYPE_DOUBLE +@item +MYSQL_TYPE_STRING +@item +MYSQL_TYPE_VAR_STRING +@item +MYSQL_TYPE_TINY_BLOB +@item +MYSQL_TYPE_MEDIUM_BLOB +@item +MYSQL_TYPE_LONG_BLOB +@end itemize + +@subsubheading Return Values + +Zero if the bind was successful. Non-zero if an error occured. + +@subsubheading Errors +@table @code +@item CR_NO_PREPARE_STMT +No prepared statement exists +@item CR_NO_PARAMETERS_EXISTS +No parameters exists to bind +@item CR_INVALID_BUFFER_USE +Indicates if the bind is to supply the long data in chunks and if the +buffer type is non string or binary +@item CR_UNSUPPORTED_PARAM_TYPE +The conversion is not supported, possibly the buffer_type is illegal or +its not from the above list of supported types. +@end table + +@subsubheading Example + +For the usage of @code{mysql_bind_param()} refer to the Example from +@ref{mysql_execute,mysql_execute()}. + + + +@node mysql_execute, mysql_stmt_affected_rows, mysql_bind_param, C Prepared statement functions +@subsubsection @code{mysql_execute()} + +@findex @code{mysql_execute()} + +@code{int mysql_execute(MYSQL_STMT *stmt}. + +@subsubheading Description + +@code{mysql_execute()} executes the prepared query associated with the +statement handle. The parameter marker values will be sent to server +during this call, so that server replaces markers with this newly +supplied data. + +@sp 1 + +If the statement is UPDATE,DELETE,or INSERT, the total number of +changed/deletd/inserted values can be found by calling +@code{mysql_stmt_affected_rows}. If this is a result set query, then one +must call @code{mysql_fetch()} to fetch the data prior to calling any +other calls which results in query processing. For more information on +how to fetch the statement binary data, refer to @ref{mysql_fetch}. + + +@subsubheading Return Values + +@code{mysql_execute()} returns the following return values: + +@multitable @columnfractions .30 .65 +@item @strong{Return Value} @tab @strong{Description} +@item MYSQL_SUCCESS, 0 @tab Successful +@item MYSQL_STATUS_ERROR, 1 @tab Error occured. Error code and +message can be obtained by calling @code{mysql_stmt_errno()} and @code{mysql_stmt_error()}. +@item MYSQL_NEED_DATA, 99 @tab One of the parameter buffer is +indicating the data suppy in chunks, and the supply is not yet complete. +@end multitable + + +@subsubheading Errors + +@table @code +@item CR_NO_PREPARE_QUERY +No query prepared prior to execution +@item CR_ALL_PARAMS_NOT_BOUND +Not all parameters data is supplied +@item CR_SERVER_GONE_ERROR +The MySQL server has gone away +@item CR_UNKNOWN_ERROR +An unkown error occured +@end table + + +@subsubheading Example + +The following example explains the uasage of @code{mysql_prepare}, +@code{mysql_param_count}, @code{mysql_bind_param}, @code{mysql_execute} +and @code{mysql_stmt_affected_rows()}. + +@example + +MYSQL_BIND bind[3]; +MYSQL_STMT *stmt; +ulonglong affected_rows; +long length; +unsigned int param_count; +int int_data; +char str_data[50], query[255]; + + /* Set autocommit mode to true */ + mysql_autocommit(mysql, 1); + + if (mysql_query(mysql,"DROP TABLE IF EXISTS test_table")) + @{ + fprintf(stderr, "\n drop table failed"); + fprintf(stderr, "\n %s", mysql_error(mysql)); + exit(0); + @} + if (mysql_query(mysql,"CREATE TABLE test_table(col1 int, col2 varchar(50), \ + col3 smallint,\ + col4 timestamp(14))")) + @{ + fprintf(stderr, "\n create table failed"); + fprintf(stderr, "\n %s", mysql_error(mysql)); + exit(0); + @} + + /* Prepare a insert query with 3 parameters */ + strcpy(query, "INSERT INTO test_table(col1,col2,col3) values(?,?,?)"); + if(!(stmt = mysql_prepare(mysql,query,strlen(query)))) + @{ + fprintf(stderr, "\n prepare, insert failed"); + fprintf(stderr, "\n %s", mysql_error(mysql)); + exit(0); + @} + fprintf(stdout, "\n prepare, insert successful"); + + /* Get the parameter count from the statement */ + param_count= mysql_param_count(stmt); + + fprintf(stdout, "\n total parameters in insert: %d", param_count); + if (param_count != 3) /* validate parameter count */ + @{ + fprintf(stderr, "\n invalid parameter count returned by MySQL"); + exit(0); + @} + + /* Bind the data for the parameters */ + + /* INTEGER PART */ + memset(bind,0,sizeof(bind)); + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= (void *)&int_data; + + /* STRING PART */ + bind[1].buffer_type= MYSQL_TYPE_VAR_STRING; + bind[1].buffer= (void *)str_data; + bind[1].buffer_length= sizeof(str_data); + + /* SMALLINT PART */ + bind[2].buffer_type= MYSQL_TYPE_SHORT; + bind[2].buffer= (void *)&small_data; + bind[2].length= (long *)&length; + + /* Bind the buffers */ + if (mysql_bind_param(stmt, bind)) + @{ + fprintf(stderr, "\n param bind failed"); + fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); + exit(0); + @} + + /* Specify the data */ + int_data= 10; /* integer */ + strcpy(str_data,"MySQL"); /* string */ + /* INSERT SMALLINT data as NULL */ + length= MYSQL_NULL_DATA; + + /* Execute the insert statement - 1*/ + if (mysql_execute(stmt)) + @{ + fprintf(stderr, "\n execute 1 failed"); + fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); + fprintf(stderr, "\n send a bug report to bugs@@lists.mysql.com, by asking why this is not working ?"); + exit(0); + @} + + /* Get the total rows affected */ + affected_rows= mysql_stmt_affected_rows(stmt); + + fprintf(stdout, "\n total affected rows: %lld", affected_rows); + if (affected_rows != 1) /* validate affected rows */ + @{ + fprintf(stderr, "\n invalid affected rows by MySQL"); + exit(0); + @} + + /* Re-execute the insert, by changing the values */ + int_data= 1000; + strcpy(str_data,"The most popular open source database"); + small_data= 1000; /* smallint */ + length= 0; + + /* Execute the insert statement - 2*/ + if (mysql_execute(stmt)) + @{ + fprintf(stderr, "\n execute 2 failed"); + fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); + exit(0); + @} + + /* Get the total rows affected */ + affected_rows= mysql_stmt_affected_rows(stmt); + + fprintf(stdout, "\n total affected rows: %lld", affected_rows); + if (affected_rows != 1) /* validate affected rows */ + @{ + fprintf(stderr, "\n invalid affected rows by MySQL"); + exit(0); + @} + + /* Close the statement */ + if (mysql_stmt_close(stmt)) + @{ + fprintf(stderr, "\n failed while closing the statement"); + fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); + exit(0); + @} + + /* DROP THE TABLE */ + if (mysql_query(mysql,"DROP TABLE test_table")) + @{ + fprintf(stderr, "\n drop table failed"); + fprintf(stderr, "\n %s", mysql_error(mysql)); + exit(0); + @} + fprintf(stdout, "Success, MySQL prepared statements are working great !!!"); +@end example + + + + +@node mysql_stmt_affected_rows, mysql_bind_result, mysql_execute, C Prepared statement functions +@subsubsection @code{mysql_stmt_affected_rows()} + +@findex @code{mysql_stmt_affected_rows()} + +@code{ulonglong mysql_stmt_affected_rows(MYSQL_STMT *stmt)} + +@subsubheading Description + +Returns total number of rows changed by the last execute statement. May +be called immediatlely after mysql_execute() for UPDATE,DELETE,or INSERT +statements.For SELECT statements, mysql_stmt_affected rows works like +mysql_num_rows(). + +@subsubheading Return Values + +An integer greater than zero indicates the number of rows affected or +retrieved. Zero indicates that no records where updated for an UPDATE +statement, no rows matched the WHERE clause in the query or that no +query has yet been executed. -1 indicates that the query returned an +error or that, for a SELECT query, mysql_stmt_affected_rows() was called +prior to calling mysql_fetch(). + +@subsubheading Errors + +None. + +@subsubheading Example + +For the usage of @code{mysql_stmt_affected_rows()} refer to the Example +from @ref{mysql_execute,mysql_execute()}. + + + + + +@node mysql_bind_result, mysql_fetch, mysql_stmt_affected_rows, C Prepared statement functions +@subsubsection @code{mysql_bind_result()} + +@findex @code{mysql_bind_result()} + +@code{my_bool mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)} + +@subsubheading Description + +@code{mysql_bind_result()} is ised to associate, or bind, columns in the +resultset to data buffers and length buffers. When @code{mysql_fetch()} is +called to fetch data, the MySQL client protocol returns the data for the +bound columns in the specified buffers. + +@sp 1 + +Note that all columns must be bound prior to calling @code{mysql_fetch()} +in case of fetching the data to buffers; else @code{mysql_fetch()} simply ignores +the data fetch; also the buffers should be sufficient enough to hold the +data as the ptotocol doesn't return the data in chunks. + +@sp 1 + +A column can be bound or rebound at any time, even after data has been +fetched from the result set. The new binding takes effect the next time +@code{mysql_fetch()} is called. For example, suppose an application binds +the columns in a result set and calls @code{mysql_fetch()}. The mysql +protocol returns data in the bound buffers. Now suppose the application +binds the columns to a different set of buffers, then the protocol does +not place the data for the just fetched row in the newly bound +buffers. Instead, it does when the next @code{mysql_fetch()} is called. + +@sp 1 + +To bind a column, an application calls @code{mysql_bind_result()} and +passes the type, address, and the address of the length buffer. + +The supported buffer types are: + +@itemize @bullet +@item +MYSQL_TYPE_TINY +@item +MYSQL_TYPE_SHORT +@item +MYSQL_TYPE_LONG +@item +MYSQL_TYPE_LONGLONG +@item +MYSQL_TYPE_FLOAT +@item +MYSQL_TYPE_DOUBLE +@item +MYSQL_TYPE_STRING +@item +MYSQL_TYPE_VAR_STRING +@item +MYSQL_TYPE_BLOB +@item +MYSQL_TYPE_TINY_BLOB +@item +MYSQL_TYPE_MEDIUM_BLOB +@item +MYSQL_TYPE_LONG_BLOB +@end itemize + +@subsubheading Return Values + +Zero if the bind was successful. Non-zero if an error occured. + +@subsubheading Errors +@table @code +@item CR_NO_PREPARE_STMT +No prepared statement exists +@item CR_UNSUPPORTED_PARAM_TYPE +The conversion is not supported, possibly the buffer_type is illegal or +its not from the list of supported types. +@end table + +@subsubheading Example + +For the usage of @code{mysql_bind_result()} refer to the Example from +@ref{mysql_fetch,mysql_fetch()} + + + +@node mysql_fetch, mysql_send_long_data, mysql_bind_result, C Prepared statement functions +@subsubsection @code{mysql_fetch()} + +@findex code{mysql_fetch()} + +@code{int mysql_fetch(MYSQL_STMT *stmt)} + +@subsubheading Description + +@code{mysql_fetch()} returns the next rowset in the result set. It can +be called only while the result set exists i.e. after a call to +@code{mysql_execute()} that creates a result set. + +@sp 1 + +If row buffers are bound using @code{mysql_bind_result()}, it returns +the data in those buffers for all the columns in the current row +set and the lengths are returned to the length pointer. + +@sp 1 +Note that, all columns must be bound by the application. + +@sp 1 +If the data fetched is a NULL data, then the length buffer will have a +value of @strong{MYSQL_NULL_DATA}, -1, else it will have the length of +the data being fetched based on the buffer type specified by the +application. All numeric, float and double types have the +fixed length(in bytes) as listed below: + +@multitable @columnfractions .10 .30 +@item @strong{Type} @tab @strong{Length} +@item MYSQL_TYPE_TINY @tab 1 +@item MYSQL_TYPE_SHORT @tab 2 +@item MYSQL_TYPE_LONG @tab 4 +@item MYSQL_TYPE_FLOAT @tab 4 +@item MYSQL_TYPE_LONGLONG @tab 8 +@item MYSQL_TYPE_DOUBLE @tab 8 +@item MYSQL_TYPE_STRING @tab data length +@item MYSQL_TYPE_VAR_STRING @tab data_length +@item MYSQL_TYPE_BLOB @tab data_length +@item MYSQL_TYPE_TINY_BLOB @tab data_length +@item MYSQL_TYPE_MEDIUM_BLOB @tab data_length +@item MYSQL_TYPE_LONG_BLOB @tab data_length +@end multitable + +@* +where @code{*data_length} is nothing but the 'Actual length of the data'. + +@subsubheading Return Values + +@multitable @columnfractions .30 .65 +@item @strong{Return Value} @tab @strong{Description} +@item MYSQL_SUCCESS, 0 @tab Successful, the data has been +fetched to application data buffers. +@item MYSQL_STATUS_ERROR, 1 @tab Error occured. Error code and +message can be obtained by calling @code{mysql_stmt_errno()} and @code{mysql_stmt_error()}. +@item MYSQL_NO_DATA, 100 @tab No more rows/data exists +@end multitable + + +@subsubheading Errors +@table @code +@item CR_UNSUPPORTED_PARAM_TYPE +If the field type is DATE,DATETIME,TIME,or TIMESTAMP; and the +application buffer type is non string based. +@item +All other un-supported conversions are returned from +@code{mysql_bind_result()}. +@end table + +@subsubheading Example + +The following example explains the usage of @code{mysql_prepare_result}, +@code{mysql_bind_result()}, and @code{mysql_fetch()} + +@example + +MYSQL_STMT *stmt; +MYSQL_BIND bind[2]; +MYSQL_RES *result; +int int_data; +long int_length, str_length; +char str_data[50]; + + query= "SELECT col1, col2 FROM test_table WHERE col1= 10)"); + if (!(stmt= mysql_prepare(&mysql, query, strlen(query))) + @{ + fprintf(stderr, "\n prepare failed"); + fprintf(stderr, "\n %s", mysql_error(&stmt)); + exit(0); + @} + + /* Get the fields meta information */ + if (!(result= mysql_prepare_result(stmt))) + @{ + fprintf(stderr, "\n prepare_result failed"); + fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); + exit(0); + @} + + fprintf(stdout, "Total fields: %ld", mysql_num_fields(result)); + + if (mysql_num_fields(result) != 2) + @{ + fprintf(stderr, "\n prepare returned invalid field count"); + exit(0); + @} + + /* Execute the SELECT query */ + if (mysql_execute(stmt)) + @{ + fprintf(stderr, "\n execute didn't retuned expected return code, MYSQL_NEED_DATA"); + exit(0); + @} + + /* Bind the result data buffers */ + bzero(bind, 0, sizeof(bind)); + + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= (void *)&int_data; + bind[0].length= &int_length; + + bind[1].buffer_type= MYSQL_TYPE_VAR_STRING; + bind[1].buffer= (void *)str_data; + bind[1].length= &str_length; + + if (mysql_bind_result(stmt, bind)) + @{ + fprintf(stderr, "\n bind_result failed"); + fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); + exit(0); + @} + + /* Now fetch data to buffers */ + if (mysql_fetch(stmt)) + @{ + fprintf(stderr, "\n fetch failed"); + fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); + exit(0); + @} + + fprintf(stdout, "\n int_data: %d, length: %ld", int_data, int_length); + fprintf(stdout, "\n str_data: %s, length: %ld", str_data, str_length); + + /* call mysql_fetch again */ + if (mysql_fetch(stmt) |= MYSQL_NO_DATA) + @{ + fprintf(stderr, "\n fetch return more than one row); + exit(0); + @} + + /* Free the prepare result */ + mysql_free_result(result); + + /* Free the statement handle */ + if (mysql_stmt_free(stmt)) + @{ + fprintf(stderr, "\n failed to free the statement handle); + fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); + exit(0); + @} + +@end example + + + +@node mysql_send_long_data, mysql_stmt_close, mysql_fetch, C Prepared statement functions +@subsubsection @code{mysql_send_long_data()} + + +@findex @code{mysql_send_long_data()}. + +@code{int mysql_send_long_data(MYSQL_STMT *stmt, unsigned int +parameter_number, const char *data, ulong length, my_bool is_last_data)} + +@subsubheading Description + +Allows an application to send the data in pieces or chunks to +server. This function can be used to send character or binary data +values in parts to a column(it must be a text or blob) with a character or +binary data type. + +@sp 1 +The @code{data} is a pointer to buffer containing the actual data for +the parameter represendted by @code{parameter_number}. The @code{length} +indicates the amount of data to be sent in bytes, and @code{is_last_data} is a +boolean flag to indicate the end of the data. If it is != 0, then the +current call will be the end of the data, else it waits for the +application to send all data. If the application doesn't ended the data +supply from @code{mysql_send_long_data()}, then the +@code{mysql_execute()} will return @strong{MYSQL_NEED_DATA}. + + + +@subsubheading Return Values + +Zero if the data is sent successfully to server. Non-zero if an error +occured. + + +@subsubheading Errors + +@table @code +@item CR_INVALID_PARAMETER_NO +Invalid parameter number +@item CR_SERVER_GONE_ERROR +The MySQL server has gone away +@item CR_UNKNOWN_ERROR +An unkown error occured +@end table + +@subsubheading Example +The following example explains how to send the data in chunks to text +column: +@example + +MYSQL_BIND bind[1]; +long length; + + query= "INSERT INTO test_long_data(text_column) VALUES(?)"); + if (!mysql_prepare(&mysql, query, strlen(query)) + @{ + fprintf(stderr, "\n prepare failed"); + fprintf(stderr, "\n %s", mysql_error(&stmt)); + exit(0); + @} + memset(bind, 0, sizeof(bind)); + bind[0].buffer_type= MYSQL_TYPE_STRING; + bind[0].length= &length; + + /* Indicate that the data supply is in CHUNKS */ + length= MYSQL_LONG_DATA; + + /* Bind the buffers */ + if (mysql_bind_param(stmt, bind)) + @{ + fprintf(stderr, "\n param bind failed"); + fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); + exit(0); + @} + + /* Execute the insert statement - It should return MYSQL_NEED_DATA */ + if (mysql_execute(stmt) != MYSQL_NEED_DATA) + @{ + fprintf(stderr, "\n execute didn't retuned expected return code, MYSQL_NEED_DATA"); + exit(0); + @} + + /* Supply data in chunks to server */ + if (!mysql_send_long_data(stmt,1,"MySQL",5,0)) + @{ + fprintf(stderr, "\n send_long_data failed"); + fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); + exit(0); + @} + /* Supply the last piece of data */ + if (mysql_send_long_data(stmt,1," - The most popular open source database",40,1)) + @{ + fprintf(stderr, "\n send_long_data failed"); + fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); + exit(0); + @} + + /* Now, execute the query */ + if (mysql_execute(stmt)) + @{ + fprintf(stderr, "\n mysql_execute failed"); + fprintf(stderr, "\n %s", mysql_stmt_error(stmt)); + exit(0); + @} + + This inserts the data, "MySQL - The most popular open source database" + to the field 'text_column'. +@end example + + + +@node mysql_stmt_close, mysql_stmt_errno, mysql_send_long_data, C Prepared statement functions +@subsubsection @code{mysql_stmt_close()} + +@findex @code{mysql_stmt_close()} + +@code{my_bool mysql_stmt_close(MYSQL_STMT *)} + +@subsubheading Description + +Closes the prepared statement. @code{mysql_stmt_close()} also +deallocates the statement handle pointed to by @code{stmt}. + +@subsubheading Return Values + +Zero if the statement was freed successfully. Non-zero if an error occured. + + +@subsubheading Errors + +@table @code +@item CR_SERVER_GONE_ERROR +The MySQL server has gone away +@item CR_UNKNOWN_ERROR +An unkown error occured +@end table + +@subsubheading Example + +For the usage of @code{mysql_stmt_close()} refer to the Example from +@ref{mysql_execute,mysql_execute()}. + + + +@node mysql_stmt_errno, mysql_stmt_error, mysql_stmt_close, C Prepared statement functions +@subsubsection @code{mysql_stmt_errno()} + + +@findex @code{mysql_stmt_errno()} + +@code{unsigned int mysql_stmt_errno(MYSQL_STMT *stmt)} + +@subsubheading Description + +For the statement specified by @code{stmt}, @code{mysql_stmt_errno()} +returns the error code for the most recently invoked statement API +function that can succeed or fail. A return value of zero means that no +error occured. Client error message numbers are listed in the MySQL +errmsg.h header file. Server error message numbers are listed in +mysqld_error.h. In the MySQL source distribution you can find a complete +list of error messages and error numbers in the file Docs/mysqld_error.txt + +@subsubheading Return Values + +An error code value. Zero if no error occured. + +@subsubheading Errors + +None + + +@node mysql_stmt_error, mysql_commit, mysql_stmt_errno, C Prepared statement functions +@subsubsection @code{mysql_stmt_error()} + + +@findex @code{mysql_stmt_error()}. + +@code{char *mysql_stmt_error(MYSQL_STMT *stmt)} + +@subsubheading Description + +For the statement specified by @code{stmt}, @code{mysql_stmt_error()} +returns the error message for the most recently invoked statement API +that can succeed or fail. An empty string ("") is returned if no error +occured. This means the following two sets are equivalent: + +@example + +if (mysql_stmt_errno(stmt)) +@{ + // an error occured +@} + +if (mysql_stmt_error(stmt)) +@{ + // an error occured +@} +@end example + +The language of the client error messages many be changed by recompiling +the MySQL client library. Currently you can choose error messages in +several different languages. + + +@subsubheading Return Values + +A character string that describes the error. An empry string if no error +occured. + +@subsubheading Errors + +None + + + +@node mysql_commit, mysql_rollback, mysql_stmt_error, C Prepared statement functions +@subsubsection @code{mysql_commit()} + + +@findex @code{mysql_commit()}. + +@code{my_bool mysql_commit(MYSQL *mysql)} + +@subsubheading Description + +Commits the current transaction + +@subsubheading Return Values + +Zero if successful. Non-zero if an error occured. + +@subsubheading Errors + +None + + + +@node mysql_rollback, mysql_autocommit, mysql_commit, C Prepared statement functions +@subsubsection @code{mysql_rollback()} + + +@findex @code{mysql_rollback()}. + +@code{my_bool mysql_rollback(MYSQL *mysql)} + +@subsubheading Description + +Rollbacks the current transaction. + + +@subsubheading Return Values + +Zero if successful. Non-zero if an error occured. + +@subsubheading Errors + +None. + + + + +@node mysql_autocommit, , mysql_rollback, C Prepared statement functions +@subsubsection @code{mysql_autocommit()} + + +@findex @code{mysql_autocommit()}. + +@code{my_bool mysql_autocommit(MYSQL *mysql, my_bool mode)} + +@subsubheading Description + +Sets the autocommit mode to on or off. If the @code{mode} is '1', then it +sets the autocommit mode to on, else to off in case of '0'. + +@subsubheading Return Values + +Zero if successful. Non-zero if an error occured + +@subsubheading Errors + +None. + +@bye From 667a81eb27b2f8115576991d96689f73bbfdf46f Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 11 Jan 2003 00:36:13 -0800 Subject: [PATCH 211/220] Fix to make the tables re-inited for every execute call --- sql/sql_prepare.cc | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 092f7c7a497..3907995676f 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -628,7 +628,7 @@ static bool parse_prepare_query(PREP_STMT *stmt, Initialize parameter items in statement */ -static bool init_param_items( PREP_STMT *stmt) +static bool init_param_items(PREP_STMT *stmt) { List ¶ms= stmt->thd->lex.param_list; Item_param **to; @@ -642,6 +642,24 @@ static bool init_param_items( PREP_STMT *stmt) return 0; } +/* + Initialize stmt execution +*/ + +static void init_stmt_execute(PREP_STMT *stmt) +{ + THD *thd= stmt->thd; + TABLE_LIST *tables=(TABLE_LIST*) thd->lex.select_lex.table_list.first; + + /* + TODO: When the new table structure is ready, then have a status bit + to indicate the table is altered, and re-do the setup_* + and open the tables back. + */ + if (tables) + tables->table=0; //safety - nasty init +} + /* Parse the query and send the total number of parameters and resultset metadata information back to client (if any), @@ -722,6 +740,8 @@ void mysql_stmt_execute(THD *thd, char *packet) DBUG_VOID_RETURN; } + init_stmt_execute(stmt); + if (stmt->param_count && setup_params_data(stmt)) DBUG_VOID_RETURN; From b82f3bbefd732526d086267ae76e23d4cfa27cbb Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 12 Jan 2003 23:58:56 +0200 Subject: [PATCH 212/220] ut0mem.c, row0sel.c, row0mysql.c, ut0mem.h, row0sel.h, row0mysql.h: Test allocation of memory beforehand if we are trying to return a > 2 MB BLOB; normally InnoDB asserts if memory allocation fails ha_innodb.cc: Do not fetch all columns if change_active_index() is called during a query; a sum(a), max(a) query seemed to do that, doing unnecessary copying (the change actually made in the previous bk ci) Free BLOB heap of handle when MySQL calls some ::extra()'s sql/ha_innodb.cc: Do not fetch all columns if change_active_index() is called during a query; a sum(a), max(a) query seemed to do that, doing unnecessary copying (the change actually made in the previous bk ci) innobase/include/row0mysql.h: Test allocation of memory beforehand if we are trying to return a > 2 MB BLOB; normally InnoDB asserts if memory allocation fails innobase/include/row0sel.h: Test allocation of memory beforehand if we are trying to return a > 2 MB BLOB; normally InnoDB asserts if memory allocation fails innobase/include/ut0mem.h: Test allocation of memory beforehand if we are trying to return a > 2 MB BLOB; normally InnoDB asserts if memory allocation fails innobase/row/row0mysql.c: Test allocation of memory beforehand if we are trying to return a > 2 MB BLOB; normally InnoDB asserts if memory allocation fails innobase/row/row0sel.c: Test allocation of memory beforehand if we are trying to return a > 2 MB BLOB; normally InnoDB asserts if memory allocation fails innobase/ut/ut0mem.c: Test allocation of memory beforehand if we are trying to return a > 2 MB BLOB; normally InnoDB asserts if memory allocation fails --- innobase/include/row0mysql.h | 8 ++++++++ innobase/include/row0sel.h | 3 ++- innobase/include/ut0mem.h | 10 ++++++++++ innobase/row/row0mysql.c | 13 +++++++++++++ innobase/row/row0sel.c | 37 +++++++++++++++++++++++++++++++----- innobase/ut/ut0mem.c | 37 +++++++++++++++++++++++++++++++++++- sql/ha_innodb.cc | 34 ++++++++++++++++++++++----------- 7 files changed, 124 insertions(+), 18 deletions(-) diff --git a/innobase/include/row0mysql.h b/innobase/include/row0mysql.h index 25d2ab77007..972fabc74cf 100644 --- a/innobase/include/row0mysql.h +++ b/innobase/include/row0mysql.h @@ -52,6 +52,14 @@ row_mysql_read_var_ref_noninline( ulint* len, /* out: variable-length field length */ byte* field); /* in: field */ /*********************************************************************** +Frees the blob heap in prebuilt when no longer needed. */ + +void +row_mysql_prebuilt_free_blob_heap( +/*==============================*/ + row_prebuilt_t* prebuilt); /* in: prebuilt struct of a + ha_innobase:: table handle */ +/*********************************************************************** Stores a reference to a BLOB in the MySQL format. */ void diff --git a/innobase/include/row0sel.h b/innobase/include/row0sel.h index aa2da6fe5f6..cfc30852b87 100644 --- a/innobase/include/row0sel.h +++ b/innobase/include/row0sel.h @@ -115,7 +115,8 @@ row_search_for_mysql( /*=================*/ /* out: DB_SUCCESS, DB_RECORD_NOT_FOUND, - DB_END_OF_INDEX, or DB_DEADLOCK */ + DB_END_OF_INDEX, DB_DEADLOCK, + or DB_TOO_BIG_RECORD */ byte* buf, /* in/out: buffer for the fetched row in the MySQL format */ ulint mode, /* in: search mode PAGE_CUR_L, ... */ diff --git a/innobase/include/ut0mem.h b/innobase/include/ut0mem.h index 09e0d800685..d3d04d58596 100644 --- a/innobase/include/ut0mem.h +++ b/innobase/include/ut0mem.h @@ -50,6 +50,16 @@ ut_malloc( /* out, own: allocated memory */ ulint n); /* in: number of bytes to allocate */ /************************************************************************** +Tests if malloc of n bytes would succeed. ut_malloc() asserts if memory runs +out. It cannot be used if we want to return an error message. Prints to +stderr a message if fails. */ + +ibool +ut_test_malloc( +/*===========*/ + /* out: TRUE if succeeded */ + ulint n); /* in: try to allocate this many bytes */ +/************************************************************************** Frees a memory bloock allocated with ut_malloc. */ void diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index ba56b3071cd..7cef63d1337 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -58,6 +58,19 @@ row_mysql_read_var_ref_noninline( return(row_mysql_read_var_ref(len, field)); } +/*********************************************************************** +Frees the blob heap in prebuilt when no longer needed. */ + +void +row_mysql_prebuilt_free_blob_heap( +/*==============================*/ + row_prebuilt_t* prebuilt) /* in: prebuilt struct of a + ha_innobase:: table handle */ +{ + mem_heap_free(prebuilt->blob_heap); + prebuilt->blob_heap = NULL; +} + /*********************************************************************** Stores a reference to a BLOB in the MySQL format. */ diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c index ea5b3020c08..34f951b0c8a 100644 --- a/innobase/row/row0sel.c +++ b/innobase/row/row0sel.c @@ -2039,9 +2039,12 @@ Note that the template in prebuilt may advise us to copy only a few columns to mysql_rec, other columns are left blank. All columns may not be needed in the query. */ static -void +ibool row_sel_store_mysql_rec( /*====================*/ + /* out: TRUE if success, FALSE + if could not allocate memory for a + BLOB */ byte* mysql_rec, /* out: row in the MySQL format */ row_prebuilt_t* prebuilt, /* in: prebuilt struct */ rec_t* rec) /* in: Innobase record in the index @@ -2092,7 +2095,19 @@ row_sel_store_mysql_rec( if (templ->type == DATA_BLOB) { ut_a(prebuilt->templ_contains_blob); - + + /* A heuristic test that we can allocate + the memory for a big BLOB. We have a safety + margin of 1000000 bytes. Since the test + takes some CPU time, we do not use for small + BLOBs. */ + + if (len > 2000000 + && !ut_test_malloc(len + 1000000)) { + + return(FALSE); + } + /* Copy the BLOB data to the BLOB heap of prebuilt */ @@ -2142,6 +2157,8 @@ row_sel_store_mysql_rec( } } } + + return(TRUE); } /************************************************************************* @@ -2526,7 +2543,8 @@ row_search_for_mysql( /*=================*/ /* out: DB_SUCCESS, DB_RECORD_NOT_FOUND, - DB_END_OF_INDEX, or DB_DEADLOCK */ + DB_END_OF_INDEX, DB_DEADLOCK, + or DB_TOO_BIG_RECORD */ byte* buf, /* in/out: buffer for the fetched row in the MySQL format */ ulint mode, /* in: search mode PAGE_CUR_L, ... */ @@ -2758,7 +2776,12 @@ row_search_for_mysql( #ifdef UNIV_SEARCH_DEBUG ut_a(0 == cmp_dtuple_rec(search_tuple, rec)); #endif - row_sel_store_mysql_rec(buf, prebuilt, rec); + if (!row_sel_store_mysql_rec(buf, prebuilt, + rec)) { + err = DB_TOO_BIG_RECORD; + + goto lock_wait_or_error; + } mtr_commit(&mtr); @@ -3200,7 +3223,11 @@ rec_loop: rec_get_size(rec)); mach_write_to_4(buf, rec_get_extra_size(rec) + 4); } else { - row_sel_store_mysql_rec(buf, prebuilt, rec); + if (!row_sel_store_mysql_rec(buf, prebuilt, rec)) { + err = DB_TOO_BIG_RECORD; + + goto lock_wait_or_error; + } } if (prebuilt->clust_index_was_generated) { diff --git a/innobase/ut/ut0mem.c b/innobase/ut/ut0mem.c index 03f15031fdf..a5991d5683d 100644 --- a/innobase/ut/ut0mem.c +++ b/innobase/ut/ut0mem.c @@ -77,8 +77,9 @@ ut_malloc_low( ret = malloc(n + sizeof(ut_mem_block_t)); if (ret == NULL) { + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Fatal error: cannot allocate %lu bytes of\n" + " InnoDB: Fatal error: cannot allocate %lu bytes of\n" "InnoDB: memory with malloc! Total allocated memory\n" "InnoDB: by InnoDB %lu bytes. Operating system errno: %d\n" "InnoDB: Cannot continue operation!\n" @@ -134,6 +135,40 @@ ut_malloc( return(ut_malloc_low(n, TRUE)); } +/************************************************************************** +Tests if malloc of n bytes would succeed. ut_malloc() asserts if memory runs +out. It cannot be used if we want to return an error message. Prints to +stderr a message if fails. */ + +ibool +ut_test_malloc( +/*===========*/ + /* out: TRUE if succeeded */ + ulint n) /* in: try to allocate this many bytes */ +{ + void* ret; + + ret = malloc(n); + + if (ret == NULL) { + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Error: cannot allocate %lu bytes of memory for\n" + "InnoDB: a BLOB with malloc! Total allocated memory\n" + "InnoDB: by InnoDB %lu bytes. Operating system errno: %d\n" + "InnoDB: Check if you should increase the swap file or\n" + "InnoDB: ulimits of your operating system.\n" + "InnoDB: On FreeBSD check you have compiled the OS with\n" + "InnoDB: a big enough maximum process size.\n", + n, ut_total_allocated_memory, errno); + return(FALSE); + } + + free(ret); + + return(TRUE); +} + /************************************************************************** Frees a memory block allocated with ut_malloc. */ diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 0d56f216b3b..cfec8282e42 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -1624,6 +1624,12 @@ build_template( } if (prebuilt->select_lock_type == LOCK_X) { + /* In versions < 3.23.50 we always retrieved the clustered + index record if prebuilt->select_lock_type == LOCK_S, + but there is really not need for that, and in some cases + performance could be seriously degraded because the MySQL + optimizer did not know about our convention! */ + /* We always retrieve the whole clustered index record if we use exclusive row level locks, for example, if the read is done in an UPDATE statement. */ @@ -1632,12 +1638,6 @@ build_template( } if (templ_type == ROW_MYSQL_REC_FIELDS) { - /* In versions < 3.23.50 we always retrieved the clustered - index record if prebuilt->select_lock_type == LOCK_S, - but there is really not need for that, and in some cases - performance could be seriously degraded because the MySQL - optimizer did not know about our convention! */ - index = prebuilt->index; } else { index = clust_index; @@ -2506,11 +2506,13 @@ ha_innobase::change_active_index( dict_index_copy_types(prebuilt->search_tuple, prebuilt->index, prebuilt->index->n_fields); - /* Maybe MySQL changes the active index for a handle also - during some queries, we do not know: then it is safest to build - the template such that all columns will be fetched */ + /* MySQL changes the active index for a handle also during some + queries, for example SELECT MAX(a), SUM(a) first retrieves the MAX() + and then calculates te sum. Previously we played safe and used + the flag ROW_MYSQL_WHOLE_ROW below, but that caused unnecessary + copying. Starting from MySQL-4.1 we use a more efficient flag here. */ - build_template(prebuilt, user_thd, table, ROW_MYSQL_WHOLE_ROW); + build_template(prebuilt, user_thd, table, ROW_MYSQL_REC_FIELDS); DBUG_RETURN(0); } @@ -3742,8 +3744,18 @@ ha_innobase::extra( obsolete! */ switch (operation) { + case HA_EXTRA_FLUSH: + if (prebuilt->blob_heap) { + row_mysql_prebuilt_free_blob_heap(prebuilt); + } + break; case HA_EXTRA_RESET: - case HA_EXTRA_RESET_STATE: + if (prebuilt->blob_heap) { + row_mysql_prebuilt_free_blob_heap(prebuilt); + } + prebuilt->read_just_key = 0; + break; + case HA_EXTRA_RESET_STATE: prebuilt->read_just_key = 0; break; case HA_EXTRA_NO_KEYREAD: From d2503a04ee18eeb2c0b5b0056d600955f15958e1 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 13 Jan 2003 16:36:04 +0400 Subject: [PATCH 213/220] Fix for spatial objects --- sql/item_strfunc.cc | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 7818a23fcd8..963dd6968f4 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2771,10 +2771,8 @@ String *Item_func_spatial_collection::val_str(String *str) uint32 n_points; double x1, y1, x2, y2; - if (len < WKB_HEADER_SIZE + 4 + 8 + 8) + if (len < 4 + 2 * POINT_DATA_SIZE) goto ret; - data+=WKB_HEADER_SIZE; - len-=WKB_HEADER_SIZE; uint32 llen=len; const char *ldata=data; @@ -2786,10 +2784,6 @@ String *Item_func_spatial_collection::val_str(String *str) float8get(y1,data); data+=8; - len-= 4 + 8 + 8; - - if (len < n_points * POINT_DATA_SIZE) - goto ret; data+=(n_points-2) * POINT_DATA_SIZE; float8get(x2,data); From 2b174c6da1dfab048d67a6788c5446d72dcd1572 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 13 Jan 2003 18:20:59 +0200 Subject: [PATCH 214/220] sql_handler.cc: Fix InnoDB HANDLER: InnoDB must know in each call that the handle is used by HANDLER; the previous implementation worked only by pure luck sql/sql_handler.cc: Fix InnoDB HANDLER: InnoDB must know in each call that the handle is used by HANDLER; the previous implementation worked only by pure luck --- sql/sql_handler.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 97703cd6b20..0d8af46dbf6 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -109,6 +109,10 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, if (cond && (cond->check_cols(1) || cond->fix_fields(thd, tables, &cond))) return -1; + /* InnoDB needs to know that this table handle is used in the HANDLER */ + + table->file->init_table_handle_for_HANDLER(); + if (keyname) { if ((keyno=find_type(keyname, &table->keynames, 1+2)-1)<0) @@ -131,8 +135,6 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, insert_fields(thd,tables,tables->db,tables->alias,&it); - table->file->init_table_handle_for_HANDLER(); // Only InnoDB requires it - select_limit+=offset_limit; protocol->send_fields(&list,1); @@ -142,6 +144,12 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, if (!lock) goto err0; // mysql_lock_tables() printed error message already + /* In ::external_lock InnoDB resets the fields which tell it that + the handle is used in the HANDLER interface. Tell it again that + we are using it for HANDLER. */ + + table->file->init_table_handle_for_HANDLER(); + for (num_rows=0; num_rows < select_limit; ) { switch (mode) { From aef4ae161aaa2d59a2cf0d037e5fabe59da8a5a1 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 13 Jan 2003 23:25:55 +0200 Subject: [PATCH 215/220] ha_innodb.cc: Added some assertions to make sure index_init is only called with a properly prepared InnoDB table handle sql/ha_innodb.cc: Added some assertions to make sure index_init is only called with a properly prepared InnoDB table handle --- sql/ha_innodb.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index cfec8282e42..cb012d33572 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -1600,6 +1600,8 @@ build_template( ibool fetch_all_in_key = FALSE; ulint i; + ut_a(templ_type != ROW_MYSQL_REC_FIELDS || thd == current_thd); + clust_index = dict_table_get_first_index_noninline(prebuilt->table); if (!prebuilt->hint_no_need_to_fetch_extra_cols) { @@ -2466,7 +2468,9 @@ ha_innobase::index_read_last( } /************************************************************************ -Changes the active index of a handle. */ +Changes the active index of a handle. Note that since we build also the +template for a search, update_thd() must already have been called, in +::external_lock, for example. */ int ha_innobase::change_active_index( @@ -2481,6 +2485,10 @@ ha_innobase::change_active_index( statistic_increment(ha_read_key_count, &LOCK_status); DBUG_ENTER("change_active_index"); + ut_a(prebuilt->trx == + (trx_t*) current_thd->transaction.all.innobase_tid); + ut_a(user_thd == current_thd); + active_index = keynr; if (keynr != MAX_KEY && table->keys > 0) { From 5e88e69963c64a83501a09362938cacb0ff9a707 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 Jan 2003 11:32:40 +0400 Subject: [PATCH 216/220] Some reorganization to move loading related code to /strings library. This is to reuse code in conf_to_src.c --- mysys/charset.c | 477 +++++++++++++++++++++++++----------------------- 1 file changed, 244 insertions(+), 233 deletions(-) diff --git a/mysys/charset.c b/mysys/charset.c index 8d852fd99c2..4216de67c7e 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -22,17 +22,7 @@ #include -static void set_max_sort_char(CHARSET_INFO *cs); -static my_bool create_fromuni(CHARSET_INFO *cs); - - -#define MY_CHARSET_INDEX "Index.xml" - -const char *charsets_dir= NULL; -static int charset_initialized=0; - -#define MAX_LINE 1024 - +#define CS_MAX_NM_LEN 32 #define CTYPE_TABLE_SIZE 257 #define TO_LOWER_TABLE_SIZE 256 #define TO_UPPER_TABLE_SIZE 256 @@ -40,38 +30,13 @@ static int charset_initialized=0; #define TO_UNI_TABLE_SIZE 256 -char *get_charsets_dir(char *buf) -{ - const char *sharedir= SHAREDIR; - DBUG_ENTER("get_charsets_dir"); - - if (charsets_dir != NULL) - strmake(buf, charsets_dir, FN_REFLEN-1); - else - { - if (test_if_hard_path(sharedir) || - is_prefix(sharedir, DEFAULT_CHARSET_HOME)) - strxmov(buf, sharedir, "/", CHARSET_DIR, NullS); - else - strxmov(buf, DEFAULT_CHARSET_HOME, "/", sharedir, "/", CHARSET_DIR, - NullS); - } - convert_dirname(buf,buf,NullS); - DBUG_PRINT("info",("charsets dir: '%s'", buf)); - DBUG_RETURN(strend(buf)); -} - - -#define MAX_BUF 1024*16 - -#ifndef DBUG_OFF -static void mstr(char *str,const char *src,uint l1,uint l2) +static char *mstr(char *str,const char *src,uint l1,uint l2) { l1= l1like_range = my_like_range_simple; - cs->wildcmp = my_wildcmp_8bit; - cs->strnncoll = my_strnncoll_simple; - cs->caseup_str = my_caseup_str_8bit; - cs->casedn_str = my_casedn_str_8bit; - cs->caseup = my_caseup_8bit; - cs->casedn = my_casedn_8bit; - cs->tosort = my_tosort_8bit; - cs->strcasecmp = my_strcasecmp_8bit; - cs->strncasecmp = my_strncasecmp_8bit; - cs->mb_wc = my_mb_wc_8bit; - cs->wc_mb = my_wc_mb_8bit; - cs->hash_caseup = my_hash_caseup_simple; - cs->hash_sort = my_hash_sort_simple; - cs->snprintf = my_snprintf_8bit; - cs->strntol = my_strntol_8bit; - cs->strntoul = my_strntoul_8bit; - cs->strntoll = my_strntoll_8bit; - cs->strntoull = my_strntoull_8bit; - cs->strntod = my_strntod_8bit; - cs->mbmaxlen = 1; -} - - -static void simple_cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from) -{ - to->number= from->number ? from->number : to->number; - to->state|= from->state; - - if (from->csname) - to->csname= my_once_strdup(from->csname,MYF(MY_WME)); - - if (from->name) - to->name= my_once_strdup(from->name,MYF(MY_WME)); - - if (from->ctype) - to->ctype= (uchar*) my_once_memdup((char*) from->ctype, - CTYPE_TABLE_SIZE, MYF(MY_WME)); - if (from->to_lower) - to->to_lower= (uchar*) my_once_memdup((char*) from->to_lower, - TO_LOWER_TABLE_SIZE, MYF(MY_WME)); - if (from->to_upper) - to->to_upper= (uchar*) my_once_memdup((char*) from->to_upper, - TO_UPPER_TABLE_SIZE, MYF(MY_WME)); - if (from->sort_order) - { - to->sort_order= (uchar*) my_once_memdup((char*) from->sort_order, - SORT_ORDER_TABLE_SIZE, - MYF(MY_WME)); - set_max_sort_char(to); - } - if (from->tab_to_uni) - { - uint sz=TO_UNI_TABLE_SIZE*sizeof(uint16); - to->tab_to_uni= (uint16*) my_once_memdup((char*)from->tab_to_uni, sz, - MYF(MY_WME)); - create_fromuni(to); - } -} - - -static my_bool simple_cs_is_full(CHARSET_INFO *cs) -{ - return ((cs->csname && cs->tab_to_uni && cs->ctype && cs->to_upper && - cs->to_lower) && - (cs->number && cs->name && cs->sort_order)); -} static int fill_uchar(uchar *a,uint size,const char *str, uint len) @@ -273,37 +168,16 @@ static int cs_leave(MY_XML_PARSER *st,const char *attr, uint len) struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; struct my_cs_file_section_st *s= cs_file_sec(attr,len); int state= s ? s->state : 0; + int rc; - if (state == _CS_COLLATION) - { - if (i->cs.name && (i->cs.number || - (i->cs.number=get_charset_number(i->cs.name)))) - { - if (!all_charsets[i->cs.number]) - { - if (!(all_charsets[i->cs.number]= - (CHARSET_INFO*) my_once_alloc(sizeof(CHARSET_INFO),i->myflags))) - return MY_XML_ERROR; - bzero((void*)all_charsets[i->cs.number],sizeof(CHARSET_INFO)); - } - - if (!(all_charsets[i->cs.number]->state & MY_CS_COMPILED)) - { - simple_cs_copy_data(all_charsets[i->cs.number],&i->cs); - if (simple_cs_is_full(all_charsets[i->cs.number])) - { - simple_cs_init_functions(all_charsets[i->cs.number]); - all_charsets[i->cs.number]->state |= MY_CS_LOADED; - } - } - i->cs.number= 0; - i->cs.name= NULL; - i->cs.state= 0; - i->cs.sort_order= NULL; - i->cs.state= 0; - } + switch(state){ + case _CS_COLLATION: + rc= i->add_collation ? i->add_collation(&i->cs) : MY_XML_OK; + break; + default: + rc=MY_XML_OK; } - return MY_XML_OK; + return rc; } @@ -326,14 +200,10 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len) i->cs.number= my_strntoul(my_charset_latin1,attr,len,(char**)NULL,0); break; case _CS_COLNAME: - memcpy(i->name,attr,len=min(len,CS_MAX_NM_LEN-1)); - i->name[len]='\0'; - i->cs.name=i->name; + i->cs.name=mstr(i->name,attr,len,CS_MAX_NM_LEN-1); break; - case _CS_NAME: - memcpy(i->csname,attr,len=min(len,CS_MAX_NM_LEN-1)); - i->csname[len]='\0'; - i->cs.csname=i->csname; + case _CS_CSNAME: + i->cs.csname=mstr(i->csname,attr,len,CS_MAX_NM_LEN-1); break; case _CS_FLAG: if (!strncmp("primary",attr,len)) @@ -364,49 +234,6 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len) } -static my_bool read_charset_index(const char *filename, myf myflags) -{ - char *buf; - int fd; - uint len; - MY_XML_PARSER p; - struct my_cs_file_info i; - - if (!(buf= (char *)my_malloc(MAX_BUF,myflags))) - return FALSE; - - strmov(get_charsets_dir(buf), filename); - - if ((fd=my_open(buf,O_RDONLY,myflags)) < 0) - { - my_free(buf,myflags); - return TRUE; - } - - len=read(fd,buf,MAX_BUF); - my_xml_parser_create(&p); - my_close(fd,myflags); - - my_xml_set_enter_handler(&p,cs_enter); - my_xml_set_value_handler(&p,cs_value); - my_xml_set_leave_handler(&p,cs_leave); - my_xml_set_user_data(&p,(void*)&i); - - if (my_xml_parse(&p,buf,len) != MY_XML_OK) - { -#ifdef NOT_YET - printf("ERROR at line %d pos %d '%s'\n", - my_xml_error_lineno(&p)+1, - my_xml_error_pos(&p), - my_xml_error_string(&p)); -#endif - } - - my_xml_parser_free(&p); - my_free(buf, myflags); - return FALSE; -} - static void set_max_sort_char(CHARSET_INFO *cs) { uchar max_char; @@ -426,48 +253,30 @@ static void set_max_sort_char(CHARSET_INFO *cs) } } -static my_bool init_available_charsets(myf myflags) + +static void simple_cs_init_functions(CHARSET_INFO *cs) { - my_bool error=FALSE; - /* - We have to use charset_initialized to not lock on THR_LOCK_charset - inside get_internal_charset... - */ - if (!charset_initialized) - { - CHARSET_INFO **cs; - /* - To make things thread safe we are not allowing other threads to interfere - while we may changing the cs_info_table - */ - pthread_mutex_lock(&THR_LOCK_charset); - - bzero(&all_charsets,sizeof(all_charsets)); - init_compiled_charsets(myflags); - - /* Copy compiled charsets */ - for (cs=all_charsets; cs < all_charsets+255 ; cs++) - { - if (*cs) - set_max_sort_char(*cs); - } - error= read_charset_index(MY_CHARSET_INDEX,myflags); - charset_initialized=1; - pthread_mutex_unlock(&THR_LOCK_charset); - } - return error; -} - - -void free_charsets(void) -{ - charset_initialized=0; -} - - -static void get_charset_conf_name(const char *cs_name, char *buf) -{ - strxmov(get_charsets_dir(buf), cs_name, ".conf", NullS); + cs->like_range = my_like_range_simple; + cs->wildcmp = my_wildcmp_8bit; + cs->strnncoll = my_strnncoll_simple; + cs->caseup_str = my_caseup_str_8bit; + cs->casedn_str = my_casedn_str_8bit; + cs->caseup = my_caseup_8bit; + cs->casedn = my_casedn_8bit; + cs->tosort = my_tosort_8bit; + cs->strcasecmp = my_strcasecmp_8bit; + cs->strncasecmp = my_strncasecmp_8bit; + cs->mb_wc = my_mb_wc_8bit; + cs->wc_mb = my_wc_mb_8bit; + cs->hash_caseup = my_hash_caseup_simple; + cs->hash_sort = my_hash_sort_simple; + cs->snprintf = my_snprintf_8bit; + cs->strntol = my_strntol_8bit; + cs->strntoul = my_strntoul_8bit; + cs->strntoll = my_strntoll_8bit; + cs->strntoull = my_strntoull_8bit; + cs->strntod = my_strntod_8bit; + cs->mbmaxlen = 1; } @@ -563,6 +372,208 @@ static my_bool create_fromuni(CHARSET_INFO *cs) } +static void simple_cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from) +{ + to->number= from->number ? from->number : to->number; + to->state|= from->state; + + if (from->csname) + to->csname= my_once_strdup(from->csname,MYF(MY_WME)); + + if (from->name) + to->name= my_once_strdup(from->name,MYF(MY_WME)); + + if (from->ctype) + to->ctype= (uchar*) my_once_memdup((char*) from->ctype, + CTYPE_TABLE_SIZE, MYF(MY_WME)); + if (from->to_lower) + to->to_lower= (uchar*) my_once_memdup((char*) from->to_lower, + TO_LOWER_TABLE_SIZE, MYF(MY_WME)); + if (from->to_upper) + to->to_upper= (uchar*) my_once_memdup((char*) from->to_upper, + TO_UPPER_TABLE_SIZE, MYF(MY_WME)); + if (from->sort_order) + { + to->sort_order= (uchar*) my_once_memdup((char*) from->sort_order, + SORT_ORDER_TABLE_SIZE, + MYF(MY_WME)); + set_max_sort_char(to); + } + if (from->tab_to_uni) + { + uint sz=TO_UNI_TABLE_SIZE*sizeof(uint16); + to->tab_to_uni= (uint16*) my_once_memdup((char*)from->tab_to_uni, sz, + MYF(MY_WME)); + create_fromuni(to); + } +} + + +static my_bool simple_cs_is_full(CHARSET_INFO *cs) +{ + return ((cs->csname && cs->tab_to_uni && cs->ctype && cs->to_upper && + cs->to_lower) && + (cs->number && cs->name && cs->sort_order)); +} + + +static int add_collation(CHARSET_INFO *cs) +{ + if (cs->name && (cs->number || (cs->number=get_charset_number(cs->name)))) + { + if (!all_charsets[cs->number]) + { + if (!(all_charsets[cs->number]= + (CHARSET_INFO*) my_once_alloc(sizeof(CHARSET_INFO),MYF(0)))) + return MY_XML_ERROR; + bzero((void*)all_charsets[cs->number],sizeof(CHARSET_INFO)); + } + + if (!(all_charsets[cs->number]->state & MY_CS_COMPILED)) + { + simple_cs_copy_data(all_charsets[cs->number],cs); + if (simple_cs_is_full(all_charsets[cs->number])) + { + simple_cs_init_functions(all_charsets[cs->number]); + all_charsets[cs->number]->state |= MY_CS_LOADED; + } + } + cs->number= 0; + cs->name= NULL; + cs->state= 0; + cs->sort_order= NULL; + cs->state= 0; + } + return MY_XML_OK; +} + + +static my_bool my_parse_charset_xml(const char *buf, uint len) +{ + MY_XML_PARSER p; + struct my_cs_file_info i; + my_bool rc; + + my_xml_parser_create(&p); + my_xml_set_enter_handler(&p,cs_enter); + my_xml_set_value_handler(&p,cs_value); + my_xml_set_leave_handler(&p,cs_leave); + i.add_collation= add_collation; + my_xml_set_user_data(&p,(void*)&i); + rc= (my_xml_parse(&p,buf,len) == MY_XML_OK) ? FALSE : TRUE; + my_xml_parser_free(&p); + return rc; +} + + +#define MAX_BUF 1024*16 +#define MY_CHARSET_INDEX "Index.xml" + +const char *charsets_dir= NULL; +static int charset_initialized=0; + + +static my_bool my_read_charset_file(const char *filename, myf myflags) +{ + char *buf; + int fd; + uint len; + + if (!(buf= (char *)my_malloc(MAX_BUF,myflags))) + return FALSE; + + if ((fd=my_open(filename,O_RDONLY,myflags)) < 0) + { + my_free(buf,myflags); + return TRUE; + } + len=read(fd,buf,MAX_BUF); + my_close(fd,myflags); + + if (my_parse_charset_xml(buf,len)) + { +#ifdef NOT_YET + printf("ERROR at line %d pos %d '%s'\n", + my_xml_error_lineno(&p)+1, + my_xml_error_pos(&p), + my_xml_error_string(&p)); +#endif + } + + my_free(buf, myflags); + return FALSE; +} + + +char *get_charsets_dir(char *buf) +{ + const char *sharedir= SHAREDIR; + DBUG_ENTER("get_charsets_dir"); + + if (charsets_dir != NULL) + strmake(buf, charsets_dir, FN_REFLEN-1); + else + { + if (test_if_hard_path(sharedir) || + is_prefix(sharedir, DEFAULT_CHARSET_HOME)) + strxmov(buf, sharedir, "/", CHARSET_DIR, NullS); + else + strxmov(buf, DEFAULT_CHARSET_HOME, "/", sharedir, "/", CHARSET_DIR, + NullS); + } + convert_dirname(buf,buf,NullS); + DBUG_PRINT("info",("charsets dir: '%s'", buf)); + DBUG_RETURN(strend(buf)); +} + +static my_bool init_available_charsets(myf myflags) +{ + char fname[FN_REFLEN]; + my_bool error=FALSE; + /* + We have to use charset_initialized to not lock on THR_LOCK_charset + inside get_internal_charset... + */ + if (!charset_initialized) + { + CHARSET_INFO **cs; + /* + To make things thread safe we are not allowing other threads to interfere + while we may changing the cs_info_table + */ + pthread_mutex_lock(&THR_LOCK_charset); + + bzero(&all_charsets,sizeof(all_charsets)); + init_compiled_charsets(myflags); + + /* Copy compiled charsets */ + for (cs=all_charsets; cs < all_charsets+255 ; cs++) + { + if (*cs) + set_max_sort_char(*cs); + } + + strmov(get_charsets_dir(fname), MY_CHARSET_INDEX); + error= my_read_charset_file(fname,myflags); + charset_initialized=1; + pthread_mutex_unlock(&THR_LOCK_charset); + } + return error; +} + + +void free_charsets(void) +{ + charset_initialized=0; +} + + +static void get_charset_conf_name(const char *cs_name, char *buf) +{ + strxmov(get_charsets_dir(buf), cs_name, ".conf", NullS); +} + + uint get_charset_number(const char *charset_name) { CHARSET_INFO **cs; @@ -606,8 +617,8 @@ static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags) if (cs && !(cs->state & (MY_CS_COMPILED | MY_CS_LOADED))) { - strxmov(buf, cs->csname, ".xml", NullS); - read_charset_index(buf,flags); + strxmov(get_charsets_dir(buf), cs->csname, ".xml", NullS); + my_read_charset_file(buf,flags); cs= (cs->state & MY_CS_LOADED) ? cs : NULL; } pthread_mutex_unlock(&THR_LOCK_charset); From 50989ef2032201d2f969082196d546f8a04368b5 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 Jan 2003 13:36:22 +0400 Subject: [PATCH 217/220] Charset loading has been moved to /string library --- include/m_ctype.h | 10 +- mysys/charset.c | 241 ++-------------------------------------------- strings/ctype.c | 223 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 238 insertions(+), 236 deletions(-) diff --git a/include/m_ctype.h b/include/m_ctype.h index 85397796e73..f141e592d8c 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -27,6 +27,13 @@ extern "C" { #endif +#define MY_CS_NAME_SIZE 32 +#define MY_CS_CTYPE_TABLE_SIZE 257 +#define MY_CS_TO_LOWER_TABLE_SIZE 256 +#define MY_CS_TO_UPPER_TABLE_SIZE 256 +#define MY_CS_SORT_ORDER_TABLE_SIZE 256 +#define MY_CS_TO_UNI_TABLE_SIZE 256 + #define CHARSET_DIR "charsets/" #define my_wc_t ulong @@ -145,7 +152,8 @@ extern CHARSET_INFO *default_charset_info; extern CHARSET_INFO *system_charset_info; extern CHARSET_INFO *all_charsets[256]; extern my_bool init_compiled_charsets(myf flags); - +extern my_bool my_parse_charset_xml(const char *bug, uint len, + int (*add)(CHARSET_INFO *cs)); /* declarations for simple charsets */ extern int my_strnxfrm_simple(CHARSET_INFO *, uchar *, uint, const uchar *, uint); diff --git a/mysys/charset.c b/mysys/charset.c index 4216de67c7e..c89e1d60c7e 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -22,217 +22,6 @@ #include -#define CS_MAX_NM_LEN 32 -#define CTYPE_TABLE_SIZE 257 -#define TO_LOWER_TABLE_SIZE 256 -#define TO_UPPER_TABLE_SIZE 256 -#define SORT_ORDER_TABLE_SIZE 256 -#define TO_UNI_TABLE_SIZE 256 - - -static char *mstr(char *str,const char *src,uint l1,uint l2) -{ - l1= l1str; s++) - { - if (!strncmp(attr,s->str,len)) - return s; - } - return NULL; -} - -struct my_cs_file_info -{ - char csname[CS_MAX_NM_LEN]; - char name[CS_MAX_NM_LEN]; - uchar ctype[CTYPE_TABLE_SIZE]; - uchar to_lower[TO_LOWER_TABLE_SIZE]; - uchar to_upper[TO_UPPER_TABLE_SIZE]; - uchar sort_order[SORT_ORDER_TABLE_SIZE]; - uint16 tab_to_uni[TO_UNI_TABLE_SIZE]; - CHARSET_INFO cs; - myf myflags; - int (*add_collation)(CHARSET_INFO *cs); -}; - - - -static int fill_uchar(uchar *a,uint size,const char *str, uint len) -{ - uint i= 0; - const char *s, *b, *e=str+len; - - for (s=str ; s < e ; i++) - { - for ( ; (s < e) && strchr(" \t\r\n",s[0]); s++) ; - b=s; - for ( ; (s < e) && !strchr(" \t\r\n",s[0]); s++) ; - if (s == b || i > size) - break; - a[i]= my_strntoul(my_charset_latin1,b,s-b,NULL,16); - } - return 0; -} - -static int fill_uint16(uint16 *a,uint size,const char *str, uint len) -{ - uint i= 0; - const char *s, *b, *e=str+len; - for (s=str ; s < e ; i++) - { - for ( ; (s < e) && strchr(" \t\r\n",s[0]); s++) ; - b=s; - for ( ; (s < e) && !strchr(" \t\r\n",s[0]); s++) ; - if (s == b || i > size) - break; - a[i]= my_strntol(my_charset_latin1,b,s-b,NULL,16); - } - return 0; -} - - -static int cs_enter(MY_XML_PARSER *st,const char *attr, uint len) -{ - struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; - struct my_cs_file_section_st *s= cs_file_sec(attr,len); - - if ( s && (s->state == _CS_CHARSET)) - { - bzero(&i->cs,sizeof(i->cs)); - } - return MY_XML_OK; -} - - -static int cs_leave(MY_XML_PARSER *st,const char *attr, uint len) -{ - struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; - struct my_cs_file_section_st *s= cs_file_sec(attr,len); - int state= s ? s->state : 0; - int rc; - - switch(state){ - case _CS_COLLATION: - rc= i->add_collation ? i->add_collation(&i->cs) : MY_XML_OK; - break; - default: - rc=MY_XML_OK; - } - return rc; -} - - -static int cs_value(MY_XML_PARSER *st,const char *attr, uint len) -{ - struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; - struct my_cs_file_section_st *s; - int state= (s=cs_file_sec(st->attr,strlen(st->attr))) ? s->state : 0; - -#ifndef DBUG_OFF - if(0){ - char str[1024]; - mstr(str,attr,len,sizeof(str)-1); - printf("VALUE %d %s='%s'\n",state,st->attr,str); - } -#endif - - switch (state) { - case _CS_ID: - i->cs.number= my_strntoul(my_charset_latin1,attr,len,(char**)NULL,0); - break; - case _CS_COLNAME: - i->cs.name=mstr(i->name,attr,len,CS_MAX_NM_LEN-1); - break; - case _CS_CSNAME: - i->cs.csname=mstr(i->csname,attr,len,CS_MAX_NM_LEN-1); - break; - case _CS_FLAG: - if (!strncmp("primary",attr,len)) - i->cs.state|= MY_CS_PRIMARY; - break; - case _CS_UPPERMAP: - fill_uchar(i->to_upper,TO_UPPER_TABLE_SIZE,attr,len); - i->cs.to_upper=i->to_upper; - break; - case _CS_LOWERMAP: - fill_uchar(i->to_lower,TO_LOWER_TABLE_SIZE,attr,len); - i->cs.to_lower=i->to_lower; - break; - case _CS_UNIMAP: - fill_uint16(i->tab_to_uni,TO_UNI_TABLE_SIZE,attr,len); - i->cs.tab_to_uni=i->tab_to_uni; - break; - case _CS_COLLMAP: - fill_uchar(i->sort_order,SORT_ORDER_TABLE_SIZE,attr,len); - i->cs.sort_order=i->sort_order; - break; - case _CS_CTYPEMAP: - fill_uchar(i->ctype,CTYPE_TABLE_SIZE,attr,len); - i->cs.ctype=i->ctype; - break; - } - return MY_XML_OK; -} - static void set_max_sort_char(CHARSET_INFO *cs) { @@ -385,23 +174,23 @@ static void simple_cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from) if (from->ctype) to->ctype= (uchar*) my_once_memdup((char*) from->ctype, - CTYPE_TABLE_SIZE, MYF(MY_WME)); + MY_CS_CTYPE_TABLE_SIZE, MYF(MY_WME)); if (from->to_lower) to->to_lower= (uchar*) my_once_memdup((char*) from->to_lower, - TO_LOWER_TABLE_SIZE, MYF(MY_WME)); + MY_CS_TO_LOWER_TABLE_SIZE, MYF(MY_WME)); if (from->to_upper) to->to_upper= (uchar*) my_once_memdup((char*) from->to_upper, - TO_UPPER_TABLE_SIZE, MYF(MY_WME)); + MY_CS_TO_UPPER_TABLE_SIZE, MYF(MY_WME)); if (from->sort_order) { to->sort_order= (uchar*) my_once_memdup((char*) from->sort_order, - SORT_ORDER_TABLE_SIZE, + MY_CS_SORT_ORDER_TABLE_SIZE, MYF(MY_WME)); set_max_sort_char(to); } if (from->tab_to_uni) { - uint sz=TO_UNI_TABLE_SIZE*sizeof(uint16); + uint sz= MY_CS_TO_UNI_TABLE_SIZE*sizeof(uint16); to->tab_to_uni= (uint16*) my_once_memdup((char*)from->tab_to_uni, sz, MYF(MY_WME)); create_fromuni(to); @@ -448,24 +237,6 @@ static int add_collation(CHARSET_INFO *cs) } -static my_bool my_parse_charset_xml(const char *buf, uint len) -{ - MY_XML_PARSER p; - struct my_cs_file_info i; - my_bool rc; - - my_xml_parser_create(&p); - my_xml_set_enter_handler(&p,cs_enter); - my_xml_set_value_handler(&p,cs_value); - my_xml_set_leave_handler(&p,cs_leave); - i.add_collation= add_collation; - my_xml_set_user_data(&p,(void*)&i); - rc= (my_xml_parse(&p,buf,len) == MY_XML_OK) ? FALSE : TRUE; - my_xml_parser_free(&p); - return rc; -} - - #define MAX_BUF 1024*16 #define MY_CHARSET_INDEX "Index.xml" @@ -490,7 +261,7 @@ static my_bool my_read_charset_file(const char *filename, myf myflags) len=read(fd,buf,MAX_BUF); my_close(fd,myflags); - if (my_parse_charset_xml(buf,len)) + if (my_parse_charset_xml(buf,len,add_collation)) { #ifdef NOT_YET printf("ERROR at line %d pos %d '%s'\n", diff --git a/strings/ctype.c b/strings/ctype.c index 61fb57d9ac3..c2a7e928493 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -16,6 +16,7 @@ #include #include +#include #ifndef SCO #include #endif @@ -3895,6 +3896,228 @@ static CHARSET_INFO compiled_charsets[] = { }; +static char *mstr(char *str,const char *src,uint l1,uint l2) +{ + l1= l1str; s++) + { + if (!strncmp(attr,s->str,len)) + return s; + } + return NULL; +} + +typedef struct my_cs_file_info +{ + char csname[MY_CS_NAME_SIZE]; + char name[MY_CS_NAME_SIZE]; + uchar ctype[MY_CS_CTYPE_TABLE_SIZE]; + uchar to_lower[MY_CS_TO_LOWER_TABLE_SIZE]; + uchar to_upper[MY_CS_TO_UPPER_TABLE_SIZE]; + uchar sort_order[MY_CS_SORT_ORDER_TABLE_SIZE]; + uint16 tab_to_uni[MY_CS_TO_UNI_TABLE_SIZE]; + CHARSET_INFO cs; + int (*add_collation)(CHARSET_INFO *cs); +} MY_CHARSET_LOADER; + + + +static int fill_uchar(uchar *a,uint size,const char *str, uint len) +{ + uint i= 0; + const char *s, *b, *e=str+len; + + for (s=str ; s < e ; i++) + { + for ( ; (s < e) && strchr(" \t\r\n",s[0]); s++) ; + b=s; + for ( ; (s < e) && !strchr(" \t\r\n",s[0]); s++) ; + if (s == b || i > size) + break; + a[i]= my_strntoul(my_charset_latin1,b,s-b,NULL,16); + } + return 0; +} + +static int fill_uint16(uint16 *a,uint size,const char *str, uint len) +{ + uint i= 0; + const char *s, *b, *e=str+len; + for (s=str ; s < e ; i++) + { + for ( ; (s < e) && strchr(" \t\r\n",s[0]); s++) ; + b=s; + for ( ; (s < e) && !strchr(" \t\r\n",s[0]); s++) ; + if (s == b || i > size) + break; + a[i]= my_strntol(my_charset_latin1,b,s-b,NULL,16); + } + return 0; +} + + +static int cs_enter(MY_XML_PARSER *st,const char *attr, uint len) +{ + struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; + struct my_cs_file_section_st *s= cs_file_sec(attr,len); + + if ( s && (s->state == _CS_CHARSET)) + { + bzero(&i->cs,sizeof(i->cs)); + } + return MY_XML_OK; +} + + +static int cs_leave(MY_XML_PARSER *st,const char *attr, uint len) +{ + struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; + struct my_cs_file_section_st *s= cs_file_sec(attr,len); + int state= s ? s->state : 0; + int rc; + + switch(state){ + case _CS_COLLATION: + rc= i->add_collation ? i->add_collation(&i->cs) : MY_XML_OK; + break; + default: + rc=MY_XML_OK; + } + return rc; +} + + +static int cs_value(MY_XML_PARSER *st,const char *attr, uint len) +{ + struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; + struct my_cs_file_section_st *s; + int state= (s=cs_file_sec(st->attr,strlen(st->attr))) ? s->state : 0; + +#ifndef DBUG_OFF + if(0){ + char str[1024]; + mstr(str,attr,len,sizeof(str)-1); + printf("VALUE %d %s='%s'\n",state,st->attr,str); + } +#endif + + switch (state) { + case _CS_ID: + i->cs.number= my_strntoul(my_charset_latin1,attr,len,(char**)NULL,0); + break; + case _CS_COLNAME: + i->cs.name=mstr(i->name,attr,len,MY_CS_NAME_SIZE-1); + break; + case _CS_CSNAME: + i->cs.csname=mstr(i->csname,attr,len,MY_CS_NAME_SIZE-1); + break; + case _CS_FLAG: + if (!strncmp("primary",attr,len)) + i->cs.state|= MY_CS_PRIMARY; + break; + case _CS_UPPERMAP: + fill_uchar(i->to_upper,MY_CS_TO_UPPER_TABLE_SIZE,attr,len); + i->cs.to_upper=i->to_upper; + break; + case _CS_LOWERMAP: + fill_uchar(i->to_lower,MY_CS_TO_LOWER_TABLE_SIZE,attr,len); + i->cs.to_lower=i->to_lower; + break; + case _CS_UNIMAP: + fill_uint16(i->tab_to_uni,MY_CS_TO_UNI_TABLE_SIZE,attr,len); + i->cs.tab_to_uni=i->tab_to_uni; + break; + case _CS_COLLMAP: + fill_uchar(i->sort_order,MY_CS_SORT_ORDER_TABLE_SIZE,attr,len); + i->cs.sort_order=i->sort_order; + break; + case _CS_CTYPEMAP: + fill_uchar(i->ctype,MY_CS_CTYPE_TABLE_SIZE,attr,len); + i->cs.ctype=i->ctype; + break; + } + return MY_XML_OK; +} + + +my_bool my_parse_charset_xml(const char *buf, uint len, + int (*add_collation)(CHARSET_INFO *cs)) +{ + MY_XML_PARSER p; + struct my_cs_file_info i; + my_bool rc; + + my_xml_parser_create(&p); + my_xml_set_enter_handler(&p,cs_enter); + my_xml_set_value_handler(&p,cs_value); + my_xml_set_leave_handler(&p,cs_leave); + i.add_collation= add_collation; + my_xml_set_user_data(&p,(void*)&i); + rc= (my_xml_parse(&p,buf,len) == MY_XML_OK) ? FALSE : TRUE; + my_xml_parser_free(&p); + return rc; +} + + CHARSET_INFO *my_charset_latin1 = &compiled_charsets[0]; CHARSET_INFO *all_charsets[256]; CHARSET_INFO *default_charset_info = &compiled_charsets[0]; From 910c125bb6528b08f7c30b7b75650076b7b953fe Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 Jan 2003 14:28:36 +0200 Subject: [PATCH 218/220] Updates for multi-byte character sets (Note: test 'union' fails, but Sanja promised to fix this) include/m_ctype.h: Changed prototype for strntod() to inform the user that source may be modified. include/m_string.h: Moved my_vsnprintf to strings library include/my_sys.h: Moved my_vsnprintf to strings library libmysql/Makefile.shared: Moved my_vsnprintf to strings library mysql-test/r/alter_table.result: Moved my_vsnprintf to strings library mysql-test/r/create.result: Moved my_vsnprintf to strings library mysql-test/r/ctype_many.result: Moved my_vsnprintf to strings library mysql-test/r/fulltext.result: Moved my_vsnprintf to strings library mysql-test/r/innodb.result: Moved my_vsnprintf to strings library mysql-test/r/merge.result: Moved my_vsnprintf to strings library mysql-test/r/select.result: Moved my_vsnprintf to strings library mysql-test/r/show_check.result: Moved my_vsnprintf to strings library mysql-test/r/type_blob.result: Moved my_vsnprintf to strings library mysql-test/r/type_enum.result: Moved my_vsnprintf to strings library mysql-test/r/type_ranges.result: Moved my_vsnprintf to strings library mysql-test/r/type_set.result: Moved my_vsnprintf to strings library mysys/Makefile.am: Moved my_vsnprintf to strings library sql/field.cc: Fixed for character set handling sql/field.h: Fixed for character set handling sql/item.cc: Fixed for character set handling sql/item.h: Fixed for character set handling sql/item_func.cc: Fixed for character set handling sql/item_func.h: Fixed for character set handling sql/item_strfunc.cc: Fixed for character set handling sql/item_sum.cc: Fixed for character set handling sql/item_sum.h: Fixed for character set handling sql/item_timefunc.cc: Fixed for character set handling sql/mysqld.cc: Update to use new test_if_int() sql/opt_range.cc: Fixed for character set handling sql/procedure.h: Fixed for character set handling sql/sql_class.cc: Fixed for character set handling sql/sql_string.cc: Added multi byte support to append. Added set_latin1() sql/sql_string.h: Added set_latin1() sql/sql_update.cc: Cosmetic changes strings/Makefile.am: Moved my_vsnprintf to strings library strings/ctype-simple.c: Code review + cleanup strings/ctype-utf8.c: Fixed strntod() strings/my_vsnprintf.c: Added support for %#d and %#u --- include/m_ctype.h | 4 +- include/m_string.h | 6 + include/my_sys.h | 3 - libmysql/Makefile.shared | 4 +- mysql-test/r/alter_table.result | 4 +- mysql-test/r/create.result | 12 +- mysql-test/r/ctype_many.result | 8 +- mysql-test/r/fulltext.result | 2 +- mysql-test/r/innodb.result | 2 +- mysql-test/r/merge.result | 2 +- mysql-test/r/select.result | 16 +- mysql-test/r/show_check.result | 14 +- mysql-test/r/type_blob.result | 20 +- mysql-test/r/type_enum.result | 4 +- mysql-test/r/type_ranges.result | 34 +-- mysql-test/r/type_set.result | 4 +- mysys/Makefile.am | 2 +- sql/field.cc | 406 ++++++++++++++---------------- sql/field.h | 5 +- sql/item.cc | 17 +- sql/item.h | 8 +- sql/item_func.cc | 8 +- sql/item_func.h | 2 +- sql/item_strfunc.cc | 3 +- sql/item_sum.cc | 3 +- sql/item_sum.h | 3 +- sql/item_timefunc.cc | 2 +- sql/mysqld.cc | 7 +- sql/opt_range.cc | 2 +- sql/procedure.h | 5 +- sql/sql_class.cc | 6 +- sql/sql_string.cc | 158 ++++++++---- sql/sql_string.h | 1 + sql/sql_update.cc | 1 + strings/Makefile.am | 6 +- strings/ctype-simple.c | 186 ++++++-------- strings/ctype-utf8.c | 32 +-- {mysys => strings}/my_vsnprintf.c | 57 ++++- 38 files changed, 567 insertions(+), 492 deletions(-) rename {mysys => strings}/my_vsnprintf.c (74%) diff --git a/include/m_ctype.h b/include/m_ctype.h index 85397796e73..7f4a13f0fae 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -134,7 +134,7 @@ typedef struct charset_info_st ulong (*strntoul)(struct charset_info_st *, const char *s, uint l, char **e, int base); longlong (*strntoll)(struct charset_info_st *, const char *s, uint l, char **e, int base); ulonglong (*strntoull)(struct charset_info_st *, const char *s, uint l, char **e, int base); - double (*strntod)(struct charset_info_st *, const char *s, uint l, char **e); + double (*strntod)(struct charset_info_st *, char *s, uint l, char **e); } CHARSET_INFO; @@ -178,7 +178,7 @@ long my_strntol_8bit(CHARSET_INFO *, const char *s, uint l,char **e, int ulong my_strntoul_8bit(CHARSET_INFO *, const char *s, uint l,char **e, int base); longlong my_strntoll_8bit(CHARSET_INFO *, const char *s, uint l,char **e, int base); ulonglong my_strntoull_8bit(CHARSET_INFO *, const char *s, uint l,char **e, int base); -double my_strntod_8bit(CHARSET_INFO *, const char *s, uint l,char **e); +double my_strntod_8bit(CHARSET_INFO *, char *s, uint l,char **e); int my_l10tostr_8bit(CHARSET_INFO *, char *to, uint l, int radix, long int val); int my_ll10tostr_8bit(CHARSET_INFO *, char *to, uint l, int radix, longlong val); diff --git a/include/m_string.h b/include/m_string.h index c6943613b1a..fabd6c9bb59 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -238,6 +238,12 @@ extern ulonglong strtoull(const char *str, char **ptr, int base); #endif #endif +/* my_vsnprintf.c */ + +extern int my_vsnprintf( char *str, size_t n, + const char *format, va_list ap ); +extern int my_snprintf(char* to, size_t n, const char* fmt, ...); + #if defined(__cplusplus) && !defined(OS2) } #endif diff --git a/include/my_sys.h b/include/my_sys.h index 975990ca7fc..3d81a9e9219 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -569,9 +569,6 @@ extern int my_error _VARARGS((int nr,myf MyFlags, ...)); extern int my_printf_error _VARARGS((uint my_err, const char *format, myf MyFlags, ...) __attribute__ ((format (printf, 2, 4)))); -extern int my_vsnprintf( char *str, size_t n, - const char *format, va_list ap ); -extern int my_snprintf(char* to, size_t n, const char* fmt, ...); extern int my_message(uint my_err, const char *str,myf MyFlags); extern int my_message_no_curses(uint my_err, const char *str,myf MyFlags); extern int my_message_curses(uint my_err, const char *str,myf MyFlags); diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared index 4d8b703fb2d..08128b3936d 100644 --- a/libmysql/Makefile.shared +++ b/libmysql/Makefile.shared @@ -37,7 +37,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \ int2str.lo str2int.lo strinstr.lo strcont.lo \ strcend.lo bcmp.lo \ bchange.lo bmove.lo bmove_upp.lo longlong2str.lo \ - strtoull.lo strtoll.lo llstr.lo \ + strtoull.lo strtoll.lo llstr.lo my_vsnprintf.lo \ ctype.lo ctype-simple.lo ctype-bin.lo ctype-mb.lo \ ctype-big5.lo ctype-czech.lo ctype-euc_kr.lo \ ctype-win1250ch.lo ctype-utf8.lo \ @@ -60,7 +60,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \ my_compress.lo array.lo my_once.lo list.lo my_net.lo \ charset.lo xml.lo hash.lo mf_iocache.lo \ mf_iocache2.lo my_seek.lo \ - my_pread.lo mf_cache.lo my_vsnprintf.lo md5.lo sha1.lo\ + my_pread.lo mf_cache.lo md5.lo sha1.lo\ my_getopt.lo my_gethostbyname.lo my_port.lo sqlobjects = net.lo diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index a4be4195ac8..456dfa860df 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -53,7 +53,7 @@ SHOW FULL COLUMNS FROM t1; Field Type Collation Null Key Default Extra Privileges Comment GROUP_ID int(10) unsigned binary PRI 0 select,insert,update,references LANG_ID smallint(5) unsigned binary PRI 0 select,insert,update,references -NAME char(80) character set latin1 latin1 MUL select,insert,update,references +NAME char(80) latin1 MUL select,insert,update,references DROP TABLE t1; create table t1 (n int); insert into t1 values(9),(3),(12),(10); @@ -120,5 +120,5 @@ alter table t2 rename t1, add c char(10) comment "no comment"; show columns from t1; Field Type Collation Null Key Default Extra i int(10) unsigned binary PRI NULL auto_increment -c char(10) character set latin1 latin1 YES NULL +c char(10) latin1 YES NULL drop table t1; diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index affda14b4ba..88b9bfce51a 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -76,10 +76,10 @@ create table t1(x varchar(50) ); create table t2 select x from t1 where 1=2; describe t1; Field Type Collation Null Key Default Extra -x varchar(50) character set latin1 latin1 YES NULL +x varchar(50) latin1 YES NULL describe t2; Field Type Collation Null Key Default Extra -x char(50) character set latin1 latin1 YES NULL +x char(50) latin1 YES NULL drop table t2; create table t2 select now() as a , curtime() as b, curdate() as c , 1+1 as d , 1.0 + 1 as e , 33333333333333333 + 3 as f; describe t2; @@ -181,7 +181,7 @@ show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `id` int(11) NOT NULL default '0', - `name` char(20) character set latin1 default NULL + `name` char(20) default NULL ) TYPE=MyISAM CHARSET=latin1 select * from t3; id name @@ -204,7 +204,7 @@ show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `id` int(11) NOT NULL default '0', - `name` char(20) character set latin1 default NULL + `name` char(20) default NULL ) TYPE=MyISAM CHARSET=latin1 select * from t3; id name @@ -219,14 +219,14 @@ show create table t3; Table Create Table t3 CREATE TEMPORARY TABLE `t3` ( `id` int(11) NOT NULL default '0', - `name` char(20) character set latin1 default NULL + `name` char(20) default NULL ) TYPE=MyISAM CHARSET=latin1 create table t2 like t3; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `id` int(11) NOT NULL default '0', - `name` char(20) character set latin1 default NULL + `name` char(20) default NULL ) TYPE=MyISAM CHARSET=latin1 select * from t2; id name diff --git a/mysql-test/r/ctype_many.result b/mysql-test/r/ctype_many.result index 3a9d0ec5da5..91a43634bcb 100644 --- a/mysql-test/r/ctype_many.result +++ b/mysql-test/r/ctype_many.result @@ -22,23 +22,23 @@ Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) character set latin2 NOT NULL default '', `koi8_ru_f` char(32) character set koi8r NOT NULL default '', - `latin5_f` char(32) character set latin5 NOT NULL default '' + `latin5_f` char(32) NOT NULL default '' ) TYPE=MyISAM CHARSET=latin5 ALTER TABLE t1 CHARSET=latin2; ALTER TABLE t1 ADD latin2_f CHAR(32) NOT NULL; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `comment` char(32) character set latin2 NOT NULL default '', + `comment` char(32) NOT NULL default '', `koi8_ru_f` char(32) character set koi8r NOT NULL default '', `latin5_f` char(32) character set latin5 NOT NULL default '', - `latin2_f` char(32) character set latin2 NOT NULL default '' + `latin2_f` char(32) NOT NULL default '' ) TYPE=MyISAM CHARSET=latin2 ALTER TABLE t1 DROP latin2_f, DROP latin5_f; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `comment` char(32) character set latin2 NOT NULL default '', + `comment` char(32) NOT NULL default '', `koi8_ru_f` char(32) character set koi8r NOT NULL default '' ) TYPE=MyISAM CHARSET=latin2 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('a','LAT SMALL A'); diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index 66aa7311542..1382c31d145 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -141,7 +141,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `ticket` int(11) default NULL, - `inhalt` text character set latin1, + `inhalt` text, KEY `tig` (`ticket`), FULLTEXT KEY `tix` (`inhalt`) ) TYPE=MyISAM CHARSET=latin1 diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 110b8707bc8..f5bbf082730 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -805,7 +805,7 @@ create table t1 (a char(20), index (a(5))) type=innodb; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` char(20) character set latin1 default NULL, + `a` char(20) default NULL, KEY `a` (`a`) ) TYPE=InnoDB CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index 772ed0349da..9199f291c08 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -172,7 +172,7 @@ show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `a` int(11) NOT NULL default '0', - `b` char(20) character set latin1 default NULL, + `b` char(20) default NULL, KEY `a` (`a`) ) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(t1,t2) create table t4 (a int not null, b char(10), key(a)) type=MERGE UNION=(t1,t2); diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index bba10f408cb..9ed54f7c253 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -3221,17 +3221,17 @@ Field Type Collation Null Key Default Extra Privileges Comment auto int(11) binary PRI NULL auto_increment select,insert,update,references fld1 int(6) unsigned zerofill binary UNI 000000 select,insert,update,references companynr tinyint(2) unsigned zerofill binary 00 select,insert,update,references -fld3 char(30) character set latin1 latin1 MUL select,insert,update,references -fld4 char(35) character set latin1 latin1 select,insert,update,references -fld5 char(35) character set latin1 latin1 select,insert,update,references -fld6 char(4) character set latin1 latin1 select,insert,update,references +fld3 char(30) latin1 MUL select,insert,update,references +fld4 char(35) latin1 select,insert,update,references +fld5 char(35) latin1 select,insert,update,references +fld6 char(4) latin1 select,insert,update,references show full columns from t2 from test like 'f%'; Field Type Collation Null Key Default Extra Privileges Comment fld1 int(6) unsigned zerofill binary UNI 000000 select,insert,update,references -fld3 char(30) character set latin1 latin1 MUL select,insert,update,references -fld4 char(35) character set latin1 latin1 select,insert,update,references -fld5 char(35) character set latin1 latin1 select,insert,update,references -fld6 char(4) character set latin1 latin1 select,insert,update,references +fld3 char(30) latin1 MUL select,insert,update,references +fld4 char(35) latin1 select,insert,update,references +fld5 char(35) latin1 select,insert,update,references +fld6 char(4) latin1 select,insert,update,references show full columns from t2 from test like 's%'; Field Type Collation Null Key Default Extra Privileges Comment show keys from t2; diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 94170638730..d2bdc4f9401 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -93,14 +93,14 @@ c int not null comment 'int column' show create table t1 ; Table Create Table t1 CREATE TABLE `t1` ( - `test_set` set('val1','val2','val3') character set latin1 NOT NULL default '', - `name` char(20) character set latin1 default 'O''Brien' COMMENT 'O''Brien as default', + `test_set` set('val1','val2','val3') NOT NULL default '', + `name` char(20) default 'O''Brien' COMMENT 'O''Brien as default', `c` int(11) NOT NULL default '0' COMMENT 'int column' ) TYPE=MyISAM CHARSET=latin1 COMMENT='it''s a table' show full columns from t1; Field Type Collation Null Key Default Extra Privileges Comment -test_set set('val1','val2','val3') character set latin1 latin1 select,insert,update,references -name char(20) character set latin1 latin1 YES O'Brien select,insert,update,references O'Brien as default +test_set set('val1','val2','val3') latin1 select,insert,update,references +name char(20) latin1 YES O'Brien select,insert,update,references O'Brien as default c int(11) binary 0 select,insert,update,references int column drop table t1; create table t1 (a int not null, unique aa (a)); @@ -133,7 +133,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0', - `b` char(10) character set latin1 default NULL, + `b` char(10) default NULL, KEY `b` (`b`) ) TYPE=MyISAM CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test' alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0; @@ -141,7 +141,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0', - `b` varchar(10) character set latin1 default NULL, + `b` varchar(10) default NULL, KEY `b` (`b`) ) TYPE=MyISAM CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=200 AVG_ROW_LENGTH=10 PACK_KEYS=0 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC COMMENT='test' ALTER TABLE t1 AVG_ROW_LENGTH=0 CHECKSUM=0 COMMENT="" MIN_ROWS=0 MAX_ROWS=0 PACK_KEYS=DEFAULT DELAY_KEY_WRITE=0 ROW_FORMAT=default; @@ -149,7 +149,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0', - `b` varchar(10) character set latin1 default NULL, + `b` varchar(10) default NULL, KEY `b` (`b`) ) TYPE=MyISAM CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index 3248e3c5c80..ba8e01d6319 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -3,10 +3,10 @@ CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000)); show columns from t1; Field Type Collation Null Key Default Extra a blob binary YES NULL -b text character set latin1 latin1 YES NULL +b text latin1 YES NULL c blob binary YES NULL -d mediumtext character set latin1 latin1 YES NULL -e longtext character set latin1 latin1 YES NULL +d mediumtext latin1 YES NULL +e longtext latin1 YES NULL CREATE TABLE t2 (a char(257), b varchar(70000) binary, c varchar(70000000)); Warnings: Warning 1244 Converting column 'a' from CHAR to TEXT @@ -14,14 +14,14 @@ Warning 1244 Converting column 'b' from CHAR to BLOB Warning 1244 Converting column 'c' from CHAR to TEXT show columns from t2; Field Type Collation Null Key Default Extra -a text character set latin1 latin1 YES NULL +a text latin1 YES NULL b mediumblob binary YES NULL -c longtext character set latin1 latin1 YES NULL +c longtext latin1 YES NULL create table t3 (a long, b long byte); show create TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( - `a` mediumtext character set latin1, + `a` mediumtext, `b` mediumblob ) TYPE=MyISAM CHARSET=latin1 drop table t1,t2,t3 @@ -70,15 +70,15 @@ update t1 set c="",b=null where c="1"; lock tables t1 READ; show full fields from t1; Field Type Collation Null Key Default Extra Privileges Comment -t text character set latin1 latin1 YES NULL select,insert,update,references -c varchar(10) character set latin1 latin1 YES NULL select,insert,update,references +t text latin1 YES NULL select,insert,update,references +c varchar(10) latin1 YES NULL select,insert,update,references b blob binary YES NULL select,insert,update,references d varchar(10) binary binary YES NULL select,insert,update,references lock tables t1 WRITE; show full fields from t1; Field Type Collation Null Key Default Extra Privileges Comment -t text character set latin1 latin1 YES NULL select,insert,update,references -c varchar(10) character set latin1 latin1 YES NULL select,insert,update,references +t text latin1 YES NULL select,insert,update,references +c varchar(10) latin1 YES NULL select,insert,update,references b blob binary YES NULL select,insert,update,references d varchar(10) binary binary YES NULL select,insert,update,references unlock tables; diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result index 51e11d259eb..c0f0be246c9 100644 --- a/mysql-test/r/type_enum.result +++ b/mysql-test/r/type_enum.result @@ -1626,13 +1626,13 @@ create table t1 (a enum (' ','a','b') not null); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('','a','b') character set latin1 NOT NULL default '' + `a` enum('','a','b') NOT NULL default '' ) TYPE=MyISAM CHARSET=latin1 drop table t1; create table t1 (a enum (' ','a','b ') not null default 'b '); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('','a','b') character set latin1 NOT NULL default 'b' + `a` enum('','a','b') NOT NULL default 'b' ) TYPE=MyISAM CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result index b570513a5e7..19f1ac2b4d7 100644 --- a/mysql-test/r/type_ranges.result +++ b/mysql-test/r/type_ranges.result @@ -40,7 +40,7 @@ KEY (options,flags) show full fields from t1; Field Type Collation Null Key Default Extra Privileges Comment auto int(5) unsigned binary PRI NULL auto_increment select,insert,update,references -string varchar(10) character set latin1 latin1 YES hello select,insert,update,references +string varchar(10) latin1 YES hello select,insert,update,references tiny tinyint(4) binary MUL 0 select,insert,update,references short smallint(6) binary MUL 1 select,insert,update,references medium mediumint(8) binary MUL 0 select,insert,update,references @@ -61,8 +61,8 @@ blob_col blob binary YES NULL select,insert,update,references tinyblob_col tinyblob binary YES NULL select,insert,update,references mediumblob_col mediumblob binary select,insert,update,references longblob_col longblob binary select,insert,update,references -options enum('one','two','tree') character set latin1 latin1 MUL one select,insert,update,references -flags set('one','two','tree') character set latin1 latin1 select,insert,update,references +options enum('one','two','tree') latin1 MUL one select,insert,update,references +flags set('one','two','tree') latin1 select,insert,update,references show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 0 PRIMARY 1 auto A 0 NULL NULL BTREE @@ -170,7 +170,7 @@ update t2 set string="changed" where auto=16; show full columns from t1; Field Type Collation Null Key Default Extra Privileges Comment auto int(5) unsigned binary MUL NULL auto_increment select,insert,update,references -string varchar(10) character set latin1 latin1 YES new defaul select,insert,update,references +string varchar(10) latin1 YES new defaul select,insert,update,references tiny tinyint(4) binary MUL 0 select,insert,update,references short smallint(6) binary MUL 0 select,insert,update,references medium mediumint(8) binary MUL 0 select,insert,update,references @@ -184,19 +184,19 @@ umedium mediumint(8) unsigned binary MUL 0 select,insert,update,references ulong int(11) unsigned binary MUL 0 select,insert,update,references ulonglong bigint(13) unsigned binary MUL 0 select,insert,update,references time_stamp timestamp latin1 YES NULL select,insert,update,references -date_field varchar(10) character set latin1 latin1 YES NULL select,insert,update,references +date_field varchar(10) latin1 YES NULL select,insert,update,references time_field time latin1 YES NULL select,insert,update,references date_time datetime latin1 YES NULL select,insert,update,references -new_blob_col varchar(20) character set latin1 latin1 YES NULL select,insert,update,references +new_blob_col varchar(20) latin1 YES NULL select,insert,update,references tinyblob_col tinyblob binary YES NULL select,insert,update,references mediumblob_col mediumblob binary select,insert,update,references -options enum('one','two','tree') character set latin1 latin1 MUL one select,insert,update,references -flags set('one','two','tree') character set latin1 latin1 select,insert,update,references -new_field varchar(10) character set latin1 latin1 new select,insert,update,references +options enum('one','two','tree') latin1 MUL one select,insert,update,references +flags set('one','two','tree') latin1 select,insert,update,references +new_field varchar(10) latin1 new select,insert,update,references show full columns from t2; Field Type Collation Null Key Default Extra Privileges Comment auto int(5) unsigned binary 0 select,insert,update,references -string varchar(10) character set latin1 latin1 YES new defaul select,insert,update,references +string varchar(10) latin1 YES new defaul select,insert,update,references tiny tinyint(4) binary 0 select,insert,update,references short smallint(6) binary 0 select,insert,update,references medium mediumint(8) binary 0 select,insert,update,references @@ -210,15 +210,15 @@ umedium mediumint(8) unsigned binary 0 select,insert,update,references ulong int(11) unsigned binary 0 select,insert,update,references ulonglong bigint(13) unsigned binary 0 select,insert,update,references time_stamp timestamp latin1 YES NULL select,insert,update,references -date_field varchar(10) character set latin1 latin1 YES NULL select,insert,update,references +date_field varchar(10) latin1 YES NULL select,insert,update,references time_field time latin1 YES NULL select,insert,update,references date_time datetime latin1 YES NULL select,insert,update,references -new_blob_col varchar(20) character set latin1 latin1 YES NULL select,insert,update,references +new_blob_col varchar(20) latin1 YES NULL select,insert,update,references tinyblob_col tinyblob binary YES NULL select,insert,update,references mediumblob_col mediumblob binary select,insert,update,references -options enum('one','two','tree') character set latin1 latin1 one select,insert,update,references -flags set('one','two','tree') character set latin1 latin1 select,insert,update,references -new_field varchar(10) character set latin1 latin1 new select,insert,update,references +options enum('one','two','tree') latin1 one select,insert,update,references +flags set('one','two','tree') latin1 select,insert,update,references +new_field varchar(10) latin1 new select,insert,update,references select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null))); auto auto 16 16 @@ -231,8 +231,8 @@ show full columns from t2; Field Type Collation Null Key Default Extra Privileges Comment auto bigint(17) unsigned binary PRI 0 select,insert,update,references t1 bigint(1) binary 0 select,insert,update,references -t2 char(1) character set latin1 latin1 select,insert,update,references -t3 mediumtext character set latin1 latin1 select,insert,update,references +t2 char(1) latin1 select,insert,update,references +t3 mediumtext latin1 select,insert,update,references t4 mediumblob binary select,insert,update,references select * from t2; auto t1 t2 t3 t4 diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result index 256937c586a..b0ea1b69e59 100644 --- a/mysql-test/r/type_set.result +++ b/mysql-test/r/type_set.result @@ -3,13 +3,13 @@ create table t1 (a set (' ','a','b') not null); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` set('','a','b') character set latin1 NOT NULL default '' + `a` set('','a','b') NOT NULL default '' ) TYPE=MyISAM CHARSET=latin1 drop table t1; create table t1 (a set (' ','a','b ') not null default 'b '); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` set('','a','b') character set latin1 NOT NULL default 'b' + `a` set('','a','b') NOT NULL default 'b' ) TYPE=MyISAM CHARSET=latin1 drop table t1; diff --git a/mysys/Makefile.am b/mysys/Makefile.am index c8b7987a506..a50dd51a174 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -50,7 +50,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\ my_getopt.c my_mkdir.c \ default.c my_compress.c checksum.c raid.cc \ my_net.c my_semaphore.c my_port.c \ - my_vsnprintf.c charset.c xml.c my_bitmap.c my_bit.c md5.c \ + charset.c xml.c my_bitmap.c my_bit.c md5.c \ my_gethostbyname.c rijndael.c my_aes.c sha1.c \ my_handler.c EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \ diff --git a/sql/field.cc b/sql/field.cc index 21330a2ffaa..f81f72635b9 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -34,8 +34,6 @@ // Maximum allowed exponent value for converting string to decimal #define MAX_EXPONENT 1024 - - /***************************************************************************** Instansiate templates and static variables *****************************************************************************/ @@ -67,39 +65,44 @@ void Field_num::prepend_zeros(String *value) /* Test if given number is a int (or a fixed format float with .000) - This is only used to give warnings in ALTER TABLE or LOAD DATA... + + SYNOPSIS + test_if_int() + str String to test + end Pointer to char after last used digit + cs Character set + + NOTES + This is called after one has called my_strntol() or similar function. + This is only used to give warnings in ALTER TABLE or LOAD DATA... + + TODO + Make this multi-byte-character safe + + RETURN + 0 ok + 1 error */ -bool test_if_int(const char *str,int length, CHARSET_INFO *cs) +bool test_if_int(const char *str, int length, const char *int_end, + CHARSET_INFO *cs) { + if (str == int_end) + return 0; // Empty string const char *end=str+length; + if ((str= int_end) == end) + return 1; // All digits was used - cs=system_charset_info; // QQ move test_if_int into CHARSET_INFO struct - - // Allow start space - while (str != end && my_isspace(cs,*str)) - str++; /* purecov: inspected */ - if (str != end && (*str == '-' || *str == '+')) - str++; - if (str == end) - return 0; // Error: Empty string - for (; str != end ; str++) + /* Allow end .0000 */ + if (*str == '.') { - if (!my_isdigit(cs,*str)) - { - if (*str == '.') - { // Allow '.0000' - for (str++ ; str != end && *str == '0'; str++) ; - if (str == end) - return 1; - } - if (!my_isspace(cs,*str)) - return 0; - for (str++ ; str != end ; str++) - if (!my_isspace(cs,*str)) - return 0; - return 1; - } + for (str++ ; str != end && *str == '0'; str++) ; + } + /* Allow end space */ + for (str++ ; str != end ; str++) + { + if (!my_isspace(cs,*str)) + return 0; } return 1; } @@ -107,7 +110,7 @@ bool test_if_int(const char *str,int length, CHARSET_INFO *cs) static bool test_if_real(const char *str,int length, CHARSET_INFO *cs) { - cs=system_charset_info; // QQ move test_if_int into CHARSET_INFO struct + cs= system_charset_info; // QQ move test_if_real into CHARSET_INFO struct while (length && my_isspace(cs,*str)) { // Allow start space @@ -207,17 +210,10 @@ bool Field::send_binary(Protocol *protocol) void Field_num::add_zerofill_and_unsigned(String &res) const { - uint oldlen=res.length(); - if (oldlen < res.alloced_length()) - { - uint len=res.alloced_length()-oldlen; - char *end=(char*)(res.ptr()+oldlen); - CHARSET_INFO *cs=res.charset(); - len=cs->snprintf(cs,end,len,"%s%s", - unsigned_flag ? " unsigned" : "", - zerofill ? " zerofill" : ""); - res.length(len+oldlen); - } + if (unsigned_flag) + res.append(" unsigned"); + if (zerofill) + res.append(" zerofill"); } void Field_num::make_field(Send_field *field) @@ -247,19 +243,15 @@ void Field_str::make_field(Send_field *field) field->decimals=0; } + void Field_str::add_binary_or_charset(String &res) const { - uint oldlen=res.length(); - if (oldlen < res.alloced_length()) + if (binary()) + res.append(" binary"); + else if (field_charset != table->table_charset) { - CHARSET_INFO *cs=res.charset(); - uint len=res.alloced_length() - oldlen; - char *end=(char*)(res.ptr()+oldlen); - if (binary()) - len=cs->snprintf(cs,end,len," binary"); - else - len=cs->snprintf(cs,end,len," character set %s",field_charset->csname); - res.length(oldlen+len); + res.append(" character set "); + res.append(field_charset->csname); } } @@ -287,7 +279,7 @@ uint Field::fill_cache_field(CACHE_FIELD *copy) bool Field::get_date(TIME *ltime,bool fuzzydate) { char buff[40]; - String tmp(buff,sizeof(buff),my_charset_latin1),tmp2,*res; + String tmp(buff,sizeof(buff),my_charset_bin),tmp2,*res; if (!(res=val_str(&tmp,&tmp2)) || str_to_TIME(res->ptr(),res->length(),ltime,fuzzydate) == TIMESTAMP_NONE) return 1; @@ -297,7 +289,7 @@ bool Field::get_date(TIME *ltime,bool fuzzydate) bool Field::get_time(TIME *ltime) { char buff[40]; - String tmp(buff,sizeof(buff),my_charset_latin1),tmp2,*res; + String tmp(buff,sizeof(buff),my_charset_bin),tmp2,*res; if (!(res=val_str(&tmp,&tmp2)) || str_to_time(res->ptr(),res->length(),ltime)) return 1; @@ -311,23 +303,23 @@ void Field::store_time(TIME *ltime,timestamp_type type) char buff[25]; switch (type) { case TIMESTAMP_NONE: - store("",0,my_charset_latin1); // Probably an error + store("",0,my_charset_bin); // Probably an error break; case TIMESTAMP_DATE: sprintf(buff,"%04d-%02d-%02d", ltime->year,ltime->month,ltime->day); - store(buff,10,my_charset_latin1); + store(buff,10,my_charset_bin); break; case TIMESTAMP_FULL: sprintf(buff,"%04d-%02d-%02d %02d:%02d:%02d", ltime->year,ltime->month,ltime->day, ltime->hour,ltime->minute,ltime->second); - store(buff,19,my_charset_latin1); + store(buff,19,my_charset_bin); break; case TIMESTAMP_TIME: { ulong length= my_sprintf(buff, (buff, "%02d:%02d:%02d", ltime->hour,ltime->minute,ltime->second)); - store(buff,(uint) length, my_charset_latin1); + store(buff,(uint) length, my_charset_bin); break; } } @@ -340,15 +332,12 @@ bool Field::optimize_range(uint idx) } /**************************************************************************** - Functions for the Field_null + Field_null, a field that always return NULL ****************************************************************************/ void Field_null::sql_type(String &res) const { - CHARSET_INFO *cs=res.charset(); - uint len; - len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"null"); - res.length(len); + res.set_latin1("null", 4); } @@ -360,7 +349,7 @@ void Field_null::sql_type(String &res) const void Field_decimal::reset(void) { - Field_decimal::store("0",1,my_charset_latin1); + Field_decimal::store("0",1,my_charset_bin); } void Field_decimal::overflow(bool negative) @@ -404,11 +393,16 @@ void Field_decimal::overflow(bool negative) int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) { - String l1from; + char buff[80]; + String tmp(buff,sizeof(buff), my_charset_bin); - l1from.copy(from,len,cs,my_charset_latin1); - from=l1from.ptr(); - len=l1from.length(); + /* Convert character set if the old one is multi byte */ + if (cs->mbmaxlen > 1) + { + tmp.copy(from, len, cs, my_charset_bin); + from= tmp.ptr(); + len= tmp.length(); + } const char *end= from+len; /* The pointer where the field value starts (i.e., "where to write") */ @@ -461,7 +455,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) There are three steps in this function : - parse the input string - modify the position of digits around the decimal dot '.' - according to the exponent value (if specified) + according to the exponent value (if specified) - write the formatted number */ @@ -469,7 +463,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) tmp_dec++; /* skip pre-space */ - while (from != end && my_isspace(my_charset_latin1,*from)) + while (from != end && my_isspace(my_charset_bin,*from)) from++; if (from == end) { @@ -506,13 +500,13 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) for (; from!=end && *from == '0'; from++) ; // Read prezeros pre_zeros_end=int_digits_from=from; /* Read non zero digits at the left of '.'*/ - for (; from != end && my_isdigit(my_charset_latin1, *from) ; from++) ; + for (; from != end && my_isdigit(my_charset_bin, *from) ; from++) ; int_digits_end=from; if (from!=end && *from == '.') // Some '.' ? from++; frac_digits_from= from; /* Read digits at the right of '.' */ - for (;from!=end && my_isdigit(my_charset_latin1, *from); from++) ; + for (;from!=end && my_isdigit(my_charset_bin, *from); from++) ; frac_digits_end=from; // Some exponentiation symbol ? if (from != end && (*from == 'e' || *from == 'E')) @@ -528,7 +522,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) exponents will become small (e.g. 1e4294967296 will become 1e0, and the field will finally contain 1 instead of its max possible value). */ - for (;from!=end && my_isdigit(my_charset_latin1, *from); from++) + for (;from!=end && my_isdigit(my_charset_bin, *from); from++) { exponent=10*exponent+(*from-'0'); if (exponent>MAX_EXPONENT) @@ -546,7 +540,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs) if (current_thd->count_cuted_fields) { // Skip end spaces - for (;from != end && my_isspace(my_charset_latin1, *from); from++) ; + for (;from != end && my_isspace(my_charset_bin, *from); from++) ; if (from != end) // If still something left, warn { current_thd->cuted_fields++; @@ -838,30 +832,29 @@ int Field_decimal::store(longlong nr) double Field_decimal::val_real(void) { - CHARSET_INFO *cs=charset(); - return my_strntod(cs,ptr,field_length,NULL); + return my_strntod(my_charset_bin, ptr, field_length, NULL); } longlong Field_decimal::val_int(void) { - CHARSET_INFO *cs=charset(); if (unsigned_flag) - return my_strntoull(cs,ptr,field_length,NULL,10); + return my_strntoull(my_charset_bin, ptr, field_length, NULL, 10); else - return my_strntoll(cs,ptr,field_length,NULL,10); + return my_strntoll( my_charset_bin, ptr, field_length, NULL, 10); } + String *Field_decimal::val_str(String *val_buffer __attribute__((unused)), String *val_ptr) { char *str; - CHARSET_INFO *cs=current_thd->variables.thd_charset; for (str=ptr ; *str == ' ' ; str++) ; uint tmp_length=(uint) (str-ptr); + val_ptr->set_charset(my_charset_bin); if (field_length < tmp_length) // Error in data val_ptr->length(0); else - val_ptr->copy((const char*) str,field_length-tmp_length,my_charset_latin1,cs); + val_ptr->set_latin1((const char*) str, field_length-tmp_length); return val_ptr; } @@ -878,9 +871,9 @@ int Field_decimal::cmp(const char *a_ptr,const char *b_ptr) for (end=a_ptr+field_length; a_ptr != end && (*a_ptr == *b_ptr || - ((my_isspace(my_charset_latin1,*a_ptr) || *a_ptr == '+' || + ((my_isspace(my_charset_bin,*a_ptr) || *a_ptr == '+' || *a_ptr == '0') && - (my_isspace(my_charset_latin1,*b_ptr) || *b_ptr == '+' || + (my_isspace(my_charset_bin,*b_ptr) || *b_ptr == '+' || *b_ptr == '0'))); a_ptr++,b_ptr++) { @@ -908,7 +901,7 @@ void Field_decimal::sort_string(char *to,uint length) char *str,*end; for (str=ptr,end=ptr+length; str != end && - ((my_isspace(my_charset_latin1,*str) || *str == '+' || + ((my_isspace(my_charset_bin,*str) || *str == '+' || *str == '0')) ; str++) *to++=' '; @@ -920,7 +913,7 @@ void Field_decimal::sort_string(char *to,uint length) *to++=1; // Smaller than any number str++; while (str != end) - if (my_isdigit(my_charset_latin1,*str)) + if (my_isdigit(my_charset_bin,*str)) *to++= (char) ('9' - *str++); else *to++= *str++; @@ -933,14 +926,12 @@ void Field_decimal::sql_type(String &res) const { CHARSET_INFO *cs=res.charset(); uint tmp=field_length; - uint len; if (!unsigned_flag) tmp--; if (dec) tmp--; - len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), - "decimal(%d,%d)",tmp,dec); - res.length(len); + res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), + "decimal(%d,%d)",tmp,dec)); add_zerofill_and_unsigned(res); } @@ -951,7 +942,8 @@ void Field_decimal::sql_type(String &res) const int Field_tiny::store(const char *from,uint len,CHARSET_INFO *cs) { - long tmp= my_strntol(cs,from,len,(char **)NULL,10); + char *end; + long tmp= my_strntol(cs, from, len, &end,10); int error= 0; if (unsigned_flag) @@ -968,7 +960,7 @@ int Field_tiny::store(const char *from,uint len,CHARSET_INFO *cs) current_thd->cuted_fields++; error= 1; } - else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs)) + else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs)) { current_thd->cuted_fields++; error= 1; @@ -988,7 +980,7 @@ int Field_tiny::store(const char *from,uint len,CHARSET_INFO *cs) current_thd->cuted_fields++; error= 1; } - else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs)) + else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs)) { current_thd->cuted_fields++; error= 1; @@ -1098,7 +1090,7 @@ longlong Field_tiny::val_int(void) String *Field_tiny::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { - CHARSET_INFO *cs=current_thd->variables.thd_charset; + CHARSET_INFO *cs= my_charset_bin; uint length; uint mlength=max(field_length+1,5*cs->mbmaxlen); val_buffer->alloc(mlength); @@ -1140,22 +1132,19 @@ void Field_tiny::sort_string(char *to,uint length __attribute__((unused))) void Field_tiny::sql_type(String &res) const { CHARSET_INFO *cs=res.charset(); - uint len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), - "tinyint(%d)",(int) field_length); - res.length(len); + res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), + "tinyint(%d)",(int) field_length)); add_zerofill_and_unsigned(res); } /**************************************************************************** -** short int + Field type short int (2 byte) ****************************************************************************/ - -// Note: Sometimes this should be fixed to check for garbage after number. - int Field_short::store(const char *from,uint len,CHARSET_INFO *cs) { - long tmp= my_strntol(cs,from,len,NULL,10); + char *end; + long tmp= my_strntol(cs, from, len, &end, 10); int error= 0; if (unsigned_flag) { @@ -1171,7 +1160,7 @@ int Field_short::store(const char *from,uint len,CHARSET_INFO *cs) current_thd->cuted_fields++; error= 1; } - else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs)) + else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs)) { current_thd->cuted_fields++; error= 1; @@ -1191,7 +1180,7 @@ int Field_short::store(const char *from,uint len,CHARSET_INFO *cs) current_thd->cuted_fields++; error= 1; } - else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs)) + else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs)) { current_thd->cuted_fields++; error= 1; @@ -1337,7 +1326,7 @@ longlong Field_short::val_int(void) String *Field_short::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { - CHARSET_INFO *cs=current_thd->variables.thd_charset; + CHARSET_INFO *cs= my_charset_bin; uint length; uint mlength=max(field_length+1,7*cs->mbmaxlen); val_buffer->alloc(mlength); @@ -1351,9 +1340,9 @@ String *Field_short::val_str(String *val_buffer, shortget(j,ptr); if (unsigned_flag) - length=(uint) cs->l10tostr(cs,to,mlength, 10, (long) (uint16) j); + length=(uint) cs->l10tostr(cs, to, mlength, 10, (long) (uint16) j); else - length=(uint) cs->l10tostr(cs,to,mlength,-10, (long) j); + length=(uint) cs->l10tostr(cs, to, mlength,-10, (long) j); val_buffer->length(length); if (zerofill) prepend_zeros(val_buffer); @@ -1414,22 +1403,20 @@ void Field_short::sort_string(char *to,uint length __attribute__((unused))) void Field_short::sql_type(String &res) const { CHARSET_INFO *cs=res.charset(); - uint len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), - "smallint(%d)",(int) field_length); - res.length(len); + res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), + "smallint(%d)",(int) field_length)); add_zerofill_and_unsigned(res); } /**************************************************************************** -** medium int + Field type medium int (3 byte) ****************************************************************************/ -// Note: Sometimes this should be fixed to check for garbage after number. - int Field_medium::store(const char *from,uint len,CHARSET_INFO *cs) { - long tmp= my_strntol(cs,from,len,NULL,10); + char *end; + long tmp= my_strntol(cs, from, len, &end, 10); int error= 0; if (unsigned_flag) @@ -1446,7 +1433,7 @@ int Field_medium::store(const char *from,uint len,CHARSET_INFO *cs) current_thd->cuted_fields++; error= 1; } - else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs)) + else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs)) { current_thd->cuted_fields++; error= 1; @@ -1466,7 +1453,7 @@ int Field_medium::store(const char *from,uint len,CHARSET_INFO *cs) current_thd->cuted_fields++; error= 1; } - else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs)) + else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs)) { current_thd->cuted_fields++; error= 1; @@ -1572,16 +1559,18 @@ double Field_medium::val_real(void) return (double) j; } + longlong Field_medium::val_int(void) { long j= unsigned_flag ? (long) uint3korr(ptr) : sint3korr(ptr); return (longlong) j; } + String *Field_medium::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { - CHARSET_INFO *cs=current_thd->variables.thd_charset; + CHARSET_INFO *cs= my_charset_bin; uint length; uint mlength=max(field_length+1,10*cs->mbmaxlen); val_buffer->alloc(mlength); @@ -1632,9 +1621,8 @@ void Field_medium::sort_string(char *to,uint length __attribute__((unused))) void Field_medium::sql_type(String &res) const { CHARSET_INFO *cs=res.charset(); - uint len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), - "mediumint(%d)",(int) field_length); - res.length(len); + res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), + "mediumint(%d)",(int) field_length)); add_zerofill_and_unsigned(res); } @@ -1643,26 +1631,23 @@ void Field_medium::sql_type(String &res) const ****************************************************************************/ -// Note: Sometimes this should be fixed to check for garbage after number. - int Field_long::store(const char *from,uint len,CHARSET_INFO *cs) { + long tmp; + int error= 0; char *end; + /* TODO: Make multi-byte-character safe */ while (len && my_isspace(cs,*from)) { len--; from++; } - long tmp; - String tmp_str(from, len, cs); - from= tmp_str.c_ptr(); // Add end null if needed - int error= 0; - errno=0; + my_errno=0; if (unsigned_flag) { if (!len || *from == '-') { tmp=0; // Set negative to 0 - errno=ERANGE; + my_errno=ERANGE; error= 1; } else @@ -1670,9 +1655,9 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs) } else tmp=my_strntol(cs,from,len,&end,10); - if (errno || + if (my_errno || (from+len != end && current_thd->count_cuted_fields && - !test_if_int(from,len,cs))) + !test_if_int(from,len,end,cs))) { current_thd->cuted_fields++; error= 1; @@ -1817,7 +1802,7 @@ longlong Field_long::val_int(void) String *Field_long::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { - CHARSET_INFO *cs=current_thd->variables.thd_charset; + CHARSET_INFO *cs= my_charset_bin; uint length; uint mlength=max(field_length+1,12*cs->mbmaxlen); val_buffer->alloc(mlength); @@ -1896,34 +1881,32 @@ void Field_long::sort_string(char *to,uint length __attribute__((unused))) void Field_long::sql_type(String &res) const { CHARSET_INFO *cs=res.charset(); - uint len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), - "int(%d)",(int) field_length); - res.length(len); + res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), + "int(%d)",(int) field_length)); add_zerofill_and_unsigned(res); } /**************************************************************************** -** longlong int + Field type longlong int (8 bytes) ****************************************************************************/ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs) { + longlong tmp; + int error= 0; char *end; + /* TODO: Make multi byte safe */ while (len && my_isspace(cs,*from)) { // For easy error check len--; from++; } - longlong tmp; - String tmp_str(from, len, cs); - from= tmp_str.c_ptr(); // Add end null if needed - int error= 0; - errno=0; + my_errno=0; if (unsigned_flag) { if (!len || *from == '-') { tmp=0; // Set negative to 0 - errno=ERANGE; + my_errno= ERANGE; error= 1; } else @@ -1931,9 +1914,9 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs) } else tmp=my_strntoll(cs,from,len,&end,10); - if (errno || + if (my_errno || (from+len != end && current_thd->count_cuted_fields && - !test_if_int(from,len,cs))) + !test_if_int(from,len,end,cs))) current_thd->cuted_fields++; #ifdef WORDS_BIGENDIAN if (table->db_low_byte_first) @@ -2042,7 +2025,7 @@ longlong Field_longlong::val_int(void) String *Field_longlong::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { - CHARSET_INFO *cs=current_thd->variables.thd_charset; + CHARSET_INFO *cs= my_charset_bin; uint length; uint mlength=max(field_length+1,22*cs->mbmaxlen); val_buffer->alloc(mlength); @@ -2128,9 +2111,8 @@ void Field_longlong::sort_string(char *to,uint length __attribute__((unused))) void Field_longlong::sql_type(String &res) const { CHARSET_INFO *cs=res.charset(); - uint len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), - "bigint(%d)",(int) field_length); - res.length(len); + res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), + "bigint(%d)",(int) field_length)); add_zerofill_and_unsigned(res); } @@ -2140,8 +2122,8 @@ void Field_longlong::sql_type(String &res) const int Field_float::store(const char *from,uint len,CHARSET_INFO *cs) { - errno=0; - Field_float::store(my_strntod(cs,from,len,(char**)NULL)); + errno=0; // my_strntod() changes errno + Field_float::store(my_strntod(cs,(char*) from,len,(char**)NULL)); if (errno || current_thd->count_cuted_fields && !test_if_real(from,len,cs)) { current_thd->cuted_fields++; @@ -2394,18 +2376,16 @@ bool Field_float::send_binary(Protocol *protocol) void Field_float::sql_type(String &res) const { - CHARSET_INFO *cs=res.charset(); - uint len; if (dec == NOT_FIXED_DEC) { - len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),"float"); + res.set_latin1("float", 5); } else { - len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), - "float(%d,%d)",(int) field_length,dec); + CHARSET_INFO *cs= res.charset(); + res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), + "float(%d,%d)",(int) field_length,dec)); } - res.length(len); add_zerofill_and_unsigned(res); } @@ -2415,9 +2395,9 @@ void Field_float::sql_type(String &res) const int Field_double::store(const char *from,uint len,CHARSET_INFO *cs) { - errno=0; + errno=0; // my_strntod() changes errno int error= 0; - double j= my_strntod(cs,from,len,(char**)0); + double j= my_strntod(cs,(char*) from,len,(char**)0); if (errno || current_thd->count_cuted_fields && !test_if_real(from,len,cs)) { current_thd->cuted_fields++; @@ -2655,17 +2635,15 @@ void Field_double::sort_string(char *to,uint length __attribute__((unused))) void Field_double::sql_type(String &res) const { CHARSET_INFO *cs=res.charset(); - uint len; if (dec == NOT_FIXED_DEC) { - len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),"double"); + res.set_latin1("double",6); } else { - len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), - "double(%d,%d)",(int) field_length,dec); + res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(), + "double(%d,%d)",(int) field_length,dec)); } - res.length(len); add_zerofill_and_unsigned(res); } @@ -2722,9 +2700,9 @@ int Field_timestamp::store(double nr) /* -** Convert a datetime of formats YYMMDD, YYYYMMDD or YYMMDDHHMSS to -** YYYYMMDDHHMMSS. The high date '99991231235959' is checked before this -** function. + Convert a datetime of formats YYMMDD, YYYYMMDD or YYMMDDHHMSS to + YYYYMMDDHHMMSS. The high date '99991231235959' is checked before this + function. */ static longlong fix_datetime(longlong nr) @@ -2854,9 +2832,10 @@ String *Field_timestamp::val_str(String *val_buffer, if (temp == 0L) { /* Zero time is "000000" */ - strmov(to, "0000-00-00 00:00:00"); - return val_buffer; + val_ptr->set("0000-00-00 00:00:00", 19, my_charset_bin); + return val_ptr; } + val_buffer->set_charset(my_charset_bin); // Safety time_arg=(time_t) temp; localtime_r(&time_arg,&tm_tmp); l_time=&tm_tmp; @@ -2995,9 +2974,7 @@ void Field_timestamp::sort_string(char *to,uint length __attribute__((unused))) void Field_timestamp::sql_type(String &res) const { - CHARSET_INFO *cs=res.charset(); - uint len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"timestamp"); - res.length(len); + res.set_latin1("timestamp", 9); } @@ -3125,6 +3102,12 @@ longlong Field_time::val_int(void) return (longlong) sint3korr(ptr); } + +/* + This function is multi-byte safe as the result string is always of type + my_charset_bin +*/ + String *Field_time::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { @@ -3189,9 +3172,7 @@ void Field_time::sort_string(char *to,uint length __attribute__((unused))) void Field_time::sql_type(String &res) const { - CHARSET_INFO *cs=res.charset(); - uint len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"time"); - res.length(len); + res.set_latin1("time", 4); } /**************************************************************************** @@ -3202,7 +3183,8 @@ void Field_time::sql_type(String &res) const int Field_year::store(const char *from, uint len,CHARSET_INFO *cs) { - long nr= my_strntol(cs,from,len,NULL,10); + char *end; + long nr= my_strntol(cs, from, len, &end, 10); if (nr < 0 || nr >= 100 && nr <= 1900 || nr > 2155) { @@ -3210,7 +3192,7 @@ int Field_year::store(const char *from, uint len,CHARSET_INFO *cs) current_thd->cuted_fields++; return 1; } - else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs)) + else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs)) current_thd->cuted_fields++; if (nr != 0 || len != 4) { @@ -3287,9 +3269,8 @@ String *Field_year::val_str(String *val_buffer, void Field_year::sql_type(String &res) const { CHARSET_INFO *cs=res.charset(); - ulong len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(), - "year(%d)",(int) field_length); - res.length(len); + res.length(cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(), + "year(%d)",(int) field_length)); } @@ -3375,6 +3356,7 @@ int Field_date::store(longlong nr) return error; } + bool Field_date::send_binary(Protocol *protocol) { longlong tmp= Field_date::val_int(); @@ -3469,9 +3451,7 @@ void Field_date::sort_string(char *to,uint length __attribute__((unused))) void Field_date::sql_type(String &res) const { - CHARSET_INFO *cs=res.charset(); - uint len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"date"); - res.length(len); + res.set_latin1("date", 4); } /**************************************************************************** @@ -3639,9 +3619,7 @@ void Field_newdate::sort_string(char *to,uint length __attribute__((unused))) void Field_newdate::sql_type(String &res) const { - CHARSET_INFO *cs=res.charset(); - uint len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"date"); - res.length(len); + res.set_latin1("date", 4); } @@ -3872,9 +3850,7 @@ void Field_datetime::sort_string(char *to,uint length __attribute__((unused))) void Field_datetime::sql_type(String &res) const { - CHARSET_INFO *cs=res.charset(); - uint len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"datetime"); - res.length(len); + res.set_latin1("datetime", 8); } /**************************************************************************** @@ -3929,7 +3905,7 @@ int Field_string::store(double nr) int width=min(field_length,DBL_DIG+5); sprintf(buff,"%-*.*g",width,max(width-5,0),nr); end=strcend(buff,' '); - return Field_string::store(buff,(uint) (end - buff), my_charset_latin1); + return Field_string::store(buff,(uint) (end - buff), my_charset_bin); } @@ -4118,7 +4094,7 @@ int Field_varstring::store(double nr) int width=min(field_length,DBL_DIG+5); sprintf(buff,"%-*.*g",width,max(width-5,0),nr); end=strcend(buff,' '); - return Field_varstring::store(buff,(uint) (end - buff), my_charset_latin1); + return Field_varstring::store(buff,(uint) (end - buff), my_charset_bin); } @@ -4464,22 +4440,23 @@ int Field_blob::store(const char *from,uint len,CHARSET_INFO *cs) int Field_blob::store(double nr) { - value.set(nr,2,current_thd->variables.thd_charset); - return Field_blob::store(value.ptr(),(uint) value.length(), value.charset()); + CHARSET_INFO *cs=charset(); + value.set(nr, 2, cs); + return Field_blob::store(value.ptr(),(uint) value.length(), cs); } int Field_blob::store(longlong nr) { - value.set(nr,current_thd->variables.thd_charset); - return Field_blob::store(value.ptr(), (uint) value.length(), value.charset()); + CHARSET_INFO *cs=charset(); + value.set(nr, cs); + return Field_blob::store(value.ptr(), (uint) value.length(), cs); } double Field_blob::val_real(void) { char *blob; - memcpy_fixed(&blob,ptr+packlength,sizeof(char*)); if (!blob) return 0.0; @@ -4496,8 +4473,7 @@ longlong Field_blob::val_int(void) if (!blob) return 0; uint32 length=get_length(ptr); - CHARSET_INFO *cs=charset(); - return my_strntoll(cs,blob,length,NULL,10); + return my_strntoll(charset(),blob,length,NULL,10); } @@ -4507,9 +4483,9 @@ String *Field_blob::val_str(String *val_buffer __attribute__((unused)), char *blob; memcpy_fixed(&blob,ptr+packlength,sizeof(char*)); if (!blob) - val_ptr->set("",0,field_charset); // A bit safer than ->length(0) + val_ptr->set("",0,charset()); // A bit safer than ->length(0) else - val_ptr->set((const char*) blob,get_length(ptr),field_charset); + val_ptr->set((const char*) blob,get_length(ptr),charset()); return val_ptr; } @@ -4567,7 +4543,8 @@ int Field_blob::cmp_binary(const char *a_ptr, const char *b_ptr, /* The following is used only when comparing a key */ -void Field_blob::get_key_image(char *buff,uint length, CHARSET_INFO *cs,imagetype type) +void Field_blob::get_key_image(char *buff,uint length, + CHARSET_INFO *cs,imagetype type) { length-= HA_KEY_BLOB_LENGTH; uint32 blob_length= get_length(ptr); @@ -4695,22 +4672,26 @@ void Field_blob::sort_string(char *to,uint length) void Field_blob::sql_type(String &res) const { - CHARSET_INFO *cs=res.charset(); const char *str; - uint len; + uint length; switch (packlength) { - default: str="tiny"; break; - case 2: str=""; break; - case 3: str="medium"; break; - case 4: str="long"; break; + default: str="tiny"; length=4; break; + case 2: str=""; length=0; break; + case 3: str="medium"; length= 6; break; + case 4: str="long"; length=4; break; + } + res.set_latin1(str,length); + if (binary()) + res.append("blob"); + else + { + res.append("text"); + if (field_charset != table->table_charset) + { + res.append(" character set "); + res.append(field_charset->csname); + } } - - len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"%s%s%s%s", - str, - binary() ? "blob" : "text", - binary() ? "" : " character set ", - binary() ? "" : field_charset->name); - res.length(len); } @@ -5452,8 +5433,7 @@ create_field::create_field(Field *old_field,Field *orig_field) orig_field) { char buff[MAX_FIELD_WIDTH],*pos; - CHARSET_INFO *field_charset= charset; - String tmp(buff,sizeof(buff),field_charset); + String tmp(buff,sizeof(buff), charset); /* Get the value from record[2] (the default value row) */ my_ptrdiff_t diff= (my_ptrdiff_t) (orig_field->table->rec_buff_length*2); @@ -5465,7 +5445,7 @@ create_field::create_field(Field *old_field,Field *orig_field) { pos= (char*) sql_memdup(tmp.ptr(),tmp.length()+1); pos[tmp.length()]=0; - def=new Item_string(pos,tmp.length(),field_charset); + def=new Item_string(pos,tmp.length(), charset); } } } diff --git a/sql/field.h b/sql/field.h index 67bae7302f9..06a9b534b16 100644 --- a/sql/field.h +++ b/sql/field.h @@ -133,7 +133,9 @@ public: tmp->unireg_check=Field::NONE; tmp->flags&= (NOT_NULL_FLAG | BLOB_FLAG | UNSIGNED_FLAG | ZEROFILL_FLAG | BINARY_FLAG | ENUM_FLAG | SET_FLAG); +#ifdef PROBABLY_WRONG tmp->table_name= new_table->table_name; +#endif tmp->reset_fields(); } return tmp; @@ -1094,7 +1096,8 @@ bool set_field_to_null(Field *field); bool set_field_to_null_with_conversions(Field *field, bool no_conversions); uint find_enum(TYPELIB *typelib,const char *x, uint length); ulonglong find_set(TYPELIB *typelib,const char *x, uint length); -bool test_if_int(const char *str,int length,CHARSET_INFO *cs); +bool test_if_int(const char *str, int length, const char *int_end, + CHARSET_INFO *cs); /* The following are for the interface with the .frm file diff --git a/sql/item.cc b/sql/item.cc index b0b56bf9101..925ee9ac0f4 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -116,7 +116,7 @@ bool Item_string::eq(const Item *item, bool binary_cmp) const bool Item::get_date(TIME *ltime,bool fuzzydate) { char buff[40]; - String tmp(buff,sizeof(buff),NULL),*res; + String tmp(buff,sizeof(buff), my_charset_bin),*res; if (!(res=val_str(&tmp)) || str_to_TIME(res->ptr(),res->length(),ltime,fuzzydate) == TIMESTAMP_NONE) { @@ -134,7 +134,7 @@ bool Item::get_date(TIME *ltime,bool fuzzydate) bool Item::get_time(TIME *ltime) { char buff[40]; - String tmp(buff,sizeof(buff),NULL),*res; + String tmp(buff,sizeof(buff),my_charset_bin),*res; if (!(res=val_str(&tmp)) || str_to_time(res->ptr(),res->length(),ltime)) { @@ -380,7 +380,8 @@ double Item_param::val() { switch (item_result_type) { case STRING_RESULT: - return (double)my_strntod(str_value.charset(),str_value.ptr(),str_value.length(),(char**)0); + return (double) my_strntod(str_value.charset(), (char*) str_value.ptr(), + str_value.length(), (char**) 0); case INT_RESULT: return (double)int_value; default: @@ -1149,7 +1150,7 @@ Item *resolve_const_item(Item *item,Item *comp_item) if (res_type == STRING_RESULT) { char buff[MAX_FIELD_WIDTH]; - String tmp(buff,sizeof(buff),NULL),*result; + String tmp(buff,sizeof(buff),my_charset_bin),*result; result=item->val_str(&tmp); if (item->null_value) { @@ -1204,8 +1205,8 @@ bool field_is_equal_to_item(Field *field,Item *item) { char item_buff[MAX_FIELD_WIDTH]; char field_buff[MAX_FIELD_WIDTH]; - String item_tmp(item_buff,sizeof(item_buff),NULL),*item_result; - String field_tmp(field_buff,sizeof(field_buff),NULL); + String item_tmp(item_buff,sizeof(item_buff),my_charset_bin),*item_result; + String field_tmp(field_buff,sizeof(field_buff),my_charset_bin); item_result=item->val_str(&item_tmp); if (item->null_value) return 1; // This must be true @@ -1263,8 +1264,8 @@ void Item_cache_str::store(Item *item) double Item_cache_str::val() { if (value) - return my_strntod(value->charset(), value->ptr(), - value->length(), (char**)0); + return my_strntod(value->charset(), (char*) value->ptr(), + value->length(), (char**) 0); else return (double)0; } diff --git a/sql/item.h b/sql/item.h index 3decdc388eb..907c293d454 100644 --- a/sql/item.h +++ b/sql/item.h @@ -344,7 +344,7 @@ public: enum Type type() const { return STRING_ITEM; } double val() { - return my_strntod(str_value.charset(), str_value.ptr(), + return my_strntod(str_value.charset(), (char*) str_value.ptr(), str_value.length(), (char**) 0); } longlong val_int() @@ -598,7 +598,11 @@ public: enum Item_result result_type () const { return STRING_RESULT; } enum_field_types field_type() const { return cached_field_type; } double val() - { return null_value ? 0.0 : my_strntod(str_value.charset(),str_value.ptr(),str_value.length(),NULL); } + { + return (null_value ? 0.0 : + my_strntod(str_value.charset(), (char*) str_value.ptr(), + str_value.length(),NULL)); + } longlong val_int() { return null_value ? LL(0) : my_strntoll(str_value.charset(),str_value.ptr(),str_value.length(),(char**) 0,10); } String *val_str(String*); diff --git a/sql/item_func.cc b/sql/item_func.cc index dcf4638c48a..62cf4c0d291 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1893,7 +1893,7 @@ longlong Item_func_set_last_insert_id::val_int() longlong Item_func_benchmark::val_int() { char buff[MAX_FIELD_WIDTH]; - String tmp(buff,sizeof(buff), NULL); + String tmp(buff,sizeof(buff), my_charset_bin); THD *thd=current_thd; for (ulong loop=0 ; loop < loop_count && !thd->killed; loop++) @@ -2039,7 +2039,7 @@ Item_func_set_user_var::update() case STRING_RESULT: { char buffer[MAX_FIELD_WIDTH]; - String tmp(buffer,sizeof(buffer),NULL); + String tmp(buffer,sizeof(buffer),my_charset_bin); (void) val_str(&tmp); break; } @@ -2234,7 +2234,7 @@ longlong Item_func_inet_aton::val_int() char c = '.'; // we mark c to indicate invalid IP in case length is 0 char buff[36]; - String *s,tmp(buff,sizeof(buff),NULL); + String *s,tmp(buff,sizeof(buff),my_charset_bin); if (!(s = args[0]->val_str(&tmp))) // If null value goto err; null_value=0; @@ -2288,7 +2288,7 @@ void Item_func_match::init_search(bool no_order) String *ft_tmp= 0; char tmp1[FT_QUERY_MAXLEN]; - String tmp2(tmp1,sizeof(tmp1),NULL); + String tmp2(tmp1,sizeof(tmp1),default_charset_info); // MATCH ... AGAINST (NULL) is meaningless, but possible if (!(ft_tmp=key_item()->val_str(&tmp2))) diff --git a/sql/item_func.h b/sql/item_func.h index bf64412cab3..11793b11bdb 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -813,7 +813,7 @@ public: double val() { String *res; res=val_str(&str_value); - return res ? my_strntod(res->charset(),res->ptr(),res->length(),0) : 0.0; + return res ? my_strntod(res->charset(),(char*) res->ptr(),res->length(),0) : 0.0; } longlong val_int() { diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 7818a23fcd8..2292c6115a0 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -54,7 +54,8 @@ double Item_str_func::val() { String *res; res=val_str(&str_value); - return res ? my_strntod(res->charset(),res->ptr(),res->length(),NULL) : 0.0; + return res ? my_strntod(res->charset(), (char*) res->ptr(),res->length(), + NULL) : 0.0; } longlong Item_str_func::val_int() diff --git a/sql/item_sum.cc b/sql/item_sum.cc index d78e535010f..b15fceda686 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -341,7 +341,8 @@ double Item_sum_hybrid::val() switch (hybrid_type) { case STRING_RESULT: String *res; res=val_str(&str_value); - return res ? my_strntod(res->charset(),res->ptr(),res->length(),(char**)0) : 0.0; + return (res ? my_strntod(res->charset(), (char*) res->ptr(),res->length(), + (char**) 0) : 0.0); case INT_RESULT: if (unsigned_flag) return ulonglong2double(sum_int); diff --git a/sql/item_sum.h b/sql/item_sum.h index d16a1f2224e..ffc9558822d 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -484,7 +484,8 @@ public: double val() { String *res; res=val_str(&str_value); - return res ? my_strntod(res->charset(),res->ptr(),res->length(),(char**) 0) : 0.0; + return res ? my_strntod(res->charset(),(char*) res->ptr(),res->length(), + (char**) 0) : 0.0; } longlong val_int() { diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 796070acb8a..744c0c1fa49 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -529,7 +529,7 @@ void Item_func_now::fix_length_and_dec() { struct tm tm_tmp,*start; time_t query_start=current_thd->query_start(); - CHARSET_INFO *cs=thd_charset(); + CHARSET_INFO *cs=my_charset_bin; decimals=0; max_length=19*cs->mbmaxlen; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f66122e72a6..27c7fb369a1 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4665,8 +4665,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), berkeley_lock_type=berkeley_lock_types[type-1]; else { - if (test_if_int(argument,(uint) strlen(argument), my_charset_latin1)) - berkeley_lock_scan_time=atoi(argument); + char *end; + uint length= strlen(argument); + long value= my_strntol(my_charset_latin1, argument, length, &end, 10); + if (test_if_int(argument,(uint) length, end, my_charset_latin1)) + berkeley_lock_scan_time= value; else { fprintf(stderr,"Unknown lock type: %s\n",argument); diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 0adde4d39e0..43066a29624 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2796,7 +2796,7 @@ static void print_key(KEY_PART *key_part,const char *key,uint used_length) { char buff[1024]; - String tmp(buff,sizeof(buff),NULL); + String tmp(buff,sizeof(buff),my_charset_bin); for (uint length=0; length < used_length ; diff --git a/sql/procedure.h b/sql/procedure.h index bc1b6062e1d..bc77803230f 100644 --- a/sql/procedure.h +++ b/sql/procedure.h @@ -59,7 +59,7 @@ public: void set(double nr) { value=nr; } void set(longlong nr) { value=(double) nr; } void set(const char *str,uint length,CHARSET_INFO *cs) - { value=my_strntod(cs,str,length,(char**)0); } + { value=my_strntod(cs,(char*) str,length,(char**)0); } double val() { return value; } longlong val_int() { return (longlong) value; } String *val_str(String *s) { s->set(value,decimals,thd_charset()); return s; } @@ -99,7 +99,8 @@ public: double val() { CHARSET_INFO *cs=str_value.charset(); - return my_strntod(cs, str_value.ptr(), str_value.length(),(char**)0); + return my_strntod(cs, (char*) str_value.ptr(), str_value.length(), + (char**) 0); } longlong val_int() { diff --git a/sql/sql_class.cc b/sql/sql_class.cc index ab789370660..4416f5259bd 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -526,7 +526,7 @@ bool select_send::send_data(List &items) List_iterator_fast li(items); Protocol *protocol= thd->protocol; char buff[MAX_FIELD_WIDTH]; - String buffer(buff, sizeof(buff), NULL); + String buffer(buff, sizeof(buff), my_charset_bin); DBUG_ENTER("send_data"); protocol->prepare_for_resend(); @@ -649,7 +649,7 @@ bool select_export::send_data(List &items) DBUG_ENTER("send_data"); char buff[MAX_FIELD_WIDTH],null_buff[2],space[MAX_FIELD_WIDTH]; bool space_inited=0; - String tmp(buff,sizeof(buff),NULL),*res; + String tmp(buff,sizeof(buff),my_charset_bin),*res; tmp.length(0); if (unit->offset_limit_cnt) @@ -857,7 +857,7 @@ bool select_dump::send_data(List &items) { List_iterator_fast li(items); char buff[MAX_FIELD_WIDTH]; - String tmp(buff,sizeof(buff),NULL),*res; + String tmp(buff,sizeof(buff),my_charset_bin),*res; tmp.length(0); Item *item; DBUG_ENTER("send_data"); diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 5b84b86c277..4c499af8f9e 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -30,6 +30,9 @@ extern gptr sql_alloc(unsigned size); extern void sql_element_free(void *ptr); +static uint32 +copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs, + const char *from, uint32 from_length, CHARSET_INFO *from_cs); #include "sql_string.h" @@ -223,55 +226,51 @@ bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *cs) return FALSE; } -/* Copy with charset convertion */ -bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *from, CHARSET_INFO *to) -{ - uint32 new_length=to->mbmaxlen*arg_length; - int cnvres; - my_wc_t wc; - const uchar *s=(const uchar *)str; - const uchar *se=s+arg_length; - uchar *d, *de; + /* Copy with charset convertion */ +bool String::copy(const char *str, uint32 arg_length, + CHARSET_INFO *from_cs, CHARSET_INFO *to_cs) +{ + uint32 new_length= to_cs->mbmaxlen*arg_length; if (alloc(new_length)) return TRUE; - - d=(uchar *)Ptr; - de=d+new_length; - - for (str_length=new_length ; s < se && d < de ; ) - { - if ((cnvres=from->mb_wc(from,&wc,s,se)) > 0 ) - { - s+=cnvres; - } - else if (cnvres==MY_CS_ILSEQ) - { - s++; - wc='?'; - } - else - break; - -outp: - if ((cnvres=to->wc_mb(to,wc,d,de)) >0 ) - { - d+=cnvres; - } - else if (cnvres==MY_CS_ILUNI && wc!='?') - { - wc='?'; - goto outp; - } - else - break; - } - Ptr[new_length]=0; - length((uint32) (d-(uchar *)Ptr)); - str_charset=to; + str_length=copy_and_convert((char*) Ptr, new_length, to_cs, + str, arg_length, from_cs); + str_charset=to_cs; return FALSE; } + +/* + Set a string to the value of a latin1-string, keeping the original charset + + SYNOPSIS + copy_or_set() + str String of a simple charset (latin1) + arg_length Length of string + + IMPLEMENTATION + If string object is of a simple character set, set it to point to the + given string. + If not, make a copy and convert it to the new character set. + + RETURN + 0 ok + 1 Could not allocate result buffer + +*/ + +bool String::set_latin1(const char *str, uint32 arg_length) +{ + if (str_charset->mbmaxlen == 1) + { + set(str, arg_length, str_charset); + return 0; + } + return copy(str, arg_length, my_charset_latin1, str_charset); +} + + /* This is used by mysql.cc */ bool String::fill(uint32 max_length,char fill_char) @@ -306,11 +305,26 @@ bool String::append(const String &s) return FALSE; } + +/* + Append a latin1 string to the a string of the current character set +*/ + + bool String::append(const char *s,uint32 arg_length) { if (!arg_length) // Default argument if (!(arg_length= (uint32) strlen(s))) return FALSE; + if (str_charset->mbmaxlen > 1) + { + uint32 add_length=arg_length * str_charset->mbmaxlen; + if (realloc(str_length+ add_length)) + return TRUE; + str_length+= copy_and_convert(Ptr+str_length, add_length, str_charset, + s, arg_length, my_charset_latin1); + return FALSE; + } if (realloc(str_length+arg_length)) return TRUE; memcpy(Ptr+str_length,s,arg_length); @@ -318,6 +332,7 @@ bool String::append(const char *s,uint32 arg_length) return FALSE; } + #ifdef TO_BE_REMOVED bool String::append(FILE* file, uint32 arg_length, myf my_flags) { @@ -658,4 +673,61 @@ String *copy_if_not_alloced(String *to,String *from,uint32 from_length) } +/**************************************************************************** + Help functions +****************************************************************************/ +/* + copy a string from one character set to another + + SYNOPSIS + copy_and_convert() + to Store result here + to_cs Character set of result string + from Copy from here + from_length Length of from string + from_cs From character set + + NOTES + 'to' must be big enough as form_length * to_cs->mbmaxlen + + RETURN + length of bytes copied to 'to' +*/ + + +static uint32 +copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs, + const char *from, uint32 from_length, CHARSET_INFO *from_cs) +{ + int cnvres; + my_wc_t wc; + const uchar *from_end= (const uchar*) from+from_length; + char *to_start= to; + uchar *to_end= (uchar*) to+to_length; + + while ((uchar*) from < from_end) + { + if ((cnvres=from_cs->mb_wc(from_cs, &wc, (uchar*) from, from_end)) > 0) + from+= cnvres; + else if (cnvres == MY_CS_ILSEQ) + { + from++; + wc= '?'; + } + else + break; // Impossible char. + +outp: + if ((cnvres= to_cs->wc_mb(to_cs, wc, (uchar*) to, to_end)) > 0) + to+= cnvres; + else if (cnvres == MY_CS_ILUNI && wc != '?') + { + wc= '?'; + goto outp; + } + else + break; + } + return (uint32) (to - to_start); +} diff --git a/sql/sql_string.h b/sql/sql_string.h index afcc3d74530..ad91b20f18c 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -115,6 +115,7 @@ public: Ptr=(char*) str; str_length=arg_length; Alloced_length=0 ; alloced=0; str_charset=cs; } + bool String::set_latin1(const char *str, uint32 arg_length); inline void set_quick(char *str,uint32 arg_length, CHARSET_INFO *cs) { if (!alloced) diff --git a/sql/sql_update.cc b/sql/sql_update.cc index bf98ab7f7cb..3aae6f6f411 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -233,6 +233,7 @@ int mysql_update(THD *thd, } } end_read_record(&info); + if (table->key_read) { table->key_read=0; diff --git a/strings/Makefile.am b/strings/Makefile.am index ac0b6d7f1e0..ac4a994872d 100644 --- a/strings/Makefile.am +++ b/strings/Makefile.am @@ -22,19 +22,19 @@ pkglib_LIBRARIES = libmystrings.a # Exact one of ASSEMBLER_X if ASSEMBLER_x86 ASRCS = strings-x86.s longlong2str-x86.s -CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c +CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c my_vsnprintf.c else if ASSEMBLER_sparc32 # These file MUST all be on the same line!! Otherwise automake # generats a very broken makefile ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s -CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c +CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c my_vsnprintf.c else #no assembler ASRCS = # These file MUST all be on the same line!! Otherwise automake # generats a very broken makefile -CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c +CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c my_vsnprintf.c endif endif diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index 49801478504..9bcafa9f164 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -110,88 +110,40 @@ int my_mb_wc_8bit(CHARSET_INFO *cs,my_wc_t *wc, } int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, - unsigned char *s, - unsigned char *e __attribute__((unused))) + unsigned char *str, + unsigned char *end __attribute__((unused))) { MY_UNI_IDX *idx; - for(idx=cs->tab_from_uni; idx->tab ; idx++){ - if(idx->from<=wc && idx->to>=wc){ - s[0]=idx->tab[wc-idx->from]; - return (!s[0] && wc) ? MY_CS_ILUNI : 1; + for (idx=cs->tab_from_uni; idx->tab ; idx++) + { + if (idx->from <= wc && idx->to >= wc) + { + str[0]= idx->tab[wc - idx->from]; + return (!str[0] && wc) ? MY_CS_ILUNI : 1; } } return MY_CS_ILUNI; } -#ifdef NOT_USED -static int my_vsnprintf_8bit(char *to, size_t n, const char* fmt, va_list ap) -{ - char *start=to, *end=to+n-1; - for (; *fmt ; fmt++) - { - if (fmt[0] != '%') - { - if (to == end) /* End of buffer */ - break; - *to++= *fmt; /* Copy ordinary char */ - continue; - } - /* Skip if max size is used (to be compatible with printf) */ - fmt++; - while (my_isdigit(system_charset_info,*fmt) || *fmt == '.' || *fmt == '-') - fmt++; - if (*fmt == 'l') - fmt++; - if (*fmt == 's') /* String parameter */ - { - reg2 char *par = va_arg(ap, char *); - uint plen,left_len = (uint)(end-to); - if (!par) par = (char*)"(null)"; - plen = (uint) strlen(par); - if (left_len <= plen) - plen = left_len - 1; - to=strnmov(to,par,plen); - continue; - } - else if (*fmt == 'd' || *fmt == 'u') /* Integer parameter */ - { - register int iarg; - if ((uint) (end-to) < 16) - break; - iarg = va_arg(ap, int); - if (*fmt == 'd') - to=int10_to_str((long) iarg,to, -10); - else - to=int10_to_str((long) (uint) iarg,to,10); - continue; - } - /* We come here on '%%', unknown code or too long parameter */ - if (to == end) - break; - *to++='%'; /* % used as % or unknown code */ - } - DBUG_ASSERT(to <= end); - *to='\0'; /* End of errmessage */ - return (uint) (to - start); -} -#endif +/* + We can't use vsprintf here as it's not guaranteed to return + the length on all operating systems. + This function is also not called in a safe environment, so the + end buffer must be checked. +*/ int my_snprintf_8bit(CHARSET_INFO *cs __attribute__((unused)), char* to, uint n __attribute__((unused)), const char* fmt, ...) { va_list args; + int result; va_start(args,fmt); -#ifdef NOT_USED - return my_vsnprintf_8bit(to, n, fmt, args); -#endif - /* - FIXME: generally not safe, but it is OK for now - FIXME: as far as it's not called unsafely in the current code - */ - return vsprintf(to,fmt,args); /* FIXME */ + result= my_vsnprintf(to, n, fmt, args); + va_end(args); + return result; } @@ -690,28 +642,48 @@ noconv: return 0L; } -double my_strntod_8bit(CHARSET_INFO *cs __attribute__((unused)), - const char *s, uint l, char **e) +/* + Read double from string + + SYNOPSIS: + my_strntod_8bit() + cs Character set information + str String to convert to double + length Optional length for string. + end pointer to end of converted string + + NOTES: + If length is not INT_MAX32 or str[length] != 0 then the given str must + be writeable + If length == INT_MAX32 the str must be \0 terminated. + + It's implemented this way to save a buffer allocation and a memory copy. + + RETURN + value of number in string +*/ + + +double my_strntod_8bit(CHARSET_INFO *cs __attribute__((unused)), + char *str, uint length, char **end) { - char buf[256]; - double res; - if((l+1)>sizeof(buf)) - { - if (e) - memcpy(*e,s,sizeof(s)); - return 0; - } - strncpy(buf,s,l); - buf[l]='\0'; - res=strtod(buf,e); - if (e) - memcpy(*e,*e-buf+s,sizeof(s)); - return res; + char end_char; + double result; + + if (length == INT_MAX32 || str[length] == 0) + return strtod(str, end); + end_char= str[length]; + str[length]= 0; + result= strtod(str, end); + str[length]= end_char; /* Restore end char */ + return result; } /* This is a fast version optimized for the case of radix 10 / -10 + + Assume len >= 1 */ int my_l10tostr_8bit(CHARSET_INFO *cs __attribute__((unused)), @@ -720,18 +692,19 @@ int my_l10tostr_8bit(CHARSET_INFO *cs __attribute__((unused)), char buffer[66]; register char *p, *e; long int new_val; - int sl=0; - uint l; - + uint sign=0; + e = p = &buffer[sizeof(buffer)-1]; - *e='\0'; + *p= 0; if (radix < 0) { if (val < 0) { - sl = 1; - val = -val; + val= -val; + *dst++= '-'; + len--; + sign= 1; } } @@ -746,41 +719,38 @@ int my_l10tostr_8bit(CHARSET_INFO *cs __attribute__((unused)), val= new_val; } - if (sl) - { - *--p='-'; - } - - l=e-p; - l=(l>len)?len:l; - memcpy(dst,p,l); - return (int)l; + len= min(len, (uint) (e-p)); + memcpy(dst, p, len); + return (int) len+sign; } + int my_ll10tostr_8bit(CHARSET_INFO *cs __attribute__((unused)), char *dst, uint len, int radix, longlong val) { char buffer[65]; register char *p, *e; long long_val; - int sl=0; - uint l; + uint sign= 0; if (radix < 0) { if (val < 0) { - sl=1; val = -val; + *dst++= '-'; + len--; + sign= 1; } } e = p = &buffer[sizeof(buffer)-1]; - *p='\0'; + *p= 0; if (val == 0) { - *--p='0'; + *--p= '0'; + len= 1; goto cnv; } @@ -800,16 +770,10 @@ int my_ll10tostr_8bit(CHARSET_INFO *cs __attribute__((unused)), long_val= quo; } + len= min(len, (uint) (e-p)); cnv: - if (sl) - { - *--p='-'; - } - - l=e-p; - l=(l>len)?len:l; - memcpy(dst,p,l); - return (int)(e-p); + memcpy(dst, p, len); + return len+sign; } diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 42a70731ab5..4f72a4c2334 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -2874,37 +2874,31 @@ bs: double my_strntod_ucs2(CHARSET_INFO *cs __attribute__((unused)), - const char *nptr, uint l, char **endptr) + char *nptr, uint length, char **endptr) { char buf[256]; double res; register char *b=buf; register const char *s=nptr; - register const char *e=nptr+l; + register const char *end; my_wc_t wc; int cnv; - if((l+1)>sizeof(buf)) - { - if (endptr) - *endptr=(char*)nptr; - my_errno=ERANGE; - return 0; - } - - while ((cnv=cs->mb_wc(cs,&wc,s,e))>0) + /* Cut too long strings */ + if (length >= sizeof(buf)) + length= sizeof(buf)-1; + end=nptr+length; + + while ((cnv=cs->mb_wc(cs,&wc,s,end)) > 0) { s+=cnv; - if (wc < 128) - { - *b++=wc; - } - else - break; + if (wc > (int) (uchar) 'e' || !wc) + break; /* Can't be part of double */ + *b++=wc; } - *b='\0'; + *b= 0; - res=strtod(buf,endptr); + res=strtod(buf, endptr); if (endptr) *endptr=(char*) (*endptr-buf+nptr); return res; diff --git a/mysys/my_vsnprintf.c b/strings/my_vsnprintf.c similarity index 74% rename from mysys/my_vsnprintf.c rename to strings/my_vsnprintf.c index f6c91c0c329..a67523af7bc 100644 --- a/mysys/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -14,13 +14,25 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "mysys_priv.h" -#include "mysys_err.h" +#include #include #include #include #include +/* + Limited snprintf() implementations + + IMPLEMENTION: + Supports following formats: + %#d + %#u + %#.#s Note #.# is skiped + + RETURN + length of result string +*/ + int my_snprintf(char* to, size_t n, const char* fmt, ...) { va_list args; @@ -31,9 +43,12 @@ int my_snprintf(char* to, size_t n, const char* fmt, ...) return result; } + int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) { char *start=to, *end=to+n-1; + uint length, num_state, pre_zero; + for (; *fmt ; fmt++) { if (fmt[0] != '%') @@ -43,10 +58,27 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) *to++= *fmt; /* Copy ordinary char */ continue; } - /* Skip if max size is used (to be compatible with printf) */ - fmt++; - while (my_isdigit(system_charset_info,*fmt) || *fmt == '.' || *fmt == '-') + fmt++; /* skip '%' */ + /* Read max fill size (only used with %d and %u) */ + if (*fmt == '-') fmt++; + length= num_state= pre_zero= 0; + for (;; fmt++) + { + if (my_isdigit(system_charset_info,*fmt)) + { + if (!num_state) + { + length=length*10+ (uint) (*fmt-'0'); + if (!length) + pre_zero= 1; /* first digit was 0 */ + } + continue; + } + if (*fmt != '.' || num_state) + break; + num_state= 1; + } if (*fmt == 'l') fmt++; if (*fmt == 's') /* String parameter */ @@ -63,13 +95,26 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) else if (*fmt == 'd' || *fmt == 'u') /* Integer parameter */ { register int iarg; - if ((uint) (end-to) < 16) + char *to_start= to; + if ((uint) (end-to) < max(16,length)) break; iarg = va_arg(ap, int); if (*fmt == 'd') to=int10_to_str((long) iarg,to, -10); else to=int10_to_str((long) (uint) iarg,to,10); + /* If %#d syntax was used, we have to pre-zero/pre-space the string */ + if (length) + { + uint res_length= (uint) (to - to_start); + if (res_length < length) + { + uint diff= (length- res_length); + bmove_upp(to+diff, to, res_length); + bfill(to-res_length, diff, pre_zero ? '0' : ' '); + to+= diff; + } + } continue; } /* We come here on '%%', unknown code or too long parameter */ From 5ce475835c84a79279b78838edc5113329a785ca Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 Jan 2003 18:28:50 +0400 Subject: [PATCH 219/220] bin chatset now handles strnncoll itself so we don't have to check if charset is binary anymore --- sql/field.cc | 30 ------------------------------ strings/ctype-bin.c | 4 ++-- 2 files changed, 2 insertions(+), 32 deletions(-) diff --git a/sql/field.cc b/sql/field.cc index f81f72635b9..467096a4a71 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -4017,11 +4017,6 @@ int Field_string::pack_cmp(const char *a, const char *b, uint length) uint a_length= (uint) (uchar) *a++; uint b_length= (uint) (uchar) *b++; - if (binary()) - { - int cmp= memcmp(a,b,min(a_length,b_length)); - return cmp ? cmp : (int) (a_length - b_length); - } return my_strnncoll(field_charset, (const uchar*)a,a_length, (const uchar*)b,b_length); @@ -4036,11 +4031,6 @@ int Field_string::pack_cmp(const char *b, uint length) end--; uint a_length = (uint) (end - ptr); - if (binary()) - { - int cmp= memcmp(ptr,b,min(a_length,b_length)); - return cmp ? cmp : (int) (a_length - b_length); - } return my_strnncoll(field_charset, (const uchar*)ptr,a_length, (const uchar*)b, b_length); @@ -4231,11 +4221,6 @@ int Field_varstring::pack_cmp(const char *a, const char *b, uint key_length) a_length= (uint) (uchar) *a++; b_length= (uint) (uchar) *b++; } - if (binary()) - { - int cmp= memcmp(a,b,min(a_length,b_length)); - return cmp ? cmp : (int) (a_length - b_length); - } return my_strnncoll(field_charset, (const uchar *)a,a_length, (const uchar *)b,b_length); @@ -4254,11 +4239,6 @@ int Field_varstring::pack_cmp(const char *b, uint key_length) { b_length= (uint) (uchar) *b++; } - if (binary()) - { - int cmp= memcmp(a,b,min(a_length,b_length)); - return cmp ? cmp : (int) (a_length - b_length); - } return my_strnncoll(field_charset, (const uchar *)a,a_length, (const uchar *)b,b_length); @@ -4747,11 +4727,6 @@ int Field_blob::pack_cmp(const char *a, const char *b, uint key_length) a_length= (uint) (uchar) *a++; b_length= (uint) (uchar) *b++; } - if (binary()) - { - int cmp= memcmp(a,b,min(a_length,b_length)); - return cmp ? cmp : (int) (a_length - b_length); - } return my_strnncoll(field_charset, (const uchar *)a,a_length, (const uchar *)b,b_length); @@ -4775,11 +4750,6 @@ int Field_blob::pack_cmp(const char *b, uint key_length) { b_length= (uint) (uchar) *b++; } - if (binary()) - { - int cmp= memcmp(a,b,min(a_length,b_length)); - return cmp ? cmp : (int) (a_length - b_length); - } return my_strnncoll(field_charset, (const uchar *)a,a_length, (const uchar *)b,b_length); diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index 0d7729721ad..e20afff1470 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -47,8 +47,8 @@ static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)), const uchar *s, uint slen, const uchar *t, uint tlen) { - int len = ( slen > tlen ) ? tlen : slen; - return memcmp(s,t,len); + int cmp= memcmp(s,t,min(slen,tlen)); + return cmp ? cmp : (int) (slen - tlen); } static void my_caseup_str_bin(CHARSET_INFO *cs __attribute__((unused)), From 742de8f5ff550da8cfe681fe7bc7b4bdfdccc083 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 Jan 2003 18:00:34 +0200 Subject: [PATCH 220/220] after merging fixing include/m_string.h: added include to va_list bicame known mysql-test/r/union.result: some changing in error message sql/sql_base.cc: error detection moved sql/sql_lex.cc: new flag to detect table name error sql/sql_lex.h: new flag to detect table name error sql/sql_yacc.yy: check possibility of using table name added --- include/m_string.h | 3 +++ mysql-test/r/union.result | 2 +- sql/sql_base.cc | 8 ++------ sql/sql_lex.cc | 2 +- sql/sql_lex.h | 1 + sql/sql_yacc.yy | 40 +++++++++++++++++++++++++++++++++++---- 6 files changed, 44 insertions(+), 12 deletions(-) diff --git a/include/m_string.h b/include/m_string.h index fabd6c9bb59..15a488fe72a 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -31,6 +31,9 @@ #include #endif +/* need by my_vsnprintf */ +#include + /* Correct some things for UNIXWARE7 */ #ifdef HAVE_UNIXWARE7_THREADS #undef HAVE_STRINGS_H diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 94f304c77b1..e546a8c8284 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -85,7 +85,7 @@ a b 2 b 1 a (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b; -Table 't1' from one of SELECT's can not be used in order clause +Table 't1' from one of SELECT's can not be used in global ORDER clause explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 4 diff --git a/sql/sql_base.cc b/sql/sql_base.cc index a384e723e32..038a286f4df 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1749,12 +1749,8 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables, } if (report_error) { - if (thd->lex.current_select->get_master()->order_list.elements) - my_printf_error(ER_TABLENAME_NOT_ALLOWED_HERE, ER(ER_TABLENAME_NOT_ALLOWED_HERE), - MYF(0), table_name, thd->where); - else - my_printf_error(ER_UNKNOWN_TABLE, ER(ER_UNKNOWN_TABLE), MYF(0), - table_name, thd->where); + my_printf_error(ER_UNKNOWN_TABLE, ER(ER_UNKNOWN_TABLE), MYF(0), + table_name, thd->where); } else return (Field*) not_found_field; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index dda3d4e822e..b656f698e89 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -943,7 +943,7 @@ int yylex(void *arg, void *yythd) void st_select_lex_node::init_query() { - dependent= 0; + no_table_names_allowed= dependent= 0; } void st_select_lex_node::init_select() diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 4b6ac927f07..e4a17838cd2 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -212,6 +212,7 @@ public: bool with_sum_func; bool create_refs; bool dependent; /* dependent from outer select subselect */ + bool no_table_names_allowed; /* used for global order by */ static void *operator new(size_t size) { diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 0985859caae..318d563b88a 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3740,17 +3740,41 @@ simple_ident: } | ident '.' ident { - SELECT_LEX_NODE *sel=Select; + THD *thd= YYTHD; + LEX *lex= &thd->lex; + SELECT_LEX_NODE *sel= lex->current_select; + if (sel->no_table_names_allowed) + { + my_printf_error(ER_TABLENAME_NOT_ALLOWED_HERE, + ER(ER_TABLENAME_NOT_ALLOWED_HERE), + MYF(0), $1.str, thd->where); + } $$ = !sel->create_refs || sel->get_in_sum_expr() > 0 ? (Item*) new Item_field(NullS,$1.str,$3.str) : (Item*) new Item_ref(NullS,$1.str,$3.str); } | '.' ident '.' ident { - SELECT_LEX_NODE *sel=Select; + THD *thd= YYTHD; + LEX *lex= &thd->lex; + SELECT_LEX_NODE *sel= lex->current_select; + if (sel->no_table_names_allowed) + { + my_printf_error(ER_TABLENAME_NOT_ALLOWED_HERE, + ER(ER_TABLENAME_NOT_ALLOWED_HERE), + MYF(0), $2.str, thd->where); + } $$ = !sel->create_refs || sel->get_in_sum_expr() > 0 ? (Item*) new Item_field(NullS,$2.str,$4.str) : (Item*) new Item_ref(NullS,$2.str,$4.str); } | ident '.' ident '.' ident { - SELECT_LEX_NODE *sel=Select; + THD *thd= YYTHD; + LEX *lex= &thd->lex; + SELECT_LEX_NODE *sel= lex->current_select; + if (sel->no_table_names_allowed) + { + my_printf_error(ER_TABLENAME_NOT_ALLOWED_HERE, + ER(ER_TABLENAME_NOT_ALLOWED_HERE), + MYF(0), $3.str, thd->where); + } $$ = !sel->create_refs || sel->get_in_sum_expr() > 0 ? (Item*) new Item_field((YYTHD->client_capabilities & CLIENT_NO_SCHEMA ? NullS :$1.str),$3.str,$5.str) : (Item*) new Item_ref((YYTHD->client_capabilities & CLIENT_NO_SCHEMA ? NullS :$1.str),$3.str,$5.str); }; @@ -4535,7 +4559,8 @@ optional_order_or_limit: /* Empty */ {} | { - LEX *lex=Lex; + THD *thd= YYTHD; + LEX *lex= &thd->lex; if (!lex->current_select->linkage == GLOBAL_OPTIONS_TYPE) { send_error(lex->thd, ER_SYNTAX_ERROR); @@ -4547,8 +4572,15 @@ optional_order_or_limit: lex->current_select= sel->master_unit(); lex->current_select->select_limit= lex->thd->variables.select_limit; + lex->current_select->no_table_names_allowed= 1; + thd->where= "global ORDER clause"; } order_or_limit + { + THD *thd= YYTHD; + thd->lex.current_select->no_table_names_allowed= 0; + thd->where= ""; + } ; order_or_limit: