diff options
author | Kentoku <kentokushiba@gmail.com> | 2019-01-30 03:29:37 +0900 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2019-01-31 08:51:34 +0100 |
commit | 4e599c74bb673e6d752bdacffbe014cbfd033b0a (patch) | |
tree | 33e764ad0b9151b258f69e6214e4daba621c3a51 /storage/spider | |
parent | 470c1b8d564bdc3574376d2c50a0dac783c5b3da (diff) | |
download | mariadb-git-4e599c74bb673e6d752bdacffbe014cbfd033b0a.tar.gz |
MDEV-18313 Supports 'wrapper mariadb' for connection information
Diffstat (limited to 'storage/spider')
-rw-r--r-- | storage/spider/CMakeLists.txt | 2 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/bugfix/include/wrapper_mariadb_deinit.inc | 11 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/bugfix/include/wrapper_mariadb_init.inc | 24 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/bugfix/r/wrapper_mariadb.result | 78 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.cnf | 3 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.test | 69 | ||||
-rw-r--r-- | storage/spider/spd_db_handlersocket.cc | 7 | ||||
-rw-r--r-- | storage/spider/spd_db_include.cc | 51 | ||||
-rw-r--r-- | storage/spider/spd_db_include.h | 23 | ||||
-rw-r--r-- | storage/spider/spd_db_mysql.cc | 2067 | ||||
-rw-r--r-- | storage/spider/spd_db_mysql.h | 196 | ||||
-rw-r--r-- | storage/spider/spd_db_oracle.cc | 9 | ||||
-rw-r--r-- | storage/spider/spd_table.cc | 8 |
13 files changed, 1616 insertions, 932 deletions
diff --git a/storage/spider/CMakeLists.txt b/storage/spider/CMakeLists.txt index 21278dde3b3..62dfc968579 100644 --- a/storage/spider/CMakeLists.txt +++ b/storage/spider/CMakeLists.txt @@ -18,7 +18,7 @@ SET(SPIDER_SOURCES spd_table.cc spd_direct_sql.cc spd_udf.cc spd_ping_table.cc spd_copy_tables.cc spd_i_s.cc spd_malloc.cc ha_spider.cc spd_udf.def spd_db_mysql.cc spd_db_handlersocket.cc spd_db_oracle.cc - spd_group_by_handler.cc + spd_group_by_handler.cc spd_db_include.cc hs_client/config.cpp hs_client/escape.cpp hs_client/fatal.cpp hs_client/hstcpcli.cpp hs_client/socket.cpp hs_client/string_util.cpp ) diff --git a/storage/spider/mysql-test/spider/bugfix/include/wrapper_mariadb_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/wrapper_mariadb_deinit.inc new file mode 100644 index 00000000000..76b7582abfe --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/wrapper_mariadb_deinit.inc @@ -0,0 +1,11 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/include/wrapper_mariadb_init.inc b/storage/spider/mysql-test/spider/bugfix/include/wrapper_mariadb_init.inc new file mode 100644 index 00000000000..df3d44c39bc --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/wrapper_mariadb_init.inc @@ -0,0 +1,24 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a", srv "s_2_1", wrapper "mariadb"'; +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT pkey FROM tbl_a ORDER BY pkey; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; diff --git a/storage/spider/mysql-test/spider/bugfix/r/wrapper_mariadb.result b/storage/spider/mysql-test/spider/bugfix/r/wrapper_mariadb.result new file mode 100644 index 00000000000..7c01421fa13 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/wrapper_mariadb.result @@ -0,0 +1,78 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +this test is for MDEV-18313 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +select test +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +SELECT * FROM tbl_a ORDER BY pkey; +pkey +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; +argument +select t0.`pkey` `pkey` from `auto_test_remote`.`tbl_a` t0 order by `pkey` +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' +SELECT pkey FROM tbl_a ORDER BY pkey; +pkey +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.cnf b/storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.cnf new file mode 100644 index 00000000000..05dfd8a0bce --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.cnf @@ -0,0 +1,3 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.test b/storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.test new file mode 100644 index 00000000000..0102155b5ab --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.test @@ -0,0 +1,69 @@ +--source ../include/wrapper_mariadb_init.inc +--echo +--echo this test is for MDEV-18313 +--echo +--echo drop and create databases + +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +--echo +--echo select test + +--connection child2_1 +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +SELECT * FROM tbl_a ORDER BY pkey; + +--connection child2_1 +eval $CHILD2_1_SELECT_ARGUMENT1; +eval $CHILD2_1_SELECT_TABLES; + +--echo +--echo deinit +--disable_warnings + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings +--source ../include/wrapper_mariadb_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/spd_db_handlersocket.cc b/storage/spider/spd_db_handlersocket.cc index 4aebc7811b4..37bbe530723 100644 --- a/storage/spider/spd_db_handlersocket.cc +++ b/storage/spider/spd_db_handlersocket.cc @@ -500,7 +500,7 @@ SPIDER_DB_ROW *spider_db_handlersocket_row::clone() uint i; DBUG_ENTER("spider_db_handlersocket_row::clone"); DBUG_PRINT("info",("spider this=%p", this)); - if (!(clone_row = new spider_db_handlersocket_row())) + if (!(clone_row = new spider_db_handlersocket_row(dbton_id))) { DBUG_RETURN(NULL); } @@ -603,7 +603,7 @@ bool spider_db_handlersocket_result_buffer::check_size( spider_db_handlersocket_result::spider_db_handlersocket_result( SPIDER_DB_CONN *in_db_conn -) : spider_db_result(in_db_conn, spider_dbton_handlersocket.dbton_id) +) : spider_db_result(in_db_conn), row(in_db_conn->dbton_id) { DBUG_ENTER("spider_db_handlersocket_result::spider_db_handlersocket_result"); DBUG_PRINT("info",("spider this=%p", this)); @@ -3953,7 +3953,8 @@ int spider_db_handlersocket_util::append_having( spider_handlersocket_share::spider_handlersocket_share( st_spider_share *share ) : spider_db_share( - share + share, + spider_dbton_handlersocket.dbton_id ), table_names_str(NULL), db_names_str(NULL), diff --git a/storage/spider/spd_db_include.cc b/storage/spider/spd_db_include.cc new file mode 100644 index 00000000000..2910aa97690 --- /dev/null +++ b/storage/spider/spd_db_include.cc @@ -0,0 +1,51 @@ +/* Copyright (C) 2018-2019 Kentoku Shiba + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#define MYSQL_SERVER 1 +#include <my_global.h> +#include "mysql_version.h" +#include "spd_environ.h" +#if MYSQL_VERSION_ID < 50500 +#include "mysql_priv.h" +#include <mysql/plugin.h> +#else +#include "sql_priv.h" +#include "probes_mysql.h" +#include "sql_class.h" +#endif +#include "sql_common.h" +#include <mysql.h> +#include <errmsg.h> +#include "spd_err.h" +#include "spd_db_include.h" +#include "spd_include.h" + +spider_db_result::spider_db_result( + SPIDER_DB_CONN *in_db_conn +) : db_conn(in_db_conn), dbton_id(in_db_conn->dbton_id) +{ + DBUG_ENTER("spider_db_result::spider_db_result"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_db_conn::spider_db_conn( + SPIDER_CONN *in_conn +) : conn(in_conn), dbton_id(in_conn->dbton_id) +{ + DBUG_ENTER("spider_db_conn::spider_db_conn"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index cc4d2bcd3a1..64cee006c65 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -21,6 +21,7 @@ #define SPIDER_DBTON_SIZE 15 #define SPIDER_DB_WRAPPER_MYSQL "mysql" +#define SPIDER_DB_WRAPPER_MARIADB "mariadb" #if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100204 #define PLUGIN_VAR_CAN_MEMALLOC @@ -795,6 +796,7 @@ struct st_spider_db_request_key class spider_db_util { public: + uint dbton_id; spider_db_util() {} virtual ~spider_db_util() {} virtual int append_name( @@ -961,8 +963,7 @@ protected: SPIDER_DB_CONN *db_conn; public: uint dbton_id; - spider_db_result(SPIDER_DB_CONN *in_db_conn, uint in_dbton_id) : - db_conn(in_db_conn), dbton_id(in_dbton_id) {} + spider_db_result(SPIDER_DB_CONN *in_db_conn); virtual ~spider_db_result() {} virtual bool has_result() = 0; virtual void free_result() = 0; @@ -1028,9 +1029,10 @@ class spider_db_conn protected: SPIDER_CONN *conn; public: + uint dbton_id; spider_db_conn( - SPIDER_CONN *conn - ) : conn(conn) {} + SPIDER_CONN *in_conn + ); virtual ~spider_db_conn() {} virtual int init() = 0; virtual bool is_connected() = 0; @@ -1229,8 +1231,12 @@ protected: const char *mem_calc_file_name; ulong mem_calc_line_no; public: + uint dbton_id; st_spider_share *spider_share; - spider_db_share(st_spider_share *share) : spider_share(share) {} + spider_db_share( + st_spider_share *share, + uint dbton_id + ) : dbton_id(dbton_id), spider_share(share) {} virtual ~spider_db_share() {} virtual int init() = 0; virtual uint get_column_name_length( @@ -1264,6 +1270,7 @@ protected: const char *mem_calc_file_name; ulong mem_calc_line_no; public: + uint dbton_id; ha_spider *spider; spider_db_share *db_share; int first_link_idx; @@ -1271,7 +1278,8 @@ public: SPIDER_LINK_IDX_CHAIN *link_idx_chain; #endif spider_db_handler(ha_spider *spider, spider_db_share *db_share) : - spider(spider), db_share(db_share), first_link_idx(-1) {} + dbton_id(db_share->dbton_id), spider(spider), db_share(db_share), + first_link_idx(-1) {} virtual ~spider_db_handler() {} virtual int init() = 0; virtual int append_index_hint( @@ -1750,9 +1758,10 @@ public: class spider_db_copy_table { public: + uint dbton_id; spider_db_share *db_share; spider_db_copy_table(spider_db_share *db_share) : - db_share(db_share) {} + dbton_id(db_share->dbton_id), db_share(db_share) {} virtual ~spider_db_copy_table() {} virtual int init() = 0; virtual void set_sql_charset( diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index ceb38f886aa..262e47120ce 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -57,6 +57,9 @@ extern HASH spider_ipport_conns; extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE]; extern const char spider_dig_upper[]; +spider_db_mysql_util spider_db_mysql_utility; +spider_db_mariadb_util spider_db_mariadb_utility; + #define SPIDER_SQL_NAME_QUOTE_STR "`" #define SPIDER_SQL_NAME_QUOTE_LEN (sizeof(SPIDER_SQL_NAME_QUOTE_STR) - 1) static const char *name_quote_str = SPIDER_SQL_NAME_QUOTE_STR; @@ -197,12 +200,24 @@ int spider_mysql_init() DBUG_RETURN(0); } +int spider_mariadb_init() +{ + DBUG_ENTER("spider_mariadb_init"); + DBUG_RETURN(0); +} + int spider_mysql_deinit() { DBUG_ENTER("spider_mysql_deinit"); DBUG_RETURN(0); } +int spider_mariadb_deinit() +{ + DBUG_ENTER("spider_mariadb_deinit"); + DBUG_RETURN(0); +} + spider_db_share *spider_mysql_create_share( SPIDER_SHARE *share ) { @@ -210,13 +225,29 @@ spider_db_share *spider_mysql_create_share( DBUG_RETURN(new spider_mysql_share(share)); } +spider_db_share *spider_mariadb_create_share( + SPIDER_SHARE *share +) { + DBUG_ENTER("spider_mariadb_create_share"); + DBUG_RETURN(new spider_mariadb_share(share)); +} + spider_db_handler *spider_mysql_create_handler( ha_spider *spider, spider_db_share *db_share ) { DBUG_ENTER("spider_mysql_create_handler"); DBUG_RETURN(new spider_mysql_handler(spider, - (spider_mysql_share *) db_share)); + (spider_mbase_share *) db_share)); +} + +spider_db_handler *spider_mariadb_create_handler( + ha_spider *spider, + spider_db_share *db_share +) { + DBUG_ENTER("spider_mariadb_create_handler"); + DBUG_RETURN(new spider_mariadb_handler(spider, + (spider_mbase_share *) db_share)); } spider_db_copy_table *spider_mysql_create_copy_table( @@ -224,7 +255,15 @@ spider_db_copy_table *spider_mysql_create_copy_table( ) { DBUG_ENTER("spider_mysql_create_copy_table"); DBUG_RETURN(new spider_mysql_copy_table( - (spider_mysql_share *) db_share)); + (spider_mbase_share *) db_share)); +} + +spider_db_copy_table *spider_mariadb_create_copy_table( + spider_db_share *db_share +) { + DBUG_ENTER("spider_mariadb_create_copy_table"); + DBUG_RETURN(new spider_mariadb_copy_table( + (spider_mbase_share *) db_share)); } SPIDER_DB_CONN *spider_mysql_create_conn( @@ -234,13 +273,24 @@ SPIDER_DB_CONN *spider_mysql_create_conn( DBUG_RETURN(new spider_db_mysql(conn)); } +SPIDER_DB_CONN *spider_mariadb_create_conn( + SPIDER_CONN *conn +) { + DBUG_ENTER("spider_mariadb_create_conn"); + DBUG_RETURN(new spider_db_mariadb(conn)); +} + bool spider_mysql_support_direct_join( ) { DBUG_ENTER("spider_mysql_support_direct_join"); DBUG_RETURN(TRUE); } -spider_db_mysql_util spider_db_mysql_utility; +bool spider_mariadb_support_direct_join( +) { + DBUG_ENTER("spider_mariadb_support_direct_join"); + DBUG_RETURN(TRUE); +} SPIDER_DBTON spider_dbton_mysql = { 0, @@ -256,18 +306,49 @@ SPIDER_DBTON spider_dbton_mysql = { &spider_db_mysql_utility }; -spider_db_mysql_row::spider_db_mysql_row() : - spider_db_row(spider_dbton_mysql.dbton_id), +SPIDER_DBTON spider_dbton_mariadb = { + 0, + SPIDER_DB_WRAPPER_MARIADB, + SPIDER_DB_ACCESS_TYPE_SQL, + spider_mariadb_init, + spider_mariadb_deinit, + spider_mariadb_create_share, + spider_mariadb_create_handler, + spider_mariadb_create_copy_table, + spider_mariadb_create_conn, + spider_mariadb_support_direct_join, + &spider_db_mariadb_utility +}; + +spider_db_mbase_row::spider_db_mbase_row( + uint dbton_id +) : spider_db_row(dbton_id), row(NULL), lengths(NULL), cloned(FALSE) { + DBUG_ENTER("spider_db_mbase_row::spider_db_mbase_row"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_db_mysql_row::spider_db_mysql_row() : + spider_db_mbase_row(spider_db_mysql_utility.dbton_id) +{ DBUG_ENTER("spider_db_mysql_row::spider_db_mysql_row"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_VOID_RETURN; } -spider_db_mysql_row::~spider_db_mysql_row() +spider_db_mariadb_row::spider_db_mariadb_row() : + spider_db_mbase_row(spider_db_mariadb_utility.dbton_id) { - DBUG_ENTER("spider_db_mysql_row::~spider_db_mysql_row"); + DBUG_ENTER("spider_db_mariadb_row::spider_db_mariadb_row"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_db_mbase_row::~spider_db_mbase_row() +{ + DBUG_ENTER("spider_db_mbase_row::~spider_db_mbase_row"); DBUG_PRINT("info",("spider this=%p", this)); if (cloned) { @@ -276,11 +357,25 @@ spider_db_mysql_row::~spider_db_mysql_row() DBUG_VOID_RETURN; } -int spider_db_mysql_row::store_to_field( +spider_db_mysql_row::~spider_db_mysql_row() +{ + DBUG_ENTER("spider_db_mysql_row::~spider_db_mysql_row"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_db_mariadb_row::~spider_db_mariadb_row() +{ + DBUG_ENTER("spider_db_mariadb_row::~spider_db_mariadb_row"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +int spider_db_mbase_row::store_to_field( Field *field, CHARSET_INFO *access_charset ) { - DBUG_ENTER("spider_db_mysql_row::store_to_field"); + DBUG_ENTER("spider_db_mbase_row::store_to_field"); DBUG_PRINT("info",("spider this=%p", this)); if (!*row) { @@ -317,10 +412,10 @@ int spider_db_mysql_row::store_to_field( DBUG_RETURN(0); } -int spider_db_mysql_row::append_to_str( +int spider_db_mbase_row::append_to_str( spider_string *str ) { - DBUG_ENTER("spider_db_mysql_row::append_to_str"); + DBUG_ENTER("spider_db_mbase_row::append_to_str"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(*lengths)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -328,11 +423,11 @@ int spider_db_mysql_row::append_to_str( DBUG_RETURN(0); } -int spider_db_mysql_row::append_escaped_to_str( +int spider_db_mbase_row::append_escaped_to_str( spider_string *str, uint dbton_id ) { - DBUG_ENTER("spider_db_mysql_row::append_escaped_to_str"); + DBUG_ENTER("spider_db_mbase_row::append_escaped_to_str"); DBUG_PRINT("info",("spider this=%p", this)); spider_string tmp_str(*row, *lengths + 1, str->charset()); tmp_str.init_calc_mem(133); @@ -343,50 +438,50 @@ int spider_db_mysql_row::append_escaped_to_str( DBUG_RETURN(0); } -void spider_db_mysql_row::first() +void spider_db_mbase_row::first() { - DBUG_ENTER("spider_db_mysql_row::first"); + DBUG_ENTER("spider_db_mbase_row::first"); DBUG_PRINT("info",("spider this=%p", this)); row = row_first; lengths = lengths_first; DBUG_VOID_RETURN; } -void spider_db_mysql_row::next() +void spider_db_mbase_row::next() { - DBUG_ENTER("spider_db_mysql_row::next"); + DBUG_ENTER("spider_db_mbase_row::next"); DBUG_PRINT("info",("spider this=%p", this)); row++; lengths++; DBUG_VOID_RETURN; } -bool spider_db_mysql_row::is_null() +bool spider_db_mbase_row::is_null() { - DBUG_ENTER("spider_db_mysql_row::is_null"); + DBUG_ENTER("spider_db_mbase_row::is_null"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(!(*row)); } -int spider_db_mysql_row::val_int() +int spider_db_mbase_row::val_int() { - DBUG_ENTER("spider_db_mysql_row::val_int"); + DBUG_ENTER("spider_db_mbase_row::val_int"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(*row ? atoi(*row) : 0); } -double spider_db_mysql_row::val_real() +double spider_db_mbase_row::val_real() { - DBUG_ENTER("spider_db_mysql_row::val_real"); + DBUG_ENTER("spider_db_mbase_row::val_real"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(*row ? my_atof(*row) : 0.0); } -my_decimal *spider_db_mysql_row::val_decimal( +my_decimal *spider_db_mbase_row::val_decimal( my_decimal *decimal_value, CHARSET_INFO *access_charset ) { - DBUG_ENTER("spider_db_mysql_row::val_decimal"); + DBUG_ENTER("spider_db_mbase_row::val_decimal"); DBUG_PRINT("info",("spider this=%p", this)); if (!*row) DBUG_RETURN(NULL); @@ -402,16 +497,16 @@ my_decimal *spider_db_mysql_row::val_decimal( DBUG_RETURN(decimal_value); } -SPIDER_DB_ROW *spider_db_mysql_row::clone() +SPIDER_DB_ROW *spider_db_mbase_row::clone() { - spider_db_mysql_row *clone_row; + spider_db_mbase_row *clone_row; char *tmp_char; MYSQL_ROW tmp_row = row_first, ctmp_row; ulong *tmp_lengths = lengths_first; uint row_size, i; - DBUG_ENTER("spider_db_mysql_row::clone"); + DBUG_ENTER("spider_db_mbase_row::clone"); DBUG_PRINT("info",("spider this=%p", this)); - if (!(clone_row = new spider_db_mysql_row())) + if (!(clone_row = new spider_db_mbase_row(dbton_id))) { DBUG_RETURN(NULL); } @@ -464,14 +559,14 @@ SPIDER_DB_ROW *spider_db_mysql_row::clone() DBUG_RETURN((SPIDER_DB_ROW *) clone_row); } -int spider_db_mysql_row::store_to_tmp_table( +int spider_db_mbase_row::store_to_tmp_table( TABLE *tmp_table, spider_string *str ) { uint i; MYSQL_ROW tmp_row = row; ulong *tmp_lengths = lengths; - DBUG_ENTER("spider_db_mysql_row::store_to_tmp_table"); + DBUG_ENTER("spider_db_mbase_row::store_to_tmp_table"); DBUG_PRINT("info",("spider this=%p", this)); str->length(0); for (i = 0; i < field_count; i++) @@ -500,11 +595,11 @@ int spider_db_mysql_row::store_to_tmp_table( DBUG_RETURN(tmp_table->file->ha_write_row(tmp_table->record[0])); } -uint spider_db_mysql_row::get_byte_size() +uint spider_db_mbase_row::get_byte_size() { ulong *tmp_lengths = lengths_first; uint i; - DBUG_ENTER("spider_db_mysql_row::get_byte_size"); + DBUG_ENTER("spider_db_mbase_row::get_byte_size"); DBUG_PRINT("info",("spider this=%p", this)); if (!record_size) { @@ -517,18 +612,37 @@ uint spider_db_mysql_row::get_byte_size() DBUG_RETURN(record_size); } -spider_db_mysql_result::spider_db_mysql_result(SPIDER_DB_CONN *in_db_conn) : - spider_db_result(in_db_conn, spider_dbton_mysql.dbton_id), - db_result(NULL) +spider_db_mbase_result::spider_db_mbase_result( + SPIDER_DB_CONN *in_db_conn +) : spider_db_result(in_db_conn), + db_result(NULL), row(in_db_conn->dbton_id) +{ + DBUG_ENTER("spider_db_mbase_result::spider_db_mbase_result"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_db_mysql_result::spider_db_mysql_result( + SPIDER_DB_CONN *in_db_conn +) : spider_db_mbase_result(in_db_conn) { DBUG_ENTER("spider_db_mysql_result::spider_db_mysql_result"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_VOID_RETURN; } -spider_db_mysql_result::~spider_db_mysql_result() +spider_db_mariadb_result::spider_db_mariadb_result( + SPIDER_DB_CONN *in_db_conn +) : spider_db_mbase_result(in_db_conn) { - DBUG_ENTER("spider_db_mysql_result::~spider_db_mysql_result"); + DBUG_ENTER("spider_db_mariadb_result::spider_db_mariadb_result"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_db_mbase_result::~spider_db_mbase_result() +{ + DBUG_ENTER("spider_db_mbase_result::~spider_db_mbase_result"); DBUG_PRINT("info",("spider this=%p", this)); if (db_result) { @@ -537,16 +651,30 @@ spider_db_mysql_result::~spider_db_mysql_result() DBUG_VOID_RETURN; } -bool spider_db_mysql_result::has_result() +spider_db_mysql_result::~spider_db_mysql_result() +{ + DBUG_ENTER("spider_db_mysql_result::~spider_db_mysql_result"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_db_mariadb_result::~spider_db_mariadb_result() +{ + DBUG_ENTER("spider_db_mariadb_result::~spider_db_mariadb_result"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +bool spider_db_mbase_result::has_result() { - DBUG_ENTER("spider_db_mysql_result::has_result"); + DBUG_ENTER("spider_db_mbase_result::has_result"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(db_result); } -void spider_db_mysql_result::free_result() +void spider_db_mbase_result::free_result() { - DBUG_ENTER("spider_db_mysql_result::free_result"); + DBUG_ENTER("spider_db_mbase_result::free_result"); DBUG_PRINT("info",("spider this=%p", this)); /* need 2 times execution design */ if (db_result) @@ -557,24 +685,24 @@ void spider_db_mysql_result::free_result() DBUG_VOID_RETURN; } -SPIDER_DB_ROW *spider_db_mysql_result::current_row() +SPIDER_DB_ROW *spider_db_mbase_result::current_row() { - DBUG_ENTER("spider_db_mysql_result::current_row"); + DBUG_ENTER("spider_db_mbase_result::current_row"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN((SPIDER_DB_ROW *) row.clone()); } -SPIDER_DB_ROW *spider_db_mysql_result::fetch_row() +SPIDER_DB_ROW *spider_db_mbase_result::fetch_row() { - DBUG_ENTER("spider_db_mysql_result::fetch_row"); + DBUG_ENTER("spider_db_mbase_result::fetch_row"); DBUG_PRINT("info",("spider this=%p", this)); if (!(row.row = mysql_fetch_row(db_result))) { - if (mysql_errno(((spider_db_mysql *) db_conn)->db_conn)) + if (mysql_errno(((spider_db_mbase *) db_conn)->db_conn)) { - store_error_num = mysql_errno(((spider_db_mysql *) db_conn)->db_conn); + store_error_num = mysql_errno(((spider_db_mbase *) db_conn)->db_conn); my_message(store_error_num, - mysql_error(((spider_db_mysql *) db_conn)->db_conn), MYF(0)); + mysql_error(((spider_db_mbase *) db_conn)->db_conn), MYF(0)); } else store_error_num = HA_ERR_END_OF_FILE; DBUG_RETURN(NULL); @@ -587,18 +715,18 @@ SPIDER_DB_ROW *spider_db_mysql_result::fetch_row() DBUG_RETURN((SPIDER_DB_ROW *) &row); } -SPIDER_DB_ROW *spider_db_mysql_result::fetch_row_from_result_buffer( +SPIDER_DB_ROW *spider_db_mbase_result::fetch_row_from_result_buffer( spider_db_result_buffer *spider_res_buf ) { - DBUG_ENTER("spider_db_mysql_result::fetch_row_from_result_buffer"); + DBUG_ENTER("spider_db_mbase_result::fetch_row_from_result_buffer"); DBUG_PRINT("info",("spider this=%p", this)); if (!(row.row = mysql_fetch_row(db_result))) { - if (mysql_errno(((spider_db_mysql *) db_conn)->db_conn)) + if (mysql_errno(((spider_db_mbase *) db_conn)->db_conn)) { - store_error_num = mysql_errno(((spider_db_mysql *) db_conn)->db_conn); + store_error_num = mysql_errno(((spider_db_mbase *) db_conn)->db_conn); my_message(store_error_num, - mysql_error(((spider_db_mysql *) db_conn)->db_conn), MYF(0)); + mysql_error(((spider_db_mbase *) db_conn)->db_conn), MYF(0)); } else store_error_num = HA_ERR_END_OF_FILE; DBUG_RETURN(NULL); @@ -611,7 +739,7 @@ SPIDER_DB_ROW *spider_db_mysql_result::fetch_row_from_result_buffer( DBUG_RETURN((SPIDER_DB_ROW *) &row); } -SPIDER_DB_ROW *spider_db_mysql_result::fetch_row_from_tmp_table( +SPIDER_DB_ROW *spider_db_mbase_result::fetch_row_from_tmp_table( TABLE *tmp_table ) { uint i; @@ -620,7 +748,7 @@ SPIDER_DB_ROW *spider_db_mysql_result::fetch_row_from_tmp_table( MYSQL_ROW tmp_row; ulong *tmp_lengths; uint field_count; - DBUG_ENTER("spider_db_mysql_result::fetch_row_from_tmp_table"); + DBUG_ENTER("spider_db_mbase_result::fetch_row_from_tmp_table"); DBUG_PRINT("info",("spider this=%p", this)); tmp_str1.init_calc_mem(117); tmp_str2.init_calc_mem(118); @@ -654,7 +782,7 @@ SPIDER_DB_ROW *spider_db_mysql_result::fetch_row_from_tmp_table( DBUG_RETURN((SPIDER_DB_ROW *) &row); } -int spider_db_mysql_result::fetch_table_status( +int spider_db_mbase_result::fetch_table_status( int mode, ha_rows &records, ulong &mean_rec_length, @@ -680,15 +808,15 @@ int spider_db_mysql_result::fetch_table_status( int time_status; #endif long not_used_long; - DBUG_ENTER("spider_db_mysql_result::fetch_table_status"); + DBUG_ENTER("spider_db_mbase_result::fetch_table_status"); DBUG_PRINT("info",("spider this=%p", this)); if (!(mysql_row = mysql_fetch_row(db_result))) { DBUG_PRINT("info",("spider fetch row is null")); - if ((error_num = mysql_errno(((spider_db_mysql *) db_conn)->db_conn))) + if ((error_num = mysql_errno(((spider_db_mbase *) db_conn)->db_conn))) { my_message(error_num, - mysql_error(((spider_db_mysql *) db_conn)->db_conn), MYF(0)); + mysql_error(((spider_db_mbase *) db_conn)->db_conn), MYF(0)); DBUG_RETURN(error_num); } DBUG_RETURN(ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM); @@ -941,21 +1069,21 @@ int spider_db_mysql_result::fetch_table_status( DBUG_RETURN(0); } -int spider_db_mysql_result::fetch_table_records( +int spider_db_mbase_result::fetch_table_records( int mode, ha_rows &records ) { int error_num; MYSQL_ROW mysql_row; - DBUG_ENTER("spider_db_mysql_result::fetch_table_records"); + DBUG_ENTER("spider_db_mbase_result::fetch_table_records"); DBUG_PRINT("info",("spider this=%p", this)); if (!(mysql_row = mysql_fetch_row(db_result))) { DBUG_PRINT("info",("spider fetch row is null")); - if ((error_num = mysql_errno(((spider_db_mysql *) db_conn)->db_conn))) + if ((error_num = mysql_errno(((spider_db_mbase *) db_conn)->db_conn))) { my_message(error_num, - mysql_error(((spider_db_mysql *) db_conn)->db_conn), MYF(0)); + mysql_error(((spider_db_mbase *) db_conn)->db_conn), MYF(0)); DBUG_RETURN(error_num); } DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE); @@ -986,7 +1114,7 @@ int spider_db_mysql_result::fetch_table_records( DBUG_RETURN(0); } -int spider_db_mysql_result::fetch_table_cardinality( +int spider_db_mbase_result::fetch_table_cardinality( int mode, TABLE *table, longlong *cardinality, @@ -996,16 +1124,16 @@ int spider_db_mysql_result::fetch_table_cardinality( int error_num; MYSQL_ROW mysql_row; Field *field; - DBUG_ENTER("spider_db_mysql_result::fetch_table_cardinality"); + DBUG_ENTER("spider_db_mbase_result::fetch_table_cardinality"); DBUG_PRINT("info",("spider this=%p", this)); memset((uchar *) cardinality_upd, 0, sizeof(uchar) * bitmap_size); if (!(mysql_row = mysql_fetch_row(db_result))) { DBUG_PRINT("info",("spider fetch row is null")); - if ((error_num = mysql_errno(((spider_db_mysql *) db_conn)->db_conn))) + if ((error_num = mysql_errno(((spider_db_mbase *) db_conn)->db_conn))) { my_message(error_num, - mysql_error(((spider_db_mysql *) db_conn)->db_conn), MYF(0)); + mysql_error(((spider_db_mbase *) db_conn)->db_conn), MYF(0)); DBUG_RETURN(error_num); } /* no index */ @@ -1074,29 +1202,29 @@ int spider_db_mysql_result::fetch_table_cardinality( mysql_row = mysql_fetch_row(db_result); } } - if ((error_num = mysql_errno(((spider_db_mysql *) db_conn)->db_conn))) + if ((error_num = mysql_errno(((spider_db_mbase *) db_conn)->db_conn))) { my_message(error_num, - mysql_error(((spider_db_mysql *) db_conn)->db_conn), MYF(0)); + mysql_error(((spider_db_mbase *) db_conn)->db_conn), MYF(0)); DBUG_RETURN(error_num); } DBUG_RETURN(0); } -int spider_db_mysql_result::fetch_table_mon_status( +int spider_db_mbase_result::fetch_table_mon_status( int &status ) { int error_num; MYSQL_ROW mysql_row; - DBUG_ENTER("spider_db_mysql_result::fetch_table_mon_status"); + DBUG_ENTER("spider_db_mbase_result::fetch_table_mon_status"); DBUG_PRINT("info",("spider this=%p", this)); if (!(mysql_row = mysql_fetch_row(db_result))) { DBUG_PRINT("info",("spider fetch row is null")); - if ((error_num = mysql_errno(((spider_db_mysql *) db_conn)->db_conn))) + if ((error_num = mysql_errno(((spider_db_mbase *) db_conn)->db_conn))) { my_message(error_num, - mysql_error(((spider_db_mysql *) db_conn)->db_conn), MYF(0)); + mysql_error(((spider_db_mbase *) db_conn)->db_conn), MYF(0)); DBUG_RETURN(error_num); } DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -1115,21 +1243,21 @@ int spider_db_mysql_result::fetch_table_mon_status( DBUG_RETURN(0); } -int spider_db_mysql_result::fetch_show_master_status( +int spider_db_mbase_result::fetch_show_master_status( const char **binlog_file_name, const char **binlog_pos ) { int error_num; MYSQL_ROW mysql_row; - DBUG_ENTER("spider_db_mysql_result::fetch_show_master_status"); + DBUG_ENTER("spider_db_mbase_result::fetch_show_master_status"); DBUG_PRINT("info",("spider this=%p", this)); if (!(mysql_row = mysql_fetch_row(db_result))) { DBUG_PRINT("info",("spider fetch row is null")); - if ((error_num = mysql_errno(((spider_db_mysql *) db_conn)->db_conn))) + if ((error_num = mysql_errno(((spider_db_mbase *) db_conn)->db_conn))) { my_message(error_num, - mysql_error(((spider_db_mysql *) db_conn)->db_conn), MYF(0)); + mysql_error(((spider_db_mbase *) db_conn)->db_conn), MYF(0)); DBUG_RETURN(error_num); } DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE); @@ -1146,20 +1274,20 @@ int spider_db_mysql_result::fetch_show_master_status( DBUG_RETURN(0); } -int spider_db_mysql_result::fetch_select_binlog_gtid_pos( +int spider_db_mbase_result::fetch_select_binlog_gtid_pos( const char **gtid_pos ) { int error_num; MYSQL_ROW mysql_row; - DBUG_ENTER("spider_db_mysql_result::fetch_select_binlog_gtid_pos"); + DBUG_ENTER("spider_db_mbase_result::fetch_select_binlog_gtid_pos"); DBUG_PRINT("info",("spider this=%p", this)); if (!(mysql_row = mysql_fetch_row(db_result))) { DBUG_PRINT("info",("spider fetch row is null")); - if ((error_num = mysql_errno(((spider_db_mysql *) db_conn)->db_conn))) + if ((error_num = mysql_errno(((spider_db_mbase *) db_conn)->db_conn))) { my_message(error_num, - mysql_error(((spider_db_mysql *) db_conn)->db_conn), MYF(0)); + mysql_error(((spider_db_mbase *) db_conn)->db_conn), MYF(0)); DBUG_RETURN(error_num); } DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE); @@ -1174,24 +1302,24 @@ int spider_db_mysql_result::fetch_select_binlog_gtid_pos( DBUG_RETURN(0); } -longlong spider_db_mysql_result::num_rows() +longlong spider_db_mbase_result::num_rows() { - DBUG_ENTER("spider_db_mysql_result::num_rows"); + DBUG_ENTER("spider_db_mbase_result::num_rows"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN((longlong) mysql_num_rows(db_result)); } -uint spider_db_mysql_result::num_fields() +uint spider_db_mbase_result::num_fields() { - DBUG_ENTER("spider_db_mysql_result::num_fields"); + DBUG_ENTER("spider_db_mbase_result::num_fields"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(mysql_num_fields(db_result)); } -void spider_db_mysql_result::move_to_pos( +void spider_db_mbase_result::move_to_pos( longlong pos ) { - DBUG_ENTER("spider_db_mysql_result::move_to_pos"); + DBUG_ENTER("spider_db_mbase_result::move_to_pos"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider pos=%lld", pos)); /* @@ -1201,31 +1329,31 @@ void spider_db_mysql_result::move_to_pos( DBUG_VOID_RETURN; } -int spider_db_mysql_result::get_errno() +int spider_db_mbase_result::get_errno() { - DBUG_ENTER("spider_db_mysql_result::get_errno"); + DBUG_ENTER("spider_db_mbase_result::get_errno"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider store_error_num=%d", store_error_num)); DBUG_RETURN(store_error_num); } #ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE -int spider_db_mysql_result::fetch_columns_for_discover_table_structure( +int spider_db_mbase_result::fetch_columns_for_discover_table_structure( spider_string *str, CHARSET_INFO *access_charset ) { int error_num; uint length; MYSQL_ROW mysql_row; - DBUG_ENTER("spider_db_mysql_result::fetch_columns_for_discover_table_structure"); + DBUG_ENTER("spider_db_mbase_result::fetch_columns_for_discover_table_structure"); DBUG_PRINT("info",("spider this=%p", this)); if (!(mysql_row = mysql_fetch_row(db_result))) { DBUG_PRINT("info",("spider fetch row is null")); - if ((error_num = mysql_errno(((spider_db_mysql *) db_conn)->db_conn))) + if ((error_num = mysql_errno(((spider_db_mbase *) db_conn)->db_conn))) { my_message(error_num, - mysql_error(((spider_db_mysql *) db_conn)->db_conn), MYF(0)); + mysql_error(((spider_db_mbase *) db_conn)->db_conn), MYF(0)); DBUG_RETURN(error_num); } DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -1327,30 +1455,30 @@ int spider_db_mysql_result::fetch_columns_for_discover_table_structure( } str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); } while ((mysql_row = mysql_fetch_row(db_result))); - if ((error_num = mysql_errno(((spider_db_mysql *) db_conn)->db_conn))) + if ((error_num = mysql_errno(((spider_db_mbase *) db_conn)->db_conn))) { my_message(error_num, - mysql_error(((spider_db_mysql *) db_conn)->db_conn), MYF(0)); + mysql_error(((spider_db_mbase *) db_conn)->db_conn), MYF(0)); DBUG_RETURN(error_num); } DBUG_RETURN(0); } -int spider_db_mysql_result::fetch_index_for_discover_table_structure( +int spider_db_mbase_result::fetch_index_for_discover_table_structure( spider_string *str, CHARSET_INFO *access_charset ) { int error_num; MYSQL_ROW mysql_row; - DBUG_ENTER("spider_db_mysql_result::fetch_index_for_discover_table_structure"); + DBUG_ENTER("spider_db_mbase_result::fetch_index_for_discover_table_structure"); DBUG_PRINT("info",("spider this=%p", this)); if (!(mysql_row = mysql_fetch_row(db_result))) { DBUG_PRINT("info",("spider fetch row is null")); - if ((error_num = mysql_errno(((spider_db_mysql *) db_conn)->db_conn))) + if ((error_num = mysql_errno(((spider_db_mbase *) db_conn)->db_conn))) { my_message(error_num, - mysql_error(((spider_db_mysql *) db_conn)->db_conn), MYF(0)); + mysql_error(((spider_db_mbase *) db_conn)->db_conn), MYF(0)); DBUG_RETURN(error_num); } DBUG_RETURN(0); @@ -1519,10 +1647,10 @@ int spider_db_mysql_result::fetch_index_for_discover_table_structure( else using_hash = FALSE; } while ((mysql_row = mysql_fetch_row(db_result))); - if ((error_num = mysql_errno(((spider_db_mysql *) db_conn)->db_conn))) + if ((error_num = mysql_errno(((spider_db_mbase *) db_conn)->db_conn))) { my_message(error_num, - mysql_error(((spider_db_mysql *) db_conn)->db_conn), MYF(0)); + mysql_error(((spider_db_mbase *) db_conn)->db_conn), MYF(0)); DBUG_RETURN(error_num); } if (!first) @@ -1540,22 +1668,22 @@ int spider_db_mysql_result::fetch_index_for_discover_table_structure( DBUG_RETURN(0); } -int spider_db_mysql_result::fetch_table_for_discover_table_structure( +int spider_db_mbase_result::fetch_table_for_discover_table_structure( spider_string *str, SPIDER_SHARE *spider_share, CHARSET_INFO *access_charset ) { int error_num; MYSQL_ROW mysql_row; - DBUG_ENTER("spider_db_mysql_result::fetch_table_for_discover_table_structure"); + DBUG_ENTER("spider_db_mbase_result::fetch_table_for_discover_table_structure"); DBUG_PRINT("info",("spider this=%p", this)); if (!(mysql_row = mysql_fetch_row(db_result))) { DBUG_PRINT("info",("spider fetch row is null")); - if ((error_num = mysql_errno(((spider_db_mysql *) db_conn)->db_conn))) + if ((error_num = mysql_errno(((spider_db_mbase *) db_conn)->db_conn))) { my_message(error_num, - mysql_error(((spider_db_mysql *) db_conn)->db_conn), MYF(0)); + mysql_error(((spider_db_mbase *) db_conn)->db_conn), MYF(0)); DBUG_RETURN(error_num); } DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -1581,20 +1709,39 @@ int spider_db_mysql_result::fetch_table_for_discover_table_structure( } #endif +spider_db_mbase::spider_db_mbase( + SPIDER_CONN *conn, + spider_db_mbase_util *spider_db_mbase_utility +) : spider_db_conn(conn), spider_db_mbase_utility(spider_db_mbase_utility), + lock_table_hash_inited(FALSE), handler_open_array_inited(FALSE) +{ + DBUG_ENTER("spider_db_mbase::spider_db_mbase"); + DBUG_PRINT("info",("spider this=%p", this)); + db_conn = NULL; + DBUG_VOID_RETURN; +} + spider_db_mysql::spider_db_mysql( SPIDER_CONN *conn -) : spider_db_conn(conn), lock_table_hash_inited(FALSE), - handler_open_array_inited(FALSE) +) : spider_db_mbase(conn, &spider_db_mysql_utility) { DBUG_ENTER("spider_db_mysql::spider_db_mysql"); DBUG_PRINT("info",("spider this=%p", this)); - db_conn = NULL; DBUG_VOID_RETURN; } -spider_db_mysql::~spider_db_mysql() +spider_db_mariadb::spider_db_mariadb( + SPIDER_CONN *conn +) : spider_db_mbase(conn, &spider_db_mariadb_utility) { - DBUG_ENTER("spider_db_mysql::~spider_db_mysql"); + DBUG_ENTER("spider_db_mariadb::spider_db_mariadb"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_db_mbase::~spider_db_mbase() +{ + DBUG_ENTER("spider_db_mbase::~spider_db_mbase"); DBUG_PRINT("info",("spider this=%p", this)); if (handler_open_array_inited) { @@ -1616,9 +1763,23 @@ spider_db_mysql::~spider_db_mysql() DBUG_VOID_RETURN; } -int spider_db_mysql::init() +spider_db_mysql::~spider_db_mysql() +{ + DBUG_ENTER("spider_db_mysql::~spider_db_mysql"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_db_mariadb::~spider_db_mariadb() +{ + DBUG_ENTER("spider_db_mariadb::~spider_db_mariadb"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +int spider_db_mbase::init() { - DBUG_ENTER("spider_db_mysql::init"); + DBUG_ENTER("spider_db_mbase::init"); DBUG_PRINT("info",("spider this=%p", this)); if ( my_hash_init(&lock_table_hash, spd_charset_utf8_bin, 32, 0, 0, @@ -1648,21 +1809,21 @@ int spider_db_mysql::init() DBUG_RETURN(0); } -bool spider_db_mysql::is_connected() +bool spider_db_mbase::is_connected() { - DBUG_ENTER("spider_db_mysql::is_connected"); + DBUG_ENTER("spider_db_mbase::is_connected"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(db_conn); } -void spider_db_mysql::bg_connect() +void spider_db_mbase::bg_connect() { - DBUG_ENTER("spider_db_mysql::bg_connect"); + DBUG_ENTER("spider_db_mbase::bg_connect"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_VOID_RETURN; } -int spider_db_mysql::connect( +int spider_db_mbase::connect( char *tgt_host, char *tgt_username, char *tgt_password, @@ -1674,7 +1835,7 @@ int spider_db_mysql::connect( ) { int error_num; my_bool connect_mutex = spider_param_connect_mutex(); - DBUG_ENTER("spider_db_mysql::connect"); + DBUG_ENTER("spider_db_mbase::connect"); DBUG_PRINT("info",("spider this=%p", this)); while (TRUE) { @@ -1795,25 +1956,25 @@ int spider_db_mysql::connect( DBUG_RETURN(0); } -int spider_db_mysql::ping( +int spider_db_mbase::ping( ) { - DBUG_ENTER("spider_db_mysql::ping"); + DBUG_ENTER("spider_db_mbase::ping"); DBUG_PRINT("info",("spider this=%p", this)); if (spider_param_dry_access()) DBUG_RETURN(0); DBUG_RETURN(simple_command(db_conn, COM_PING, 0, 0, 0)); } -void spider_db_mysql::bg_disconnect() +void spider_db_mbase::bg_disconnect() { - DBUG_ENTER("spider_db_mysql::bg_disconnect"); + DBUG_ENTER("spider_db_mbase::bg_disconnect"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_VOID_RETURN; } -void spider_db_mysql::disconnect() +void spider_db_mbase::disconnect() { - DBUG_ENTER("spider_db_mysql::disconnect"); + DBUG_ENTER("spider_db_mbase::disconnect"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider db_conn=%p", db_conn)); if (db_conn) @@ -1824,9 +1985,9 @@ void spider_db_mysql::disconnect() DBUG_VOID_RETURN; } -int spider_db_mysql::set_net_timeout() +int spider_db_mbase::set_net_timeout() { - DBUG_ENTER("spider_db_mysql::set_net_timeout"); + DBUG_ENTER("spider_db_mbase::set_net_timeout"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider conn=%p", conn)); my_net_set_read_timeout(&db_conn->net, conn->net_read_timeout); @@ -1834,14 +1995,14 @@ int spider_db_mysql::set_net_timeout() DBUG_RETURN(0); } -int spider_db_mysql::exec_query( +int spider_db_mbase::exec_query( const char *query, uint length, int quick_mode ) { int error_num = 0; uint log_result_errors = spider_param_log_result_errors(); - DBUG_ENTER("spider_db_mysql::exec_query"); + DBUG_ENTER("spider_db_mbase::exec_query"); DBUG_PRINT("info",("spider this=%p", this)); if (spider_param_general_log()) { @@ -1945,30 +2106,30 @@ int spider_db_mysql::exec_query( DBUG_RETURN(error_num); } -int spider_db_mysql::get_errno() +int spider_db_mbase::get_errno() { - DBUG_ENTER("spider_db_mysql::get_errno"); + DBUG_ENTER("spider_db_mbase::get_errno"); DBUG_PRINT("info",("spider this=%p", this)); stored_error = mysql_errno(db_conn); DBUG_PRINT("info",("spider stored_error=%d", stored_error)); DBUG_RETURN(stored_error); } -const char *spider_db_mysql::get_error() +const char *spider_db_mbase::get_error() { const char *error_ptr; - DBUG_ENTER("spider_db_mysql::get_error"); + DBUG_ENTER("spider_db_mbase::get_error"); DBUG_PRINT("info",("spider this=%p", this)); error_ptr = mysql_error(db_conn); DBUG_PRINT("info",("spider error=%s", error_ptr)); DBUG_RETURN(error_ptr); } -bool spider_db_mysql::is_server_gone_error( +bool spider_db_mbase::is_server_gone_error( int error_num ) { bool server_gone; - DBUG_ENTER("spider_db_mysql::is_server_gone_error"); + DBUG_ENTER("spider_db_mbase::is_server_gone_error"); DBUG_PRINT("info",("spider this=%p", this)); server_gone = (error_num == CR_SERVER_GONE_ERROR || error_num == CR_SERVER_LOST); @@ -1976,11 +2137,11 @@ bool spider_db_mysql::is_server_gone_error( DBUG_RETURN(server_gone); } -bool spider_db_mysql::is_dup_entry_error( +bool spider_db_mbase::is_dup_entry_error( int error_num ) { bool dup_entry; - DBUG_ENTER("spider_db_mysql::is_dup_entry_error"); + DBUG_ENTER("spider_db_mbase::is_dup_entry_error"); DBUG_PRINT("info",("spider this=%p", this)); dup_entry = ( @@ -1992,11 +2153,11 @@ bool spider_db_mysql::is_dup_entry_error( DBUG_RETURN(dup_entry); } -bool spider_db_mysql::is_xa_nota_error( +bool spider_db_mbase::is_xa_nota_error( int error_num ) { bool xa_nota; - DBUG_ENTER("spider_db_mysql::is_xa_nota_error"); + DBUG_ENTER("spider_db_mbase::is_xa_nota_error"); DBUG_PRINT("info",("spider this=%p", this)); xa_nota = ( @@ -2008,10 +2169,10 @@ bool spider_db_mysql::is_xa_nota_error( DBUG_RETURN(xa_nota); } -void spider_db_mysql::print_warnings( +void spider_db_mbase::print_warnings( struct tm *l_time ) { - DBUG_ENTER("spider_db_mysql::print_warnings"); + DBUG_ENTER("spider_db_mbase::print_warnings"); DBUG_PRINT("info",("spider this=%p", this)); if (db_conn->status == MYSQL_STATUS_READY) { @@ -2083,16 +2244,16 @@ void spider_db_mysql::print_warnings( DBUG_VOID_RETURN; } -spider_db_result *spider_db_mysql::store_result( +spider_db_result *spider_db_mbase::store_result( spider_db_result_buffer **spider_res_buf, st_spider_db_request_key *request_key, int *error_num ) { - spider_db_mysql_result *result; - DBUG_ENTER("spider_db_mysql::store_result"); + spider_db_mbase_result *result; + DBUG_ENTER("spider_db_mbase::store_result"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_ASSERT(!spider_res_buf); - if ((result = new spider_db_mysql_result(this))) + if ((result = new spider_db_mbase_result(this))) { *error_num = 0; if ( @@ -2111,14 +2272,14 @@ spider_db_result *spider_db_mysql::store_result( DBUG_RETURN(result); } -spider_db_result *spider_db_mysql::use_result( +spider_db_result *spider_db_mbase::use_result( st_spider_db_request_key *request_key, int *error_num ) { - spider_db_mysql_result *result; - DBUG_ENTER("spider_db_mysql::use_result"); + spider_db_mbase_result *result; + DBUG_ENTER("spider_db_mbase::use_result"); DBUG_PRINT("info",("spider this=%p", this)); - if ((result = new spider_db_mysql_result(this))) + if ((result = new spider_db_mbase_result(this))) { *error_num = 0; if ( @@ -2136,10 +2297,10 @@ spider_db_result *spider_db_mysql::use_result( DBUG_RETURN(result); } -int spider_db_mysql::next_result() +int spider_db_mbase::next_result() { int status; - DBUG_ENTER("spider_db_mysql::next_result"); + DBUG_ENTER("spider_db_mbase::next_result"); DBUG_PRINT("info",("spider this=%p", this)); if (db_conn->status != MYSQL_STATUS_READY) { @@ -2165,10 +2326,10 @@ int spider_db_mysql::next_result() DBUG_RETURN(-1); } -uint spider_db_mysql::affected_rows() +uint spider_db_mbase::affected_rows() { MYSQL *last_used_con; - DBUG_ENTER("spider_db_mysql::affected_rows"); + DBUG_ENTER("spider_db_mbase::affected_rows"); DBUG_PRINT("info",("spider this=%p", this)); #if MYSQL_VERSION_ID < 50500 last_used_con = db_conn->last_used_con; @@ -2178,10 +2339,10 @@ uint spider_db_mysql::affected_rows() DBUG_RETURN((uint) last_used_con->affected_rows); } -ulonglong spider_db_mysql::last_insert_id() +ulonglong spider_db_mbase::last_insert_id() { MYSQL *last_used_con; - DBUG_ENTER("spider_db_mysql::last_insert_id"); + DBUG_ENTER("spider_db_mbase::last_insert_id"); DBUG_PRINT("info",("spider this=%p", this)); #if MYSQL_VERSION_ID < 50500 last_used_con = db_conn->last_used_con; @@ -2191,30 +2352,30 @@ ulonglong spider_db_mysql::last_insert_id() DBUG_RETURN((uint) last_used_con->insert_id); } -int spider_db_mysql::set_character_set( +int spider_db_mbase::set_character_set( const char *csname ) { - DBUG_ENTER("spider_db_mysql::set_character_set"); + DBUG_ENTER("spider_db_mbase::set_character_set"); DBUG_PRINT("info",("spider this=%p", this)); if (spider_param_dry_access()) DBUG_RETURN(0); DBUG_RETURN(mysql_set_character_set(db_conn, csname)); } -int spider_db_mysql::select_db( +int spider_db_mbase::select_db( const char *dbname ) { - DBUG_ENTER("spider_db_mysql::select_db"); + DBUG_ENTER("spider_db_mbase::select_db"); DBUG_PRINT("info",("spider this=%p", this)); if (spider_param_dry_access()) DBUG_RETURN(0); DBUG_RETURN(mysql_select_db(db_conn, dbname)); } -int spider_db_mysql::consistent_snapshot( +int spider_db_mbase::consistent_snapshot( int *need_mon ) { - DBUG_ENTER("spider_db_mysql::consistent_snapshot"); + DBUG_ENTER("spider_db_mbase::consistent_snapshot"); DBUG_PRINT("info",("spider this=%p", this)); if (spider_db_query( conn, @@ -2229,17 +2390,17 @@ int spider_db_mysql::consistent_snapshot( DBUG_RETURN(0); } -bool spider_db_mysql::trx_start_in_bulk_sql() +bool spider_db_mbase::trx_start_in_bulk_sql() { - DBUG_ENTER("spider_db_mysql::trx_start_in_bulk_sql"); + DBUG_ENTER("spider_db_mbase::trx_start_in_bulk_sql"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(TRUE); } -int spider_db_mysql::start_transaction( +int spider_db_mbase::start_transaction( int *need_mon ) { - DBUG_ENTER("spider_db_mysql::start_transaction"); + DBUG_ENTER("spider_db_mbase::start_transaction"); DBUG_PRINT("info",("spider this=%p", this)); if (spider_db_query( conn, @@ -2254,10 +2415,10 @@ int spider_db_mysql::start_transaction( DBUG_RETURN(0); } -int spider_db_mysql::commit( +int spider_db_mbase::commit( int *need_mon ) { - DBUG_ENTER("spider_db_mysql::commit"); + DBUG_ENTER("spider_db_mbase::commit"); DBUG_PRINT("info",("spider this=%p", this)); if (spider_db_query( conn, @@ -2272,12 +2433,12 @@ int spider_db_mysql::commit( DBUG_RETURN(0); } -int spider_db_mysql::rollback( +int spider_db_mbase::rollback( int *need_mon ) { bool is_error; int error_num; - DBUG_ENTER("spider_db_mysql::rollback"); + DBUG_ENTER("spider_db_mbase::rollback"); DBUG_PRINT("info",("spider this=%p", this)); conn->mta_conn_mutex_unlock_later = TRUE; if (spider_db_query( @@ -2307,30 +2468,30 @@ int spider_db_mysql::rollback( DBUG_RETURN(0); } -int spider_db_mysql::xa_start( +int spider_db_mbase::xa_start( XID *xid, int *need_mon ) { - DBUG_ENTER("spider_db_mysql::xa_start"); + DBUG_ENTER("spider_db_mbase::xa_start"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_ASSERT(0); DBUG_RETURN(0); } -bool spider_db_mysql::xa_start_in_bulk_sql() +bool spider_db_mbase::xa_start_in_bulk_sql() { - DBUG_ENTER("spider_db_mysql::xa_start_in_bulk_sql"); + DBUG_ENTER("spider_db_mbase::xa_start_in_bulk_sql"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(TRUE); } -int spider_db_mysql::xa_end( +int spider_db_mbase::xa_end( XID *xid, int *need_mon ) { char sql_buf[SPIDER_SQL_XA_END_LEN + XIDDATASIZE + sizeof(long) + 9]; spider_string sql_str(sql_buf, sizeof(sql_buf), &my_charset_bin); - DBUG_ENTER("spider_db_mysql::xa_end"); + DBUG_ENTER("spider_db_mbase::xa_end"); DBUG_PRINT("info",("spider this=%p", this)); sql_str.init_calc_mem(108); @@ -2350,13 +2511,13 @@ int spider_db_mysql::xa_end( DBUG_RETURN(0); } -int spider_db_mysql::xa_prepare( +int spider_db_mbase::xa_prepare( XID *xid, int *need_mon ) { char sql_buf[SPIDER_SQL_XA_PREPARE_LEN + XIDDATASIZE + sizeof(long) + 9]; spider_string sql_str(sql_buf, sizeof(sql_buf), &my_charset_bin); - DBUG_ENTER("spider_db_mysql::xa_prepare"); + DBUG_ENTER("spider_db_mbase::xa_prepare"); DBUG_PRINT("info",("spider this=%p", this)); sql_str.init_calc_mem(109); @@ -2376,13 +2537,13 @@ int spider_db_mysql::xa_prepare( DBUG_RETURN(0); } -int spider_db_mysql::xa_commit( +int spider_db_mbase::xa_commit( XID *xid, int *need_mon ) { char sql_buf[SPIDER_SQL_XA_COMMIT_LEN + XIDDATASIZE + sizeof(long) + 9]; spider_string sql_str(sql_buf, sizeof(sql_buf), &my_charset_bin); - DBUG_ENTER("spider_db_mysql::xa_commit"); + DBUG_ENTER("spider_db_mbase::xa_commit"); DBUG_PRINT("info",("spider this=%p", this)); sql_str.init_calc_mem(110); @@ -2402,13 +2563,13 @@ int spider_db_mysql::xa_commit( DBUG_RETURN(0); } -int spider_db_mysql::xa_rollback( +int spider_db_mbase::xa_rollback( XID *xid, int *need_mon ) { char sql_buf[SPIDER_SQL_XA_ROLLBACK_LEN + XIDDATASIZE + sizeof(long) + 9]; spider_string sql_str(sql_buf, sizeof(sql_buf), &my_charset_bin); - DBUG_ENTER("spider_db_mysql::xa_rollback"); + DBUG_ENTER("spider_db_mbase::xa_rollback"); DBUG_PRINT("info",("spider this=%p", this)); sql_str.init_calc_mem(111); @@ -2428,18 +2589,18 @@ int spider_db_mysql::xa_rollback( DBUG_RETURN(0); } -bool spider_db_mysql::set_trx_isolation_in_bulk_sql() +bool spider_db_mbase::set_trx_isolation_in_bulk_sql() { - DBUG_ENTER("spider_db_mysql::set_trx_isolation_in_bulk_sql"); + DBUG_ENTER("spider_db_mbase::set_trx_isolation_in_bulk_sql"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(TRUE); } -int spider_db_mysql::set_trx_isolation( +int spider_db_mbase::set_trx_isolation( int trx_isolation, int *need_mon ) { - DBUG_ENTER("spider_db_mysql::set_trx_isolation"); + DBUG_ENTER("spider_db_mbase::set_trx_isolation"); DBUG_PRINT("info",("spider this=%p", this)); switch (trx_isolation) { @@ -2497,18 +2658,18 @@ int spider_db_mysql::set_trx_isolation( DBUG_RETURN(0); } -bool spider_db_mysql::set_autocommit_in_bulk_sql() +bool spider_db_mbase::set_autocommit_in_bulk_sql() { - DBUG_ENTER("spider_db_mysql::set_autocommit_in_bulk_sql"); + DBUG_ENTER("spider_db_mbase::set_autocommit_in_bulk_sql"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(TRUE); } -int spider_db_mysql::set_autocommit( +int spider_db_mbase::set_autocommit( bool autocommit, int *need_mon ) { - DBUG_ENTER("spider_db_mysql::set_autocommit"); + DBUG_ENTER("spider_db_mbase::set_autocommit"); DBUG_PRINT("info",("spider this=%p", this)); if (autocommit) { @@ -2537,18 +2698,18 @@ int spider_db_mysql::set_autocommit( DBUG_RETURN(0); } -bool spider_db_mysql::set_sql_log_off_in_bulk_sql() +bool spider_db_mbase::set_sql_log_off_in_bulk_sql() { - DBUG_ENTER("spider_db_mysql::set_sql_log_off_in_bulk_sql"); + DBUG_ENTER("spider_db_mbase::set_sql_log_off_in_bulk_sql"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(TRUE); } -int spider_db_mysql::set_sql_log_off( +int spider_db_mbase::set_sql_log_off( bool sql_log_off, int *need_mon ) { - DBUG_ENTER("spider_db_mysql::set_sql_log_off"); + DBUG_ENTER("spider_db_mbase::set_sql_log_off"); DBUG_PRINT("info",("spider this=%p", this)); if (sql_log_off) { @@ -2577,21 +2738,21 @@ int spider_db_mysql::set_sql_log_off( DBUG_RETURN(0); } -bool spider_db_mysql::set_time_zone_in_bulk_sql() +bool spider_db_mbase::set_time_zone_in_bulk_sql() { - DBUG_ENTER("spider_db_mysql::set_time_zone_in_bulk_sql"); + DBUG_ENTER("spider_db_mbase::set_time_zone_in_bulk_sql"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(TRUE); } -int spider_db_mysql::set_time_zone( +int spider_db_mbase::set_time_zone( Time_zone *time_zone, int *need_mon ) { const String *tz_str = time_zone->get_name(); char sql_buf[MAX_FIELD_WIDTH]; spider_string sql_str(sql_buf, sizeof(sql_buf), &my_charset_bin); - DBUG_ENTER("spider_db_mysql::set_time_zone"); + DBUG_ENTER("spider_db_mbase::set_time_zone"); DBUG_PRINT("info",("spider this=%p", this)); sql_str.init_calc_mem(214); sql_str.length(0); @@ -2614,7 +2775,7 @@ int spider_db_mysql::set_time_zone( DBUG_RETURN(0); } -int spider_db_mysql::exec_simple_sql_with_result( +int spider_db_mbase::exec_simple_sql_with_result( SPIDER_TRX *trx, SPIDER_SHARE *share, const char *sql, @@ -2624,7 +2785,7 @@ int spider_db_mysql::exec_simple_sql_with_result( SPIDER_DB_RESULT **res ) { int error_num; - DBUG_ENTER("spider_db_mysql::exec_simple_sql_with_result"); + DBUG_ENTER("spider_db_mbase::exec_simple_sql_with_result"); pthread_mutex_lock(&conn->mta_conn_mutex); SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = need_mon; @@ -2714,7 +2875,7 @@ int spider_db_mysql::exec_simple_sql_with_result( DBUG_RETURN(0); } -int spider_db_mysql::show_master_status( +int spider_db_mbase::show_master_status( SPIDER_TRX *trx, SPIDER_SHARE *share, int all_link_idx, @@ -2728,7 +2889,7 @@ int spider_db_mysql::show_master_status( int error_num; const char *binlog_file_name, *binlog_pos; uint binlog_file_name_length, binlog_pos_length; - DBUG_ENTER("spider_db_mysql::show_master_status"); + DBUG_ENTER("spider_db_mbase::show_master_status"); if ((error_num = exec_simple_sql_with_result(trx, share, SPIDER_SQL_SHOW_MASTER_STATUS_STR, SPIDER_SQL_SHOW_MASTER_STATUS_LEN, all_link_idx, need_mon, res1)) @@ -2737,7 +2898,7 @@ int spider_db_mysql::show_master_status( DBUG_RETURN(error_num); } - if (!(error_num = ((spider_db_mysql_result *)*res1)->fetch_show_master_status( + if (!(error_num = ((spider_db_mbase_result *)*res1)->fetch_show_master_status( &binlog_file_name, &binlog_pos)) ) { binlog_file_name_length = strlen(binlog_file_name); @@ -2776,7 +2937,7 @@ int spider_db_mysql::show_master_status( DBUG_RETURN(0); } -int spider_db_mysql::select_binlog_gtid_pos( +int spider_db_mbase::select_binlog_gtid_pos( SPIDER_TRX *trx, SPIDER_SHARE *share, int all_link_idx, @@ -2792,7 +2953,7 @@ int spider_db_mysql::select_binlog_gtid_pos( int error_num; size_t length; const char *gtid_pos; - DBUG_ENTER("spider_db_mysql::select_binlog_gtid_pos"); + DBUG_ENTER("spider_db_mbase::select_binlog_gtid_pos"); str->length(0); if (str->reserve( SPIDER_SQL_BINLOG_GTID_POS_LEN + @@ -2829,7 +2990,7 @@ int spider_db_mysql::select_binlog_gtid_pos( DBUG_PRINT("info", ("spider error_num=%d 1", error_num)); DBUG_RETURN(error_num); } - if (!(error_num = ((spider_db_mysql_result *)*res)->fetch_select_binlog_gtid_pos(>id_pos))) + if (!(error_num = ((spider_db_mbase_result *)*res)->fetch_select_binlog_gtid_pos(>id_pos))) { spider_store_binlog_pos_gtid(table, gtid_pos, strlen(gtid_pos), conn->access_charset); } @@ -2846,18 +3007,18 @@ int spider_db_mysql::select_binlog_gtid_pos( } #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) -int spider_db_mysql::append_sql( +int spider_db_mbase::append_sql( char *sql, ulong sql_length, st_spider_db_request_key *request_key ) { - DBUG_ENTER("spider_db_mysql::append_sql"); + DBUG_ENTER("spider_db_mbase::append_sql"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_ASSERT(0); DBUG_RETURN(0); } -int spider_db_mysql::append_open_handler( +int spider_db_mbase::append_open_handler( uint handler_id, const char *db_name, const char *table_name, @@ -2865,13 +3026,13 @@ int spider_db_mysql::append_open_handler( const char *sql, st_spider_db_request_key *request_key ) { - DBUG_ENTER("spider_db_mysql::append_open_handler"); + DBUG_ENTER("spider_db_mbase::append_open_handler"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_ASSERT(0); DBUG_RETURN(0); } -int spider_db_mysql::append_select( +int spider_db_mbase::append_select( uint handler_id, spider_string *sql, SPIDER_DB_HS_STRING_REF_BUFFER *keys, @@ -2879,24 +3040,24 @@ int spider_db_mysql::append_select( int skip, st_spider_db_request_key *request_key ) { - DBUG_ENTER("spider_db_mysql::append_select"); + DBUG_ENTER("spider_db_mbase::append_select"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_ASSERT(0); DBUG_RETURN(0); } -int spider_db_mysql::append_insert( +int spider_db_mbase::append_insert( uint handler_id, SPIDER_DB_HS_STRING_REF_BUFFER *upds, st_spider_db_request_key *request_key ) { - DBUG_ENTER("spider_db_mysql::append_insert"); + DBUG_ENTER("spider_db_mbase::append_insert"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_ASSERT(0); DBUG_RETURN(0); } -int spider_db_mysql::append_update( +int spider_db_mbase::append_update( uint handler_id, spider_string *sql, SPIDER_DB_HS_STRING_REF_BUFFER *keys, @@ -2907,13 +3068,13 @@ int spider_db_mysql::append_update( bool decrement, st_spider_db_request_key *request_key ) { - DBUG_ENTER("spider_db_mysql::append_update"); + DBUG_ENTER("spider_db_mbase::append_update"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_ASSERT(0); DBUG_RETURN(0); } -int spider_db_mysql::append_delete( +int spider_db_mbase::append_delete( uint handler_id, spider_string *sql, SPIDER_DB_HS_STRING_REF_BUFFER *keys, @@ -2921,27 +3082,27 @@ int spider_db_mysql::append_delete( int skip, st_spider_db_request_key *request_key ) { - DBUG_ENTER("spider_db_mysql::append_delete"); + DBUG_ENTER("spider_db_mbase::append_delete"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_ASSERT(0); DBUG_RETURN(0); } -void spider_db_mysql::reset_request_queue() +void spider_db_mbase::reset_request_queue() { - DBUG_ENTER("spider_db_mysql::reset_request_queue"); + DBUG_ENTER("spider_db_mbase::reset_request_queue"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_ASSERT(0); DBUG_VOID_RETURN; } #endif -size_t spider_db_mysql::escape_string( +size_t spider_db_mbase::escape_string( char *to, const char *from, size_t from_length ) { - DBUG_ENTER("spider_db_mysql::escape_string"); + DBUG_ENTER("spider_db_mbase::escape_string"); DBUG_PRINT("info",("spider this=%p", this)); if (db_conn->server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES) DBUG_RETURN(escape_quotes_for_mysql(db_conn->charset, to, 0, @@ -2950,14 +3111,14 @@ size_t spider_db_mysql::escape_string( from, from_length)); } -bool spider_db_mysql::have_lock_table_list() +bool spider_db_mbase::have_lock_table_list() { - DBUG_ENTER("spider_db_mysql::have_lock_table_list"); + DBUG_ENTER("spider_db_mbase::have_lock_table_list"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(lock_table_hash.records); } -int spider_db_mysql::append_lock_tables( +int spider_db_mbase::append_lock_tables( spider_string *str ) { int error_num; @@ -2972,9 +3133,9 @@ int spider_db_mysql::append_lock_tables( const char *table_name; uint table_name_length; CHARSET_INFO *table_name_charset; - DBUG_ENTER("spider_db_mysql::lock_tables"); + DBUG_ENTER("spider_db_mbase::lock_tables"); DBUG_PRINT("info",("spider this=%p", this)); - if ((error_num = spider_db_mysql_utility.append_lock_table_head(str))) + if ((error_num = spider_db_mbase_utility->append_lock_table_head(str))) { DBUG_RETURN(error_num); } @@ -3003,7 +3164,7 @@ int spider_db_mysql::append_lock_tables( DBUG_RETURN(0); } conn_link_idx = tmp_spider->conn_link_idx[tmp_link_idx]; - spider_mysql_share *db_share = (spider_mysql_share *) + spider_mbase_share *db_share = (spider_mbase_share *) tmp_spider->share->dbton_share[conn->dbton_id]; if (&db_share->db_names_str[conn_link_idx]) { @@ -3026,7 +3187,7 @@ int spider_db_mysql::append_lock_tables( tmp_spider->share->tgt_table_names_lengths[conn_link_idx]; table_name_charset = system_charset_info; } - if ((error_num = spider_db_mysql_utility. + if ((error_num = spider_db_mbase_utility-> append_lock_table_body( str, db_name, @@ -3048,54 +3209,54 @@ int spider_db_mysql::append_lock_tables( my_hash_delete(&lock_table_hash, (uchar*) tmp_link_for_hash); #endif } - if ((error_num = spider_db_mysql_utility.append_lock_table_tail(str))) + if ((error_num = spider_db_mbase_utility->append_lock_table_tail(str))) { DBUG_RETURN(error_num); } DBUG_RETURN(0); } -int spider_db_mysql::append_unlock_tables( +int spider_db_mbase::append_unlock_tables( spider_string *str ) { int error_num; - DBUG_ENTER("spider_db_mysql::append_unlock_tables"); + DBUG_ENTER("spider_db_mbase::append_unlock_tables"); DBUG_PRINT("info",("spider this=%p", this)); - if ((error_num = spider_db_mysql_utility.append_unlock_table(str))) + if ((error_num = spider_db_mbase_utility->append_unlock_table(str))) { DBUG_RETURN(error_num); } DBUG_RETURN(0); } -uint spider_db_mysql::get_lock_table_hash_count() +uint spider_db_mbase::get_lock_table_hash_count() { - DBUG_ENTER("spider_db_mysql::get_lock_table_hash_count"); + DBUG_ENTER("spider_db_mbase::get_lock_table_hash_count"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(lock_table_hash.records); } -void spider_db_mysql::reset_lock_table_hash() +void spider_db_mbase::reset_lock_table_hash() { - DBUG_ENTER("spider_db_mysql::reset_lock_table_hash"); + DBUG_ENTER("spider_db_mbase::reset_lock_table_hash"); DBUG_PRINT("info",("spider this=%p", this)); my_hash_reset(&lock_table_hash); DBUG_VOID_RETURN; } -uint spider_db_mysql::get_opened_handler_count() +uint spider_db_mbase::get_opened_handler_count() { - DBUG_ENTER("spider_db_mysql::get_opened_handler_count"); + DBUG_ENTER("spider_db_mbase::get_opened_handler_count"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(handler_open_array.elements); } -void spider_db_mysql::reset_opened_handler() +void spider_db_mbase::reset_opened_handler() { ha_spider *tmp_spider; int tmp_link_idx; SPIDER_LINK_FOR_HASH **tmp_link_for_hash; - DBUG_ENTER("spider_db_mysql::reset_opened_handler"); + DBUG_ENTER("spider_db_mbase::reset_opened_handler"); DBUG_PRINT("info",("spider this=%p", this)); while ((tmp_link_for_hash = (SPIDER_LINK_FOR_HASH **) pop_dynamic(&handler_open_array))) @@ -3107,7 +3268,7 @@ void spider_db_mysql::reset_opened_handler() DBUG_VOID_RETURN; } -void spider_db_mysql::set_dup_key_idx( +void spider_db_mbase::set_dup_key_idx( ha_spider *spider, int link_idx ) { @@ -3116,7 +3277,7 @@ void spider_db_mysql::set_dup_key_idx( int key_name_length; int max_length = 0; const char *key_name; - DBUG_ENTER("spider_db_mysql::set_dup_key_idx"); + DBUG_ENTER("spider_db_mbase::set_dup_key_idx"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider error_str=%s", conn->error_str)); for (roop_count = 0; roop_count < table->s->keys; roop_count++) @@ -3156,21 +3317,42 @@ void spider_db_mysql::set_dup_key_idx( DBUG_VOID_RETURN; } -bool spider_db_mysql::cmp_request_key_to_snd( +bool spider_db_mbase::cmp_request_key_to_snd( st_spider_db_request_key *request_key ) { - DBUG_ENTER("spider_db_mysql::cmp_request_key_to_snd"); + DBUG_ENTER("spider_db_mbase::cmp_request_key_to_snd"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(TRUE); } -spider_db_mysql_util::spider_db_mysql_util() : spider_db_util() +spider_db_mbase_util::spider_db_mbase_util() : spider_db_util() +{ + DBUG_ENTER("spider_db_mbase_util::spider_db_mbase_util"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_db_mysql_util::spider_db_mysql_util() : spider_db_mbase_util() { DBUG_ENTER("spider_db_mysql_util::spider_db_mysql_util"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_VOID_RETURN; } +spider_db_mariadb_util::spider_db_mariadb_util() : spider_db_mbase_util() +{ + DBUG_ENTER("spider_db_mariadb_util::spider_db_mariadb_util"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_db_mbase_util::~spider_db_mbase_util() +{ + DBUG_ENTER("spider_db_mbase_util::~spider_db_mbase_util"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + spider_db_mysql_util::~spider_db_mysql_util() { DBUG_ENTER("spider_db_mysql_util::~spider_db_mysql_util"); @@ -3178,25 +3360,32 @@ spider_db_mysql_util::~spider_db_mysql_util() DBUG_VOID_RETURN; } -int spider_db_mysql_util::append_name( +spider_db_mariadb_util::~spider_db_mariadb_util() +{ + DBUG_ENTER("spider_db_mariadb_util::~spider_db_mariadb_util"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +int spider_db_mbase_util::append_name( spider_string *str, const char *name, uint name_length ) { - DBUG_ENTER("spider_db_mysql_util::append_name"); + DBUG_ENTER("spider_db_mbase_util::append_name"); str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); str->q_append(name, name_length); str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); DBUG_RETURN(0); } -int spider_db_mysql_util::append_name_with_charset( +int spider_db_mbase_util::append_name_with_charset( spider_string *str, const char *name, uint name_length, CHARSET_INFO *name_charset ) { - DBUG_ENTER("spider_db_mysql_util::append_name_with_charset"); + DBUG_ENTER("spider_db_mbase_util::append_name_with_charset"); if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN * 2 + name_length * 2)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); @@ -3207,17 +3396,17 @@ int spider_db_mysql_util::append_name_with_charset( DBUG_RETURN(0); } -bool spider_db_mysql_util::is_name_quote( +bool spider_db_mbase_util::is_name_quote( const char head_code ) { - DBUG_ENTER("spider_db_mysql_util::is_name_quote"); + DBUG_ENTER("spider_db_mbase_util::is_name_quote"); DBUG_RETURN(head_code == *name_quote_str); } -int spider_db_mysql_util::append_escaped_name_quote( +int spider_db_mbase_util::append_escaped_name_quote( spider_string *str ) { - DBUG_ENTER("spider_db_mysql_util::append_escaped_name_quote"); + DBUG_ENTER("spider_db_mbase_util::append_escaped_name_quote"); if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN * 2)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); @@ -3225,7 +3414,7 @@ int spider_db_mysql_util::append_escaped_name_quote( DBUG_RETURN(0); } -int spider_db_mysql_util::append_column_value( +int spider_db_mbase_util::append_column_value( ha_spider *spider, spider_string *str, Field *field, @@ -3238,7 +3427,7 @@ int spider_db_mysql_util::append_column_value( uint length; THD *thd = field->table->in_use; Time_zone *saved_time_zone = thd->variables.time_zone; - DBUG_ENTER("spider_db_mysql_util::append_column_value"); + DBUG_ENTER("spider_db_mbase_util::append_column_value"); tmp_str.init_calc_mem(113); thd->variables.time_zone = UTC; @@ -3403,7 +3592,7 @@ int spider_db_mysql_util::append_column_value( DBUG_RETURN(0); } -int spider_db_mysql_util::append_from_with_alias( +int spider_db_mbase_util::append_from_with_alias( spider_string *str, const char **table_names, uint *table_name_lengths, @@ -3414,7 +3603,7 @@ int spider_db_mysql_util::append_from_with_alias( bool over_write ) { uint roop_count, length = 0; - DBUG_ENTER("spider_db_mysql_util::append_from_with_alias"); + DBUG_ENTER("spider_db_mbase_util::append_from_with_alias"); DBUG_PRINT("info",("spider this=%p", this)); if (!over_write) { @@ -3437,11 +3626,11 @@ int spider_db_mysql_util::append_from_with_alias( DBUG_RETURN(0); } -int spider_db_mysql_util::append_trx_isolation( +int spider_db_mbase_util::append_trx_isolation( spider_string *str, int trx_isolation ) { - DBUG_ENTER("spider_db_mysql_util::append_trx_isolation"); + DBUG_ENTER("spider_db_mbase_util::append_trx_isolation"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_SEMICOLON_LEN + SPIDER_SQL_ISO_READ_UNCOMMITTED_LEN)) @@ -3474,11 +3663,11 @@ int spider_db_mysql_util::append_trx_isolation( DBUG_RETURN(0); } -int spider_db_mysql_util::append_autocommit( +int spider_db_mbase_util::append_autocommit( spider_string *str, bool autocommit ) { - DBUG_ENTER("spider_db_mysql_util::append_autocommit"); + DBUG_ENTER("spider_db_mbase_util::append_autocommit"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_SEMICOLON_LEN + SPIDER_SQL_AUTOCOMMIT_OFF_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -3497,11 +3686,11 @@ int spider_db_mysql_util::append_autocommit( DBUG_RETURN(0); } -int spider_db_mysql_util::append_sql_log_off( +int spider_db_mbase_util::append_sql_log_off( spider_string *str, bool sql_log_off ) { - DBUG_ENTER("spider_db_mysql_util::append_sql_log_off"); + DBUG_ENTER("spider_db_mbase_util::append_sql_log_off"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_SEMICOLON_LEN + SPIDER_SQL_SQL_LOG_OFF_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -3518,12 +3707,12 @@ int spider_db_mysql_util::append_sql_log_off( DBUG_RETURN(0); } -int spider_db_mysql_util::append_time_zone( +int spider_db_mbase_util::append_time_zone( spider_string *str, Time_zone *time_zone ) { const String *tz_str = time_zone->get_name(); - DBUG_ENTER("spider_db_mysql_util::append_time_zone"); + DBUG_ENTER("spider_db_mbase_util::append_time_zone"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_SEMICOLON_LEN + SPIDER_SQL_TIME_ZONE_LEN + tz_str->length() + SPIDER_SQL_VALUE_QUOTE_LEN)) @@ -3536,10 +3725,10 @@ int spider_db_mysql_util::append_time_zone( DBUG_RETURN(0); } -int spider_db_mysql_util::append_start_transaction( +int spider_db_mbase_util::append_start_transaction( spider_string *str ) { - DBUG_ENTER("spider_db_mysql_util::append_start_transaction"); + DBUG_ENTER("spider_db_mbase_util::append_start_transaction"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_SEMICOLON_LEN + SPIDER_SQL_START_TRANSACTION_LEN)) @@ -3553,11 +3742,11 @@ int spider_db_mysql_util::append_start_transaction( DBUG_RETURN(0); } -int spider_db_mysql_util::append_xa_start( +int spider_db_mbase_util::append_xa_start( spider_string *str, XID *xid ) { - DBUG_ENTER("spider_db_mysql_util::append_xa_start"); + DBUG_ENTER("spider_db_mbase_util::append_xa_start"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_SEMICOLON_LEN + SPIDER_SQL_XA_START_LEN + XIDDATASIZE + sizeof(long) + 9)) @@ -3571,10 +3760,10 @@ int spider_db_mysql_util::append_xa_start( DBUG_RETURN(0); } -int spider_db_mysql_util::append_lock_table_head( +int spider_db_mbase_util::append_lock_table_head( spider_string *str ) { - DBUG_ENTER("spider_db_mysql_util::append_lock_table_head"); + DBUG_ENTER("spider_db_mbase_util::append_lock_table_head"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_LOCK_TABLE_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -3582,7 +3771,7 @@ int spider_db_mysql_util::append_lock_table_head( DBUG_RETURN(0); } -int spider_db_mysql_util::append_lock_table_body( +int spider_db_mbase_util::append_lock_table_body( spider_string *str, const char *db_name, uint db_name_length, @@ -3592,7 +3781,7 @@ int spider_db_mysql_util::append_lock_table_body( CHARSET_INFO *table_name_charset, int lock_type ) { - DBUG_ENTER("spider_db_mysql_util::append_lock_table_body"); + DBUG_ENTER("spider_db_mbase_util::append_lock_table_body"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN)) { @@ -3621,19 +3810,19 @@ int spider_db_mysql_util::append_lock_table_body( DBUG_RETURN(0); } -int spider_db_mysql_util::append_lock_table_tail( +int spider_db_mbase_util::append_lock_table_tail( spider_string *str ) { - DBUG_ENTER("spider_db_mysql_util::append_lock_table_tail"); + DBUG_ENTER("spider_db_mbase_util::append_lock_table_tail"); DBUG_PRINT("info",("spider this=%p", this)); str->length(str->length() - SPIDER_SQL_COMMA_LEN); DBUG_RETURN(0); } -int spider_db_mysql_util::append_unlock_table( +int spider_db_mbase_util::append_unlock_table( spider_string *str ) { - DBUG_ENTER("spider_db_mysql_util::append_unlock_table"); + DBUG_ENTER("spider_db_mbase_util::append_unlock_table"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_UNLOCK_TABLE_LEN)) { @@ -3643,7 +3832,7 @@ int spider_db_mysql_util::append_unlock_table( DBUG_RETURN(0); } -int spider_db_mysql_util::open_item_func( +int spider_db_mbase_util::open_item_func( Item_func *item_func, ha_spider *spider, spider_string *str, @@ -3652,7 +3841,6 @@ int spider_db_mysql_util::open_item_func( bool use_fields, spider_fields *fields ) { - uint dbton_id = spider_dbton_mysql.dbton_id; int error_num; Item *item, **item_list = item_func->arguments(); Field *field; @@ -3665,7 +3853,7 @@ int spider_db_mysql_util::open_item_func( last_str_length = SPIDER_SQL_NULL_CHAR_LEN; int use_pushdown_udf; bool merge_func = FALSE; - DBUG_ENTER("spider_db_mysql_util::open_item_func"); + DBUG_ENTER("spider_db_mbase_util::open_item_func"); if (str) { if (str->reserve(SPIDER_SQL_OPEN_PAREN_LEN)) @@ -4730,7 +4918,7 @@ int spider_db_mysql_util::open_item_func( } #ifdef HANDLER_HAS_DIRECT_AGGREGATE -int spider_db_mysql_util::open_item_sum_func( +int spider_db_mbase_util::open_item_sum_func( Item_sum *item_sum, ha_spider *spider, spider_string *str, @@ -4739,10 +4927,9 @@ int spider_db_mysql_util::open_item_sum_func( bool use_fields, spider_fields *fields ) { - uint dbton_id = spider_dbton_mysql.dbton_id; uint roop_count, item_count = item_sum->get_arg_count(); int error_num; - DBUG_ENTER("spider_db_mysql_util::open_item_sum_func"); + DBUG_ENTER("spider_db_mbase_util::open_item_sum_func"); DBUG_PRINT("info",("spider Sumfunctype = %d", item_sum->sum_func())); switch (item_sum->sum_func()) { @@ -4848,11 +5035,11 @@ int spider_db_mysql_util::open_item_sum_func( } #endif -int spider_db_mysql_util::append_escaped_util( +int spider_db_mbase_util::append_escaped_util( spider_string *to, String *from ) { - DBUG_ENTER("spider_db_mysql_util::append_escaped_util"); + DBUG_ENTER("spider_db_mbase_util::append_escaped_util"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider from=%s", from->charset()->csname)); DBUG_PRINT("info",("spider to=%s", to->charset()->csname)); @@ -4861,7 +5048,7 @@ int spider_db_mysql_util::append_escaped_util( } #ifdef SPIDER_HAS_GROUP_BY_HANDLER -int spider_db_mysql_util::append_table( +int spider_db_mbase_util::append_table( ha_spider *spider, spider_fields *fields, spider_string *str, @@ -4874,13 +5061,12 @@ int spider_db_mysql_util::append_table( ) { int error_num; bool use_cond_table_list = FALSE; - spider_mysql_share *db_share; - spider_mysql_handler *dbton_hdl; + spider_mbase_share *db_share; + spider_mbase_handler *dbton_hdl; SPIDER_TABLE_HOLDER *table_holder; - uint dbton_id = spider_dbton_mysql.dbton_id; TABLE_LIST *cond_table_list = *cond_table_list_ptr; ha_spider *spd; - DBUG_ENTER("spider_db_mysql_util::append_table"); + DBUG_ENTER("spider_db_mbase_util::append_table"); DBUG_PRINT("info",("spider table_list=%p", table_list)); DBUG_PRINT("info",("spider table_list->outer_join=%u", table_list->outer_join)); @@ -4987,9 +5173,9 @@ int spider_db_mysql_util::append_table( { table_holder = fields->get_table_holder(table_list->table); spd = table_holder->spider; - db_share = (spider_mysql_share *) + db_share = (spider_mbase_share *) spd->share->dbton_share[dbton_id]; - dbton_hdl = (spider_mysql_handler *) + dbton_hdl = (spider_mbase_handler *) spd->dbton_handler[dbton_id]; dbton_hdl->table_name_pos = str->length(); @@ -5084,7 +5270,7 @@ int spider_db_mysql_util::append_table( DBUG_RETURN(0); } -int spider_db_mysql_util::append_tables_top_down( +int spider_db_mbase_util::append_tables_top_down( ha_spider *spider, spider_fields *fields, spider_string *str, @@ -5097,7 +5283,7 @@ int spider_db_mysql_util::append_tables_top_down( uint outer_join_backup; TABLE_LIST *cur_table_list, *prev_table_list = NULL, *cond_table_list = NULL; bool first; - DBUG_ENTER("spider_db_mysql_util::append_tables_top_down"); + DBUG_ENTER("spider_db_mbase_util::append_tables_top_down"); DBUG_PRINT("info",("spider this=%p", this)); if ( table_list->outer_join || @@ -5223,7 +5409,7 @@ int spider_db_mysql_util::append_tables_top_down( str->q_append(SPIDER_SQL_ON_STR, SPIDER_SQL_ON_LEN); } if ((error_num = spider_db_print_item_type(on_expr, NULL, - spider, str, NULL, 0, spider_dbton_mysql.dbton_id, TRUE, fields))) + spider, str, NULL, 0, dbton_id, TRUE, fields))) { DBUG_RETURN(error_num); } @@ -5232,14 +5418,14 @@ int spider_db_mysql_util::append_tables_top_down( DBUG_RETURN(0); } -int spider_db_mysql_util::append_tables_top_down_check( +int spider_db_mbase_util::append_tables_top_down_check( TABLE_LIST *table_list, TABLE_LIST **used_table_list, uint *current_pos ) { int error_num; TABLE_LIST *cur_table_list; - DBUG_ENTER("spider_db_mysql_util::append_tables_top_down_check"); + DBUG_ENTER("spider_db_mbase_util::append_tables_top_down_check"); DBUG_PRINT("info",("spider this=%p", this)); List_iterator_fast<TABLE_LIST> it1(table_list->nested_join->join_list); while ((cur_table_list = it1++)) @@ -5256,7 +5442,7 @@ int spider_db_mysql_util::append_tables_top_down_check( DBUG_RETURN(0); } -int spider_db_mysql_util::append_embedding_tables( +int spider_db_mbase_util::append_embedding_tables( ha_spider *spider, spider_fields *fields, spider_string *str, @@ -5267,7 +5453,7 @@ int spider_db_mysql_util::append_embedding_tables( ) { int error_num; TABLE_LIST *embedding = table_list->embedding; - DBUG_ENTER("spider_db_mysql_util::append_embedding_tables"); + DBUG_ENTER("spider_db_mbase_util::append_embedding_tables"); DBUG_PRINT("info",("spider this=%p", this)); if (embedding) { @@ -5310,7 +5496,7 @@ int spider_db_mysql_util::append_embedding_tables( DBUG_RETURN(0); } -int spider_db_mysql_util::append_from_and_tables( +int spider_db_mbase_util::append_from_and_tables( ha_spider *spider, spider_fields *fields, spider_string *str, @@ -5322,7 +5508,7 @@ int spider_db_mysql_util::append_from_and_tables( TABLE *table; TABLE_LIST **used_table_list, *prev_table_list = NULL, *cond_table_list = NULL; - DBUG_ENTER("spider_db_mysql_util::append_from_and_tables"); + DBUG_ENTER("spider_db_mbase_util::append_from_and_tables"); DBUG_PRINT("info",("spider this=%p", this)); used_table_list = (TABLE_LIST **) my_alloca(sizeof(TABLE_LIST *) * table_count); @@ -5387,19 +5573,19 @@ int spider_db_mysql_util::append_from_and_tables( DBUG_RETURN(0); } -int spider_db_mysql_util::reappend_tables( +int spider_db_mbase_util::reappend_tables( spider_fields *fields, SPIDER_LINK_IDX_CHAIN *link_idx_chain, spider_string *str ) { int error_num; - uint dbton_id = spider_dbton_mysql.dbton_id, length; + uint32 length; ha_spider *spider; - spider_mysql_share *db_share; - spider_mysql_handler *dbton_hdl; + spider_mbase_share *db_share; + spider_mbase_handler *dbton_hdl; SPIDER_TABLE_HOLDER *table_holder; SPIDER_LINK_IDX_HOLDER *link_idx_holder; - DBUG_ENTER("spider_db_mysql_util::reappend_tables"); + DBUG_ENTER("spider_db_mbase_util::reappend_tables"); DBUG_PRINT("info",("spider this=%p", this)); length = str->length(); fields->set_pos_to_first_table_on_link_idx_chain(link_idx_chain); @@ -5409,11 +5595,11 @@ int spider_db_mysql_util::reappend_tables( link_idx_holder = fields->get_next_table_on_link_idx_chain(link_idx_chain); spider = table_holder->spider; - db_share = (spider_mysql_share *) + db_share = (spider_mbase_share *) spider->share->dbton_share[dbton_id]; if (!db_share->same_db_table_name) { - dbton_hdl = (spider_mysql_handler *) spider->dbton_handler[dbton_id]; + dbton_hdl = (spider_mbase_handler *) spider->dbton_handler[dbton_id]; str->length(dbton_hdl->table_name_pos); if ((error_num = db_share->append_table_name_with_adjusting(str, spider->conn_link_idx[link_idx_holder->link_idx]))) @@ -5426,10 +5612,10 @@ int spider_db_mysql_util::reappend_tables( DBUG_RETURN(0); } -int spider_db_mysql_util::append_where( +int spider_db_mbase_util::append_where( spider_string *str ) { - DBUG_ENTER("spider_db_mysql_util::append_where"); + DBUG_ENTER("spider_db_mbase_util::append_where"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_WHERE_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -5437,10 +5623,10 @@ int spider_db_mysql_util::append_where( DBUG_RETURN(0); } -int spider_db_mysql_util::append_having( +int spider_db_mbase_util::append_having( spider_string *str ) { - DBUG_ENTER("spider_db_mysql_util::append_having"); + DBUG_ENTER("spider_db_mbase_util::append_having"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_HAVING_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -5449,11 +5635,15 @@ int spider_db_mysql_util::append_having( } #endif -spider_mysql_share::spider_mysql_share( - st_spider_share *share +spider_mbase_share::spider_mbase_share( + st_spider_share *share, + uint dbton_id, + spider_db_mbase_util *spider_db_mbase_utility ) : spider_db_share( - share + share, + dbton_id ), + spider_db_mbase_utility(spider_db_mbase_utility), table_select(NULL), table_select_pos(0), key_select(NULL), @@ -5474,16 +5664,39 @@ spider_mysql_share::spider_mysql_share( same_db_table_name(TRUE), first_all_link_idx(-1) { - DBUG_ENTER("spider_mysql_share::spider_mysql_share"); + DBUG_ENTER("spider_mbase_share::spider_mbase_share"); DBUG_PRINT("info",("spider this=%p", this)); spider_alloc_calc_mem_init(mem_calc, 71); spider_alloc_calc_mem(spider_current_trx, mem_calc, sizeof(*this)); DBUG_VOID_RETURN; } -spider_mysql_share::~spider_mysql_share() +spider_mysql_share::spider_mysql_share( + st_spider_share *share +) : spider_mbase_share( + share, + spider_db_mysql_utility.dbton_id, + &spider_db_mysql_utility +) { + DBUG_ENTER("spider_mysql_share::spider_mysql_share"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} +spider_mariadb_share::spider_mariadb_share( + st_spider_share *share +) : spider_mbase_share( + share, + spider_db_mariadb_utility.dbton_id, + &spider_db_mariadb_utility +) { + DBUG_ENTER("spider_mariadb_share::spider_mariadb_share"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_mbase_share::~spider_mbase_share() { - DBUG_ENTER("spider_mysql_share::~spider_mysql_share"); + DBUG_ENTER("spider_mbase_share::~spider_mbase_share"); DBUG_PRINT("info",("spider this=%p", this)); if (table_select) delete [] table_select; @@ -5504,13 +5717,27 @@ spider_mysql_share::~spider_mysql_share() DBUG_VOID_RETURN; } -int spider_mysql_share::init() +spider_mysql_share::~spider_mysql_share() +{ + DBUG_ENTER("spider_mysql_share::~spider_mysql_share"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_mariadb_share::~spider_mariadb_share() +{ + DBUG_ENTER("spider_mariadb_share::~spider_mariadb_share"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +int spider_mbase_share::init() { int error_num; uint roop_count; TABLE_SHARE *table_share = spider_share->table_share; uint keys = table_share ? table_share->keys : 0; - DBUG_ENTER("spider_mysql_share::init"); + DBUG_ENTER("spider_mbase_share::init"); DBUG_PRINT("info",("spider this=%p", this)); if (!(key_select_pos = (int *) spider_bulk_alloc_mem(spider_current_trx, 112, @@ -5571,33 +5798,33 @@ int spider_mysql_share::init() DBUG_RETURN(error_num); } -uint spider_mysql_share::get_column_name_length( +uint spider_mbase_share::get_column_name_length( uint field_index ) { - DBUG_ENTER("spider_mysql_share::get_column_name_length"); + DBUG_ENTER("spider_mbase_share::get_column_name_length"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(column_name_str[field_index].length()); } -int spider_mysql_share::append_column_name( +int spider_mbase_share::append_column_name( spider_string *str, uint field_index ) { int error_num; - DBUG_ENTER("spider_mysql_share::append_column_name"); + DBUG_ENTER("spider_mbase_share::append_column_name"); DBUG_PRINT("info",("spider this=%p", this)); - error_num = spider_db_mysql_utility.append_name(str, + error_num = spider_db_mbase_utility->append_name(str, column_name_str[field_index].ptr(), column_name_str[field_index].length()); DBUG_RETURN(error_num); } -int spider_mysql_share::append_column_name_with_alias( +int spider_mbase_share::append_column_name_with_alias( spider_string *str, uint field_index, const char *alias, uint alias_length ) { - DBUG_ENTER("spider_mysql_share::append_column_name_with_alias"); + DBUG_ENTER("spider_mbase_share::append_column_name_with_alias"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve( alias_length + @@ -5609,7 +5836,7 @@ int spider_mysql_share::append_column_name_with_alias( DBUG_RETURN(0); } -int spider_mysql_share::append_table_name( +int spider_mbase_share::append_table_name( spider_string *str, int all_link_idx ) { @@ -5617,20 +5844,20 @@ int spider_mysql_share::append_table_name( uint db_nm_len = db_names_str[all_link_idx].length(); const char *table_nm = table_names_str[all_link_idx].ptr(); uint table_nm_len = table_names_str[all_link_idx].length(); - DBUG_ENTER("spider_mysql_share::append_table_name"); + DBUG_ENTER("spider_mbase_share::append_table_name"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(db_nm_len + SPIDER_SQL_DOT_LEN + table_nm_len + /* SPIDER_SQL_NAME_QUOTE_LEN */ 4)) { DBUG_RETURN(HA_ERR_OUT_OF_MEM); } - spider_db_mysql_utility.append_name(str, db_nm, db_nm_len); + spider_db_mbase_utility->append_name(str, db_nm, db_nm_len); str->q_append(SPIDER_SQL_DOT_STR, SPIDER_SQL_DOT_LEN); - spider_db_mysql_utility.append_name(str, table_nm, table_nm_len); + spider_db_mbase_utility->append_name(str, table_nm, table_nm_len); DBUG_RETURN(0); } -int spider_mysql_share::append_table_name_with_adjusting( +int spider_mbase_share::append_table_name_with_adjusting( spider_string *str, int all_link_idx ) { @@ -5640,11 +5867,11 @@ int spider_mysql_share::append_table_name_with_adjusting( const char *table_nm = table_names_str[all_link_idx].ptr(); uint table_nm_len = table_names_str[all_link_idx].length(); uint table_nm_max_len = table_nm_max_length; - DBUG_ENTER("spider_mysql_share::append_table_name_with_adjusting"); + DBUG_ENTER("spider_mbase_share::append_table_name_with_adjusting"); DBUG_PRINT("info",("spider this=%p", this)); - spider_db_mysql_utility.append_name(str, db_nm, db_nm_len); + spider_db_mbase_utility->append_name(str, db_nm, db_nm_len); str->q_append(SPIDER_SQL_DOT_STR, SPIDER_SQL_DOT_LEN); - spider_db_mysql_utility.append_name(str, table_nm, table_nm_len); + spider_db_mbase_utility->append_name(str, table_nm, table_nm_len); uint length = db_nm_max_len - db_nm_len + table_nm_max_len - table_nm_len; @@ -5653,7 +5880,7 @@ int spider_mysql_share::append_table_name_with_adjusting( DBUG_RETURN(0); } -int spider_mysql_share::append_from_with_adjusted_table_name( +int spider_mbase_share::append_from_with_adjusted_table_name( spider_string *str, int *table_name_pos ) { @@ -5663,7 +5890,7 @@ int spider_mysql_share::append_from_with_adjusted_table_name( const char *table_nm = table_names_str[0].ptr(); uint table_nm_len = table_names_str[0].length(); uint table_nm_max_len = table_nm_max_length; - DBUG_ENTER("spider_mysql_share::append_from_with_adjusted_table_name"); + DBUG_ENTER("spider_mbase_share::append_from_with_adjusted_table_name"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_FROM_LEN + db_nm_max_length + SPIDER_SQL_DOT_LEN + table_nm_max_length + @@ -5673,9 +5900,9 @@ int spider_mysql_share::append_from_with_adjusted_table_name( } str->q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN); *table_name_pos = str->length(); - spider_db_mysql_utility.append_name(str, db_nm, db_nm_len); + spider_db_mbase_utility->append_name(str, db_nm, db_nm_len); str->q_append(SPIDER_SQL_DOT_STR, SPIDER_SQL_DOT_LEN); - spider_db_mysql_utility.append_name(str, table_nm, table_nm_len); + spider_db_mbase_utility->append_name(str, table_nm, table_nm_len); uint length = db_nm_max_len - db_nm_len + table_nm_max_len - table_nm_len; @@ -5684,14 +5911,13 @@ int spider_mysql_share::append_from_with_adjusted_table_name( DBUG_RETURN(0); } -int spider_mysql_share::create_table_names_str() +int spider_mbase_share::create_table_names_str() { int error_num, roop_count; uint table_nm_len, db_nm_len; spider_string *str, *first_tbl_nm_str, *first_db_nm_str, *first_db_tbl_str; char *first_tbl_nm, *first_db_nm; - uint dbton_id = spider_dbton_mysql.dbton_id; - DBUG_ENTER("spider_mysql_share::create_table_names_str"); + DBUG_ENTER("spider_mbase_share::create_table_names_str"); table_names_str = NULL; db_names_str = NULL; db_table_str = NULL; @@ -5822,9 +6048,9 @@ error: DBUG_RETURN(error_num); } -void spider_mysql_share::free_table_names_str() +void spider_mbase_share::free_table_names_str() { - DBUG_ENTER("spider_mysql_share::free_table_names_str"); + DBUG_ENTER("spider_mbase_share::free_table_names_str"); if (db_table_str) { delete [] db_table_str; @@ -5843,14 +6069,13 @@ void spider_mysql_share::free_table_names_str() DBUG_VOID_RETURN; } -int spider_mysql_share::create_column_name_str() +int spider_mbase_share::create_column_name_str() { spider_string *str; int error_num; Field **field; TABLE_SHARE *table_share = spider_share->table_share; - uint dbton_id = spider_dbton_mysql.dbton_id; - DBUG_ENTER("spider_mysql_share::create_column_name_str"); + DBUG_ENTER("spider_mbase_share::create_column_name_str"); if ( table_share->fields && !(column_name_str = new spider_string[table_share->fields]) @@ -5876,9 +6101,9 @@ error: DBUG_RETURN(error_num); } -void spider_mysql_share::free_column_name_str() +void spider_mbase_share::free_column_name_str() { - DBUG_ENTER("spider_mysql_share::free_column_name_str"); + DBUG_ENTER("spider_mbase_share::free_column_name_str"); if (column_name_str) { delete [] column_name_str; @@ -5887,12 +6112,12 @@ void spider_mysql_share::free_column_name_str() DBUG_VOID_RETURN; } -int spider_mysql_share::convert_key_hint_str() +int spider_mbase_share::convert_key_hint_str() { spider_string *tmp_key_hint; int roop_count; TABLE_SHARE *table_share = spider_share->table_share; - DBUG_ENTER("spider_mysql_share::convert_key_hint_str"); + DBUG_ENTER("spider_mbase_share::convert_key_hint_str"); if (spider_share->access_charset->cset != system_charset_info->cset) { /* need conversion */ @@ -5915,11 +6140,10 @@ int spider_mysql_share::convert_key_hint_str() DBUG_RETURN(0); } -int spider_mysql_share::append_show_table_status() +int spider_mbase_share::append_show_table_status() { int roop_count; spider_string *str; - uint dbton_id = spider_dbton_mysql.dbton_id; DBUG_ENTER("spider_mysql_append_show_table_status"); if (!(show_table_status = new spider_string[2 * spider_share->all_link_count])) @@ -5987,7 +6211,7 @@ error: DBUG_RETURN(HA_ERR_OUT_OF_MEM); } -void spider_mysql_share::free_show_table_status() +void spider_mbase_share::free_show_table_status() { DBUG_ENTER("spider_mysql_free_show_table_status"); if (show_table_status) @@ -5998,12 +6222,11 @@ void spider_mysql_share::free_show_table_status() DBUG_VOID_RETURN; } -int spider_mysql_share::append_show_records() +int spider_mbase_share::append_show_records() { int roop_count; spider_string *str; - uint dbton_id = spider_dbton_mysql.dbton_id; - DBUG_ENTER("spider_mysql_share::append_show_records"); + DBUG_ENTER("spider_mbase_share::append_show_records"); if (!(show_records = new spider_string[spider_share->all_link_count])) goto error; @@ -6038,9 +6261,9 @@ error: DBUG_RETURN(HA_ERR_OUT_OF_MEM); } -void spider_mysql_share::free_show_records() +void spider_mbase_share::free_show_records() { - DBUG_ENTER("spider_mysql_share::free_show_records"); + DBUG_ENTER("spider_mbase_share::free_show_records"); if (show_records) { delete [] show_records; @@ -6049,12 +6272,11 @@ void spider_mysql_share::free_show_records() DBUG_VOID_RETURN; } -int spider_mysql_share::append_show_index() +int spider_mbase_share::append_show_index() { int roop_count; spider_string *str; - uint dbton_id = spider_dbton_mysql.dbton_id; - DBUG_ENTER("spider_mysql_share::append_show_index"); + DBUG_ENTER("spider_mbase_share::append_show_index"); if (!(show_index = new spider_string[2 * spider_share->all_link_count])) goto error; @@ -6113,9 +6335,9 @@ error: DBUG_RETURN(HA_ERR_OUT_OF_MEM); } -void spider_mysql_share::free_show_index() +void spider_mbase_share::free_show_index() { - DBUG_ENTER("spider_mysql_share::free_show_index"); + DBUG_ENTER("spider_mbase_share::free_show_index"); if (show_index) { delete [] show_index; @@ -6124,13 +6346,13 @@ void spider_mysql_share::free_show_index() DBUG_VOID_RETURN; } -int spider_mysql_share::append_table_select() +int spider_mbase_share::append_table_select() { Field **field; uint field_length; spider_string *str = table_select; TABLE_SHARE *table_share = spider_share->table_share; - DBUG_ENTER("spider_mysql_share::append_table_select"); + DBUG_ENTER("spider_mbase_share::append_table_select"); if (!*table_share->field) DBUG_RETURN(0); @@ -6148,7 +6370,7 @@ int spider_mysql_share::append_table_select() DBUG_RETURN(append_from_with_adjusted_table_name(str, &table_select_pos)); } -int spider_mysql_share::append_key_select( +int spider_mbase_share::append_key_select( uint idx ) { KEY_PART_INFO *key_part; @@ -6158,7 +6380,7 @@ int spider_mysql_share::append_key_select( spider_string *str = &key_select[idx]; TABLE_SHARE *table_share = spider_share->table_share; const KEY *key_info = &table_share->key_info[idx]; - DBUG_ENTER("spider_mysql_share::append_key_select"); + DBUG_ENTER("spider_mbase_share::append_key_select"); if (!spider_user_defined_key_parts(key_info)) DBUG_RETURN(0); @@ -6178,14 +6400,14 @@ int spider_mysql_share::append_key_select( DBUG_RETURN(append_from_with_adjusted_table_name(str, &key_select_pos[idx])); } -bool spider_mysql_share::need_change_db_table_name() +bool spider_mbase_share::need_change_db_table_name() { - DBUG_ENTER("spider_mysql_share::need_change_db_table_name"); + DBUG_ENTER("spider_mbase_share::need_change_db_table_name"); DBUG_RETURN(!same_db_table_name); } #ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE -int spider_mysql_share::discover_table_structure( +int spider_mbase_share::discover_table_structure( SPIDER_TRX *trx, SPIDER_SHARE *spider_share, spider_string *str @@ -6193,9 +6415,8 @@ int spider_mysql_share::discover_table_structure( int roop_count, error_num = HA_ERR_WRONG_COMMAND; char sql_buf[MAX_FIELD_WIDTH]; spider_string sql_str(sql_buf, sizeof(sql_buf), system_charset_info); - uint dbton_id = spider_dbton_mysql.dbton_id; uint strlen = str->length(); - DBUG_ENTER("spider_mysql_share::discover_table_structure"); + DBUG_ENTER("spider_mbase_share::discover_table_structure"); DBUG_PRINT("info",("spider this=%p", this)); sql_str.init_calc_mem(228); for (roop_count = 0; roop_count < (int) spider_share->all_link_count; @@ -6454,13 +6675,15 @@ int spider_mysql_share::discover_table_structure( } #endif -spider_mysql_handler::spider_mysql_handler( +spider_mbase_handler::spider_mbase_handler( ha_spider *spider, - spider_mysql_share *db_share + spider_mbase_share *db_share, + spider_db_mbase_util *spider_db_mbase_utility ) : spider_db_handler( spider, db_share ), + spider_db_mbase_utility(spider_db_mbase_utility), where_pos(0), order_pos(0), limit_pos(0), @@ -6484,16 +6707,42 @@ spider_mysql_handler::spider_mysql_handler( mysql_share(db_share), link_for_hash(NULL) { - DBUG_ENTER("spider_mysql_handler::spider_mysql_handler"); + DBUG_ENTER("spider_mbase_handler::spider_mbase_handler"); DBUG_PRINT("info",("spider this=%p", this)); spider_alloc_calc_mem_init(mem_calc, 183); spider_alloc_calc_mem(spider_current_trx, mem_calc, sizeof(*this)); DBUG_VOID_RETURN; } -spider_mysql_handler::~spider_mysql_handler() +spider_mysql_handler::spider_mysql_handler( + ha_spider *spider, + spider_mbase_share *db_share +) : spider_mbase_handler( + spider, + db_share, + &spider_db_mysql_utility +) { + DBUG_ENTER("spider_mysql_handler::spider_mysql_handler"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_mariadb_handler::spider_mariadb_handler( + ha_spider *spider, + spider_mbase_share *db_share +) : spider_mbase_handler( + spider, + db_share, + &spider_db_mariadb_utility +) { + DBUG_ENTER("spider_mariadb_handler::spider_mariadb_handler"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_mbase_handler::~spider_mbase_handler() { - DBUG_ENTER("spider_mysql_handler::~spider_mysql_handler"); + DBUG_ENTER("spider_mbase_handler::~spider_mbase_handler"); DBUG_PRINT("info",("spider this=%p", this)); while (union_table_name_pos_first) { @@ -6509,7 +6758,21 @@ spider_mysql_handler::~spider_mysql_handler() DBUG_VOID_RETURN; } -int spider_mysql_handler::init() +spider_mysql_handler::~spider_mysql_handler() +{ + DBUG_ENTER("spider_mysql_handler::~spider_mysql_handler"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_mariadb_handler::~spider_mariadb_handler() +{ + DBUG_ENTER("spider_mariadb_handler::~spider_mariadb_handler"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +int spider_mbase_handler::init() { uint roop_count; THD *thd = spider->trx->thd; @@ -6517,7 +6780,7 @@ int spider_mysql_handler::init() int init_sql_alloc_size = spider_param_init_sql_alloc_size(thd, share->init_sql_alloc_size); TABLE *table = spider->get_table(); - DBUG_ENTER("spider_mysql_handler::init"); + DBUG_ENTER("spider_mbase_handler::init"); DBUG_PRINT("info",("spider this=%p", this)); sql.init_calc_mem(59); sql_part.init_calc_mem(60); @@ -6572,7 +6835,7 @@ int spider_mysql_handler::init() } -int spider_mysql_handler::append_index_hint( +int spider_mbase_handler::append_index_hint( spider_string *str, int link_idx, ulong sql_type @@ -6583,7 +6846,7 @@ int spider_mysql_handler::append_index_hint( Index_hint *hint; // THD *thd = current_thd; int error_num = 0; - DBUG_ENTER("spider_mysql_handler::append_index_hint"); + DBUG_ENTER("spider_mbase_handler::append_index_hint"); DBUG_PRINT("info",("spider this=%p", this)); while(index_hints && (hint = iter++)) @@ -6626,13 +6889,13 @@ int spider_mysql_handler::append_index_hint( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_table_name_with_adjusting( +int spider_mbase_handler::append_table_name_with_adjusting( spider_string *str, int link_idx, ulong sql_type ) { int error_num = 0; - DBUG_ENTER("spider_mysql_handler::append_table_name_with_adjusting"); + DBUG_ENTER("spider_mbase_handler::append_table_name_with_adjusting"); DBUG_PRINT("info",("spider this=%p", this)); if (sql_type == SPIDER_SQL_TYPE_HANDLER) { @@ -6644,7 +6907,7 @@ int spider_mysql_handler::append_table_name_with_adjusting( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_key_column_types( +int spider_mbase_handler::append_key_column_types( const key_range *start_key, spider_string *str ) { @@ -6658,7 +6921,7 @@ int spider_mysql_handler::append_key_column_types( Field *field; char tmp_buf[MAX_FIELD_WIDTH]; spider_string tmp_str(tmp_buf, sizeof(tmp_buf), system_charset_info); - DBUG_ENTER("spider_mysql_handler::append_key_column_types"); + DBUG_ENTER("spider_mbase_handler::append_key_column_types"); DBUG_PRINT("info",("spider this=%p", this)); tmp_str.init_calc_mem(115); @@ -6712,7 +6975,7 @@ int spider_mysql_handler::append_key_column_types( DBUG_RETURN(0); } -int spider_mysql_handler::append_key_join_columns_for_bka( +int spider_mbase_handler::append_key_join_columns_for_bka( const key_range *start_key, spider_string *str, const char **table_aliases, @@ -6727,7 +6990,7 @@ int spider_mysql_handler::append_key_join_columns_for_bka( Field *field; char tmp_buf[MAX_FIELD_WIDTH]; bool start_where = ((int) str->length() == where_pos); - DBUG_ENTER("spider_mysql_handler::append_key_join_columns_for_bka"); + DBUG_ENTER("spider_mbase_handler::append_key_join_columns_for_bka"); DBUG_PRINT("info",("spider this=%p", this)); start_key_part_map = start_key->keypart_map & full_key_part_map; DBUG_PRINT("info", ("spider spider_user_defined_key_parts=%u", @@ -6776,11 +7039,11 @@ int spider_mysql_handler::append_key_join_columns_for_bka( DBUG_RETURN(0); } -int spider_mysql_handler::append_tmp_table_and_sql_for_bka( +int spider_mbase_handler::append_tmp_table_and_sql_for_bka( const key_range *start_key ) { int error_num; - DBUG_ENTER("spider_mysql_handler::append_tmp_table_and_sql_for_bka"); + DBUG_ENTER("spider_mbase_handler::append_tmp_table_and_sql_for_bka"); DBUG_PRINT("info",("spider this=%p", this)); char tmp_table_name[MAX_FIELD_WIDTH * 2], tgt_table_name[MAX_FIELD_WIDTH * 2]; @@ -6838,7 +7101,7 @@ int spider_mysql_handler::append_tmp_table_and_sql_for_bka( if ( (error_num = append_select_columns_with_alias(&sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)) || - (error_num = spider_db_mysql_utility.append_from_with_alias(&sql, + (error_num = spider_db_mbase_utility->append_from_with_alias(&sql, table_names, table_name_lengths, table_aliases, table_alias_lengths, 2, &table_name_pos, FALSE)) @@ -6878,9 +7141,9 @@ int spider_mysql_handler::append_tmp_table_and_sql_for_bka( DBUG_RETURN(0); } -int spider_mysql_handler::reuse_tmp_table_and_sql_for_bka() +int spider_mbase_handler::reuse_tmp_table_and_sql_for_bka() { - DBUG_ENTER("spider_mysql_handler::reuse_tmp_table_and_sql_for_bka"); + DBUG_ENTER("spider_mbase_handler::reuse_tmp_table_and_sql_for_bka"); DBUG_PRINT("info",("spider this=%p", this)); tmp_sql.length(tmp_sql_pos4); sql.length(limit_pos); @@ -6888,13 +7151,13 @@ int spider_mysql_handler::reuse_tmp_table_and_sql_for_bka() DBUG_RETURN(0); } -void spider_mysql_handler::create_tmp_bka_table_name( +void spider_mbase_handler::create_tmp_bka_table_name( char *tmp_table_name, int *tmp_table_name_length, int link_idx ) { uint adjust_length, length; - DBUG_ENTER("spider_mysql_handler::create_tmp_bka_table_name"); + DBUG_ENTER("spider_mbase_handler::create_tmp_bka_table_name"); if (spider_param_bka_table_name_type(current_thd, mysql_share->spider_share-> bka_table_name_types[spider->conn_link_idx[link_idx]]) == 1) @@ -6936,7 +7199,7 @@ void spider_mysql_handler::create_tmp_bka_table_name( DBUG_VOID_RETURN; } -int spider_mysql_handler::append_create_tmp_bka_table( +int spider_mbase_handler::append_create_tmp_bka_table( const key_range *start_key, spider_string *str, char *tmp_table_name, @@ -6951,7 +7214,7 @@ int spider_mysql_handler::append_create_tmp_bka_table( uint bka_engine_length = strlen(bka_engine), cset_length = strlen(table_charset->csname), coll_length = strlen(table_charset->name); - DBUG_ENTER("spider_mysql_handler::append_create_tmp_bka_table"); + DBUG_ENTER("spider_mbase_handler::append_create_tmp_bka_table"); if (str->reserve(SPIDER_SQL_CREATE_TMP_LEN + tmp_table_name_length + SPIDER_SQL_OPEN_PAREN_LEN + SPIDER_SQL_ID_LEN + SPIDER_SQL_ID_TYPE_LEN + SPIDER_SQL_COMMA_LEN)) @@ -6979,7 +7242,7 @@ int spider_mysql_handler::append_create_tmp_bka_table( DBUG_RETURN(0); } -int spider_mysql_handler::append_drop_tmp_bka_table( +int spider_mbase_handler::append_drop_tmp_bka_table( spider_string *str, char *tmp_table_name, int tmp_table_name_length, @@ -6987,7 +7250,7 @@ int spider_mysql_handler::append_drop_tmp_bka_table( int *drop_table_end_pos, bool with_semicolon ) { - DBUG_ENTER("spider_mysql_handler::append_drop_tmp_bka_table"); + DBUG_ENTER("spider_mbase_handler::append_drop_tmp_bka_table"); if (str->reserve(SPIDER_SQL_DROP_TMP_LEN + tmp_table_name_length + (with_semicolon ? SPIDER_SQL_SEMICOLON_LEN : 0))) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -7000,7 +7263,7 @@ int spider_mysql_handler::append_drop_tmp_bka_table( DBUG_RETURN(0); } -int spider_mysql_handler::append_insert_tmp_bka_table( +int spider_mbase_handler::append_insert_tmp_bka_table( const key_range *start_key, spider_string *str, char *tmp_table_name, @@ -7008,7 +7271,7 @@ int spider_mysql_handler::append_insert_tmp_bka_table( int *db_name_pos ) { int error_num; - DBUG_ENTER("spider_mysql_handler::append_insert_tmp_bka_table"); + DBUG_ENTER("spider_mbase_handler::append_insert_tmp_bka_table"); if (str->reserve(SPIDER_SQL_INSERT_LEN + SPIDER_SQL_INTO_LEN + tmp_table_name_length + SPIDER_SQL_OPEN_PAREN_LEN + SPIDER_SQL_ID_LEN + SPIDER_SQL_COMMA_LEN)) @@ -7031,11 +7294,11 @@ int spider_mysql_handler::append_insert_tmp_bka_table( DBUG_RETURN(0); } -int spider_mysql_handler::append_union_table_and_sql_for_bka( +int spider_mbase_handler::append_union_table_and_sql_for_bka( const key_range *start_key ) { int error_num; - DBUG_ENTER("spider_mysql_handler::append_union_table_and_sql_for_bka"); + DBUG_ENTER("spider_mbase_handler::append_union_table_and_sql_for_bka"); DBUG_PRINT("info",("spider this=%p", this)); char tgt_table_name[MAX_FIELD_WIDTH * 2]; spider_string tgt_table_name_str(tgt_table_name, MAX_FIELD_WIDTH * 2, @@ -7082,7 +7345,7 @@ int spider_mysql_handler::append_union_table_and_sql_for_bka( tmp_sql_pos1 = sql.length(); if ( - (error_num = spider_db_mysql_utility.append_from_with_alias(&tmp_sql, + (error_num = spider_db_mbase_utility->append_from_with_alias(&tmp_sql, table_names, table_name_lengths, table_aliases, table_alias_lengths, 2, &table_name_pos, FALSE)) @@ -7124,15 +7387,15 @@ int spider_mysql_handler::append_union_table_and_sql_for_bka( DBUG_RETURN(0); } -int spider_mysql_handler::reuse_union_table_and_sql_for_bka() +int spider_mbase_handler::reuse_union_table_and_sql_for_bka() { - DBUG_ENTER("spider_mysql_handler::reuse_union_table_and_sql_for_bka"); + DBUG_ENTER("spider_mbase_handler::reuse_union_table_and_sql_for_bka"); DBUG_PRINT("info",("spider this=%p", this)); sql.length(tmp_sql_pos1); DBUG_RETURN(0); } -int spider_mysql_handler::append_insert_for_recovery( +int spider_mbase_handler::append_insert_for_recovery( ulong sql_type, int link_idx ) { @@ -7142,7 +7405,7 @@ int spider_mysql_handler::append_insert_for_recovery( uint field_name_length = 0; bool add_value = FALSE; spider_string *insert_sql; - DBUG_ENTER("spider_mysql_handler::append_insert_for_recovery"); + DBUG_ENTER("spider_mbase_handler::append_insert_for_recovery"); DBUG_PRINT("info",("spider this=%p", this)); if (sql_type == SPIDER_SQL_TYPE_INSERT_SQL) { @@ -7190,7 +7453,7 @@ int spider_mysql_handler::append_insert_for_recovery( insert_sql->q_append(SPIDER_SQL_NULL_STR, SPIDER_SQL_NULL_LEN); } else { if ( - spider_db_mysql_utility. + spider_db_mbase_utility-> append_column_value(spider, insert_sql, *field, NULL, share->access_charset) || insert_sql->reserve(SPIDER_SQL_COMMA_LEN) @@ -7211,13 +7474,13 @@ int spider_mysql_handler::append_insert_for_recovery( DBUG_RETURN(0); } -int spider_mysql_handler::append_update( +int spider_mbase_handler::append_update( const TABLE *table, my_ptrdiff_t ptr_diff ) { int error_num; spider_string *str = &update_sql; - DBUG_ENTER("spider_mysql_handler::append_update"); + DBUG_ENTER("spider_mbase_handler::append_update"); DBUG_PRINT("info",("spider this=%p", this)); if (str->length() > 0) { @@ -7236,7 +7499,7 @@ int spider_mysql_handler::append_update( DBUG_RETURN(0); } -int spider_mysql_handler::append_update( +int spider_mbase_handler::append_update( const TABLE *table, my_ptrdiff_t ptr_diff, int link_idx @@ -7244,7 +7507,7 @@ int spider_mysql_handler::append_update( int error_num; SPIDER_SHARE *share = spider->share; spider_string *str = &spider->result_list.update_sqls[link_idx]; - DBUG_ENTER("spider_mysql_handler::append_update"); + DBUG_ENTER("spider_mbase_handler::append_update"); DBUG_PRINT("info",("spider this=%p", this)); if (str->length() > 0) { @@ -7277,13 +7540,13 @@ int spider_mysql_handler::append_update( DBUG_RETURN(0); } -int spider_mysql_handler::append_delete( +int spider_mbase_handler::append_delete( const TABLE *table, my_ptrdiff_t ptr_diff ) { int error_num; spider_string *str = &update_sql; - DBUG_ENTER("spider_mysql_handler::append_delete"); + DBUG_ENTER("spider_mbase_handler::append_delete"); DBUG_PRINT("info",("spider this=%p", this)); if (str->length() > 0) { @@ -7303,14 +7566,14 @@ int spider_mysql_handler::append_delete( DBUG_RETURN(0); } -int spider_mysql_handler::append_delete( +int spider_mbase_handler::append_delete( const TABLE *table, my_ptrdiff_t ptr_diff, int link_idx ) { int error_num; spider_string *str = &spider->result_list.update_sqls[link_idx]; - DBUG_ENTER("spider_mysql_handler::append_delete"); + DBUG_ENTER("spider_mbase_handler::append_delete"); DBUG_PRINT("info",("spider this=%p", this)); if (str->length() > 0) { @@ -7330,21 +7593,21 @@ int spider_mysql_handler::append_delete( DBUG_RETURN(0); } -int spider_mysql_handler::append_insert_part() +int spider_mbase_handler::append_insert_part() { int error_num; - DBUG_ENTER("spider_mysql_handler::append_insert_part"); + DBUG_ENTER("spider_mbase_handler::append_insert_part"); DBUG_PRINT("info",("spider this=%p", this)); error_num = append_insert(&insert_sql, 0); DBUG_RETURN(error_num); } -int spider_mysql_handler::append_insert( +int spider_mbase_handler::append_insert( spider_string *str, int link_idx ) { SPIDER_SHARE *share = spider->share; - DBUG_ENTER("spider_mysql_handler::append_insert"); + DBUG_ENTER("spider_mbase_handler::append_insert"); if ( ( spider->write_can_replace || @@ -7408,20 +7671,20 @@ int spider_mysql_handler::append_insert( DBUG_RETURN(0); } -int spider_mysql_handler::append_update_part() +int spider_mbase_handler::append_update_part() { int error_num; - DBUG_ENTER("spider_mysql_handler::append_update_part"); + DBUG_ENTER("spider_mbase_handler::append_update_part"); DBUG_PRINT("info",("spider this=%p", this)); error_num = append_update(&update_sql, 0); DBUG_RETURN(error_num); } -int spider_mysql_handler::append_update( +int spider_mbase_handler::append_update( spider_string *str, int link_idx ) { - DBUG_ENTER("spider_mysql_handler::append_update"); + DBUG_ENTER("spider_mbase_handler::append_update"); if (str->reserve(SPIDER_SQL_UPDATE_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_UPDATE_STR, SPIDER_SQL_UPDATE_LEN); @@ -7448,19 +7711,19 @@ int spider_mysql_handler::append_update( DBUG_RETURN(0); } -int spider_mysql_handler::append_delete_part() +int spider_mbase_handler::append_delete_part() { int error_num; - DBUG_ENTER("spider_mysql_handler::append_delete_part"); + DBUG_ENTER("spider_mbase_handler::append_delete_part"); DBUG_PRINT("info",("spider this=%p", this)); error_num = append_delete(&update_sql); DBUG_RETURN(error_num); } -int spider_mysql_handler::append_delete( +int spider_mbase_handler::append_delete( spider_string *str ) { - DBUG_ENTER("spider_mysql_handler::append_delete"); + DBUG_ENTER("spider_mbase_handler::append_delete"); if (str->reserve(SPIDER_SQL_DELETE_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_DELETE_STR, SPIDER_SQL_DELETE_LEN); @@ -7489,22 +7752,22 @@ int spider_mysql_handler::append_delete( #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS -int spider_mysql_handler::append_increment_update_set_part() +int spider_mbase_handler::append_increment_update_set_part() { int error_num; - DBUG_ENTER("spider_mysql_handler::append_increment_update_set_part"); + DBUG_ENTER("spider_mbase_handler::append_increment_update_set_part"); DBUG_PRINT("info",("spider this=%p", this)); error_num = append_increment_update_set(&update_sql); DBUG_RETURN(error_num); } -int spider_mysql_handler::append_increment_update_set( +int spider_mbase_handler::append_increment_update_set( spider_string *str ) { uint field_name_length; uint roop_count; Field *field; - DBUG_ENTER("spider_mysql_handler::append_increment_update_set"); + DBUG_ENTER("spider_mbase_handler::append_increment_update_set"); if (str->reserve(SPIDER_SQL_SET_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_SET_STR, SPIDER_SQL_SET_LEN); @@ -7548,24 +7811,24 @@ int spider_mysql_handler::append_increment_update_set( #endif #endif -int spider_mysql_handler::append_update_set_part() +int spider_mbase_handler::append_update_set_part() { int error_num; - DBUG_ENTER("spider_mysql_handler::append_update_set_part"); + DBUG_ENTER("spider_mbase_handler::append_update_set_part"); DBUG_PRINT("info",("spider this=%p", this)); error_num = append_update_set(&update_sql); where_pos = update_sql.length(); DBUG_RETURN(error_num); } -int spider_mysql_handler::append_update_set( +int spider_mbase_handler::append_update_set( spider_string *str ) { uint field_name_length; SPIDER_SHARE *share = spider->share; TABLE *table = spider->get_table(); Field **fields; - DBUG_ENTER("spider_mysql_handler::append_update_set"); + DBUG_ENTER("spider_mbase_handler::append_update_set"); if (str->reserve(SPIDER_SQL_SET_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_SET_STR, SPIDER_SQL_SET_LEN); @@ -7595,7 +7858,7 @@ int spider_mysql_handler::append_update_set( table->read_set); #endif if ( - spider_db_mysql_utility. + spider_db_mbase_utility-> append_column_value(spider, str, *fields, NULL, share->access_charset) || str->reserve(SPIDER_SQL_COMMA_LEN) @@ -7617,17 +7880,17 @@ int spider_mysql_handler::append_update_set( } #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS -int spider_mysql_handler::append_direct_update_set_part() +int spider_mbase_handler::append_direct_update_set_part() { int error_num; - DBUG_ENTER("spider_mysql_handler::append_direct_update_set_part"); + DBUG_ENTER("spider_mbase_handler::append_direct_update_set_part"); DBUG_PRINT("info",("spider this=%p", this)); error_num = append_direct_update_set(&update_sql); where_pos = update_sql.length(); DBUG_RETURN(error_num); } -int spider_mysql_handler::append_direct_update_set( +int spider_mbase_handler::append_direct_update_set( spider_string *str ) { #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) @@ -7637,7 +7900,7 @@ int spider_mysql_handler::append_direct_update_set( TABLE *table = spider->get_table(); #endif #endif - DBUG_ENTER("spider_mysql_handler::append_direct_update_set"); + DBUG_ENTER("spider_mbase_handler::append_direct_update_set"); if ( spider->direct_update_kinds == SPIDER_SQL_KIND_SQL && spider->direct_update_fields @@ -7646,7 +7909,7 @@ int spider_mysql_handler::append_direct_update_set( DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_SET_STR, SPIDER_SQL_SET_LEN); DBUG_RETURN(spider_db_append_update_columns(spider, str, NULL, 0, - spider_dbton_mysql.dbton_id, FALSE, NULL)); + dbton_id, FALSE, NULL)); } if ( @@ -7687,7 +7950,7 @@ int spider_mysql_handler::append_direct_update_set( table->read_set); #endif if ( - spider_db_mysql_utility. + spider_db_mbase_utility-> append_column_value(spider, str, top_table_field, NULL, share->access_charset) || str->reserve(SPIDER_SQL_COMMA_LEN) @@ -7711,57 +7974,57 @@ int spider_mysql_handler::append_direct_update_set( DBUG_RETURN(0); } -int spider_mysql_handler::append_dup_update_pushdown_part( +int spider_mbase_handler::append_dup_update_pushdown_part( const char *alias, uint alias_length ) { int error_num; - DBUG_ENTER("spider_mysql_handler::append_dup_update_pushdown_part"); + DBUG_ENTER("spider_mbase_handler::append_dup_update_pushdown_part"); DBUG_PRINT("info",("spider this=%p", this)); dup_update_sql.length(0); error_num = append_update_columns(&dup_update_sql, alias, alias_length); DBUG_RETURN(error_num); } -int spider_mysql_handler::append_update_columns_part( +int spider_mbase_handler::append_update_columns_part( const char *alias, uint alias_length ) { int error_num; - DBUG_ENTER("spider_mysql_handler::append_update_columns_part"); + DBUG_ENTER("spider_mbase_handler::append_update_columns_part"); DBUG_PRINT("info",("spider this=%p", this)); error_num = append_update_columns(&update_sql, alias, alias_length); DBUG_RETURN(error_num); } -int spider_mysql_handler::check_update_columns_part() +int spider_mbase_handler::check_update_columns_part() { int error_num; - DBUG_ENTER("spider_mysql_handler::check_update_columns_part"); + DBUG_ENTER("spider_mbase_handler::check_update_columns_part"); DBUG_PRINT("info",("spider this=%p", this)); error_num = append_update_columns(NULL, NULL, 0); DBUG_RETURN(error_num); } -int spider_mysql_handler::append_update_columns( +int spider_mbase_handler::append_update_columns( spider_string *str, const char *alias, uint alias_length ) { int error_num; - DBUG_ENTER("spider_mysql_handler::append_update_columns"); + DBUG_ENTER("spider_mbase_handler::append_update_columns"); error_num = spider_db_append_update_columns(spider, str, - alias, alias_length, spider_dbton_mysql.dbton_id, FALSE, NULL); + alias, alias_length, dbton_id, FALSE, NULL); DBUG_RETURN(error_num); } #endif -int spider_mysql_handler::append_select_part( +int spider_mbase_handler::append_select_part( ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_select_part"); + DBUG_ENTER("spider_mbase_handler::append_select_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -7778,12 +8041,12 @@ int spider_mysql_handler::append_select_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_select( +int spider_mbase_handler::append_select( spider_string *str, ulong sql_type ) { SPIDER_RESULT_LIST *result_list = &spider->result_list; - DBUG_ENTER("spider_mysql_handler::append_select"); + DBUG_ENTER("spider_mbase_handler::append_select"); if (sql_type == SPIDER_SQL_TYPE_HANDLER) { if (str->reserve(SPIDER_SQL_HANDLER_LEN)) @@ -7854,12 +8117,12 @@ int spider_mysql_handler::append_select( DBUG_RETURN(0); } -int spider_mysql_handler::append_table_select_part( +int spider_mbase_handler::append_table_select_part( ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_table_select_part"); + DBUG_ENTER("spider_mbase_handler::append_table_select_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -7873,23 +8136,23 @@ int spider_mysql_handler::append_table_select_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_table_select( +int spider_mbase_handler::append_table_select( spider_string *str ) { - DBUG_ENTER("spider_mysql_handler::append_table_select"); + DBUG_ENTER("spider_mbase_handler::append_table_select"); table_name_pos = str->length() + mysql_share->table_select_pos; if (str->append(*(mysql_share->table_select))) DBUG_RETURN(HA_ERR_OUT_OF_MEM); DBUG_RETURN(0); } -int spider_mysql_handler::append_key_select_part( +int spider_mbase_handler::append_key_select_part( ulong sql_type, uint idx ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_key_select_part"); + DBUG_ENTER("spider_mbase_handler::append_key_select_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -7903,23 +8166,23 @@ int spider_mysql_handler::append_key_select_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_key_select( +int spider_mbase_handler::append_key_select( spider_string *str, uint idx ) { - DBUG_ENTER("spider_mysql_handler::append_key_select"); + DBUG_ENTER("spider_mbase_handler::append_key_select"); table_name_pos = str->length() + mysql_share->key_select_pos[idx]; if (str->append(mysql_share->key_select[idx])) DBUG_RETURN(HA_ERR_OUT_OF_MEM); DBUG_RETURN(0); } -int spider_mysql_handler::append_minimum_select_part( +int spider_mbase_handler::append_minimum_select_part( ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_minimum_select_part"); + DBUG_ENTER("spider_mbase_handler::append_minimum_select_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -7933,7 +8196,7 @@ int spider_mysql_handler::append_minimum_select_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_minimum_select( +int spider_mbase_handler::append_minimum_select( spider_string *str, ulong sql_type ) { @@ -7941,7 +8204,7 @@ int spider_mysql_handler::append_minimum_select( Field **field; int field_length; bool appended = FALSE; - DBUG_ENTER("spider_mysql_handler::append_minimum_select"); + DBUG_ENTER("spider_mbase_handler::append_minimum_select"); minimum_select_bitmap_create(); for (field = table->field; *field; field++) { @@ -7970,7 +8233,7 @@ int spider_mysql_handler::append_minimum_select( DBUG_RETURN(append_from(str, sql_type, first_link_idx)); } -int spider_mysql_handler::append_table_select_with_alias( +int spider_mbase_handler::append_table_select_with_alias( spider_string *str, const char *alias, uint alias_length @@ -7978,7 +8241,7 @@ int spider_mysql_handler::append_table_select_with_alias( TABLE *table = spider->get_table(); Field **field; int field_length; - DBUG_ENTER("spider_mysql_handler::append_table_select_with_alias"); + DBUG_ENTER("spider_mbase_handler::append_table_select_with_alias"); for (field = table->field; *field; field++) { field_length = @@ -7994,7 +8257,7 @@ int spider_mysql_handler::append_table_select_with_alias( DBUG_RETURN(0); } -int spider_mysql_handler::append_key_select_with_alias( +int spider_mbase_handler::append_key_select_with_alias( spider_string *str, const KEY *key_info, const char *alias, @@ -8004,7 +8267,7 @@ int spider_mysql_handler::append_key_select_with_alias( Field *field; uint part_num; int field_length; - DBUG_ENTER("spider_mysql_handler::append_key_select_with_alias"); + DBUG_ENTER("spider_mbase_handler::append_key_select_with_alias"); for (key_part = key_info->key_part, part_num = 0; part_num < spider_user_defined_key_parts(key_info); key_part++, part_num++) { @@ -8021,7 +8284,7 @@ int spider_mysql_handler::append_key_select_with_alias( DBUG_RETURN(0); } -int spider_mysql_handler::append_minimum_select_with_alias( +int spider_mbase_handler::append_minimum_select_with_alias( spider_string *str, const char *alias, uint alias_length @@ -8030,7 +8293,7 @@ int spider_mysql_handler::append_minimum_select_with_alias( Field **field; int field_length; bool appended = FALSE; - DBUG_ENTER("spider_mysql_handler::append_minimum_select_with_alias"); + DBUG_ENTER("spider_mbase_handler::append_minimum_select_with_alias"); minimum_select_bitmap_create(); for (field = table->field; *field; field++) { @@ -8060,14 +8323,14 @@ int spider_mysql_handler::append_minimum_select_with_alias( DBUG_RETURN(0); } -int spider_mysql_handler::append_select_columns_with_alias( +int spider_mbase_handler::append_select_columns_with_alias( spider_string *str, const char *alias, uint alias_length ) { int error_num; SPIDER_RESULT_LIST *result_list = &spider->result_list; - DBUG_ENTER("spider_mysql_handler::append_select_columns_with_alias"); + DBUG_ENTER("spider_mbase_handler::append_select_columns_with_alias"); #ifdef HANDLER_HAS_DIRECT_AGGREGATE if ( result_list->direct_aggregate && @@ -8089,12 +8352,12 @@ int spider_mysql_handler::append_select_columns_with_alias( DBUG_RETURN(append_minimum_select_with_alias(str, alias, alias_length)); } -int spider_mysql_handler::append_hint_after_table_part( +int spider_mbase_handler::append_hint_after_table_part( ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_hint_after_table_part"); + DBUG_ENTER("spider_mbase_handler::append_hint_after_table_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -8118,11 +8381,11 @@ int spider_mysql_handler::append_hint_after_table_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_hint_after_table( +int spider_mbase_handler::append_hint_after_table( spider_string *str ) { int error_num; - DBUG_ENTER("spider_mysql_handler::append_hint_after_table"); + DBUG_ENTER("spider_mbase_handler::append_hint_after_table"); DBUG_PRINT("info",("spider this=%p", this)); if ( mysql_share->key_hint && @@ -8133,10 +8396,10 @@ int spider_mysql_handler::append_hint_after_table( DBUG_RETURN(0); } -void spider_mysql_handler::set_where_pos( +void spider_mbase_handler::set_where_pos( ulong sql_type ) { - DBUG_ENTER("spider_mysql_handler::set_where_pos"); + DBUG_ENTER("spider_mbase_handler::set_where_pos"); switch (sql_type) { case SPIDER_SQL_TYPE_SELECT_SQL: @@ -8158,10 +8421,10 @@ void spider_mysql_handler::set_where_pos( DBUG_VOID_RETURN; } -void spider_mysql_handler::set_where_to_pos( +void spider_mbase_handler::set_where_to_pos( ulong sql_type ) { - DBUG_ENTER("spider_mysql_handler::set_where_to_pos"); + DBUG_ENTER("spider_mbase_handler::set_where_to_pos"); switch (sql_type) { case SPIDER_SQL_TYPE_SELECT_SQL: @@ -8183,23 +8446,23 @@ void spider_mysql_handler::set_where_to_pos( DBUG_VOID_RETURN; } -int spider_mysql_handler::check_item_type( +int spider_mbase_handler::check_item_type( Item *item ) { int error_num; - DBUG_ENTER("spider_mysql_handler::check_item_type"); + DBUG_ENTER("spider_mbase_handler::check_item_type"); DBUG_PRINT("info",("spider this=%p", this)); error_num = spider_db_print_item_type(item, NULL, spider, NULL, NULL, 0, - spider_dbton_mysql.dbton_id, FALSE, NULL); + dbton_id, FALSE, NULL); DBUG_RETURN(error_num); } -int spider_mysql_handler::append_values_connector_part( +int spider_mbase_handler::append_values_connector_part( ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_values_connector_part"); + DBUG_ENTER("spider_mbase_handler::append_values_connector_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -8216,10 +8479,10 @@ int spider_mysql_handler::append_values_connector_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_values_connector( +int spider_mbase_handler::append_values_connector( spider_string *str ) { - DBUG_ENTER("spider_mysql_handler::append_values_connector"); + DBUG_ENTER("spider_mbase_handler::append_values_connector"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN + SPIDER_SQL_COMMA_LEN + SPIDER_SQL_OPEN_PAREN_LEN)) @@ -8230,12 +8493,12 @@ int spider_mysql_handler::append_values_connector( DBUG_RETURN(0); } -int spider_mysql_handler::append_values_terminator_part( +int spider_mbase_handler::append_values_terminator_part( ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_values_terminator_part"); + DBUG_ENTER("spider_mbase_handler::append_values_terminator_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -8252,22 +8515,22 @@ int spider_mysql_handler::append_values_terminator_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_values_terminator( +int spider_mbase_handler::append_values_terminator( spider_string *str ) { - DBUG_ENTER("spider_mysql_handler::append_values_terminator"); + DBUG_ENTER("spider_mbase_handler::append_values_terminator"); DBUG_PRINT("info",("spider this=%p", this)); str->length(str->length() - SPIDER_SQL_COMMA_LEN - SPIDER_SQL_OPEN_PAREN_LEN); DBUG_RETURN(0); } -int spider_mysql_handler::append_union_table_connector_part( +int spider_mbase_handler::append_union_table_connector_part( ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_union_table_connector_part"); + DBUG_ENTER("spider_mbase_handler::append_union_table_connector_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -8284,10 +8547,10 @@ int spider_mysql_handler::append_union_table_connector_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_union_table_connector( +int spider_mbase_handler::append_union_table_connector( spider_string *str ) { - DBUG_ENTER("spider_mysql_handler::append_union_table_connector"); + DBUG_ENTER("spider_mbase_handler::append_union_table_connector"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve((SPIDER_SQL_SPACE_LEN * 2) + SPIDER_SQL_UNION_ALL_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -8297,12 +8560,12 @@ int spider_mysql_handler::append_union_table_connector( DBUG_RETURN(0); } -int spider_mysql_handler::append_union_table_terminator_part( +int spider_mbase_handler::append_union_table_terminator_part( ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_union_table_terminator_part"); + DBUG_ENTER("spider_mbase_handler::append_union_table_terminator_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -8316,10 +8579,10 @@ int spider_mysql_handler::append_union_table_terminator_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_union_table_terminator( +int spider_mbase_handler::append_union_table_terminator( spider_string *str ) { - DBUG_ENTER("spider_mysql_handler::append_union_table_terminator"); + DBUG_ENTER("spider_mbase_handler::append_union_table_terminator"); DBUG_PRINT("info",("spider this=%p", this)); str->length(str->length() - ((SPIDER_SQL_SPACE_LEN * 2) + SPIDER_SQL_UNION_ALL_LEN)); @@ -8334,13 +8597,13 @@ int spider_mysql_handler::append_union_table_terminator( DBUG_RETURN(0); } -int spider_mysql_handler::append_key_column_values_part( +int spider_mbase_handler::append_key_column_values_part( const key_range *start_key, ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_key_column_values_part"); + DBUG_ENTER("spider_mbase_handler::append_key_column_values_part"); switch (sql_type) { case SPIDER_SQL_TYPE_SELECT_SQL: @@ -8356,7 +8619,7 @@ int spider_mysql_handler::append_key_column_values_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_key_column_values( +int spider_mbase_handler::append_key_column_values( spider_string *str, const key_range *start_key ) { @@ -8372,7 +8635,7 @@ int spider_mysql_handler::append_key_column_values( key_part_map start_key_part_map; KEY_PART_INFO *key_part; Field *field; - DBUG_ENTER("spider_mysql_handler::append_key_column_values"); + DBUG_ENTER("spider_mbase_handler::append_key_column_values"); start_key_part_map = start_key->keypart_map & full_key_part_map; DBUG_PRINT("info", ("spider spider_user_defined_key_parts=%u", spider_user_defined_key_parts(key_info))); @@ -8398,7 +8661,7 @@ int spider_mysql_handler::append_key_column_values( if (error_num > 0) DBUG_RETURN(error_num); } else { - if (spider_db_mysql_utility.append_column_value(spider, str, field, ptr, + if (spider_db_mbase_utility->append_column_value(spider, str, field, ptr, share->access_charset)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); } @@ -8411,13 +8674,13 @@ int spider_mysql_handler::append_key_column_values( DBUG_RETURN(0); } -int spider_mysql_handler::append_key_column_values_with_name_part( +int spider_mbase_handler::append_key_column_values_with_name_part( const key_range *start_key, ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_key_column_values_with_name_part"); + DBUG_ENTER("spider_mbase_handler::append_key_column_values_with_name_part"); switch (sql_type) { case SPIDER_SQL_TYPE_SELECT_SQL: @@ -8433,7 +8696,7 @@ int spider_mysql_handler::append_key_column_values_with_name_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_key_column_values_with_name( +int spider_mbase_handler::append_key_column_values_with_name( spider_string *str, const key_range *start_key ) { @@ -8451,7 +8714,7 @@ int spider_mysql_handler::append_key_column_values_with_name( KEY_PART_INFO *key_part; Field *field; char tmp_buf[MAX_FIELD_WIDTH]; - DBUG_ENTER("spider_mysql_handler::append_key_column_values_with_name"); + DBUG_ENTER("spider_mbase_handler::append_key_column_values_with_name"); start_key_part_map = start_key->keypart_map & full_key_part_map; DBUG_PRINT("info", ("spider spider_user_defined_key_parts=%u", spider_user_defined_key_parts(key_info))); @@ -8479,7 +8742,7 @@ int spider_mysql_handler::append_key_column_values_with_name( if (error_num > 0) DBUG_RETURN(error_num); } else { - if (spider_db_mysql_utility.append_column_value(spider, str, field, ptr, + if (spider_db_mbase_utility->append_column_value(spider, str, field, ptr, share->access_charset)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); } @@ -8496,7 +8759,7 @@ int spider_mysql_handler::append_key_column_values_with_name( DBUG_RETURN(0); } -int spider_mysql_handler::append_key_where_part( +int spider_mbase_handler::append_key_where_part( const key_range *start_key, const key_range *end_key, ulong sql_type @@ -8504,7 +8767,7 @@ int spider_mysql_handler::append_key_where_part( int error_num; spider_string *str, *str_part = NULL, *str_part2 = NULL; bool set_order; - DBUG_ENTER("spider_mysql_handler::append_key_where_part"); + DBUG_ENTER("spider_mbase_handler::append_key_where_part"); switch (sql_type) { case SPIDER_SQL_TYPE_SELECT_SQL: @@ -8539,7 +8802,7 @@ int spider_mysql_handler::append_key_where_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_key_where( +int spider_mbase_handler::append_key_where( spider_string *str, spider_string *str_part, spider_string *str_part2, @@ -8549,14 +8812,14 @@ int spider_mysql_handler::append_key_where( bool set_order ) { int error_num; - DBUG_ENTER("spider_mysql_handler::append_key_where"); + DBUG_ENTER("spider_mbase_handler::append_key_where"); error_num = spider_db_append_key_where_internal(str, str_part, str_part2, start_key, end_key, spider, set_order, sql_type, - spider_dbton_mysql.dbton_id); + dbton_id); DBUG_RETURN(error_num); } -int spider_mysql_handler::append_is_null_part( +int spider_mbase_handler::append_is_null_part( ulong sql_type, KEY_PART_INFO *key_part, const key_range *key, @@ -8566,7 +8829,7 @@ int spider_mysql_handler::append_is_null_part( ) { int error_num; spider_string *str, *str_part = NULL, *str_part2 = NULL; - DBUG_ENTER("spider_mysql_handler::append_is_null_part"); + DBUG_ENTER("spider_mbase_handler::append_is_null_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -8593,7 +8856,7 @@ int spider_mysql_handler::append_is_null_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_is_null( +int spider_mbase_handler::append_is_null( ulong sql_type, spider_string *str, spider_string *str_part, @@ -8604,7 +8867,7 @@ int spider_mysql_handler::append_is_null( bool key_eq, bool tgt_final ) { - DBUG_ENTER("spider_mysql_handler::append_is_null"); + DBUG_ENTER("spider_mbase_handler::append_is_null"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider key_eq=%s", key_eq ? "TRUE" : "FALSE")); if (key_part->null_bit) @@ -8677,14 +8940,14 @@ int spider_mysql_handler::append_is_null( DBUG_RETURN(0); } -int spider_mysql_handler::append_where_terminator_part( +int spider_mbase_handler::append_where_terminator_part( ulong sql_type, bool set_order, int key_count ) { int error_num; spider_string *str, *str_part = NULL, *str_part2 = NULL; - DBUG_ENTER("spider_mysql_handler::append_where_terminator_part"); + DBUG_ENTER("spider_mbase_handler::append_where_terminator_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -8711,7 +8974,7 @@ int spider_mysql_handler::append_where_terminator_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_where_terminator( +int spider_mbase_handler::append_where_terminator( ulong sql_type, spider_string *str, spider_string *str_part, @@ -8720,7 +8983,7 @@ int spider_mysql_handler::append_where_terminator( int key_count ) { SPIDER_RESULT_LIST *result_list = &spider->result_list; - DBUG_ENTER("spider_mysql_handler::append_where_terminator"); + DBUG_ENTER("spider_mbase_handler::append_where_terminator"); DBUG_PRINT("info",("spider this=%p", this)); if (sql_type != SPIDER_SQL_TYPE_HANDLER) { @@ -8750,12 +9013,12 @@ int spider_mysql_handler::append_where_terminator( DBUG_RETURN(0); } -int spider_mysql_handler::append_match_where_part( +int spider_mbase_handler::append_match_where_part( ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_match_where_part"); + DBUG_ENTER("spider_mbase_handler::append_match_where_part"); switch (sql_type) { case SPIDER_SQL_TYPE_SELECT_SQL: @@ -8769,13 +9032,13 @@ int spider_mysql_handler::append_match_where_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_match_where( +int spider_mbase_handler::append_match_where( spider_string *str ) { int error_num; bool first = TRUE; st_spider_ft_info *ft_info = spider->ft_first; - DBUG_ENTER("spider_mysql_handler::append_match_where"); + DBUG_ENTER("spider_mbase_handler::append_match_where"); if (spider->ft_current) { while (TRUE) @@ -8806,7 +9069,7 @@ int spider_mysql_handler::append_match_where( DBUG_RETURN(0); } -int spider_mysql_handler::append_update_where( +int spider_mbase_handler::append_update_where( spider_string *str, const TABLE *table, my_ptrdiff_t ptr_diff @@ -8816,7 +9079,7 @@ int spider_mysql_handler::append_update_where( THD *thd = spider->trx->thd; SPIDER_SHARE *share = spider->share; bool no_pk = (table->s->primary_key == MAX_KEY); - DBUG_ENTER("spider_mysql_handler::append_update_where"); + DBUG_ENTER("spider_mbase_handler::append_update_where"); DBUG_PRINT("info", ("spider table->s->primary_key=%s", table->s->primary_key != MAX_KEY ? "TRUE" : "FALSE")); uint str_len_bakup = str->length(); @@ -8853,7 +9116,7 @@ int spider_mysql_handler::append_update_where( str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN); (*field)->move_field_offset(ptr_diff); if ( - spider_db_mysql_utility. + spider_db_mbase_utility-> append_column_value(spider, str, *field, NULL, share->access_charset) || str->reserve(SPIDER_SQL_AND_LEN) @@ -8893,7 +9156,7 @@ int spider_mysql_handler::append_update_where( str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN); (*field)->move_field_offset(ptr_diff); if ( - spider_db_mysql_utility. + spider_db_mbase_utility-> append_column_value(spider, str, *field, NULL, share->access_charset) || str->reserve(SPIDER_SQL_AND_LEN) @@ -8917,7 +9180,7 @@ int spider_mysql_handler::append_update_where( DBUG_RETURN(0); } -int spider_mysql_handler::append_condition_part( +int spider_mbase_handler::append_condition_part( const char *alias, uint alias_length, ulong sql_type, @@ -8926,7 +9189,7 @@ int spider_mysql_handler::append_condition_part( int error_num; spider_string *str; bool start_where = FALSE; - DBUG_ENTER("spider_mysql_handler::append_condition_part"); + DBUG_ENTER("spider_mbase_handler::append_condition_part"); switch (sql_type) { case SPIDER_SQL_TYPE_SELECT_SQL: @@ -9000,7 +9263,7 @@ int spider_mysql_handler::append_condition_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_condition( +int spider_mbase_handler::append_condition( spider_string *str, const char *alias, uint alias_length, @@ -9009,7 +9272,7 @@ int spider_mysql_handler::append_condition( ) { int error_num, restart_pos = 0, start_where_pos; SPIDER_CONDITION *tmp_cond = spider->condition; - DBUG_ENTER("spider_mysql_handler::append_condition"); + DBUG_ENTER("spider_mbase_handler::append_condition"); if (str && start_where) { start_where_pos = str->length(); @@ -9041,7 +9304,7 @@ int spider_mysql_handler::append_condition( } if ((error_num = spider_db_print_item_type( (Item *) tmp_cond->cond, NULL, spider, str, alias, alias_length, - spider_dbton_mysql.dbton_id, FALSE, NULL))) + dbton_id, FALSE, NULL))) { if (str && error_num == ER_SPIDER_COND_SKIP_NUM) { @@ -9056,7 +9319,7 @@ int spider_mysql_handler::append_condition( DBUG_RETURN(0); } -int spider_mysql_handler::append_match_against_part( +int spider_mbase_handler::append_match_against_part( ulong sql_type, st_spider_ft_info *ft_info, const char *alias, @@ -9064,7 +9327,7 @@ int spider_mysql_handler::append_match_against_part( ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_match_against_part"); + DBUG_ENTER("spider_mbase_handler::append_match_against_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -9078,7 +9341,7 @@ int spider_mysql_handler::append_match_against_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_match_against( +int spider_mbase_handler::append_match_against( spider_string *str, st_spider_ft_info *ft_info, const char *alias, @@ -9092,7 +9355,7 @@ int spider_mysql_handler::append_match_against( int key_count; KEY_PART_INFO *key_part; Field *field; - DBUG_ENTER("spider_mysql_handler::append_match_against"); + DBUG_ENTER("spider_mbase_handler::append_match_against"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_MATCH_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -9141,7 +9404,7 @@ int spider_mysql_handler::append_match_against( tmp_str.append(ft_init_key->ptr(), ft_init_key->length(), ft_init_key->charset()) || str->reserve(tmp_str.length() * 2) || - spider_db_mysql_utility.append_escaped_util(str, tmp_str.get_str()) + spider_db_mbase_utility->append_escaped_util(str, tmp_str.get_str()) ) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->mem_calc(); @@ -9164,14 +9427,14 @@ int spider_mysql_handler::append_match_against( DBUG_RETURN(0); } -int spider_mysql_handler::append_match_select_part( +int spider_mbase_handler::append_match_select_part( ulong sql_type, const char *alias, uint alias_length ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_match_select_part"); + DBUG_ENTER("spider_mbase_handler::append_match_select_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -9185,13 +9448,13 @@ int spider_mysql_handler::append_match_select_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_match_select( +int spider_mbase_handler::append_match_select( spider_string *str, const char *alias, uint alias_length ) { int error_num; - DBUG_ENTER("spider_mysql_handler::append_match_select"); + DBUG_ENTER("spider_mbase_handler::append_match_select"); DBUG_PRINT("info",("spider this=%p", this)); if (spider->ft_current) { @@ -9213,14 +9476,14 @@ int spider_mysql_handler::append_match_select( } #ifdef HANDLER_HAS_DIRECT_AGGREGATE -int spider_mysql_handler::append_sum_select_part( +int spider_mbase_handler::append_sum_select_part( ulong sql_type, const char *alias, uint alias_length ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_sum_select_part"); + DBUG_ENTER("spider_mbase_handler::append_sum_select_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -9234,21 +9497,21 @@ int spider_mysql_handler::append_sum_select_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_sum_select( +int spider_mbase_handler::append_sum_select( spider_string *str, const char *alias, uint alias_length ) { int error_num; st_select_lex *select_lex; - DBUG_ENTER("spider_mysql_handler::append_sum_select"); + DBUG_ENTER("spider_mbase_handler::append_sum_select"); DBUG_PRINT("info",("spider this=%p", this)); select_lex = spider_get_select_lex(spider); JOIN *join = select_lex->join; Item_sum **item_sum_ptr; for (item_sum_ptr = join->sum_funcs; *item_sum_ptr; ++item_sum_ptr) { - if ((error_num = spider_db_mysql_utility.open_item_sum_func(*item_sum_ptr, + if ((error_num = spider_db_mbase_utility->open_item_sum_func(*item_sum_ptr, spider, str, alias, alias_length, FALSE, NULL))) { DBUG_RETURN(error_num); @@ -9261,10 +9524,10 @@ int spider_mysql_handler::append_sum_select( } #endif -void spider_mysql_handler::set_order_pos( +void spider_mbase_handler::set_order_pos( ulong sql_type ) { - DBUG_ENTER("spider_mysql_handler::set_order_pos"); + DBUG_ENTER("spider_mbase_handler::set_order_pos"); switch (sql_type) { case SPIDER_SQL_TYPE_SELECT_SQL: @@ -9287,10 +9550,10 @@ void spider_mysql_handler::set_order_pos( DBUG_VOID_RETURN; } -void spider_mysql_handler::set_order_to_pos( +void spider_mbase_handler::set_order_to_pos( ulong sql_type ) { - DBUG_ENTER("spider_mysql_handler::set_order_to_pos"); + DBUG_ENTER("spider_mbase_handler::set_order_to_pos"); switch (sql_type) { case SPIDER_SQL_TYPE_SELECT_SQL: @@ -9314,14 +9577,14 @@ void spider_mysql_handler::set_order_to_pos( } #ifdef HANDLER_HAS_DIRECT_AGGREGATE -int spider_mysql_handler::append_group_by_part( +int spider_mbase_handler::append_group_by_part( const char *alias, uint alias_length, ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_group_by_part"); + DBUG_ENTER("spider_mbase_handler::append_group_by_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -9345,14 +9608,14 @@ int spider_mysql_handler::append_group_by_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_group_by( +int spider_mbase_handler::append_group_by( spider_string *str, const char *alias, uint alias_length ) { int error_num; st_select_lex *select_lex; - DBUG_ENTER("spider_mysql_handler::append_group_by"); + DBUG_ENTER("spider_mbase_handler::append_group_by"); DBUG_PRINT("info",("spider this=%p", this)); select_lex = spider_get_select_lex(spider); ORDER *group = (ORDER *) select_lex->group_list.first; @@ -9364,7 +9627,7 @@ int spider_mysql_handler::append_group_by( for (; group; group = group->next) { if ((error_num = spider_db_print_item_type((*group->item), NULL, spider, - str, alias, alias_length, spider_dbton_mysql.dbton_id, FALSE, NULL))) + str, alias, alias_length, dbton_id, FALSE, NULL))) { DBUG_RETURN(error_num); } @@ -9378,14 +9641,14 @@ int spider_mysql_handler::append_group_by( } #endif -int spider_mysql_handler::append_key_order_for_merge_with_alias_part( +int spider_mbase_handler::append_key_order_for_merge_with_alias_part( const char *alias, uint alias_length, ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_key_order_for_merge_with_alias_part"); + DBUG_ENTER("spider_mbase_handler::append_key_order_for_merge_with_alias_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -9410,7 +9673,7 @@ int spider_mysql_handler::append_key_order_for_merge_with_alias_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_key_order_for_merge_with_alias( +int spider_mbase_handler::append_key_order_for_merge_with_alias( spider_string *str, const char *alias, uint alias_length @@ -9420,7 +9683,7 @@ int spider_mysql_handler::append_key_order_for_merge_with_alias( int length; Field *field; uint key_name_length; - DBUG_ENTER("spider_mysql_handler::append_key_order_for_merge_with_alias"); + DBUG_ENTER("spider_mbase_handler::append_key_order_for_merge_with_alias"); DBUG_PRINT("info",("spider this=%p", this)); #ifdef HANDLER_HAS_DIRECT_AGGREGATE if (spider->result_list.direct_aggregate) @@ -9494,14 +9757,14 @@ int spider_mysql_handler::append_key_order_for_merge_with_alias( DBUG_RETURN(0); } -int spider_mysql_handler::append_key_order_for_direct_order_limit_with_alias_part( +int spider_mbase_handler::append_key_order_for_direct_order_limit_with_alias_part( const char *alias, uint alias_length, ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_key_order_for_direct_order_limit_with_alias_part"); + DBUG_ENTER("spider_mbase_handler::append_key_order_for_direct_order_limit_with_alias_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -9526,7 +9789,7 @@ int spider_mysql_handler::append_key_order_for_direct_order_limit_with_alias_par DBUG_RETURN(error_num); } -int spider_mysql_handler::append_key_order_for_direct_order_limit_with_alias( +int spider_mbase_handler::append_key_order_for_direct_order_limit_with_alias( spider_string *str, const char *alias, uint alias_length @@ -9536,7 +9799,7 @@ int spider_mysql_handler::append_key_order_for_direct_order_limit_with_alias( st_select_lex *select_lex; longlong select_limit; longlong offset_limit; - DBUG_ENTER("spider_mysql_handler::append_key_order_for_direct_order_limit_with_alias"); + DBUG_ENTER("spider_mbase_handler::append_key_order_for_direct_order_limit_with_alias"); DBUG_PRINT("info",("spider this=%p", this)); #ifdef HANDLER_HAS_DIRECT_AGGREGATE if (spider->result_list.direct_aggregate) @@ -9557,7 +9820,7 @@ int spider_mysql_handler::append_key_order_for_direct_order_limit_with_alias( { if ((error_num = spider_db_print_item_type((*order->item), NULL, spider, str, alias, - alias_length, spider_dbton_mysql.dbton_id, FALSE, NULL))) + alias_length, dbton_id, FALSE, NULL))) { DBUG_PRINT("info",("spider error=%d", error_num)); DBUG_RETURN(error_num); @@ -9580,14 +9843,14 @@ int spider_mysql_handler::append_key_order_for_direct_order_limit_with_alias( DBUG_RETURN(0); } -int spider_mysql_handler::append_key_order_with_alias_part( +int spider_mbase_handler::append_key_order_with_alias_part( const char *alias, uint alias_length, ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_key_order_with_alias_part"); + DBUG_ENTER("spider_mbase_handler::append_key_order_with_alias_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -9612,12 +9875,12 @@ int spider_mysql_handler::append_key_order_with_alias_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_key_order_for_handler( +int spider_mbase_handler::append_key_order_for_handler( spider_string *str, const char *alias, uint alias_length ) { - DBUG_ENTER("spider_mysql_handler::append_key_order_for_handler"); + DBUG_ENTER("spider_mbase_handler::append_key_order_for_handler"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider ha_next_pos=%d", ha_next_pos)); DBUG_PRINT("info",("spider ha_where_pos=%d", ha_where_pos)); @@ -9627,7 +9890,7 @@ int spider_mysql_handler::append_key_order_for_handler( DBUG_RETURN(0); } -int spider_mysql_handler::append_key_order_with_alias( +int spider_mbase_handler::append_key_order_with_alias( spider_string *str, const char *alias, uint alias_length @@ -9638,7 +9901,7 @@ int spider_mysql_handler::append_key_order_with_alias( KEY_PART_INFO *key_part; Field *field; uint key_name_length; - DBUG_ENTER("spider_mysql_handler::append_key_order_with_alias"); + DBUG_ENTER("spider_mbase_handler::append_key_order_with_alias"); DBUG_PRINT("info",("spider this=%p", this)); #ifdef HANDLER_HAS_DIRECT_AGGREGATE if (spider->result_list.direct_aggregate) @@ -9793,14 +10056,14 @@ int spider_mysql_handler::append_key_order_with_alias( DBUG_RETURN(0); } -int spider_mysql_handler::append_limit_part( +int spider_mbase_handler::append_limit_part( longlong offset, longlong limit, ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_limit_part"); + DBUG_ENTER("spider_mbase_handler::append_limit_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -9830,14 +10093,14 @@ int spider_mysql_handler::append_limit_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::reappend_limit_part( +int spider_mbase_handler::reappend_limit_part( longlong offset, longlong limit, ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::reappend_limit_part"); + DBUG_ENTER("spider_mbase_handler::reappend_limit_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -9867,14 +10130,14 @@ int spider_mysql_handler::reappend_limit_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_limit( +int spider_mbase_handler::append_limit( spider_string *str, longlong offset, longlong limit ) { char buf[SPIDER_LONGLONG_LEN + 1]; uint32 length; - DBUG_ENTER("spider_mysql_handler::append_limit"); + DBUG_ENTER("spider_mbase_handler::append_limit"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info", ("spider offset=%lld", offset)); DBUG_PRINT("info", ("spider limit=%lld", limit)); @@ -9898,12 +10161,12 @@ int spider_mysql_handler::append_limit( DBUG_RETURN(0); } -int spider_mysql_handler::append_select_lock_part( +int spider_mbase_handler::append_select_lock_part( ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_select_lock_part"); + DBUG_ENTER("spider_mbase_handler::append_select_lock_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -9917,11 +10180,11 @@ int spider_mysql_handler::append_select_lock_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_select_lock( +int spider_mbase_handler::append_select_lock( spider_string *str ) { int lock_mode = spider_conn_lock_mode(spider); - DBUG_ENTER("spider_mysql_handler::append_select_lock"); + DBUG_ENTER("spider_mbase_handler::append_select_lock"); DBUG_PRINT("info",("spider this=%p", this)); if (lock_mode == SPIDER_LOCK_MODE_EXCLUSIVE) { @@ -9937,12 +10200,12 @@ int spider_mysql_handler::append_select_lock( DBUG_RETURN(0); } -int spider_mysql_handler::append_union_all_start_part( +int spider_mbase_handler::append_union_all_start_part( ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_union_all_start_part"); + DBUG_ENTER("spider_mbase_handler::append_union_all_start_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -9956,10 +10219,10 @@ int spider_mysql_handler::append_union_all_start_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_union_all_start( +int spider_mbase_handler::append_union_all_start( spider_string *str ) { - DBUG_ENTER("spider_mysql_handler::append_union_all_start"); + DBUG_ENTER("spider_mbase_handler::append_union_all_start"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_OPEN_PAREN_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -9967,12 +10230,12 @@ int spider_mysql_handler::append_union_all_start( DBUG_RETURN(0); } -int spider_mysql_handler::append_union_all_part( +int spider_mbase_handler::append_union_all_part( ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_union_all_part"); + DBUG_ENTER("spider_mbase_handler::append_union_all_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -9986,10 +10249,10 @@ int spider_mysql_handler::append_union_all_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_union_all( +int spider_mbase_handler::append_union_all( spider_string *str ) { - DBUG_ENTER("spider_mysql_handler::append_union_all"); + DBUG_ENTER("spider_mbase_handler::append_union_all"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_UNION_ALL_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -9997,12 +10260,12 @@ int spider_mysql_handler::append_union_all( DBUG_RETURN(0); } -int spider_mysql_handler::append_union_all_end_part( +int spider_mbase_handler::append_union_all_end_part( ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_union_all_end_part"); + DBUG_ENTER("spider_mbase_handler::append_union_all_end_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -10016,24 +10279,24 @@ int spider_mysql_handler::append_union_all_end_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_union_all_end( +int spider_mbase_handler::append_union_all_end( spider_string *str ) { - DBUG_ENTER("spider_mysql_handler::append_union_all_end"); + DBUG_ENTER("spider_mbase_handler::append_union_all_end"); DBUG_PRINT("info",("spider this=%p", this)); str->length(str->length() - SPIDER_SQL_UNION_ALL_LEN + SPIDER_SQL_CLOSE_PAREN_LEN); DBUG_RETURN(0); } -int spider_mysql_handler::append_multi_range_cnt_part( +int spider_mbase_handler::append_multi_range_cnt_part( ulong sql_type, uint multi_range_cnt, bool with_comma ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_multi_range_cnt_part"); + DBUG_ENTER("spider_mbase_handler::append_multi_range_cnt_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -10050,14 +10313,14 @@ int spider_mysql_handler::append_multi_range_cnt_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_multi_range_cnt( +int spider_mbase_handler::append_multi_range_cnt( spider_string *str, uint multi_range_cnt, bool with_comma ) { int range_cnt_length; char range_cnt_str[SPIDER_SQL_INT_LEN]; - DBUG_ENTER("spider_mysql_handler::append_multi_range_cnt"); + DBUG_ENTER("spider_mbase_handler::append_multi_range_cnt"); DBUG_PRINT("info",("spider this=%p", this)); range_cnt_length = my_sprintf(range_cnt_str, (range_cnt_str, "%u", multi_range_cnt)); @@ -10075,13 +10338,13 @@ int spider_mysql_handler::append_multi_range_cnt( DBUG_RETURN(0); } -int spider_mysql_handler::append_multi_range_cnt_with_name_part( +int spider_mbase_handler::append_multi_range_cnt_with_name_part( ulong sql_type, uint multi_range_cnt ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_multi_range_cnt_with_name_part"); + DBUG_ENTER("spider_mbase_handler::append_multi_range_cnt_with_name_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -10098,13 +10361,13 @@ int spider_mysql_handler::append_multi_range_cnt_with_name_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_multi_range_cnt_with_name( +int spider_mbase_handler::append_multi_range_cnt_with_name( spider_string *str, uint multi_range_cnt ) { int range_cnt_length; char range_cnt_str[SPIDER_SQL_INT_LEN]; - DBUG_ENTER("spider_mysql_handler::append_multi_range_cnt_with_name"); + DBUG_ENTER("spider_mbase_handler::append_multi_range_cnt_with_name"); DBUG_PRINT("info",("spider this=%p", this)); range_cnt_length = my_sprintf(range_cnt_str, (range_cnt_str, "%u", multi_range_cnt)); @@ -10118,7 +10381,7 @@ int spider_mysql_handler::append_multi_range_cnt_with_name( DBUG_RETURN(0); } -int spider_mysql_handler::append_open_handler_part( +int spider_mbase_handler::append_open_handler_part( ulong sql_type, uint handler_id, SPIDER_CONN *conn, @@ -10126,7 +10389,7 @@ int spider_mysql_handler::append_open_handler_part( ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_open_handler_part"); + DBUG_ENTER("spider_mbase_handler::append_open_handler_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -10141,14 +10404,14 @@ int spider_mysql_handler::append_open_handler_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_open_handler( +int spider_mbase_handler::append_open_handler( spider_string *str, uint handler_id, SPIDER_CONN *conn, int link_idx ) { int error_num; - DBUG_ENTER("spider_mysql_handler::append_open_handler"); + DBUG_ENTER("spider_mbase_handler::append_open_handler"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider link_idx=%d", link_idx)); DBUG_PRINT("info",("spider m_handler_cid=%s", @@ -10172,13 +10435,13 @@ int spider_mysql_handler::append_open_handler( DBUG_RETURN(0); } -int spider_mysql_handler::append_close_handler_part( +int spider_mbase_handler::append_close_handler_part( ulong sql_type, int link_idx ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_close_handler_part"); + DBUG_ENTER("spider_mbase_handler::append_close_handler_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -10193,11 +10456,11 @@ int spider_mysql_handler::append_close_handler_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_close_handler( +int spider_mbase_handler::append_close_handler( spider_string *str, int link_idx ) { - DBUG_ENTER("spider_mysql_handler::append_close_handler"); + DBUG_ENTER("spider_mbase_handler::append_close_handler"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_HANDLER_LEN + SPIDER_SQL_CLOSE_LEN + SPIDER_SQL_HANDLER_CID_LEN)) @@ -10209,12 +10472,12 @@ int spider_mysql_handler::append_close_handler( DBUG_RETURN(0); } -int spider_mysql_handler::append_insert_terminator_part( +int spider_mbase_handler::append_insert_terminator_part( ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_insert_terminator_part"); + DBUG_ENTER("spider_mbase_handler::append_insert_terminator_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -10228,10 +10491,10 @@ int spider_mysql_handler::append_insert_terminator_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_insert_terminator( +int spider_mbase_handler::append_insert_terminator( spider_string *str ) { - DBUG_ENTER("spider_mysql_handler::append_insert_terminator"); + DBUG_ENTER("spider_mbase_handler::append_insert_terminator"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider dup_update_sql.length=%u", dup_update_sql.length())); if ( @@ -10256,12 +10519,12 @@ int spider_mysql_handler::append_insert_terminator( DBUG_RETURN(0); } -int spider_mysql_handler::append_insert_values_part( +int spider_mbase_handler::append_insert_values_part( ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_insert_values_part"); + DBUG_ENTER("spider_mbase_handler::append_insert_values_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -10275,14 +10538,14 @@ int spider_mysql_handler::append_insert_values_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_insert_values( +int spider_mbase_handler::append_insert_values( spider_string *str ) { SPIDER_SHARE *share = spider->share; TABLE *table = spider->get_table(); Field **field; bool add_value = FALSE; - DBUG_ENTER("spider_mysql_handler::append_insert_values"); + DBUG_ENTER("spider_mbase_handler::append_insert_values"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_OPEN_PAREN_LEN)) { @@ -10329,7 +10592,7 @@ int spider_mysql_handler::append_insert_values( str->q_append(SPIDER_SQL_NULL_STR, SPIDER_SQL_NULL_LEN); } else { if ( - spider_db_mysql_utility. + spider_db_mbase_utility-> append_column_value(spider, str, *field, NULL, share->access_charset) || str->reserve(SPIDER_SQL_COMMA_LEN) @@ -10359,12 +10622,12 @@ int spider_mysql_handler::append_insert_values( DBUG_RETURN(0); } -int spider_mysql_handler::append_into_part( +int spider_mbase_handler::append_into_part( ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_into_part"); + DBUG_ENTER("spider_mbase_handler::append_into_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -10378,13 +10641,13 @@ int spider_mysql_handler::append_into_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_into( +int spider_mbase_handler::append_into( spider_string *str ) { const TABLE *table = spider->get_table(); Field **field; uint field_name_length = 0; - DBUG_ENTER("spider_mysql_handler::append_into"); + DBUG_ENTER("spider_mbase_handler::append_into"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_INTO_LEN + mysql_share->db_nm_max_length + SPIDER_SQL_DOT_LEN + mysql_share->table_nm_max_length + @@ -10420,10 +10683,10 @@ int spider_mysql_handler::append_into( DBUG_RETURN(0); } -void spider_mysql_handler::set_insert_to_pos( +void spider_mbase_handler::set_insert_to_pos( ulong sql_type ) { - DBUG_ENTER("spider_mysql_handler::set_insert_to_pos"); + DBUG_ENTER("spider_mbase_handler::set_insert_to_pos"); switch (sql_type) { case SPIDER_SQL_TYPE_INSERT_SQL: @@ -10436,13 +10699,13 @@ void spider_mysql_handler::set_insert_to_pos( DBUG_VOID_RETURN; } -int spider_mysql_handler::append_from_part( +int spider_mbase_handler::append_from_part( ulong sql_type, int link_idx ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_from_part"); + DBUG_ENTER("spider_mbase_handler::append_from_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -10462,12 +10725,12 @@ int spider_mysql_handler::append_from_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_from( +int spider_mbase_handler::append_from( spider_string *str, ulong sql_type, int link_idx ) { - DBUG_ENTER("spider_mysql_handler::append_from"); + DBUG_ENTER("spider_mbase_handler::append_from"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider link_idx=%d", link_idx)); int error_num = 0; @@ -10501,14 +10764,14 @@ int spider_mysql_handler::append_from( DBUG_RETURN(0); } -int spider_mysql_handler::append_flush_tables_part( +int spider_mbase_handler::append_flush_tables_part( ulong sql_type, int link_idx, bool lock ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_flush_tables_part"); + DBUG_ENTER("spider_mbase_handler::append_flush_tables_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -10522,12 +10785,12 @@ int spider_mysql_handler::append_flush_tables_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_flush_tables( +int spider_mbase_handler::append_flush_tables( spider_string *str, int link_idx, bool lock ) { - DBUG_ENTER("spider_mysql_handler::append_flush_tables"); + DBUG_ENTER("spider_mbase_handler::append_flush_tables"); DBUG_PRINT("info",("spider this=%p", this)); if (lock) { @@ -10545,13 +10808,13 @@ int spider_mysql_handler::append_flush_tables( DBUG_RETURN(0); } -int spider_mysql_handler::append_optimize_table_part( +int spider_mbase_handler::append_optimize_table_part( ulong sql_type, int link_idx ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_optimize_table_part"); + DBUG_ENTER("spider_mbase_handler::append_optimize_table_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -10565,7 +10828,7 @@ int spider_mysql_handler::append_optimize_table_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_optimize_table( +int spider_mbase_handler::append_optimize_table( spider_string *str, int link_idx ) { @@ -10573,7 +10836,7 @@ int spider_mysql_handler::append_optimize_table( int conn_link_idx = spider->conn_link_idx[link_idx]; int local_length = spider_param_internal_optimize_local(spider->trx->thd, share->internal_optimize_local) * SPIDER_SQL_SQL_LOCAL_LEN; - DBUG_ENTER("spider_mysql_handler::append_optimize_table"); + DBUG_ENTER("spider_mbase_handler::append_optimize_table"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_SQL_OPTIMIZE_LEN + SPIDER_SQL_SQL_TABLE_LEN + local_length + @@ -10590,13 +10853,13 @@ int spider_mysql_handler::append_optimize_table( DBUG_RETURN(0); } -int spider_mysql_handler::append_analyze_table_part( +int spider_mbase_handler::append_analyze_table_part( ulong sql_type, int link_idx ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_analyze_table_part"); + DBUG_ENTER("spider_mbase_handler::append_analyze_table_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -10610,7 +10873,7 @@ int spider_mysql_handler::append_analyze_table_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_analyze_table( +int spider_mbase_handler::append_analyze_table( spider_string *str, int link_idx ) { @@ -10618,7 +10881,7 @@ int spider_mysql_handler::append_analyze_table( int conn_link_idx = spider->conn_link_idx[link_idx]; int local_length = spider_param_internal_optimize_local(spider->trx->thd, share->internal_optimize_local) * SPIDER_SQL_SQL_LOCAL_LEN; - DBUG_ENTER("spider_mysql_handler::append_analyze_table"); + DBUG_ENTER("spider_mbase_handler::append_analyze_table"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_SQL_ANALYZE_LEN + SPIDER_SQL_SQL_TABLE_LEN + local_length + @@ -10635,14 +10898,14 @@ int spider_mysql_handler::append_analyze_table( DBUG_RETURN(0); } -int spider_mysql_handler::append_repair_table_part( +int spider_mbase_handler::append_repair_table_part( ulong sql_type, int link_idx, HA_CHECK_OPT* check_opt ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_repair_table_part"); + DBUG_ENTER("spider_mbase_handler::append_repair_table_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -10656,7 +10919,7 @@ int spider_mysql_handler::append_repair_table_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_repair_table( +int spider_mbase_handler::append_repair_table( spider_string *str, int link_idx, HA_CHECK_OPT* check_opt @@ -10665,7 +10928,7 @@ int spider_mysql_handler::append_repair_table( int conn_link_idx = spider->conn_link_idx[link_idx]; int local_length = spider_param_internal_optimize_local(spider->trx->thd, share->internal_optimize_local) * SPIDER_SQL_SQL_LOCAL_LEN; - DBUG_ENTER("spider_mysql_handler::append_repair_table"); + DBUG_ENTER("spider_mbase_handler::append_repair_table"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_SQL_REPAIR_LEN + SPIDER_SQL_SQL_TABLE_LEN + local_length + @@ -10700,14 +10963,14 @@ int spider_mysql_handler::append_repair_table( DBUG_RETURN(0); } -int spider_mysql_handler::append_check_table_part( +int spider_mbase_handler::append_check_table_part( ulong sql_type, int link_idx, HA_CHECK_OPT* check_opt ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_check_table_part"); + DBUG_ENTER("spider_mbase_handler::append_check_table_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -10721,13 +10984,13 @@ int spider_mysql_handler::append_check_table_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_check_table( +int spider_mbase_handler::append_check_table( spider_string *str, int link_idx, HA_CHECK_OPT* check_opt ) { int conn_link_idx = spider->conn_link_idx[link_idx]; - DBUG_ENTER("spider_mysql_handler::append_check_table"); + DBUG_ENTER("spider_mbase_handler::append_check_table"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_SQL_CHECK_TABLE_LEN + mysql_share->db_names_str[conn_link_idx].length() + @@ -10765,13 +11028,13 @@ int spider_mysql_handler::append_check_table( DBUG_RETURN(0); } -int spider_mysql_handler::append_enable_keys_part( +int spider_mbase_handler::append_enable_keys_part( ulong sql_type, int link_idx ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_enable_keys_part"); + DBUG_ENTER("spider_mbase_handler::append_enable_keys_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -10785,12 +11048,12 @@ int spider_mysql_handler::append_enable_keys_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_enable_keys( +int spider_mbase_handler::append_enable_keys( spider_string *str, int link_idx ) { int conn_link_idx = spider->conn_link_idx[link_idx]; - DBUG_ENTER("spider_mysql_handler::append_enable_keys"); + DBUG_ENTER("spider_mbase_handler::append_enable_keys"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_SQL_ALTER_TABLE_LEN + mysql_share->db_names_str[conn_link_idx].length() + @@ -10806,13 +11069,13 @@ int spider_mysql_handler::append_enable_keys( DBUG_RETURN(0); } -int spider_mysql_handler::append_disable_keys_part( +int spider_mbase_handler::append_disable_keys_part( ulong sql_type, int link_idx ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_disable_keys_part"); + DBUG_ENTER("spider_mbase_handler::append_disable_keys_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -10826,12 +11089,12 @@ int spider_mysql_handler::append_disable_keys_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_disable_keys( +int spider_mbase_handler::append_disable_keys( spider_string *str, int link_idx ) { int conn_link_idx = spider->conn_link_idx[link_idx]; - DBUG_ENTER("spider_mysql_handler::append_disable_keys"); + DBUG_ENTER("spider_mbase_handler::append_disable_keys"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_SQL_ALTER_TABLE_LEN + mysql_share->db_names_str[conn_link_idx].length() + @@ -10847,12 +11110,12 @@ int spider_mysql_handler::append_disable_keys( DBUG_RETURN(0); } -int spider_mysql_handler::append_delete_all_rows_part( +int spider_mbase_handler::append_delete_all_rows_part( ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_delete_all_rows_part"); + DBUG_ENTER("spider_mbase_handler::append_delete_all_rows_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -10866,12 +11129,12 @@ int spider_mysql_handler::append_delete_all_rows_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_delete_all_rows( +int spider_mbase_handler::append_delete_all_rows( spider_string *str, ulong sql_type ) { int error_num; - DBUG_ENTER("spider_mysql_handler::append_delete_all_rows"); + DBUG_ENTER("spider_mbase_handler::append_delete_all_rows"); DBUG_PRINT("info",("spider this=%p", this)); if (spider->sql_command == SQLCOM_TRUNCATE) { @@ -10887,12 +11150,12 @@ int spider_mysql_handler::append_delete_all_rows( DBUG_RETURN(0); } -int spider_mysql_handler::append_truncate( +int spider_mbase_handler::append_truncate( spider_string *str, ulong sql_type, int link_idx ) { - DBUG_ENTER("spider_mysql_handler::append_truncate"); + DBUG_ENTER("spider_mbase_handler::append_truncate"); if (str->reserve(SPIDER_SQL_TRUNCATE_TABLE_LEN + mysql_share->db_nm_max_length + SPIDER_SQL_DOT_LEN + mysql_share->table_nm_max_length + @@ -10904,7 +11167,7 @@ int spider_mysql_handler::append_truncate( DBUG_RETURN(0); } -int spider_mysql_handler::append_explain_select_part( +int spider_mbase_handler::append_explain_select_part( key_range *start_key, key_range *end_key, ulong sql_type, @@ -10912,7 +11175,7 @@ int spider_mysql_handler::append_explain_select_part( ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_explain_select_part"); + DBUG_ENTER("spider_mbase_handler::append_explain_select_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -10927,7 +11190,7 @@ int spider_mysql_handler::append_explain_select_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_explain_select( +int spider_mbase_handler::append_explain_select( spider_string *str, key_range *start_key, key_range *end_key, @@ -10935,7 +11198,7 @@ int spider_mysql_handler::append_explain_select( int link_idx ) { int error_num; - DBUG_ENTER("spider_mysql_handler::append_explain_select"); + DBUG_ENTER("spider_mbase_handler::append_explain_select"); DBUG_PRINT("info",("spider this=%p", this)); if (str->reserve(SPIDER_SQL_EXPLAIN_SELECT_LEN)) { @@ -10964,7 +11227,7 @@ int spider_mysql_handler::append_explain_select( * solely of the specified column. * FALSE - otherwise. ********************************************************************/ -bool spider_mysql_handler::is_sole_projection_field( +bool spider_mbase_handler::is_sole_projection_field( uint16 field_index ) { // Determine whether the projection list consists solely of the field of interest @@ -10973,7 +11236,7 @@ bool spider_mysql_handler::is_sole_projection_field( uint16 projection_field_count = 0; uint16 projection_field_index; Field** field; - DBUG_ENTER( "spider_mysql_handler::is_sole_projection_field" ); + DBUG_ENTER( "spider_mbase_handler::is_sole_projection_field" ); for ( field = table->field; *field ; field++ ) { @@ -11012,10 +11275,10 @@ bool spider_mysql_handler::is_sole_projection_field( DBUG_RETURN( FALSE ); } -bool spider_mysql_handler::is_bulk_insert_exec_period( +bool spider_mbase_handler::is_bulk_insert_exec_period( bool bulk_end ) { - DBUG_ENTER("spider_mysql_handler::is_bulk_insert_exec_period"); + DBUG_ENTER("spider_mbase_handler::is_bulk_insert_exec_period"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider insert_sql.length=%u", insert_sql.length())); DBUG_PRINT("info",("spider insert_pos=%d", insert_pos)); @@ -11029,19 +11292,19 @@ bool spider_mysql_handler::is_bulk_insert_exec_period( DBUG_RETURN(FALSE); } -bool spider_mysql_handler::sql_is_filled_up( +bool spider_mbase_handler::sql_is_filled_up( ulong sql_type ) { - DBUG_ENTER("spider_mysql_handler::sql_is_filled_up"); + DBUG_ENTER("spider_mbase_handler::sql_is_filled_up"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(filled_up); } -bool spider_mysql_handler::sql_is_empty( +bool spider_mbase_handler::sql_is_empty( ulong sql_type ) { bool is_empty; - DBUG_ENTER("spider_mysql_handler::sql_is_empty"); + DBUG_ENTER("spider_mbase_handler::sql_is_empty"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -11069,34 +11332,34 @@ bool spider_mysql_handler::sql_is_empty( DBUG_RETURN(is_empty); } -bool spider_mysql_handler::support_multi_split_read() +bool spider_mbase_handler::support_multi_split_read() { - DBUG_ENTER("spider_mysql_handler::support_multi_split_read"); + DBUG_ENTER("spider_mbase_handler::support_multi_split_read"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(TRUE); } -bool spider_mysql_handler::support_bulk_update() +bool spider_mbase_handler::support_bulk_update() { - DBUG_ENTER("spider_mysql_handler::support_bulk_update"); + DBUG_ENTER("spider_mbase_handler::support_bulk_update"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(TRUE); } -int spider_mysql_handler::bulk_tmp_table_insert() +int spider_mbase_handler::bulk_tmp_table_insert() { int error_num; - DBUG_ENTER("spider_mysql_handler::bulk_tmp_table_insert"); + DBUG_ENTER("spider_mbase_handler::bulk_tmp_table_insert"); DBUG_PRINT("info",("spider this=%p", this)); error_num = store_sql_to_bulk_tmp_table(&update_sql, upd_tmp_tbl); DBUG_RETURN(error_num); } -int spider_mysql_handler::bulk_tmp_table_insert( +int spider_mbase_handler::bulk_tmp_table_insert( int link_idx ) { int error_num; - DBUG_ENTER("spider_mysql_handler::bulk_tmp_table_insert"); + DBUG_ENTER("spider_mbase_handler::bulk_tmp_table_insert"); DBUG_PRINT("info",("spider this=%p", this)); error_num = store_sql_to_bulk_tmp_table( &spider->result_list.update_sqls[link_idx], @@ -11104,10 +11367,10 @@ int spider_mysql_handler::bulk_tmp_table_insert( DBUG_RETURN(error_num); } -int spider_mysql_handler::bulk_tmp_table_end_bulk_insert() +int spider_mbase_handler::bulk_tmp_table_end_bulk_insert() { int error_num; - DBUG_ENTER("spider_mysql_handler::bulk_tmp_table_end_bulk_insert"); + DBUG_ENTER("spider_mbase_handler::bulk_tmp_table_end_bulk_insert"); DBUG_PRINT("info",("spider this=%p", this)); if ((error_num = upd_tmp_tbl->file->ha_end_bulk_insert())) { @@ -11116,10 +11379,10 @@ int spider_mysql_handler::bulk_tmp_table_end_bulk_insert() DBUG_RETURN(0); } -int spider_mysql_handler::bulk_tmp_table_rnd_init() +int spider_mbase_handler::bulk_tmp_table_rnd_init() { int error_num; - DBUG_ENTER("spider_mysql_handler::bulk_tmp_table_rnd_init"); + DBUG_ENTER("spider_mbase_handler::bulk_tmp_table_rnd_init"); DBUG_PRINT("info",("spider this=%p", this)); upd_tmp_tbl->file->extra(HA_EXTRA_CACHE); if ((error_num = upd_tmp_tbl->file->ha_rnd_init(TRUE))) @@ -11130,10 +11393,10 @@ int spider_mysql_handler::bulk_tmp_table_rnd_init() DBUG_RETURN(0); } -int spider_mysql_handler::bulk_tmp_table_rnd_next() +int spider_mbase_handler::bulk_tmp_table_rnd_next() { int error_num; - DBUG_ENTER("spider_mysql_handler::bulk_tmp_table_rnd_next"); + DBUG_ENTER("spider_mbase_handler::bulk_tmp_table_rnd_next"); DBUG_PRINT("info",("spider this=%p", this)); #if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200 error_num = upd_tmp_tbl->file->ha_rnd_next(upd_tmp_tbl->record[0]); @@ -11147,10 +11410,10 @@ int spider_mysql_handler::bulk_tmp_table_rnd_next() DBUG_RETURN(error_num); } -int spider_mysql_handler::bulk_tmp_table_rnd_end() +int spider_mbase_handler::bulk_tmp_table_rnd_end() { int error_num; - DBUG_ENTER("spider_mysql_handler::bulk_tmp_table_rnd_end"); + DBUG_ENTER("spider_mbase_handler::bulk_tmp_table_rnd_end"); DBUG_PRINT("info",("spider this=%p", this)); reading_from_bulk_tmp_table = FALSE; if ((error_num = upd_tmp_tbl->file->ha_rnd_end())) @@ -11160,28 +11423,28 @@ int spider_mysql_handler::bulk_tmp_table_rnd_end() DBUG_RETURN(0); } -bool spider_mysql_handler::need_copy_for_update( +bool spider_mbase_handler::need_copy_for_update( int link_idx ) { int all_link_idx = spider->conn_link_idx[link_idx]; - DBUG_ENTER("spider_mysql_handler::need_copy_for_update"); + DBUG_ENTER("spider_mbase_handler::need_copy_for_update"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(!mysql_share->same_db_table_name || spider->share->link_statuses[all_link_idx] == SPIDER_LINK_STATUS_RECOVERY); } -bool spider_mysql_handler::bulk_tmp_table_created() +bool spider_mbase_handler::bulk_tmp_table_created() { - DBUG_ENTER("spider_mysql_handler::bulk_tmp_table_created"); + DBUG_ENTER("spider_mbase_handler::bulk_tmp_table_created"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(upd_tmp_tbl); } -int spider_mysql_handler::mk_bulk_tmp_table_and_bulk_start() +int spider_mbase_handler::mk_bulk_tmp_table_and_bulk_start() { THD *thd = spider->trx->thd; TABLE *table = spider->get_table(); - DBUG_ENTER("spider_mysql_handler::mk_bulk_tmp_table_and_bulk_start"); + DBUG_ENTER("spider_mbase_handler::mk_bulk_tmp_table_and_bulk_start"); DBUG_PRINT("info",("spider this=%p", this)); if (!upd_tmp_tbl) { @@ -11202,9 +11465,9 @@ int spider_mysql_handler::mk_bulk_tmp_table_and_bulk_start() DBUG_RETURN(0); } -void spider_mysql_handler::rm_bulk_tmp_table() +void spider_mbase_handler::rm_bulk_tmp_table() { - DBUG_ENTER("spider_mysql_handler::rm_bulk_tmp_table"); + DBUG_ENTER("spider_mbase_handler::rm_bulk_tmp_table"); DBUG_PRINT("info",("spider this=%p", this)); if (upd_tmp_tbl) { @@ -11214,12 +11477,12 @@ void spider_mysql_handler::rm_bulk_tmp_table() DBUG_VOID_RETURN; } -int spider_mysql_handler::store_sql_to_bulk_tmp_table( +int spider_mbase_handler::store_sql_to_bulk_tmp_table( spider_string *str, TABLE *tmp_table ) { int error_num; - DBUG_ENTER("spider_mysql_handler::store_sql_to_bulk_tmp_table"); + DBUG_ENTER("spider_mbase_handler::store_sql_to_bulk_tmp_table"); DBUG_PRINT("info",("spider this=%p", this)); tmp_table->field[0]->set_notnull(); tmp_table->field[0]->store(str->ptr(), str->length(), str->charset()); @@ -11228,24 +11491,24 @@ int spider_mysql_handler::store_sql_to_bulk_tmp_table( DBUG_RETURN(0); } -int spider_mysql_handler::restore_sql_from_bulk_tmp_table( +int spider_mbase_handler::restore_sql_from_bulk_tmp_table( spider_string *str, TABLE *tmp_table ) { - DBUG_ENTER("spider_mysql_handler::restore_sql_from_bulk_tmp_table"); + DBUG_ENTER("spider_mbase_handler::restore_sql_from_bulk_tmp_table"); DBUG_PRINT("info",("spider this=%p", this)); tmp_table->field[0]->val_str(str->get_str()); str->mem_calc(); DBUG_RETURN(0); } -int spider_mysql_handler::insert_lock_tables_list( +int spider_mbase_handler::insert_lock_tables_list( SPIDER_CONN *conn, int link_idx ) { - spider_db_mysql *db_conn = (spider_db_mysql *) conn->db_conn; + spider_db_mbase *db_conn = (spider_db_mbase *) conn->db_conn; SPIDER_LINK_FOR_HASH *tmp_link_for_hash2 = &link_for_hash[link_idx]; - DBUG_ENTER("spider_mysql_handler::insert_lock_tables_list"); + DBUG_ENTER("spider_mbase_handler::insert_lock_tables_list"); DBUG_PRINT("info",("spider this=%p", this)); uint old_elements = db_conn->lock_table_hash.array.max_element; @@ -11271,7 +11534,7 @@ int spider_mysql_handler::insert_lock_tables_list( DBUG_RETURN(0); } -int spider_mysql_handler::append_lock_tables_list( +int spider_mbase_handler::append_lock_tables_list( SPIDER_CONN *conn, int link_idx, int *appended @@ -11279,8 +11542,8 @@ int spider_mysql_handler::append_lock_tables_list( int error_num; SPIDER_LINK_FOR_HASH *tmp_link_for_hash, *tmp_link_for_hash2; int conn_link_idx = spider->conn_link_idx[link_idx]; - spider_db_mysql *db_conn = (spider_db_mysql *) conn->db_conn; - DBUG_ENTER("spider_mysql_handler::append_lock_tables_list"); + spider_db_mbase *db_conn = (spider_db_mbase *) conn->db_conn; + DBUG_ENTER("spider_mbase_handler::append_lock_tables_list"); DBUG_PRINT("info",("spider this=%p", this)); tmp_link_for_hash2 = &link_for_hash[link_idx]; tmp_link_for_hash2->db_table_str = @@ -11342,14 +11605,14 @@ int spider_mysql_handler::append_lock_tables_list( DBUG_RETURN(0); } -int spider_mysql_handler::realloc_sql( +int spider_mbase_handler::realloc_sql( ulong *realloced ) { THD *thd = spider->trx->thd; st_spider_share *share = spider->share; int init_sql_alloc_size = spider_param_init_sql_alloc_size(thd, share->init_sql_alloc_size); - DBUG_ENTER("spider_mysql_handler::realloc_sql"); + DBUG_ENTER("spider_mbase_handler::realloc_sql"); DBUG_PRINT("info",("spider this=%p", this)); if ((int) sql.alloced_length() > init_sql_alloc_size * 2) { @@ -11396,10 +11659,10 @@ int spider_mysql_handler::realloc_sql( DBUG_RETURN(0); } -int spider_mysql_handler::reset_sql( +int spider_mbase_handler::reset_sql( ulong sql_type ) { - DBUG_ENTER("spider_mysql_handler::reset_sql"); + DBUG_ENTER("spider_mbase_handler::reset_sql"); DBUG_PRINT("info",("spider this=%p", this)); if (sql_type & SPIDER_SQL_TYPE_SELECT_SQL) { @@ -11426,73 +11689,73 @@ int spider_mysql_handler::reset_sql( } #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) -int spider_mysql_handler::reset_keys( +int spider_mbase_handler::reset_keys( ulong sql_type ) { - DBUG_ENTER("spider_mysql_handler::reset_keys"); + DBUG_ENTER("spider_mbase_handler::reset_keys"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_ASSERT(0); DBUG_RETURN(0); } -int spider_mysql_handler::reset_upds( +int spider_mbase_handler::reset_upds( ulong sql_type ) { - DBUG_ENTER("spider_mysql_handler::reset_upds"); + DBUG_ENTER("spider_mbase_handler::reset_upds"); DBUG_PRINT("info",("spider this=%p", this)); hs_upds.clear(); DBUG_RETURN(0); } -int spider_mysql_handler::reset_strs( +int spider_mbase_handler::reset_strs( ulong sql_type ) { - DBUG_ENTER("spider_mysql_handler::reset_strs"); + DBUG_ENTER("spider_mbase_handler::reset_strs"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_ASSERT(0); DBUG_RETURN(0); } -int spider_mysql_handler::reset_strs_pos( +int spider_mbase_handler::reset_strs_pos( ulong sql_type ) { - DBUG_ENTER("spider_mysql_handler::reset_strs_pos"); + DBUG_ENTER("spider_mbase_handler::reset_strs_pos"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_ASSERT(0); DBUG_RETURN(0); } -int spider_mysql_handler::push_back_upds( +int spider_mbase_handler::push_back_upds( SPIDER_HS_STRING_REF &info ) { int error_num; - DBUG_ENTER("spider_mysql_handler::push_back_upds"); + DBUG_ENTER("spider_mbase_handler::push_back_upds"); DBUG_PRINT("info",("spider this=%p", this)); error_num = hs_upds.push_back(info); DBUG_RETURN(error_num); } #endif -bool spider_mysql_handler::need_lock_before_set_sql_for_exec( +bool spider_mbase_handler::need_lock_before_set_sql_for_exec( ulong sql_type ) { - DBUG_ENTER("spider_mysql_handler::need_lock_before_set_sql_for_exec"); + DBUG_ENTER("spider_mbase_handler::need_lock_before_set_sql_for_exec"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(FALSE); } #ifdef SPIDER_HAS_GROUP_BY_HANDLER -int spider_mysql_handler::set_sql_for_exec( +int spider_mbase_handler::set_sql_for_exec( ulong sql_type, int link_idx, SPIDER_LINK_IDX_CHAIN *link_idx_chain ) { int error_num; - DBUG_ENTER("spider_mysql_handler::set_sql_for_exec"); + DBUG_ENTER("spider_mbase_handler::set_sql_for_exec"); DBUG_PRINT("info",("spider this=%p", this)); if (sql_type & SPIDER_SQL_TYPE_SELECT_SQL) { - if ((error_num = spider_db_mysql_utility.reappend_tables( + if ((error_num = spider_db_mbase_utility->reappend_tables( spider->fields, link_idx_chain, &sql))) DBUG_RETURN(error_num); exec_sql = &sql; @@ -11501,7 +11764,7 @@ int spider_mysql_handler::set_sql_for_exec( } #endif -int spider_mysql_handler::set_sql_for_exec( +int spider_mbase_handler::set_sql_for_exec( ulong sql_type, int link_idx ) { @@ -11510,7 +11773,7 @@ int spider_mysql_handler::set_sql_for_exec( SPIDER_SHARE *share = spider->share; SPIDER_RESULT_LIST *result_list = &spider->result_list; int all_link_idx = spider->conn_link_idx[link_idx]; - DBUG_ENTER("spider_mysql_handler::set_sql_for_exec"); + DBUG_ENTER("spider_mbase_handler::set_sql_for_exec"); DBUG_PRINT("info",("spider this=%p", this)); if (sql_type & (SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_TMP_SQL)) { @@ -11561,7 +11824,7 @@ int spider_mysql_handler::set_sql_for_exec( exec_sql->length(table_name_pos); if (result_list->tmp_table_join && spider->bka_mode != 2) { - if ((error_num = spider_db_mysql_utility.append_from_with_alias( + if ((error_num = spider_db_mbase_utility->append_from_with_alias( exec_sql, table_names, table_name_lengths, table_aliases, table_alias_lengths, 2, &table_name_pos, TRUE)) @@ -11683,12 +11946,12 @@ int spider_mysql_handler::set_sql_for_exec( DBUG_RETURN(0); } -int spider_mysql_handler::set_sql_for_exec( +int spider_mbase_handler::set_sql_for_exec( spider_db_copy_table *tgt_ct, ulong sql_type ) { - spider_mysql_copy_table *mysql_ct = (spider_mysql_copy_table *) tgt_ct; - DBUG_ENTER("spider_mysql_handler::set_sql_for_exec"); + spider_mbase_copy_table *mysql_ct = (spider_mbase_copy_table *) tgt_ct; + DBUG_ENTER("spider_mbase_handler::set_sql_for_exec"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -11702,7 +11965,7 @@ int spider_mysql_handler::set_sql_for_exec( DBUG_RETURN(0); } -int spider_mysql_handler::execute_sql( +int spider_mbase_handler::execute_sql( ulong sql_type, SPIDER_CONN *conn, int quick_mode, @@ -11710,7 +11973,7 @@ int spider_mysql_handler::execute_sql( ) { spider_string *tgt_sql; uint tgt_length; - DBUG_ENTER("spider_mysql_handler::execute_sql"); + DBUG_ENTER("spider_mbase_handler::execute_sql"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -11764,23 +12027,23 @@ int spider_mysql_handler::execute_sql( )); } -int spider_mysql_handler::reset() +int spider_mbase_handler::reset() { - DBUG_ENTER("spider_mysql_handler::reset"); + DBUG_ENTER("spider_mbase_handler::reset"); DBUG_PRINT("info",("spider this=%p", this)); update_sql.length(0); DBUG_RETURN(0); } -int spider_mysql_handler::sts_mode_exchange( +int spider_mbase_handler::sts_mode_exchange( int sts_mode ) { - DBUG_ENTER("spider_mysql_handler::sts_mode_exchange"); + DBUG_ENTER("spider_mbase_handler::sts_mode_exchange"); DBUG_PRINT("info",("spider sts_mode=%d", sts_mode)); DBUG_RETURN(sts_mode); } -int spider_mysql_handler::show_table_status( +int spider_mbase_handler::show_table_status( int link_idx, int sts_mode, uint flag @@ -11791,7 +12054,7 @@ int spider_mysql_handler::show_table_status( SPIDER_SHARE *share = spider->share; uint pos = (2 * spider->conn_link_idx[link_idx]); ulonglong auto_increment_value = 0; - DBUG_ENTER("spider_mysql_handler::show_table_status"); + DBUG_ENTER("spider_mbase_handler::show_table_status"); DBUG_PRINT("info",("spider sts_mode=%d", sts_mode)); if (sts_mode == 1) @@ -12087,15 +12350,15 @@ int spider_mysql_handler::show_table_status( DBUG_RETURN(0); } -int spider_mysql_handler::crd_mode_exchange( +int spider_mbase_handler::crd_mode_exchange( int crd_mode ) { - DBUG_ENTER("spider_mysql_handler::crd_mode_exchange"); + DBUG_ENTER("spider_mbase_handler::crd_mode_exchange"); DBUG_PRINT("info",("spider crd_mode=%d", crd_mode)); DBUG_RETURN(crd_mode); } -int spider_mysql_handler::show_index( +int spider_mbase_handler::show_index( int link_idx, int crd_mode ) { @@ -12107,7 +12370,7 @@ int spider_mysql_handler::show_index( int roop_count; longlong *tmp_cardinality; uint pos = (2 * spider->conn_link_idx[link_idx]); - DBUG_ENTER("spider_mysql_handler::show_index"); + DBUG_ENTER("spider_mbase_handler::show_index"); DBUG_PRINT("info",("spider crd_mode=%d", crd_mode)); if (crd_mode == 1) { @@ -12380,7 +12643,7 @@ int spider_mysql_handler::show_index( DBUG_RETURN(0); } -int spider_mysql_handler::show_records( +int spider_mbase_handler::show_records( int link_idx ) { int error_num; @@ -12388,7 +12651,7 @@ int spider_mysql_handler::show_records( SPIDER_DB_RESULT *res; SPIDER_SHARE *share = spider->share; uint pos = spider->conn_link_idx[link_idx]; - DBUG_ENTER("spider_mysql_handler::show_records"); + DBUG_ENTER("spider_mbase_handler::show_records"); pthread_mutex_lock(&conn->mta_conn_mutex); SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; @@ -12493,17 +12756,17 @@ int spider_mysql_handler::show_records( DBUG_RETURN(0); } -int spider_mysql_handler::show_last_insert_id( +int spider_mbase_handler::show_last_insert_id( int link_idx, ulonglong &last_insert_id ) { SPIDER_CONN *conn = spider->conns[link_idx]; - DBUG_ENTER("spider_mysql_handler::show_last_insert_id"); + DBUG_ENTER("spider_mbase_handler::show_last_insert_id"); last_insert_id = conn->db_conn->last_insert_id(); DBUG_RETURN(0); } -ha_rows spider_mysql_handler::explain_select( +ha_rows spider_mbase_handler::explain_select( key_range *start_key, key_range *end_key, int link_idx @@ -12515,7 +12778,7 @@ ha_rows spider_mysql_handler::explain_select( SPIDER_DB_RESULT *res; ha_rows rows; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; - DBUG_ENTER("spider_mysql_handler::explain_select"); + DBUG_ENTER("spider_mbase_handler::explain_select"); if ((error_num = dbton_hdl->append_explain_select_part( start_key, end_key, SPIDER_SQL_TYPE_OTHER_SQL, link_idx))) { @@ -12639,13 +12902,13 @@ ha_rows spider_mysql_handler::explain_select( DBUG_RETURN(rows); } -int spider_mysql_handler::lock_tables( +int spider_mbase_handler::lock_tables( int link_idx ) { int error_num; SPIDER_CONN *conn = spider->conns[link_idx]; spider_string *str = &sql; - DBUG_ENTER("spider_mysql_handler::lock_tables"); + DBUG_ENTER("spider_mbase_handler::lock_tables"); str->length(0); if ((error_num = conn->db_conn->append_lock_tables(str))) { @@ -12692,12 +12955,12 @@ int spider_mysql_handler::lock_tables( DBUG_RETURN(0); } -int spider_mysql_handler::unlock_tables( +int spider_mbase_handler::unlock_tables( int link_idx ) { int error_num; SPIDER_CONN *conn = spider->conns[link_idx]; - DBUG_ENTER("spider_mysql_handler::unlock_tables"); + DBUG_ENTER("spider_mbase_handler::unlock_tables"); if (conn->table_locked) { spider_string *str = &sql; @@ -12728,14 +12991,14 @@ int spider_mysql_handler::unlock_tables( DBUG_RETURN(0); } -int spider_mysql_handler::disable_keys( +int spider_mbase_handler::disable_keys( SPIDER_CONN *conn, int link_idx ) { int error_num; SPIDER_SHARE *share = spider->share; spider_string *str = &spider->result_list.sqls[link_idx]; - DBUG_ENTER("spider_mysql_handler::disable_keys"); + DBUG_ENTER("spider_mbase_handler::disable_keys"); DBUG_PRINT("info",("spider this=%p", this)); str->length(0); if ((error_num = append_disable_keys_part(SPIDER_SQL_TYPE_OTHER_HS, @@ -12777,14 +13040,14 @@ int spider_mysql_handler::disable_keys( DBUG_RETURN(0); } -int spider_mysql_handler::enable_keys( +int spider_mbase_handler::enable_keys( SPIDER_CONN *conn, int link_idx ) { int error_num; SPIDER_SHARE *share = spider->share; spider_string *str = &spider->result_list.sqls[link_idx]; - DBUG_ENTER("spider_mysql_handler::enable_keys"); + DBUG_ENTER("spider_mbase_handler::enable_keys"); DBUG_PRINT("info",("spider this=%p", this)); str->length(0); if ((error_num = append_enable_keys_part(SPIDER_SQL_TYPE_OTHER_HS, @@ -12826,7 +13089,7 @@ int spider_mysql_handler::enable_keys( DBUG_RETURN(0); } -int spider_mysql_handler::check_table( +int spider_mbase_handler::check_table( SPIDER_CONN *conn, int link_idx, HA_CHECK_OPT* check_opt @@ -12834,7 +13097,7 @@ int spider_mysql_handler::check_table( int error_num; SPIDER_SHARE *share = spider->share; spider_string *str = &spider->result_list.sqls[link_idx]; - DBUG_ENTER("spider_mysql_handler::check_table"); + DBUG_ENTER("spider_mbase_handler::check_table"); DBUG_PRINT("info",("spider this=%p", this)); str->length(0); if ((error_num = append_check_table_part(SPIDER_SQL_TYPE_OTHER_HS, @@ -12876,7 +13139,7 @@ int spider_mysql_handler::check_table( DBUG_RETURN(0); } -int spider_mysql_handler::repair_table( +int spider_mbase_handler::repair_table( SPIDER_CONN *conn, int link_idx, HA_CHECK_OPT* check_opt @@ -12884,7 +13147,7 @@ int spider_mysql_handler::repair_table( int error_num; SPIDER_SHARE *share = spider->share; spider_string *str = &spider->result_list.sqls[link_idx]; - DBUG_ENTER("spider_mysql_handler::repair_table"); + DBUG_ENTER("spider_mbase_handler::repair_table"); DBUG_PRINT("info",("spider this=%p", this)); str->length(0); if ((error_num = append_repair_table_part(SPIDER_SQL_TYPE_OTHER_HS, @@ -12926,14 +13189,14 @@ int spider_mysql_handler::repair_table( DBUG_RETURN(0); } -int spider_mysql_handler::analyze_table( +int spider_mbase_handler::analyze_table( SPIDER_CONN *conn, int link_idx ) { int error_num; SPIDER_SHARE *share = spider->share; spider_string *str = &spider->result_list.sqls[link_idx]; - DBUG_ENTER("spider_mysql_handler::analyze_table"); + DBUG_ENTER("spider_mbase_handler::analyze_table"); DBUG_PRINT("info",("spider this=%p", this)); str->length(0); if ((error_num = append_analyze_table_part(SPIDER_SQL_TYPE_OTHER_HS, @@ -12975,14 +13238,14 @@ int spider_mysql_handler::analyze_table( DBUG_RETURN(0); } -int spider_mysql_handler::optimize_table( +int spider_mbase_handler::optimize_table( SPIDER_CONN *conn, int link_idx ) { int error_num; SPIDER_SHARE *share = spider->share; spider_string *str = &spider->result_list.sqls[link_idx]; - DBUG_ENTER("spider_mysql_handler::optimize_table"); + DBUG_ENTER("spider_mbase_handler::optimize_table"); DBUG_PRINT("info",("spider this=%p", this)); str->length(0); if ((error_num = append_optimize_table_part(SPIDER_SQL_TYPE_OTHER_HS, @@ -13024,7 +13287,7 @@ int spider_mysql_handler::optimize_table( DBUG_RETURN(0); } -int spider_mysql_handler::flush_tables( +int spider_mbase_handler::flush_tables( SPIDER_CONN *conn, int link_idx, bool lock @@ -13032,7 +13295,7 @@ int spider_mysql_handler::flush_tables( int error_num; SPIDER_SHARE *share = spider->share; spider_string *str = &spider->result_list.sqls[link_idx]; - DBUG_ENTER("spider_mysql_handler::flush_tables"); + DBUG_ENTER("spider_mbase_handler::flush_tables"); DBUG_PRINT("info",("spider this=%p", this)); str->length(0); if ((error_num = append_flush_tables_part(SPIDER_SQL_TYPE_OTHER_HS, @@ -13057,13 +13320,13 @@ int spider_mysql_handler::flush_tables( DBUG_RETURN(0); } -int spider_mysql_handler::flush_logs( +int spider_mbase_handler::flush_logs( SPIDER_CONN *conn, int link_idx ) { int error_num; SPIDER_SHARE *share = spider->share; - DBUG_ENTER("spider_mysql_handler::flush_logs"); + DBUG_ENTER("spider_mbase_handler::flush_logs"); DBUG_PRINT("info",("spider this=%p", this)); spider_conn_set_timeout_from_share(conn, link_idx, spider->trx->thd, share); @@ -13082,16 +13345,16 @@ int spider_mysql_handler::flush_logs( DBUG_RETURN(0); } -int spider_mysql_handler::insert_opened_handler( +int spider_mbase_handler::insert_opened_handler( SPIDER_CONN *conn, int link_idx ) { - spider_db_mysql *db_conn = (spider_db_mysql *) conn->db_conn; + spider_db_mbase *db_conn = (spider_db_mbase *) conn->db_conn; SPIDER_LINK_FOR_HASH *tmp_link_for_hash = &link_for_hash[link_idx]; DBUG_ASSERT(tmp_link_for_hash->spider == spider); DBUG_ASSERT(tmp_link_for_hash->link_idx == link_idx); uint old_elements = db_conn->handler_open_array.max_element; - DBUG_ENTER("spider_mysql_handler::insert_opened_handler"); + DBUG_ENTER("spider_mbase_handler::insert_opened_handler"); DBUG_PRINT("info",("spider this=%p", this)); if (insert_dynamic(&db_conn->handler_open_array, (uchar*) &tmp_link_for_hash)) @@ -13108,14 +13371,14 @@ int spider_mysql_handler::insert_opened_handler( DBUG_RETURN(0); } -int spider_mysql_handler::delete_opened_handler( +int spider_mbase_handler::delete_opened_handler( SPIDER_CONN *conn, int link_idx ) { - spider_db_mysql *db_conn = (spider_db_mysql *) conn->db_conn; + spider_db_mbase *db_conn = (spider_db_mbase *) conn->db_conn; uint roop_count, elements = db_conn->handler_open_array.elements; SPIDER_LINK_FOR_HASH *tmp_link_for_hash; - DBUG_ENTER("spider_mysql_handler::delete_opened_handler"); + DBUG_ENTER("spider_mbase_handler::delete_opened_handler"); DBUG_PRINT("info",("spider this=%p", this)); for (roop_count = 0; roop_count < elements; roop_count++) { @@ -13131,27 +13394,27 @@ int spider_mysql_handler::delete_opened_handler( DBUG_RETURN(0); } -int spider_mysql_handler::sync_from_clone_source( +int spider_mbase_handler::sync_from_clone_source( spider_db_handler *dbton_hdl ) { - DBUG_ENTER("spider_mysql_handler::sync_from_clone_source"); + DBUG_ENTER("spider_mbase_handler::sync_from_clone_source"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(0); } -bool spider_mysql_handler::support_use_handler( +bool spider_mbase_handler::support_use_handler( int use_handler ) { - DBUG_ENTER("spider_mysql_handler::support_use_handler"); + DBUG_ENTER("spider_mbase_handler::support_use_handler"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_RETURN(TRUE); } -void spider_mysql_handler::minimum_select_bitmap_create() +void spider_mbase_handler::minimum_select_bitmap_create() { TABLE *table = spider->get_table(); Field **field_p; - DBUG_ENTER("spider_mysql_handler::minimum_select_bitmap_create"); + DBUG_ENTER("spider_mbase_handler::minimum_select_bitmap_create"); DBUG_PRINT("info",("spider this=%p", this)); memset(minimum_select_bitmap, 0, no_bytes_in_map(table->read_set)); if ( @@ -13218,10 +13481,10 @@ void spider_mysql_handler::minimum_select_bitmap_create() DBUG_VOID_RETURN; } -bool spider_mysql_handler::minimum_select_bit_is_set( +bool spider_mbase_handler::minimum_select_bit_is_set( uint field_index ) { - DBUG_ENTER("spider_mysql_handler::minimum_select_bit_is_set"); + DBUG_ENTER("spider_mbase_handler::minimum_select_bit_is_set"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider field_index=%u", field_index)); DBUG_PRINT("info",("spider minimum_select_bitmap=%s", @@ -13230,12 +13493,12 @@ bool spider_mysql_handler::minimum_select_bit_is_set( DBUG_RETURN(spider_bit_is_set(minimum_select_bitmap, field_index)); } -void spider_mysql_handler::copy_minimum_select_bitmap( +void spider_mbase_handler::copy_minimum_select_bitmap( uchar *bitmap ) { int roop_count; TABLE *table = spider->get_table(); - DBUG_ENTER("spider_mysql_handler::copy_minimum_select_bitmap"); + DBUG_ENTER("spider_mbase_handler::copy_minimum_select_bitmap"); for (roop_count = 0; roop_count < (int) ((table->s->fields + 7) / 8); roop_count++) @@ -13249,9 +13512,9 @@ void spider_mysql_handler::copy_minimum_select_bitmap( DBUG_VOID_RETURN; } -int spider_mysql_handler::init_union_table_name_pos() +int spider_mbase_handler::init_union_table_name_pos() { - DBUG_ENTER("spider_mysql_handler::init_union_table_name_pos"); + DBUG_ENTER("spider_mbase_handler::init_union_table_name_pos"); DBUG_PRINT("info",("spider this=%p", this)); if (!union_table_name_pos_first) { @@ -13268,9 +13531,9 @@ int spider_mysql_handler::init_union_table_name_pos() DBUG_RETURN(0); } -int spider_mysql_handler::set_union_table_name_pos() +int spider_mbase_handler::set_union_table_name_pos() { - DBUG_ENTER("spider_mysql_handler::set_union_table_name_pos"); + DBUG_ENTER("spider_mbase_handler::set_union_table_name_pos"); DBUG_PRINT("info",("spider this=%p", this)); if (union_table_name_pos_current->tgt_num >= SPIDER_INT_HLD_TGT_SIZE) { @@ -13293,12 +13556,12 @@ int spider_mysql_handler::set_union_table_name_pos() DBUG_RETURN(0); } -int spider_mysql_handler::reset_union_table_name( +int spider_mbase_handler::reset_union_table_name( spider_string *str, int link_idx, ulong sql_type ) { - DBUG_ENTER("spider_mysql_handler::reset_union_table_name"); + DBUG_ENTER("spider_mbase_handler::reset_union_table_name"); DBUG_PRINT("info",("spider this=%p", this)); if (!union_table_name_pos_current) DBUG_RETURN(0); @@ -13321,7 +13584,7 @@ int spider_mysql_handler::reset_union_table_name( } #ifdef SPIDER_HAS_GROUP_BY_HANDLER -int spider_mysql_handler::append_from_and_tables_part( +int spider_mbase_handler::append_from_and_tables_part( spider_fields *fields, ulong sql_type ) { @@ -13329,7 +13592,7 @@ int spider_mysql_handler::append_from_and_tables_part( spider_string *str; SPIDER_TABLE_HOLDER *table_holder; TABLE_LIST *table_list; - DBUG_ENTER("spider_mysql_handler::append_from_and_tables_part"); + DBUG_ENTER("spider_mbase_handler::append_from_and_tables_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -13342,19 +13605,19 @@ int spider_mysql_handler::append_from_and_tables_part( fields->set_pos_to_first_table_holder(); table_holder = fields->get_next_table_holder(); table_list = table_holder->table->pos_in_table_list; - error_num = spider_db_mysql_utility.append_from_and_tables( + error_num = spider_db_mbase_utility->append_from_and_tables( table_holder->spider, fields, str, table_list, fields->get_table_count()); DBUG_RETURN(error_num); } -int spider_mysql_handler::reappend_tables_part( +int spider_mbase_handler::reappend_tables_part( spider_fields *fields, ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::reappend_tables_part"); + DBUG_ENTER("spider_mbase_handler::reappend_tables_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -13364,17 +13627,17 @@ int spider_mysql_handler::reappend_tables_part( default: DBUG_RETURN(0); } - error_num = spider_db_mysql_utility.reappend_tables(fields, + error_num = spider_db_mbase_utility->reappend_tables(fields, link_idx_chain, str); DBUG_RETURN(error_num); } -int spider_mysql_handler::append_where_part( +int spider_mbase_handler::append_where_part( ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_where_part"); + DBUG_ENTER("spider_mbase_handler::append_where_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -13384,16 +13647,16 @@ int spider_mysql_handler::append_where_part( default: DBUG_RETURN(0); } - error_num = spider_db_mysql_utility.append_where(str); + error_num = spider_db_mbase_utility->append_where(str); DBUG_RETURN(error_num); } -int spider_mysql_handler::append_having_part( +int spider_mbase_handler::append_having_part( ulong sql_type ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_having_part"); + DBUG_ENTER("spider_mbase_handler::append_having_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -13403,11 +13666,11 @@ int spider_mysql_handler::append_having_part( default: DBUG_RETURN(0); } - error_num = spider_db_mysql_utility.append_having(str); + error_num = spider_db_mbase_utility->append_having(str); DBUG_RETURN(error_num); } -int spider_mysql_handler::append_item_type_part( +int spider_mbase_handler::append_item_type_part( Item *item, const char *alias, uint alias_length, @@ -13417,7 +13680,7 @@ int spider_mysql_handler::append_item_type_part( ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_item_type_part"); + DBUG_ENTER("spider_mbase_handler::append_item_type_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -13428,11 +13691,11 @@ int spider_mysql_handler::append_item_type_part( DBUG_RETURN(0); } error_num = spider_db_print_item_type(item, NULL, spider, str, - alias, alias_length, spider_dbton_mysql.dbton_id, use_fields, fields); + alias, alias_length, dbton_id, use_fields, fields); DBUG_RETURN(error_num); } -int spider_mysql_handler::append_list_item_select_part( +int spider_mbase_handler::append_list_item_select_part( List<Item> *select, const char *alias, uint alias_length, @@ -13442,7 +13705,7 @@ int spider_mysql_handler::append_list_item_select_part( ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_list_item_select_part"); + DBUG_ENTER("spider_mbase_handler::append_list_item_select_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -13457,7 +13720,7 @@ int spider_mysql_handler::append_list_item_select_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_list_item_select( +int spider_mbase_handler::append_list_item_select( List<Item> *select, spider_string *str, const char *alias, @@ -13466,12 +13729,12 @@ int spider_mysql_handler::append_list_item_select( spider_fields *fields ) { int error_num; - uint dbton_id = spider_dbton_mysql.dbton_id, length; + uint32 length; List_iterator_fast<Item> it(*select); Item *item; Field *field; const char *item_name; - DBUG_ENTER("spider_mysql_handler::append_list_item_select"); + DBUG_ENTER("spider_mbase_handler::append_list_item_select"); DBUG_PRINT("info",("spider this=%p", this)); while ((item = it++)) { @@ -13495,7 +13758,7 @@ int spider_mysql_handler::append_list_item_select( )) DBUG_RETURN(HA_ERR_OUT_OF_MEM); str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN); - if ((error_num = spider_db_mysql_utility.append_name(str, + if ((error_num = spider_db_mbase_utility->append_name(str, item_name, length))) { DBUG_RETURN(error_num); @@ -13506,7 +13769,7 @@ int spider_mysql_handler::append_list_item_select( DBUG_RETURN(0); } -int spider_mysql_handler::append_group_by_part( +int spider_mbase_handler::append_group_by_part( ORDER *order, const char *alias, uint alias_length, @@ -13516,7 +13779,7 @@ int spider_mysql_handler::append_group_by_part( ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_group_by_part"); + DBUG_ENTER("spider_mbase_handler::append_group_by_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -13531,7 +13794,7 @@ int spider_mysql_handler::append_group_by_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_group_by( +int spider_mbase_handler::append_group_by( ORDER *order, spider_string *str, const char *alias, @@ -13540,8 +13803,7 @@ int spider_mysql_handler::append_group_by( spider_fields *fields ) { int error_num; - uint dbton_id = spider_dbton_mysql.dbton_id; - DBUG_ENTER("spider_mysql_handler::append_group_by"); + DBUG_ENTER("spider_mbase_handler::append_group_by"); DBUG_PRINT("info",("spider this=%p", this)); if (order) { @@ -13564,7 +13826,7 @@ int spider_mysql_handler::append_group_by( DBUG_RETURN(0); } -int spider_mysql_handler::append_order_by_part( +int spider_mbase_handler::append_order_by_part( ORDER *order, const char *alias, uint alias_length, @@ -13574,7 +13836,7 @@ int spider_mysql_handler::append_order_by_part( ) { int error_num; spider_string *str; - DBUG_ENTER("spider_mysql_handler::append_order_by_part"); + DBUG_ENTER("spider_mbase_handler::append_order_by_part"); DBUG_PRINT("info",("spider this=%p", this)); switch (sql_type) { @@ -13589,7 +13851,7 @@ int spider_mysql_handler::append_order_by_part( DBUG_RETURN(error_num); } -int spider_mysql_handler::append_order_by( +int spider_mbase_handler::append_order_by( ORDER *order, spider_string *str, const char *alias, @@ -13598,8 +13860,7 @@ int spider_mysql_handler::append_order_by( spider_fields *fields ) { int error_num; - uint dbton_id = spider_dbton_mysql.dbton_id; - DBUG_ENTER("spider_mysql_handler::append_order_by"); + DBUG_ENTER("spider_mbase_handler::append_order_by"); DBUG_PRINT("info",("spider this=%p", this)); if (order) { @@ -13631,18 +13892,45 @@ int spider_mysql_handler::append_order_by( } #endif -spider_mysql_copy_table::spider_mysql_copy_table( - spider_mysql_share *db_share +spider_mbase_copy_table::spider_mbase_copy_table( + spider_mbase_share *db_share ) : spider_db_copy_table( db_share ), mysql_share(db_share) { + DBUG_ENTER("spider_mbase_copy_table::spider_mbase_copy_table"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_mysql_copy_table::spider_mysql_copy_table( + spider_mbase_share *db_share +) : spider_mbase_copy_table( + db_share +) { DBUG_ENTER("spider_mysql_copy_table::spider_mysql_copy_table"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_VOID_RETURN; } +spider_mariadb_copy_table::spider_mariadb_copy_table( + spider_mbase_share *db_share +) : spider_mbase_copy_table( + db_share +) { + DBUG_ENTER("spider_mariadb_copy_table::spider_mariadb_copy_table"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +spider_mbase_copy_table::~spider_mbase_copy_table() +{ + DBUG_ENTER("spider_mbase_copy_table::~spider_mbase_copy_table"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + spider_mysql_copy_table::~spider_mysql_copy_table() { DBUG_ENTER("spider_mysql_copy_table::~spider_mysql_copy_table"); @@ -13650,26 +13938,33 @@ spider_mysql_copy_table::~spider_mysql_copy_table() DBUG_VOID_RETURN; } -int spider_mysql_copy_table::init() +spider_mariadb_copy_table::~spider_mariadb_copy_table() { - DBUG_ENTER("spider_mysql_copy_table::init"); + DBUG_ENTER("spider_mariadb_copy_table::~spider_mariadb_copy_table"); + DBUG_PRINT("info",("spider this=%p", this)); + DBUG_VOID_RETURN; +} + +int spider_mbase_copy_table::init() +{ + DBUG_ENTER("spider_mbase_copy_table::init"); DBUG_PRINT("info",("spider this=%p", this)); sql.init_calc_mem(78); DBUG_RETURN(0); } -void spider_mysql_copy_table::set_sql_charset( +void spider_mbase_copy_table::set_sql_charset( CHARSET_INFO *cs ) { - DBUG_ENTER("spider_mysql_copy_table::set_sql_charset"); + DBUG_ENTER("spider_mbase_copy_table::set_sql_charset"); DBUG_PRINT("info",("spider this=%p", this)); sql.set_charset(cs); DBUG_VOID_RETURN; } -int spider_mysql_copy_table::append_select_str() +int spider_mbase_copy_table::append_select_str() { - DBUG_ENTER("spider_mysql_copy_table::append_select_str"); + DBUG_ENTER("spider_mbase_copy_table::append_select_str"); DBUG_PRINT("info",("spider this=%p", this)); if (sql.reserve(SPIDER_SQL_SELECT_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -13677,10 +13972,10 @@ int spider_mysql_copy_table::append_select_str() DBUG_RETURN(0); } -int spider_mysql_copy_table::append_insert_str( +int spider_mbase_copy_table::append_insert_str( int insert_flg ) { - DBUG_ENTER("spider_mysql_copy_table::append_insert_str"); + DBUG_ENTER("spider_mbase_copy_table::append_insert_str"); DBUG_PRINT("info",("spider this=%p", this)); if (insert_flg & SPIDER_DB_INSERT_REPLACE) { @@ -13719,12 +14014,12 @@ int spider_mysql_copy_table::append_insert_str( DBUG_RETURN(0); } -int spider_mysql_copy_table::append_table_columns( +int spider_mbase_copy_table::append_table_columns( TABLE_SHARE *table_share ) { int error_num; Field **field; - DBUG_ENTER("spider_mysql_copy_table::append_table_columns"); + DBUG_ENTER("spider_mbase_copy_table::append_table_columns"); DBUG_PRINT("info",("spider this=%p", this)); for (field = table_share->field; *field; field++) { @@ -13732,7 +14027,7 @@ int spider_mysql_copy_table::append_table_columns( DBUG_RETURN(HA_ERR_OUT_OF_MEM); sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); if ((error_num = spider_db_append_name_with_quote_str(&sql, - (*field)->field_name, spider_dbton_mysql.dbton_id))) + (*field)->field_name, dbton_id))) DBUG_RETURN(error_num); if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN + SPIDER_SQL_COMMA_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -13743,9 +14038,9 @@ int spider_mysql_copy_table::append_table_columns( DBUG_RETURN(0); } -int spider_mysql_copy_table::append_from_str() +int spider_mbase_copy_table::append_from_str() { - DBUG_ENTER("spider_mysql_copy_table::append_from_str"); + DBUG_ENTER("spider_mbase_copy_table::append_from_str"); DBUG_PRINT("info",("spider this=%p", this)); if (sql.reserve(SPIDER_SQL_FROM_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -13753,40 +14048,40 @@ int spider_mysql_copy_table::append_from_str() DBUG_RETURN(0); } -int spider_mysql_copy_table::append_table_name( +int spider_mbase_copy_table::append_table_name( int link_idx ) { int error_num; - DBUG_ENTER("spider_mysql_copy_table::append_table_name"); + DBUG_ENTER("spider_mbase_copy_table::append_table_name"); DBUG_PRINT("info",("spider this=%p", this)); error_num = mysql_share->append_table_name(&sql, link_idx); DBUG_RETURN(error_num); } -void spider_mysql_copy_table::set_sql_pos() +void spider_mbase_copy_table::set_sql_pos() { - DBUG_ENTER("spider_mysql_copy_table::set_sql_pos"); + DBUG_ENTER("spider_mbase_copy_table::set_sql_pos"); DBUG_PRINT("info",("spider this=%p", this)); pos = sql.length(); DBUG_VOID_RETURN; } -void spider_mysql_copy_table::set_sql_to_pos() +void spider_mbase_copy_table::set_sql_to_pos() { - DBUG_ENTER("spider_mysql_copy_table::set_sql_to_pos"); + DBUG_ENTER("spider_mbase_copy_table::set_sql_to_pos"); DBUG_PRINT("info",("spider this=%p", this)); sql.length(pos); DBUG_VOID_RETURN; } -int spider_mysql_copy_table::append_copy_where( +int spider_mbase_copy_table::append_copy_where( spider_db_copy_table *source_ct, KEY *key_info, ulong *last_row_pos, ulong *last_lengths ) { int error_num, roop_count, roop_count2; - DBUG_ENTER("spider_mysql_copy_table::append_copy_where"); + DBUG_ENTER("spider_mbase_copy_table::append_copy_where"); DBUG_PRINT("info",("spider this=%p", this)); if (sql.reserve(SPIDER_SQL_WHERE_LEN + SPIDER_SQL_OPEN_PAREN_LEN)) { @@ -13832,7 +14127,7 @@ int spider_mysql_copy_table::append_copy_where( DBUG_RETURN(0); } -int spider_mysql_copy_table::append_key_order_str( +int spider_mbase_copy_table::append_key_order_str( KEY *key_info, int start_pos, bool desc_flg @@ -13840,7 +14135,7 @@ int spider_mysql_copy_table::append_key_order_str( int length, error_num; KEY_PART_INFO *key_part; Field *field; - DBUG_ENTER("spider_mysql_copy_table::append_key_order_str"); + DBUG_ENTER("spider_mbase_copy_table::append_key_order_str"); DBUG_PRINT("info",("spider this=%p", this)); if ((int) spider_user_defined_key_parts(key_info) > start_pos) { @@ -13861,7 +14156,7 @@ int spider_mysql_copy_table::append_key_order_str( DBUG_RETURN(HA_ERR_OUT_OF_MEM); sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); if ((error_num = spider_db_append_name_with_quote_str(&sql, - field->field_name, spider_dbton_mysql.dbton_id))) + field->field_name, dbton_id))) DBUG_RETURN(error_num); if (key_part->key_part_flag & HA_REVERSE_SORT) { @@ -13891,7 +14186,7 @@ int spider_mysql_copy_table::append_key_order_str( DBUG_RETURN(HA_ERR_OUT_OF_MEM); sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); if ((error_num = spider_db_append_name_with_quote_str(&sql, - field->field_name, spider_dbton_mysql.dbton_id))) + field->field_name, dbton_id))) DBUG_RETURN(error_num); if (key_part->key_part_flag & HA_REVERSE_SORT) { @@ -13914,13 +14209,13 @@ int spider_mysql_copy_table::append_key_order_str( DBUG_RETURN(0); } -int spider_mysql_copy_table::append_limit( +int spider_mbase_copy_table::append_limit( longlong offset, longlong limit ) { char buf[SPIDER_LONGLONG_LEN + 1]; uint32 length; - DBUG_ENTER("spider_mysql_copy_table::append_limit"); + DBUG_ENTER("spider_mbase_copy_table::append_limit"); DBUG_PRINT("info",("spider this=%p", this)); if (offset || limit < 9223372036854775807LL) { @@ -13942,9 +14237,9 @@ int spider_mysql_copy_table::append_limit( DBUG_RETURN(0); } -int spider_mysql_copy_table::append_into_str() +int spider_mbase_copy_table::append_into_str() { - DBUG_ENTER("spider_mysql_copy_table::append_into_str"); + DBUG_ENTER("spider_mbase_copy_table::append_into_str"); DBUG_PRINT("info",("spider this=%p", this)); if (sql.reserve(SPIDER_SQL_INTO_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -13952,9 +14247,9 @@ int spider_mysql_copy_table::append_into_str() DBUG_RETURN(0); } -int spider_mysql_copy_table::append_open_paren_str() +int spider_mbase_copy_table::append_open_paren_str() { - DBUG_ENTER("spider_mysql_copy_table::append_open_paren_str"); + DBUG_ENTER("spider_mbase_copy_table::append_open_paren_str"); DBUG_PRINT("info",("spider this=%p", this)); if (sql.reserve(SPIDER_SQL_OPEN_PAREN_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -13962,9 +14257,9 @@ int spider_mysql_copy_table::append_open_paren_str() DBUG_RETURN(0); } -int spider_mysql_copy_table::append_values_str() +int spider_mbase_copy_table::append_values_str() { - DBUG_ENTER("spider_mysql_copy_table::append_values_str"); + DBUG_ENTER("spider_mbase_copy_table::append_values_str"); DBUG_PRINT("info",("spider this=%p", this)); if (sql.reserve(SPIDER_SQL_CLOSE_PAREN_LEN + SPIDER_SQL_VALUES_LEN + SPIDER_SQL_OPEN_PAREN_LEN)) @@ -13975,10 +14270,10 @@ int spider_mysql_copy_table::append_values_str() DBUG_RETURN(0); } -int spider_mysql_copy_table::append_select_lock_str( +int spider_mbase_copy_table::append_select_lock_str( int lock_mode ) { - DBUG_ENTER("spider_mysql_copy_table::append_select_lock_str"); + DBUG_ENTER("spider_mbase_copy_table::append_select_lock_str"); DBUG_PRINT("info",("spider this=%p", this)); if (lock_mode == SPIDER_LOCK_MODE_EXCLUSIVE) { @@ -13994,20 +14289,20 @@ int spider_mysql_copy_table::append_select_lock_str( DBUG_RETURN(0); } -int spider_mysql_copy_table::exec_query( +int spider_mbase_copy_table::exec_query( SPIDER_CONN *conn, int quick_mode, int *need_mon ) { int error_num; - DBUG_ENTER("spider_mysql_copy_table::exec_query"); + DBUG_ENTER("spider_mbase_copy_table::exec_query"); DBUG_PRINT("info",("spider this=%p", this)); error_num = spider_db_query(conn, sql.ptr(), sql.length(), quick_mode, need_mon); DBUG_RETURN(error_num); } -int spider_mysql_copy_table::copy_key_row( +int spider_mbase_copy_table::copy_key_row( spider_db_copy_table *source_ct, Field *field, ulong *row_pos, @@ -14016,14 +14311,14 @@ int spider_mysql_copy_table::copy_key_row( const int joint_length ) { int error_num; - spider_string *source_str = &((spider_mysql_copy_table *) source_ct)->sql; - DBUG_ENTER("spider_mysql_copy_table::copy_key_row"); + spider_string *source_str = &((spider_mbase_copy_table *) source_ct)->sql; + DBUG_ENTER("spider_mbase_copy_table::copy_key_row"); DBUG_PRINT("info",("spider this=%p", this)); if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN); if ((error_num = spider_db_append_name_with_quote_str(&sql, - field->field_name, spider_dbton_mysql.dbton_id))) + field->field_name, dbton_id))) DBUG_RETURN(error_num); if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN + joint_length + *length + SPIDER_SQL_AND_LEN)) @@ -14035,12 +14330,12 @@ int spider_mysql_copy_table::copy_key_row( DBUG_RETURN(0); } -int spider_mysql_copy_table::copy_row( +int spider_mbase_copy_table::copy_row( Field *field, SPIDER_DB_ROW *row ) { int error_num; - DBUG_ENTER("spider_mysql_copy_table::copy_row"); + DBUG_ENTER("spider_mbase_copy_table::copy_row"); DBUG_PRINT("info",("spider this=%p", this)); if (row->is_null()) { @@ -14053,7 +14348,7 @@ int spider_mysql_copy_table::copy_row( DBUG_RETURN(HA_ERR_OUT_OF_MEM); sql.q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); if ((error_num = row->append_escaped_to_str(&sql, - spider_dbton_mysql.dbton_id))) + dbton_id))) DBUG_RETURN(error_num); if (sql.reserve(SPIDER_SQL_VALUE_QUOTE_LEN + SPIDER_SQL_COMMA_LEN)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -14068,7 +14363,7 @@ int spider_mysql_copy_table::copy_row( DBUG_RETURN(0); } -int spider_mysql_copy_table::copy_rows( +int spider_mbase_copy_table::copy_rows( TABLE *table, SPIDER_DB_ROW *row, ulong **last_row_pos, @@ -14077,7 +14372,7 @@ int spider_mysql_copy_table::copy_rows( int error_num; Field **field; ulong *lengths2, *row_pos2; - DBUG_ENTER("spider_mysql_copy_table::copy_rows"); + DBUG_ENTER("spider_mbase_copy_table::copy_rows"); DBUG_PRINT("info",("spider this=%p", this)); row_pos2 = *last_row_pos; lengths2 = *last_lengths; @@ -14108,13 +14403,13 @@ int spider_mysql_copy_table::copy_rows( DBUG_RETURN(0); } -int spider_mysql_copy_table::copy_rows( +int spider_mbase_copy_table::copy_rows( TABLE *table, SPIDER_DB_ROW *row ) { int error_num; Field **field; - DBUG_ENTER("spider_mysql_copy_table::copy_rows"); + DBUG_ENTER("spider_mbase_copy_table::copy_rows"); DBUG_PRINT("info",("spider this=%p", this)); for ( field = table->field; @@ -14138,22 +14433,22 @@ int spider_mysql_copy_table::copy_rows( DBUG_RETURN(0); } -int spider_mysql_copy_table::append_insert_terminator() +int spider_mbase_copy_table::append_insert_terminator() { - DBUG_ENTER("spider_mysql_copy_table::append_insert_terminator"); + DBUG_ENTER("spider_mbase_copy_table::append_insert_terminator"); DBUG_PRINT("info",("spider this=%p", this)); sql.length(sql.length() - SPIDER_SQL_COMMA_LEN - SPIDER_SQL_OPEN_PAREN_LEN); DBUG_RETURN(0); } -int spider_mysql_copy_table::copy_insert_values( +int spider_mbase_copy_table::copy_insert_values( spider_db_copy_table *source_ct ) { - spider_mysql_copy_table *tmp_ct = (spider_mysql_copy_table *) source_ct; + spider_mbase_copy_table *tmp_ct = (spider_mbase_copy_table *) source_ct; spider_string *source_str = &tmp_ct->sql; int values_length = source_str->length() - tmp_ct->pos; const char *values_ptr = source_str->ptr() + tmp_ct->pos; - DBUG_ENTER("spider_mysql_copy_table::copy_insert_values"); + DBUG_ENTER("spider_mbase_copy_table::copy_insert_values"); DBUG_PRINT("info",("spider this=%p", this)); if (sql.reserve(values_length)) { diff --git a/storage/spider/spd_db_mysql.h b/storage/spider/spd_db_mysql.h index 9a709f46c51..3448cea06cc 100644 --- a/storage/spider/spd_db_mysql.h +++ b/storage/spider/spd_db_mysql.h @@ -13,11 +13,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -class spider_db_mysql_util: public spider_db_util +class spider_db_mbase_util: public spider_db_util { public: - spider_db_mysql_util(); - ~spider_db_mysql_util(); + spider_db_mbase_util(); + virtual ~spider_db_mbase_util(); int append_name( spider_string *str, const char *name, @@ -174,7 +174,21 @@ public: #endif }; -class spider_db_mysql_row: public spider_db_row +class spider_db_mysql_util: public spider_db_mbase_util +{ +public: + spider_db_mysql_util(); + ~spider_db_mysql_util(); +}; + +class spider_db_mariadb_util: public spider_db_mbase_util +{ +public: + spider_db_mariadb_util(); + ~spider_db_mariadb_util(); +}; + +class spider_db_mbase_row: public spider_db_row { public: MYSQL_ROW row; @@ -184,8 +198,10 @@ public: uint field_count; uint record_size; bool cloned; - spider_db_mysql_row(); - ~spider_db_mysql_row(); + spider_db_mbase_row( + uint dbton_id + ); + virtual ~spider_db_mbase_row(); int store_to_field( Field *field, CHARSET_INFO *access_charset @@ -214,15 +230,31 @@ public: uint get_byte_size(); }; -class spider_db_mysql_result: public spider_db_result +class spider_db_mysql_row: public spider_db_mbase_row +{ +public: + spider_db_mysql_row(); + ~spider_db_mysql_row(); +}; + +class spider_db_mariadb_row: public spider_db_mbase_row +{ +public: + spider_db_mariadb_row(); + ~spider_db_mariadb_row(); +}; + +class spider_db_mbase_result: public spider_db_result { public: MYSQL_RES *db_result; - spider_db_mysql_row row; + spider_db_mbase_row row; MYSQL_ROW_OFFSET first_row; int store_error_num; - spider_db_mysql_result(SPIDER_DB_CONN *in_db_conn); - ~spider_db_mysql_result(); + spider_db_mbase_result( + SPIDER_DB_CONN *in_db_conn + ); + virtual ~spider_db_mbase_result(); bool has_result(); void free_result(); SPIDER_DB_ROW *current_row(); @@ -289,9 +321,29 @@ public: #endif }; -class spider_db_mysql: public spider_db_conn +class spider_db_mysql_result: public spider_db_mbase_result +{ +public: + spider_db_mysql_result( + SPIDER_DB_CONN *in_db_conn + ); + ~spider_db_mysql_result(); +}; + +class spider_db_mariadb_result: public spider_db_mbase_result +{ +public: + spider_db_mariadb_result( + SPIDER_DB_CONN *in_db_conn + ); + ~spider_db_mariadb_result(); +}; + +class spider_db_mbase: public spider_db_conn { - int stored_error; +protected: + int stored_error; + spider_db_mbase_util *spider_db_mbase_utility; public: MYSQL *db_conn; HASH lock_table_hash; @@ -306,10 +358,11 @@ public: const char *handler_open_array_func_name; const char *handler_open_array_file_name; ulong handler_open_array_line_no; - spider_db_mysql( - SPIDER_CONN *conn + spider_db_mbase( + SPIDER_CONN *conn, + spider_db_mbase_util *spider_db_mbase_utility ); - ~spider_db_mysql(); + virtual ~spider_db_mbase(); int init(); bool is_connected(); void bg_connect(); @@ -524,8 +577,28 @@ public: ); }; -class spider_mysql_share: public spider_db_share +class spider_db_mysql: public spider_db_mbase +{ +public: + spider_db_mysql( + SPIDER_CONN *conn + ); + ~spider_db_mysql(); +}; + +class spider_db_mariadb: public spider_db_mbase +{ +public: + spider_db_mariadb( + SPIDER_CONN *conn + ); + ~spider_db_mariadb(); +}; + +class spider_mbase_share: public spider_db_share { +protected: + spider_db_mbase_util *spider_db_mbase_utility; public: spider_string *table_select; int table_select_pos; @@ -547,10 +620,12 @@ public: bool same_db_table_name; int first_all_link_idx; - spider_mysql_share( - st_spider_share *share + spider_mbase_share( + st_spider_share *share, + uint dbton_id, + spider_db_mbase_util *spider_db_mbase_utility ); - ~spider_mysql_share(); + virtual ~spider_mbase_share(); int init(); uint get_column_name_length( uint field_index @@ -585,7 +660,7 @@ public: spider_string *str ); #endif -private: +protected: int create_table_names_str(); void free_table_names_str(); int create_column_name_str(); @@ -603,8 +678,28 @@ private: ); }; -class spider_mysql_handler: public spider_db_handler +class spider_mysql_share: public spider_mbase_share +{ +public: + spider_mysql_share( + st_spider_share *share + ); + ~spider_mysql_share(); +}; + +class spider_mariadb_share: public spider_mbase_share { +public: + spider_mariadb_share( + st_spider_share *share + ); + ~spider_mariadb_share(); +}; + +class spider_mbase_handler: public spider_db_handler +{ +protected: + spider_db_mbase_util *spider_db_mbase_utility; spider_string sql; spider_string sql_part; spider_string sql_part2; @@ -614,7 +709,7 @@ class spider_mysql_handler: public spider_db_handler int limit_pos; public: int table_name_pos; -private: +protected: int ha_read_pos; int ha_next_pos; int ha_where_pos; @@ -647,14 +742,15 @@ private: SPIDER_INT_HLD *union_table_name_pos_first; SPIDER_INT_HLD *union_table_name_pos_current; public: - spider_mysql_share *mysql_share; + spider_mbase_share *mysql_share; SPIDER_LINK_FOR_HASH *link_for_hash; uchar *minimum_select_bitmap; - spider_mysql_handler( + spider_mbase_handler( ha_spider *spider, - spider_mysql_share *share + spider_mbase_share *share, + spider_db_mbase_util *spider_db_mbase_utility ); - ~spider_mysql_handler(); + virtual ~spider_mbase_handler(); int init(); int append_index_hint( spider_string *str, @@ -1498,16 +1594,36 @@ public: #endif }; -class spider_mysql_copy_table: public spider_db_copy_table +class spider_mysql_handler: public spider_mbase_handler +{ +public: + spider_mysql_handler( + ha_spider *spider, + spider_mbase_share *share + ); + ~spider_mysql_handler(); +}; + +class spider_mariadb_handler: public spider_mbase_handler { public: - spider_mysql_share *mysql_share; + spider_mariadb_handler( + ha_spider *spider, + spider_mbase_share *share + ); + ~spider_mariadb_handler(); +}; + +class spider_mbase_copy_table: public spider_db_copy_table +{ +public: + spider_mbase_share *mysql_share; spider_string sql; uint pos; - spider_mysql_copy_table( - spider_mysql_share *db_share + spider_mbase_copy_table( + spider_mbase_share *db_share ); - ~spider_mysql_copy_table(); + virtual ~spider_mbase_copy_table(); int init(); void set_sql_charset( CHARSET_INFO *cs @@ -1578,3 +1694,21 @@ public: spider_db_copy_table *source_ct ); }; + +class spider_mysql_copy_table: public spider_mbase_copy_table +{ +public: + spider_mysql_copy_table( + spider_mbase_share *db_share + ); + ~spider_mysql_copy_table(); +}; + +class spider_mariadb_copy_table: public spider_mbase_copy_table +{ +public: + spider_mariadb_copy_table( + spider_mbase_share *db_share + ); + ~spider_mariadb_copy_table(); +}; diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc index 82a1e9a0fbc..eae749f6867 100644 --- a/storage/spider/spd_db_oracle.cc +++ b/storage/spider/spd_db_oracle.cc @@ -512,7 +512,7 @@ SPIDER_DB_ROW *spider_db_oracle_row::clone() spider_db_oracle_row *clone_row; DBUG_ENTER("spider_db_oracle_row::clone"); DBUG_PRINT("info",("spider this=%p", this)); - if (!(clone_row = new spider_db_oracle_row())) + if (!(clone_row = new spider_db_oracle_row(dbton_id))) { DBUG_RETURN(NULL); } @@ -772,9 +772,9 @@ int spider_db_oracle_row::fetch() } spider_db_oracle_result::spider_db_oracle_result(SPIDER_DB_CONN *in_db_conn) : - spider_db_result(in_db_conn, spider_dbton_oracle.dbton_id), + spider_db_result(in_db_conn), db_conn(NULL), stmtp(NULL), field_count(0), access_charset(NULL), - fetched(FALSE) + fetched(FALSE), row(in_db_conn->dbton_id) { DBUG_ENTER("spider_db_oracle_result::spider_db_oracle_result"); DBUG_PRINT("info",("spider this=%p", this)); @@ -4365,7 +4365,8 @@ int spider_db_oracle_util::append_having( spider_oracle_share::spider_oracle_share( st_spider_share *share ) : spider_db_share( - share + share, + spider_dbton_oracle.dbton_id ), table_select(NULL), table_select_pos(0), diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index fe5265184b6..0e706219432 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -128,6 +128,7 @@ extern long spider_conn_mutex_id; handlerton *spider_hton_ptr; SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE]; extern SPIDER_DBTON spider_dbton_mysql; +extern SPIDER_DBTON spider_dbton_mariadb; #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) extern SPIDER_DBTON spider_dbton_handlersocket; #endif @@ -7362,15 +7363,22 @@ int spider_db_init( #endif spider_dbton_mysql.dbton_id = dbton_id; + spider_dbton_mysql.db_util->dbton_id = dbton_id; spider_dbton[dbton_id] = spider_dbton_mysql; ++dbton_id; + spider_dbton_mariadb.dbton_id = dbton_id; + spider_dbton_mariadb.db_util->dbton_id = dbton_id; + spider_dbton[dbton_id] = spider_dbton_mariadb; + ++dbton_id; #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) spider_dbton_handlersocket.dbton_id = dbton_id; + spider_dbton_handlersocket.db_util->dbton_id = dbton_id; spider_dbton[dbton_id] = spider_dbton_handlersocket; ++dbton_id; #endif #ifdef HAVE_ORACLE_OCI spider_dbton_oracle.dbton_id = dbton_id; + spider_dbton_oracle.db_util->dbton_id = dbton_id; spider_dbton[dbton_id] = spider_dbton_oracle; ++dbton_id; #endif |