polardbxengine/mysql-test/suite/x/t/galaxy_stmtexecute_with_arg...

124 lines
2.8 KiB
Plaintext

## generated
## Test query with resultset
## Preamble
## SETUP DB
--source include/xplugin_preamble.inc
--source include/xplugin_create_user.inc
CREATE DATABASE xtest;
USE xtest;
CREATE TABLE `scalar_types`(`number_uint` INTEGER UNSIGNED DEFAULT 10, `number_sint` INTEGER DEFAULT -10, `value_bool` BOOLEAN DEFAULT 0, `value_string` VARCHAR(255) default NULL, `number_float` FLOAT DEFAULT 1.1, `number_double` DOUBLE DEFAULT 2.2, `value_blob` TINYBLOB DEFAULT NULL);
--write_file $MYSQL_TMP_DIR/galaxy_stmtexecute_insert.tmp
Mysqlx.Sql.StmtExecute {
stmt: "INSERT INTO `xtest`.`scalar_types`(`number_sint`, `number_uint`, `value_string`) VALUES(0, ?, 'First inserted row'),(?, 1,'Second inserted row'), (-1, 0,?)"
args {
type: SCALAR
scalar {
type: V_UINT
v_unsigned_int: 1
}
}
args {
type: SCALAR
scalar {
type: V_SINT
v_signed_int: -1
}
}
args {
type: SCALAR
scalar {
type: V_STRING
v_string {
value: "\"Thrid\" inserted 'row'"
}
}
}
}
-->recvresult
Mysqlx.Sql.StmtExecute {
stmt: "INSERT INTO `xtest`.`scalar_types`(`number_float`, `number_double`, `value_blob`) VALUES(0.1, ?, 'First inserted blob'),(?, 200.01,'Second inserted blob'), (10.11, 2.2, ?), (111, 222, ?)"
args {
type: SCALAR
scalar {
type: V_DOUBLE
v_double: 200.01
}
}
args {
type: SCALAR
scalar {
type: V_DOUBLE
v_double: 10.11
}
}
args {
type: SCALAR
scalar {
type: V_STRING
v_string {
value: "\"Thrid\" inserted 'blob'"
}
}
}
args {
type: SCALAR
scalar {
type: V_NULL
}
}
}
-->recvresult
EOF
--write_file $MYSQL_TMP_DIR/galaxy_stmtexecute_invalid.tmp
-->echo Too many args
Mysqlx.Sql.GalaxyStmtExecute {
stmt: "SELECT * FROM `xtest`.`scalar_types`"
args {
type: SCALAR
scalar {
type: V_STRING
v_string {
value: "%inserted 'row%"
}
}
}
}
-->recvtype Mysqlx.Error
-->sql
USE `xtest`;
-->endsql
-->echo String as identifier
Mysqlx.Sql.GalaxyStmtExecute {
stmt: "SELECT * FROM ?"
args {
type: SCALAR
scalar {
type: V_IDENTIFIER
v_identifier {
value: "scalar_types"
}
}
}
}
-->recvuntil Mysqlx.Sql.StmtExecuteOk
EOF
## Test starts here
--exec $GALAXYXTEST -ux_root --password='' --file=$MYSQL_TMP_DIR/galaxy_stmtexecute_insert.tmp 2>&1
--exec $GALAXYXTEST -ux_root --password='' --file=$MYSQL_TMP_DIR/galaxy_stmtexecute_invalid.tmp 2>&1
## Cleanup
DROP DATABASE xtest;
--remove_file $MYSQL_TMP_DIR/galaxy_stmtexecute_insert.tmp
--remove_file $MYSQL_TMP_DIR/galaxy_stmtexecute_invalid.tmp
--source include/xplugin_drop_user.inc