| 1 |
########### ../t/find_crud_conditionalclauses_o.test ####### |
| 2 |
### # |
| 3 |
### This test runs aims to run FIND operation statements # |
| 4 |
### variant with mysqlxtest client for Table and Document data models. # |
| 5 |
### Test covers # |
| 6 |
### - find with different operators # |
| 7 |
### - find with metadata result # |
| 8 |
### - find with limit (row count and offset) # |
| 9 |
### - find with Order Asc/Desc # |
| 10 |
### # |
| 11 |
######################################################################## |
| 12 |
# |
| 13 |
|
| 14 |
--echo ============================================== |
| 15 |
--echo CRUD FIND CONDITIONAL CLAUSES SCENARIOS |
| 16 |
--echo ============================================== |
| 17 |
--echo |
| 18 |
|
| 19 |
--echo ================================================================================ |
| 20 |
--echo PREAMBLE |
| 21 |
--echo ================================================================================ |
| 22 |
--source include/xplugin_preamble.inc |
| 23 |
create user crudfinduser@localhost identified by 'crudfinduser'; |
| 24 |
grant all on *.* to crudfinduser@localhost; |
| 25 |
|
| 26 |
## TEST STARTS HERE |
| 27 |
--echo ================================================================================ |
| 28 |
--echo TEST START |
| 29 |
--echo ================================================================================ |
| 30 |
--write_file $MYSQL_TMP_DIR/find_crud_table.xpl |
| 31 |
-->sql |
| 32 |
DROP SCHEMA if EXISTS minisakila; |
| 33 |
CREATE SCHEMA minisakila; |
| 34 |
USE minisakila; |
| 35 |
|
| 36 |
CREATE TABLE actor ( |
| 37 |
actor_id int unsigned NOT NULL AUTO_INCREMENT, |
| 38 |
first_name varchar(45) NOT NULL, |
| 39 |
last_name varchar(45) NOT NULL, |
| 40 |
is_active bit(1) NOT NULL, |
| 41 |
PRIMARY KEY (actor_id) |
| 42 |
); |
| 43 |
|
| 44 |
INSERT INTO actor VALUES |
| 45 |
(NULL,'Victor','Otero',true), |
| 46 |
(NULL,'Gonzalo','Crhystens',false), |
| 47 |
(NULL,'Abraham','Vega',true), |
| 48 |
(NULL,'Jennifer','Leon',false), |
| 49 |
(NULL,'Jhonny','Test',true); |
| 50 |
-->endsql |
| 51 |
|
| 52 |
-->echo Table based scenarios |
| 53 |
|
| 54 |
-->echo Find all the rows including all the metadata |
| 55 |
Mysqlx.Crud.Find { |
| 56 |
collection { |
| 57 |
name: "actor" |
| 58 |
schema: "minisakila" |
| 59 |
} |
| 60 |
data_model: TABLE |
| 61 |
} |
| 62 |
|
| 63 |
## expect Mysqlx.Sql.ColumnMetaData |
| 64 |
-->recv |
| 65 |
## expect Mysqlx.Sql.ColumnMetaData |
| 66 |
-->recv |
| 67 |
## expect Mysqlx.Sql.ColumnMetaData |
| 68 |
-->recv |
| 69 |
## expect Mysqlx.Sql.ColumnMetaData |
| 70 |
-->recv |
| 71 |
## expect Mysqlx.Sql.Row |
| 72 |
-->recv |
| 73 |
## expect Mysqlx.Sql.Row |
| 74 |
-->recv |
| 75 |
## expect Mysqlx.Sql.Row |
| 76 |
-->recv |
| 77 |
## expect Mysqlx.Sql.Row |
| 78 |
-->recv |
| 79 |
## expect Mysqlx.Sql.Row |
| 80 |
-->recv |
| 81 |
## expect Mysqlx.Sql.CursorFetchDone |
| 82 |
-->recv |
| 83 |
## expect Mysqlx.Sql.StmtExecuteOk |
| 84 |
-->recv |
| 85 |
|
| 86 |
-->echo Find all the rows without the metadata |
| 87 |
Mysqlx.Crud.Find { |
| 88 |
collection { |
| 89 |
name: "actor" |
| 90 |
schema: "minisakila" |
| 91 |
} |
| 92 |
data_model: TABLE |
| 93 |
} |
| 94 |
-->recvresult |
| 95 |
|
| 96 |
-->echo Find with limit row count and offset |
| 97 |
Mysqlx.Crud.Find { |
| 98 |
collection { |
| 99 |
name: "actor" |
| 100 |
schema: "minisakila" |
| 101 |
} |
| 102 |
data_model: TABLE |
| 103 |
limit { |
| 104 |
row_count:1 |
| 105 |
offset:3 |
| 106 |
} |
| 107 |
} |
| 108 |
# From third row only one row |
| 109 |
-->recvresult |
| 110 |
|
| 111 |
-->echo Find with limit row count |
| 112 |
Mysqlx.Crud.Find { |
| 113 |
collection { |
| 114 |
name: "actor" |
| 115 |
schema: "minisakila" |
| 116 |
} |
| 117 |
data_model: TABLE |
| 118 |
limit { |
| 119 |
row_count:4 |
| 120 |
} |
| 121 |
} |
| 122 |
-->recvresult |
| 123 |
|
| 124 |
-->echo Find specific row with == Operator |
| 125 |
Mysqlx.Crud.Find { |
| 126 |
collection { |
| 127 |
name: "actor" |
| 128 |
schema: "minisakila" |
| 129 |
} |
| 130 |
data_model: TABLE |
| 131 |
criteria { |
| 132 |
type: OPERATOR |
| 133 |
operator { |
| 134 |
name: "==" |
| 135 |
param { |
| 136 |
type: IDENT identifier { |
| 137 |
name: "actor_id" |
| 138 |
} |
| 139 |
} |
| 140 |
param { |
| 141 |
type: LITERAL |
| 142 |
literal { |
| 143 |
type: V_SINT |
| 144 |
v_signed_int: 1 |
| 145 |
} |
| 146 |
} |
| 147 |
} |
| 148 |
} |
| 149 |
} |
| 150 |
-->recvresult |
| 151 |
|
| 152 |
-->echo Find specific row with != Operator |
| 153 |
Mysqlx.Crud.Find { |
| 154 |
collection { |
| 155 |
name: "actor" |
| 156 |
schema: "minisakila" |
| 157 |
} |
| 158 |
data_model: TABLE |
| 159 |
criteria { |
| 160 |
type: OPERATOR |
| 161 |
operator { |
| 162 |
name: "!=" |
| 163 |
param { |
| 164 |
type: IDENT |
| 165 |
identifier { |
| 166 |
name: "actor_id" |
| 167 |
} |
| 168 |
} |
| 169 |
param { |
| 170 |
type: LITERAL |
| 171 |
literal { |
| 172 |
type: V_SINT |
| 173 |
v_signed_int: 1 |
| 174 |
|
| 175 |
} |
| 176 |
} |
| 177 |
} |
| 178 |
} |
| 179 |
} |
| 180 |
-->recvresult |
| 181 |
|
| 182 |
-->echo Find specific row with like Operator |
| 183 |
Mysqlx.Crud.Find { |
| 184 |
collection { |
| 185 |
name: "actor" |
| 186 |
schema: "minisakila" |
| 187 |
} |
| 188 |
data_model: TABLE |
| 189 |
criteria { |
| 190 |
type: OPERATOR |
| 191 |
operator { |
| 192 |
name: "like" |
| 193 |
param { |
| 194 |
type: IDENT |
| 195 |
identifier { |
| 196 |
name: "first_name" |
| 197 |
} |
| 198 |
} |
| 199 |
param { |
| 200 |
type: LITERAL |
| 201 |
literal { |
| 202 |
type: V_OCTETS |
| 203 |
v_octets {value:"%on%"} |
| 204 |
|
| 205 |
} |
| 206 |
} |
| 207 |
} |
| 208 |
} |
| 209 |
} |
| 210 |
-->recvresult |
| 211 |
|
| 212 |
-->echo Find specific row with && and like Operators |
| 213 |
Mysqlx.Crud.Find { |
| 214 |
collection { |
| 215 |
name: "actor" |
| 216 |
schema: "minisakila" |
| 217 |
} |
| 218 |
data_model: TABLE |
| 219 |
criteria { |
| 220 |
type: OPERATOR |
| 221 |
operator { |
| 222 |
name: "&&" |
| 223 |
param { |
| 224 |
type: OPERATOR |
| 225 |
operator { |
| 226 |
name: "like" |
| 227 |
param { |
| 228 |
type: IDENT |
| 229 |
identifier { |
| 230 |
name: "first_name" |
| 231 |
} |
| 232 |
} |
| 233 |
param { |
| 234 |
type: LITERAL |
| 235 |
literal { |
| 236 |
type: V_OCTETS |
| 237 |
v_octets {value:"%on%"} |
| 238 |
|
| 239 |
} |
| 240 |
} |
| 241 |
} |
| 242 |
} |
| 243 |
param { |
| 244 |
type: OPERATOR |
| 245 |
operator { |
| 246 |
name: "like" |
| 247 |
param { |
| 248 |
type: IDENT |
| 249 |
identifier { |
| 250 |
name: "last_name" |
| 251 |
} |
| 252 |
} |
| 253 |
param { |
| 254 |
type: LITERAL |
| 255 |
literal { |
| 256 |
type: V_OCTETS |
| 257 |
v_octets {value:"%ns%"} |
| 258 |
|
| 259 |
} |
| 260 |
} |
| 261 |
} |
| 262 |
} |
| 263 |
} |
| 264 |
} |
| 265 |
} |
| 266 |
-->recvresult |
| 267 |
|
| 268 |
-->echo Find specific row with || and in Operators |
| 269 |
Mysqlx.Crud.Find { |
| 270 |
collection { |
| 271 |
name: "actor" |
| 272 |
schema: "minisakila" |
| 273 |
} |
| 274 |
data_model: TABLE |
| 275 |
criteria { |
| 276 |
type: OPERATOR |
| 277 |
operator { |
| 278 |
name: "||" |
| 279 |
param { |
| 280 |
type: OPERATOR |
| 281 |
operator { |
| 282 |
name: "in" |
| 283 |
param { |
| 284 |
type: IDENT |
| 285 |
identifier { |
| 286 |
name: "actor_id" |
| 287 |
} |
| 288 |
} |
| 289 |
param { |
| 290 |
type: LITERAL |
| 291 |
literal { |
| 292 |
type: V_SINT |
| 293 |
v_signed_int: 1 |
| 294 |
} |
| 295 |
} |
| 296 |
param { |
| 297 |
type: LITERAL |
| 298 |
literal { |
| 299 |
type: V_SINT |
| 300 |
v_signed_int: 2 |
| 301 |
} |
| 302 |
} |
| 303 |
} |
| 304 |
} |
| 305 |
param { |
| 306 |
type: OPERATOR |
| 307 |
operator { |
| 308 |
name: "like" |
| 309 |
param { |
| 310 |
type: IDENT |
| 311 |
identifier { |
| 312 |
name: "first_name" |
| 313 |
} |
| 314 |
} |
| 315 |
param { |
| 316 |
type: LITERAL |
| 317 |
literal { |
| 318 |
type: V_OCTETS |
| 319 |
v_octets {value:"%ham%"} |
| 320 |
} |
| 321 |
} |
| 322 |
} |
| 323 |
} |
| 324 |
} |
| 325 |
} |
| 326 |
} |
| 327 |
-->recvresult |
| 328 |
|
| 329 |
-->echo Find specific row with not_in Operators |
| 330 |
Mysqlx.Crud.Find { |
| 331 |
collection { |
| 332 |
name: "actor" |
| 333 |
schema: "minisakila" |
| 334 |
} |
| 335 |
data_model: TABLE |
| 336 |
criteria { |
| 337 |
type: OPERATOR |
| 338 |
operator { |
| 339 |
name: "||" |
| 340 |
param { |
| 341 |
type: OPERATOR |
| 342 |
operator { |
| 343 |
name: "not_in" |
| 344 |
param { |
| 345 |
type: IDENT |
| 346 |
identifier { |
| 347 |
name: "actor_id" |
| 348 |
} |
| 349 |
} |
| 350 |
param { |
| 351 |
type: LITERAL |
| 352 |
literal { |
| 353 |
type: V_SINT |
| 354 |
v_signed_int: 1 |
| 355 |
} |
| 356 |
} |
| 357 |
param { |
| 358 |
type: LITERAL |
| 359 |
literal { |
| 360 |
type: V_SINT |
| 361 |
v_signed_int: 2 |
| 362 |
|
| 363 |
} |
| 364 |
} |
| 365 |
} |
| 366 |
} |
| 367 |
param { |
| 368 |
type: OPERATOR |
| 369 |
operator { |
| 370 |
name: "like" |
| 371 |
param { |
| 372 |
type: IDENT |
| 373 |
identifier { |
| 374 |
name: "first_name" |
| 375 |
} |
| 376 |
} |
| 377 |
param { |
| 378 |
type: LITERAL |
| 379 |
literal { |
| 380 |
type: V_OCTETS |
| 381 |
v_octets {value:"%ham%"} |
| 382 |
|
| 383 |
} |
| 384 |
} |
| 385 |
} |
| 386 |
} |
| 387 |
} |
| 388 |
} |
| 389 |
} |
| 390 |
-->recvresult |
| 391 |
|
| 392 |
-->echo Find specific row with &&, <= and >= Operators |
| 393 |
Mysqlx.Crud.Find { |
| 394 |
collection { |
| 395 |
name: "actor" |
| 396 |
schema: "minisakila" |
| 397 |
} |
| 398 |
data_model: TABLE |
| 399 |
criteria { |
| 400 |
type: OPERATOR |
| 401 |
operator { |
| 402 |
name: "&&" |
| 403 |
param { |
| 404 |
type: OPERATOR |
| 405 |
operator { |
| 406 |
name: "<=" |
| 407 |
param { |
| 408 |
type: IDENT |
| 409 |
identifier { |
| 410 |
name: "actor_id" |
| 411 |
} |
| 412 |
} |
| 413 |
param { |
| 414 |
type: LITERAL |
| 415 |
literal { |
| 416 |
type: V_SINT |
| 417 |
v_signed_int: 4 |
| 418 |
|
| 419 |
} |
| 420 |
} |
| 421 |
} |
| 422 |
} |
| 423 |
param { |
| 424 |
type: OPERATOR |
| 425 |
operator { |
| 426 |
name: ">=" |
| 427 |
param { |
| 428 |
type: IDENT |
| 429 |
identifier { |
| 430 |
name: "actor_id" |
| 431 |
} |
| 432 |
} |
| 433 |
param { |
| 434 |
type: LITERAL |
| 435 |
literal { |
| 436 |
type: V_SINT |
| 437 |
v_signed_int: 2 |
| 438 |
|
| 439 |
} |
| 440 |
} |
| 441 |
} |
| 442 |
} |
| 443 |
} |
| 444 |
} |
| 445 |
} |
| 446 |
-->recvresult |
| 447 |
|
| 448 |
-->echo Find specific row with &&, < and > Operators |
| 449 |
Mysqlx.Crud.Find { |
| 450 |
collection { |
| 451 |
name: "actor" |
| 452 |
schema: "minisakila" |
| 453 |
} |
| 454 |
data_model: TABLE |
| 455 |
criteria { |
| 456 |
type: OPERATOR |
| 457 |
operator { |
| 458 |
name: "&&" |
| 459 |
param { |
| 460 |
type: OPERATOR |
| 461 |
operator { |
| 462 |
name: "<" |
| 463 |
param { |
| 464 |
type: IDENT |
| 465 |
identifier { |
| 466 |
name: "actor_id" |
| 467 |
} |
| 468 |
} |
| 469 |
param { |
| 470 |
type: LITERAL |
| 471 |
literal { |
| 472 |
type: V_SINT |
| 473 |
v_signed_int: 4 |
| 474 |
|
| 475 |
} |
| 476 |
} |
| 477 |
} |
| 478 |
} |
| 479 |
param { |
| 480 |
type: OPERATOR |
| 481 |
operator { |
| 482 |
name: ">" |
| 483 |
param { |
| 484 |
type: IDENT |
| 485 |
identifier { |
| 486 |
name: "actor_id" |
| 487 |
} |
| 488 |
} |
| 489 |
param { |
| 490 |
type: LITERAL |
| 491 |
literal { |
| 492 |
type: V_SINT |
| 493 |
v_signed_int: 2 |
| 494 |
|
| 495 |
} |
| 496 |
} |
| 497 |
} |
| 498 |
} |
| 499 |
} |
| 500 |
} |
| 501 |
} |
| 502 |
-->recvresult |
| 503 |
|
| 504 |
-->echo Find specific row with like Operator using string |
| 505 |
Mysqlx.Crud.Find { |
| 506 |
collection { |
| 507 |
name: "actor" |
| 508 |
schema: "minisakila" |
| 509 |
} |
| 510 |
data_model: TABLE |
| 511 |
criteria { |
| 512 |
type: OPERATOR |
| 513 |
operator { |
| 514 |
name: "like" |
| 515 |
param { |
| 516 |
type: IDENT |
| 517 |
identifier { |
| 518 |
name: "first_name" |
| 519 |
} |
| 520 |
} |
| 521 |
param { |
| 522 |
type: LITERAL |
| 523 |
literal { |
| 524 |
type: V_STRING |
| 525 |
v_string |
| 526 |
{ |
| 527 |
value: "%on%" |
| 528 |
} |
| 529 |
} |
| 530 |
} |
| 531 |
} |
| 532 |
} |
| 533 |
} |
| 534 |
-->recvresult |
| 535 |
|
| 536 |
-->echo Find specific row with != Operator with order desc |
| 537 |
Mysqlx.Crud.Find { |
| 538 |
collection { |
| 539 |
name: "actor" |
| 540 |
schema: "minisakila" |
| 541 |
} |
| 542 |
data_model: TABLE |
| 543 |
criteria { |
| 544 |
type: OPERATOR |
| 545 |
operator { |
| 546 |
name: "!=" |
| 547 |
param { |
| 548 |
type: IDENT |
| 549 |
identifier { |
| 550 |
name: "first_name" |
| 551 |
} |
| 552 |
} |
| 553 |
param { |
| 554 |
type: LITERAL |
| 555 |
literal { |
| 556 |
type: V_STRING |
| 557 |
v_string { |
| 558 |
value: "Omar" |
| 559 |
} |
| 560 |
} |
| 561 |
} |
| 562 |
} |
| 563 |
} |
| 564 |
order { |
| 565 |
expr { |
| 566 |
type: IDENT |
| 567 |
identifier { |
| 568 |
name: "last_name" |
| 569 |
} |
| 570 |
} |
| 571 |
direction: DESC |
| 572 |
} |
| 573 |
} |
| 574 |
-->recvresult |
| 575 |
|
| 576 |
-->echo Find specific row with != Operator with order asc |
| 577 |
Mysqlx.Crud.Find { |
| 578 |
collection { |
| 579 |
name: "actor" |
| 580 |
schema: "minisakila" |
| 581 |
} |
| 582 |
data_model: TABLE |
| 583 |
criteria { |
| 584 |
type: OPERATOR |
| 585 |
operator { |
| 586 |
name: "!=" |
| 587 |
param { |
| 588 |
type: IDENT |
| 589 |
identifier { |
| 590 |
name: "first_name" |
| 591 |
} |
| 592 |
} |
| 593 |
param { |
| 594 |
type: LITERAL |
| 595 |
literal { |
| 596 |
type: V_STRING |
| 597 |
v_string { |
| 598 |
value: "Omar" |
| 599 |
} |
| 600 |
} |
| 601 |
} |
| 602 |
} |
| 603 |
} |
| 604 |
order { |
| 605 |
expr { |
| 606 |
type: IDENT |
| 607 |
identifier { |
| 608 |
name: "last_name" |
| 609 |
} |
| 610 |
} |
| 611 |
direction: ASC |
| 612 |
} |
| 613 |
} |
| 614 |
-->recvresult |
| 615 |
|
| 616 |
## Negative test scenarios for Table |
| 617 |
-->echo Find using not available schema name |
| 618 |
Mysqlx.Crud.Find { |
| 619 |
collection { |
| 620 |
name: "actor" |
| 621 |
schema: "noavailableschema" |
| 622 |
} |
| 623 |
data_model: TABLE |
| 624 |
criteria { |
| 625 |
type: OPERATOR |
| 626 |
operator { |
| 627 |
name: "==" |
| 628 |
param { |
| 629 |
type: IDENT |
| 630 |
identifier { |
| 631 |
name: "actor_id" |
| 632 |
} |
| 633 |
} |
| 634 |
param { |
| 635 |
type: LITERAL |
| 636 |
literal { |
| 637 |
type: V_SINT |
| 638 |
v_signed_int: 1 |
| 639 |
|
| 640 |
} |
| 641 |
} |
| 642 |
} |
| 643 |
} |
| 644 |
} |
| 645 |
-->expecterror 1049 |
| 646 |
-->recvresult |
| 647 |
|
| 648 |
-->echo Find using not available table name |
| 649 |
Mysqlx.Crud.Find { |
| 650 |
collection { |
| 651 |
name: "notavailableatable" |
| 652 |
schema: "minisakila" |
| 653 |
} |
| 654 |
data_model: TABLE |
| 655 |
criteria { |
| 656 |
type: OPERATOR |
| 657 |
operator { |
| 658 |
name: "==" |
| 659 |
param { |
| 660 |
type: IDENT |
| 661 |
identifier { |
| 662 |
name: "actor_id" |
| 663 |
} |
| 664 |
} |
| 665 |
param { |
| 666 |
type: LITERAL |
| 667 |
literal { |
| 668 |
type: V_SINT |
| 669 |
v_signed_int: 1 |
| 670 |
|
| 671 |
} |
| 672 |
} |
| 673 |
} |
| 674 |
} |
| 675 |
} |
| 676 |
-->expecterror 1146 |
| 677 |
-->recvresult |
| 678 |
|
| 679 |
-->echo Find using not available column name |
| 680 |
Mysqlx.Crud.Find { |
| 681 |
collection { |
| 682 |
name: "actor" |
| 683 |
schema: "minisakila" |
| 684 |
} |
| 685 |
data_model: TABLE |
| 686 |
criteria { |
| 687 |
type: OPERATOR |
| 688 |
operator { |
| 689 |
name: "==" |
| 690 |
param { |
| 691 |
type: IDENT |
| 692 |
identifier { |
| 693 |
name: "notavailablecolumn" |
| 694 |
} |
| 695 |
} |
| 696 |
param { |
| 697 |
type: LITERAL |
| 698 |
literal { |
| 699 |
type: V_SINT |
| 700 |
v_signed_int: 1 |
| 701 |
|
| 702 |
} |
| 703 |
} |
| 704 |
} |
| 705 |
} |
| 706 |
} |
| 707 |
-->expecterror 1054 |
| 708 |
-->recvresult |
| 709 |
|
| 710 |
EOF |
| 711 |
|
| 712 |
--exec $MYSQLXTEST -u crudfinduser --password='crudfinduser' --file=$MYSQL_TMP_DIR/find_crud_table.xpl 2>&1 |
| 713 |
--remove_file $MYSQL_TMP_DIR/find_crud_table.xpl |
| 714 |
|
| 715 |
|
| 716 |
--write_file $MYSQL_TMP_DIR/find_crud_coll.xpl |
| 717 |
CREATE SCHEMA mysqlxcoll; |
| 718 |
|
| 719 |
-->stmtadmin create_collection {"schema":"mysqlxcoll","name":"maincoll"} |
| 720 |
-->recvresult |
| 721 |
|
| 722 |
USE mysqlxcoll; |
| 723 |
|
| 724 |
INSERT INTO maincoll (doc) values |
| 725 |
('{"_id": "1", "name": "Victor", "last_name": "Otero","amount": 4.99}'), |
| 726 |
('{"_id": "2", "name": "Gonzalo", "last_name": "Crhystens","amount": 120.57}'), |
| 727 |
('{"_id": "3", "name": "Abraham", "last_name": "Vega","amount": 74.56}'), |
| 728 |
('{"_id": "4", "name": "Jennifer", "last_name": "Leon","amount": 387.14}'), |
| 729 |
('{"_id": "5", "name": "Jhonny", "last_name": "Test","amount": 125.45}'); |
| 730 |
|
| 731 |
|
| 732 |
-->echo Collection based scenarios |
| 733 |
-->echo Find all the rows including all metadata |
| 734 |
Mysqlx.Crud.Find { |
| 735 |
collection { |
| 736 |
name: "maincoll" |
| 737 |
schema: "mysqlxcoll" |
| 738 |
} |
| 739 |
data_model: DOCUMENT |
| 740 |
} |
| 741 |
## expect Mysqlx.Sql.ColumnMetaData |
| 742 |
-->recv |
| 743 |
## expect Mysqlx.Sql.Row |
| 744 |
-->recv |
| 745 |
## expect Mysqlx.Sql.Row |
| 746 |
-->recv |
| 747 |
## expect Mysqlx.Sql.Row |
| 748 |
-->recv |
| 749 |
## expect Mysqlx.Sql.Row |
| 750 |
-->recv |
| 751 |
## expect Mysqlx.Sql.Row |
| 752 |
-->recv |
| 753 |
## expect Mysqlx.Sql.ResultFetchDone |
| 754 |
-->recv |
| 755 |
## expect Mysqlx.Sql.StmtExecuteOk |
| 756 |
-->recv |
| 757 |
|
| 758 |
-->echo Find all the rows without all metadata |
| 759 |
Mysqlx.Crud.Find { |
| 760 |
collection { |
| 761 |
name: "maincoll" |
| 762 |
schema: "mysqlxcoll" |
| 763 |
} |
| 764 |
data_model: DOCUMENT |
| 765 |
} |
| 766 |
-->recvresult |
| 767 |
|
| 768 |
-->echo Find with limit row count and offset |
| 769 |
Mysqlx.Crud.Find { |
| 770 |
collection { |
| 771 |
name: "maincoll" |
| 772 |
schema: "mysqlxcoll" |
| 773 |
} |
| 774 |
data_model: DOCUMENT |
| 775 |
limit{ |
| 776 |
row_count:2 |
| 777 |
offset:3 |
| 778 |
} |
| 779 |
} |
| 780 |
-->recvresult |
| 781 |
|
| 782 |
-->echo Find with limit row count |
| 783 |
Mysqlx.Crud.Find { |
| 784 |
collection { |
| 785 |
name: "maincoll" |
| 786 |
schema: "mysqlxcoll" |
| 787 |
} |
| 788 |
data_model: DOCUMENT |
| 789 |
limit{ |
| 790 |
row_count:3 |
| 791 |
} |
| 792 |
} |
| 793 |
-->recvresult |
| 794 |
|
| 795 |
-->echo Find specific row with == Operator |
| 796 |
Mysqlx.Crud.Find { |
| 797 |
collection { |
| 798 |
name: "maincoll" |
| 799 |
schema: "mysqlxcoll" |
| 800 |
} |
| 801 |
data_model: DOCUMENT |
| 802 |
criteria { |
| 803 |
type: OPERATOR |
| 804 |
operator { |
| 805 |
name: "==" |
| 806 |
param { |
| 807 |
type: IDENT |
| 808 |
identifier { |
| 809 |
name: "_id" |
| 810 |
} |
| 811 |
} |
| 812 |
param { |
| 813 |
type: LITERAL |
| 814 |
literal { |
| 815 |
type: V_OCTETS |
| 816 |
v_octets {value:"1"} |
| 817 |
} |
| 818 |
} |
| 819 |
} |
| 820 |
} |
| 821 |
} |
| 822 |
-->recvresult |
| 823 |
|
| 824 |
-->echo Find specific row with != Operator |
| 825 |
Mysqlx.Crud.Find { |
| 826 |
collection { |
| 827 |
name: "maincoll" |
| 828 |
schema: "mysqlxcoll" |
| 829 |
} |
| 830 |
data_model: DOCUMENT |
| 831 |
criteria { |
| 832 |
type: OPERATOR |
| 833 |
operator { |
| 834 |
name: "!=" |
| 835 |
param { |
| 836 |
type: IDENT |
| 837 |
identifier { |
| 838 |
document_path { |
| 839 |
type: MEMBER |
| 840 |
value: "name" |
| 841 |
} |
| 842 |
} |
| 843 |
} |
| 844 |
param { |
| 845 |
type: LITERAL |
| 846 |
literal { |
| 847 |
type: V_OCTETS |
| 848 |
v_octets {value:"Jhonny"} |
| 849 |
|
| 850 |
} |
| 851 |
} |
| 852 |
} |
| 853 |
} |
| 854 |
} |
| 855 |
-->recvresult |
| 856 |
|
| 857 |
-->echo Find specific row with like Operator |
| 858 |
Mysqlx.Crud.Find { |
| 859 |
collection { |
| 860 |
name: "maincoll" |
| 861 |
schema: "mysqlxcoll" |
| 862 |
} |
| 863 |
data_model: DOCUMENT |
| 864 |
criteria { |
| 865 |
type: OPERATOR |
| 866 |
operator { |
| 867 |
name: "like" |
| 868 |
param { |
| 869 |
type: IDENT |
| 870 |
identifier { |
| 871 |
document_path { |
| 872 |
type: MEMBER |
| 873 |
value: "name" |
| 874 |
} |
| 875 |
} |
| 876 |
} |
| 877 |
param { |
| 878 |
type: LITERAL |
| 879 |
literal { |
| 880 |
type: V_OCTETS |
| 881 |
v_octets {value:"%er%"} |
| 882 |
|
| 883 |
} |
| 884 |
} |
| 885 |
} |
| 886 |
} |
| 887 |
} |
| 888 |
-->recvresult |
| 889 |
|
| 890 |
-->echo Find specific row with && and like Operators |
| 891 |
Mysqlx.Crud.Find { |
| 892 |
collection { |
| 893 |
name: "maincoll" |
| 894 |
schema: "mysqlxcoll" |
| 895 |
} |
| 896 |
data_model: DOCUMENT |
| 897 |
criteria { |
| 898 |
type: OPERATOR |
| 899 |
operator { |
| 900 |
name: "&&" |
| 901 |
param { |
| 902 |
type: OPERATOR |
| 903 |
operator{ |
| 904 |
name: "like" |
| 905 |
param{ |
| 906 |
type: IDENT |
| 907 |
identifier { |
| 908 |
document_path { |
| 909 |
type: MEMBER |
| 910 |
value: "name" |
| 911 |
} |
| 912 |
} |
| 913 |
} |
| 914 |
param { |
| 915 |
type: LITERAL |
| 916 |
literal { |
| 917 |
type: V_OCTETS |
| 918 |
v_octets {value:"%er%"} |
| 919 |
|
| 920 |
} |
| 921 |
} |
| 922 |
} |
| 923 |
} |
| 924 |
param { |
| 925 |
type: OPERATOR |
| 926 |
operator{ |
| 927 |
name: "like" |
| 928 |
param{ |
| 929 |
type: IDENT |
| 930 |
identifier { |
| 931 |
document_path { |
| 932 |
type: MEMBER |
| 933 |
value: "last_name" |
| 934 |
} |
| 935 |
} |
| 936 |
} |
| 937 |
param { |
| 938 |
type: LITERAL |
| 939 |
literal { |
| 940 |
type: V_OCTETS |
| 941 |
v_octets {value:"%on%"} |
| 942 |
|
| 943 |
} |
| 944 |
} |
| 945 |
} |
| 946 |
} |
| 947 |
} |
| 948 |
} |
| 949 |
} |
| 950 |
-->recvresult |
| 951 |
|
| 952 |
-->echo Find specific row with || and in Operators |
| 953 |
Mysqlx.Crud.Find { |
| 954 |
collection { |
| 955 |
name: "maincoll" |
| 956 |
schema: "mysqlxcoll" |
| 957 |
} |
| 958 |
data_model: DOCUMENT |
| 959 |
criteria { |
| 960 |
type: OPERATOR |
| 961 |
operator { |
| 962 |
name: "||" |
| 963 |
param { |
| 964 |
type: OPERATOR |
| 965 |
operator{ |
| 966 |
name: "in" |
| 967 |
param { |
| 968 |
type: IDENT |
| 969 |
identifier { |
| 970 |
name: "_id" |
| 971 |
} |
| 972 |
} |
| 973 |
param { |
| 974 |
type: LITERAL |
| 975 |
literal { |
| 976 |
type: V_SINT |
| 977 |
v_signed_int: 3 |
| 978 |
} |
| 979 |
} |
| 980 |
param { |
| 981 |
type: LITERAL |
| 982 |
literal { |
| 983 |
type: V_SINT |
| 984 |
v_signed_int: 4 |
| 985 |
} |
| 986 |
} |
| 987 |
} |
| 988 |
} |
| 989 |
param { |
| 990 |
type: OPERATOR |
| 991 |
operator { |
| 992 |
name: "like" |
| 993 |
param { |
| 994 |
type: IDENT |
| 995 |
identifier { |
| 996 |
document_path { |
| 997 |
type: MEMBER |
| 998 |
value: "name" |
| 999 |
} |
| 1000 |
} |
| 1001 |
} |
| 1002 |
param { |
| 1003 |
type: LITERAL |
| 1004 |
literal { |
| 1005 |
type: V_OCTETS |
| 1006 |
v_octets {value:"Gonzalo"} |
| 1007 |
} |
| 1008 |
} |
| 1009 |
} |
| 1010 |
} |
| 1011 |
} |
| 1012 |
} |
| 1013 |
} |
| 1014 |
-->recvresult |
| 1015 |
|
| 1016 |
-->echo Find specific row with not_in Operators |
| 1017 |
Mysqlx.Crud.Find { |
| 1018 |
collection { |
| 1019 |
name: "maincoll" |
| 1020 |
schema: "mysqlxcoll" |
| 1021 |
} |
| 1022 |
data_model: DOCUMENT |
| 1023 |
criteria { |
| 1024 |
type: OPERATOR |
| 1025 |
operator { |
| 1026 |
name: "not_in" |
| 1027 |
param { |
| 1028 |
type: IDENT identifier { name: "_id" } |
| 1029 |
} |
| 1030 |
param { |
| 1031 |
type: LITERAL |
| 1032 |
literal { |
| 1033 |
type: V_OCTETS |
| 1034 |
v_octets {value:"1"} |
| 1035 |
} |
| 1036 |
} |
| 1037 |
param { |
| 1038 |
type: LITERAL |
| 1039 |
literal { |
| 1040 |
type: V_OCTETS |
| 1041 |
v_octets {value:"2"} |
| 1042 |
} |
| 1043 |
} |
| 1044 |
param { |
| 1045 |
type: LITERAL |
| 1046 |
literal { |
| 1047 |
type: V_OCTETS |
| 1048 |
v_octets {value:"3"} |
| 1049 |
} |
| 1050 |
} |
| 1051 |
} |
| 1052 |
} |
| 1053 |
} |
| 1054 |
-->recvresult |
| 1055 |
|
| 1056 |
-->echo Find specific row with &&, <= and >= Operators |
| 1057 |
Mysqlx.Crud.Find { |
| 1058 |
collection { |
| 1059 |
name: "maincoll" |
| 1060 |
schema: "mysqlxcoll" |
| 1061 |
} |
| 1062 |
data_model: DOCUMENT |
| 1063 |
criteria { |
| 1064 |
type: OPERATOR |
| 1065 |
operator { |
| 1066 |
name: "&&" |
| 1067 |
param { |
| 1068 |
type: OPERATOR |
| 1069 |
operator{ |
| 1070 |
name: "<=" |
| 1071 |
param{ |
| 1072 |
type: IDENT |
| 1073 |
identifier { |
| 1074 |
document_path { |
| 1075 |
type: MEMBER |
| 1076 |
value: "amount" |
| 1077 |
} |
| 1078 |
} |
| 1079 |
} |
| 1080 |
param { |
| 1081 |
type: LITERAL |
| 1082 |
literal { |
| 1083 |
type: V_DOUBLE |
| 1084 |
v_double: 120.57 |
| 1085 |
} |
| 1086 |
} |
| 1087 |
} |
| 1088 |
} |
| 1089 |
param { |
| 1090 |
type: OPERATOR |
| 1091 |
operator{ |
| 1092 |
name: ">=" |
| 1093 |
param{ |
| 1094 |
type: IDENT |
| 1095 |
identifier { |
| 1096 |
document_path { |
| 1097 |
type: MEMBER |
| 1098 |
value: "amount" |
| 1099 |
} |
| 1100 |
} |
| 1101 |
} |
| 1102 |
param { |
| 1103 |
type: LITERAL |
| 1104 |
literal { |
| 1105 |
type: V_DOUBLE |
| 1106 |
v_double: 4.99 |
| 1107 |
|
| 1108 |
} |
| 1109 |
} |
| 1110 |
} |
| 1111 |
} |
| 1112 |
} |
| 1113 |
} |
| 1114 |
} |
| 1115 |
-->recvresult |
| 1116 |
|
| 1117 |
-->echo Find specific row with &&, < and > Operators |
| 1118 |
Mysqlx.Crud.Find { |
| 1119 |
collection { |
| 1120 |
name: "maincoll" |
| 1121 |
schema: "mysqlxcoll" |
| 1122 |
} |
| 1123 |
data_model: DOCUMENT |
| 1124 |
criteria { |
| 1125 |
type: OPERATOR |
| 1126 |
operator { |
| 1127 |
name: "&&" |
| 1128 |
param { |
| 1129 |
type: OPERATOR |
| 1130 |
operator{ |
| 1131 |
name: "<" |
| 1132 |
param{ |
| 1133 |
type: IDENT |
| 1134 |
identifier { |
| 1135 |
document_path { |
| 1136 |
type: MEMBER |
| 1137 |
value: "amount" |
| 1138 |
} |
| 1139 |
} |
| 1140 |
} |
| 1141 |
param { |
| 1142 |
type: LITERAL |
| 1143 |
literal { |
| 1144 |
type: V_DOUBLE |
| 1145 |
v_double: 120.57 |
| 1146 |
|
| 1147 |
} |
| 1148 |
} |
| 1149 |
} |
| 1150 |
} |
| 1151 |
param { |
| 1152 |
type: OPERATOR |
| 1153 |
operator{ |
| 1154 |
name: ">" |
| 1155 |
param{ |
| 1156 |
type: IDENT |
| 1157 |
identifier { |
| 1158 |
document_path { |
| 1159 |
type: MEMBER |
| 1160 |
value: "amount" |
| 1161 |
} |
| 1162 |
} |
| 1163 |
} |
| 1164 |
param { |
| 1165 |
type: LITERAL |
| 1166 |
literal { |
| 1167 |
type: V_DOUBLE |
| 1168 |
v_double: 4.99 |
| 1169 |
|
| 1170 |
} |
| 1171 |
} |
| 1172 |
} |
| 1173 |
} |
| 1174 |
} |
| 1175 |
} |
| 1176 |
} |
| 1177 |
-->recvresult |
| 1178 |
|
| 1179 |
-->echo Find with not available schema name |
| 1180 |
Mysqlx.Crud.Find { |
| 1181 |
collection { |
| 1182 |
name: "maincoll" |
| 1183 |
schema: "notavailableschema" |
| 1184 |
} |
| 1185 |
data_model: DOCUMENT |
| 1186 |
criteria { |
| 1187 |
type: OPERATOR |
| 1188 |
operator { |
| 1189 |
name: "not_in" |
| 1190 |
param { |
| 1191 |
type: IDENT |
| 1192 |
identifier { |
| 1193 |
document_path { |
| 1194 |
type: MEMBER |
| 1195 |
value: "==" |
| 1196 |
} |
| 1197 |
} |
| 1198 |
} |
| 1199 |
param { |
| 1200 |
type: LITERAL |
| 1201 |
literal { |
| 1202 |
type: V_OCTETS |
| 1203 |
v_octets {value:"1"} |
| 1204 |
|
| 1205 |
} |
| 1206 |
} |
| 1207 |
} |
| 1208 |
} |
| 1209 |
} |
| 1210 |
-->expecterror 1049 |
| 1211 |
-->recvresult |
| 1212 |
|
| 1213 |
-->echo Find with not available table name |
| 1214 |
Mysqlx.Crud.Find { |
| 1215 |
collection { |
| 1216 |
name: "notavailabletable" |
| 1217 |
schema: "mysqlxcoll" |
| 1218 |
} |
| 1219 |
data_model: DOCUMENT |
| 1220 |
criteria { |
| 1221 |
type: OPERATOR |
| 1222 |
operator { |
| 1223 |
name: "==" |
| 1224 |
param { |
| 1225 |
type: IDENT identifier { name: "_id" } |
| 1226 |
} |
| 1227 |
param { |
| 1228 |
type: LITERAL |
| 1229 |
literal { |
| 1230 |
type: V_OCTETS |
| 1231 |
v_octets {value:"1"} |
| 1232 |
} |
| 1233 |
} |
| 1234 |
} |
| 1235 |
} |
| 1236 |
} |
| 1237 |
-->expecterror 1146 |
| 1238 |
-->recvresult |
| 1239 |
|
| 1240 |
-->echo Find with not available column name |
| 1241 |
Mysqlx.Crud.Find { |
| 1242 |
collection { |
| 1243 |
name: "maincoll" |
| 1244 |
schema: "mysqlxcoll" |
| 1245 |
} |
| 1246 |
data_model: DOCUMENT |
| 1247 |
criteria { |
| 1248 |
type: OPERATOR |
| 1249 |
operator { |
| 1250 |
name: "==" |
| 1251 |
param { |
| 1252 |
type: IDENT |
| 1253 |
identifier { |
| 1254 |
document_path { |
| 1255 |
type: MEMBER |
| 1256 |
value: "notavailablecolumn" |
| 1257 |
} |
| 1258 |
} |
| 1259 |
} |
| 1260 |
param { |
| 1261 |
type: LITERAL |
| 1262 |
literal { |
| 1263 |
type: V_OCTETS |
| 1264 |
v_octets {value:"1"} |
| 1265 |
|
| 1266 |
} |
| 1267 |
} |
| 1268 |
} |
| 1269 |
} |
| 1270 |
} |
| 1271 |
-->recvresult |
| 1272 |
|
| 1273 |
## Cleanup |
| 1274 |
-->echo ================================================================================ |
| 1275 |
-->echo CLEAN UP |
| 1276 |
-->echo ================================================================================ |
| 1277 |
-->sql |
| 1278 |
DROP SCHEMA IF EXISTS minisakila; |
| 1279 |
DROP SCHEMA IF EXISTS mysqlxcoll; |
| 1280 |
DROP USER crudfinduser@localhost; |
| 1281 |
-->endsql |
| 1282 |
EOF |
| 1283 |
|
| 1284 |
--exec $MYSQLXTEST -u crudfinduser --password='crudfinduser' --file=$MYSQL_TMP_DIR/find_crud_coll.xpl 2>&1 |
| 1285 |
|
| 1286 |
## Cleanup |
| 1287 |
--source ../include/xplugin_cleanup.inc |
| 1288 |
|