From 60b64b7077c2c9a4c59b84134b44e4ba2288ceb0 Mon Sep 17 00:00:00 2001 From: "mleich@mysql.com" <> Date: Wed, 26 Jan 2005 10:19:28 +0100 Subject: [PATCH 1/4] WL#1420 convert NIST test for mysql Test cases using common object (database,user,table,..) names could probably destroy customer data, when connecting to an already running server. This Changeset contains an auxiliary routine include/testdb_only.inc" which should be sourced by tests doing such dangerous things. The test case will get a "[skipped]" when the environment variable USE_RUNNING_SERVER is not 0 . The modified mysql-test-run.sh sets USE_RUNNING_SERVER to 0, when the "mysql-test-run" starts its own server, aka there was no "--extern" option. --- mysql-test/include/testdb_only.inc | 30 ++++++++++++++++++++++++ mysql-test/mysql-test-run.sh | 37 ++++++++++++++++-------------- mysql-test/r/testdb_only.require | 2 ++ 3 files changed, 52 insertions(+), 17 deletions(-) create mode 100644 mysql-test/include/testdb_only.inc create mode 100644 mysql-test/r/testdb_only.require diff --git a/mysql-test/include/testdb_only.inc b/mysql-test/include/testdb_only.inc new file mode 100644 index 00000000000..ddc3f123d45 --- /dev/null +++ b/mysql-test/include/testdb_only.inc @@ -0,0 +1,30 @@ +#################### include/testdb_only.inc ###################### +# # +# We must prevent to work on databases created by customers, # +# because we DROP/CREATE/MODIFY objects with sometimes common # +# names like STAFF, EMPLOYEE etc. # +# # +# Therefore we check the environment variable USE_RUNNING_SERVER. # +# USE_RUNNING_SERVER is exported by "mysql-test-run" and could # +# contain the following values: # +# 0 -- mysql-test-run was started without the --extern option # +# That means the test will be performed within the test # +# area 'mysql-test/var/...' . # +# 1 -- mysql-test-run was started with the --extern option # +# That means the test will be performed by an already # +# running server and data modifications will most probably # +# outside of the common test area 'mysql-test/var/...' . # +# # +# If USE_RUNNING_SERVER is not 0 the test will be skipped. # +# # +################################################################### + +--disable_query_log +eval set @USE_RUNNING_SERVER= '$USE_RUNNING_SERVER'; +--require r/testdb_only.require +SELECT 'use extern server' + AS "Variable_name ", + IF(@USE_RUNNING_SERVER= '1','YES', + IF(@USE_RUNNING_SERVER= '0','NO','UNEXPECTED')) + AS "Value" ; +--enable_query_log diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 1e3052de8e8..73f10fca5cf 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -224,7 +224,7 @@ EXTRA_MASTER_OPT="" EXTRA_MYSQL_TEST_OPT="" EXTRA_MYSQLDUMP_OPT="" EXTRA_MYSQLBINLOG_OPT="" -USE_RUNNING_SERVER="" +USE_RUNNING_SERVER=0 USE_NDBCLUSTER="" USE_RUNNING_NDBCLUSTER="" DO_GCOV="" @@ -255,7 +255,7 @@ NDBD_EXTRA_OPTS= while test $# -gt 0; do case "$1" in --embedded-server) USE_EMBEDDED_SERVER=1 USE_MANAGER=0 NO_SLAVE=1 ; \ - USE_RUNNING_SERVER="" RESULT_EXT=".es" TEST_MODE="embedded" ;; + USE_RUNNING_SERVER=0 RESULT_EXT=".es" TEST_MODE="embedded" ;; --user=*) DBUSER=`$ECHO "$1" | $SED -e "s;--user=;;"` ;; --force) FORCE=1 ;; --timer) USE_TIMER=1 ;; @@ -265,8 +265,8 @@ while test $# -gt 0; do MASTER_MYSQLD=`$ECHO "$1" | $SED -e "s;--master-binary=;;"` ;; --slave-binary=*) SLAVE_MYSQLD=`$ECHO "$1" | $SED -e "s;--slave-binary=;;"` ;; - --local) USE_RUNNING_SERVER="" ;; - --extern) USE_RUNNING_SERVER="1" ;; + --local) USE_RUNNING_SERVER=0 ;; + --extern) USE_RUNNING_SERVER=1 ;; --with-ndbcluster) USE_NDBCLUSTER="--ndbcluster" ;; --ndb-connectstring=*) @@ -303,7 +303,7 @@ while test $# -gt 0; do --no-manager | --skip-manager) USE_MANAGER=0 ;; --manager) USE_MANAGER=1 - USE_RUNNING_SERVER= + USE_RUNNING_SERVER=0 ;; --start-and-exit) START_AND_EXIT=1 @@ -372,7 +372,7 @@ while test $# -gt 0; do EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb" # This needs to be checked properly # USE_MANAGER=1 - USE_RUNNING_SERVER="" + USE_RUNNING_SERVER=0 ;; --client-gdb ) if [ x$BINARY_DIST = x1 ] ; then @@ -385,7 +385,7 @@ while test $# -gt 0; do --manual-gdb ) DO_GDB=1 MANUAL_GDB=1 - USE_RUNNING_SERVER="" + USE_RUNNING_SERVER=0 EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb" EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb" ;; @@ -394,7 +394,7 @@ while test $# -gt 0; do $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --ddd option" fi DO_DDD=1 - USE_RUNNING_SERVER="" + USE_RUNNING_SERVER=0 EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb" EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb" ;; @@ -412,7 +412,7 @@ while test $# -gt 0; do EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc --skip-bdb" SLEEP_TIME_AFTER_RESTART=10 SLEEP_TIME_FOR_DELETE=60 - USE_RUNNING_SERVER="" + USE_RUNNING_SERVER=0 if test "$1" = "--valgrind-all" then VALGRIND="$VALGRIND -v --show-reachable=yes" @@ -627,9 +627,9 @@ fi if [ -z "$1" ] then - USE_RUNNING_SERVER="" + USE_RUNNING_SERVER=0 fi -if [ -n "$USE_RUNNING_SERVER" ] +if [ $USE_RUNNING_SERVER -eq 1 ] then MASTER_MYSOCK=$LOCAL_SOCKET; DBUSER=${DBUSER:-test} @@ -801,7 +801,7 @@ report_stats () { $ECHO "http://www.mysql.com/doc/en/MySQL_test_suite.html" fi - if test -z "$USE_RUNNING_SERVER" + if [ $USE_RUNNING_SERVER -eq 0 ] then # Report if there was any fatal warnings/errors in the log files @@ -1511,7 +1511,7 @@ run_testcase () done fi - if [ -z "$USE_RUNNING_SERVER" ] ; + if [ $USE_RUNNING_SERVER -eq 0 ] ; then if [ -f $master_opt_file ] ; then @@ -1655,7 +1655,7 @@ run_testcase () if [ x$FORCE != x1 ] ; then $ECHO "Aborting: $tname failed in $TEST_MODE mode. To continue, re-run with '--force'." $ECHO - if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && \ + if [ -z "$DO_GDB" ] && [ $USE_RUNNING_SERVER -eq 0 ] && \ [ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ] then mysql_stop @@ -1664,7 +1664,7 @@ run_testcase () exit 1 fi FAILED_CASES="$FAILED_CASES $tname" - if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && \ + if [ -z "$DO_GDB" ] && [ $USE_RUNNING_SERVER -eq 0 ] && \ [ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ] then mysql_restart @@ -1683,7 +1683,7 @@ run_testcase () [ "$DO_GCOV" ] && gcov_prepare [ "$DO_GPROF" ] && gprof_prepare -if [ -z "$USE_RUNNING_SERVER" ] +if [ $USE_RUNNING_SERVER -eq 0 ] then if [ -z "$FAST_START" ] then @@ -1744,6 +1744,9 @@ fi $ECHO "Starting Tests" +# Some test cases need USE_RUNNING_SERVER +export USE_RUNNING_SERVER + # # This can probably be deleted # @@ -1816,7 +1819,7 @@ fi $ECHO $DASH72 $ECHO -if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && [ -z "$DO_DDD" ] +if [ -z "$DO_GDB" ] && [ $USE_RUNNING_SERVER -eq 0 ] && [ -z "$DO_DDD" ] then mysql_stop fi diff --git a/mysql-test/r/testdb_only.require b/mysql-test/r/testdb_only.require new file mode 100644 index 00000000000..e717418fdb6 --- /dev/null +++ b/mysql-test/r/testdb_only.require @@ -0,0 +1,2 @@ +Variable_name Value +use extern server NO From 259aa7131c0dc7eff4132e3e591ddc83bda1a7ae Mon Sep 17 00:00:00 2001 From: "tomas@poseidon.ndb.mysql.com" <> Date: Wed, 26 Jan 2005 15:07:39 +0100 Subject: [PATCH 2/4] updated show table status usage in ndb tests to become independent on ndb cluster run --- mysql-test/r/ndb_alter_table.result | 8 ++++---- mysql-test/r/ndb_autodiscover.result | 4 ++-- mysql-test/t/ndb_alter_table.test | 4 ++++ mysql-test/t/ndb_autodiscover.test | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/ndb_alter_table.result b/mysql-test/r/ndb_alter_table.result index 2857a4b5cc7..2aab46014a9 100644 --- a/mysql-test/r/ndb_alter_table.result +++ b/mysql-test/r/ndb_alter_table.result @@ -34,13 +34,13 @@ col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null, col6 int not null, to_be_deleted int) ENGINE=ndbcluster; show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 ndbcluster 10 Dynamic 0 0 0 0 0 0 1 NULL NULL NULL latin1_swedish_ci NULL number_of_replicas: 2 +t1 ndbcluster 10 Dynamic 0 0 # # 0 # 1 # # # latin1_swedish_ci NULL # SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO; insert into t1 values (0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7); show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 ndbcluster 10 Dynamic 9 96 131072 0 0 0 101 NULL NULL NULL latin1_swedish_ci NULL number_of_replicas: 2 +t1 ndbcluster 10 Dynamic 9 96 # # 0 # 101 # # # latin1_swedish_ci NULL # select * from t1 order by col1; col1 col2 col3 col4 col5 col6 to_be_deleted 0 4 3 5 PENDING 1 7 @@ -60,7 +60,7 @@ change column col2 fourth varchar(30) not null after col3, modify column col6 int not null first; show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 ndbcluster 10 Dynamic 9 152 131072 0 0 0 102 NULL NULL NULL latin1_swedish_ci NULL number_of_replicas: 2 +t1 ndbcluster 10 Dynamic 9 152 # # 0 # 102 # # # latin1_swedish_ci NULL # select * from t1 order by col1; col6 col1 col3 fourth col4 col4_5 col5 col7 col8 1 0 3 4 5 PENDING 0000-00-00 00:00:00 @@ -75,7 +75,7 @@ col6 col1 col3 fourth col4 col4_5 col5 col7 col8 insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00'); show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 ndbcluster 10 Dynamic 10 152 131072 0 0 0 103 NULL NULL NULL latin1_swedish_ci NULL number_of_replicas: 2 +t1 ndbcluster 10 Dynamic 10 152 # # 0 # 103 # # # latin1_swedish_ci NULL # select * from t1 order by col1; col6 col1 col3 fourth col4 col4_5 col5 col7 col8 1 0 3 4 5 PENDING 0000-00-00 00:00:00 diff --git a/mysql-test/r/ndb_autodiscover.result b/mysql-test/r/ndb_autodiscover.result index b89b4ce1f21..ba21483a9b0 100644 --- a/mysql-test/r/ndb_autodiscover.result +++ b/mysql-test/r/ndb_autodiscover.result @@ -144,8 +144,8 @@ Handler_discover 1 flush tables; show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t6 MyISAM 9 Fixed 1 260 # # # 0 NULL # # NULL # NULL -t7 ndbcluster 9 Fixed 1 276 # # # 0 NULL # # NULL # NULL number_of_replicas: 2 +t6 MyISAM 9 Fixed 1 260 # # # 0 NULL # # NULL # NULL # +t7 ndbcluster 9 Fixed 1 276 # # # 0 NULL # # NULL # NULL # show status like 'handler_discover%'; Variable_name Value Handler_discover 2 diff --git a/mysql-test/t/ndb_alter_table.test b/mysql-test/t/ndb_alter_table.test index 892443a1407..3544a50c3e1 100644 --- a/mysql-test/t/ndb_alter_table.test +++ b/mysql-test/t/ndb_alter_table.test @@ -47,10 +47,12 @@ col3 varchar (20) not null, col4 varchar(4) not null, col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null, col6 int not null, to_be_deleted int) ENGINE=ndbcluster; +--replace_column 7 # 8 # 10 # 12 # 13 # 14 # 18 # show table status; SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO; insert into t1 values (0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7); +--replace_column 7 # 8 # 10 # 12 # 13 # 14 # 18 # show table status; select * from t1 order by col1; alter table t1 @@ -59,9 +61,11 @@ add column col7 varchar(30) not null after col5, add column col8 datetime not null, drop column to_be_deleted, change column col2 fourth varchar(30) not null after col3, modify column col6 int not null first; +--replace_column 7 # 8 # 10 # 12 # 13 # 14 # 18 # show table status; select * from t1 order by col1; insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00'); +--replace_column 7 # 8 # 10 # 12 # 13 # 14 # 18 # show table status; select * from t1 order by col1; delete from t1; diff --git a/mysql-test/t/ndb_autodiscover.test b/mysql-test/t/ndb_autodiscover.test index 2159e6b6e62..713aa326e4d 100644 --- a/mysql-test/t/ndb_autodiscover.test +++ b/mysql-test/t/ndb_autodiscover.test @@ -176,7 +176,7 @@ show status like 'handler_discover%'; flush tables; system rm var/master-data/test/t7.frm ; ---replace_column 7 # 8 # 9 # 12 # 13 # 15 # +--replace_column 7 # 8 # 9 # 12 # 13 # 15 # 18 # show table status; show status like 'handler_discover%'; From 3b2bf2f512a62ae5b2c9e06e38026033b177bed9 Mon Sep 17 00:00:00 2001 From: "georg@beethoven.site" <> Date: Wed, 26 Jan 2005 15:19:20 +0100 Subject: [PATCH 3/4] Fixes for windows compilation bugs (After review of cs georg:1.1800 by Monty) --- VC++Files/libmysqld/libmysqld.dsp | 4 ---- VC++Files/mysqldemb/mysqldemb.dsp | 4 ---- extra/comp_err.c | 8 ++++---- innobase/ut/ut0ut.c | 7 +++++++ libmysql/libmysql.c | 4 ++-- sql/field.h | 2 +- sql/item_sum.cc | 6 +++--- sql/key.cc | 4 ++-- sql/opt_range.cc | 2 +- sql/sql_acl.cc | 4 ++-- sql/table.cc | 6 +++--- 11 files changed, 25 insertions(+), 26 deletions(-) diff --git a/VC++Files/libmysqld/libmysqld.dsp b/VC++Files/libmysqld/libmysqld.dsp index 99912228445..019589289cd 100644 --- a/VC++Files/libmysqld/libmysqld.dsp +++ b/VC++Files/libmysqld/libmysqld.dsp @@ -228,10 +228,6 @@ SOURCE=..\sql\ha_innodb.cpp # End Source File # Begin Source File -SOURCE=..\sql\ha_isammrg.cpp -# End Source File -# Begin Source File - SOURCE=..\sql\ha_myisam.cpp # End Source File # Begin Source File diff --git a/VC++Files/mysqldemb/mysqldemb.dsp b/VC++Files/mysqldemb/mysqldemb.dsp index a8207d436a0..61a745ff7e8 100644 --- a/VC++Files/mysqldemb/mysqldemb.dsp +++ b/VC++Files/mysqldemb/mysqldemb.dsp @@ -169,10 +169,6 @@ SOURCE=..\sql\ha_innodb.cpp # End Source File # Begin Source File -SOURCE=..\sql\ha_isammrg.cpp -# End Source File -# Begin Source File - SOURCE=..\sql\ha_myisam.cpp # End Source File # Begin Source File diff --git a/extra/comp_err.c b/extra/comp_err.c index baed28a0350..a554fc2437e 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -41,7 +41,7 @@ static char *HEADERFILE= (char*) "mysqld_error.h"; static char *NAMEFILE= (char*) "mysqld_ername.h"; static char *STATEFILE= (char*) "sql_state.h"; static char *TXTFILE= (char*) "../sql/share/errmsg.txt"; -static char *DATADIR= (char*) "../sql/share/"; +static char *DATADIRECTORY= (char*) "../sql/share/"; static char *default_dbug_option= (char*) "d:t:O,/tmp/comp_err.trace"; /* Header for errmsg.sys files */ @@ -112,8 +112,8 @@ static struct my_option my_long_options[]= 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"in_file", 'F', "Input file", (gptr *) & TXTFILE, (gptr *) & TXTFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"out_dir", 'D', "Output base directory", (gptr *) & DATADIR, - (gptr *) & DATADIR, + {"out_dir", 'D', "Output base directory", (gptr *) & DATADIRECTORY, + (gptr *) & DATADIRECTORY, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"out_file", 'O', "Output filename (errmsg.sys)", (gptr *) & OUTFILE, (gptr *) & OUTFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -281,7 +281,7 @@ static int create_sys_files(struct languages *lang_head, DBUG_RETURN(1); } - outfile_end= strxmov(outfile, DATADIR, + outfile_end= strxmov(outfile, DATADIRECTORY, tmp_lang->lang_long_name, NullS); if (!my_stat(outfile, &stat_info,MYF(0))) { diff --git a/innobase/ut/ut0ut.c b/innobase/ut/ut0ut.c index f35b4dea5e0..6f2aa0957d8 100644 --- a/innobase/ut/ut0ut.c +++ b/innobase/ut/ut0ut.c @@ -82,10 +82,17 @@ ut_usectime( ulint* sec, /* out: seconds since the Epoch */ ulint* ms) /* out: microseconds since the Epoch+*sec */ { +#ifdef __WIN__ + SYSTEMTIME st; + GetLocalTime(&st); + *sec = (ulint) st.wSecond; + *ms = (ulint) st.wMilliseconds; +#else struct timeval tv; gettimeofday(&tv,NULL); *sec = (ulint) tv.tv_sec; *ms = (ulint) tv.tv_usec; +#endif } /************************************************************** diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index c6815d2a5ce..258391ac899 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1740,7 +1740,7 @@ static int stmt_read_row_no_data(MYSQL_STMT *stmt, unsigned char **row); STMT_ATTR_UPDATE_MAX_LENGTH attribute is set. */ static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data); -static bool setup_one_fetch_function(MYSQL_BIND *bind, MYSQL_FIELD *field); +static my_bool setup_one_fetch_function(MYSQL_BIND *bind, MYSQL_FIELD *field); /* Maximum sizes of MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, MYSQL_TYPE_DATETIME @@ -3718,7 +3718,7 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, longlongstore(buffer, data); } *param->error= value != (param->is_unsigned ? - (double) (*(ulonglong*) buffer) : + ulonglong2double(*(ulonglong*) buffer) : (double) (*(longlong*) buffer)); break; case MYSQL_TYPE_FLOAT: diff --git a/sql/field.h b/sql/field.h index fd1ef09d14f..84d71afcd6f 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1228,7 +1228,7 @@ public: int cmp(const char *a, const char *b) { return cmp_binary(a, b); } int key_cmp(const byte *a, const byte *b) - { return cmp_binary(a, b); } + { return cmp_binary((char *) a, (char *) b); } int key_cmp(const byte *str, uint length); int cmp_offset(uint row_offset); void get_key_image(char *buff, uint length, imagetype type); diff --git a/sql/item_sum.cc b/sql/item_sum.cc index be89aa3f86d..29837c3afbd 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1234,7 +1234,7 @@ int composite_key_cmp(void* arg, byte* key1, byte* key2) { Field* f = *field; int len = *lengths++; - int res = f->cmp(key1, key2); + int res = f->cmp((char *) key1, (char *) key2); if (res) return res; key1 += len; @@ -1688,7 +1688,7 @@ int group_concat_key_cmp_with_distinct(void* arg, byte* key1, { int res; uint offset= (uint) (field->ptr - record); - if ((res= field->cmp(key1 + offset, key2 + offset))) + if ((res= field->cmp((char *) key1 + offset, (char *) key2 + offset))) return res; } } @@ -1722,7 +1722,7 @@ int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2) { int res; uint offset= (uint) (field->ptr - record); - if ((res= field->cmp(key1 + offset, key2 + offset))) + if ((res= field->cmp((char *) key1 + offset, (char *) key2 + offset))) return (*order_item)->asc ? res : -res; } } diff --git a/sql/key.cc b/sql/key.cc index aec294e370a..c5ed60b129c 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -135,7 +135,7 @@ void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length) { key_length-= HA_KEY_BLOB_LENGTH; length= min(key_length, key_part->length); - key_part->field->get_key_image(to_key, length, Field::itRAW); + key_part->field->get_key_image((char *) to_key, length, Field::itRAW); to_key+= HA_KEY_BLOB_LENGTH; } else @@ -217,7 +217,7 @@ void key_restore(byte *to_record, byte *from_key, KEY *key_info, { key_length-= HA_KEY_BLOB_LENGTH; length= min(key_length, key_part->length); - key_part->field->set_key_image(from_key, length); + key_part->field->set_key_image((char *) from_key, length); from_key+= HA_KEY_BLOB_LENGTH; } else diff --git a/sql/opt_range.cc b/sql/opt_range.cc index c3b84564504..e5799bfd509 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1891,7 +1891,7 @@ double get_sweep_read_cost(const PARAM *param, ha_rows records) else { double n_blocks= - ceil((double)param->table->file->data_file_length / IO_SIZE); + ceil(ulonglong2double(param->table->file->data_file_length) / IO_SIZE); double busy_blocks= n_blocks * (1.0 - pow(1.0 - 1.0/n_blocks, rows2double(records))); if (busy_blocks < 1.0) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index f9d95b2cde5..71d042eda02 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1494,12 +1494,12 @@ static bool update_user_table(THD *thd, const char *host, const char *user, DBUG_RETURN(1); /* purecov: deadcode */ table->field[0]->store(host,(uint) strlen(host), system_charset_info); table->field[1]->store(user,(uint) strlen(user), system_charset_info); - key_copy(user_key, table->record[0], table->key_info, + key_copy((byte *) user_key, table->record[0], table->key_info, table->key_info->key_length); table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS); if (table->file->index_read_idx(table->record[0], 0, - user_key, table->key_info->key_length, + (byte *) user_key, table->key_info->key_length, HA_READ_KEY_EXACT)) { my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH), diff --git a/sql/table.cc b/sql/table.cc index 82ad32341c0..69a132329c0 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -305,7 +305,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, if (!(record= (char *) alloc_root(&outparam->mem_root, rec_buff_length * records))) goto err; /* purecov: inspected */ - share->default_values= record; + share->default_values= (byte *) record; if (my_pread(file,(byte*) record, (uint) share->reclength, (ulong) (uint2korr(head+6)+ ((uint2korr(head+14) == 0xffff ? @@ -320,9 +320,9 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, } else { - outparam->record[0]= record+ rec_buff_length; + outparam->record[0]= (byte *) record+ rec_buff_length; if (records > 2) - outparam->record[1]= record+ rec_buff_length*2; + outparam->record[1]= (byte *) record+ rec_buff_length*2; else outparam->record[1]= outparam->record[0]; // Safety } From c38886b20c8f8e74304f1c5a507dbc4635b53da2 Mon Sep 17 00:00:00 2001 From: "ram@gw.mysql.r18.ru" <> Date: Wed, 26 Jan 2005 18:37:49 +0400 Subject: [PATCH 4/4] timed_mutexes moved to include/my_sys.h and mysys/my_static.c to avoid linking problems referring to the variable from .c programs. --- include/my_sys.h | 2 ++ mysys/my_static.c | 2 ++ sql/mysql_priv.h | 1 - sql/mysqld.cc | 1 - 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/my_sys.h b/include/my_sys.h index d11dc4a3e46..72d4bec74b1 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -259,6 +259,8 @@ extern char wild_many,wild_one,wild_prefix; extern const char *charsets_dir; extern char *defaults_extra_file; +extern my_bool timed_mutexes; + typedef struct wild_file_pack /* Struct to hold info when selecting files */ { uint wilds; /* How many wildcards */ diff --git a/mysys/my_static.c b/mysys/my_static.c index 57d41676390..8207463ea50 100644 --- a/mysys/my_static.c +++ b/mysys/my_static.c @@ -25,6 +25,8 @@ #include "my_alarm.h" #endif +my_bool timed_mutexes= 0; + /* from my_init */ my_string home_dir=0,my_progname=0; char NEAR curr_dir[FN_REFLEN]= {0}, diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 5a222a1ce10..0349d9a635f 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -1002,7 +1002,6 @@ extern ulong table_cache_size; extern ulong max_connections,max_connect_errors, connect_timeout; extern ulong slave_net_timeout; extern ulong max_user_connections; -extern my_bool timed_mutexes; extern ulong what_to_log,flush_time; extern ulong query_buff_size, thread_stack,thread_stack_min; extern ulong binlog_cache_size, max_binlog_cache_size, open_files_limit; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 94eb34954ba..e99acd7ed82 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -335,7 +335,6 @@ ulong binlog_cache_use= 0, binlog_cache_disk_use= 0; ulong max_connections,max_used_connections, max_connect_errors, max_user_connections = 0; ulong thread_id=1L,current_pid; -my_bool timed_mutexes= 0; ulong slow_launch_threads = 0, sync_binlog_period; ulong expire_logs_days = 0; ulong rpl_recovery_rank=0;