Skip to content

Commit e80c4b3

Browse files
committed
- Fix MDEV-9779. Connection was not recognized in the option list.
This was a regression bug. modified: storage/connect/ha_connect.cc modified: storage/connect/mysql-test/connect/r/part_table.result modified: storage/connect/mysql-test/connect/t/part_table.test
1 parent c1efc4a commit e80c4b3

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

storage/connect/ha_connect.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ char *ha_connect::GetRealString(const char *s)
11501150
{
11511151
char *sv;
11521152

1153-
if (IsPartitioned() && s) {
1153+
if (IsPartitioned() && s && partname && *partname) {
11541154
sv= (char*)PlugSubAlloc(xp->g, NULL, 0);
11551155
sprintf(sv, s, partname);
11561156
PlugSubAlloc(xp->g, NULL, strlen(sv) + 1);
@@ -1173,7 +1173,9 @@ char *ha_connect::GetStringOption(char *opname, char *sdef)
11731173
: table->s->connect_string;
11741174

11751175
if (cnc.length)
1176-
opval= GetRealString(strz(xp->g, cnc));
1176+
opval= strz(xp->g, cnc);
1177+
else
1178+
opval= GetListOption(xp->g, opname, options->oplist);
11771179

11781180
} else if (!stricmp(opname, "Query_String"))
11791181
opval= thd_query_string(table->in_use)->str;

storage/connect/mysql-test/connect/r/part_table.result

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,31 @@ id msg
191191
35 thirty five
192192
81 big
193193
DROP TABLE t1;
194+
CREATE TABLE t1 (
195+
id INT KEY NOT NULL,
196+
msg VARCHAR(32))
197+
ENGINE=CONNECT TABLE_TYPE=MYSQL
198+
OPTION_LIST='connect=mysql://root@localhost/test/xt%s'
199+
PARTITION BY RANGE COLUMNS(id) (
200+
PARTITION `1` VALUES LESS THAN(10),
201+
PARTITION `2` VALUES LESS THAN(50),
202+
PARTITION `3` VALUES LESS THAN(MAXVALUE));
203+
Warnings:
204+
Warning 1105 Data repartition in 1 is unchecked
205+
Warning 1105 Data repartition in 2 is unchecked
206+
Warning 1105 Data repartition in 3 is unchecked
207+
SELECT * FROM t1;
208+
id msg
209+
4 four
210+
7 sept
211+
1 one
212+
8 eight
213+
40 forty
214+
10 ten
215+
11 eleven
216+
35 thirty five
217+
81 big
218+
DROP TABLE t1;
194219
DROP TABLE xt1;
195220
DROP TABLE xt2;
196221
DROP TABLE xt3;

storage/connect/mysql-test/connect/t/part_table.test

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,21 @@ SELECT * FROM t1;
8282
DELETE FROM t1 WHERE id in (60,72);
8383
SELECT * FROM t1;
8484
DROP TABLE t1;
85+
86+
#
87+
# Using a connection string
88+
#
89+
CREATE TABLE t1 (
90+
id INT KEY NOT NULL,
91+
msg VARCHAR(32))
92+
ENGINE=CONNECT TABLE_TYPE=MYSQL
93+
OPTION_LIST='connect=mysql://root@localhost/test/xt%s'
94+
PARTITION BY RANGE COLUMNS(id) (
95+
PARTITION `1` VALUES LESS THAN(10),
96+
PARTITION `2` VALUES LESS THAN(50),
97+
PARTITION `3` VALUES LESS THAN(MAXVALUE));
98+
SELECT * FROM t1;
99+
DROP TABLE t1;
85100
DROP TABLE xt1;
86101
DROP TABLE xt2;
87102
DROP TABLE xt3;

0 commit comments

Comments
 (0)