Current Path : /home/usr.opt/mysql57/mysql-test/suite/x/t/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //home/usr.opt/mysql57/mysql-test/suite/x/t/insert_table.test |
## generated ## Rel: Insert 0 rows --source ../include/xplugin_preamble.inc ## Test starts here --write_file $MYSQL_TMP_DIR/insert_table_empty.tmp ## Test data -->sql drop schema if exists xtest; create schema xtest default charset='utf8mb4'; use xtest; create table simpletable (id int auto_increment primary key, value int); create table mycoll (doc JSON, _id VARBINARY(16) GENERATED ALWAYS AS (json_unquote(json_extract(doc, '$._id'))) stored PRIMARY KEY); create table mytable (i int NOT NULL, ui int unsigned, vc varchar(100), f float, d double, dt datetime, ts timestamp(5), j json); create table ` .'"````\\` (` .'"````\\` int); -->endsql ## Insert nothing (to get an error) Mysqlx.Crud.Insert { collection { name: "mytable" schema: "xtest" } data_model: TABLE projection { name: "i" } projection { name: "ui" } projection { name: "vc" } projection { name: "f" } projection { name: "d" } projection { name: "dt" } projection { name: "ts" } projection { name: "j" } } ## expect Mysqlx.Error -->recv -->sql select count(*) from xtest.mytable; truncate table xtest.mytable; -->endsql ## Insert wrong type values Mysqlx.Crud.Insert { collection { name: "mytable" schema: "xtest" } data_model: TABLE projection { name: "i" } projection { name: "ui" } projection { name: "vc" } projection { name: "f" } projection { name: "d" } projection { name: "dt" } projection { name: "ts" } projection { name: "j" } row { field { type: LITERAL literal { type: V_SINT v_signed_int: -100 } } field { type: LITERAL literal { type: V_UINT v_unsigned_int: 100 } } field { type: LITERAL literal { type: V_STRING v_string { value: "" } } } field { type: LITERAL literal { type: V_FLOAT v_float: 0.333333333333 } } field { type: LITERAL literal { type: V_DOUBLE v_double: 0.333333333333 } } field { type: LITERAL literal { type: V_STRING v_string { value: "2015-05-05 1:20:30" } } } field { type: LITERAL literal { type: V_STRING v_string { value: "2015-06-06 03:10:20.12345" } } } field { type: LITERAL literal { type: V_STRING v_string { value: "{\"name\":\"Me\"}" } } } } row { field { type: LITERAL literal { type: V_NULL } } field { type: LITERAL literal { type: V_UINT v_unsigned_int: 50 } } field { type: LITERAL literal { type: V_STRING v_string { value: "new\'string" } } } field { type: LITERAL literal { type: V_FLOAT v_float: 0 } } field { type: LITERAL literal { type: V_DOUBLE v_double: 1 } } field { type: LITERAL literal { type: V_STRING v_string { value: "2000-1-1 1:1:1" } } } field { type: LITERAL literal { type: V_STRING v_string { value: "1999-2-2 2:2:2.22222" } } } field { type: LITERAL literal { type: V_NULL } } } } ## expect Mysqlx.Error -->recv -->sql select count(*) from xtest.mytable; truncate table xtest.mytable; -->endsql ## valid cases -->echo Valid cases Mysqlx.Crud.Insert { collection { name: "mytable" schema: "xtest" } data_model: TABLE projection { name: "i" } projection { name: "ui" } projection { name: "vc" } projection { name: "f" } projection { name: "d" } projection { name: "dt" } projection { name: "ts" } projection { name: "j" } row { field { type: LITERAL literal { type: V_SINT v_signed_int: -100 } } field { type: LITERAL literal { type: V_UINT v_unsigned_int: 100 } } field { type: LITERAL literal { type: V_STRING v_string { value: "string" } } } field { type: LITERAL literal { type: V_FLOAT v_float: 0.333333333333 } } field { type: LITERAL literal { type: V_DOUBLE v_double: 0.333333333333 } } field { type: LITERAL literal { type: V_STRING v_string { value: "2015-05-05 1:20:30" } } } field { type: LITERAL literal { type: V_STRING v_string { value: "2015-06-06 03:10:20.12345" } } } field { type: LITERAL literal { type: V_STRING v_string { value: "{\"name\":\"Me\"}" } } } } } ## expect Mysqlx.Sql.StmtExecuteOk -->recvresult -->sql select count(*) from xtest.mytable; truncate table xtest.mytable; -->endsql Mysqlx.Crud.Insert { collection { name: "mytable" schema: "xtest" } data_model: TABLE projection { name: "i" } projection { name: "ui" } projection { name: "vc" } projection { name: "f" } projection { name: "d" } projection { name: "dt" } projection { name: "ts" } projection { name: "j" } row { field { type: LITERAL literal { type: V_SINT v_signed_int: -100 } } field { type: LITERAL literal { type: V_UINT v_unsigned_int: 100 } } field { type: LITERAL literal { type: V_STRING v_string { value: "" } } } field { type: LITERAL literal { type: V_FLOAT v_float: 0.333333333333 } } field { type: LITERAL literal { type: V_DOUBLE v_double: 0.333333333333 } } field { type: LITERAL literal { type: V_STRING v_string { value: "2015-05-05 1:20:30" } } } field { type: LITERAL literal { type: V_STRING v_string { value: "2015-06-06 03:10:20.12345" } } } field { type: LITERAL literal { type: V_STRING v_string { value: "{\"name\":\"Me\"}" } } } } row { field { type: LITERAL literal { type: V_SINT v_signed_int: -50 } } field { type: LITERAL literal { type: V_UINT v_unsigned_int: 50 } } field { type: LITERAL literal { type: V_STRING v_string { value: "new\'string" } } } field { type: LITERAL literal { type: V_FLOAT v_float: 0 } } field { type: LITERAL literal { type: V_DOUBLE v_double: 1 } } field { type: LITERAL literal { type: V_STRING v_string { value: "2000-1-1 1:1:1" } } } field { type: LITERAL literal { type: V_STRING v_string { value: "1999-2-2 2:2:2.22222" } } } field { type: LITERAL literal { type: V_NULL } } } } ## expect Mysqlx.Sql.StmtExecuteOk -->recvresult ## multiple rows with auto_increment Mysqlx.Crud.Insert { collection { name: "simpletable" schema: "xtest" } data_model: TABLE projection { name: "value" } row { field { type: LITERAL literal { type: V_SINT v_double: 5 } } } row { field { type: LITERAL literal { type: V_SINT v_double: 6 } } } } -->recvresult -->sql select count(*) from xtest.mytable; -->endsql ## Cleanup -->sql drop schema if exists xtest; -->endsql EOF --exec $MYSQLXTEST -uroot --password='' --file=$MYSQL_TMP_DIR/insert_table_empty.tmp 2>&1 --remove_file $MYSQL_TMP_DIR/insert_table_empty.tmp ## Postamble uninstall plugin mysqlx;