summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2016-03-24 23:36:39 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2016-03-24 23:36:39 +0100
commite80c4b3186c0ceda522874400a196fd144dede91 (patch)
tree5ce337eaeaeb6cab175679f966fe93522fa9d81f /storage
parentc1efc4a4ddbc2ab8c409b19e57aa4e54336b38c9 (diff)
downloadmariadb-git-e80c4b3186c0ceda522874400a196fd144dede91.tar.gz
- 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
Diffstat (limited to 'storage')
-rw-r--r--storage/connect/ha_connect.cc6
-rw-r--r--storage/connect/mysql-test/connect/r/part_table.result25
-rw-r--r--storage/connect/mysql-test/connect/t/part_table.test15
3 files changed, 44 insertions, 2 deletions
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index d82c6a278d8..a7840122147 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -1150,7 +1150,7 @@ char *ha_connect::GetRealString(const char *s)
{
char *sv;
- if (IsPartitioned() && s) {
+ if (IsPartitioned() && s && partname && *partname) {
sv= (char*)PlugSubAlloc(xp->g, NULL, 0);
sprintf(sv, s, partname);
PlugSubAlloc(xp->g, NULL, strlen(sv) + 1);
@@ -1173,7 +1173,9 @@ char *ha_connect::GetStringOption(char *opname, char *sdef)
: table->s->connect_string;
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"))
opval= thd_query_string(table->in_use)->str;
diff --git a/storage/connect/mysql-test/connect/r/part_table.result b/storage/connect/mysql-test/connect/r/part_table.result
index 122c328fa59..f3a556ae784 100644
--- a/storage/connect/mysql-test/connect/r/part_table.result
+++ b/storage/connect/mysql-test/connect/r/part_table.result
@@ -191,6 +191,31 @@ id msg
35 thirty five
81 big
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 xt2;
DROP TABLE xt3;
diff --git a/storage/connect/mysql-test/connect/t/part_table.test b/storage/connect/mysql-test/connect/t/part_table.test
index d839337ba6f..5edd5766bd6 100644
--- a/storage/connect/mysql-test/connect/t/part_table.test
+++ b/storage/connect/mysql-test/connect/t/part_table.test
@@ -82,6 +82,21 @@ SELECT * FROM t1;
DELETE FROM t1 WHERE id in (60,72);
SELECT * FROM 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 xt2;
DROP TABLE xt3;