mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MroongaSE: addint thd_autoinc and thd_error_context plugin services
This commit is contained in:
parent
67f514382b
commit
1345a75922
22 changed files with 345 additions and 36 deletions
|
@ -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.
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
53
include/mysql/service_thd_autoinc.h
Normal file
53
include/mysql/service_thd_autoinc.h
Normal file
|
@ -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
|
93
include/mysql/service_thd_error_context.h
Normal file
93
include/mysql/service_thd_error_context.h
Normal file
|
@ -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
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
18
libservices/thd_autoinc_service.c
Normal file
18
libservices/thd_autoinc_service.c
Normal file
|
@ -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;
|
18
libservices/thd_error_context_service.c
Normal file
18
libservices/thd_error_context_service.c
Normal file
|
@ -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;
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 },
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue