1## generated
2## Rel: Delete non-existing row
3
4--source ../include/xplugin_preamble.inc
5## Test starts here
6--write_file $MYSQL_TMP_DIR/delete_del_none_table.tmp
7## Test data
8-->sql
9drop schema if exists xtest;
10create schema xtest;
11use xtest;
12create table mycoll (doc JSON, _id VARCHAR(32) NOT NULL PRIMARY KEY);
13insert into mycoll (doc, _id) values ('{"_id": "1", "name": "Joe1"}', json_unquote(json_extract(doc, '$._id')));
14insert into mycoll (doc, _id) values ('{"_id": "2", "name": "Joe2", "last_name": "Smith"}', json_unquote(json_extract(doc, '$._id')));
15insert into mycoll (doc, _id) values ('{"_id": "3", "name": "Joe2", "last_name": "Shmo"}', json_unquote(json_extract(doc, '$._id')));
16create table mytable (id int primary key, name varchar(40), price decimal(5,2), info json);
17insert into mytable values (1, 'banana', 1.20, '{"color": "yellow"}');
18insert into mytable values (2, 'apple', 0.25, '{"color":"red"}');
19insert into mytable values (3, 'tomato', 1.80, '{"color":"red"}');
20insert into mytable values (4, 'mango', 3.14, '{"color":"green"}');
21insert into mytable values (5, 'orange', 0.90, '{"color":"orange"}');
22-->endsql
23Mysqlx.Crud.Delete {
24  collection {
25    name: "mytable"
26    schema: "xtest"
27  }
28  data_model: TABLE
29  criteria {
30    type: OPERATOR
31    operator {
32      name: "&&"
33      param {
34        type: OPERATOR
35        operator {
36          name: ">"
37          param {
38            type: IDENT
39            identifier {
40              name: "price"
41            }
42          }
43          param {
44            type: LITERAL
45            literal {
46              type: V_DOUBLE
47              v_double: 100.0
48            }
49          }
50        }
51      }
52      param {
53        type: OPERATOR
54        operator {
55          name: "=="
56          param {
57            type: IDENT
58            identifier {
59              document_path {
60                type: MEMBER
61                value: "color"
62              }
63              name: "info"
64            }
65          }
66          param {
67            type: LITERAL
68            literal {
69                type: V_OCTETS
70                v_octets {value:"red"}
71            }
72          }
73        }
74      }
75    }
76  }
77}
78
79## expect Mysqlx.Sql.StmtExecuteOk
80-->recvresult
81
82## Cleanup
83-->sql
84drop schema if exists xtest;
85-->endsql
86EOF
87
88--exec $MYSQLXTEST -uroot --password='' --file=$MYSQL_TMP_DIR/delete_del_none_table.tmp 2>&1
89--remove_file $MYSQL_TMP_DIR/delete_del_none_table.tmp
90
91## Postamble
92uninstall plugin mysqlx;
93