diff options
Diffstat (limited to 'storage/connect')
-rw-r--r-- | storage/connect/ha_connect.cc | 11 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/r/index.result | 36 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/r/mysql.result | 38 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/t/index.test | 26 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/t/mysql.test | 30 | ||||
-rw-r--r-- | storage/connect/xindex.cpp | 4 |
6 files changed, 137 insertions, 8 deletions
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 5b6af042f68..23d3c7c1058 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -1614,15 +1614,10 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf) pcf->Scale= 0; pcf->Opt= (fop) ? (int)fop->opt : 0; -// if (fp->field_length >= 0) { + if (fp->field_length >= 0) pcf->Length= fp->field_length; - - // length is bytes for Connect, not characters - if (!strnicmp(chset, "utf8", 4)) - pcf->Length /= 3; - -// } else -// pcf->Length= 256; // BLOB? + else + pcf->Length= 256; // BLOB? pcf->Precision= pcf->Length; diff --git a/storage/connect/mysql-test/connect/r/index.result b/storage/connect/mysql-test/connect/r/index.result index c156e10749e..baebf1f1ebe 100644 --- a/storage/connect/mysql-test/connect/r/index.result +++ b/storage/connect/mysql-test/connect/r/index.result @@ -140,6 +140,42 @@ DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; # +# MDEV-28299: Server crashes in +# XINDXS::Range/CntIndexRange (Connect engine) +# +CREATE TABLE t1 ( a int not null, KEY (a))engine=CONNECT; +Warnings: +Warning 1105 No table_type. Will be set to DOS +Warning 1105 No file name. Table will use t1.dos +SELECT * FROM t1 WHERE a=1; +a +INSERT INTO t1 values (1),(2),(1); +SELECT * FROM t1 WHERE a=1; +a +1 +1 +DROP TABLE t1; +CREATE TABLE t1 (a int, b int, pk int, PRIMARY KEY (pk)) engine=CONNECT; +Warnings: +Warning 1105 No table_type. Will be set to DOS +Warning 1105 No file name. Table will use t1.dos +SELECT x.a +FROM t1 AS x JOIN t1 AS y ON (x.a = y.b) +WHERE x.pk > 3; +a +INSERT INTO t1 values (1,2,1),(2,1,2),(1,2,3),(3,4,4); +SELECT x.a +FROM t1 AS x JOIN t1 AS y ON (x.a = y.b) +WHERE x.pk > 3; +a +INSERT INTO t1 values (1,2,5); +SELECT x.a +FROM t1 AS x JOIN t1 AS y ON (x.a = y.b) +WHERE x.pk > 3; +a +1 +DROP TABLE t1; +# # MDEV-27591 Connect tables (FIX/DOS) don't work with DESC keys - wrong results # CREATE TABLE t1 ( diff --git a/storage/connect/mysql-test/connect/r/mysql.result b/storage/connect/mysql-test/connect/r/mysql.result index 918256ac395..d3c244b277a 100644 --- a/storage/connect/mysql-test/connect/r/mysql.result +++ b/storage/connect/mysql-test/connect/r/mysql.result @@ -326,5 +326,43 @@ id DROP TABLE t1; DROP TABLE t2; # +# MDEV-28489 / MDEV-26722 UTF8 bytes calculated incorrectly +# +CREATE TABLE t1 (name varchar(20)) CHARSET=utf8; +INSERT INTO t1 (name) VALUES ('Иванова'), ('Ivanova'); +CREATE TABLE t2 (name varchar(1)) ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='test' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT' CHARSET=utf8; +SELECT hex(name) from t1; +hex(name) +C390CB9CC390C2B2C390C2B0C390C2BDC390C2BEC390C2B2C390C2B0 +4976616E6F7661 +SELECT hex(name) from t2; +hex(name) +C390 +49 +Warnings: +Warning 1105 Out of range value for column name at row 1 +Warning 1265 Data truncated for column 'name' at row 1 +Warning 1105 Out of range value Ð? for column 'name' at row 1 +Warning 1105 Out of range value for column name at row 2 +Warning 1265 Data truncated for column 'name' at row 2 +Warning 1105 Out of range value Iva for column 'name' at row 2 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (col char(5)) CHARSET=utf8; +INSERT INTO t1 (col) VALUES ('glace'), ('glacé'); +Warnings: +Warning 1406 Data too long for column 'col' at row 2 +CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='test' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT' CHARSET=utf8; +SELECT hex(col) from t1; +hex(col) +676C616365 +676C6163C383 +SELECT hex(col) from t2; +hex(col) +676C616365 +676C6163C383 +DROP TABLE t2; +DROP TABLE t1; +# # End of 10.3 tests # diff --git a/storage/connect/mysql-test/connect/t/index.test b/storage/connect/mysql-test/connect/t/index.test index b631236832d..47bfbae7680 100644 --- a/storage/connect/mysql-test/connect/t/index.test +++ b/storage/connect/mysql-test/connect/t/index.test @@ -79,6 +79,32 @@ DROP TABLE t2; DROP TABLE t3; --echo # +--echo # MDEV-28299: Server crashes in +--echo # XINDXS::Range/CntIndexRange (Connect engine) +--echo # + +CREATE TABLE t1 ( a int not null, KEY (a))engine=CONNECT; +SELECT * FROM t1 WHERE a=1; + +INSERT INTO t1 values (1),(2),(1); +SELECT * FROM t1 WHERE a=1; +DROP TABLE t1; + +CREATE TABLE t1 (a int, b int, pk int, PRIMARY KEY (pk)) engine=CONNECT; +SELECT x.a +FROM t1 AS x JOIN t1 AS y ON (x.a = y.b) +WHERE x.pk > 3; +INSERT INTO t1 values (1,2,1),(2,1,2),(1,2,3),(3,4,4); +SELECT x.a +FROM t1 AS x JOIN t1 AS y ON (x.a = y.b) +WHERE x.pk > 3; +INSERT INTO t1 values (1,2,5); +SELECT x.a +FROM t1 AS x JOIN t1 AS y ON (x.a = y.b) +WHERE x.pk > 3; +DROP TABLE t1; + +--echo # --echo # MDEV-27591 Connect tables (FIX/DOS) don't work with DESC keys - wrong results --echo # --error ER_UNKNOWN_ERROR diff --git a/storage/connect/mysql-test/connect/t/mysql.test b/storage/connect/mysql-test/connect/t/mysql.test index ce76a4665d5..a50db4a6457 100644 --- a/storage/connect/mysql-test/connect/t/mysql.test +++ b/storage/connect/mysql-test/connect/t/mysql.test @@ -504,5 +504,35 @@ DROP TABLE t1; DROP TABLE t2; --echo # +--echo # MDEV-28489 / MDEV-26722 UTF8 bytes calculated incorrectly +--echo # + +CREATE TABLE t1 (name varchar(20)) CHARSET=utf8; +INSERT INTO t1 (name) VALUES ('Иванова'), ('Ivanova'); + +--replace_result $PORT PORT +--eval CREATE TABLE t2 (name varchar(1)) ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='test' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' CHARSET=utf8 + +SELECT hex(name) from t1; +# This will warn as we are truncating data +SELECT hex(name) from t2; + +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 (col char(5)) CHARSET=utf8; +INSERT INTO t1 (col) VALUES ('glace'), ('glacé'); + +--replace_result $PORT PORT +--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL DBNAME='test' TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT' CHARSET=utf8 + +SELECT hex(col) from t1; +SELECT hex(col) from t2; + +DROP TABLE t2; +DROP TABLE t1; + + +--echo # --echo # End of 10.3 tests --echo # diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp index 7f0efb727a2..4bcbbfd4235 100644 --- a/storage/connect/xindex.cpp +++ b/storage/connect/xindex.cpp @@ -2029,6 +2029,10 @@ int XINDXS::Range(PGLOBAL g, int limit, bool incl) PXCOL kp = To_KeyCol; OPVAL op = Op; +// In case single column index doesn't exist return + if (!kp) + return 0; + switch (limit) { case 1: Op = (incl) ? OP_GE : OP_GT; break; case 2: Op = (incl) ? OP_GT : OP_GE; break; |