| 1 |
## Inserting 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_insert_args.xpl |
| 12 |
|
| 13 |
##-- missing arg |
| 14 |
-->quiet |
| 15 |
Mysqlx.Crud.Insert { |
| 16 |
collection { name: "xtable" schema: "xtest"} |
| 17 |
data_model: TABLE |
| 18 |
projection {name: "value"} |
| 19 |
row { |
| 20 |
field { |
| 21 |
type : LITERAL literal { type: V_FLOAT v_float: 12.0 } |
| 22 |
} |
| 23 |
} |
| 24 |
row { |
| 25 |
field { |
| 26 |
type: PLACEHOLDER position: 0 |
| 27 |
} |
| 28 |
} |
| 29 |
} |
| 30 |
-->noquiet |
| 31 |
-->expecterror 5154 |
| 32 |
-->recvresult |
| 33 |
|
| 34 |
|
| 35 |
##-- one arg |
| 36 |
-->quiet |
| 37 |
Mysqlx.Crud.Insert { |
| 38 |
collection { name: "xtable" schema: "xtest"} |
| 39 |
data_model: TABLE |
| 40 |
projection {name: "value"} |
| 41 |
row { |
| 42 |
field { |
| 43 |
type : LITERAL literal { type: V_FLOAT v_float: 23.1 } |
| 44 |
} |
| 45 |
} |
| 46 |
row { |
| 47 |
field { |
| 48 |
type: PLACEHOLDER position: 0 |
| 49 |
} |
| 50 |
} |
| 51 |
args { type: V_FLOAT v_float: 34.2 } |
| 52 |
} |
| 53 |
-->noquiet |
| 54 |
-->recvresult |
| 55 |
|
| 56 |
|
| 57 |
##-- two args |
| 58 |
-->quiet |
| 59 |
Mysqlx.Crud.Insert { |
| 60 |
collection { name: "xtable" schema: "xtest"} |
| 61 |
data_model: TABLE |
| 62 |
projection {name: "value"} |
| 63 |
row { |
| 64 |
field { |
| 65 |
type: PLACEHOLDER position: 1 |
| 66 |
} |
| 67 |
} |
| 68 |
row { |
| 69 |
field { |
| 70 |
type: PLACEHOLDER position: 0 |
| 71 |
} |
| 72 |
} |
| 73 |
args { type: V_FLOAT v_float: 45.4 } |
| 74 |
args { type: V_FLOAT v_float: 56.3 } |
| 75 |
} |
| 76 |
-->noquiet |
| 77 |
-->recvresult |
| 78 |
|
| 79 |
|
| 80 |
##-- two args in one expr |
| 81 |
-->quiet |
| 82 |
Mysqlx.Crud.Insert { |
| 83 |
collection { name: "xtable" schema: "xtest"} |
| 84 |
data_model: TABLE |
| 85 |
projection {name: "value"} |
| 86 |
row { |
| 87 |
field { |
| 88 |
type: OPERATOR operator { |
| 89 |
name: "+" |
| 90 |
param { |
| 91 |
type: PLACEHOLDER position: 1 |
| 92 |
} |
| 93 |
param { |
| 94 |
type: PLACEHOLDER position: 0 |
| 95 |
} |
| 96 |
} |
| 97 |
} |
| 98 |
} |
| 99 |
args { type: V_FLOAT v_float: 24.2 } |
| 100 |
args { type: V_FLOAT v_float: 43.3 } |
| 101 |
} |
| 102 |
-->noquiet |
| 103 |
-->recvresult |
| 104 |
EOF |
| 105 |
|
| 106 |
--exec $MYSQLXTEST -ux_root --password='' --file=$MYSQL_TMP_DIR/crud_insert_args.xpl 2>&1 |
| 107 |
|
| 108 |
SELECT * FROM xtest.xtable; |
| 109 |
|
| 110 |
## Cleanup |
| 111 |
--source ../include/xplugin_cleanup.inc |