diff options
-rw-r--r-- | include/mysql/plugin.h | 12 | ||||
-rw-r--r-- | include/mysql/plugin_audit.h.pp | 26 | ||||
-rw-r--r-- | include/mysql/plugin_auth.h.pp | 26 | ||||
-rw-r--r-- | include/mysql/plugin_ftparser.h.pp | 26 | ||||
-rw-r--r-- | include/mysql/service_thd_autoinc.h | 53 | ||||
-rw-r--r-- | include/mysql/service_thd_error_context.h | 93 | ||||
-rw-r--r-- | include/mysql/services.h | 2 | ||||
-rw-r--r-- | include/service_versions.h | 3 | ||||
-rw-r--r-- | libservices/CMakeLists.txt | 2 | ||||
-rw-r--r-- | libservices/thd_autoinc_service.c | 18 | ||||
-rw-r--r-- | libservices/thd_error_context_service.c | 18 | ||||
-rw-r--r-- | mysql-test/r/handlersocket.result | 2 | ||||
-rw-r--r-- | mysql-test/r/plugin.result | 6 | ||||
-rw-r--r-- | mysql-test/suite/plugins/r/show_all_plugins.result | 4 | ||||
-rw-r--r-- | sql/sql_class.cc | 46 | ||||
-rw-r--r-- | sql/sql_plugin_services.h | 14 | ||||
-rw-r--r-- | storage/csv/ha_tina.cc | 4 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 4 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.h | 7 | ||||
-rw-r--r-- | storage/myisam/ha_myisam.cc | 6 | ||||
-rw-r--r-- | storage/spider/spd_include.h | 4 | ||||
-rw-r--r-- | storage/xtradb/handler/ha_innodb.cc | 5 |
22 files changed, 345 insertions, 36 deletions
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index bbfd93eb94a..ac2c93dfe31 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -75,7 +75,7 @@ typedef struct st_mysql_xid MYSQL_XID; #define MYSQL_PLUGIN_INTERFACE_VERSION 0x0104 /* MariaDB plugin interface version */ -#define MARIA_PLUGIN_INTERFACE_VERSION 0x0107 +#define MARIA_PLUGIN_INTERFACE_VERSION 0x0108 /* The allowable types of plugins @@ -622,11 +622,15 @@ void **thd_ha_data(const MYSQL_THD thd, const struct handlerton *hton); void thd_storage_lock_wait(MYSQL_THD thd, long long value); int thd_tx_isolation(const MYSQL_THD thd); int thd_tx_is_read_only(const MYSQL_THD thd); +#if MARIA_PLUGIN_INTERFACE_VERSION < 0x0200 +/** + TODO: This function is for API compatibility, remove it eventually. + All engines should switch to use thd_get_error_context_description() + plugin service function. +*/ char *thd_security_context(MYSQL_THD thd, char *buffer, unsigned int length, unsigned int max_query_len); -/* Increments the row counter, see THD::row_count */ -void thd_inc_row_count(MYSQL_THD thd); - +#endif /** Create a temporary file. diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp index 078cb2e6714..6ad222ca63a 100644 --- a/include/mysql/plugin_audit.h.pp +++ b/include/mysql/plugin_audit.h.pp @@ -137,6 +137,31 @@ extern struct logger_service_st { int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...); int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size); int logger_rotate(LOGGER_HANDLE *log); +#include <mysql/service_thd_autoinc.h> +extern struct thd_autoinc_service_st { + void (*thd_get_autoinc_func)(const void* thd, + unsigned long* off, unsigned long* inc); +} *thd_autoinc_service; +void thd_get_autoinc(const void* thd, + unsigned long* off, unsigned long* inc); +#include <mysql/service_thd_error_context.h> +extern struct thd_error_context_service_st { + const char *(*thd_get_error_message_func)(const void* thd); + unsigned int (*thd_get_error_number_func)(const void* thd); + unsigned long (*thd_get_error_row_func)(const void* thd); + void (*thd_inc_error_row_func)(void* thd); + char *(*thd_get_error_context_description_func)(void* thd, + char *buffer, + unsigned int length, + unsigned int max_query_length); +} *thd_error_context_service; +const char *thd_get_error_message(const void* thd); +unsigned int thd_get_error_number(const void* thd); +unsigned long thd_get_error_row(const void* thd); +void thd_inc_error_row(void* thd); +char *thd_get_error_context_description(void* thd, + char *buffer, unsigned int length, + unsigned int max_query_length); struct st_mysql_xid { long formatID; long gtrid_length; @@ -280,7 +305,6 @@ int thd_tx_isolation(const void* thd); int thd_tx_is_read_only(const void* thd); char *thd_security_context(void* thd, char *buffer, unsigned int length, unsigned int max_query_len); -void thd_inc_row_count(void* thd); int mysql_tmpfile(const char *prefix); unsigned long thd_get_thread_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp index f5b8a8770f8..ad2a2f7a963 100644 --- a/include/mysql/plugin_auth.h.pp +++ b/include/mysql/plugin_auth.h.pp @@ -137,6 +137,31 @@ extern struct logger_service_st { int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...); int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size); int logger_rotate(LOGGER_HANDLE *log); +#include <mysql/service_thd_autoinc.h> +extern struct thd_autoinc_service_st { + void (*thd_get_autoinc_func)(const void* thd, + unsigned long* off, unsigned long* inc); +} *thd_autoinc_service; +void thd_get_autoinc(const void* thd, + unsigned long* off, unsigned long* inc); +#include <mysql/service_thd_error_context.h> +extern struct thd_error_context_service_st { + const char *(*thd_get_error_message_func)(const void* thd); + unsigned int (*thd_get_error_number_func)(const void* thd); + unsigned long (*thd_get_error_row_func)(const void* thd); + void (*thd_inc_error_row_func)(void* thd); + char *(*thd_get_error_context_description_func)(void* thd, + char *buffer, + unsigned int length, + unsigned int max_query_length); +} *thd_error_context_service; +const char *thd_get_error_message(const void* thd); +unsigned int thd_get_error_number(const void* thd); +unsigned long thd_get_error_row(const void* thd); +void thd_inc_error_row(void* thd); +char *thd_get_error_context_description(void* thd, + char *buffer, unsigned int length, + unsigned int max_query_length); struct st_mysql_xid { long formatID; long gtrid_length; @@ -280,7 +305,6 @@ int thd_tx_isolation(const void* thd); int thd_tx_is_read_only(const void* thd); char *thd_security_context(void* thd, char *buffer, unsigned int length, unsigned int max_query_len); -void thd_inc_row_count(void* thd); int mysql_tmpfile(const char *prefix); unsigned long thd_get_thread_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp index dff8b79e6f6..efcb25edc2f 100644 --- a/include/mysql/plugin_ftparser.h.pp +++ b/include/mysql/plugin_ftparser.h.pp @@ -137,6 +137,31 @@ extern struct logger_service_st { int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...); int logger_write(LOGGER_HANDLE *log, const char *buffer, size_t size); int logger_rotate(LOGGER_HANDLE *log); +#include <mysql/service_thd_autoinc.h> +extern struct thd_autoinc_service_st { + void (*thd_get_autoinc_func)(const void* thd, + unsigned long* off, unsigned long* inc); +} *thd_autoinc_service; +void thd_get_autoinc(const void* thd, + unsigned long* off, unsigned long* inc); +#include <mysql/service_thd_error_context.h> +extern struct thd_error_context_service_st { + const char *(*thd_get_error_message_func)(const void* thd); + unsigned int (*thd_get_error_number_func)(const void* thd); + unsigned long (*thd_get_error_row_func)(const void* thd); + void (*thd_inc_error_row_func)(void* thd); + char *(*thd_get_error_context_description_func)(void* thd, + char *buffer, + unsigned int length, + unsigned int max_query_length); +} *thd_error_context_service; +const char *thd_get_error_message(const void* thd); +unsigned int thd_get_error_number(const void* thd); +unsigned long thd_get_error_row(const void* thd); +void thd_inc_error_row(void* thd); +char *thd_get_error_context_description(void* thd, + char *buffer, unsigned int length, + unsigned int max_query_length); struct st_mysql_xid { long formatID; long gtrid_length; @@ -233,7 +258,6 @@ int thd_tx_isolation(const void* thd); int thd_tx_is_read_only(const void* thd); char *thd_security_context(void* thd, char *buffer, unsigned int length, unsigned int max_query_len); -void thd_inc_row_count(void* thd); int mysql_tmpfile(const char *prefix); unsigned long thd_get_thread_id(const void* thd); void thd_get_xid(const void* thd, MYSQL_XID *xid); diff --git a/include/mysql/service_thd_autoinc.h b/include/mysql/service_thd_autoinc.h new file mode 100644 index 00000000000..a4e336ab232 --- /dev/null +++ b/include/mysql/service_thd_autoinc.h @@ -0,0 +1,53 @@ +#ifndef MYSQL_SERVICE_THD_AUTOINC_INCLUDED +/* Copyright (C) 2013 MariaDB Foundation. + + 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; version 2 of the License. + + 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/** + @file + This service provides access to the auto_increment related system variables: + + @@auto_increment_offset + @@auto_increment_increment +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct thd_autoinc_service_st { + void (*thd_get_autoinc_func)(const MYSQL_THD thd, + unsigned long* off, unsigned long* inc); +} *thd_autoinc_service; + +#ifdef MYSQL_DYNAMIC_PLUGIN +#define thd_get_autoinc(thd, off, inc) \ + (thd_autoinc_service->thd_get_autoinc_func((thd), (off), (inc))) +#else +/** + Return autoincrement system variables + @param IN thd user thread connection handle + @param OUT off the value of @@SESSION.auto_increment_offset + @param OUT inc the value of @@SESSION.auto_increment_increment +*/ +void thd_get_autoinc(const MYSQL_THD thd, + unsigned long* off, unsigned long* inc); +#endif + +#ifdef __cplusplus +} +#endif + +#define MYSQL_SERVICE_THD_AUTOINC_INCLUDED +#endif diff --git a/include/mysql/service_thd_error_context.h b/include/mysql/service_thd_error_context.h new file mode 100644 index 00000000000..7619aa44082 --- /dev/null +++ b/include/mysql/service_thd_error_context.h @@ -0,0 +1,93 @@ +#ifndef MYSQL_SERVICE_THD_STMT_DA_INCLUDED +/* Copyright (C) 2013 MariaDB Foundation. + + 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; version 2 of the License. + + 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/** + @file + This service provides access to the statement diagnostics area: + - error message + - error number + - row for warning (e.g. for multi-row INSERT statements) +*/ + +#ifdef __cplusplus +extern "C" { +#endif + + +extern struct thd_error_context_service_st { + const char *(*thd_get_error_message_func)(const MYSQL_THD thd); + unsigned int (*thd_get_error_number_func)(const MYSQL_THD thd); + unsigned long (*thd_get_error_row_func)(const MYSQL_THD thd); + void (*thd_inc_error_row_func)(MYSQL_THD thd); + char *(*thd_get_error_context_description_func)(MYSQL_THD thd, + char *buffer, + unsigned int length, + unsigned int max_query_length); +} *thd_error_context_service; + +#ifdef MYSQL_DYNAMIC_PLUGIN +#define thd_get_error_message(thd) \ + (thd_error_context_service->thd_get_error_message_func((thd))) +#define thd_get_error_number(thd) \ + (thd_error_context_service->thd_get_error_number_func((thd))) +#define thd_get_error_row(thd) \ + (thd_error_context_service->thd_get_error_row_func((thd))) +#define thd_inc_error_row(thd) \ + (thd_error_context_service->thd_inc_error_row_func((thd))) +#define thd_get_error_context_description(thd, buffer, length, max_query_len) \ + (thd_error_context_service->thd_get_error_context_description_func((thd), \ + (buffer), \ + (length), \ + (max_query_len))) +#else +/** + Return error message + @param thd user thread connection handle + @return error text +*/ +const char *thd_get_error_message(const MYSQL_THD thd); +/** + Return error number + @param thd user thread connection handle + @return error number +*/ +unsigned int thd_get_error_number(const MYSQL_THD thd); +/** + Return the current row number (i.e. in a multiple INSERT statement) + @param thd user thread connection handle + @return row number +*/ +unsigned long thd_get_error_row(const MYSQL_THD thd); +/** + Increment the current row number + @param thd user thread connection handle +*/ +void thd_inc_error_row(MYSQL_THD thd); +/** + Return a text description of a thread, its security context (user,host) + and the current query. +*/ +char *thd_get_error_context_description(MYSQL_THD thd, + char *buffer, unsigned int length, + unsigned int max_query_length); +#endif + +#ifdef __cplusplus +} +#endif + +#define MYSQL_SERVICE_THD_STMT_DA_INCLUDED +#endif diff --git a/include/mysql/services.h b/include/mysql/services.h index 8c3adf08407..62cac338703 100644 --- a/include/mysql/services.h +++ b/include/mysql/services.h @@ -28,6 +28,8 @@ extern "C" { #include <mysql/service_thd_timezone.h> #include <mysql/service_sha1.h> #include <mysql/service_logger.h> +#include <mysql/service_thd_autoinc.h> +#include <mysql/service_thd_error_context.h> #ifdef __cplusplus } diff --git a/include/service_versions.h b/include/service_versions.h index eaefe8f3521..cca190b811c 100644 --- a/include/service_versions.h +++ b/include/service_versions.h @@ -30,4 +30,5 @@ #define VERSION_thd_timezone 0x0100 #define VERSION_my_sha1 0x0100 #define VERSION_logger 0x0100 - +#define VERSION_thd_autoinc 0x0100 +#define VERSION_thd_error_context 0x0100 diff --git a/libservices/CMakeLists.txt b/libservices/CMakeLists.txt index ff8a16b774b..d70a98802f5 100644 --- a/libservices/CMakeLists.txt +++ b/libservices/CMakeLists.txt @@ -20,6 +20,8 @@ SET(MYSQLSERVICES_SOURCES thd_alloc_service.c thd_wait_service.c thd_timezone_service.c + thd_autoinc_service.c + thd_error_context_service.c progress_report_service.c debug_sync_service.c my_sha1_service.c diff --git a/libservices/thd_autoinc_service.c b/libservices/thd_autoinc_service.c new file mode 100644 index 00000000000..cb859a70e55 --- /dev/null +++ b/libservices/thd_autoinc_service.c @@ -0,0 +1,18 @@ +/* Copyright (C) 2013 MariaDB Foundation + Use is subject to license terms. + + 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; version 2 of the License. + + 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +#include <service_versions.h> +SERVICE_VERSION thd_autoinc_service= (void *) VERSION_thd_autoinc; diff --git a/libservices/thd_error_context_service.c b/libservices/thd_error_context_service.c new file mode 100644 index 00000000000..80eb6263b52 --- /dev/null +++ b/libservices/thd_error_context_service.c @@ -0,0 +1,18 @@ +/* Copyright (C) 2013 MariaDB Foundation + Use is subject to license terms. + + 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; version 2 of the License. + + 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +#include <service_versions.h> +SERVICE_VERSION thd_error_context_service= (void *) VERSION_thd_error_context; diff --git a/mysql-test/r/handlersocket.result b/mysql-test/r/handlersocket.result index e1fbc2d9840..b519e2e7c93 100644 --- a/mysql-test/r/handlersocket.result +++ b/mysql-test/r/handlersocket.result @@ -5,7 +5,7 @@ plugin_version 1.0 plugin_status ACTIVE plugin_type DAEMON plugin_library handlersocket.so -plugin_library_version 1.7 +plugin_library_version 1.8 plugin_author higuchi dot akira at dena dot jp plugin_description Direct access into InnoDB plugin_license BSD diff --git a/mysql-test/r/plugin.result b/mysql-test/r/plugin.result index 4075d551b1a..d304f094987 100644 --- a/mysql-test/r/plugin.result +++ b/mysql-test/r/plugin.result @@ -15,7 +15,7 @@ PLUGIN_STATUS ACTIVE PLUGIN_TYPE STORAGE ENGINE PLUGIN_TYPE_VERSION # PLUGIN_LIBRARY ha_example.so -PLUGIN_LIBRARY_VERSION 1.7 +PLUGIN_LIBRARY_VERSION 1.8 PLUGIN_AUTHOR Brian Aker, MySQL AB PLUGIN_DESCRIPTION Example storage engine PLUGIN_LICENSE GPL @@ -28,7 +28,7 @@ PLUGIN_STATUS ACTIVE PLUGIN_TYPE DAEMON PLUGIN_TYPE_VERSION # PLUGIN_LIBRARY ha_example.so -PLUGIN_LIBRARY_VERSION 1.7 +PLUGIN_LIBRARY_VERSION 1.8 PLUGIN_AUTHOR Sergei Golubchik PLUGIN_DESCRIPTION Unusable Daemon PLUGIN_LICENSE GPL @@ -62,7 +62,7 @@ PLUGIN_STATUS DELETED PLUGIN_TYPE STORAGE ENGINE PLUGIN_TYPE_VERSION # PLUGIN_LIBRARY ha_example.so -PLUGIN_LIBRARY_VERSION 1.7 +PLUGIN_LIBRARY_VERSION 1.8 PLUGIN_AUTHOR Brian Aker, MySQL AB PLUGIN_DESCRIPTION Example storage engine PLUGIN_LICENSE GPL diff --git a/mysql-test/suite/plugins/r/show_all_plugins.result b/mysql-test/suite/plugins/r/show_all_plugins.result index 0df0d6455a7..854eb339ce0 100644 --- a/mysql-test/suite/plugins/r/show_all_plugins.result +++ b/mysql-test/suite/plugins/r/show_all_plugins.result @@ -4,8 +4,8 @@ Variable_name Value Opened_plugin_libraries 0 select * from information_schema.all_plugins where plugin_library='ha_example.so'; PLUGIN_NAME PLUGIN_VERSION PLUGIN_STATUS PLUGIN_TYPE PLUGIN_TYPE_VERSION PLUGIN_LIBRARY PLUGIN_LIBRARY_VERSION PLUGIN_AUTHOR PLUGIN_DESCRIPTION PLUGIN_LICENSE LOAD_OPTION PLUGIN_MATURITY PLUGIN_AUTH_VERSION -EXAMPLE 0.1 NOT INSTALLED STORAGE ENGINE MYSQL_VERSION_ID ha_example.so 1.7 Brian Aker, MySQL AB Example storage engine GPL OFF Experimental 0.1 -UNUSABLE 3.14 NOT INSTALLED DAEMON MYSQL_VERSION_ID ha_example.so 1.7 Sergei Golubchik Unusable Daemon GPL OFF Experimental 3.14.15.926 +EXAMPLE 0.1 NOT INSTALLED STORAGE ENGINE MYSQL_VERSION_ID ha_example.so 1.8 Brian Aker, MySQL AB Example storage engine GPL OFF Experimental 0.1 +UNUSABLE 3.14 NOT INSTALLED DAEMON MYSQL_VERSION_ID ha_example.so 1.8 Sergei Golubchik Unusable Daemon GPL OFF Experimental 3.14.15.926 show status like '%libraries%'; Variable_name Value Opened_plugin_libraries 1 diff --git a/sql/sql_class.cc b/sql/sql_class.cc index d1fa138f33c..25f07ea9574 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -694,10 +694,29 @@ int thd_tx_is_read_only(const THD *thd) return (int) thd->tx_read_only; } + extern "C" -void thd_inc_row_count(THD *thd) -{ - thd->get_stmt_da()->inc_current_row_for_warning(); +{ /* Functions for thd_error_context_service */ + + const char *thd_get_error_message(const THD *thd) + { + return thd->get_stmt_da()->message(); + } + + uint thd_get_error_number(const THD *thd) + { + return thd->get_stmt_da()->sql_errno(); + } + + ulong thd_get_error_row(const THD *thd) + { + return thd->get_stmt_da()->current_row_for_warning(); + } + + void thd_inc_error_row(THD *thd) + { + thd->get_stmt_da()->inc_current_row_for_warning(); + } } @@ -720,8 +739,9 @@ void thd_inc_row_count(THD *thd) */ extern "C" -char *thd_security_context(THD *thd, char *buffer, unsigned int length, - unsigned int max_query_len) +char *thd_get_error_context_description(THD *thd, char *buffer, + unsigned int length, + unsigned int max_query_len) { String str(buffer, length, &my_charset_latin1); const Security_context *sctx= &thd->main_security_ctx; @@ -799,6 +819,21 @@ char *thd_security_context(THD *thd, char *buffer, unsigned int length, } +#if MARIA_PLUGIN_INTERFACE_VERSION < 0x0200 +/** + TODO: This function is for API compatibility, remove it eventually. + All engines should switch to use thd_get_error_context_description() + plugin service function. +*/ +extern "C" +char *thd_security_context(THD *thd, + char *buffer, unsigned int length, + unsigned int max_query_len) +{ + return thd_get_error_context_description(thd, buffer, length, max_query_len); +} +#endif + /** Implementation of Drop_table_error_handler::handle_condition(). The reason in having this implementation is to silence technical low-level @@ -4241,6 +4276,7 @@ extern "C" enum durability_properties thd_get_durability_property(const MYSQL_TH } /** Get the auto_increment_offset auto_increment_increment. +Exposed by thd_autoinc_service. Needed by InnoDB. @param thd Thread object @param off auto_increment_offset diff --git a/sql/sql_plugin_services.h b/sql/sql_plugin_services.h index 362252eee8a..38b4c4074be 100644 --- a/sql/sql_plugin_services.h +++ b/sql/sql_plugin_services.h @@ -74,6 +74,18 @@ static struct logger_service_st logger_service_handler= { logger_rotate }; +static struct thd_autoinc_service_st thd_autoinc_handler= { + thd_get_autoinc +}; + +static struct thd_error_context_service_st thd_error_conext_handler= { + thd_get_error_message, + thd_get_error_number, + thd_get_error_row, + thd_inc_error_row, + thd_get_error_context_description +}; + static struct st_service_ref list_of_services[]= { { "my_snprintf_service", VERSION_my_snprintf, &my_snprintf_handler }, @@ -85,5 +97,7 @@ static struct st_service_ref list_of_services[]= { "thd_timezone_service", VERSION_thd_timezone, &thd_timezone_handler }, { "my_sha1_service", VERSION_my_sha1, &my_sha1_handler}, { "logger_service", VERSION_logger, &logger_service_handler }, + { "thd_autoinc_service", VERSION_thd_autoinc, &thd_autoinc_handler }, + { "thd_error_context_service", VERSION_thd_error_context, &thd_error_conext_handler }, }; diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index b49cb3fc5ab..c5e53cb7354 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -1500,7 +1500,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt) /* Read the file row-by-row. If everything is ok, repair is not needed. */ while (!(rc= find_current_row(buf))) { - thd_inc_row_count(thd); + thd_inc_error_row(thd); rows_repaired++; current_position= next_position; } @@ -1714,7 +1714,7 @@ int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt) /* Read the file row-by-row. If everything is ok, repair is not needed. */ while (!(rc= find_current_row(buf))) { - thd_inc_row_count(thd); + thd_inc_error_row(thd); count--; current_position= next_position; } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 82421d2d725..cf4617d9e5b 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1519,8 +1519,8 @@ innobase_mysql_print_thd( { char buffer[1024]; - fputs(thd_security_context(thd, buffer, sizeof buffer, - max_query_len), f); + fputs(thd_get_error_context_description(thd, buffer, sizeof buffer, + max_query_len), f); putc('\n', f); } diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index ece9f7cf58a..1fb071f5765 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -434,13 +434,6 @@ bool thd_sqlcom_can_generate_row_events(const MYSQL_THD thd); */ enum durability_properties thd_get_durability_property(const MYSQL_THD thd); -/** Get the auto_increment_offset auto_increment_increment. -@param thd Thread object -@param off auto_increment_offset -@param inc auto_increment_increment */ -void thd_get_autoinc(const MYSQL_THD thd, ulong* off, ulong* inc) -__attribute__((nonnull)); - /** Is strict sql_mode set. @param thd Thread object @return True if sql_mode has strict mode (all or trans), false otherwise. diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 158ab7fb898..6bedc5c07aa 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -646,8 +646,10 @@ void _mi_report_crashed(MI_INFO *file, const char *message, for (element= file->s->in_use; element; element= list_rest(element)) { THD *thd= (THD*) element->data; - sql_print_error("%s", thd ? thd_security_context(thd, buf, sizeof(buf), 0) - : "Unknown thread accessing table"); + sql_print_error("%s", + thd ? + thd_get_error_context_description(thd, buf, sizeof(buf), 0) + : "Unknown thread accessing table"); } mysql_mutex_unlock(&file->s->intern_lock); } diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index aafaf7f51db..6138debf1a3 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -60,8 +60,8 @@ #endif #if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100004 -#define spider_stmt_da_message(A) (A)->get_stmt_da()->message() -#define spider_stmt_da_sql_errno(A) (A)->get_stmt_da()->sql_errno() +#define spider_stmt_da_message(A) thd_get_error_message(A) +#define spider_stmt_da_sql_errno(A) thd_get_error_number(A) #define spider_user_defined_key_parts(A) (A)->user_defined_key_parts #define SPIDER_CAN_BG_UPDATE (1LL << 39) #define SPIDER_ALTER_ADD_PARTITION Alter_info::ALTER_ADD_PARTITION diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index f4dedea8a2d..1b49b9a90e5 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -1338,8 +1338,9 @@ innobase_mysql_print_thd( { char buffer[1024]; - fputs(thd_security_context((THD*) thd, buffer, sizeof buffer, - max_query_len), f); + fputs(thd_get_error_context_description((THD*) thd, + buffer, sizeof buffer, + max_query_len), f); putc('\n', f); } |