Debian Codegraph @

mysql-test/suite/x/r/flow_resultset_prepexecute_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.Prepare.Prepare {
124 stmt_id: 1
125 stmt {
126 type: DELETE
127 delete {
128 collection {
129 name: "coll"
130 }
131 data_model: DOCUMENT
132 criteria {
133 type: OPERATOR
134 operator {
135 name: "=="
136 param {
137 type: IDENT
138 identifier {
139 document_path {
140 type: MEMBER
141 value: "name"
142 }
143 }
144 }
145 param {
146 type: LITERAL
147 literal {
148 type: V_OCTETS
149 v_octets {
150 value: "fifth"
151 }
152 }
153 }
154 }
155 }
156 }
157 }
158 }
159
160 RUN recvok
161 send Mysqlx.Prepare.Execute {
162 stmt_id: 1
163 }
164
165 [ASSERT notice session state change - ROWS_AFFECTED, v_unsigned_int:1]
166 [ASSERT Mysqlx.Sql.StmtExecuteOk]
167
168 #
169 # I.2
170 send Mysqlx.Prepare.Prepare {
171 stmt_id: 2
172 stmt {
173 type: UPDATE
174 update {
175 collection {
176 name: "coll"
177 }
178 data_model: DOCUMENT
179 operation {
180 source {
181 document_path {
182 type: MEMBER
183 value: "prio"
184 }
185 }
186 operation: ITEM_SET
187 value {
188 type: OPERATOR
189 operator {
190 name: "-"
191 param {
192 type: IDENT
193 identifier {
194 document_path {
195 type: MEMBER
196 value: "prio"
197 }
198 }
199 }
200 param {
201 type: LITERAL
202 literal {
203 type: V_SINT
204 v_signed_int: 1
205 }
206 }
207 }
208 }
209 }
210 }
211 }
212 }
213
214 RUN recvok
215 send Mysqlx.Prepare.Execute {
216 stmt_id: 2
217 }
218
219 [ASSERT notice session state change - PRODUCED_MESSAGE, type: V_STRING]
220 [ASSERT notice session state change - ROWS_AFFECTED, v_unsigned_int:3]
221 [ASSERT Mysqlx.Sql.StmtExecuteOk]
222
223 #
224 # I.3
225 send Mysqlx.Prepare.Prepare {
226 stmt_id: 3
227 stmt {
228 type: INSERT
229 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: "{\"_id\": \"6\", \"name\":\"sixth\", \"prio\":3}"
242 content_type: 2
243 }
244 }
245 }
246 }
247 upsert: false
248 }
249 }
250 }
251
252 RUN recvok
253 send Mysqlx.Prepare.Execute {
254 stmt_id: 3
255 }
256
257 [ASSERT notice session state change - ROWS_AFFECTED, v_unsigned_int:1]
258 [ASSERT Mysqlx.Sql.StmtExecuteOk]
259
260 #
261 # I.4
262 send Mysqlx.Prepare.Prepare {
263 stmt_id: 4
264 stmt {
265 type: INSERT
266 insert {
267 collection {
268 name: "coll"
269 schema: "xtest"
270 }
271 data_model: DOCUMENT
272 row {
273 field {
274 type: LITERAL
275 literal {
276 type: V_OCTETS
277 v_octets {
278 value: "{\"name\":\"sixth\", \"prio\":3}"
279 content_type: 2
280 }
281 }
282 }
283 }
284 upsert: false
285 }
286 }
287 }
288
289 RUN recvok
290 send Mysqlx.Prepare.Execute {
291 stmt_id: 4
292 }
293
294 [ASSERT notice session state change - ROWS_AFFECTED, v_unsigned_int:1]
295 [ASSERT notice session state change - GENERATED_DOCUMENT_IDS, type: V_OCTETS]
296 [ASSERT Mysqlx.Sql.StmtExecuteOk]
297
298 #
299 # I.5
300 send Mysqlx.Prepare.Prepare {
301 stmt_id: 5
302 stmt {
303 type: FIND
304 find {
305 collection {
306 name: "coll"
307 }
308 data_model: DOCUMENT
309 projection {
310 source {
311 type: IDENT
312 identifier {
313 document_path {
314 type: MEMBER
315 value: "name"
316 }
317 }
318 }
319 alias: "name"
320 }
321 }
322 }
323 }
324
325 RUN recvok
326 send Mysqlx.Prepare.Execute {
327 stmt_id: 5
328 }
329
330 [ASSERT Mysqlx.Resultset.ColumnMetaData]
331 [ASSERT Mysqlx.Resultset.Row]
332 [ASSERT Mysqlx.Resultset.Row]
333 [ASSERT Mysqlx.Resultset.Row]
334 [ASSERT Mysqlx.Resultset.Row]
335 [ASSERT Mysqlx.Resultset.Row]
336 [ASSERT Mysqlx.Resultset.FetchDone]
337 [ASSERT Mysqlx.Sql.StmtExecuteOk]
338
339 #
340 # II.1
341 send Mysqlx.Prepare.Prepare {
342 stmt_id: 6
343 stmt {
344 type: FIND
345 find {
346 collection {
347 name: "coll"
348 }
349 data_model: DOCUMENT
350 projection {
351 source {
352 type: OPERATOR
353 operator {
354 name: "/"
355 param {
356 type: LITERAL
357 literal {
358 type: V_SINT
359 v_signed_int: 1
360 }
361 }
362 param {
363 type: IDENT
364 identifier {
365 document_path {
366 type: MEMBER
367 value: "prio"
368 }
369 }
370 }
371 }
372 }
373 alias: "name"
374 }
375 }
376 }
377 }
378
379 RUN recvok
380 send Mysqlx.Prepare.Execute {
381 stmt_id: 6
382 }
383
384 [ASSERT Mysqlx.Resultset.ColumnMetaData]
385 [ASSERT Mysqlx.Resultset.Row]
386 [ASSERT Mysqlx.Resultset.Row]
387 [ASSERT Mysqlx.Resultset.Row]
388 [ASSERT Mysqlx.Resultset.Row]
389 [ASSERT Mysqlx.Resultset.Row]
390 [ASSERT Mysqlx.Resultset.FetchDone]
391 [ASSERT notice warning - WARNING, 1365]
392 [ASSERT notice warning - WARNING, 1365]
393 [ASSERT Mysqlx.Sql.StmtExecuteOk]
394 Mysqlx.Ok {
395 msg: "bye!"
396 }
397 ok