Debian Codegraph @

mysql-test/suite/x/include/test_flow_resultset_prepexecute_crud_table.inc

raw
1
2 --write_file $MYSQL_TMP_DIR/resultset.xpl
3 -->import assert_messages.macro
4 -->import assert_notices.macro
5 -->import crud_insert.macro
6
7 -->echo
8 -->echo
9 -->echo ## Test setup
10
11 ##
12 ## Purpose of this test is:
13 #
14 # * validating that resultsets are in align to the UML flow:
15 #
16 # ...
17 # loop has more resultsets or not at end of fetch
18 # group resultset
19 # loop has more columns
20 # server --> client: ColumnMetaData
21 # end
22 # loop has more rows
23 # server --> client: Row
24 # end
25 # end
26 # alt has more resultsets
27 # server --> client: FetchDoneMoreResultsets
28 # end
29 # end
30 # loop has more OUT-paramsets or not at end of fetch
31 # server --> client: FetchDoneMoreOutParams
32 # group resultset
33 # loop has more columns
34 # server --> client: ColumnMetaData
35 # end
36 # loop has more rows
37 # server --> client: Row
38 # end
39 # end
40 # end
41 # alt at end of all resultsets
42 # server --> client: FetchDone
43 # else cursor is opened
44 # server --> client: FetchSuspended
45 # end
46 # ...
47 #
48 # * expecting following notices for CRUD operations on table:
49 #
50 # |Notice\Stmt |Select |Insert |Update |Delete |
51 # |-----------------------|-------|-------|-------|-------|
52 # |ROWS_AFFECTED |X |X |X |X |
53 # |PRODUCED_MESSAGE | | |X | |
54 # |GENERATED_INSERT_ID | |X(PK) | | |
55 # |GENERATED_DOCUMENT_IDS | | | | |
56 #
57 -->echo
58 -->echo
59 -->echo ## I. Validate simple resultsets for CRUD messages
60 -->echo #
61 -->echo # 1. Assert resultset for CRUD-delete message
62 -->echo # 2. Assert resultset for CRUD-update message
63 -->echo # 3. Assert resultset for CRUD-create message (table with auto_inc column)
64 -->echo # 4. Assert resultset for CRUD-create message (table without auto_inc column)
65 -->echo # 5. Assert resultset for CRUD-read message
66 -->echo
67 -->echo ## II. Validate simple resultset with warnings
68 -->echo #
69 -->echo # 1. Assert one resultsets for select queries
70
71
72 -->echo
73 -->echo #
74 -->echo # I.1
75 Mysqlx.Prepare.Prepare {
76 stmt_id: 1
77 stmt: {
78 type: DELETE
79 delete {
80 collection {
81 name: "xtable"
82 }
83 data_model: TABLE
84 criteria {
85 type: OPERATOR
86 operator {
87 name: "=="
88 param {
89 type: IDENT
90 identifier {
91 name: "prio"
92 }
93 }
94 param {
95 type: LITERAL
96 literal {
97 type: V_SINT
98 v_signed_int: 3
99 }
100 }
101 }
102 }
103 }
104 }
105 }
106 recvok;
107 Mysqlx.Prepare.Execute {
108 stmt_id: 1
109 }
110 callmacro Assert_notice_session_state ROWS_AFFECTED v_unsigned_int:1;
111 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
112
113
114 -->echo
115 -->echo #
116 -->echo # I.2
117 Mysqlx.Prepare.Prepare {
118 stmt_id: 2
119 stmt: {
120 type: UPDATE
121 update {
122 collection {
123 name: "xtable"
124 }
125 data_model: TABLE
126 operation {
127 source {
128 name: "prio"
129 }
130 operation: SET
131 value {
132 type: OPERATOR
133 operator {
134 name: "-"
135 param {
136 type: IDENT
137 identifier {
138 name: "prio"
139 }
140 }
141 param {
142 type: LITERAL
143 literal {
144 type: V_SINT
145 v_signed_int: 1
146 }
147 }
148 }
149 }
150 }
151 }
152 }
153 }
154 recvok;
155 Mysqlx.Prepare.Execute {
156 stmt_id: 2
157 }
158 callmacro Assert_notice_session_state PRODUCED_MESSAGE type: V_STRING;
159 callmacro Assert_notice_session_state ROWS_AFFECTED v_unsigned_int:4;
160 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
161
162
163 -->echo
164 -->echo #
165 -->echo # I.3
166 Mysqlx.Prepare.Prepare {
167 stmt_id: 3
168 stmt: {
169 type: INSERT
170 insert {
171 collection {
172 name: "xtable"
173 }
174 data_model: TABLE
175 row {
176 field {
177 type: LITERAL
178 literal {
179 type: V_STRING
180 v_string {
181 value: "sixth"
182 }
183 }
184 }
185 field {
186 type: LITERAL
187 literal {
188 type: V_SINT
189 v_signed_int: 3
190 }
191 }
192 }
193 upsert: false
194 }
195 }
196 }
197 recvok;
198 Mysqlx.Prepare.Execute {
199 stmt_id: 3
200 }
201 callmacro Assert_notice_session_state ROWS_AFFECTED v_unsigned_int:1;
202 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
203
204
205 -->echo
206 -->echo #
207 -->echo # I.4
208 Mysqlx.Prepare.Prepare {
209 stmt_id: 4
210 stmt: {
211 type: INSERT
212 insert {
213 collection {
214 name: "xtable_with_pk"
215 }
216
217 projection {
218 name: "description"
219 }
220
221 data_model: TABLE
222 row {
223 field {
224 type: LITERAL
225 literal {
226 type: V_STRING
227 v_string {
228 value: "test"
229 }
230 }
231 }
232 }
233 upsert: false
234 }
235 }
236 }
237 recvok;
238 Mysqlx.Prepare.Execute {
239 stmt_id: 4
240 }
241 callmacro Assert_notice_session_state ROWS_AFFECTED v_unsigned_int:1;
242 callmacro Assert_notice_session_state GENERATED_INSERT_ID v_unsigned_int: 2;
243 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
244
245
246 -->echo
247 -->echo #
248 -->echo # I.5
249 Mysqlx.Prepare.Prepare {
250 stmt_id: 5
251 stmt: {
252 type: FIND
253 find {
254 collection {
255 name: "xtable"
256 }
257 data_model: TABLE
258 projection {
259 alias:"prio"
260 source {
261 type: IDENT
262 identifier {
263 name: "prio"
264 }
265 }
266 }
267 }
268 }
269 }
270 recvok;
271 Mysqlx.Prepare.Execute {
272 stmt_id: 5
273 }
274 callmacro Assert_metadata SINT "prio";
275 callmacro Assert_rows 5;
276 callmacro Assert_message Mysqlx.Resultset.FetchDone;
277 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
278
279
280 -->echo
281 -->echo #
282 -->echo # II.1
283 Mysqlx.Prepare.Prepare {
284 stmt_id: 6
285 stmt: {
286 type: FIND
287 find {
288 collection {
289 name: "xtable"
290 }
291 data_model: TABLE
292 projection {
293 alias:"name"
294 source {
295 type: OPERATOR
296 operator {
297 name: "/"
298 param {
299 type: LITERAL
300 literal {
301 type: V_SINT
302 v_signed_int: 1
303 }
304 }
305 param {
306 type: IDENT
307 identifier {
308 name: "prio"
309 }
310 }
311 }
312 }
313 }
314 }
315 }
316 }
317 recvok;
318 Mysqlx.Prepare.Execute {
319 stmt_id: 6
320 }
321 callmacro Assert_metadata DECIMAL "name";
322 callmacro Assert_rows 5;
323 callmacro Assert_message Mysqlx.Resultset.FetchDone;
324 ## ER_DIVISION_BY_ZERO == 1365
325 callmacro Assert_notice_warning WARNING 1365;
326 callmacro Assert_notice_warning WARNING 1365;
327 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
328
329 EOF
330
331 source sample_tables.inc;
332