| 1 |
## Updating 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_update_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 |
##-- operation - missing arg |
| 32 |
-->callmacro prepare_values |
| 33 |
-->quiet |
| 34 |
Mysqlx.Crud.Update { |
| 35 |
collection { name: "xtable" schema: "xtest"} |
| 36 |
data_model: TABLE |
| 37 |
operation { |
| 38 |
source { name: 'value' } |
| 39 |
operation: SET |
| 40 |
value: { type: PLACEHOLDER position: 0 } |
| 41 |
} |
| 42 |
} |
| 43 |
-->noquiet |
| 44 |
-->expecterror 5154 |
| 45 |
-->recvresult |
| 46 |
-->callmacro show_values |
| 47 |
|
| 48 |
|
| 49 |
##-- operation - one arg |
| 50 |
-->callmacro prepare_values |
| 51 |
-->quiet |
| 52 |
Mysqlx.Crud.Update { |
| 53 |
collection { name: "xtable" schema: "xtest"} |
| 54 |
data_model: TABLE |
| 55 |
operation { |
| 56 |
source { name: 'value' } |
| 57 |
operation: SET |
| 58 |
value: { type: PLACEHOLDER position: 0 } |
| 59 |
} |
| 60 |
args { type: V_FLOAT v_float: 34.2 } |
| 61 |
} |
| 62 |
-->noquiet |
| 63 |
-->recvresult |
| 64 |
-->callmacro show_values |
| 65 |
|
| 66 |
|
| 67 |
##-- criteria - missing arg |
| 68 |
-->callmacro prepare_values |
| 69 |
-->quiet |
| 70 |
Mysqlx.Crud.Update { |
| 71 |
collection { name: "xtable" schema: "xtest"} |
| 72 |
data_model: TABLE |
| 73 |
operation { |
| 74 |
source { name: 'value' } |
| 75 |
operation: SET |
| 76 |
value: { type : LITERAL literal { type: V_FLOAT v_float: 11.1 } } |
| 77 |
} |
| 78 |
criteria { |
| 79 |
type: OPERATOR |
| 80 |
operator { |
| 81 |
name: ">" |
| 82 |
param { type: IDENT identifier { name: "value" } } |
| 83 |
param { type: PLACEHOLDER position: 0 } |
| 84 |
} |
| 85 |
} |
| 86 |
} |
| 87 |
-->noquiet |
| 88 |
-->expecterror 5154 |
| 89 |
-->recvresult |
| 90 |
-->callmacro show_values |
| 91 |
|
| 92 |
|
| 93 |
##-- criteria - one arg |
| 94 |
-->callmacro prepare_values |
| 95 |
-->quiet |
| 96 |
Mysqlx.Crud.Update { |
| 97 |
collection { name: "xtable" schema: "xtest"} |
| 98 |
data_model: TABLE |
| 99 |
operation { |
| 100 |
source { name: 'value' } |
| 101 |
operation: SET |
| 102 |
value: { type : LITERAL literal { type: V_FLOAT v_float: 11.2 } } |
| 103 |
} |
| 104 |
criteria { |
| 105 |
type: OPERATOR |
| 106 |
operator { |
| 107 |
name: ">" |
| 108 |
param { type: IDENT identifier { name: "value" } } |
| 109 |
param { type: PLACEHOLDER position: 0 } |
| 110 |
} |
| 111 |
} |
| 112 |
args { type: V_FLOAT v_float: 51.2 } |
| 113 |
} |
| 114 |
-->noquiet |
| 115 |
-->recvresult |
| 116 |
-->callmacro show_values |
| 117 |
|
| 118 |
|
| 119 |
##-- order - missing arg |
| 120 |
-->callmacro prepare_values |
| 121 |
-->quiet |
| 122 |
Mysqlx.Crud.Update { |
| 123 |
collection { name: "xtable" schema: "xtest"} |
| 124 |
data_model: TABLE |
| 125 |
operation { |
| 126 |
source { name: 'value' } |
| 127 |
operation: SET |
| 128 |
value: { type : LITERAL literal { type: V_FLOAT v_float: 11.1 } } |
| 129 |
} |
| 130 |
order { |
| 131 |
expr { type: PLACEHOLDER position: 0 } |
| 132 |
direction: DESC |
| 133 |
} |
| 134 |
} |
| 135 |
-->noquiet |
| 136 |
-->expecterror 5154 |
| 137 |
-->recvresult |
| 138 |
-->callmacro show_values |
| 139 |
|
| 140 |
|
| 141 |
##-- order - one arg |
| 142 |
-->callmacro prepare_values |
| 143 |
-->quiet |
| 144 |
Mysqlx.Crud.Update { |
| 145 |
collection { name: "xtable" schema: "xtest"} |
| 146 |
data_model: TABLE |
| 147 |
operation { |
| 148 |
source { name: 'value' } |
| 149 |
operation: SET |
| 150 |
value: { type : LITERAL literal { type: V_FLOAT v_float: 11.2 } } |
| 151 |
} |
| 152 |
args { type: V_OCTETS v_octets {value:"none"} } |
| 153 |
order { |
| 154 |
expr { type: PLACEHOLDER position: 0 } |
| 155 |
direction: DESC |
| 156 |
} |
| 157 |
limit: {row_count: 2} |
| 158 |
} |
| 159 |
-->noquiet |
| 160 |
-->recvresult |
| 161 |
-->callmacro show_values |
| 162 |
|
| 163 |
EOF |
| 164 |
|
| 165 |
--exec $MYSQLXTEST -ux_root --password='' --file=$MYSQL_TMP_DIR/crud_update_args.xpl 2>&1 |
| 166 |
|
| 167 |
## Cleanup |
| 168 |
--source ../include/xplugin_cleanup.inc |