From d0d52e9f11ab7bad11d34d207139a26f26dd362c Mon Sep 17 00:00:00 2001 From: Mikael Ronstrom Date: Thu, 10 Sep 2009 11:15:39 +0200 Subject: WL#4444 Added TRUNCATE partition support, fixes bug#19405 and bug #35111 --- sql/handler.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sql/handler.cc') diff --git a/sql/handler.cc b/sql/handler.cc index 0e83d2911f2..97e49ef2157 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2742,6 +2742,9 @@ void handler::print_error(int error, myf errflag) case HA_ERR_TABLE_NEEDS_UPGRADE: textno=ER_TABLE_NEEDS_UPGRADE; break; + case HA_ERR_NO_PARTITION_FOUND: + textno=ER_WRONG_PARTITION_NAME; + break; case HA_ERR_TABLE_READONLY: textno= ER_OPEN_AS_READONLY; break; -- cgit v1.2.1 From 63e56390a3f1a4f80642932a790ab74f28de8010 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 10 Sep 2009 03:18:29 -0600 Subject: WL#2110 (SIGNAL) WL#2265 (RESIGNAL) Manual merge of SIGNAL and RESIGNAL to mysql-trunk-signal, plus required dependencies. --- sql/handler.cc | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'sql/handler.cc') diff --git a/sql/handler.cc b/sql/handler.cc index 0e83d2911f2..c29cb196b60 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1313,7 +1313,7 @@ int ha_rollback_trans(THD *thd, bool all) trans->ha_list= 0; trans->no_2pc=0; if (is_real_trans && thd->transaction_rollback_request) - thd->transaction.xid_state.rm_error= thd->main_da.sql_errno(); + thd->transaction.xid_state.rm_error= thd->stmt_da->sql_errno(); if (all) thd->variables.tx_isolation=thd->session_tx_isolation; } @@ -1914,23 +1914,28 @@ const char *get_canonical_filename(handler *file, const char *path, struct Ha_delete_table_error_handler: public Internal_error_handler { public: - virtual bool handle_error(uint sql_errno, - const char *message, - MYSQL_ERROR::enum_warning_level level, - THD *thd); + virtual bool handle_condition(THD *thd, + uint sql_errno, + const char* sqlstate, + MYSQL_ERROR::enum_warning_level level, + const char* msg, + MYSQL_ERROR ** cond_hdl); char buff[MYSQL_ERRMSG_SIZE]; }; bool Ha_delete_table_error_handler:: -handle_error(uint sql_errno, - const char *message, - MYSQL_ERROR::enum_warning_level level, - THD *thd) -{ +handle_condition(THD *, + uint, + const char*, + MYSQL_ERROR::enum_warning_level, + const char* msg, + MYSQL_ERROR ** cond_hdl) +{ + *cond_hdl= NULL; /* Grab the error message */ - strmake(buff, message, sizeof(buff)-1); + strmake(buff, msg, sizeof(buff)-1); return TRUE; } @@ -1989,7 +1994,7 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path, XXX: should we convert *all* errors to warnings here? What if the error is fatal? */ - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, error, + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, error, ha_delete_table_error_handler.buff); } delete file; -- cgit v1.2.1 From 5d2f79def9b67dd5400411070d47f8180ceb072b Mon Sep 17 00:00:00 2001 From: Mats Kindahl Date: Fri, 25 Sep 2009 11:47:15 +0200 Subject: Bug #47645: Segmentation fault when out of memory during handlerton initialization There is a missing check for memory allocation failure when allocating memory for the handlerton structure. If the handlerton init function tries to de-reference the pointer, it will cause a segmentation fault and crash the server. This patch fixes the problem by not calling the init function if memory allocation failed, and instead prints an informative error message and reports the error to the caller. sql/handler.cc: Add a check if memory allocation succeeded before calling the init function. If it failed, it is not necessary to free the memory, but the plugin->data is set to NULL to ensure that it can be checked for failure. --- sql/handler.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sql/handler.cc') diff --git a/sql/handler.cc b/sql/handler.cc index e5c64452aaf..f966a9099ee 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -430,6 +430,14 @@ int ha_initialize_handlerton(st_plugin_int *plugin) hton= (handlerton *)my_malloc(sizeof(handlerton), MYF(MY_WME | MY_ZEROFILL)); + + if (hton == NULL) + { + sql_print_error("Unable to allocate memory for plugin '%s' handlerton.", + plugin->name.str); + goto err_no_hton_memory; + } + /* Historical Requirement */ plugin->data= hton; // shortcut for the future if (plugin->plugin->init && plugin->plugin->init(hton)) @@ -540,6 +548,7 @@ err_deinit: err: my_free((uchar*) hton, MYF(0)); +err_no_hton_memory: plugin->data= NULL; DBUG_RETURN(1); } -- cgit v1.2.1 From 623ed58cfda0aef6b6bf545a4200357a58a8a4cc Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Sat, 26 Sep 2009 12:49:49 +0800 Subject: Backporting WL#4398 WL#1720 Backporting BUG#44058 BUG#42244 BUG#45672 BUG#45673 Backporting BUG#45819 BUG#45973 BUG#39012 --- sql/handler.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'sql/handler.cc') diff --git a/sql/handler.cc b/sql/handler.cc index e5c64452aaf..f17bb9f8036 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -24,6 +24,7 @@ #endif #include "mysql_priv.h" +#include "rpl_handler.h" #include "rpl_filter.h" #include #include @@ -221,6 +222,8 @@ handlerton *ha_checktype(THD *thd, enum legacy_db_type database_type, return NULL; } + RUN_HOOK(transaction, after_rollback, (thd, FALSE)); + switch (database_type) { #ifndef NO_HASH case DB_TYPE_HASH: @@ -1190,6 +1193,7 @@ int ha_commit_trans(THD *thd, bool all) if (cookie) tc_log->unlog(cookie, xid); DBUG_EXECUTE_IF("crash_commit_after", abort();); + RUN_HOOK(transaction, after_commit, (thd, FALSE)); end: if (rw_trans) start_waiting_global_read_lock(thd); @@ -1337,6 +1341,7 @@ int ha_rollback_trans(THD *thd, bool all) push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARNING_NOT_COMPLETE_ROLLBACK, ER(ER_WARNING_NOT_COMPLETE_ROLLBACK)); + RUN_HOOK(transaction, after_rollback, (thd, FALSE)); DBUG_RETURN(error); } @@ -1371,7 +1376,14 @@ int ha_autocommit_or_rollback(THD *thd, int error) thd->variables.tx_isolation=thd->session_tx_isolation; } + else #endif + { + if (!error) + RUN_HOOK(transaction, after_commit, (thd, FALSE)); + else + RUN_HOOK(transaction, after_rollback, (thd, FALSE)); + } DBUG_RETURN(error); } -- cgit v1.2.1 From ebca60c1ff07ecb57cd2852052534640322ca576 Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Fri, 2 Oct 2009 13:59:42 +0800 Subject: Backport BUG#41013 main.bootstrap coredumps in 6.0-rpl When a storage engine failed to initialize before allocated slot number, the slot number would be 0, and when later finalizing this plugin, it would accidentally unplug the storage engine currently uses slot 0. This patch fixed this problem by add a new macro value HA_SLOT_UNDEF to distinguish undefined slot number from slot 0. --- sql/handler.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sql/handler.cc') diff --git a/sql/handler.cc b/sql/handler.cc index f966a9099ee..ac959cb62f2 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -413,7 +413,13 @@ int ha_finalize_handlerton(st_plugin_int *plugin) reuse an array slot. Otherwise the number of uninstall/install cycles would be limited. */ - hton2plugin[hton->slot]= NULL; + if (hton->slot != HA_SLOT_UNDEF) + { + /* Make sure we are not unpluging another plugin */ + DBUG_ASSERT(hton2plugin[hton->slot] == plugin); + DBUG_ASSERT(hton->slot < MAX_HA); + hton2plugin[hton->slot]= NULL; + } my_free((uchar*)hton, MYF(0)); @@ -438,6 +444,7 @@ int ha_initialize_handlerton(st_plugin_int *plugin) goto err_no_hton_memory; } + hton->slot= HA_SLOT_UNDEF; /* Historical Requirement */ plugin->data= hton; // shortcut for the future if (plugin->plugin->init && plugin->plugin->init(hton)) -- cgit v1.2.1 From 9b41c7532d18b04d2f430932ad916886c77fbff6 Mon Sep 17 00:00:00 2001 From: Konstantin Osipov Date: Wed, 14 Oct 2009 20:37:38 +0400 Subject: Backport of: ---------------------------------------------------------- revno: 2617.22.5 committer: Konstantin Osipov branch nick: mysql-6.0-runtime timestamp: Tue 2009-01-27 05:08:48 +0300 message: Remove non-prefixed use of HASH. Always use my_hash_init(), my_hash_inited(), my_hash_search(), my_hash_element(), my_hash_delete(), my_hash_free() rather than non-prefixed counterparts (hash_init(), etc). Remove the backward-compatible defines. --- sql/handler.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sql/handler.cc') diff --git a/sql/handler.cc b/sql/handler.cc index 6aa6450cbb8..495670e238e 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1533,7 +1533,7 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin, } // recovery mode if (info->commit_list ? - hash_search(info->commit_list, (uchar *)&x, sizeof(x)) != 0 : + my_hash_search(info->commit_list, (uchar *)&x, sizeof(x)) != 0 : tc_heuristic_recover == TC_HEURISTIC_RECOVER_COMMIT) { #ifndef DBUG_OFF @@ -1649,7 +1649,7 @@ bool mysql_xa_recover(THD *thd) DBUG_RETURN(1); pthread_mutex_lock(&LOCK_xid_cache); - while ((xs= (XID_STATE*)hash_element(&xid_cache, i++))) + while ((xs= (XID_STATE*) my_hash_element(&xid_cache, i++))) { if (xs->xa_state==XA_PREPARED) { @@ -2972,9 +2972,9 @@ static bool update_frm_version(TABLE *table) if ((result= my_pwrite(file,(uchar*) version,4,51L,MYF_RW))) goto err; - for (entry=(TABLE*) hash_first(&open_cache,(uchar*) key,key_length, &state); + for (entry=(TABLE*) my_hash_first(&open_cache,(uchar*) key,key_length, &state); entry; - entry= (TABLE*) hash_next(&open_cache,(uchar*) key,key_length, &state)) + entry= (TABLE*) my_hash_next(&open_cache,(uchar*) key,key_length, &state)) entry->s->mysql_version= MYSQL_VERSION_ID; } err: -- cgit v1.2.1 From d8c3f2263f3deaadff957a0047460e8058cffccf Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Thu, 15 Oct 2009 17:23:43 +0500 Subject: WL#751 Error message construction, backport --- sql/handler.cc | 67 +++++++++++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 29 deletions(-) (limited to 'sql/handler.cc') diff --git a/sql/handler.cc b/sql/handler.cc index 6aa6450cbb8..a490d39a444 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -283,6 +283,15 @@ handler *get_ha_partition(partition_info *part_info) #endif +const char **handler_errmsgs; + + +const char **get_handler_errmsgs() +{ + return handler_errmsgs; +} + + /** Register handler error messages for use with my_error(). @@ -294,61 +303,61 @@ handler *get_ha_partition(partition_info *part_info) int ha_init_errors(void) { -#define SETMSG(nr, msg) errmsgs[(nr) - HA_ERR_FIRST]= (msg) +#define SETMSG(nr, msg) handler_errmsgs[(nr) - HA_ERR_FIRST]= (msg) const char **errmsgs; /* Allocate a pointer array for the error message strings. */ /* Zerofill it to avoid uninitialized gaps. */ - if (! (errmsgs= (const char**) my_malloc(HA_ERR_ERRORS * sizeof(char*), - MYF(MY_WME | MY_ZEROFILL)))) + if (! (handler_errmsgs= (const char**) my_malloc(HA_ERR_ERRORS * sizeof(char*), + MYF(MY_WME | MY_ZEROFILL)))) return 1; /* Set the dedicated error messages. */ - SETMSG(HA_ERR_KEY_NOT_FOUND, ER(ER_KEY_NOT_FOUND)); - SETMSG(HA_ERR_FOUND_DUPP_KEY, ER(ER_DUP_KEY)); + SETMSG(HA_ERR_KEY_NOT_FOUND, ER_DEFAULT(ER_KEY_NOT_FOUND)); + SETMSG(HA_ERR_FOUND_DUPP_KEY, ER_DEFAULT(ER_DUP_KEY)); SETMSG(HA_ERR_RECORD_CHANGED, "Update wich is recoverable"); SETMSG(HA_ERR_WRONG_INDEX, "Wrong index given to function"); - SETMSG(HA_ERR_CRASHED, ER(ER_NOT_KEYFILE)); - SETMSG(HA_ERR_WRONG_IN_RECORD, ER(ER_CRASHED_ON_USAGE)); + SETMSG(HA_ERR_CRASHED, ER_DEFAULT(ER_NOT_KEYFILE)); + SETMSG(HA_ERR_WRONG_IN_RECORD, ER_DEFAULT(ER_CRASHED_ON_USAGE)); SETMSG(HA_ERR_OUT_OF_MEM, "Table handler out of memory"); SETMSG(HA_ERR_NOT_A_TABLE, "Incorrect file format '%.64s'"); SETMSG(HA_ERR_WRONG_COMMAND, "Command not supported"); - SETMSG(HA_ERR_OLD_FILE, ER(ER_OLD_KEYFILE)); + SETMSG(HA_ERR_OLD_FILE, ER_DEFAULT(ER_OLD_KEYFILE)); SETMSG(HA_ERR_NO_ACTIVE_RECORD, "No record read in update"); SETMSG(HA_ERR_RECORD_DELETED, "Intern record deleted"); - SETMSG(HA_ERR_RECORD_FILE_FULL, ER(ER_RECORD_FILE_FULL)); + SETMSG(HA_ERR_RECORD_FILE_FULL, ER_DEFAULT(ER_RECORD_FILE_FULL)); SETMSG(HA_ERR_INDEX_FILE_FULL, "No more room in index file '%.64s'"); SETMSG(HA_ERR_END_OF_FILE, "End in next/prev/first/last"); - SETMSG(HA_ERR_UNSUPPORTED, ER(ER_ILLEGAL_HA)); + SETMSG(HA_ERR_UNSUPPORTED, ER_DEFAULT(ER_ILLEGAL_HA)); SETMSG(HA_ERR_TO_BIG_ROW, "Too big row"); SETMSG(HA_WRONG_CREATE_OPTION, "Wrong create option"); - SETMSG(HA_ERR_FOUND_DUPP_UNIQUE, ER(ER_DUP_UNIQUE)); + SETMSG(HA_ERR_FOUND_DUPP_UNIQUE, ER_DEFAULT(ER_DUP_UNIQUE)); SETMSG(HA_ERR_UNKNOWN_CHARSET, "Can't open charset"); - SETMSG(HA_ERR_WRONG_MRG_TABLE_DEF, ER(ER_WRONG_MRG_TABLE)); - SETMSG(HA_ERR_CRASHED_ON_REPAIR, ER(ER_CRASHED_ON_REPAIR)); - SETMSG(HA_ERR_CRASHED_ON_USAGE, ER(ER_CRASHED_ON_USAGE)); - SETMSG(HA_ERR_LOCK_WAIT_TIMEOUT, ER(ER_LOCK_WAIT_TIMEOUT)); - SETMSG(HA_ERR_LOCK_TABLE_FULL, ER(ER_LOCK_TABLE_FULL)); - SETMSG(HA_ERR_READ_ONLY_TRANSACTION, ER(ER_READ_ONLY_TRANSACTION)); - SETMSG(HA_ERR_LOCK_DEADLOCK, ER(ER_LOCK_DEADLOCK)); - SETMSG(HA_ERR_CANNOT_ADD_FOREIGN, ER(ER_CANNOT_ADD_FOREIGN)); - SETMSG(HA_ERR_NO_REFERENCED_ROW, ER(ER_NO_REFERENCED_ROW_2)); - SETMSG(HA_ERR_ROW_IS_REFERENCED, ER(ER_ROW_IS_REFERENCED_2)); + SETMSG(HA_ERR_WRONG_MRG_TABLE_DEF, ER_DEFAULT(ER_WRONG_MRG_TABLE)); + SETMSG(HA_ERR_CRASHED_ON_REPAIR, ER_DEFAULT(ER_CRASHED_ON_REPAIR)); + SETMSG(HA_ERR_CRASHED_ON_USAGE, ER_DEFAULT(ER_CRASHED_ON_USAGE)); + SETMSG(HA_ERR_LOCK_WAIT_TIMEOUT, ER_DEFAULT(ER_LOCK_WAIT_TIMEOUT)); + SETMSG(HA_ERR_LOCK_TABLE_FULL, ER_DEFAULT(ER_LOCK_TABLE_FULL)); + SETMSG(HA_ERR_READ_ONLY_TRANSACTION, ER_DEFAULT(ER_READ_ONLY_TRANSACTION)); + SETMSG(HA_ERR_LOCK_DEADLOCK, ER_DEFAULT(ER_LOCK_DEADLOCK)); + SETMSG(HA_ERR_CANNOT_ADD_FOREIGN, ER_DEFAULT(ER_CANNOT_ADD_FOREIGN)); + SETMSG(HA_ERR_NO_REFERENCED_ROW, ER_DEFAULT(ER_NO_REFERENCED_ROW_2)); + SETMSG(HA_ERR_ROW_IS_REFERENCED, ER_DEFAULT(ER_ROW_IS_REFERENCED_2)); SETMSG(HA_ERR_NO_SAVEPOINT, "No savepoint with that name"); SETMSG(HA_ERR_NON_UNIQUE_BLOCK_SIZE, "Non unique key block size"); SETMSG(HA_ERR_NO_SUCH_TABLE, "No such table: '%.64s'"); - SETMSG(HA_ERR_TABLE_EXIST, ER(ER_TABLE_EXISTS_ERROR)); + SETMSG(HA_ERR_TABLE_EXIST, ER_DEFAULT(ER_TABLE_EXISTS_ERROR)); SETMSG(HA_ERR_NO_CONNECTION, "Could not connect to storage engine"); - SETMSG(HA_ERR_TABLE_DEF_CHANGED, ER(ER_TABLE_DEF_CHANGED)); + SETMSG(HA_ERR_TABLE_DEF_CHANGED, ER_DEFAULT(ER_TABLE_DEF_CHANGED)); SETMSG(HA_ERR_FOREIGN_DUPLICATE_KEY, "FK constraint would lead to duplicate key"); - SETMSG(HA_ERR_TABLE_NEEDS_UPGRADE, ER(ER_TABLE_NEEDS_UPGRADE)); - SETMSG(HA_ERR_TABLE_READONLY, ER(ER_OPEN_AS_READONLY)); - SETMSG(HA_ERR_AUTOINC_READ_FAILED, ER(ER_AUTOINC_READ_FAILED)); - SETMSG(HA_ERR_AUTOINC_ERANGE, ER(ER_WARN_DATA_OUT_OF_RANGE)); - SETMSG(HA_ERR_TOO_MANY_CONCURRENT_TRXS, ER(ER_TOO_MANY_CONCURRENT_TRXS)); + SETMSG(HA_ERR_TABLE_NEEDS_UPGRADE, ER_DEFAULT(ER_TABLE_NEEDS_UPGRADE)); + SETMSG(HA_ERR_TABLE_READONLY, ER_DEFAULT(ER_OPEN_AS_READONLY)); + SETMSG(HA_ERR_AUTOINC_READ_FAILED, ER_DEFAULT(ER_AUTOINC_READ_FAILED)); + SETMSG(HA_ERR_AUTOINC_ERANGE, ER_DEFAULT(ER_WARN_DATA_OUT_OF_RANGE)); + SETMSG(HA_ERR_TOO_MANY_CONCURRENT_TRXS, ER_DEFAULT(ER_TOO_MANY_CONCURRENT_TRXS)); /* Register the error messages for use with my_error(). */ - return my_error_register(errmsgs, HA_ERR_FIRST, HA_ERR_LAST); + return my_error_register(get_handler_errmsgs, HA_ERR_FIRST, HA_ERR_LAST); } -- cgit v1.2.1 From 8ec23470f14323bb85220bae42d154681a4be7f3 Mon Sep 17 00:00:00 2001 From: Konstantin Osipov Date: Thu, 22 Oct 2009 00:02:06 +0400 Subject: Backport of revno 2630.28.10, 2630.28.31, 2630.28.26, 2630.33.1, 2630.39.1, 2630.28.29, 2630.34.3, 2630.34.2, 2630.34.1, 2630.29.29, 2630.29.28, 2630.31.1, 2630.28.13, 2630.28.10, 2617.23.14 and some other minor revisions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch implements: WL#4264 "Backup: Stabilize Service Interface" -- all the server prerequisites except si_objects.{h,cc} themselves (they can be just copied over, when needed). WL#4435: Support OUT-parameters in prepared statements. (and all issues in the initial patches for these two tasks, that were discovered in pushbuild and during testing). Bug#39519: mysql_stmt_close() should flush all data associated with the statement. After execution of a prepared statement, send OUT parameters of the invoked stored procedure, if any, to the client. When using the binary protocol, send the parameters in an additional result set over the wire. When using the text protocol, assign out parameters to the user variables from the CALL(@var1, @var2, ...) specification. The following refactoring has been made: - Protocol::send_fields() was renamed to Protocol::send_result_set_metadata(); - A new Protocol::send_result_set_row() was introduced to incapsulate common functionality for sending row data. - Signature of Protocol::prepare_for_send() was changed: this operation does not need a list of items, the number of items is fully sufficient. The following backward incompatible changes have been made: - CLIENT_MULTI_RESULTS is now enabled by default in the client; - CLIENT_PS_MULTI_RESUTLS is now enabled by default in the client. include/mysql.h: Add a new flag to MYSQL_METHODS::flush_use_result function pointer. This flag determines if all results should be flushed or only the first one: - if flush_all_results is TRUE, then cli_flush_use_result() will read/flush all pending results. I.e. it will read all packets while server status attribute indicates that there are more results. This is a new semantic, required to fix the bug. - if flush_all_results is FALSE, the old sematic is preserved -- i.e. cli_flush_use_result() reads data until first EOF-packet. include/mysql.h.pp: Update the ABI with new calls (compatible changes). include/mysql_com.h: Add CLIENT_PS_OUT_PARAMS -- a client capability indicating that the client supportsю libmysql/libmysql.c: Add mysql_stmt_next_result() -- analogue of mysql_next_result() for binary protocol. Fix a minor bug in alloc_fields() -- not all members were copied over, and some only shallow-copied (catalog). Flush all results in mysql_stmt_close() (Bug#39519). libmysqld/lib_sql.cc: Rename send_fields() -> send_result_set_metadata(). Refactoring: change prepare_for_send() so that it accepts only what it really needs -- a number of elements in the list. mysql-test/r/ps.result: Update results: WL#4435. mysql-test/t/ps.test: WL#4435: A test case for an SQL-part of the problem. sql-common/client.c: Bug#39519. Implement new functionality in cli_flush_use_result(): if flush_all_delete is TRUE, then it should read/flush all pending results. sql/Makefile.am: Add a new header sql_prepare.h to the list of build headers. sql/events.cc: Rename: Protocol::send_fields() -> Protocol::send_result_set_metadata(). sql/handler.cc: Rename: Protocol::send_fields() -> Protocol::send_result_set_metadata(). sql/mysql_priv.h: Move sql_prepare.cc-specific declarations to a new header - sql_prepare.h. sql/procedure.h: Rename: Protocol::send_fields() -> Protocol::send_result_set_metadata(). sql/protocol.cc: Move the logic responsible for sending of one result set row to the Protocol class. Define a template for end-of-statement action. Refactoring: change prepare_for_send() so that it accepts only what it really needs -- a number of elements in the list. Rename send_fields() to send_result_set_metadata(). sql/protocol.h: Update with new declarations (WL#4435). Rename send_fields() -> send_result_set_metadata(). prepare_for_send() only needs the number of columns to send, and doesn't use the item list - update signature to require only what's needed. Add a new protocol type -- Protocol_local. sql/repl_failsafe.cc: Rename: Protocol::send_fields() -> Protocol::send_result_set_metadata(). sql/slave.cc: Rename: Protocol::send_fields() -> Protocol::send_result_set_metadata(). sql/sql_acl.cc: Rename: Protocol::send_fields() -> Protocol::send_result_set_metadata(). sql/sql_base.cc: Include sql_prepare.h (for Reprepare_observer). sql/sql_cache.cc: Extend the query cache flags block to be able to store a numeric id for the result format, not just a flag binary/non-binary. sql/sql_class.cc: Update to use the rename of Protocol::send_fields() to Protocol::send_result_set_metadata(). Use Protocol::send_one_result_set_row(). sql/sql_class.h: Move the declaration of Reprepare_observer to the new header - sql_prepare.h. Update to the new signature of class Protocol::send_fields(). sql/sql_connect.cc: Use a protocol template method instead of raw NET layer API at the end of a statement. sql/sql_cursor.cc: Rename: Protocol::send_fields() -> Protocol::send_result_set_metadata(). sql/sql_error.cc: Rename: Protocol::send_fields() -> Protocol::send_result_set_metadata(). sql/sql_handler.cc: Rename: Protocol::send_fields() -> Protocol::send_result_set_metadata(). Use new method Protocol::send_one_result_set_row(). sql/sql_help.cc: Rename: Protocol::send_fields() -> Protocol::send_result_set_metadata(). sql/sql_lex.cc: Initialize multi_statements variable. Add a handy constant for empty lex string. sql/sql_lex.h: Add a separate member for a standalone parsing option - multi-statements support. sql/sql_list.cc: sql_list.h is a standalone header now, no need to include mysql_priv.h. sql/sql_list.h: Make sql_list.h a stand-alone header. sql/sql_parse.cc: Include sql_prepare.h for prepared statements- related declarations. Use a new Protocol template method to end each statement (send OK, EOF or ERROR to the client). sql/sql_prepare.cc: Implement Execute Direct API (WL#4264), currently unused. It will be used by the service interface (Backup). Use a new header - sql_prepare.h. Add support for OUT parameters in the binary and text protocol (prepared statements only). sql/sql_prepare.h: Add a new header to contain (for now) all prepared statement- external related declarations. sql/sql_profile.cc: Rename: Protocol::send_fields() -> Protocol::send_result_set_metadata(). sql/sql_repl.cc: Rename: Protocol::send_fields() -> Protocol::send_result_set_metadata(). sql/sql_select.cc: Rename: Protocol::send_fields() -> Protocol::send_result_set_metadata(). sql/sql_show.cc: Rename: Protocol::send_fields() -> Protocol::send_result_set_metadata(). sql/sql_string.h: Add a way to convert a String to LEX_STRING. sql/sql_table.cc: Rename: Protocol::send_fields() -> Protocol::send_result_set_metadata(). sql/sql_update.cc: Remove an extraneous my_error(). The error is already reported in update_non_unique_table_error(). sql/sql_yacc.yy: Support for multi-statements is an independent property of parsing, not derived from the protocol type. tests/mysql_client_test.c: Add tests for WL#4435 (binary protocol). --- sql/handler.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sql/handler.cc') diff --git a/sql/handler.cc b/sql/handler.cc index 495670e238e..bdf2f862275 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1644,7 +1644,7 @@ bool mysql_xa_recover(THD *thd) field_list.push_back(new Item_int("bqual_length", 0, MY_INT32_NUM_DECIMAL_DIGITS)); field_list.push_back(new Item_empty_string("data",XIDDATASIZE)); - if (protocol->send_fields(&field_list, + if (protocol->send_result_set_metadata(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) DBUG_RETURN(1); @@ -4434,7 +4434,7 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat) field_list.push_back(new Item_empty_string("Name",FN_REFLEN)); field_list.push_back(new Item_empty_string("Status",10)); - if (protocol->send_fields(&field_list, + if (protocol->send_result_set_metadata(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) return TRUE; -- cgit v1.2.1