diff options
54 files changed, 537 insertions, 374 deletions
diff --git a/Docs/mysqld_error.txt b/Docs/mysqld_error.txt index aeb3a12c263..e567d5676aa 100644 --- a/Docs/mysqld_error.txt +++ b/Docs/mysqld_error.txt @@ -1,6 +1,8 @@ /* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB This file is public domain and comes with NO WARRANTY of any kind */ +character-set=latin1 + #define ER_HASHCHK 1000 "hashchk", #define ER_NISAMCHK 1001 @@ -14,11 +16,11 @@ #define ER_CANT_CREATE_TABLE 1005 "Can't create table '%-.64s' (errno: %d)", #define ER_CANT_CREATE_DB 1006 -"Can't create database '%-.64s'. (errno: %d)", +"Can't create database '%-.64s' (errno: %d)", #define ER_DB_CREATE_EXISTS 1007 -"Can't create database '%-.64s'. Database exists", +"Can't create database '%-.64s'; database exists", #define ER_DB_DROP_EXISTS 1008 -"Can't drop database '%-.64s'. Database doesn't exist", +"Can't drop database '%-.64s'; database doesn't exist", #define ER_DB_DROP_DELETE 1009 "Error dropping database (can't delete '%-.64s', errno: %d)", #define ER_DB_DROP_RMDIR 1010 @@ -34,7 +36,7 @@ #define ER_CANT_LOCK 1015 "Can't lock file (errno: %d)", #define ER_CANT_OPEN_FILE 1016 -"Can't open file: '%-.64s'. (errno: %d)", +"Can't open file: '%-.64s' (errno: %d)", #define ER_FILE_NOT_FOUND 1017 "Can't find file: '%-.64s' (errno: %d)", #define ER_CANT_READ_DIR 1018 @@ -44,7 +46,7 @@ #define ER_CHECKREAD 1020 "Record has changed since last read in table '%-.64s'", #define ER_DISK_FULL 1021 -"Disk full (%s). Waiting for someone to free some space....", +"Disk full (%s). Waiting for someone to free some space...", #define ER_DUP_KEY 1022 "Can't write, duplicate key in table '%-.64s'", #define ER_ERROR_ON_CLOSE 1023 @@ -62,17 +64,17 @@ #define ER_FORM_NOT_FOUND 1029 "View '%-.64s' doesn't exist for '%-.64s'", #define ER_GET_ERRNO 1030 -"Got error %d from table handler", +"Got error %d from storage engine", #define ER_ILLEGAL_HA 1031 -"Table handler for '%-.64s' doesn't have this option", +"Table storage engine for '%-.64s' doesn't have this option", #define ER_KEY_NOT_FOUND 1032 "Can't find record in '%-.64s'", #define ER_NOT_FORM_FILE 1033 "Incorrect information in file: '%-.64s'", #define ER_NOT_KEYFILE 1034 -"Incorrect key file for table: '%-.64s'. Try to repair it", +"Incorrect key file for table: '%-.64s'; try to repair it", #define ER_OLD_KEYFILE 1035 -"Old key file for table '%-.64s'; Repair it!", +"Old key file for table '%-.64s'; repair it!", #define ER_OPEN_AS_READONLY 1036 "Table '%-.64s' is read only", #define ER_OUTOFMEMORY 1037 @@ -90,9 +92,9 @@ #define ER_HANDSHAKE_ERROR 1043 "Bad handshake", #define ER_DBACCESS_DENIED_ERROR 1044 -"Access denied for user: '%-.32s@%-.64s' to database '%-.64s'", +"Access denied for user: '%-.32s'@'%-.64s' to database '%-.64s'", #define ER_ACCESS_DENIED_ERROR 1045 -"Access denied for user: '%-.32s@%-.64s' (Using password: %s)", +"Access denied for user: '%-.32s'@'%-.64s' (Using password: %s)", #define ER_NO_DB_ERROR 1046 "No Database Selected", #define ER_UNKNOWN_COM_ERROR 1047 @@ -154,7 +156,7 @@ #define ER_WRONG_AUTO_KEY 1075 "Incorrect table definition; There can only be one auto column and it must be defined as a key", #define ER_READY 1076 -"%s: ready for connections\n", +"%s: ready for connections.\nVersion: '%s' socket: '%s' port: %d\n", #define ER_NORMAL_SHUTDOWN 1077 "%s: Normal shutdown\n", #define ER_GOT_SIGNAL 1078 @@ -170,7 +172,7 @@ #define ER_WRONG_FIELD_TERMINATORS 1083 "Field separator argument is not what is expected. Check the manual", #define ER_BLOBS_AND_NO_TERMINATED 1084 -"You can't use fixed rowlength with BLOBs. Please use 'fields terminated by'.", +"You can't use fixed rowlength with BLOBs. Please use 'fields terminated by'", #define ER_TEXTFILE_NOT_READABLE 1085 "The file '%-.64s' must be in the database directory or be readable by all", #define ER_FILE_EXISTS_ERROR 1086 @@ -180,15 +182,15 @@ #define ER_ALTER_INFO 1088 "Records: %ld Duplicates: %ld", #define ER_WRONG_SUB_KEY 1089 -"Incorrect sub part key. The used key part isn't a string, the used length is longer than the key part or the table handler doesn't support unique sub keys", +"Incorrect sub part key. The used key part isn't a string, the used length is longer than the key part or the storage engine doesn't support unique sub keys", #define ER_CANT_REMOVE_ALL_FIELDS 1090 "You can't delete all columns with ALTER TABLE. Use DROP TABLE instead", #define ER_CANT_DROP_FIELD_OR_KEY 1091 "Can't DROP '%-.64s'. Check that column/key exists", #define ER_INSERT_INFO 1092 "Records: %ld Duplicates: %ld Warnings: %ld", -#define ER_INSERT_TABLE_USED 1093 -"INSERT TABLE '%-.64s' isn't allowed in FROM table list", +#define ER_UPDATE_TABLE_USED 1093 +"You can't specify target table '%-.64s' for update in FROM clause", #define ER_NO_SUCH_THREAD 1094 "Unknown thread id: %lu", #define ER_KILL_DENIED_ERROR 1095 @@ -204,13 +206,13 @@ #define ER_TABLE_NOT_LOCKED 1100 "Table '%-.64s' was not locked with LOCK TABLES", #define ER_BLOB_CANT_HAVE_DEFAULT 1101 -"BLOB column '%-.64s' can't have a default value", +"BLOB/TEXT column '%-.64s' can't have a default value", #define ER_WRONG_DB_NAME 1102 "Incorrect database name '%-.100s'", #define ER_WRONG_TABLE_NAME 1103 "Incorrect table name '%-.100s'", #define ER_TOO_BIG_SELECT 1104 -"The SELECT would examine too many records and probably take a very long time. Check your WHERE and use SET OPTION SQL_BIG_SELECTS=1 if the SELECT is ok", +"The SELECT would examine more rows than MAX_JOIN_SIZE. Check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is ok", #define ER_UNKNOWN_ERROR 1105 "Unknown error", #define ER_UNKNOWN_PROCEDURE 1106 @@ -238,7 +240,7 @@ #define ER_TOO_MANY_FIELDS 1117 "Too many columns", #define ER_TOO_BIG_ROWSIZE 1118 -"Too big row size. The maximum row size, not counting BLOBs, is %d. You have to change some fields to BLOBs", +"Too big row size. The maximum row size for the used table type, not counting BLOBs, is %ld. You have to change some fields to TEXT or BLOBs", #define ER_STACK_OVERRUN 1119 "Thread stack overrun: Used: %ld of a %ld stack. Use 'mysqld -O thread_stack=#' to specify a bigger stack if needed", #define ER_WRONG_OUTER_JOIN 1120 @@ -286,11 +288,11 @@ #define ER_NONEXISTING_GRANT 1141 "There is no such grant defined for user '%-.32s' on host '%-.64s'", #define ER_TABLEACCESS_DENIED_ERROR 1142 -"%-.16s command denied to user: '%-.32s@%-.64s' for table '%-.64s'", +"%-.16s command denied to user: '%-.32s'@'%-.64s' for table '%-.64s'", #define ER_COLUMNACCESS_DENIED_ERROR 1143 -"%-.16s command denied to user: '%-.32s@%-.64s' for column '%-.64s' in table '%-.64s'", +"%-.16s command denied to user: '%-.32s'@'%-.64s' for column '%-.64s' in table '%-.64s'", #define ER_ILLEGAL_GRANT_FOR_TABLE 1144 -"Illegal GRANT/REVOKE command. Please consult the manual which privileges can be used.", +"Illegal GRANT/REVOKE command. Please consult the manual which privileges can be used", #define ER_GRANT_WRONG_HOST_OR_USER 1145 "The host or user argument to GRANT is too long", #define ER_NO_SUCH_TABLE 1146 @@ -332,17 +334,17 @@ #define ER_TABLE_CANT_HANDLE_AUTO_INCREMENT 1164 "The used table type doesn't support AUTO_INCREMENT columns", #define ER_DELAYED_INSERT_TABLE_LOCKED 1165 -"INSERT DELAYED can't be used with table '%-.64s', because it is locked with LOCK TABLES", +"INSERT DELAYED can't be used with table '%-.64s' because it is locked with LOCK TABLES", #define ER_WRONG_COLUMN_NAME 1166 "Incorrect column name '%-.100s'", #define ER_WRONG_KEY_COLUMN 1167 -"The used table handler can't index column '%-.64s'", +"The used storage engine can't index column '%-.64s'", #define ER_WRONG_MRG_TABLE 1168 "All tables in the MERGE table are not identically defined", #define ER_DUP_UNIQUE 1169 "Can't write, because of unique constraint, to table '%-.64s'", #define ER_BLOB_KEY_WITHOUT_LENGTH 1170 -"BLOB column '%-.64s' used in key specification without a key length", +"BLOB/TEXT column '%-.64s' used in key specification without a key length", #define ER_PRIMARY_CANT_HAVE_NULL 1171 "All parts of a PRIMARY KEY must be NOT NULL; If you need NULL in a key, use UNIQUE instead", #define ER_TOO_MANY_ROWS 1172 @@ -358,7 +360,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 %s", +"The storage engine 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 @@ -372,7 +374,7 @@ #define ER_NEW_ABORTING_CONNECTION 1184 "Aborted connection %ld to db: '%-.64s' user: '%-.32s' host: `%-.64s' (%-.64s)", #define ER_DUMP_NOT_IMPLEMENTED 1185 -"The handler for the table does not support binary table dump", +"The storage engine for the table does not support binary table dump", #define ER_FLUSH_MASTER_BINLOG_CLOSED 1186 "Binlog closed, cannot RESET MASTER", #define ER_INDEX_REBUILD 1187 @@ -394,13 +396,13 @@ #define ER_CRASHED_ON_REPAIR 1195 "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", #define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196 -"Warning: Some non-transactional changed tables couldn't be rolled back", +"Some non-transactional changed tables couldn't be rolled back", #define ER_TRANS_CACHE_FULL 1197 -"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again', +"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again", #define ER_SLAVE_MUST_STOP 1198 -"This operation cannot be performed with a running slave, run SLAVE STOP first", +"This operation cannot be performed with a running slave, run STOP SLAVE first", #define ER_SLAVE_NOT_RUNNING 1199 -"This operation requires a running slave, configure slave and do SLAVE START", +"This operation requires a running slave, configure slave and do START SLAVE", #define ER_BAD_SLAVE 1200 "The server is not configured as slave, fix in config file or with CHANGE MASTER TO", #define ER_MASTER_INFO 1201 @@ -424,19 +426,19 @@ #define ER_WRONG_ARGUMENTS 1210 "Wrong arguments to %s", #define ER_NO_PERMISSION_TO_CREATE_USER 1211 -"%-.32s@%-.64s is not allowed to create new users", +"'%-.32s'@'%-.64s' is not allowed to create new users", #define ER_UNION_TABLES_IN_DIFFERENT_DIR 1212 -"Incorrect table definition; All MERGE tables must be in the same database", +"Incorrect table definition; all MERGE tables must be in the same database", #define ER_LOCK_DEADLOCK 1213 "Deadlock found when trying to get lock; Try restarting transaction", -#define ER_TABLE_CANT_HANDLE_FULLTEXT 1214 +#define ER_TABLE_CANT_HANDLE_FT 1214 "The used table type doesn't support FULLTEXT indexes", #define ER_CANNOT_ADD_FOREIGN 1215 "Cannot add foreign key constraint", #define ER_NO_REFERENCED_ROW 1216 -"Cannot add a child row: a foreign key constraint fails", +"Cannot add or update a child row: a foreign key constraint fails", #define ER_ROW_IS_REFERENCED 1217 -"Cannot delete a parent row: a foreign key constraint fails", +"Cannot delete or update a parent row: a foreign key constraint fails", #define ER_CONNECT_TO_MASTER 1218 "Error connecting to master: %-.128s", #define ER_QUERY_ON_MASTER 1219 @@ -475,3 +477,97 @@ "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", +#define ER_SLAVE_IGNORED_TABLE 1237 +"Slave SQL thread ignored the query because of replicate-*-table rules", +#define ER_WRONG_FK_DEF 1238 +"Wrong foreign key definition for '%-.64s': %s", +#define ER_KEY_REF_DO_NOT_MATCH_TABLE_REF 1239 +"Key reference and table reference doesn't match", +#define ER_OPERAND_COLUMNS 1240 +"Operand should contain %d column(s)", +#define ER_SUBQUERY_NO_1_ROW 1241 +"Subquery returns more than 1 row", +#define ER_UNKNOWN_STMT_HANDLER 1242 +"Unknown prepared statement handler (%ld) given to %s", +#define ER_CORRUPT_HELP_DB 1243 +"Help database is corrupt or does not exist", +#define ER_CYCLIC_REFERENCE 1244 +"Cyclic reference on subqueries", +#define ER_AUTO_CONVERT 1245 +"Converting column '%s' from %s to %s", +#define ER_ILLEGAL_REFERENCE 1246 +"Reference '%-.64s' not supported (%s)", +#define ER_DERIVED_MUST_HAVE_ALIAS 1247 +"Every derived table must have it's own alias", +#define ER_SELECT_REDUCED 1248 +"Select %u was reduced during optimisation", +#define ER_TABLENAME_NOT_ALLOWED_HERE 1249 +"Table '%-.64s' from one of SELECT's can not be used in %-.32s", +#define ER_NOT_SUPPORTED_AUTH_MODE 1250 +"Client does not support authentication protocol requested by server; consider upgrading MySQL client", +#define ER_SPATIAL_CANT_HAVE_NULL 1251 +"All parts of a SPATIAL KEY must be NOT NULL", +#define ER_COLLATION_CHARSET_MISMATCH 1252 +"COLLATION '%s' is not valid for CHARACTER SET '%s'", +#define ER_SLAVE_WAS_RUNNING 1253 +"Slave is already running", +#define ER_SLAVE_WAS_NOT_RUNNING 1254 +"Slave has already been stopped", +#define ER_TOO_BIG_FOR_UNCOMPRESS 1255 +"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", +#define ER_ZLIB_Z_MEM_ERROR 1256 +"ZLIB: Not enough memory available for zlib", +#define ER_ZLIB_Z_BUF_ERROR 1257 +"ZLIB: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", +#define ER_ZLIB_Z_DATA_ERROR 1258 +"ZLIB: Input data was corrupted for zlib", +#define ER_CUT_VALUE_GROUP_CONCAT 1259 +"%d line(s) was(were) cut by group_concat()", +#define ER_WARN_TOO_FEW_RECORDS 1260 +"Record count is fewer than the column count at row %ld"; +#define ER_WARN_TOO_MANY_RECORDS 1261 +"Record count is more than the column count at row %ld"; +#define ER_WARN_NULL_TO_NOTNULL 1262 +"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; +#define ER_WARN_DATA_OUT_OF_RANGE 1263 +"Data truncated, out of range for column '%s' at row %ld"; +#define ER_WARN_DATA_TRUNCATED 1264 +"Data truncated for column '%s' at row %ld", +#define ER_WARN_USING_OTHER_HANDLER 1265 +"Using storage engine %s for table '%s'", +#define ER_CANT_AGGREGATE_2COLLATIONS 1266 +"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", +#define ER_DROP_USER 1267 +"Can't drop one or more of the requested users", +#define ER_REVOKE_GRANTS 1268 +"Can't revoke all privileges, grant for one or more of the requested users", +#define ER_CANT_AGGREGATE_3COLLATIONS 1269 +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +#define ER_CANT_AGGREGATE_NCOLLATIONS 1270 +"Illegal mix of collations for operation '%s'", +#define ER_VARIABLE_IS_NOT_STRUCT 1271 +"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +#define ER_UNKNOWN_COLLATION 1272 +"Unknown collation: '%-.64s'", +#define ER_SLAVE_IGNORED_SSL_PARAMS 1273 +"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.", +#define ER_SERVER_IS_IN_SECURE_AUTH_MODE 1274 +"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format", +#define ER_WARN_FIELD_RESOLVED 1275 +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", +#define ER_BAD_SLAVE_UNTIL_COND 1276 +"Wrong parameter or combination of parameters for START SLAVE UNTIL", +#define ER_MISSING_SKIP_SLAVE 1277 +"It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL. Otherwise you will get problems if you get an unexpected slave's mysqld restart", +#define ER_UNTIL_COND_IGNORED 1278 +"SQL thread is not to be started so UNTIL options are ignored", +#define ER_WRONG_NAME_FOR_INDEX 1279 +"Incorrect index name '%-.100s'", +#define ER_WRONG_NAME_FOR_CATALOG 1280 +"Incorrect catalog name '%-.100s'", +#define ER_WARN_QC_RESIZE 1281 +"Query cache failed to set size %lu, new query cache size is %lu", +#define ER_BAD_FT_COLUMN 1282 +"Column '%-.64s' cannot be part of FULLTEXT index", +#define ER_UNKNOWN_KEY_CACHE 1283 +"Unknown key cache '%-.100s'", diff --git a/Makefile.am b/Makefile.am index 6afbce11dfa..4e4c2da8082 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,10 +23,9 @@ EXTRA_DIST = INSTALL-SOURCE README COPYING zlib SUBDIRS = . include @docs_dirs@ \ @readline_topdir@ sql-common \ @thread_dirs@ pstack @sql_client_dirs@ \ - @sql_server_dirs@ scripts man tests \ + @sql_server_dirs@ scripts man tests SSL\ BUILD @netware_dir@ os2 @libmysqld_dirs@ \ @bench_dirs@ support-files @fs_dirs@ @tools_dirs@ - # Relink after clean linked_sources = linked_client_sources linked_server_sources \ diff --git a/SSL/Makefile.am b/SSL/Makefile.am new file mode 100644 index 00000000000..bd3aad1e3b2 --- /dev/null +++ b/SSL/Makefile.am @@ -0,0 +1,24 @@ +# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 + +## Process this file with automake to create Makefile.in + +EXTRA_DIST= NOTES cacert.pem client-cert.pem client-key.pem \ + client-req.pem run-client run-server server-cert.pem \ + server-key.pem server-req.pem + +# Don't update the files from bitkeeper +%::SCCS/s.% diff --git a/configure.in b/configure.in index 4b930b45f04..88622ececab 100644 --- a/configure.in +++ b/configure.in @@ -2818,7 +2818,7 @@ AC_OUTPUT(Makefile extra/Makefile mysys/Makefile isam/Makefile dnl libmysql_r/Makefile libmysqld/Makefile libmysqld/examples/Makefile dnl libmysql/Makefile client/Makefile dnl pstack/Makefile pstack/aout/Makefile sql/Makefile sql/share/Makefile dnl - sql-common/Makefile dnl + sql-common/Makefile SSL/Makefile dnl merge/Makefile dbug/Makefile scripts/Makefile dnl include/Makefile sql-bench/Makefile tools/Makefile dnl tests/Makefile Docs/Makefile support-files/Makefile dnl diff --git a/include/sql_common.h b/include/sql_common.h index 1c374030a55..fef573f7450 100644 --- a/include/sql_common.h +++ b/include/sql_common.h @@ -22,9 +22,6 @@ extern const char *not_error_sqlstate; extern "C" { #endif -ulong STDCALL net_field_length(uchar **packet); -my_ulonglong net_field_length_ll(uchar **packet); - MYSQL_FIELD *unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, my_bool default_value, uint server_capabilities); void free_rows(MYSQL_DATA *cur); diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index be57868e574..fe5b4f9c096 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -428,7 +428,7 @@ os_file_handle_error_no_exit( return (FALSE); } - return(FALSE); + return(FALSE); /* not reached */ } /******************************************************************** diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index 9987804f03e..1f709025759 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -995,7 +995,7 @@ srv_console( srv_dec_thread_count(SRV_CONSOLE); } - return(0); + return(0); /* Not reached */ } /************************************************************************* @@ -3286,7 +3286,7 @@ suspend_thread: os_thread_exit(NULL); #ifndef __WIN__ - return(NULL); + return(NULL); /* Not reached */ #else return(0); #endif diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index 3f375b66c4f..69ddaec0619 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -441,7 +441,7 @@ io_handler_thread( os_thread_exit(NULL); #ifndef __WIN__ - return(NULL); + return(NULL); /* Not reached */ #else return(0); #endif diff --git a/innobase/trx/trx0sys.c b/innobase/trx/trx0sys.c index 89412003485..177c5db7413 100644 --- a/innobase/trx/trx0sys.c +++ b/innobase/trx/trx0sys.c @@ -589,7 +589,7 @@ trx_sys_update_mysql_binlog_offset( mlog_write_string(sys_header + field + TRX_SYS_MYSQL_LOG_NAME, - file_name, 1 + ut_strlen(file_name), mtr); + (byte*) file_name, 1 + ut_strlen(file_name), mtr); } if (mach_read_from_4(sys_header + field diff --git a/isam/isamchk.c b/isam/isamchk.c index 0c0df603da0..4e7ab7ec854 100644 --- a/isam/isamchk.c +++ b/isam/isamchk.c @@ -286,8 +286,8 @@ static struct my_option my_long_options[] = "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"block-search", 'b', "For debugging.", (gptr*) &search_after_block, - (gptr*) &search_after_block, 0, GET_ULONG, REQUIRED_ARG, NI_POS_ERROR, 0, - 0, 0, 0, 0}, + (gptr*) &search_after_block, 0, GET_ULONG, REQUIRED_ARG, + (longlong) NI_POS_ERROR, 0, 0, 0, 0, 0}, {"silent", 's', "Only print errors. One can use two -s to make isamchk very silent.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/libmysql/conf_to_src.c b/libmysql/conf_to_src.c index 95ffcf1cb2b..8d931309abb 100644 --- a/libmysql/conf_to_src.c +++ b/libmysql/conf_to_src.c @@ -16,9 +16,9 @@ /* can't use -lmysys because this prog is used to create -lstrings */ + +#include <my_global.h> #include <ctype.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> #include <unistd.h> diff --git a/myisam/mi_check.c b/myisam/mi_check.c index bd8c8c60e33..6f794ad2ea8 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -3301,30 +3301,28 @@ static int sort_ft_key_write(MI_SORT_PARAM *sort_param, const void *a) ft_buf->buf=0; return error; } - else - { - /* flushing buffer */ - if ((error=sort_ft_buf_flush(sort_param))) - return error; -word_init_ft_buf: - a_len+=val_len; - memcpy(ft_buf->lastkey, a, a_len); - ft_buf->buf=ft_buf->lastkey+a_len; - ft_buf->end=ft_buf->lastkey+ (sort_param->keyinfo->block_length-32); - /* 32 is just a safety margin here - (at least max(val_len, sizeof(nod_flag)) should be there). - May be better performance could be achieved if we'd put - (sort_info->keyinfo->block_length-32)/XXX - instead. - TODO: benchmark the best value for XXX. - */ + /* flushing buffer */ + if ((error=sort_ft_buf_flush(sort_param))) + return error; - return 0; - } - return -1; /* impossible */ +word_init_ft_buf: + a_len+=val_len; + memcpy(ft_buf->lastkey, a, a_len); + ft_buf->buf=ft_buf->lastkey+a_len; + /* + 32 is just a safety margin here + (at least max(val_len, sizeof(nod_flag)) should be there). + May be better performance could be achieved if we'd put + (sort_info->keyinfo->block_length-32)/XXX + instead. + TODO: benchmark the best value for XXX. + */ + ft_buf->end=ft_buf->lastkey+ (sort_param->keyinfo->block_length-32); + return 0; } /* sort_ft_key_write */ + /* get pointer to record from a key */ static my_off_t get_record_for_key(MI_INFO *info, MI_KEYDEF *keyinfo, diff --git a/myisam/mi_delete.c b/myisam/mi_delete.c index f21b0e928b6..a55d5b2a5ca 100644 --- a/myisam/mi_delete.c +++ b/myisam/mi_delete.c @@ -241,7 +241,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, if (info->ft1_to_ft2) { /* we're in ft1->ft2 conversion mode. Saving key data */ - insert_dynamic(info->ft1_to_ft2, lastkey+off); + insert_dynamic(info->ft1_to_ft2, (char*) (lastkey+off)); } else { diff --git a/myisam/mi_page.c b/myisam/mi_page.c index 8c6981afa00..c70209c2da6 100644 --- a/myisam/mi_page.c +++ b/myisam/mi_page.c @@ -52,7 +52,7 @@ uchar *_mi_fetch_keypage(register MI_INFO *info, MI_KEYDEF *keyinfo, { DBUG_PRINT("error",("page %lu had wrong page length: %u", (ulong) page, page_size)); - DBUG_DUMP("page", tmp, keyinfo->block_length); + DBUG_DUMP("page", (char*) tmp, keyinfo->block_length); info->last_keypage = HA_OFFSET_ERROR; my_errno = HA_ERR_CRASHED; tmp = 0; diff --git a/myisam/mi_preload.c b/myisam/mi_preload.c index 80489cbcd13..5e03d489efe 100644 --- a/myisam/mi_preload.c +++ b/myisam/mi_preload.c @@ -108,11 +108,11 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves) } while (pos != key_file_length); - my_free(buff, MYF(0)); + my_free((char*) buff, MYF(0)); DBUG_RETURN(0); err: - my_free(buff, MYF(MY_ALLOW_ZERO_PTR)); + my_free((char*) buff, MYF(MY_ALLOW_ZERO_PTR)); DBUG_RETURN(my_errno= errno); } diff --git a/myisam/mi_write.c b/myisam/mi_write.c index 86c45e0692f..d13ba6c2c4e 100644 --- a/myisam/mi_write.c +++ b/myisam/mi_write.c @@ -521,7 +521,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo, we cannot easily dispatch an empty page here */ b+=blen+ft2len+2; for (a=anc_buff+a_length ; b < a ; b+=ft2len+2) - insert_dynamic(info->ft1_to_ft2, b); + insert_dynamic(info->ft1_to_ft2, (char*) b); /* fixing the page's length - it contains only one key now */ mi_putint(anc_buff,2+blen+ft2len+2,0); diff --git a/myisam/myisampack.c b/myisam/myisampack.c index 5ca57248204..93edde33bdb 100644 --- a/myisam/myisampack.c +++ b/myisam/myisampack.c @@ -51,7 +51,7 @@ struct st_file_buffer { char *buffer,*pos,*end; my_off_t pos_in_file; int bits; - uint byte; + uint current_byte; }; struct st_huff_tree; @@ -1912,7 +1912,7 @@ static void init_file_buffer(File file, pbool read_buffer) file_buffer.pos=file_buffer.buffer; file_buffer.bits=BITS_SAVED; } - file_buffer.byte=0; + file_buffer.current_byte=0; } @@ -1961,13 +1961,13 @@ static void write_bits (register ulong value, register uint bits) { if ((file_buffer.bits-=(int) bits) >= 0) { - file_buffer.byte|=value << file_buffer.bits; + file_buffer.current_byte|=value << file_buffer.bits; } else { reg3 uint byte_buff; bits= (uint) -file_buffer.bits; - byte_buff=file_buffer.byte | (uint) (value >> bits); + byte_buff=file_buffer.current_byte | (uint) (value >> bits); #if BITS_SAVED == 32 *file_buffer.pos++= (byte) (byte_buff >> 24) ; *file_buffer.pos++= (byte) (byte_buff >> 16) ; @@ -1993,7 +1993,7 @@ static void write_bits (register ulong value, register uint bits) if (file_buffer.pos >= file_buffer.end) VOID(flush_buffer((uint) ~0)); file_buffer.bits=(int) (BITS_SAVED - bits); - file_buffer.byte=(uint) (value << (BITS_SAVED - bits)); + file_buffer.current_byte=(uint) (value << (BITS_SAVED - bits)); } return; } @@ -2005,7 +2005,7 @@ static void flush_bits (void) uint bits,byte_buff; bits=(file_buffer.bits) & ~7; - byte_buff = file_buffer.byte >> bits; + byte_buff = file_buffer.current_byte >> bits; bits=BITS_SAVED - bits; while (bits > 0) { @@ -2013,7 +2013,7 @@ static void flush_bits (void) *file_buffer.pos++= (byte) (uchar) (byte_buff >> bits) ; } file_buffer.bits=BITS_SAVED; - file_buffer.byte=0; + file_buffer.current_byte=0; return; } diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index f896f7fa9cc..29cd7a05f7d 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -1,4 +1,4 @@ -#! /bin/sh +#!/bin/sh # mysql-test-run - originally written by Matt Wagner <matt@mysql.com> # modified by Sasha Pachev <sasha@mysql.com> # Slightly updated by Monty @@ -229,7 +229,6 @@ while test $# -gt 0; do --local) USE_RUNNING_SERVER="" ;; --extern) USE_RUNNING_SERVER="1" ;; --tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;; - --start-from=*) START_FROM=`$ECHO "$1" | $SED -e "s;--start-from=;;"` ;; --local-master) MASTER_MYPORT=3306; EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT --host=127.0.0.1 \ @@ -1173,7 +1172,7 @@ run_testcase () slave_master_info_file=$TESTDIR/$tname.slave-mi echo $tname > $CURRENT_TEST SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0` - if [ $USE_MANAGER = 1 ] ; then + if [ "$USE_MANAGER" = 1 ] ; then many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)` fi @@ -1186,11 +1185,6 @@ run_testcase () fi fi - if [ "$tname" '<' "$START_FROM" ] ; then -# skip_test $tname; - return; - fi - if [ -n "$DO_TEST" ] ; then DO_THIS_TEST=`$EXPR \( $tname : "$DO_TEST" \) != 0` if [ x$DO_THIS_TEST = x0 ] ; diff --git a/mysys/hash.c b/mysys/hash.c index 665e3d11e8d..4ef8847363f 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -41,7 +41,7 @@ static int hashcmp(HASH *hash,HASH_LINK *pos,const byte *key,uint length); static uint calc_hash(HASH *hash,const byte *key,uint length) { ulong nr1=1, nr2=4; - hash->charset->coll->hash_sort(hash->charset,key,length,&nr1,&nr2); + hash->charset->coll->hash_sort(hash->charset,(uchar*) key,length,&nr1,&nr2); return nr1; } @@ -216,7 +216,8 @@ static int hashcmp(HASH *hash,HASH_LINK *pos,const byte *key,uint length) uint rec_keylength; byte *rec_key= (byte*) hash_key(hash,pos->data,&rec_keylength,1); return (length && length != rec_keylength) || - my_strnncoll(hash->charset, rec_key, rec_keylength, key, length); + my_strnncoll(hash->charset, (uchar*) rec_key, rec_keylength, + (uchar*) key, length); } diff --git a/mysys/mf_wcomp.c b/mysys/mf_wcomp.c index 62a5a02eaea..c2a103688f2 100644 --- a/mysys/mf_wcomp.c +++ b/mysys/mf_wcomp.c @@ -74,7 +74,7 @@ int wild_compare(register const char *str, register const char *wildstr, DBUG_RETURN(0); /* '*' as last char: OK */ if ((cmp= *wildstr) == wild_prefix && wildstr[1] && !str_is_pattern) cmp=wildstr[1]; - for(;;str++) + for (;;str++) { while (*str && *str != cmp) str++; @@ -83,7 +83,7 @@ int wild_compare(register const char *str, register const char *wildstr, if (wild_compare(str,wildstr,str_is_pattern) == 0) DBUG_RETURN (0); } - DBUG_RETURN(1); + /* We will never come here */ } } DBUG_RETURN (*str != 0); diff --git a/mysys/my_append.c b/mysys/my_append.c index dc5ed084bb3..c3549c670c3 100644 --- a/mysys/my_append.c +++ b/mysys/my_append.c @@ -18,10 +18,10 @@ #include "mysys_priv.h" #include <sys/stat.h> #include <m_string.h> -#if defined(HAVE_SYS_UTIME_H) -#include <sys/utime.h> -#elif defined(HAVE_UTIME_H) +#if defined(HAVE_UTIME_H) #include <utime.h> +#elif defined(HAVE_SYS_UTIME_H) +#include <sys/utime.h> #elif !defined(HPUX10) struct utimbuf { time_t actime; diff --git a/mysys/my_copy.c b/mysys/my_copy.c index 84eda781a09..03f3feb54d3 100644 --- a/mysys/my_copy.c +++ b/mysys/my_copy.c @@ -18,10 +18,10 @@ #include "mysys_priv.h" #include <sys/stat.h> #include <m_string.h> -#if defined(HAVE_SYS_UTIME_H) -#include <sys/utime.h> -#elif defined(HAVE_UTIME_H) +#if defined(HAVE_UTIME_H) #include <utime.h> +#elif defined(HAVE_SYS_UTIME_H) +#include <sys/utime.h> #elif !defined(HPUX10) #include <time.h> struct utimbuf { diff --git a/mysys/my_redel.c b/mysys/my_redel.c index 9ba03cd9526..9af360424b0 100644 --- a/mysys/my_redel.c +++ b/mysys/my_redel.c @@ -19,10 +19,10 @@ #include <my_dir.h> #include <m_string.h> #include "mysys_err.h" -#if defined(HAVE_SYS_UTIME_H) -#include <sys/utime.h> -#elif defined(HAVE_UTIME_H) +#if defined(HAVE_UTIME_H) #include <utime.h> +#elif defined(HAVE_SYS_UTIME_H) +#include <sys/utime.h> #elif !defined(HPUX10) struct utimbuf { time_t actime; diff --git a/sql-common/client.c b/sql-common/client.c index 878a8beacba..dd6a5339454 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1235,7 +1235,8 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, { mysql->warning_count= uint2korr(cp+1); mysql->server_status= uint2korr(cp+3); - DBUG_PRINT("info",("warning_count: %ld", mysql->warning_count)); + DBUG_PRINT("info",("status: %u warning_count: %u", + mysql->server_status, mysql->warning_count)); } DBUG_PRINT("exit",("Got %d rows",result->rows)); DBUG_RETURN(result); @@ -2247,6 +2248,9 @@ get_info: { mysql->affected_rows= net_field_length_ll(&pos); mysql->insert_id= net_field_length_ll(&pos); + DBUG_PRINT("info",("affected_rows: %lu insert_id: %lu", + (ulong) mysql->affected_rows, + (ulong) mysql->insert_id)); if (protocol_41(mysql)) { mysql->server_status=uint2korr(pos); pos+=2; @@ -2254,10 +2258,11 @@ get_info: } else if (mysql->server_capabilities & CLIENT_TRANSACTIONS) { + /* MySQL 4.0 protocol */ mysql->server_status=uint2korr(pos); pos+=2; mysql->warning_count= 0; } - DBUG_PRINT("info",("status: %ld warning_count: %ld", + DBUG_PRINT("info",("status: %u warning_count: %u", mysql->server_status, mysql->warning_count)); if (pos < mysql->net.read_pos+length && net_field_length(&pos)) mysql->info=(char*) pos; diff --git a/sql-common/pack.c b/sql-common/pack.c index e31e596ae7a..ed79143a04b 100644 --- a/sql-common/pack.c +++ b/sql-common/pack.c @@ -78,23 +78,40 @@ my_ulonglong net_field_length_ll(uchar **packet) #endif } +/* + Store an integer with simple packing into a output package + + SYNOPSIS + net_store_length() + pkg Store the packed integer here + length integers to store + + NOTES + This is mostly used to store lengths of strings. + We have to cast the result for the LL() becasue of a bug in Forte CC + compiler. + + RETURN + Position in 'pkg' after the packed length +*/ + char * net_store_length(char *pkg, ulonglong length) { uchar *packet=(uchar*) pkg; - if (length < LL(251)) + if (length < (ulonglong) LL(251)) { *packet=(uchar) length; return (char*) packet+1; } /* 251 is reserved for NULL */ - if (length < LL(65536)) + if (length < (ulonglong) LL(65536)) { *packet++=252; int2store(packet,(uint) length); return (char*) packet+2; } - if (length < LL(16777216)) + if (length < (ulonglong) LL(16777216)) { *packet++=253; int3store(packet,(ulong) length); diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc index fb4061b31e0..ae0267b98f3 100644 --- a/sql/ha_heap.cc +++ b/sql/ha_heap.cc @@ -248,7 +248,8 @@ ha_rows ha_heap::records_in_range(int inx, } } -int ha_heap::create(const char *name, TABLE *table, + +int ha_heap::create(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_info) { uint key, parts, mem_per_row= 0; @@ -259,17 +260,17 @@ int ha_heap::create(const char *name, TABLE *table, char buff[FN_REFLEN]; int error; - for (key= parts= 0; key < table->keys; key++) - parts+= table->key_info[key].key_parts; + for (key= parts= 0; key < table_arg->keys; key++) + parts+= table_arg->key_info[key].key_parts; - if (!(keydef= (HP_KEYDEF*) my_malloc(table->keys * sizeof(HP_KEYDEF) + + if (!(keydef= (HP_KEYDEF*) my_malloc(table_arg->keys * sizeof(HP_KEYDEF) + parts * sizeof(HA_KEYSEG), MYF(MY_WME)))) return my_errno; - seg= my_reinterpret_cast(HA_KEYSEG*) (keydef + table->keys); - for (key= 0; key < table->keys; key++) + seg= my_reinterpret_cast(HA_KEYSEG*) (keydef + table_arg->keys); + for (key= 0; key < table_arg->keys; key++) { - KEY *pos= table->key_info+key; + KEY *pos= table_arg->key_info+key; KEY_PART_INFO *key_part= pos->key_part; KEY_PART_INFO *key_part_end= key_part + pos->key_parts; @@ -303,7 +304,7 @@ int ha_heap::create(const char *name, TABLE *table, if (field->null_ptr) { seg->null_bit= field->null_bit; - seg->null_pos= (uint) (field->null_ptr - (uchar*) table->record[0]); + seg->null_pos= (uint) (field->null_ptr - (uchar*) table_arg->record[0]); } else { @@ -317,7 +318,7 @@ int ha_heap::create(const char *name, TABLE *table, } } } - mem_per_row+= MY_ALIGN(table->reclength + 1, sizeof(char*)); + mem_per_row+= MY_ALIGN(table_arg->reclength + 1, sizeof(char*)); max_rows = (ha_rows) (current_thd->variables.max_heap_table_size / mem_per_row); HP_CREATE_INFO hp_create_info; @@ -326,10 +327,11 @@ int ha_heap::create(const char *name, TABLE *table, hp_create_info.auto_increment= (create_info->auto_increment_value ? create_info->auto_increment_value - 1 : 0); error= heap_create(fn_format(buff,name,"","",4+2), - table->keys,keydef, table->reclength, - (ulong) ((table->max_rows < max_rows && table->max_rows) ? - table->max_rows : max_rows), - (ulong) table->min_rows, &hp_create_info); + table_arg->keys,keydef, table_arg->reclength, + (ulong) ((table_arg->max_rows < max_rows && + table_arg->max_rows) ? + table_arg->max_rows : max_rows), + (ulong) table_arg->min_rows, &hp_create_info); my_free((gptr) keydef, MYF(0)); if (file) info(HA_STATUS_NO_LOCK | HA_STATUS_CONST | HA_STATUS_VARIABLE); @@ -337,6 +339,7 @@ int ha_heap::create(const char *name, TABLE *table, return (error); } + void ha_heap::update_create_info(HA_CREATE_INFO *create_info) { table->file->info(HA_STATUS_AUTO); diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 11870e4cc29..7fc0664445d 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -3640,7 +3640,7 @@ ha_innobase::discard_or_import_tablespace( my_bool discard) /* in: TRUE if discard, else import */ { row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; - dict_table_t* table; + dict_table_t* dict_table; trx_t* trx; int err; @@ -3650,13 +3650,13 @@ ha_innobase::discard_or_import_tablespace( ut_a(prebuilt->trx == (trx_t*) current_thd->transaction.all.innobase_tid); - table = prebuilt->table; + dict_table = prebuilt->table; trx = prebuilt->trx; if (discard) { - err = row_discard_tablespace_for_mysql(table->name, trx); + err = row_discard_tablespace_for_mysql(dict_table->name, trx); } else { - err = row_import_tablespace_for_mysql(table->name, trx); + err = row_import_tablespace_for_mysql(dict_table->name, trx); } if (err == DB_SUCCESS) { diff --git a/sql/item.cc b/sql/item.cc index 97ef19d089b..1d49671ff4c 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1667,7 +1667,9 @@ bool Item_insert_value::eq(const Item *item, bool binary_cmp) const } -bool Item_insert_value::fix_fields(THD *thd, struct st_table_list *table_list, Item **items) +bool Item_insert_value::fix_fields(THD *thd, + struct st_table_list *table_list, + Item **items) { bool res= arg->fix_fields(thd, table_list, items); if (res) @@ -1698,10 +1700,10 @@ bool Item_insert_value::fix_fields(THD *thd, struct st_table_list *table_list, I } else { - Field *field=field_arg->field; + Field *tmp_field= field_arg->field; /* charset doesn't matter here, it's to avoid sigsegv only */ - set_field(new Field_null(0,0,Field::NONE,field->field_name,field->table, - &my_charset_bin)); + set_field(new Field_null(0, 0, Field::NONE, tmp_field->field_name, + tmp_field->table, &my_charset_bin)); } return 0; } diff --git a/sql/item.h b/sql/item.h index 23b0cf018e1..a94a7a77597 100644 --- a/sql/item.h +++ b/sql/item.h @@ -830,14 +830,14 @@ public: bool fix_fields(THD *, struct st_table_list *, Item **); void print(String *str); virtual bool basic_const_item() const { return true; } - int save_in_field(Field *field, bool no_conversions) + int save_in_field(Field *field_arg, bool no_conversions) { if (!arg) { - field->set_default(); + field_arg->set_default(); return 0; } - return Item_field::save_in_field(field, no_conversions); + return Item_field::save_in_field(field_arg, no_conversions); } table_map used_tables() const { return (table_map)0L; } @@ -858,9 +858,9 @@ public: bool fix_fields(THD *, struct st_table_list *, Item **); void print(String *str); virtual bool basic_const_item() const { return true; } - int save_in_field(Field *field, bool no_conversions) + int save_in_field(Field *field_arg, bool no_conversions) { - return Item_field::save_in_field(field, no_conversions); + return Item_field::save_in_field(field_arg, no_conversions); } table_map used_tables() const { return (table_map)0L; } diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 51c53e6c136..dc017cef73c 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -41,24 +41,24 @@ public: Arg_comparator(Item **a1, Item **a2): a(a1), b(a2) {}; int set_compare_func(Item_bool_func2 *owner, Item_result type); - inline int set_compare_func(Item_bool_func2 *owner) + inline int set_compare_func(Item_bool_func2 *owner_arg) { - return set_compare_func(owner, item_cmp_type((*a)->result_type(), - (*b)->result_type())); + return set_compare_func(owner_arg, item_cmp_type((*a)->result_type(), + (*b)->result_type())); } - inline int set_cmp_func(Item_bool_func2 *owner, + inline int set_cmp_func(Item_bool_func2 *owner_arg, Item **a1, Item **a2, Item_result type) { a= a1; b= a2; - return set_compare_func(owner, type); + return set_compare_func(owner_arg, type); } - inline int set_cmp_func(Item_bool_func2 *owner, + inline int set_cmp_func(Item_bool_func2 *owner_arg, Item **a1, Item **a2) { - return set_cmp_func(owner, a1, a2, item_cmp_type((*a1)->result_type(), - (*a2)->result_type())); + return set_cmp_func(owner_arg, a1, a2, item_cmp_type((*a1)->result_type(), + (*a2)->result_type())); } inline int compare() { return (this->*func)(); } diff --git a/sql/item_func.cc b/sql/item_func.cc index 97454a6fce7..0ccc7febd0a 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1624,7 +1624,7 @@ bool udf_handler::get_arguments() String *udf_handler::val_str(String *str,String *save_str) { - uchar is_null=0; + uchar is_null_tmp=0; ulong res_length; if (get_arguments()) @@ -1641,9 +1641,9 @@ String *udf_handler::val_str(String *str,String *save_str) return 0; } } - char *res=func(&initid, &f_args, (char*) str->ptr(), &res_length, &is_null, - &error); - if (is_null || !res || error) // The !res is for safety + char *res=func(&initid, &f_args, (char*) str->ptr(), &res_length, + &is_null_tmp, &error); + if (is_null_tmp || !res || error) // The !res is for safety { return 0; } diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 367400d6b0b..7b401b50d4c 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -306,8 +306,7 @@ void Item_singlerow_subselect::fix_length_and_dec() } else { - THD *thd= current_thd; - if (!(row= (Item_cache**)thd->alloc(sizeof(Item_cache*)*max_columns))) + if (!(row= (Item_cache**) sql_alloc(sizeof(Item_cache*)*max_columns))) return; engine->fix_length_and_dec(row); value= *row; @@ -550,8 +549,8 @@ Item_in_subselect::single_value_transformer(JOIN *join, SELECT_LEX *select_lex= join->select_lex; - THD *thd= join->thd; - thd->where= "scalar IN/ALL/ANY subquery"; + THD *thd_tmp= join->thd; + thd_tmp->where= "scalar IN/ALL/ANY subquery"; if (select_lex->item_list.elements > 1) { @@ -595,7 +594,7 @@ Item_in_subselect::single_value_transformer(JOIN *join, select_lex->item_list.empty(); select_lex->item_list.push_back(item); - if (item->fix_fields(thd, join->tables_list, &item)) + if (item->fix_fields(thd_tmp, join->tables_list, &item)) { DBUG_RETURN(RES_ERROR); } @@ -609,14 +608,14 @@ Item_in_subselect::single_value_transformer(JOIN *join, subs= new Item_maxmin_subselect(this, select_lex, func->l_op()); } // left expression belong to outer select - SELECT_LEX *current= thd->lex.current_select, *up; - thd->lex.current_select= up= current->return_after_parsing(); - if (left_expr->fix_fields(thd, up->get_table_list(), &left_expr)) + SELECT_LEX *current= thd_tmp->lex.current_select, *up; + thd_tmp->lex.current_select= up= current->return_after_parsing(); + if (left_expr->fix_fields(thd_tmp, up->get_table_list(), &left_expr)) { - thd->lex.current_select= current; + thd_tmp->lex.current_select= current; DBUG_RETURN(RES_ERROR); } - thd->lex.current_select= current; + thd_tmp->lex.current_select= current; substitution= func->create(left_expr, subs); DBUG_RETURN(RES_OK); } @@ -627,16 +626,16 @@ Item_in_subselect::single_value_transformer(JOIN *join, SELECT_LEX_UNIT *unit= select_lex->master_unit(); substitution= optimizer= new Item_in_optimizer(left_expr, this); - SELECT_LEX *current= thd->lex.current_select, *up; + SELECT_LEX *current= thd_tmp->lex.current_select, *up; - thd->lex.current_select= up= current->return_after_parsing(); + thd_tmp->lex.current_select= up= current->return_after_parsing(); //optimizer never use Item **ref => we can pass 0 as parameter - if (!optimizer || optimizer->fix_left(thd, up->get_table_list(), 0)) + if (!optimizer || optimizer->fix_left(thd_tmp, up->get_table_list(), 0)) { - thd->lex.current_select= current; + thd_tmp->lex.current_select= current; DBUG_RETURN(RES_ERROR); } - thd->lex.current_select= current; + thd_tmp->lex.current_select= current; /* As far as Item_ref_in_optimizer do not substitude itself on fix_fields @@ -664,7 +663,7 @@ Item_in_subselect::single_value_transformer(JOIN *join, this->full_name())); join->having= and_items(join->having, item); select_lex->having_fix_field= 1; - if (join->having->fix_fields(thd, join->tables_list, &join->having)) + if (join->having->fix_fields(thd_tmp, join->tables_list, &join->having)) { select_lex->having_fix_field= 0; DBUG_RETURN(RES_ERROR); @@ -688,7 +687,8 @@ Item_in_subselect::single_value_transformer(JOIN *join, new Item_cond_and(having, join->having) : having); select_lex->having_fix_field= 1; - if (join->having->fix_fields(thd, join->tables_list, &join->having)) + if (join->having->fix_fields(thd_tmp, join->tables_list, + &join->having)) { select_lex->having_fix_field= 0; DBUG_RETURN(RES_ERROR); @@ -699,7 +699,7 @@ Item_in_subselect::single_value_transformer(JOIN *join, } item->name= (char *)in_additional_cond; join->conds= and_items(join->conds, item); - if (join->conds->fix_fields(thd, join->tables_list, &join->conds)) + if (join->conds->fix_fields(thd_tmp, join->tables_list, &join->conds)) DBUG_RETURN(RES_ERROR); } else @@ -711,7 +711,8 @@ Item_in_subselect::single_value_transformer(JOIN *join, (char *)"<no matter>", (char *)"<result>")); select_lex->having_fix_field= 1; - if (join->having->fix_fields(thd, join->tables_list, &join->having)) + if (join->having->fix_fields(thd_tmp, join->tables_list, + &join->having)) { select_lex->having_fix_field= 0; DBUG_RETURN(RES_ERROR); @@ -725,11 +726,11 @@ Item_in_subselect::single_value_transformer(JOIN *join, // fix_field of item will be done in time of substituting substitution= item; have_to_be_excluded= 1; - if (thd->lex.describe) + if (thd_tmp->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, + push_warning(thd_tmp, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_SELECT_REDUCED, warn_buff); } DBUG_RETURN(RES_REDUCE); @@ -739,13 +740,14 @@ Item_in_subselect::single_value_transformer(JOIN *join, DBUG_RETURN(RES_OK); } + Item_subselect::trans_res Item_in_subselect::row_value_transformer(JOIN *join) { DBUG_ENTER("Item_in_subselect::row_value_transformer"); - THD *thd= join->thd; - thd->where= "row IN/ALL/ANY subquery"; + THD *thd_tmp= join->thd; + thd_tmp->where= "row IN/ALL/ANY subquery"; SELECT_LEX *select_lex= join->select_lex; @@ -761,22 +763,22 @@ Item_in_subselect::row_value_transformer(JOIN *join) SELECT_LEX_UNIT *unit= select_lex->master_unit(); substitution= optimizer= new Item_in_optimizer(left_expr, this); - SELECT_LEX *current= thd->lex.current_select, *up; - thd->lex.current_select= up= current->return_after_parsing(); + SELECT_LEX *current= thd_tmp->lex.current_select, *up; + thd_tmp->lex.current_select= up= current->return_after_parsing(); //optimizer never use Item **ref => we can pass 0 as parameter - if (!optimizer || optimizer->fix_left(thd, up->get_table_list(), 0)) + if (!optimizer || optimizer->fix_left(thd_tmp, up->get_table_list(), 0)) { - thd->lex.current_select= current; + thd_tmp->lex.current_select= current; DBUG_RETURN(RES_ERROR); } - thd->lex.current_select= current; + thd_tmp->lex.current_select= current; unit->uncacheable|= UNCACHEABLE_DEPENDENT; } uint n= left_expr->cols(); select_lex->uncacheable|= UNCACHEABLE_DEPENDENT; - select_lex->setup_ref_array(thd, + select_lex->setup_ref_array(thd_tmp, select_lex->order_list.elements + select_lex->group_list.elements); Item *item= 0; @@ -802,7 +804,7 @@ Item_in_subselect::row_value_transformer(JOIN *join) { join->having= and_items(join->having, item); select_lex->having_fix_field= 1; - if (join->having->fix_fields(thd, join->tables_list, &join->having)) + if (join->having->fix_fields(thd_tmp, join->tables_list, &join->having)) { select_lex->having_fix_field= 0; DBUG_RETURN(RES_ERROR); @@ -812,7 +814,7 @@ Item_in_subselect::row_value_transformer(JOIN *join) else { join->conds= and_items(join->conds, item); - if (join->conds->fix_fields(thd, join->tables_list, &join->having)) + if (join->conds->fix_fields(thd_tmp, join->tables_list, &join->having)) DBUG_RETURN(RES_ERROR); } DBUG_RETURN(RES_OK); @@ -880,7 +882,7 @@ subselect_single_select_engine(st_select_lex *select, unit->select_limit_cnt= unit->global_parameters->select_limit+ unit->global_parameters ->offset_limit; if (unit->select_limit_cnt < unit->global_parameters->select_limit) - unit->select_limit_cnt= HA_POS_ERROR; // no limit + unit->select_limit_cnt= HA_POS_ERROR; // no limit if (unit->select_limit_cnt == HA_POS_ERROR) select_lex->options&= ~OPTION_FOUND_ROWS; unit->item= item; @@ -889,17 +891,17 @@ subselect_single_select_engine(st_select_lex *select, subselect_union_engine::subselect_union_engine(st_select_lex_unit *u, - select_subselect *result, - Item_subselect *item) - :subselect_engine(item, result) + select_subselect *result_arg, + Item_subselect *item_arg) + :subselect_engine(item_arg, result_arg) { unit= u; - if (!result) - //out of memory + if (!result_arg) //out of memory current_thd->fatal_error(); - unit->item= item; + unit->item= item_arg; } + int subselect_single_select_engine::prepare() { if (prepared) @@ -907,8 +909,7 @@ int subselect_single_select_engine::prepare() join= new JOIN(thd, select_lex->item_list, select_lex->options, result); if (!join || !result) { - //out of memory - thd->fatal_error(); + thd->fatal_error(); //out of memory return 1; } prepared= 1; diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 3637e025d3c..8444dc7bf66 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -263,7 +263,7 @@ public: virtual ~subselect_engine() {}; // to satisfy compiler // set_thd should be called before prepare() - void set_thd(THD *thd) { this->thd= thd; } + void set_thd(THD *thd_arg) { thd= thd_arg; } THD * get_thd() { return thd; } virtual int prepare()= 0; virtual void fix_length_and_dec(Item_cache** row)= 0; @@ -328,11 +328,11 @@ protected: public: // constructor can assign THD because it will be called after JOIN::prepare - subselect_uniquesubquery_engine(THD *thd, st_join_table *tab_arg, + subselect_uniquesubquery_engine(THD *thd_arg, st_join_table *tab_arg, Item_subselect *subs, Item *where) :subselect_engine(subs, 0), tab(tab_arg), cond(where) { - set_thd(thd); + set_thd(thd_arg); } ~subselect_uniquesubquery_engine(); int prepare(); diff --git a/sql/item_sum.cc b/sql/item_sum.cc index a3d67e9f7fa..62782e1f710 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -104,16 +104,16 @@ Item *Item_sum::get_tmp_table_item(THD *thd) Item_sum* sum_item= (Item_sum *) copy_or_same(thd); if (sum_item && sum_item->result_field) // If not a const sum func { - Field *result_field= sum_item->result_field; + Field *result_field_tmp= sum_item->result_field; for (uint i=0 ; i < sum_item->arg_count ; i++) { Item *arg= sum_item->args[i]; if (!arg->const_item()) { if (arg->type() == Item::FIELD_ITEM) - ((Item_field*) arg)->field= result_field++; + ((Item_field*) arg)->field= result_field_tmp++; else - sum_item->args[i]= new Item_field(result_field++); + sum_item->args[i]= new Item_field(result_field_tmp++); } } } diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 496ea0ed5c8..a5372a4ae60 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -671,7 +671,7 @@ longlong Item_func_month::val_int() String* Item_func_monthname::val_str(String* str) { - const char *name; + const char *month_name; uint month=(uint) Item_func_month::val_int(); if (!month) // This is also true for NULL @@ -680,8 +680,8 @@ String* Item_func_monthname::val_str(String* str) return (String*) 0; } null_value=0; - name= month_names[month-1]; - str->set(name, strlen(name), system_charset_info); + month_name= month_names[month-1]; + str->set(month_name, strlen(month_name), system_charset_info); return str; } diff --git a/sql/log.cc b/sql/log.cc index c32e37cd86a..936373daf03 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -179,7 +179,7 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg, const char *new_name, const char *index_file_name_arg, enum cache_type io_cache_type_arg, bool no_auto_events_arg, - ulong max_size) + ulong max_size_arg) { char buff[512]; File file= -1, index_file_nr= -1; @@ -190,7 +190,7 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg, last_time=query_start=0; write_error=0; - init(log_type_arg,io_cache_type_arg,no_auto_events_arg,max_size); + init(log_type_arg,io_cache_type_arg,no_auto_events_arg,max_size_arg); if (!(name=my_strdup(log_name,MYF(MY_WME)))) goto err; diff --git a/sql/protocol.cc b/sql/protocol.cc index e1347ff3c6f..0c9fed629b4 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -285,6 +285,12 @@ send_ok(THD *thd, ha_rows affected_rows, ulonglong id, const char *message) pos=net_store_length(pos, (ulonglong) id); if (thd->client_capabilities & CLIENT_PROTOCOL_41) { + DBUG_PRINT("info", + ("affected_rows: %lu id: %lu status: %u warning_count: %u", + (ulong) affected_rows, + (ulong) id, + (uint) (thd->server_status & 0xffff), + (uint) thd->total_warn_count)); int2store(pos,thd->server_status); pos+=2; @@ -483,7 +489,7 @@ bool Protocol::send_fields(List<Item> *list, uint flag) char buff[80]; String tmp((char*) buff,sizeof(buff),&my_charset_bin); Protocol_simple prot(thd); - String *packet= prot.storage_packet(); + String *local_packet= prot.storage_packet(); CHARSET_INFO *thd_charset= thd->variables.character_set_results; DBUG_ENTER("send_fields"); @@ -520,10 +526,10 @@ bool Protocol::send_fields(List<Item> *list, uint flag) cs, thd_charset) || prot.store(field.org_col_name, (uint) strlen(field.org_col_name), cs, thd_charset) || - packet->realloc(packet->length()+12)) + local_packet->realloc(local_packet->length()+12)) goto err; /* Store fixed length fields */ - pos= (char*) packet->ptr()+packet->length(); + pos= (char*) local_packet->ptr()+local_packet->length(); *pos++= 12; // Length of packed fields int2store(pos, field.charsetnr); int4store(pos+2, field.length); @@ -540,9 +546,9 @@ bool Protocol::send_fields(List<Item> *list, uint flag) cs, thd_charset) || prot.store(field.col_name, (uint) strlen(field.col_name), cs, thd_charset) || - packet->realloc(packet->length()+10)) + local_packet->realloc(local_packet->length()+10)) goto err; - pos= (char*) packet->ptr()+packet->length(); + pos= (char*) local_packet->ptr()+local_packet->length(); #ifdef TO_BE_DELETED_IN_6 if (!(thd->client_capabilities & CLIENT_LONG_FLAG)) @@ -569,7 +575,7 @@ bool Protocol::send_fields(List<Item> *list, uint flag) pos+= 10; } } - packet->length((uint) (pos - packet->ptr())); + local_packet->length((uint) (pos - local_packet->ptr())); if (flag & 2) item->send(&prot, &tmp); // Send default value if (prot.write()) diff --git a/sql/protocol.h b/sql/protocol.h index 94fd303e259..67ae4ed01b4 100644 --- a/sql/protocol.h +++ b/sql/protocol.h @@ -44,9 +44,9 @@ protected: #endif public: Protocol() {} - Protocol(THD *thd) { init(thd); } + Protocol(THD *thd_arg) { init(thd_arg); } virtual ~Protocol() {} - void init(THD* thd); + void init(THD* thd_arg); bool send_fields(List<Item> *list, uint flag); bool send_records_num(List<Item> *list, ulonglong records); bool store(I_List<i_string> *str_list); @@ -97,7 +97,7 @@ class Protocol_simple :public Protocol { public: Protocol_simple() {} - Protocol_simple(THD *thd) :Protocol(thd) {} + Protocol_simple(THD *thd_arg) :Protocol(thd_arg) {} virtual void prepare_for_resend(); virtual bool store_null(); virtual bool store_tiny(longlong from); @@ -122,7 +122,7 @@ private: uint bit_fields; public: Protocol_prep() {} - Protocol_prep(THD *thd) :Protocol(thd) {} + Protocol_prep(THD *thd_arg) :Protocol(thd_arg) {} virtual bool prepare_for_send(List<Item> *item_list); virtual void prepare_for_resend(); #ifdef EMBEDDED_LIBRARY @@ -155,7 +155,7 @@ public: ulong row_count; Protocol_cursor() {} - Protocol_cursor(THD *thd, MEM_ROOT *ini_alloc) :Protocol_simple(thd), alloc(ini_alloc) {} + Protocol_cursor(THD *thd_arg, MEM_ROOT *ini_alloc) :Protocol_simple(thd_arg), alloc(ini_alloc) {} bool prepare_for_send(List<Item> *item_list) { fields= NULL; @@ -173,7 +173,6 @@ void send_ok(THD *thd, ha_rows affected_rows=0L, ulonglong id=0L, const char *info=0); void send_eof(THD *thd, bool no_flush=0); bool send_old_password_request(THD *thd); -char *net_store_length(char *packet,ulonglong length); char *net_store_length(char *packet,uint length); char *net_store_data(char *to,const char *from, uint length); char *net_store_data(char *to,int32 from); diff --git a/sql/protocol_cursor.cc b/sql/protocol_cursor.cc index 563a2d41019..5f35552c562 100644 --- a/sql/protocol_cursor.cc +++ b/sql/protocol_cursor.cc @@ -96,23 +96,23 @@ bool Protocol_cursor::write() MYSQL_FIELD *cur_field= fields; MYSQL_FIELD *fields_end= fields + field_count; MYSQL_ROWS *new_record; - byte **data; + byte **data_tmp; byte *to; new_record= (MYSQL_ROWS *)alloc_root(alloc, sizeof(MYSQL_ROWS) + (field_count + 1)*sizeof(char *) + packet->length()); if (!new_record) goto err; - data= (byte **)(new_record + 1); - new_record->data= (char **)data; + data_tmp= (byte **)(new_record + 1); + new_record->data= (char **)data_tmp; to= (byte *)(fields + field_count + 1); - for (; cur_field < fields_end; ++cur_field, ++data) + for (; cur_field < fields_end; ++cur_field, ++data_tmp) { if ((len=net_field_length((uchar **)&cp))) { - *data= 0; + *data_tmp= 0; } else { diff --git a/sql/set_var.cc b/sql/set_var.cc index 39dc92c5d33..7e576b5a755 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -549,7 +549,6 @@ struct show_var_st init_vars[]= { {"bdb_logdir", (char*) &berkeley_logdir, SHOW_CHAR_PTR}, {"bdb_shared_data", (char*) &berkeley_shared_data, SHOW_BOOL}, {"bdb_tmpdir", (char*) &berkeley_tmpdir, SHOW_CHAR_PTR}, - {"bdb_version", (char*) DB_VERSION_STRING, SHOW_CHAR}, #endif {sys_binlog_cache_size.name,(char*) &sys_binlog_cache_size, SHOW_SYS}, {sys_bulk_insert_buff_size.name,(char*) &sys_bulk_insert_buff_size,SHOW_SYS}, @@ -740,7 +739,12 @@ struct show_var_st init_vars[]= { SHOW_SYS}, {sys_trans_prealloc_size.name, (char*) &sys_trans_prealloc_size, SHOW_SYS}, {"version", server_version, SHOW_CHAR}, +#ifdef HAVE_BERKELEY_DB + {"version_bdb", (char*) DB_VERSION_STRING, SHOW_CHAR}, +#endif {"version_comment", (char*) MYSQL_COMPILATION_COMMENT, SHOW_CHAR}, + {"version_compile_machine", (char*) MACHINE_TYPE, SHOW_CHAR}, + {"version_compile_os", (char*) SYSTEM_TYPE, SHOW_CHAR}, {sys_net_wait_timeout.name, (char*) &sys_net_wait_timeout, SHOW_SYS}, {NullS, NullS, SHOW_LONG} }; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 1041c21ef30..5dee75a5670 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1036,9 +1036,9 @@ bool select_dump::send_eof() return error; } -select_subselect::select_subselect(Item_subselect *item) +select_subselect::select_subselect(Item_subselect *item_arg) { - this->item=item; + item= item_arg; } bool select_singlerow_subselect::send_data(List<Item> &items) @@ -1229,3 +1229,14 @@ bool select_dumpvar::send_eof() return 1; } } + +/**************************************************************************** + TMP_TABLE_PARAM +****************************************************************************/ + +void TMP_TABLE_PARAM::init() +{ + field_count= sum_func_count= func_count= hidden_field_count= 0; + group_parts= group_length= group_null_parts= 0; + quick_group= 1; +} diff --git a/sql/sql_class.h b/sql/sql_class.h index 6be517d42d0..beb2de9c0a9 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -895,7 +895,12 @@ public: class TMP_TABLE_PARAM :public Sql_alloc { - public: +private: + /* Prevent use of these (not safe because of lists and copy_field) */ + TMP_TABLE_PARAM(const TMP_TABLE_PARAM &); + void operator=(TMP_TABLE_PARAM &); + +public: List<Item> copy_funcs; List<Item> save_copy_funcs; List_iterator_fast<Item> copy_funcs_it; @@ -920,6 +925,7 @@ class TMP_TABLE_PARAM :public Sql_alloc { cleanup(); } + void init(void); inline void cleanup(void) { if (copy_field) /* Fix for Intel compiler */ diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 20a1f7f0124..8e6f5b27ab0 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -67,7 +67,6 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, int res; select_union *derived_result; TABLE_LIST *tables= (TABLE_LIST *)first_select->table_list.first; - TMP_TABLE_PARAM tmp_table_param; bool is_union= first_select->next_select() && first_select->next_select()->linkage == UNION_TYPE; bool is_subsel= first_select->first_inner_unit() ? 1: 0; @@ -111,7 +110,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, fix_tables_pointers(unit); } - if(!(derived_result= new select_union(0))) + if (!(derived_result= new select_union(0))) DBUG_RETURN(1); // out of memory // st_select_lex_unit::prepare correctly work for single select @@ -128,13 +127,14 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, cursor->table->clear_query_id= 1; } - bzero((char*) &tmp_table_param,sizeof(tmp_table_param)); - tmp_table_param.field_count= unit->types.elements; + derived_result->tmp_table_param.init(); + derived_result->tmp_table_param.field_count= unit->types.elements; /* Temp table is created so that it hounours if UNION without ALL is to be processed */ - if (!(table= create_tmp_table(thd, &tmp_table_param, unit->types, + if (!(table= create_tmp_table(thd, &derived_result->tmp_table_param, + unit->types, (ORDER*) 0, is_union && !unit->union_option, 1, (first_select->options | thd->options | @@ -146,7 +146,6 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, goto exit; } derived_result->set_table(table); - derived_result->tmp_table_param=tmp_table_param; unit->offset_limit_cnt= first_select->offset_limit; unit->select_limit_cnt= first_select->select_limit+ @@ -206,7 +205,6 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, table->file->info(HA_STATUS_VARIABLE); } } - delete derived_result; if (res) free_tmp_table(thd, table); @@ -218,6 +216,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, } exit: + delete derived_result; lex->current_select= save_current_select; close_thread_tables(thd, 0, 1); } diff --git a/sql/sql_error.cc b/sql/sql_error.cc index db0dbe0dedc..81b98358486 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -102,6 +102,7 @@ void mysql_reset_errors(THD *thd) MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, uint code, const char *msg) { + DBUG_ENTER("push_warning"); if (thd->query_id != thd->warn_id) mysql_reset_errors(thd); @@ -122,7 +123,7 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, } thd->warn_count[(uint) level]++; thd->total_warn_count++; - return err; + DBUG_RETURN(err); } /* diff --git a/sql/sql_help.cc b/sql/sql_help.cc index 6af4ffde0e1..c40133c04a8 100644 --- a/sql/sql_help.cc +++ b/sql/sql_help.cc @@ -524,7 +524,7 @@ int send_header_2(Protocol *protocol, bool for_category) same as strcmp */ -int string_ptr_cmp(const void* ptr1, const void* ptr2) +extern "C" int string_ptr_cmp(const void* ptr1, const void* ptr2) { String *str1= *(String**)ptr1; String *str2= *(String**)ptr2; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 9b74073b64e..4257df494bc 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1289,12 +1289,13 @@ bool st_select_lex::test_limit() 0 - OK !0 - error */ -bool st_select_lex_unit::create_total_list(THD *thd, st_lex *lex, - TABLE_LIST **result, +bool st_select_lex_unit::create_total_list(THD *thd_arg, st_lex *lex, + TABLE_LIST **result_arg, bool check_derived) { - *result= 0; - res= create_total_list_n_last_return(thd, lex, &result, check_derived); + *result_arg= 0; + res= create_total_list_n_last_return(thd_arg, lex, &result_arg, + check_derived); return res; } @@ -1318,12 +1319,14 @@ bool st_select_lex_unit::create_total_list(THD *thd, st_lex *lex, 0 - OK !0 - error */ -bool st_select_lex_unit::create_total_list_n_last_return(THD *thd, st_lex *lex, - TABLE_LIST ***result, - bool check_derived) +bool st_select_lex_unit:: +create_total_list_n_last_return(THD *thd_arg, + st_lex *lex, + TABLE_LIST ***result_arg, + bool check_derived) { TABLE_LIST *slave_list_first=0, **slave_list_last= &slave_list_first; - TABLE_LIST **new_table_list= *result, *aux; + TABLE_LIST **new_table_list= *result_arg, *aux; SELECT_LEX *sl= (SELECT_LEX*)slave; /* @@ -1342,7 +1345,7 @@ bool st_select_lex_unit::create_total_list_n_last_return(THD *thd, st_lex *lex, if (sl->order_list.first && sl->next_select() && !sl->braces && sl->linkage != GLOBAL_OPTIONS_TYPE) { - net_printf(thd,ER_WRONG_USAGE,"UNION","ORDER BY"); + net_printf(thd_arg,ER_WRONG_USAGE,"UNION","ORDER BY"); return 1; } @@ -1360,12 +1363,12 @@ bool st_select_lex_unit::create_total_list_n_last_return(THD *thd, st_lex *lex, if ((aux= (TABLE_LIST*) sl->table_list.first)) { - TABLE_LIST *next; - for (; aux; aux= next) + TABLE_LIST *next_table; + for (; aux; aux= next_table) { TABLE_LIST *cursor; - next= aux->next; - for (cursor= **result; cursor; cursor= cursor->next) + next_table= aux->next; + for (cursor= **result_arg; cursor; cursor= cursor->next) if (!strcmp(cursor->db, aux->db) && !strcmp(cursor->real_name, aux->real_name) && !strcmp(cursor->alias, aux->alias)) @@ -1397,7 +1400,7 @@ end: *new_table_list= slave_list_first; new_table_list= slave_list_last; } - *result= new_table_list; + *result_arg= new_table_list; return 0; } diff --git a/sql/sql_list.h b/sql/sql_list.h index 7200046e6c5..0972d0341f6 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -283,9 +283,9 @@ public: List_iterator_fast(List<T> &a) : base_list_iterator(a) {} inline T* operator++(int) { return (T*) base_list_iterator::next_fast(); } inline void rewind(void) { base_list_iterator::rewind(); } - void sublist(List<T> &list, uint el) + void sublist(List<T> &list_arg, uint el_arg) { - base_list_iterator::sublist(list, el); + base_list_iterator::sublist(list_arg, el_arg); } }; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index d5a15de422d..d74d06f9439 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4320,8 +4320,8 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, LEX_STRING *alias, ulong table_options, thr_lock_type lock_type, - List<String> *use_index, - List<String> *ignore_index, + List<String> *use_index_arg, + List<String> *ignore_index_arg, LEX_STRING *option) { register TABLE_LIST *ptr; @@ -4377,12 +4377,12 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, ptr->force_index= test(table_options & TL_OPTION_FORCE_INDEX); ptr->ignore_leaves= test(table_options & TL_OPTION_IGNORE_LEAVES); ptr->derived= table->sel; - if (use_index) - ptr->use_index=(List<String> *) thd->memdup((gptr) use_index, - sizeof(*use_index)); - if (ignore_index) - ptr->ignore_index=(List<String> *) thd->memdup((gptr) ignore_index, - sizeof(*ignore_index)); + if (use_index_arg) + ptr->use_index=(List<String> *) thd->memdup((gptr) use_index_arg, + sizeof(*use_index_arg)); + if (ignore_index_arg) + ptr->ignore_index=(List<String> *) thd->memdup((gptr) ignore_index_arg, + sizeof(*ignore_index_arg)); ptr->option= option ? option->str : 0; /* check that used name is unique */ if (lock_type != TL_IGNORE) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index ba4dd9f856e..3594b53436e 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -284,8 +284,8 @@ JOIN::prepare(Item ***rref_pointer_array, uint wild_num, COND *conds_init, uint og_num, ORDER *order_init, ORDER *group_init, Item *having_init, - ORDER *proc_param_init, SELECT_LEX *select, - SELECT_LEX_UNIT *unit) + ORDER *proc_param_init, SELECT_LEX *select_lex_arg, + SELECT_LEX_UNIT *unit_arg) { DBUG_ENTER("JOIN::prepare"); @@ -295,9 +295,9 @@ JOIN::prepare(Item ***rref_pointer_array, having= having_init; proc_param= proc_param_init; tables_list= tables_init; - select_lex= select; + select_lex= select_lex_arg; select_lex->join= this; - union_part= (unit->first_select()->next_select() != 0); + union_part= (unit_arg->first_select()->next_select() != 0); /* Check that all tables, fields, conds and order are ok */ @@ -369,14 +369,14 @@ JOIN::prepare(Item ***rref_pointer_array, DBUG_RETURN(-1); } } - TABLE_LIST *table; - for (table=tables_list ; table ; table=table->next) + TABLE_LIST *table_ptr; + for (table_ptr= tables_list ; table_ptr ; table_ptr= table_ptr->next) tables++; } { /* Caclulate the number of groups */ send_group_parts= 0; - for (ORDER *group= group_list ; group ; group= group->next) + for (ORDER *group_tmp= group_list ; group_tmp ; group_tmp= group_tmp->next) send_group_parts++; } @@ -416,13 +416,13 @@ JOIN::prepare(Item ***rref_pointer_array, ref_pointer_array_size= all_fields.elements*sizeof(Item*); this->group= group_list != 0; row_limit= ((select_distinct || order || group_list) ? HA_POS_ERROR : - unit->select_limit_cnt); + unit_arg->select_limit_cnt); /* select_limit is used to decide if we are likely to scan the whole table */ - select_limit= unit->select_limit_cnt; + select_limit= unit_arg->select_limit_cnt; if (having || (select_options & OPTION_FOUND_ROWS)) select_limit= HA_POS_ERROR; - do_send_rows = (unit->select_limit_cnt) ? 1 : 0; - this->unit= unit; + do_send_rows = (unit_arg->select_limit_cnt) ? 1 : 0; + unit= unit_arg; #ifdef RESTRICTED_GROUP if (sum_func_count && !group_list && (func_count || field_count)) @@ -431,7 +431,7 @@ JOIN::prepare(Item ***rref_pointer_array, goto err; } #endif - if (!procedure && result->prepare(fields_list, unit)) + if (!procedure && result->prepare(fields_list, unit_arg)) goto err; /* purecov: inspected */ if (select_lex->olap == ROLLUP_TYPE && rollup_init()) @@ -607,20 +607,20 @@ JOIN::optimize() if (const_tables && !thd->locked_tables && !(select_options & SELECT_NO_UNLOCK)) { - TABLE **table, **end; - for (table=this->table, end=table + const_tables ; - table != end; - table++) + TABLE **curr_table, **end; + for (curr_table= table, end=cur_table + const_tables ; + curr_table != end; + curr_table++) { /* BDB tables require that we call index_end() before doing an unlock */ - if ((*table)->key_read) + if ((*curr_table)->key_read) { - (*table)->key_read=0; - (*table)->file->extra(HA_EXTRA_NO_KEYREAD); + (*curr_table)->key_read=0; + (*curr_table)->file->extra(HA_EXTRA_NO_KEYREAD); } - (*table)->file->index_end(); + (*curr_table)->file->index_end(); } - mysql_unlock_some_tables(thd, this->table, const_tables); + mysql_unlock_some_tables(thd, table, const_tables); } if (!conds && outer_join) { @@ -963,18 +963,18 @@ JOIN::optimize() if (exec_tmp_table1->distinct) { table_map used_tables= thd->used_tables; - JOIN_TAB *join_tab= this->join_tab+tables-1; + JOIN_TAB *last_join_tab= join_tab+tables-1; do { - if (used_tables & join_tab->table->map) + if (used_tables & last_join_tab->table->map) break; - join_tab->not_used_in_distinct=1; - } while (join_tab-- != this->join_tab); + last_join_tab->not_used_in_distinct=1; + } while (last_join_tab-- != join_tab); /* Optimize "select distinct b from t1 order by key_part_1 limit #" */ if (order && skip_sort_order) { /* Should always succeed */ - if (test_if_skip_sort_order(&this->join_tab[const_tables], + if (test_if_skip_sort_order(&join_tab[const_tables], order, unit->select_limit_cnt, 0)) order=0; } @@ -1393,26 +1393,27 @@ JOIN::exec() { // Some tables may have been const curr_join->tmp_having->update_used_tables(); - JOIN_TAB *table= &curr_join->join_tab[curr_join->const_tables]; - table_map used_tables= curr_join->const_table_map | table->table->map; + JOIN_TAB *curr_table= &curr_join->join_tab[curr_join->const_tables]; + table_map used_tables= (curr_join->const_table_map | + curr_table->table->map); Item* sort_table_cond= make_cond_for_table(curr_join->tmp_having, used_tables, used_tables); if (sort_table_cond) { - if (!table->select) - if (!(table->select= new SQL_SELECT)) + if (!curr_table->select) + if (!(curr_table->select= new SQL_SELECT)) DBUG_VOID_RETURN; - if (!table->select->cond) - table->select->cond= sort_table_cond; + if (!curr_table->select->cond) + curr_table->select->cond= sort_table_cond; else // This should never happen - if (!(table->select->cond= new Item_cond_and(table->select->cond, - sort_table_cond))) + if (!(curr_table->select->cond= + new Item_cond_and(curr_table->select->cond, sort_table_cond))) DBUG_VOID_RETURN; - table->select_cond=table->select->cond; - table->select_cond->top_level_item(); - DBUG_EXECUTE("where",print_where(table->select->cond, + curr_table->select_cond= cur_table->select->cond; + curr_table->select_cond->top_level_item(); + DBUG_EXECUTE("where",print_where(curr_table->select->cond, "select and having");); curr_join->tmp_having= make_cond_for_table(curr_join->tmp_having, ~ (table_map) 0, @@ -1429,9 +1430,9 @@ JOIN::exec() We can abort sorting after thd->select_limit rows if we there is no WHERE clause for any tables after the sorted one. */ - JOIN_TAB *table= &curr_join->join_tab[curr_join->const_tables+1]; + JOIN_TAB *curr_table= &curr_join->join_tab[curr_join->const_tables+1]; JOIN_TAB *end_table= &curr_join->join_tab[tables]; - for (; table < end_table ; table++) + for (; curr_table < end_table ; curr_table++) { /* table->keyuse is set in the case there was an original WHERE clause @@ -1439,7 +1440,8 @@ JOIN::exec() table->on_expr tells us that it was a LEFT JOIN and there will be at least one row generated from the table. */ - if (table->select_cond || (table->keyuse && !table->on_expr)) + if (curr_table->select_cond || + (curr_table->keyuse && !curr_table->on_expr)) { /* We have to sort all rows */ curr_join->select_limit= HA_POS_ERROR; @@ -1517,11 +1519,11 @@ JOIN::cleanup() delete select; delete_dynamic(&keyuse); delete procedure; - for (SELECT_LEX_UNIT *unit= select_lex->first_inner_unit(); - unit != 0; - unit= unit->next_unit()) + for (SELECT_LEX_UNIT *lex_unit= select_lex->first_inner_unit(); + lex_unit != 0; + lex_unit= lex_unit->next_unit()) { - error|= unit->cleanup(); + error|= lex_unit->cleanup(); } DBUG_RETURN(error); } @@ -4313,10 +4315,11 @@ COND *eliminate_not_funcs(COND *cond) static COND * optimize_cond(COND *conds,Item::cond_result *cond_value) { + DBUG_ENTER("optimize_cond"); if (!conds) { *cond_value= Item::COND_TRUE; - return conds; + DBUG_RETURN(conds); } DBUG_EXECUTE("where",print_where(conds,"original");); /* eliminate NOT operators */ @@ -4331,7 +4334,7 @@ optimize_cond(COND *conds,Item::cond_result *cond_value) DBUG_EXECUTE("where",print_where(conds,"after const change");); conds=remove_eq_conds(conds,cond_value) ; DBUG_EXECUTE("info",print_where(conds,"after remove");); - return conds; + DBUG_RETURN(conds); } @@ -8382,10 +8385,10 @@ bool JOIN::alloc_func_list() } -bool JOIN::make_sum_func_list(List<Item> &all_fields, List<Item> &send_fields, +bool JOIN::make_sum_func_list(List<Item> &field_list, List<Item> &send_fields, bool before_group_by) { - List_iterator_fast<Item> it(all_fields); + List_iterator_fast<Item> it(field_list); Item_sum **func; Item *item; DBUG_ENTER("make_sum_func_list"); @@ -8404,7 +8407,7 @@ bool JOIN::make_sum_func_list(List<Item> &all_fields, List<Item> &send_fields, if (before_group_by && rollup.state == ROLLUP::STATE_INITED) { rollup.state= ROLLUP::STATE_READY; - if (rollup_make_fields(all_fields, send_fields, &func)) + if (rollup_make_fields(field_list, send_fields, &func)) DBUG_RETURN(TRUE); // Should never happen } else if (rollup.state == ROLLUP::STATE_NONE) @@ -8707,12 +8710,12 @@ bool JOIN::rollup_init() */ for (i= 0 ; i < send_group_parts ; i++) { - List<Item> *fields= &rollup.fields[i]; - fields->empty(); + List<Item> *rollup_fields= &rollup.fields[i]; + rollup_fields->empty(); rollup.ref_pointer_arrays[i]= ref_array; ref_array+= all_fields.elements; for (j=0 ; j < fields_list.elements ; j++) - fields->push_back(rollup.item_null); + rollup_fields->push_back(rollup.item_null); } return 0; } @@ -8723,8 +8726,8 @@ bool JOIN::rollup_init() SYNOPSIS rollup_make_fields() - all_fields List of all fields (hidden and real ones) - fields Pointer to selected fields + fields_arg List of all fields (hidden and real ones) + sel_fields Pointer to selected fields func Store here a pointer to all fields IMPLEMENTATION: @@ -8736,11 +8739,11 @@ bool JOIN::rollup_init() 1 on error */ -bool JOIN::rollup_make_fields(List<Item> &all_fields, List<Item> &fields, +bool JOIN::rollup_make_fields(List<Item> &fields_arg, List<Item> &sel_fields, Item_sum ***func) { - List_iterator_fast<Item> it(all_fields); - Item *first_field= fields.head(); + List_iterator_fast<Item> it(fields_arg); + Item *first_field= sel_fields.head(); uint level; /* @@ -8775,7 +8778,7 @@ bool JOIN::rollup_make_fields(List<Item> &all_fields, List<Item> &fields, ORDER *start_group; /* Point to first hidden field */ - Item **ref_array= ref_array_start + all_fields.elements-1; + Item **ref_array= ref_array_start + fields_arg.elements-1; /* Remember where the sum functions ends for the previous level */ sum_funcs_end[pos+1]= *func; @@ -8815,10 +8818,10 @@ bool JOIN::rollup_make_fields(List<Item> &all_fields, List<Item> &fields, else if (real_fields) { /* Check if this is something that is part of this group by */ - ORDER *group; - for (group= start_group ; group ; group= group->next) + ORDER *group_tmp; + for (group_tmp= start_group ; group_tmp ; group_tmp= group_tmp->next) { - if (*group->item == item) + if (*group_tmp->item == item) { /* This is an element that is used by the GROUP BY and should be @@ -8925,7 +8928,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, DBUG_ENTER("select_describe"); DBUG_PRINT("info", ("Select 0x%lx, type %s, message %s", (ulong)join->select_lex, join->select_lex->type, - message)); + message ? message : "NULL")); /* Don't log this into the slow query log */ select_lex->options&= ~(QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED); join->unit->offset_limit_cnt= 0; @@ -9238,8 +9241,8 @@ void st_select_lex::print(THD *thd, String *str) next_on= 0; } - TABLE_LIST *next; - if ((next= table->next)) + TABLE_LIST *next_table; + if ((next_table= table->next)) { if (table->outer_join & JOIN_TYPE_RIGHT) { @@ -9248,9 +9251,9 @@ void st_select_lex::print(THD *thd, String *str) table->on_expr) next_on= table->on_expr; } - else if (next->straight) + else if (next_table->straight) str->append(" straight_join ", 15); - else if (next->outer_join & JOIN_TYPE_LEFT) + else if (next_table->outer_join & JOIN_TYPE_LEFT) str->append(" left join ", 11); else str->append(" join ", 6); @@ -9258,17 +9261,17 @@ void st_select_lex::print(THD *thd, String *str) } } - //where - Item *where= this->where; + // Where + Item *cur_where= where; if (join) - where= join->conds; - if (where) + cur_where= join->conds; + if (cur_where) { str->append(" where ", 7); - where->print(str); + cur_where->print(str); } - //group by & olap + // group by & olap if (group_list.elements) { str->append(" group by ", 10); @@ -9286,15 +9289,15 @@ void st_select_lex::print(THD *thd, String *str) } } - //having - Item *having= this->having; + // having + Item *cur_having= having; if (join) - having= join->having; + cur_having= join->having; - if (having) + if (cur_having) { str->append(" having ", 8); - having->print(str); + cur_having->print(str); } if (order_list.elements) diff --git a/sql/sql_select.h b/sql/sql_select.h index 2e101c78613..7cc71117914 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -207,14 +207,14 @@ class JOIN :public Sql_alloc bool union_part; // this subselect is part of union bool optimized; // flag to avoid double optimization in EXPLAIN - JOIN(THD *thd_arg, List<Item> &fields, ulong select_options_arg, + JOIN(THD *thd_arg, List<Item> &fields_arg, ulong select_options_arg, select_result *result_arg) - :fields_list(fields) + :fields_list(fields_arg) { - init(thd_arg, fields, select_options_arg, result_arg); + init(thd_arg, fields_arg, select_options_arg, result_arg); } - void init(THD *thd_arg, List<Item> &fields, ulong select_options_arg, + void init(THD *thd_arg, List<Item> &fields_arg, ulong select_options_arg, select_result *result_arg) { join_tab= join_tab_save= 0; @@ -247,8 +247,8 @@ class JOIN :public Sql_alloc hidden_group_fields= 0; /*safety*/ buffer_result= test(select_options & OPTION_BUFFER_RESULT) && !test(select_options & OPTION_FOUND_ROWS); - all_fields= fields; - fields_list= fields; + all_fields= fields_arg; + fields_list= fields_arg; error= 0; select= 0; ref_pointer_array= items0= items1= items2= items3= 0; @@ -256,7 +256,7 @@ class JOIN :public Sql_alloc zero_result_cause= 0; optimized= 0; - fields_list= fields; + fields_list= fields_arg; bzero((char*) &keyuse,sizeof(keyuse)); tmp_table_param.copy_field=0; tmp_table_param.end_write_records= HA_POS_ERROR; diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 56713e42244..f2470a59944 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -106,9 +106,9 @@ bool select_union::flush() } -int st_select_lex_unit::prepare(THD *thd, select_result *sel_result) +int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result) { - SELECT_LEX *lex_select_save= thd->lex.current_select; + SELECT_LEX *lex_select_save= thd_arg->lex.current_select; SELECT_LEX *sl, *first_select; select_result *tmp_result; DBUG_ENTER("st_select_lex_unit::prepare"); @@ -123,10 +123,8 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result) DBUG_RETURN(0); prepared= 1; res= 0; - TMP_TABLE_PARAM tmp_table_param; - bzero((char *)&tmp_table_param,sizeof(TMP_TABLE_PARAM)); - thd->lex.current_select= sl= first_select= first_select_in_union(); + thd_arg->lex.current_select= sl= first_select= first_select_in_union(); found_rows_for_union= first_select->options & OPTION_FOUND_ROWS; /* Global option */ @@ -136,7 +134,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result) if (!(tmp_result= union_result= new select_union(0))) goto err; union_result->not_describe= 1; - union_result->tmp_table_param= tmp_table_param; + union_result->tmp_table_param.init(); } else { @@ -147,10 +145,10 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result) for (;sl; sl= sl->next_select()) { - JOIN *join= new JOIN(thd, sl->item_list, - sl->options | thd->options | SELECT_NO_UNLOCK, + JOIN *join= new JOIN(thd_arg, sl->item_list, + sl->options | thd_arg->options | SELECT_NO_UNLOCK, tmp_result); - thd->lex.current_select= sl; + thd_arg->lex.current_select= sl; offset_limit_cnt= sl->offset_limit; select_limit_cnt= sl->select_limit+sl->offset_limit; if (select_limit_cnt < sl->select_limit) @@ -169,19 +167,19 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result) sl->having, (ORDER*) NULL, sl, this); - if (res || thd->is_fatal_error) + if (res || thd_arg->is_fatal_error) goto err; if (sl == first_select) { types.empty(); List_iterator_fast<Item> it(sl->item_list); - Item *item; - while((item= it++)) + Item *item_tmp; + while ((item_tmp= it++)) { - types.push_back(new Item_type_holder(thd, item)); + types.push_back(new Item_type_holder(thd_arg, item_tmp)); } - if (thd->is_fatal_error) + if (thd_arg->is_fatal_error) goto err; // out of memory } else @@ -194,10 +192,10 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result) } List_iterator_fast<Item> it(sl->item_list); List_iterator_fast<Item> tp(types); - Item *type, *item; - while((type= tp++, item= it++)) + Item *type, *item_tmp; + while ((type= tp++, item_tmp= it++)) { - if (((Item_type_holder*)type)->join_types(thd, item)) + if (((Item_type_holder*)type)->join_types(thd_arg, item_tmp)) DBUG_RETURN(-1); } } @@ -205,11 +203,12 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result) if (first_select->next_select()) { - tmp_table_param.field_count= types.elements; - if (!(table= create_tmp_table(thd, &tmp_table_param, types, + union_result->tmp_table_param.field_count= types.elements; + if (!(table= create_tmp_table(thd_arg, + &union_result->tmp_table_param, types, (ORDER*) 0, !union_option, 1, (first_select_in_union()->options | - thd->options | + thd_arg->options | TMP_TABLE_ALL_COLUMNS), HA_POS_ERROR, (char*) ""))) goto err; @@ -222,7 +221,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result) union_result->set_table(table); item_list.empty(); - thd->lex.current_select= lex_select_save; + thd_arg->lex.current_select= lex_select_save; { Field **field; for (field= table->field; *field; field++) @@ -235,12 +234,12 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result) else first_select->braces= 0; // remove our changes - thd->lex.current_select= lex_select_save; + thd_arg->lex.current_select= lex_select_save; - DBUG_RETURN(res || thd->is_fatal_error ? 1 : 0); + DBUG_RETURN(res || thd_arg->is_fatal_error ? 1 : 0); err: - thd->lex.current_select= lex_select_save; + thd_arg->lex.current_select= lex_select_save; DBUG_RETURN(-1); } @@ -375,7 +374,7 @@ int st_select_lex_unit::exec() if (!thd->is_fatal_error) // Check if EOM { - ulong options= thd->options; + ulong options_tmp= thd->options; thd->lex.current_select= fake_select_lex; offset_limit_cnt= global_parameters->offset_limit; select_limit_cnt= global_parameters->select_limit + @@ -384,9 +383,9 @@ int st_select_lex_unit::exec() if (select_limit_cnt < global_parameters->select_limit) select_limit_cnt= HA_POS_ERROR; // no limit if (select_limit_cnt == HA_POS_ERROR) - options&= ~OPTION_FOUND_ROWS; + options_tmp&= ~OPTION_FOUND_ROWS; else if (found_rows_for_union && !thd->lex.describe) - options|= OPTION_FOUND_ROWS; + options_tmp|= OPTION_FOUND_ROWS; fake_select_lex->ftfunc_list= &empty_list; fake_select_lex->table_list.link_in_list((byte *)&result_table_list, (byte **) @@ -421,7 +420,7 @@ int st_select_lex_unit::exec() global_parameters->order_list.elements, (ORDER*)global_parameters->order_list.first, (ORDER*) NULL, NULL, (ORDER*) NULL, - options | SELECT_NO_UNLOCK, + options_tmp | SELECT_NO_UNLOCK, result, this, fake_select_lex); if (!res) thd->limit_found_rows = (ulonglong)table->file->records + add_rows; diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 8b77f6958d0..d623ea66dfb 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -481,7 +481,8 @@ multi_update::multi_update(THD *thd_arg, TABLE_LIST *table_list, Connect fields with tables and create list of tables that are updated */ -int multi_update::prepare(List<Item> ¬_used_values, SELECT_LEX_UNIT *unit) +int multi_update::prepare(List<Item> ¬_used_values, + SELECT_LEX_UNIT *lex_unit) { TABLE_LIST *table_ref; SQL_LIST update; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index b944dc3955c..805dc9f1932 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -688,7 +688,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); insert_values update delete truncate rename show describe load alter optimize keycache preload flush reset purge begin commit rollback savepoint - slave master_def master_defs master_file_def + slave master_def master_defs master_file_def slave_until_opts repair restore backup analyze check start checksum field_list field_list_item field_spec kill column_def key_def keycache_list assign_to_keycache preload_list preload_keys diff --git a/strings/conf_to_src.c b/strings/conf_to_src.c index b21740f9dbb..d5ffa15ee0c 100644 --- a/strings/conf_to_src.c +++ b/strings/conf_to_src.c @@ -14,18 +14,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <ctype.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <fcntl.h> - #include <my_global.h> +#include <m_string.h> #include <m_ctype.h> +#include <fcntl.h> #include <my_xml.h> - #define ROW_LEN 16 #define ROW16_LEN 8 #define MAX_BUF 16*1024 |