| 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_find_args.xpl |
| 12 |
|
| 13 |
-->macro prepare_values |
| 14 |
-->quiet |
| 15 |
-->sql |
| 16 |
TRUNCATE TABLE xtest.xtable; |
| 17 |
INSERT INTO xtest.xtable VALUES (34),(23),(56),(45),(67); |
| 18 |
-->endsql |
| 19 |
-->noquiet |
| 20 |
-->endmacro |
| 21 |
|
| 22 |
|
| 23 |
##-- projection - missing arg |
| 24 |
-->quiet |
| 25 |
Mysqlx.Crud.Find { |
| 26 |
collection { name: "xtable" schema: "xtest"} |
| 27 |
data_model: TABLE |
| 28 |
projection { |
| 29 |
source { type: PLACEHOLDER position: 0 } |
| 30 |
} |
| 31 |
} |
| 32 |
-->noquiet |
| 33 |
-->expecterror 5154 |
| 34 |
-->recvresult |
| 35 |
|
| 36 |
|
| 37 |
##-- projection - one arg |
| 38 |
-->quiet |
| 39 |
Mysqlx.Crud.Find { |
| 40 |
collection { name: "xtable" schema: "xtest"} |
| 41 |
data_model: TABLE |
| 42 |
projection { |
| 43 |
source { type: PLACEHOLDER position: 0 } |
| 44 |
} |
| 45 |
args { type: V_OCTETS v_octets {value:"xteam"} } |
| 46 |
} |
| 47 |
-->noquiet |
| 48 |
-->recvresult |
| 49 |
|
| 50 |
|
| 51 |
##-- criteria - missing arg |
| 52 |
-->quiet |
| 53 |
Mysqlx.Crud.Find { |
| 54 |
collection { name: "xtable" schema: "xtest"} |
| 55 |
data_model: TABLE |
| 56 |
criteria { |
| 57 |
type: OPERATOR |
| 58 |
operator { |
| 59 |
name: ">" |
| 60 |
param { type: IDENT identifier { name: "value" } } |
| 61 |
param { type: PLACEHOLDER position: 0 } |
| 62 |
} |
| 63 |
} |
| 64 |
} |
| 65 |
-->noquiet |
| 66 |
-->expecterror 5154 |
| 67 |
-->recvresult |
| 68 |
|
| 69 |
|
| 70 |
##-- criteria - one arg |
| 71 |
-->callmacro prepare_values |
| 72 |
-->quiet |
| 73 |
Mysqlx.Crud.Find { |
| 74 |
collection { name: "xtable" schema: "xtest"} |
| 75 |
data_model: TABLE |
| 76 |
args { type: V_SINT v_signed_int: 42 } |
| 77 |
criteria { |
| 78 |
type: OPERATOR |
| 79 |
operator { |
| 80 |
name: ">" |
| 81 |
param { type: IDENT identifier { name: "value" } } |
| 82 |
param { type: PLACEHOLDER position: 0 } |
| 83 |
} |
| 84 |
} |
| 85 |
} |
| 86 |
-->noquiet |
| 87 |
-->recvresult |
| 88 |
|
| 89 |
##-- grouping - missing arg |
| 90 |
-->callmacro prepare_values |
| 91 |
-->quiet |
| 92 |
Mysqlx.Crud.Find { |
| 93 |
collection { name: "xtable" schema: "xtest"} |
| 94 |
data_model: TABLE |
| 95 |
projection { |
| 96 |
alias: "modulo" |
| 97 |
source { |
| 98 |
type: OPERATOR operator { |
| 99 |
name: "%" |
| 100 |
param { type: IDENT identifier { name: "value" } } |
| 101 |
param { |
| 102 |
type: LITERAL literal { type: V_SINT v_signed_int: 2} |
| 103 |
} |
| 104 |
} |
| 105 |
} |
| 106 |
} |
| 107 |
projection { |
| 108 |
source { |
| 109 |
type: FUNC_CALL function_call { |
| 110 |
name { name: "count" } |
| 111 |
param { type: IDENT identifier { name: "value" } } |
| 112 |
} |
| 113 |
} |
| 114 |
} |
| 115 |
grouping {type: PLACEHOLDER position: 0} |
| 116 |
} |
| 117 |
-->noquiet |
| 118 |
-->expecterror 5154 |
| 119 |
-->recvresult |
| 120 |
|
| 121 |
##-- grouping - one arg |
| 122 |
-->callmacro prepare_values |
| 123 |
-->quiet |
| 124 |
Mysqlx.Crud.Find { |
| 125 |
collection { name: "xtable" schema: "xtest"} |
| 126 |
data_model: TABLE |
| 127 |
projection { |
| 128 |
alias: "modulo" |
| 129 |
source { |
| 130 |
type: OPERATOR operator { |
| 131 |
name: "%" |
| 132 |
param { type: IDENT identifier { name: "value" } } |
| 133 |
param { |
| 134 |
type: LITERAL literal { type: V_SINT v_signed_int: 2} |
| 135 |
} |
| 136 |
} |
| 137 |
} |
| 138 |
} |
| 139 |
projection { |
| 140 |
source { |
| 141 |
type: FUNC_CALL function_call { |
| 142 |
name { name: "count" } |
| 143 |
param { type: IDENT identifier { name: "value" } } |
| 144 |
} |
| 145 |
} |
| 146 |
} |
| 147 |
grouping {type: PLACEHOLDER position: 0} |
| 148 |
args { type: V_SINT v_signed_int: 1 } |
| 149 |
} |
| 150 |
-->noquiet |
| 151 |
-->recvresult |
| 152 |
|
| 153 |
|
| 154 |
##-- grouping criteria - missing arg |
| 155 |
-->callmacro prepare_values |
| 156 |
-->quiet |
| 157 |
Mysqlx.Crud.Find { |
| 158 |
collection { name: "xtable" schema: "xtest"} |
| 159 |
data_model: TABLE |
| 160 |
projection { |
| 161 |
alias: "modulo" |
| 162 |
source { |
| 163 |
type: OPERATOR operator { |
| 164 |
name: "%" |
| 165 |
param { type: IDENT identifier { name: "value" } } |
| 166 |
param { |
| 167 |
type: LITERAL literal { type: V_SINT v_signed_int: 2} |
| 168 |
} |
| 169 |
} |
| 170 |
} |
| 171 |
} |
| 172 |
projection { |
| 173 |
source { |
| 174 |
type: FUNC_CALL function_call { |
| 175 |
name { name: "count" } |
| 176 |
param { type: IDENT identifier { name: "value" } } |
| 177 |
} |
| 178 |
} |
| 179 |
} |
| 180 |
grouping {type: IDENT identifier { name: "modulo" } } |
| 181 |
grouping_criteria { |
| 182 |
type: OPERATOR operator { |
| 183 |
name: "<" |
| 184 |
param { type: IDENT identifier {name: "modulo"} } |
| 185 |
param { type: PLACEHOLDER position: 0 } |
| 186 |
} |
| 187 |
} |
| 188 |
} |
| 189 |
-->noquiet |
| 190 |
-->expecterror 5154 |
| 191 |
-->recvresult |
| 192 |
|
| 193 |
##-- grouping criteria - one arg |
| 194 |
-->callmacro prepare_values |
| 195 |
-->quiet |
| 196 |
Mysqlx.Crud.Find { |
| 197 |
collection { name: "xtable" schema: "xtest"} |
| 198 |
data_model: TABLE |
| 199 |
projection { |
| 200 |
alias: "modulo" |
| 201 |
source { |
| 202 |
type: OPERATOR operator { |
| 203 |
name: "%" |
| 204 |
param { type: IDENT identifier { name: "value" } } |
| 205 |
param { |
| 206 |
type: LITERAL literal { type: V_SINT v_signed_int: 2} |
| 207 |
} |
| 208 |
} |
| 209 |
} |
| 210 |
} |
| 211 |
projection { |
| 212 |
source { |
| 213 |
type: FUNC_CALL function_call { |
| 214 |
name { name: "count" } |
| 215 |
param { type: IDENT identifier { name: "value" } } |
| 216 |
} |
| 217 |
} |
| 218 |
} |
| 219 |
grouping {type: IDENT identifier { name: "modulo" } } |
| 220 |
grouping_criteria { |
| 221 |
type: OPERATOR operator { |
| 222 |
name: "<" |
| 223 |
param { type: IDENT identifier {name: "modulo"} } |
| 224 |
param { type: PLACEHOLDER position: 0 } |
| 225 |
} |
| 226 |
} |
| 227 |
args { type: V_SINT v_signed_int: 1 } |
| 228 |
} |
| 229 |
-->noquiet |
| 230 |
-->recvresult |
| 231 |
|
| 232 |
##-- order - missing arg |
| 233 |
-->callmacro prepare_values |
| 234 |
-->quiet |
| 235 |
Mysqlx.Crud.Find { |
| 236 |
collection { name: "xtable" schema: "xtest"} |
| 237 |
data_model: TABLE |
| 238 |
order { |
| 239 |
expr { type: PLACEHOLDER position: 0 } |
| 240 |
direction: DESC |
| 241 |
} |
| 242 |
} |
| 243 |
-->noquiet |
| 244 |
-->expecterror 5154 |
| 245 |
-->recvresult |
| 246 |
|
| 247 |
|
| 248 |
##-- order - one arg |
| 249 |
-->callmacro prepare_values |
| 250 |
-->quiet |
| 251 |
Mysqlx.Crud.Find { |
| 252 |
collection { name: "xtable" schema: "xtest"} |
| 253 |
data_model: TABLE |
| 254 |
order { |
| 255 |
expr { type: PLACEHOLDER position: 0 } |
| 256 |
direction: DESC |
| 257 |
} |
| 258 |
args { type: V_SINT v_signed_int: 1 } |
| 259 |
} |
| 260 |
-->noquiet |
| 261 |
-->recvresult |
| 262 |
EOF |
| 263 |
|
| 264 |
--exec $MYSQLXTEST -ux_root --password='' --file=$MYSQL_TMP_DIR/crud_find_args.xpl 2>&1 |
| 265 |
|
| 266 |
## Cleanup |
| 267 |
--source ../include/xplugin_cleanup.inc |