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

71 lines
1.5 KiB
Plaintext

## Put records in order using members of json doc
## Preamble
--source include/xplugin_preamble.inc
--source include/xplugin_create_user.inc
## Test starts here
--write_file $MYSQL_TMP_DIR/crud_order_by.tmp
## Test data
-->sql
create schema xtest;
use xtest;
create table xtable (doc JSON);
insert into xtable (doc) values ('{"numeric": 2, "string": "2"}');
insert into xtable (doc) values ('{"numeric": 70, "string": "70"}');
insert into xtable (doc) values ('{"numeric": 5, "string": "5"}');
insert into xtable (doc) values ('{"numeric": 10, "string": "10"}');
insert into xtable (doc) values ('{"numeric": 1, "string": "1"}');
insert into xtable (doc) values ('{"numeric": 30, "string": "30"}');
SELECT * FROM xtest.xtable;
-->endsql
Mysqlx.Crud.Find {
collection {
name: "xtable"
schema: "xtest"
}
data_model: TABLE
order {
expr {
type: IDENT
identifier {
document_path {
type: MEMBER
value: "numeric"
}
}
}
}
}
-->recvresult
Mysqlx.Crud.Find {
collection {
name: "xtable"
schema: "xtest"
}
data_model: TABLE
order {
expr {
type: IDENT
identifier {
document_path {
type: MEMBER
value: "string"
}
}
}
}
}
-->recvresult
EOF
--exec $MYSQLXTEST -ux_root --password='' --file=$MYSQL_TMP_DIR/crud_order_by.tmp 2>&1
## Cleanup
--remove_file $MYSQL_TMP_DIR/crud_order_by.tmp
--source include/xplugin_drop_user.inc
drop schema if exists xtest;