mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-17204 Mariadb 10.3.9 Spider DB SQL Alias no execute (#1348)
This commit is contained in:
@@ -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
|
@@ -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 %';
|
@@ -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
|
@@ -0,0 +1,3 @@
|
|||||||
|
!include include/default_mysqld.cnf
|
||||||
|
!include ../my_1_1.cnf
|
||||||
|
!include ../my_2_1.cnf
|
@@ -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
|
@@ -1439,7 +1439,7 @@ int spider_db_append_name_with_quote_str(
|
|||||||
) {
|
) {
|
||||||
DBUG_ENTER("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(
|
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(
|
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_ENTER("spider_db_append_name_with_quote_str");
|
||||||
DBUG_RETURN(spider_db_append_name_with_quote_str_internal(
|
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(
|
int spider_db_append_name_with_quote_str_internal(
|
||||||
@@ -1457,6 +1457,18 @@ int spider_db_append_name_with_quote_str_internal(
|
|||||||
const char *name,
|
const char *name,
|
||||||
int length,
|
int length,
|
||||||
uint dbton_id
|
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;
|
int error_num;
|
||||||
const char *name_end;
|
const char *name_end;
|
||||||
@@ -1466,9 +1478,9 @@ int spider_db_append_name_with_quote_str_internal(
|
|||||||
{
|
{
|
||||||
head_code = *name;
|
head_code = *name;
|
||||||
#ifdef SPIDER_HAS_MY_CHARLEN
|
#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
|
#else
|
||||||
if (!(length = my_mbcharlen(system_charset_info, (uchar) head_code)))
|
if (!(length = my_mbcharlen(cs, (uchar) head_code)))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
my_message(ER_SPIDER_WRONG_CHARACTER_IN_NAME_NUM,
|
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);
|
DBUG_RETURN(error_num);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (str->append(name, length, system_charset_info))
|
if (str->append(name, length, cs))
|
||||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9060,10 +9072,11 @@ int spider_db_open_item_ident(
|
|||||||
str->q_append(alias, alias_length);
|
str->q_append(alias, alias_length);
|
||||||
#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
|
#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
|
||||||
if ((error_num = spider_dbton[dbton_id].db_util->
|
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
|
#else
|
||||||
if ((error_num = spider_dbton[dbton_id].db_util->
|
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
|
#endif
|
||||||
{
|
{
|
||||||
DBUG_RETURN(error_num);
|
DBUG_RETURN(error_num);
|
||||||
@@ -9074,11 +9087,11 @@ int spider_db_open_item_ident(
|
|||||||
str->q_append(alias, alias_length);
|
str->q_append(alias, alias_length);
|
||||||
#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
|
#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
|
||||||
if ((error_num = spider_dbton[dbton_id].db_util->
|
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)))
|
field_name_length, system_charset_info)))
|
||||||
#else
|
#else
|
||||||
if ((error_num = spider_dbton[dbton_id].db_util->
|
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)))
|
field_name_length, system_charset_info)))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
@@ -429,6 +429,14 @@ int spider_db_append_name_with_quote_str_internal(
|
|||||||
uint dbton_id
|
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(
|
int spider_db_append_select(
|
||||||
ha_spider *spider
|
ha_spider *spider
|
||||||
);
|
);
|
||||||
|
@@ -2504,6 +2504,57 @@ int spider_db_handlersocket_util::append_name_with_charset(
|
|||||||
DBUG_RETURN(0);
|
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(
|
bool spider_db_handlersocket_util::is_name_quote(
|
||||||
const char head_code
|
const char head_code
|
||||||
) {
|
) {
|
||||||
|
@@ -34,6 +34,17 @@ public:
|
|||||||
uint name_length,
|
uint name_length,
|
||||||
CHARSET_INFO *name_charset
|
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(
|
bool is_name_quote(
|
||||||
const char head_code
|
const char head_code
|
||||||
);
|
);
|
||||||
|
@@ -817,6 +817,17 @@ public:
|
|||||||
uint name_length,
|
uint name_length,
|
||||||
CHARSET_INFO *name_charset
|
CHARSET_INFO *name_charset
|
||||||
) = 0;
|
) = 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(
|
virtual bool is_name_quote(
|
||||||
const char head_code
|
const char head_code
|
||||||
) = 0;
|
) = 0;
|
||||||
|
@@ -3587,6 +3587,57 @@ int spider_db_mbase_util::append_name_with_charset(
|
|||||||
DBUG_RETURN(0);
|
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(
|
bool spider_db_mbase_util::is_name_quote(
|
||||||
const char head_code
|
const char head_code
|
||||||
) {
|
) {
|
||||||
@@ -14931,7 +14982,7 @@ int spider_mbase_handler::append_list_item_select(
|
|||||||
))
|
))
|
||||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||||
str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
|
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)))
|
item_name, length)))
|
||||||
{
|
{
|
||||||
DBUG_RETURN(error_num);
|
DBUG_RETURN(error_num);
|
||||||
|
@@ -29,6 +29,17 @@ public:
|
|||||||
uint name_length,
|
uint name_length,
|
||||||
CHARSET_INFO *name_charset
|
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(
|
bool is_name_quote(
|
||||||
const char head_code
|
const char head_code
|
||||||
);
|
);
|
||||||
|
@@ -2545,6 +2545,57 @@ int spider_db_oracle_util::append_name_with_charset(
|
|||||||
DBUG_RETURN(0);
|
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(
|
bool spider_db_oracle_util::is_name_quote(
|
||||||
const char head_code
|
const char head_code
|
||||||
) {
|
) {
|
||||||
@@ -12784,7 +12835,7 @@ int spider_oracle_handler::append_list_item_select(
|
|||||||
))
|
))
|
||||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||||
str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
|
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)))
|
item_name, length)))
|
||||||
{
|
{
|
||||||
DBUG_RETURN(error_num);
|
DBUG_RETURN(error_num);
|
||||||
|
@@ -32,6 +32,17 @@ public:
|
|||||||
uint name_length,
|
uint name_length,
|
||||||
CHARSET_INFO *name_charset
|
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(
|
bool is_name_quote(
|
||||||
const char head_code
|
const char head_code
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user