| 1 |
## Deleting and placeholders |
| 2 |
|
| 3 |
--source include/xplugin_preamble.inc |
| 4 |
--source include/xplugin_create_user.inc |
| 5 |
|
| 6 |
## Test data |
| 7 |
CREATE SCHEMA xtest; |
| 8 |
CREATE TABLE xtest.xtable (value FLOAT); |
| 9 |
|
| 10 |
## Test starts here |
| 11 |
--write_file $MYSQL_TMP_DIR/crud_delete_args.xpl |
| 12 |
|
| 13 |
-->macro prepare_values |
| 14 |
-->quiet |
| 15 |
-->sql |
| 16 |
TRUNCATE TABLE xtest.xtable; |
| 17 |
INSERT INTO xtest.xtable VALUES (34.2),(23.1),(56.3),(45.4),(67.5); |
| 18 |
-->endsql |
| 19 |
-->noquiet |
| 20 |
-->endmacro |
| 21 |
|
| 22 |
-->macro show_values |
| 23 |
-->quiet |
| 24 |
-->sql |
| 25 |
SELECT * FROM xtest.xtable; |
| 26 |
-->endsql |
| 27 |
-->noquiet |
| 28 |
-->endmacro |
| 29 |
|
| 30 |
|
| 31 |
##-- criteria - missing arg |
| 32 |
-->callmacro prepare_values |
| 33 |
-->quiet |
| 34 |
Mysqlx.Crud.Delete { |
| 35 |
collection { name: "xtable" schema: "xtest"} |
| 36 |
data_model: TABLE |
| 37 |
criteria { |
| 38 |
type: OPERATOR |
| 39 |
operator { |
| 40 |
name: ">" |
| 41 |
param { type: IDENT identifier { name: "value" } } |
| 42 |
param { type: PLACEHOLDER position: 0 } |
| 43 |
} |
| 44 |
} |
| 45 |
} |
| 46 |
-->noquiet |
| 47 |
-->expecterror 5154 |
| 48 |
-->recvresult |
| 49 |
-->callmacro show_values |
| 50 |
|
| 51 |
|
| 52 |
##-- criteria - one arg |
| 53 |
-->callmacro prepare_values |
| 54 |
-->quiet |
| 55 |
Mysqlx.Crud.Delete { |
| 56 |
collection { name: "xtable" schema: "xtest"} |
| 57 |
data_model: TABLE |
| 58 |
criteria { |
| 59 |
type: OPERATOR |
| 60 |
operator { |
| 61 |
name: ">" |
| 62 |
param { type: IDENT identifier { name: "value" } } |
| 63 |
param { type: PLACEHOLDER position: 0 } |
| 64 |
} |
| 65 |
} |
| 66 |
args { type: V_FLOAT v_float: 51.1 } |
| 67 |
} |
| 68 |
-->noquiet |
| 69 |
-->recvresult |
| 70 |
-->callmacro show_values |
| 71 |
|
| 72 |
|
| 73 |
##-- order - missing arg |
| 74 |
-->callmacro prepare_values |
| 75 |
-->quiet |
| 76 |
Mysqlx.Crud.Delete { |
| 77 |
collection { name: "xtable" schema: "xtest"} |
| 78 |
data_model: TABLE |
| 79 |
order { |
| 80 |
expr { type: PLACEHOLDER position: 0 } |
| 81 |
direction: DESC |
| 82 |
} |
| 83 |
} |
| 84 |
-->noquiet |
| 85 |
-->expecterror 5154 |
| 86 |
-->recvresult |
| 87 |
-->callmacro show_values |
| 88 |
|
| 89 |
|
| 90 |
##-- order - one arg |
| 91 |
-->callmacro prepare_values |
| 92 |
-->quiet |
| 93 |
Mysqlx.Crud.Delete { |
| 94 |
collection { name: "xtable" schema: "xtest"} |
| 95 |
data_model: TABLE |
| 96 |
args { type: V_OCTETS v_octets {value:"none"} } |
| 97 |
order { |
| 98 |
expr { type: PLACEHOLDER position: 0 } |
| 99 |
direction: DESC |
| 100 |
} |
| 101 |
limit: {row_count: 2} |
| 102 |
} |
| 103 |
-->noquiet |
| 104 |
-->recvresult |
| 105 |
-->callmacro show_values |
| 106 |
|
| 107 |
EOF |
| 108 |
|
| 109 |
--exec $MYSQLXTEST -ux_root --password='' --file=$MYSQL_TMP_DIR/crud_delete_args.xpl 2>&1 |
| 110 |
|
| 111 |
## Cleanup |
| 112 |
--source ../include/xplugin_cleanup.inc |