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

115 lines
2.1 KiB
Plaintext

## Inserting and placeholders
--source include/xplugin_preamble.inc
--source include/xplugin_create_user.inc
## Test data
DROP SCHEMA IF EXISTS xtest;
CREATE SCHEMA xtest;
CREATE TABLE xtest.xtable (value FLOAT);
## Test starts here
--write_file $MYSQL_TMP_DIR/crud_insert_args.tmp
##-- missing arg
-->quiet
Mysqlx.Crud.Insert {
collection { name: "xtable" schema: "xtest"}
data_model: TABLE
projection {name: "value"}
row {
field {
type : LITERAL literal { type: V_FLOAT v_float: 12.0 }
}
}
row {
field {
type: PLACEHOLDER position: 0
}
}
}
-->noquiet
-->expecterror 5154
-->recvresult
##-- one arg
-->quiet
Mysqlx.Crud.Insert {
collection { name: "xtable" schema: "xtest"}
data_model: TABLE
projection {name: "value"}
row {
field {
type : LITERAL literal { type: V_FLOAT v_float: 23.1 }
}
}
row {
field {
type: PLACEHOLDER position: 0
}
}
args { type: V_FLOAT v_float: 34.2 }
}
-->noquiet
-->recvresult
##-- two args
-->quiet
Mysqlx.Crud.Insert {
collection { name: "xtable" schema: "xtest"}
data_model: TABLE
projection {name: "value"}
row {
field {
type: PLACEHOLDER position: 1
}
}
row {
field {
type: PLACEHOLDER position: 0
}
}
args { type: V_FLOAT v_float: 45.4 }
args { type: V_FLOAT v_float: 56.3 }
}
-->noquiet
-->recvresult
##-- two args in one expr
-->quiet
Mysqlx.Crud.Insert {
collection { name: "xtable" schema: "xtest"}
data_model: TABLE
projection {name: "value"}
row {
field {
type: OPERATOR operator {
name: "+"
param {
type: PLACEHOLDER position: 1
}
param {
type: PLACEHOLDER position: 0
}
}
}
}
args { type: V_FLOAT v_float: 24.2 }
args { type: V_FLOAT v_float: 43.3 }
}
-->noquiet
-->recvresult
EOF
--exec $MYSQLXTEST -ux_root --password='' --file=$MYSQL_TMP_DIR/crud_insert_args.tmp 2>&1
SELECT * FROM xtest.xtable;
## Cleanup
DROP SCHEMA IF EXISTS xtest;
--remove_file $MYSQL_TMP_DIR/crud_insert_args.tmp
--source include/xplugin_drop_user.inc