summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKentoku SHIBA <kentokushiba@gmail.com>2019-06-29 03:42:35 +0900
committerGitHub <noreply@github.com>2019-06-29 03:42:35 +0900
commit76200870ea7d8fc8e7bd16ffa3e486cb3ba438f6 (patch)
treea31352bd6b48a2b67134b6f6ce5e0c9ce88020e4
parentd4bdf1c0b67b19180e461411c9494137456e0e77 (diff)
downloadmariadb-git-76200870ea7d8fc8e7bd16ffa3e486cb3ba438f6.tar.gz
MDEV-17204 Mariadb 10.3.9 Spider DB SQL Alias no execute (#1348)bb-10.4-MDEV-17402
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_deinit.inc11
-rw-r--r--storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_init.inc25
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/select_with_backquote.result75
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.test74
-rw-r--r--storage/spider/spd_db_conn.cc31
-rw-r--r--storage/spider/spd_db_conn.h8
-rw-r--r--storage/spider/spd_db_handlersocket.cc51
-rw-r--r--storage/spider/spd_db_handlersocket.h11
-rw-r--r--storage/spider/spd_db_include.h11
-rw-r--r--storage/spider/spd_db_mysql.cc53
-rw-r--r--storage/spider/spd_db_mysql.h11
-rw-r--r--storage/spider/spd_db_oracle.cc53
-rw-r--r--storage/spider/spd_db_oracle.h11
14 files changed, 417 insertions, 11 deletions
diff --git a/storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_deinit.inc
new file mode 100644
index 00000000000..76b7582abfe
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_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/select_with_backquote_init.inc b/storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_init.inc
new file mode 100644
index 00000000000..37bf690c066
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/include/select_with_backquote_init.inc
@@ -0,0 +1,25 @@
+--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"';
+--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,
+ txt_utf8 char(8) NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE DEFAULT CHARACTER SET utf8;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey, txt_utf8 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/select_with_backquote.result b/storage/spider/mysql-test/spider/bugfix/r/select_with_backquote.result
new file mode 100644
index 00000000000..52f8c98bf98
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/select_with_backquote.result
@@ -0,0 +1,75 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+this test is for MDEV-17204
+
+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,
+txt_utf8 char(8) NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE DEFAULT CHARACTER SET utf8 MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,txt_utf8) VALUES (0,'01234567'),(1,'12345678'),(2,'23456789'),(3,'34567890'),(4,'45678901'),(5,'56789012'),(6,'67890123'),(7,'78901234'),(8,'89012345'),(9,'90123456');
+FLUSH TABLES;
+
+test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SET NAMES utf8;
+SELECT `pkey`, LEFT(`txt_utf8`, 4) FROM `auto_test_local`.`tbl_a` ORDER BY LEFT(`txt_utf8`, 4) LIMIT 3;
+pkey LEFT(`txt_utf8`, 4)
+0 0123
+1 1234
+2 2345
+connection child2_1;
+SET NAMES utf8;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`pkey` `pkey`,(left(t0.`txt_utf8` , 4)) `LEFT(``txt_utf8``, 4)` from `auto_test_remote`.`tbl_a` t0 order by `LEFT(``txt_utf8``, 4)` limit 3
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT pkey, txt_utf8 FROM tbl_a ORDER BY pkey;
+pkey txt_utf8
+0 01234567
+1 12345678
+2 23456789
+3 34567890
+4 45678901
+5 56789012
+6 67890123
+7 78901234
+8 89012345
+9 90123456
+
+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/select_with_backquote.cnf b/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.cnf
new file mode 100644
index 00000000000..05dfd8a0bce
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.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/select_with_backquote.test b/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.test
new file mode 100644
index 00000000000..4c4d687cf89
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.test
@@ -0,0 +1,74 @@
+--source ../include/select_with_backquote_init.inc
+--echo
+--echo this test is for MDEV-17204
+--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,
+ txt_utf8 char(8) NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE DEFAULT CHARACTER SET utf8 MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ txt_utf8 char(8) NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE DEFAULT CHARACTER SET utf8 $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (pkey,txt_utf8) VALUES (0,'01234567'),(1,'12345678'),(2,'23456789'),(3,'34567890'),(4,'45678901'),(5,'56789012'),(6,'67890123'),(7,'78901234'),(8,'89012345'),(9,'90123456');
+FLUSH TABLES;
+
+--echo
+--echo test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+SET NAMES utf8;
+SELECT `pkey`, LEFT(`txt_utf8`, 4) FROM `auto_test_local`.`tbl_a` ORDER BY LEFT(`txt_utf8`, 4) LIMIT 3;
+
+--connection child2_1
+SET NAMES utf8;
+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/select_with_backquote_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc
index 75b7e92ea96..853478ef251 100644
--- a/storage/spider/spd_db_conn.cc
+++ b/storage/spider/spd_db_conn.cc
@@ -1439,7 +1439,7 @@ int spider_db_append_name_with_quote_str(
) {
DBUG_ENTER("spider_db_append_name_with_quote_str");
DBUG_RETURN(spider_db_append_name_with_quote_str_internal(
- str, name, strlen(name), dbton_id));
+ str, name, strlen(name), system_charset_info, dbton_id));
}
int spider_db_append_name_with_quote_str(
@@ -1449,7 +1449,7 @@ int spider_db_append_name_with_quote_str(
) {
DBUG_ENTER("spider_db_append_name_with_quote_str");
DBUG_RETURN(spider_db_append_name_with_quote_str_internal(
- str, name.str, name.length, dbton_id));
+ str, name.str, name.length, system_charset_info, dbton_id));
}
int spider_db_append_name_with_quote_str_internal(
@@ -1458,6 +1458,18 @@ int spider_db_append_name_with_quote_str_internal(
int length,
uint dbton_id
) {
+ DBUG_ENTER("spider_db_append_name_with_quote_str_internal");
+ DBUG_RETURN(spider_db_append_name_with_quote_str_internal(
+ str, name, length, system_charset_info, dbton_id));
+}
+
+int spider_db_append_name_with_quote_str_internal(
+ spider_string *str,
+ const char *name,
+ int length,
+ CHARSET_INFO *cs,
+ uint dbton_id
+) {
int error_num;
const char *name_end;
char head_code;
@@ -1466,9 +1478,9 @@ int spider_db_append_name_with_quote_str_internal(
{
head_code = *name;
#ifdef SPIDER_HAS_MY_CHARLEN
- if ((length = my_charlen(system_charset_info, name, name_end)) < 1)
+ if ((length = my_charlen(cs, name, name_end)) < 1)
#else
- if (!(length = my_mbcharlen(system_charset_info, (uchar) head_code)))
+ if (!(length = my_mbcharlen(cs, (uchar) head_code)))
#endif
{
my_message(ER_SPIDER_WRONG_CHARACTER_IN_NAME_NUM,
@@ -1485,7 +1497,7 @@ int spider_db_append_name_with_quote_str_internal(
DBUG_RETURN(error_num);
}
} else {
- if (str->append(name, length, system_charset_info))
+ if (str->append(name, length, cs))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
}
@@ -9060,10 +9072,11 @@ int spider_db_open_item_ident(
str->q_append(alias, alias_length);
#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
if ((error_num = spider_dbton[dbton_id].db_util->
- append_name(str, item_ident->field_name.str, field_name_length)))
+ append_escaped_name(str, item_ident->field_name.str,
+ field_name_length)))
#else
if ((error_num = spider_dbton[dbton_id].db_util->
- append_name(str, item_ident->field_name, field_name_length)))
+ append_escaped_name(str, item_ident->field_name, field_name_length)))
#endif
{
DBUG_RETURN(error_num);
@@ -9074,11 +9087,11 @@ int spider_db_open_item_ident(
str->q_append(alias, alias_length);
#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
if ((error_num = spider_dbton[dbton_id].db_util->
- append_name_with_charset(str, item_ident->field_name.str,
+ append_escaped_name_with_charset(str, item_ident->field_name.str,
field_name_length, system_charset_info)))
#else
if ((error_num = spider_dbton[dbton_id].db_util->
- append_name_with_charset(str, item_ident->field_name,
+ append_escaped_name_with_charset(str, item_ident->field_name,
field_name_length, system_charset_info)))
#endif
{
diff --git a/storage/spider/spd_db_conn.h b/storage/spider/spd_db_conn.h
index e6ce926f4ee..0300dc6c407 100644
--- a/storage/spider/spd_db_conn.h
+++ b/storage/spider/spd_db_conn.h
@@ -429,6 +429,14 @@ int spider_db_append_name_with_quote_str_internal(
uint dbton_id
);
+int spider_db_append_name_with_quote_str_internal(
+ spider_string *str,
+ const char *name,
+ int length,
+ CHARSET_INFO *cs,
+ uint dbton_id
+);
+
int spider_db_append_select(
ha_spider *spider
);
diff --git a/storage/spider/spd_db_handlersocket.cc b/storage/spider/spd_db_handlersocket.cc
index 0fbf204c3f7..d4872e6ae81 100644
--- a/storage/spider/spd_db_handlersocket.cc
+++ b/storage/spider/spd_db_handlersocket.cc
@@ -2504,6 +2504,57 @@ int spider_db_handlersocket_util::append_name_with_charset(
DBUG_RETURN(0);
}
+int spider_db_handlersocket_util::append_escaped_name(
+ spider_string *str,
+ const char *name,
+ uint name_length
+) {
+ int error_num;
+ DBUG_ENTER("spider_db_handlersocket_util::append_name");
+ 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);
+ if ((error_num = spider_db_append_name_with_quote_str_internal(
+ str, name, name_length, dbton_id)))
+ {
+ DBUG_RETURN(error_num);
+ }
+ if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
+ DBUG_RETURN(0);
+}
+
+int spider_db_handlersocket_util::append_escaped_name_with_charset(
+ spider_string *str,
+ const char *name,
+ uint name_length,
+ CHARSET_INFO *name_charset
+) {
+ int error_num;
+ DBUG_ENTER("spider_db_handlersocket_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);
+ if ((error_num = spider_db_append_name_with_quote_str_internal(
+ str, name, name_length, name_charset, dbton_id)))
+ {
+ DBUG_RETURN(error_num);
+ }
+ if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
+ DBUG_RETURN(0);
+}
+
bool spider_db_handlersocket_util::is_name_quote(
const char head_code
) {
diff --git a/storage/spider/spd_db_handlersocket.h b/storage/spider/spd_db_handlersocket.h
index 22b4d282216..d2beb2124c0 100644
--- a/storage/spider/spd_db_handlersocket.h
+++ b/storage/spider/spd_db_handlersocket.h
@@ -34,6 +34,17 @@ public:
uint name_length,
CHARSET_INFO *name_charset
);
+ int append_escaped_name(
+ spider_string *str,
+ const char *name,
+ uint name_length
+ );
+ int append_escaped_name_with_charset(
+ spider_string *str,
+ const char *name,
+ uint name_length,
+ CHARSET_INFO *name_charset
+ );
bool is_name_quote(
const char head_code
);
diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h
index 3c78030919e..622462bdb98 100644
--- a/storage/spider/spd_db_include.h
+++ b/storage/spider/spd_db_include.h
@@ -817,6 +817,17 @@ public:
uint name_length,
CHARSET_INFO *name_charset
) = 0;
+ virtual int append_escaped_name(
+ spider_string *str,
+ const char *name,
+ uint name_length
+ ) = 0;
+ virtual int append_escaped_name_with_charset(
+ spider_string *str,
+ const char *name,
+ uint name_length,
+ CHARSET_INFO *name_charset
+ ) = 0;
virtual bool is_name_quote(
const char head_code
) = 0;
diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc
index b702960e78b..6fc7b5770a1 100644
--- a/storage/spider/spd_db_mysql.cc
+++ b/storage/spider/spd_db_mysql.cc
@@ -3587,6 +3587,57 @@ int spider_db_mbase_util::append_name_with_charset(
DBUG_RETURN(0);
}
+int spider_db_mbase_util::append_escaped_name(
+ spider_string *str,
+ const char *name,
+ uint name_length
+) {
+ int error_num;
+ DBUG_ENTER("spider_db_mbase_util::append_name");
+ 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);
+ if ((error_num = spider_db_append_name_with_quote_str_internal(
+ str, name, name_length, dbton_id)))
+ {
+ DBUG_RETURN(error_num);
+ }
+ if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
+ DBUG_RETURN(0);
+}
+
+int spider_db_mbase_util::append_escaped_name_with_charset(
+ spider_string *str,
+ const char *name,
+ uint name_length,
+ CHARSET_INFO *name_charset
+) {
+ int error_num;
+ 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);
+ if ((error_num = spider_db_append_name_with_quote_str_internal(
+ str, name, name_length, name_charset, dbton_id)))
+ {
+ DBUG_RETURN(error_num);
+ }
+ if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
+ DBUG_RETURN(0);
+}
+
bool spider_db_mbase_util::is_name_quote(
const char head_code
) {
@@ -14931,7 +14982,7 @@ int spider_mbase_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_mbase_utility->append_name(str,
+ if ((error_num = spider_db_mbase_utility->append_escaped_name(str,
item_name, length)))
{
DBUG_RETURN(error_num);
diff --git a/storage/spider/spd_db_mysql.h b/storage/spider/spd_db_mysql.h
index d68c834695f..8f317d03e0e 100644
--- a/storage/spider/spd_db_mysql.h
+++ b/storage/spider/spd_db_mysql.h
@@ -29,6 +29,17 @@ public:
uint name_length,
CHARSET_INFO *name_charset
);
+ int append_escaped_name(
+ spider_string *str,
+ const char *name,
+ uint name_length
+ );
+ int append_escaped_name_with_charset(
+ spider_string *str,
+ const char *name,
+ uint name_length,
+ CHARSET_INFO *name_charset
+ );
bool is_name_quote(
const char head_code
);
diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc
index 67ce0620a1d..097130169c7 100644
--- a/storage/spider/spd_db_oracle.cc
+++ b/storage/spider/spd_db_oracle.cc
@@ -2545,6 +2545,57 @@ int spider_db_oracle_util::append_name_with_charset(
DBUG_RETURN(0);
}
+int spider_db_oracle_util::append_escaped_name(
+ spider_string *str,
+ const char *name,
+ uint name_length
+) {
+ int error_num;
+ DBUG_ENTER("spider_db_oracle_util::append_name");
+ 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);
+ if ((error_num = spider_db_append_name_with_quote_str_internal(
+ str, name, name_length, dbton_id)))
+ {
+ DBUG_RETURN(error_num);
+ }
+ if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
+ DBUG_RETURN(0);
+}
+
+int spider_db_oracle_util::append_escaped_name_with_charset(
+ spider_string *str,
+ const char *name,
+ uint name_length,
+ CHARSET_INFO *name_charset
+) {
+ int error_num;
+ DBUG_ENTER("spider_db_oracle_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);
+ if ((error_num = spider_db_append_name_with_quote_str_internal(
+ str, name, name_length, name_charset, dbton_id)))
+ {
+ DBUG_RETURN(error_num);
+ }
+ if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN))
+ {
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+ }
+ str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
+ DBUG_RETURN(0);
+}
+
bool spider_db_oracle_util::is_name_quote(
const char head_code
) {
@@ -12784,7 +12835,7 @@ int spider_oracle_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_oracle_utility.append_name(str,
+ if ((error_num = spider_db_oracle_utility.append_escaped_name(str,
item_name, length)))
{
DBUG_RETURN(error_num);
diff --git a/storage/spider/spd_db_oracle.h b/storage/spider/spd_db_oracle.h
index c68fbeecfca..a4be417bc67 100644
--- a/storage/spider/spd_db_oracle.h
+++ b/storage/spider/spd_db_oracle.h
@@ -32,6 +32,17 @@ public:
uint name_length,
CHARSET_INFO *name_charset
);
+ int append_escaped_name(
+ spider_string *str,
+ const char *name,
+ uint name_length
+ );
+ int append_escaped_name_with_charset(
+ spider_string *str,
+ const char *name,
+ uint name_length,
+ CHARSET_INFO *name_charset
+ );
bool is_name_quote(
const char head_code
);