summaryrefslogtreecommitdiff
path: root/mysql-test/t/dyncol.test
diff options
context:
space:
mode:
authorunknown <sanja@askmonty.org>2012-12-23 20:57:54 +0200
committerunknown <sanja@askmonty.org>2012-12-23 20:57:54 +0200
commit40ae63dd65fb9e812f29d3520acb0ba6b64d3005 (patch)
treea11cd4a7bc7660d1d2159497469f32e4f8d177f4 /mysql-test/t/dyncol.test
parent28c9e1a550bc9f2c2dbb28304d22552ea944cf07 (diff)
downloadmariadb-git-40ae63dd65fb9e812f29d3520acb0ba6b64d3005.tar.gz
backport to 5.5 dyncol changes and names support
Diffstat (limited to 'mysql-test/t/dyncol.test')
-rw-r--r--mysql-test/t/dyncol.test43
1 files changed, 41 insertions, 2 deletions
diff --git a/mysql-test/t/dyncol.test b/mysql-test/t/dyncol.test
index 143a833fe8d..de30cac610a 100644
--- a/mysql-test/t/dyncol.test
+++ b/mysql-test/t/dyncol.test
@@ -636,9 +636,14 @@ select COLUMN_CREATE(color, "black");
CREATE TABLE t1 (f1 tinyblob);
INSERT INTO t1 VALUES (COLUMN_CREATE('col1', REPEAT('a',30)));
+select column_check(f1) from t1;
UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('b',211), 'val2' );
---error ER_DYN_COL_WRONG_FORMAT
+# we can't detect last string cut with 100% probability,
+# because we detect it by string end
+select column_check(f1) from t1;
UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('c',211), 'val3' );
+select column_check(f1) from t1;
+
drop table t1;
--echo #
@@ -657,7 +662,7 @@ SELECT COLUMN_ADD( NULL, 'val', 'col');
--echo #
SELECT hex(COLUMN_CREATE(REPEAT('a',255),1));
--error ER_DYN_COL_DATA
-SELECT hex(COLUMN_CREATE(REPEAT('a',256),1));
+SELECT hex(COLUMN_CREATE(REPEAT('a',65536),1));
--echo #
--echo # JSON conversion
@@ -672,3 +677,37 @@ SELECT COLUMN_CHECK(COLUMN_CREATE(1,'a'));
SELECT COLUMN_CHECK('abracadabra');
SELECT COLUMN_CHECK('');
SELECT COLUMN_CHECK(NULL);
+
+--echo #
+--echo # escaping check
+--echo #
+select column_json(column_create("string", "'\"/\\`.,whatever")),hex(column_create("string", "'\"/\\`.,whatever"));
+
+--echo #
+--echo # embedding test
+--echo #
+select column_json(column_create("val", "val", "emb", column_create("val2", "val2")));
+select column_json(column_create(1, "val", 2, column_create(3, "val2")));
+
+--echo #
+--echo # Time encoding
+--echo #
+select hex(column_create("t", "800:46:06.23434" AS time)) as hex,
+ column_json(column_create("t", "800:46:06.23434" AS time)) as json;
+select hex(column_create(1, "800:46:06.23434" AS time)) as hex,
+ column_json(column_create(1, "800:46:06.23434" AS time)) as json;
+
+select hex(column_create("t", "800:46:06" AS time)) as hex,
+ column_json(column_create("t", "800:46:06" AS time)) as json;
+select hex(column_create(1, "800:46:06" AS time)) as hex,
+ column_json(column_create(1, "800:46:06" AS time)) as json;
+
+select hex(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as hex,
+ column_json(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as json;
+select hex(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as hex,
+ column_json(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as json;
+
+select hex(column_create("t", "2012-12-21 10:46:06" AS datetime)) as hex,
+ column_json(column_create("t", "2012-12-21 10:46:06" AS datetime)) as json;
+select hex(column_create(1, "2012-12-21 10:46:06" AS datetime)) as hex,
+ column_json(column_create(1, "2012-12-21 10:46:06" AS datetime)) as json;