Commit d681c50a authored by Olivier Bertrand's avatar Olivier Bertrand

- 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
parent 59c4675c
...@@ -1150,7 +1150,7 @@ char *ha_connect::GetRealString(const char *s) ...@@ -1150,7 +1150,7 @@ char *ha_connect::GetRealString(const char *s)
{ {
char *sv; char *sv;
if (IsPartitioned() && s) { if (IsPartitioned() && s && partname && *partname) {
sv= (char*)PlugSubAlloc(xp->g, NULL, 0); sv= (char*)PlugSubAlloc(xp->g, NULL, 0);
sprintf(sv, s, partname); sprintf(sv, s, partname);
PlugSubAlloc(xp->g, NULL, strlen(sv) + 1); PlugSubAlloc(xp->g, NULL, strlen(sv) + 1);
...@@ -1173,7 +1173,9 @@ char *ha_connect::GetStringOption(char *opname, char *sdef) ...@@ -1173,7 +1173,9 @@ char *ha_connect::GetStringOption(char *opname, char *sdef)
: table->s->connect_string; : table->s->connect_string;
if (cnc.length) if (cnc.length)
opval= GetRealString(strz(xp->g, cnc)); opval= strz(xp->g, cnc);
else
opval= GetListOption(xp->g, opname, options->oplist);
} else if (!stricmp(opname, "Query_String")) } else if (!stricmp(opname, "Query_String"))
opval= thd_query_string(table->in_use)->str; opval= thd_query_string(table->in_use)->str;
......
...@@ -191,6 +191,31 @@ id msg ...@@ -191,6 +191,31 @@ id msg
35 thirty five 35 thirty five
81 big 81 big
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (
id INT KEY NOT NULL,
msg VARCHAR(32))
ENGINE=CONNECT TABLE_TYPE=MYSQL
OPTION_LIST='connect=mysql://root@localhost/test/xt%s'
PARTITION BY RANGE COLUMNS(id) (
PARTITION `1` VALUES LESS THAN(10),
PARTITION `2` VALUES LESS THAN(50),
PARTITION `3` VALUES LESS THAN(MAXVALUE));
Warnings:
Warning 1105 Data repartition in 1 is unchecked
Warning 1105 Data repartition in 2 is unchecked
Warning 1105 Data repartition in 3 is unchecked
SELECT * FROM t1;
id msg
4 four
7 sept
1 one
8 eight
40 forty
10 ten
11 eleven
35 thirty five
81 big
DROP TABLE t1;
DROP TABLE xt1; DROP TABLE xt1;
DROP TABLE xt2; DROP TABLE xt2;
DROP TABLE xt3; DROP TABLE xt3;
......
...@@ -82,6 +82,21 @@ SELECT * FROM t1; ...@@ -82,6 +82,21 @@ SELECT * FROM t1;
DELETE FROM t1 WHERE id in (60,72); DELETE FROM t1 WHERE id in (60,72);
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
#
# Using a connection string
#
CREATE TABLE t1 (
id INT KEY NOT NULL,
msg VARCHAR(32))
ENGINE=CONNECT TABLE_TYPE=MYSQL
OPTION_LIST='connect=mysql://root@localhost/test/xt%s'
PARTITION BY RANGE COLUMNS(id) (
PARTITION `1` VALUES LESS THAN(10),
PARTITION `2` VALUES LESS THAN(50),
PARTITION `3` VALUES LESS THAN(MAXVALUE));
SELECT * FROM t1;
DROP TABLE t1;
DROP TABLE xt1; DROP TABLE xt1;
DROP TABLE xt2; DROP TABLE xt2;
DROP TABLE xt3; DROP TABLE xt3;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment