Debian Codegraph @

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

raw
1 CREATE SCHEMA IF NOT EXISTS xtest;
2 USE xtest;
3
4
5 ## Test setup
6 RUN DROP TABLE IF EXISTS xtest.coll
7
8 0 rows affected
9
10 command ok
11 send Mysqlx.Crud.Insert {
12 collection {
13 name: "coll"
14 schema: "xtest"
15 }
16 data_model: DOCUMENT
17 row {
18 field {
19 type: LITERAL
20 literal {
21 type: V_OCTETS
22 v_octets {
23 value: "{\"_id\": \"1\", \"name\":\"first\", \"prio\":1}"
24 content_type: 2
25 }
26 }
27 }
28 }
29 upsert: false
30 }
31
32
33 1 rows affected
34 Got expected error (code 0)
35 send Mysqlx.Crud.Insert {
36 collection {
37 name: "coll"
38 schema: "xtest"
39 }
40 data_model: DOCUMENT
41 row {
42 field {
43 type: LITERAL
44 literal {
45 type: V_OCTETS
46 v_octets {
47 value: "{\"_id\": \"2\", \"name\":\"second\", \"prio\":2}"
48 content_type: 2
49 }
50 }
51 }
52 }
53 upsert: false
54 }
55
56
57 1 rows affected
58 Got expected error (code 0)
59 send Mysqlx.Crud.Insert {
60 collection {
61 name: "coll"
62 schema: "xtest"
63 }
64 data_model: DOCUMENT
65 row {
66 field {
67 type: LITERAL
68 literal {
69 type: V_OCTETS
70 v_octets {
71 value: "{\"_id\": \"3\", \"name\":\"third\", \"prio\":1}"
72 content_type: 2
73 }
74 }
75 }
76 }
77 upsert: false
78 }
79
80
81 1 rows affected
82 Got expected error (code 0)
83 send Mysqlx.Crud.Insert {
84 collection {
85 name: "coll"
86 schema: "xtest"
87 }
88 data_model: DOCUMENT
89 row {
90 field {
91 type: LITERAL
92 literal {
93 type: V_OCTETS
94 v_octets {
95 value: "{\"_id\": \"5\", \"name\":\"fifth\", \"prio\":4}"
96 content_type: 2
97 }
98 }
99 }
100 }
101 upsert: false
102 }
103
104
105 1 rows affected
106 Got expected error (code 0)
107
108
109 ## I. Validate simple resultsets for CRUD messages
110 #
111 # 1. Assert resultset for CRUD-delete message
112 # 2. Assert resultset for CRUD-update message
113 # 3. Assert resultset for CRUD-create message (doc with id)
114 # 4. Assert resultset for CRUD-create message (doc without id)
115 # 5. Assert resultset for CRUD-read message
116
117 ## II. Validate simple resultset with warnings
118 #
119 # 1. Assert one resultsets for select queries
120
121 #
122 # I.1
123 send Mysqlx.Crud.Delete {
124 collection {
125 name: "coll"
126 }
127 data_model: DOCUMENT
128 criteria {
129 type: OPERATOR
130 operator {
131 name: "=="
132 param {
133 type: IDENT
134 identifier {
135 document_path {
136 type: MEMBER
137 value: "name"
138 }
139 }
140 }
141 param {
142 type: LITERAL
143 literal {
144 type: V_OCTETS
145 v_octets {
146 value: "fifth"
147 }
148 }
149 }
150 }
151 }
152 }
153
154 [ASSERT notice session state change - ROWS_AFFECTED, v_unsigned_int:1]
155 [ASSERT Mysqlx.Sql.StmtExecuteOk]
156
157 #
158 # I.2
159 send Mysqlx.Crud.Update {
160 collection {
161 name: "coll"
162 }
163 data_model: DOCUMENT
164 operation {
165 source {
166 document_path {
167 type: MEMBER
168 value: "prio"
169 }
170 }
171 operation: ITEM_SET
172 value {
173 type: OPERATOR
174 operator {
175 name: "-"
176 param {
177 type: IDENT
178 identifier {
179 document_path {
180 type: MEMBER
181 value: "prio"
182 }
183 }
184 }
185 param {
186 type: LITERAL
187 literal {
188 type: V_SINT
189 v_signed_int: 1
190 }
191 }
192 }
193 }
194 }
195 }
196
197 [ASSERT notice session state change - PRODUCED_MESSAGE, type: V_STRING]
198 [ASSERT notice session state change - ROWS_AFFECTED, v_unsigned_int:3]
199 [ASSERT Mysqlx.Sql.StmtExecuteOk]
200
201 #
202 # I.3
203 send Mysqlx.Crud.Insert {
204 collection {
205 name: "coll"
206 schema: "xtest"
207 }
208 data_model: DOCUMENT
209 row {
210 field {
211 type: LITERAL
212 literal {
213 type: V_OCTETS
214 v_octets {
215 value: "{\"_id\": \"6\", \"name\":\"sixth\", \"prio\":3}"
216 content_type: 2
217 }
218 }
219 }
220 }
221 upsert: false
222 }
223
224 [ASSERT notice session state change - ROWS_AFFECTED, v_unsigned_int:1]
225 [ASSERT Mysqlx.Sql.StmtExecuteOk]
226
227 #
228 # I.4
229 send Mysqlx.Crud.Insert {
230 collection {
231 name: "coll"
232 schema: "xtest"
233 }
234 data_model: DOCUMENT
235 row {
236 field {
237 type: LITERAL
238 literal {
239 type: V_OCTETS
240 v_octets {
241 value: "{\"name\":\"sixth\", \"prio\":3}"
242 content_type: 2
243 }
244 }
245 }
246 }
247 upsert: false
248 }
249
250 [ASSERT notice session state change - ROWS_AFFECTED, v_unsigned_int:1]
251 [ASSERT notice session state change - GENERATED_DOCUMENT_IDS, type: V_OCTETS]
252 [ASSERT Mysqlx.Sql.StmtExecuteOk]
253
254 #
255 # I.5
256 send Mysqlx.Crud.Find {
257 collection {
258 name: "coll"
259 }
260 data_model: DOCUMENT
261 projection {
262 source {
263 type: IDENT
264 identifier {
265 document_path {
266 type: MEMBER
267 value: "name"
268 }
269 }
270 }
271 alias: "name"
272 }
273 }
274
275 [ASSERT Mysqlx.Resultset.ColumnMetaData]
276 [ASSERT Mysqlx.Resultset.Row]
277 [ASSERT Mysqlx.Resultset.Row]
278 [ASSERT Mysqlx.Resultset.Row]
279 [ASSERT Mysqlx.Resultset.Row]
280 [ASSERT Mysqlx.Resultset.Row]
281 [ASSERT Mysqlx.Resultset.FetchDone]
282 [ASSERT Mysqlx.Sql.StmtExecuteOk]
283
284 #
285 # II.1
286 send Mysqlx.Crud.Find {
287 collection {
288 name: "coll"
289 }
290 data_model: DOCUMENT
291 projection {
292 source {
293 type: OPERATOR
294 operator {
295 name: "/"
296 param {
297 type: LITERAL
298 literal {
299 type: V_SINT
300 v_signed_int: 1
301 }
302 }
303 param {
304 type: IDENT
305 identifier {
306 document_path {
307 type: MEMBER
308 value: "prio"
309 }
310 }
311 }
312 }
313 }
314 alias: "name"
315 }
316 }
317
318 [ASSERT Mysqlx.Resultset.ColumnMetaData]
319 [ASSERT Mysqlx.Resultset.Row]
320 [ASSERT Mysqlx.Resultset.Row]
321 [ASSERT Mysqlx.Resultset.Row]
322 [ASSERT Mysqlx.Resultset.Row]
323 [ASSERT Mysqlx.Resultset.Row]
324 [ASSERT Mysqlx.Resultset.FetchDone]
325 [ASSERT notice warning - WARNING, 1365]
326 [ASSERT notice warning - WARNING, 1365]
327 [ASSERT Mysqlx.Sql.StmtExecuteOk]
328 Mysqlx.Ok {
329 msg: "bye!"
330 }
331 ok