Debian Codegraph @

mysql-test/suite/x/r/delete_crud_o.result

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