271 lines
5.5 KiB
Plaintext
271 lines
5.5 KiB
Plaintext
## Updating 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_find_args.tmp
|
|
|
|
-->macro prepare_values
|
|
-->quiet
|
|
-->sql
|
|
TRUNCATE TABLE xtest.xtable;
|
|
INSERT INTO xtest.xtable VALUES (34),(23),(56),(45),(67);
|
|
-->endsql
|
|
-->noquiet
|
|
-->endmacro
|
|
|
|
|
|
##-- projection - missing arg
|
|
-->quiet
|
|
Mysqlx.Crud.Find {
|
|
collection { name: "xtable" schema: "xtest"}
|
|
data_model: TABLE
|
|
projection {
|
|
source { type: PLACEHOLDER position: 0 }
|
|
}
|
|
}
|
|
-->noquiet
|
|
-->expecterror 5154
|
|
-->recvresult
|
|
|
|
|
|
##-- projection - one arg
|
|
-->quiet
|
|
Mysqlx.Crud.Find {
|
|
collection { name: "xtable" schema: "xtest"}
|
|
data_model: TABLE
|
|
projection {
|
|
source { type: PLACEHOLDER position: 0 }
|
|
}
|
|
args { type: V_OCTETS v_octets {value:"xteam"} }
|
|
}
|
|
-->noquiet
|
|
-->recvresult
|
|
|
|
|
|
##-- criteria - missing arg
|
|
-->quiet
|
|
Mysqlx.Crud.Find {
|
|
collection { name: "xtable" schema: "xtest"}
|
|
data_model: TABLE
|
|
criteria {
|
|
type: OPERATOR
|
|
operator {
|
|
name: ">"
|
|
param { type: IDENT identifier { name: "value" } }
|
|
param { type: PLACEHOLDER position: 0 }
|
|
}
|
|
}
|
|
}
|
|
-->noquiet
|
|
-->expecterror 5154
|
|
-->recvresult
|
|
|
|
|
|
##-- criteria - one arg
|
|
-->callmacro prepare_values
|
|
-->quiet
|
|
Mysqlx.Crud.Find {
|
|
collection { name: "xtable" schema: "xtest"}
|
|
data_model: TABLE
|
|
args { type: V_SINT v_signed_int: 42 }
|
|
criteria {
|
|
type: OPERATOR
|
|
operator {
|
|
name: ">"
|
|
param { type: IDENT identifier { name: "value" } }
|
|
param { type: PLACEHOLDER position: 0 }
|
|
}
|
|
}
|
|
}
|
|
-->noquiet
|
|
-->recvresult
|
|
|
|
##-- grouping - missing arg
|
|
-->callmacro prepare_values
|
|
-->quiet
|
|
Mysqlx.Crud.Find {
|
|
collection { name: "xtable" schema: "xtest"}
|
|
data_model: TABLE
|
|
projection {
|
|
alias: "modulo"
|
|
source {
|
|
type: OPERATOR operator {
|
|
name: "%"
|
|
param { type: IDENT identifier { name: "value" } }
|
|
param {
|
|
type: LITERAL literal { type: V_SINT v_signed_int: 2}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
projection {
|
|
source {
|
|
type: FUNC_CALL function_call {
|
|
name { name: "count" }
|
|
param { type: IDENT identifier { name: "value" } }
|
|
}
|
|
}
|
|
}
|
|
grouping {type: PLACEHOLDER position: 0}
|
|
}
|
|
-->noquiet
|
|
-->expecterror 5154
|
|
-->recvresult
|
|
|
|
##-- grouping - one arg
|
|
-->callmacro prepare_values
|
|
-->quiet
|
|
Mysqlx.Crud.Find {
|
|
collection { name: "xtable" schema: "xtest"}
|
|
data_model: TABLE
|
|
projection {
|
|
alias: "modulo"
|
|
source {
|
|
type: OPERATOR operator {
|
|
name: "%"
|
|
param { type: IDENT identifier { name: "value" } }
|
|
param {
|
|
type: LITERAL literal { type: V_SINT v_signed_int: 2}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
projection {
|
|
source {
|
|
type: FUNC_CALL function_call {
|
|
name { name: "count" }
|
|
param { type: IDENT identifier { name: "value" } }
|
|
}
|
|
}
|
|
}
|
|
grouping {type: PLACEHOLDER position: 0}
|
|
args { type: V_SINT v_signed_int: 1 }
|
|
}
|
|
-->noquiet
|
|
-->recvresult
|
|
|
|
|
|
##-- grouping criteria - missing arg
|
|
-->callmacro prepare_values
|
|
-->quiet
|
|
Mysqlx.Crud.Find {
|
|
collection { name: "xtable" schema: "xtest"}
|
|
data_model: TABLE
|
|
projection {
|
|
alias: "modulo"
|
|
source {
|
|
type: OPERATOR operator {
|
|
name: "%"
|
|
param { type: IDENT identifier { name: "value" } }
|
|
param {
|
|
type: LITERAL literal { type: V_SINT v_signed_int: 2}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
projection {
|
|
source {
|
|
type: FUNC_CALL function_call {
|
|
name { name: "count" }
|
|
param { type: IDENT identifier { name: "value" } }
|
|
}
|
|
}
|
|
}
|
|
grouping {type: IDENT identifier { name: "modulo" } }
|
|
grouping_criteria {
|
|
type: OPERATOR operator {
|
|
name: "<"
|
|
param { type: IDENT identifier {name: "modulo"} }
|
|
param { type: PLACEHOLDER position: 0 }
|
|
}
|
|
}
|
|
}
|
|
-->noquiet
|
|
-->expecterror 5154
|
|
-->recvresult
|
|
|
|
##-- grouping criteria - one arg
|
|
-->callmacro prepare_values
|
|
-->quiet
|
|
Mysqlx.Crud.Find {
|
|
collection { name: "xtable" schema: "xtest"}
|
|
data_model: TABLE
|
|
projection {
|
|
alias: "modulo"
|
|
source {
|
|
type: OPERATOR operator {
|
|
name: "%"
|
|
param { type: IDENT identifier { name: "value" } }
|
|
param {
|
|
type: LITERAL literal { type: V_SINT v_signed_int: 2}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
projection {
|
|
source {
|
|
type: FUNC_CALL function_call {
|
|
name { name: "count" }
|
|
param { type: IDENT identifier { name: "value" } }
|
|
}
|
|
}
|
|
}
|
|
grouping {type: IDENT identifier { name: "modulo" } }
|
|
grouping_criteria {
|
|
type: OPERATOR operator {
|
|
name: "<"
|
|
param { type: IDENT identifier {name: "modulo"} }
|
|
param { type: PLACEHOLDER position: 0 }
|
|
}
|
|
}
|
|
args { type: V_SINT v_signed_int: 1 }
|
|
}
|
|
-->noquiet
|
|
-->recvresult
|
|
|
|
##-- order - missing arg
|
|
-->callmacro prepare_values
|
|
-->quiet
|
|
Mysqlx.Crud.Find {
|
|
collection { name: "xtable" schema: "xtest"}
|
|
data_model: TABLE
|
|
order {
|
|
expr { type: PLACEHOLDER position: 0 }
|
|
direction: DESC
|
|
}
|
|
}
|
|
-->noquiet
|
|
-->expecterror 5154
|
|
-->recvresult
|
|
|
|
|
|
##-- order - one arg
|
|
-->callmacro prepare_values
|
|
-->quiet
|
|
Mysqlx.Crud.Find {
|
|
collection { name: "xtable" schema: "xtest"}
|
|
data_model: TABLE
|
|
order {
|
|
expr { type: PLACEHOLDER position: 0 }
|
|
direction: DESC
|
|
}
|
|
args { type: V_SINT v_signed_int: 1 }
|
|
}
|
|
-->noquiet
|
|
-->recvresult
|
|
EOF
|
|
|
|
--exec $MYSQLXTEST -ux_root --password='' --file=$MYSQL_TMP_DIR/crud_find_args.tmp 2>&1
|
|
|
|
## Cleanup
|
|
DROP SCHEMA IF EXISTS xtest;
|
|
--remove_file $MYSQL_TMP_DIR/crud_find_args.tmp
|
|
--source include/xplugin_drop_user.inc
|