Debian Codegraph @

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

raw
1 =============================================
2 CRUD UPDATE ITEM_REPLACE SCENARIOS
3 =============================================
4
5 ================================================================================
6 PREAMBLE
7 ================================================================================
8 create user upditemreplace@localhost identified by 'upditemreplace';
9 grant all on *.* to upditemreplace@localhost;
10 CREATE SCHEMA mysqlxcoll;
11 ================================================================================
12 TEST START
13 ================================================================================
14
15 command ok
16 RUN SET SQL_SAFE_UPDATES = 0
17
18 0 rows affected
19 RUN USE mysqlxcoll
20
21 0 rows affected
22 RUN INSERT INTO maincoll (doc) values ('{"_id": "1", "name": "Victor", "last_name": "Otero","amount": 4.99}')
23
24 1 rows affected
25 RUN INSERT INTO maincoll (doc) values ('{"_id": "2", "name": "Gonzalo", "last_name": "Chrystens","amount": 120.57}')
26
27 1 rows affected
28 RUN INSERT INTO maincoll (doc) values ('{"_id": "3", "name": "Abraham", "last_name": "Vega","amount": 74.56}')
29
30 1 rows affected
31 RUN INSERT INTO maincoll (doc) values ('{"_id": "4", "name": "Jennifer", "last_name": "Leon","amount": 387.14}')
32
33 1 rows affected
34 RUN INSERT INTO maincoll (doc) values ('{"_id": "5", "name": "Jhonny", "last_name": "Test","amount": 125.45}')
35
36 1 rows affected
37 RUN INSERT INTO maincoll (doc) values ('{"_id": "0"}')
38
39 1 rows affected
40 Update a valid collection with == operator
41 send Mysqlx.Crud.Update {
42 collection {
43 name: "maincoll"
44 schema: "mysqlxcoll"
45 }
46 data_model: DOCUMENT
47 criteria {
48 type: OPERATOR
49 operator {
50 name: "=="
51 param {
52 type: IDENT
53 identifier {
54 name: "_id"
55 }
56 }
57 param {
58 type: LITERAL
59 literal {
60 type: V_OCTETS
61 v_octets {
62 value: "1"
63 }
64 }
65 }
66 }
67 }
68 operation {
69 source {
70 document_path {
71 type: MEMBER
72 value: "name"
73 }
74 }
75 operation: ITEM_REPLACE
76 value {
77 type: LITERAL
78 literal {
79 type: V_STRING
80 v_string {
81 value: "\"VictorReplaced\""
82 }
83 }
84 }
85 }
86 }
87
88
89 1 rows affected
90 Rows matched: 1 Changed: 1 Warnings: 0
91 RUN select doc from maincoll
92 doc
93 {"_id": "0"}
94 {"_id": "1", "name": "\"VictorReplaced\"", "amount": 4.99, "last_name": "Otero"}
95 {"_id": "2", "name": "Gonzalo", "amount": 120.57, "last_name": "Chrystens"}
96 {"_id": "3", "name": "Abraham", "amount": 74.56, "last_name": "Vega"}
97 {"_id": "4", "name": "Jennifer", "amount": 387.14, "last_name": "Leon"}
98 {"_id": "5", "name": "Jhonny", "amount": 125.45, "last_name": "Test"}
99 0 rows affected
100 Update a valid collection with string value and > operator for multiple docs
101 send Mysqlx.Crud.Update {
102 collection {
103 name: "maincoll"
104 schema: "mysqlxcoll"
105 }
106 data_model: DOCUMENT
107 criteria {
108 type: OPERATOR
109 operator {
110 name: ">"
111 param {
112 type: IDENT
113 identifier {
114 document_path {
115 type: MEMBER
116 value: "_id"
117 }
118 }
119 }
120 param {
121 type: LITERAL
122 literal {
123 type: V_OCTETS
124 v_octets {
125 value: "3"
126 }
127 }
128 }
129 }
130 }
131 operation {
132 source {
133 document_path {
134 type: MEMBER
135 value: "name"
136 }
137 }
138 operation: ITEM_REPLACE
139 value {
140 type: LITERAL
141 literal {
142 type: V_STRING
143 v_string {
144 value: "\"xtest_>\""
145 }
146 }
147 }
148 }
149 }
150
151
152 2 rows affected
153 Rows matched: 2 Changed: 2 Warnings: 0
154 RUN select doc from maincoll
155 doc
156 {"_id": "0"}
157 {"_id": "1", "name": "\"VictorReplaced\"", "amount": 4.99, "last_name": "Otero"}
158 {"_id": "2", "name": "Gonzalo", "amount": 120.57, "last_name": "Chrystens"}
159 {"_id": "3", "name": "Abraham", "amount": 74.56, "last_name": "Vega"}
160 {"_id": "4", "name": "\"xtest_>\"", "amount": 387.14, "last_name": "Leon"}
161 {"_id": "5", "name": "\"xtest_>\"", "amount": 125.45, "last_name": "Test"}
162 0 rows affected
163 Update a valid collection with string value and < operator for multiple docs
164 send Mysqlx.Crud.Update {
165 collection {
166 name: "maincoll"
167 schema: "mysqlxcoll"
168 }
169 data_model: DOCUMENT
170 criteria {
171 type: OPERATOR
172 operator {
173 name: "<"
174 param {
175 type: IDENT
176 identifier {
177 document_path {
178 type: MEMBER
179 value: "_id"
180 }
181 }
182 }
183 param {
184 type: LITERAL
185 literal {
186 type: V_OCTETS
187 v_octets {
188 value: "3"
189 }
190 }
191 }
192 }
193 }
194 operation {
195 source {
196 document_path {
197 type: MEMBER
198 value: "name"
199 }
200 }
201 operation: ITEM_REPLACE
202 value {
203 type: LITERAL
204 literal {
205 type: V_STRING
206 v_string {
207 value: "\"xtest_<\""
208 }
209 }
210 }
211 }
212 }
213
214
215 2 rows affected
216 Rows matched: 3 Changed: 2 Warnings: 0
217 RUN select doc from maincoll
218 doc
219 {"_id": "0"}
220 {"_id": "1", "name": "\"xtest_<\"", "amount": 4.99, "last_name": "Otero"}
221 {"_id": "2", "name": "\"xtest_<\"", "amount": 120.57, "last_name": "Chrystens"}
222 {"_id": "3", "name": "Abraham", "amount": 74.56, "last_name": "Vega"}
223 {"_id": "4", "name": "\"xtest_>\"", "amount": 387.14, "last_name": "Leon"}
224 {"_id": "5", "name": "\"xtest_>\"", "amount": 125.45, "last_name": "Test"}
225 0 rows affected
226 Update a valid collection with string value and <= operator for multiple docs
227 send Mysqlx.Crud.Update {
228 collection {
229 name: "maincoll"
230 schema: "mysqlxcoll"
231 }
232 data_model: DOCUMENT
233 criteria {
234 type: OPERATOR
235 operator {
236 name: "<="
237 param {
238 type: IDENT
239 identifier {
240 document_path {
241 type: MEMBER
242 value: "_id"
243 }
244 }
245 }
246 param {
247 type: LITERAL
248 literal {
249 type: V_OCTETS
250 v_octets {
251 value: "3"
252 }
253 }
254 }
255 }
256 }
257 operation {
258 source {
259 document_path {
260 type: MEMBER
261 value: "last_name"
262 }
263 }
264 operation: ITEM_REPLACE
265 value {
266 type: LITERAL
267 literal {
268 type: V_STRING
269 v_string {
270 value: "\"xtest_<=\""
271 }
272 }
273 }
274 }
275 }
276
277
278 3 rows affected
279 Rows matched: 4 Changed: 3 Warnings: 0
280 RUN select doc from maincoll
281 doc
282 {"_id": "0"}
283 {"_id": "1", "name": "\"xtest_<\"", "amount": 4.99, "last_name": "\"xtest_<=\""}
284 {"_id": "2", "name": "\"xtest_<\"", "amount": 120.57, "last_name": "\"xtest_<=\""}
285 {"_id": "3", "name": "Abraham", "amount": 74.56, "last_name": "\"xtest_<=\""}
286 {"_id": "4", "name": "\"xtest_>\"", "amount": 387.14, "last_name": "Leon"}
287 {"_id": "5", "name": "\"xtest_>\"", "amount": 125.45, "last_name": "Test"}
288 0 rows affected
289 Update a valid collection with string value and >= operator for multiple docs
290 send Mysqlx.Crud.Update {
291 collection {
292 name: "maincoll"
293 schema: "mysqlxcoll"
294 }
295 data_model: DOCUMENT
296 criteria {
297 type: OPERATOR
298 operator {
299 name: ">="
300 param {
301 type: IDENT
302 identifier {
303 document_path {
304 type: MEMBER
305 value: "_id"
306 }
307 }
308 }
309 param {
310 type: LITERAL
311 literal {
312 type: V_OCTETS
313 v_octets {
314 value: "4"
315 }
316 }
317 }
318 }
319 }
320 operation {
321 source {
322 document_path {
323 type: MEMBER
324 value: "last_name"
325 }
326 }
327 operation: ITEM_REPLACE
328 value {
329 type: LITERAL
330 literal {
331 type: V_STRING
332 v_string {
333 value: "\"xtest_>=\""
334 }
335 }
336 }
337 }
338 }
339
340
341 2 rows affected
342 Rows matched: 2 Changed: 2 Warnings: 0
343 RUN select doc from maincoll
344 doc
345 {"_id": "0"}
346 {"_id": "1", "name": "\"xtest_<\"", "amount": 4.99, "last_name": "\"xtest_<=\""}
347 {"_id": "2", "name": "\"xtest_<\"", "amount": 120.57, "last_name": "\"xtest_<=\""}
348 {"_id": "3", "name": "Abraham", "amount": 74.56, "last_name": "\"xtest_<=\""}
349 {"_id": "4", "name": "\"xtest_>\"", "amount": 387.14, "last_name": "\"xtest_>=\""}
350 {"_id": "5", "name": "\"xtest_>\"", "amount": 125.45, "last_name": "\"xtest_>=\""}
351 0 rows affected
352 Update a valid collection with string value and != operator for multiple docs
353 send Mysqlx.Crud.Update {
354 collection {
355 name: "maincoll"
356 schema: "mysqlxcoll"
357 }
358 data_model: DOCUMENT
359 criteria {
360 type: OPERATOR
361 operator {
362 name: "!="
363 param {
364 type: IDENT
365 identifier {
366 document_path {
367 type: MEMBER
368 value: "_id"
369 }
370 }
371 }
372 param {
373 type: LITERAL
374 literal {
375 type: V_OCTETS
376 v_octets {
377 value: "2"
378 }
379 }
380 }
381 }
382 }
383 operation {
384 source {
385 document_path {
386 type: MEMBER
387 value: "amount"
388 }
389 }
390 operation: ITEM_REPLACE
391 value {
392 type: LITERAL
393 literal {
394 type: V_STRING
395 v_string {
396 value: "\"xtest_!=\""
397 }
398 }
399 }
400 }
401 }
402
403
404 4 rows affected
405 Rows matched: 5 Changed: 4 Warnings: 0
406 RUN select doc from maincoll
407 doc
408 {"_id": "0"}
409 {"_id": "1", "name": "\"xtest_<\"", "amount": "\"xtest_!=\"", "last_name": "\"xtest_<=\""}
410 {"_id": "2", "name": "\"xtest_<\"", "amount": 120.57, "last_name": "\"xtest_<=\""}
411 {"_id": "3", "name": "Abraham", "amount": "\"xtest_!=\"", "last_name": "\"xtest_<=\""}
412 {"_id": "4", "name": "\"xtest_>\"", "amount": "\"xtest_!=\"", "last_name": "\"xtest_>=\""}
413 {"_id": "5", "name": "\"xtest_>\"", "amount": "\"xtest_!=\"", "last_name": "\"xtest_>=\""}
414 0 rows affected
415 Update with non existing doc member
416 send Mysqlx.Crud.Update {
417 collection {
418 name: "maincoll"
419 schema: "mysqlxcoll"
420 }
421 data_model: DOCUMENT
422 criteria {
423 type: OPERATOR
424 operator {
425 name: "!="
426 param {
427 type: IDENT
428 identifier {
429 document_path {
430 type: MEMBER
431 value: "_id"
432 }
433 }
434 }
435 param {
436 type: LITERAL
437 literal {
438 type: V_OCTETS
439 v_octets {
440 value: "2"
441 }
442 }
443 }
444 }
445 }
446 operation {
447 source {
448 document_path {
449 type: MEMBER
450 value: "notamember"
451 }
452 }
453 operation: ITEM_REPLACE
454 value {
455 type: LITERAL
456 literal {
457 type: V_STRING
458 v_string {
459 value: "\"xtest_notmemberdoc\""
460 }
461 }
462 }
463 }
464 }
465
466
467 0 rows affected
468 Rows matched: 5 Changed: 0 Warnings: 0
469 RUN select doc from maincoll
470 doc
471 {"_id": "0"}
472 {"_id": "1", "name": "\"xtest_<\"", "amount": "\"xtest_!=\"", "last_name": "\"xtest_<=\""}
473 {"_id": "2", "name": "\"xtest_<\"", "amount": 120.57, "last_name": "\"xtest_<=\""}
474 {"_id": "3", "name": "Abraham", "amount": "\"xtest_!=\"", "last_name": "\"xtest_<=\""}
475 {"_id": "4", "name": "\"xtest_>\"", "amount": "\"xtest_!=\"", "last_name": "\"xtest_>=\""}
476 {"_id": "5", "name": "\"xtest_>\"", "amount": "\"xtest_!=\"", "last_name": "\"xtest_>=\""}
477 0 rows affected
478 unsigned int data type update for Document
479 send Mysqlx.Crud.Update {
480 collection {
481 name: "maincoll"
482 schema: "mysqlxcoll"
483 }
484 data_model: DOCUMENT
485 criteria {
486 type: OPERATOR
487 operator {
488 name: ">"
489 param {
490 type: IDENT
491 identifier {
492 document_path {
493 type: MEMBER
494 value: "_id"
495 }
496 }
497 }
498 param {
499 type: LITERAL
500 literal {
501 type: V_OCTETS
502 v_octets {
503 value: "3"
504 }
505 }
506 }
507 }
508 }
509 operation {
510 source {
511 document_path {
512 type: MEMBER
513 value: "amount"
514 }
515 }
516 operation: ITEM_REPLACE
517 value {
518 type: LITERAL
519 literal {
520 type: V_UINT
521 v_unsigned_int: 23
522 }
523 }
524 }
525 }
526
527
528 2 rows affected
529 Rows matched: 2 Changed: 2 Warnings: 0
530 RUN select doc from maincoll
531 doc
532 {"_id": "0"}
533 {"_id": "1", "name": "\"xtest_<\"", "amount": "\"xtest_!=\"", "last_name": "\"xtest_<=\""}
534 {"_id": "2", "name": "\"xtest_<\"", "amount": 120.57, "last_name": "\"xtest_<=\""}
535 {"_id": "3", "name": "Abraham", "amount": "\"xtest_!=\"", "last_name": "\"xtest_<=\""}
536 {"_id": "4", "name": "\"xtest_>\"", "amount": 23, "last_name": "\"xtest_>=\""}
537 {"_id": "5", "name": "\"xtest_>\"", "amount": 23, "last_name": "\"xtest_>=\""}
538 0 rows affected
539 signed int data type update for Document
540 send Mysqlx.Crud.Update {
541 collection {
542 name: "maincoll"
543 schema: "mysqlxcoll"
544 }
545 data_model: DOCUMENT
546 criteria {
547 type: OPERATOR
548 operator {
549 name: ">"
550 param {
551 type: IDENT
552 identifier {
553 document_path {
554 type: MEMBER
555 value: "_id"
556 }
557 }
558 }
559 param {
560 type: LITERAL
561 literal {
562 type: V_OCTETS
563 v_octets {
564 value: "3"
565 }
566 }
567 }
568 }
569 }
570 operation {
571 source {
572 document_path {
573 type: MEMBER
574 value: "amount"
575 }
576 }
577 operation: ITEM_REPLACE
578 value {
579 type: LITERAL
580 literal {
581 type: V_SINT
582 v_signed_int: 25
583 }
584 }
585 }
586 }
587
588
589 2 rows affected
590 Rows matched: 2 Changed: 2 Warnings: 0
591 RUN select doc from maincoll
592 doc
593 {"_id": "0"}
594 {"_id": "1", "name": "\"xtest_<\"", "amount": "\"xtest_!=\"", "last_name": "\"xtest_<=\""}
595 {"_id": "2", "name": "\"xtest_<\"", "amount": 120.57, "last_name": "\"xtest_<=\""}
596 {"_id": "3", "name": "Abraham", "amount": "\"xtest_!=\"", "last_name": "\"xtest_<=\""}
597 {"_id": "4", "name": "\"xtest_>\"", "amount": 25, "last_name": "\"xtest_>=\""}
598 {"_id": "5", "name": "\"xtest_>\"", "amount": 25, "last_name": "\"xtest_>=\""}
599 0 rows affected
600 double data type update for Document
601 send Mysqlx.Crud.Update {
602 collection {
603 name: "maincoll"
604 schema: "mysqlxcoll"
605 }
606 data_model: DOCUMENT
607 criteria {
608 type: OPERATOR
609 operator {
610 name: ">"
611 param {
612 type: IDENT
613 identifier {
614 document_path {
615 type: MEMBER
616 value: "_id"
617 }
618 }
619 }
620 param {
621 type: LITERAL
622 literal {
623 type: V_OCTETS
624 v_octets {
625 value: "3"
626 }
627 }
628 }
629 }
630 }
631 operation {
632 source {
633 document_path {
634 type: MEMBER
635 value: "amount"
636 }
637 }
638 operation: ITEM_REPLACE
639 value {
640 type: LITERAL
641 literal {
642 type: V_DOUBLE
643 v_double: 26.53
644 }
645 }
646 }
647 }
648
649
650 2 rows affected
651 Rows matched: 2 Changed: 2 Warnings: 0
652 RUN select doc from maincoll
653 doc
654 {"_id": "0"}
655 {"_id": "1", "name": "\"xtest_<\"", "amount": "\"xtest_!=\"", "last_name": "\"xtest_<=\""}
656 {"_id": "2", "name": "\"xtest_<\"", "amount": 120.57, "last_name": "\"xtest_<=\""}
657 {"_id": "3", "name": "Abraham", "amount": "\"xtest_!=\"", "last_name": "\"xtest_<=\""}
658 {"_id": "4", "name": "\"xtest_>\"", "amount": 26.53, "last_name": "\"xtest_>=\""}
659 {"_id": "5", "name": "\"xtest_>\"", "amount": 26.53, "last_name": "\"xtest_>=\""}
660 0 rows affected
661 float data type update for Document
662 send Mysqlx.Crud.Update {
663 collection {
664 name: "maincoll"
665 schema: "mysqlxcoll"
666 }
667 data_model: DOCUMENT
668 criteria {
669 type: OPERATOR
670 operator {
671 name: ">"
672 param {
673 type: IDENT
674 identifier {
675 document_path {
676 type: MEMBER
677 value: "_id"
678 }
679 }
680 }
681 param {
682 type: LITERAL
683 literal {
684 type: V_OCTETS
685 v_octets {
686 value: "3"
687 }
688 }
689 }
690 }
691 }
692 operation {
693 source {
694 document_path {
695 type: MEMBER
696 value: "amount"
697 }
698 }
699 operation: ITEM_REPLACE
700 value {
701 type: LITERAL
702 literal {
703 type: V_FLOAT
704 v_float: 27.75
705 }
706 }
707 }
708 }
709
710
711 2 rows affected
712 Rows matched: 2 Changed: 2 Warnings: 0
713 RUN select doc from maincoll
714 doc
715 {"_id": "0"}
716 {"_id": "1", "name": "\"xtest_<\"", "amount": "\"xtest_!=\"", "last_name": "\"xtest_<=\""}
717 {"_id": "2", "name": "\"xtest_<\"", "amount": 120.57, "last_name": "\"xtest_<=\""}
718 {"_id": "3", "name": "Abraham", "amount": "\"xtest_!=\"", "last_name": "\"xtest_<=\""}
719 {"_id": "4", "name": "\"xtest_>\"", "amount": 27.75, "last_name": "\"xtest_>=\""}
720 {"_id": "5", "name": "\"xtest_>\"", "amount": 27.75, "last_name": "\"xtest_>=\""}
721 0 rows affected
722 Update with order clause update last _id in desc order (_id = 5)
723 send Mysqlx.Crud.Update {
724 collection {
725 name: "maincoll"
726 schema: "mysqlxcoll"
727 }
728 data_model: DOCUMENT
729 criteria {
730 type: OPERATOR
731 operator {
732 name: "!="
733 param {
734 type: IDENT
735 identifier {
736 document_path {
737 type: MEMBER
738 value: "_id"
739 }
740 }
741 }
742 param {
743 type: LITERAL
744 literal {
745 type: V_OCTETS
746 v_octets {
747 value: "0"
748 }
749 }
750 }
751 }
752 }
753 limit {
754 row_count: 1
755 }
756 order {
757 expr {
758 type: IDENT
759 identifier {
760 name: "_id"
761 }
762 }
763 direction: DESC
764 }
765 operation {
766 source {
767 document_path {
768 type: MEMBER
769 value: "amount"
770 }
771 }
772 operation: ITEM_REPLACE
773 value {
774 type: LITERAL
775 literal {
776 type: V_DOUBLE
777 v_double: 1234.567
778 }
779 }
780 }
781 }
782
783
784 1 rows affected
785 Rows matched: 1 Changed: 1 Warnings: 0
786 RUN select doc from maincoll
787 doc
788 {"_id": "0"}
789 {"_id": "1", "name": "\"xtest_<\"", "amount": "\"xtest_!=\"", "last_name": "\"xtest_<=\""}
790 {"_id": "2", "name": "\"xtest_<\"", "amount": 120.57, "last_name": "\"xtest_<=\""}
791 {"_id": "3", "name": "Abraham", "amount": "\"xtest_!=\"", "last_name": "\"xtest_<=\""}
792 {"_id": "4", "name": "\"xtest_>\"", "amount": 27.75, "last_name": "\"xtest_>=\""}
793 {"_id": "5", "name": "\"xtest_>\"", "amount": 1234.567, "last_name": "\"xtest_>=\""}
794 0 rows affected
795 Update with order clause update first two _id in asc order (_id = 1,2)
796 send Mysqlx.Crud.Update {
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 document_path {
810 type: MEMBER
811 value: "_id"
812 }
813 }
814 }
815 param {
816 type: LITERAL
817 literal {
818 type: V_OCTETS
819 v_octets {
820 value: "0"
821 }
822 }
823 }
824 }
825 }
826 limit {
827 row_count: 2
828 }
829 order {
830 expr {
831 type: IDENT
832 identifier {
833 name: "_id"
834 }
835 }
836 direction: ASC
837 }
838 operation {
839 source {
840 document_path {
841 type: MEMBER
842 value: "amount"
843 }
844 }
845 operation: ITEM_REPLACE
846 value {
847 type: LITERAL
848 literal {
849 type: V_DOUBLE
850 v_double: 9876.543
851 }
852 }
853 }
854 }
855
856
857 2 rows affected
858 Rows matched: 2 Changed: 2 Warnings: 0
859 RUN select doc from maincoll
860 doc
861 {"_id": "0"}
862 {"_id": "1", "name": "\"xtest_<\"", "amount": 9876.543, "last_name": "\"xtest_<=\""}
863 {"_id": "2", "name": "\"xtest_<\"", "amount": 9876.543, "last_name": "\"xtest_<=\""}
864 {"_id": "3", "name": "Abraham", "amount": "\"xtest_!=\"", "last_name": "\"xtest_<=\""}
865 {"_id": "4", "name": "\"xtest_>\"", "amount": 27.75, "last_name": "\"xtest_>=\""}
866 {"_id": "5", "name": "\"xtest_>\"", "amount": 1234.567, "last_name": "\"xtest_>=\""}
867 0 rows affected
868 Null value for Document
869 send Mysqlx.Crud.Update {
870 collection {
871 name: "maincoll"
872 schema: "mysqlxcoll"
873 }
874 data_model: DOCUMENT
875 criteria {
876 type: OPERATOR
877 operator {
878 name: ">"
879 param {
880 type: IDENT
881 identifier {
882 document_path {
883 type: MEMBER
884 value: "_id"
885 }
886 }
887 }
888 param {
889 type: LITERAL
890 literal {
891 type: V_OCTETS
892 v_octets {
893 value: "3"
894 }
895 }
896 }
897 }
898 }
899 operation {
900 source {
901 document_path {
902 type: MEMBER
903 value: "amount"
904 }
905 }
906 operation: ITEM_REPLACE
907 value {
908 type: LITERAL
909 literal {
910 type: V_NULL
911 }
912 }
913 }
914 }
915
916
917 2 rows affected
918 Rows matched: 2 Changed: 2 Warnings: 0
919 RUN select doc from maincoll
920 doc
921 {"_id": "0"}
922 {"_id": "1", "name": "\"xtest_<\"", "amount": 9876.543, "last_name": "\"xtest_<=\""}
923 {"_id": "2", "name": "\"xtest_<\"", "amount": 9876.543, "last_name": "\"xtest_<=\""}
924 {"_id": "3", "name": "Abraham", "amount": "\"xtest_!=\"", "last_name": "\"xtest_<=\""}
925 {"_id": "4", "name": "\"xtest_>\"", "amount": null, "last_name": "\"xtest_>=\""}
926 {"_id": "5", "name": "\"xtest_>\"", "amount": null, "last_name": "\"xtest_>=\""}
927 0 rows affected
928 RUN START TRANSACTION
929
930 0 rows affected
931 Update Transaction Rollback
932 send Mysqlx.Crud.Update {
933 collection {
934 name: "maincoll"
935 schema: "mysqlxcoll"
936 }
937 data_model: DOCUMENT
938 criteria {
939 type: OPERATOR
940 operator {
941 name: "=="
942 param {
943 type: IDENT
944 identifier {
945 document_path {
946 type: MEMBER
947 value: "_id"
948 }
949 }
950 }
951 param {
952 type: LITERAL
953 literal {
954 type: V_OCTETS
955 v_octets {
956 value: "5"
957 }
958 }
959 }
960 }
961 }
962 operation {
963 source {
964 document_path {
965 type: MEMBER
966 value: "last_name"
967 }
968 }
969 operation: ITEM_REPLACE
970 value {
971 type: LITERAL
972 literal {
973 type: V_STRING
974 v_string {
975 value: "\"Iam_rollback\""
976 }
977 }
978 }
979 }
980 }
981
982
983 1 rows affected
984 Rows matched: 1 Changed: 1 Warnings: 0
985 RUN select doc from maincoll
986 doc
987 {"_id": "0"}
988 {"_id": "1", "name": "\"xtest_<\"", "amount": 9876.543, "last_name": "\"xtest_<=\""}
989 {"_id": "2", "name": "\"xtest_<\"", "amount": 9876.543, "last_name": "\"xtest_<=\""}
990 {"_id": "3", "name": "Abraham", "amount": "\"xtest_!=\"", "last_name": "\"xtest_<=\""}
991 {"_id": "4", "name": "\"xtest_>\"", "amount": null, "last_name": "\"xtest_>=\""}
992 {"_id": "5", "name": "\"xtest_>\"", "amount": null, "last_name": "\"Iam_rollback\""}
993 0 rows affected
994 RUN ROLLBACK
995
996 0 rows affected
997 RUN select doc from maincoll
998 doc
999 {"_id": "0"}
1000 {"_id": "1", "name": "\"xtest_<\"", "amount": 9876.543, "last_name": "\"xtest_<=\""}
1001 {"_id": "2", "name": "\"xtest_<\"", "amount": 9876.543, "last_name": "\"xtest_<=\""}
1002 {"_id": "3", "name": "Abraham", "amount": "\"xtest_!=\"", "last_name": "\"xtest_<=\""}
1003 {"_id": "4", "name": "\"xtest_>\"", "amount": null, "last_name": "\"xtest_>=\""}
1004 {"_id": "5", "name": "\"xtest_>\"", "amount": null, "last_name": "\"xtest_>=\""}
1005 0 rows affected
1006 RUN START TRANSACTION
1007
1008 0 rows affected
1009 Update Transaction and Commit
1010 send Mysqlx.Crud.Update {
1011 collection {
1012 name: "maincoll"
1013 schema: "mysqlxcoll"
1014 }
1015 data_model: DOCUMENT
1016 criteria {
1017 type: OPERATOR
1018 operator {
1019 name: "=="
1020 param {
1021 type: IDENT
1022 identifier {
1023 document_path {
1024 type: MEMBER
1025 value: "_id"
1026 }
1027 }
1028 }
1029 param {
1030 type: LITERAL
1031 literal {
1032 type: V_OCTETS
1033 v_octets {
1034 value: "5"
1035 }
1036 }
1037 }
1038 }
1039 }
1040 operation {
1041 source {
1042 document_path {
1043 type: MEMBER
1044 value: "last_name"
1045 }
1046 }
1047 operation: ITEM_REPLACE
1048 value {
1049 type: LITERAL
1050 literal {
1051 type: V_STRING
1052 v_string {
1053 value: "\"Iam_commit\""
1054 }
1055 }
1056 }
1057 }
1058 }
1059
1060
1061 1 rows affected
1062 Rows matched: 1 Changed: 1 Warnings: 0
1063 RUN COMMIT
1064
1065 0 rows affected
1066 RUN select doc from maincoll
1067 doc
1068 {"_id": "0"}
1069 {"_id": "1", "name": "\"xtest_<\"", "amount": 9876.543, "last_name": "\"xtest_<=\""}
1070 {"_id": "2", "name": "\"xtest_<\"", "amount": 9876.543, "last_name": "\"xtest_<=\""}
1071 {"_id": "3", "name": "Abraham", "amount": "\"xtest_!=\"", "last_name": "\"xtest_<=\""}
1072 {"_id": "4", "name": "\"xtest_>\"", "amount": null, "last_name": "\"xtest_>=\""}
1073 {"_id": "5", "name": "\"xtest_>\"", "amount": null, "last_name": "\"Iam_commit\""}
1074 0 rows affected
1075 Invalid type of update for Document
1076 send Mysqlx.Crud.Update {
1077 collection {
1078 name: "maincoll"
1079 schema: "mysqlxcoll"
1080 }
1081 data_model: DOCUMENT
1082 criteria {
1083 type: OPERATOR
1084 operator {
1085 name: ">"
1086 param {
1087 type: IDENT
1088 identifier {
1089 document_path {
1090 type: MEMBER
1091 value: "_id"
1092 }
1093 }
1094 }
1095 param {
1096 type: LITERAL
1097 literal {
1098 type: V_OCTETS
1099 v_octets {
1100 value: "3"
1101 }
1102 }
1103 }
1104 }
1105 }
1106 operation {
1107 source {
1108 document_path {
1109 type: MEMBER
1110 value: "name"
1111 }
1112 }
1113 operation: SET
1114 value {
1115 type: LITERAL
1116 literal {
1117 type: V_STRING
1118 v_string {
1119 value: "xtest"
1120 }
1121 }
1122 }
1123 }
1124 }
1125
1126 Got expected error:
1127 Mysqlx.Error {
1128 severity: ERROR
1129 code: 5051
1130 msg: "Invalid type of update operation for document"
1131 sql_state: "HY000"
1132 }
1133
1134 ================================================================================
1135 CLEAN UP
1136 ================================================================================
1137 RUN DROP SCHEMA if EXISTS mysqlxcoll
1138
1139 1 rows affected
1140 RUN DROP USER upditemreplace@localhost
1141
1142 0 rows affected
1143 RUN SET SQL_SAFE_UPDATES = 1
1144
1145 0 rows affected
1146 Mysqlx.Ok {
1147 msg: "bye!"
1148 }
1149 ok