90 lines
2.0 KiB
Plaintext
90 lines
2.0 KiB
Plaintext
|
|
## Test polarx rpc auto commit and run locally behavior
|
|
|
|
--let $TEMP_FILE = polarx_rpc_template
|
|
|
|
--source include/polarx_rpc_preamble.inc
|
|
--source include/polarx_rpc_create_user.inc
|
|
## Test starts here
|
|
--write_file $MYSQL_TMP_DIR/$TEMP_FILE.tmp
|
|
|
|
## do sth with sql in auto commit session
|
|
-->switchsid -1
|
|
-->sql
|
|
drop schema if exists xtest;
|
|
create schema xtest;
|
|
use xtest;
|
|
create table mytable (pk int primary key auto_increment, data varchar(100));
|
|
-->endsql
|
|
|
|
|
|
## do sth with polarx_rpc msg
|
|
|
|
## switch Session ID to -2(highest bit is 1 means auto commit session)
|
|
-->switchsid -2
|
|
|
|
## begin has no effect on others auto commit request.
|
|
Polarx.Sql.StmtExecute {
|
|
stmt: "begin"
|
|
schema_name: "xtest"
|
|
}
|
|
## expect Polarx.Sql.StmtExecuteOk
|
|
-->recvresult
|
|
|
|
Polarx.Sql.StmtExecute {
|
|
stmt: "insert into mytable values (DEFAULT, \'one\')"
|
|
}
|
|
## expect Polarx.Sql.StmtExecuteOk
|
|
-->recvresult
|
|
|
|
Polarx.Sql.StmtExecute {
|
|
stmt: "insert into mytable values (DEFAULT, \'two\')"
|
|
}
|
|
## expect Polarx.Sql.StmtExecuteOk
|
|
-->recvresult
|
|
|
|
Polarx.Sql.StmtExecute {
|
|
stmt: "insert into mytable values (DEFAULT, \'three\')"
|
|
}
|
|
## expect Polarx.Sql.StmtExecuteOk
|
|
-->recvresult
|
|
|
|
## rollback should have no affect
|
|
Polarx.Sql.StmtExecute {
|
|
stmt: "rollback"
|
|
}
|
|
## expect Polarx.Sql.StmtExecuteOk
|
|
-->recvresult
|
|
|
|
## switch to another auto commit session
|
|
-->switchsid -3
|
|
|
|
Polarx.Sql.StmtExecute {
|
|
stmt: "select * from mytable"
|
|
token: 10000
|
|
}
|
|
|
|
-->recvtype Polarx.Resultset.ColumnMetaData
|
|
-->recvtype Polarx.Resultset.ColumnMetaData
|
|
-->recvtype Polarx.Resultset.Row
|
|
-->recvtype Polarx.Resultset.Row
|
|
-->recvtype Polarx.Resultset.Row
|
|
-->recvtype Polarx.Resultset.FetchDone
|
|
-->recvtype Polarx.Notice.Frame
|
|
-->recvtype Polarx.Sql.StmtExecuteOk
|
|
|
|
|
|
## switch back to auto commit session and cleanup
|
|
-->switchsid -1
|
|
-->sql
|
|
drop schema if exists xtest;
|
|
-->endsql
|
|
|
|
EOF
|
|
|
|
--exec $POLARX_RPC_TEST -upolarx_root --password='' --file=$MYSQL_TMP_DIR/$TEMP_FILE.tmp 2>&1
|
|
|
|
## Cleanup
|
|
--remove_file $MYSQL_TMP_DIR/$TEMP_FILE.tmp
|
|
--source include/polarx_rpc_drop_user.inc
|