mirror of
https://github.com/MariaDB/server.git
synced 2025-08-09 22:24:09 +03:00
- Fix MDEV-13621 Replace sprintf by strcpy for opval
modified: storage/connect/ha_connect.cc - Add test output to tbl_thread.test tryng to understand failure modified: storage/connect/mysql-test/connect/r/tbl_thread.result modified: storage/connect/mysql-test/connect/t/tbl_thread.test modified: storage/connect/tabtbl.cpp
This commit is contained in:
@@ -1288,11 +1288,10 @@ PCSZ ha_connect::GetStringOption(PCSZ opname, PCSZ sdef)
|
|||||||
} else if (!stricmp(opname, "Query_String")) {
|
} else if (!stricmp(opname, "Query_String")) {
|
||||||
// This escapes everything and returns a wrong query
|
// This escapes everything and returns a wrong query
|
||||||
// opval = thd_query_string(table->in_use)->str;
|
// opval = thd_query_string(table->in_use)->str;
|
||||||
size_t len = thd_query_string(table->in_use)->length;
|
opval = (PCSZ)PlugSubAlloc(xp->g, NULL,
|
||||||
|
thd_query_string(table->in_use)->length + 1);
|
||||||
opval = (PCSZ)PlugSubAlloc(xp->g, NULL, len + 1);
|
strcpy((char*)opval, thd_query_string(table->in_use)->str);
|
||||||
sprintf((char*)opval, "%s", thd_query_string(table->in_use)->str);
|
// sprintf((char*)opval, "%s", thd_query_string(table->in_use)->str);
|
||||||
((char*)opval)[len] = 0;
|
|
||||||
} else if (!stricmp(opname, "Partname"))
|
} else if (!stricmp(opname, "Partname"))
|
||||||
opval= partname;
|
opval= partname;
|
||||||
else if (!stricmp(opname, "Table_charset")) {
|
else if (!stricmp(opname, "Table_charset")) {
|
||||||
|
@@ -144,10 +144,12 @@ SELECT * FROM t2;
|
|||||||
v
|
v
|
||||||
22
|
22
|
||||||
CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';;
|
CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';;
|
||||||
|
set connect_xtrace=1;
|
||||||
SELECT * FROM total order by v desc;
|
SELECT * FROM total order by v desc;
|
||||||
v
|
v
|
||||||
22
|
22
|
||||||
11
|
11
|
||||||
|
set connect_xtrace=0;
|
||||||
DROP TABLE total;
|
DROP TABLE total;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
DROP TABLE t2;
|
DROP TABLE t2;
|
||||||
|
@@ -97,7 +97,9 @@ SELECT * FROM t2;
|
|||||||
|
|
||||||
--replace_result $PORT PORT
|
--replace_result $PORT PORT
|
||||||
--eval CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=$PORT';
|
--eval CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=$PORT';
|
||||||
|
set connect_xtrace=1;
|
||||||
SELECT * FROM total order by v desc;
|
SELECT * FROM total order by v desc;
|
||||||
|
set connect_xtrace=0;
|
||||||
|
|
||||||
DROP TABLE total;
|
DROP TABLE total;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
@@ -669,6 +669,9 @@ bool TDBTBM::OpenTables(PGLOBAL g)
|
|||||||
// Remove remote table from the local list
|
// Remove remote table from the local list
|
||||||
*ptabp = tabp->Next;
|
*ptabp = tabp->Next;
|
||||||
|
|
||||||
|
if (trace)
|
||||||
|
htrc("=====> New remote table %s\n", tabp->GetName());
|
||||||
|
|
||||||
// Make the remote table block
|
// Make the remote table block
|
||||||
tp = (PTBMT)PlugSubAlloc(g, NULL, sizeof(TBMT));
|
tp = (PTBMT)PlugSubAlloc(g, NULL, sizeof(TBMT));
|
||||||
memset(tp, 0, sizeof(TBMT));
|
memset(tp, 0, sizeof(TBMT));
|
||||||
@@ -692,7 +695,10 @@ bool TDBTBM::OpenTables(PGLOBAL g)
|
|||||||
ptp = &tp->Next;
|
ptp = &tp->Next;
|
||||||
Nrc++; // Number of remote connections
|
Nrc++; // Number of remote connections
|
||||||
} else {
|
} else {
|
||||||
ptabp = &tabp->Next;
|
if (trace)
|
||||||
|
htrc("=====> Local table %s\n", tabp->GetName());
|
||||||
|
|
||||||
|
ptabp = &tabp->Next;
|
||||||
Nlc++; // Number of local connections
|
Nlc++; // Number of local connections
|
||||||
} // endif Type
|
} // endif Type
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user