Debian Codegraph @

mysql-test/suite/x/t/cursor_fetch.test

raw
1 ## Test of cursor fetch functionality
2
3 ## Preamble
4 --source include/xplugin_preamble.inc
5 --source include/xplugin_create_user.inc
6 ## Test starts here
7
8 --write_file $MYSQL_TMP_DIR/cursor_fetch.xpl
9
10 Mysqlx.Prepare.Prepare {
11 stmt_id: 1
12 stmt: {
13 type: STMT
14 stmt_execute: {
15 stmt: 'SELECT * FROM xtest.t1'
16 }
17 }
18 }
19 -->recvok
20
21 Mysqlx.Prepare.Prepare {
22 stmt_id: 2
23 stmt: {
24 type: STMT
25 stmt_execute: {
26 stmt: 'SELECT * FROM xtest.t2'
27 }
28 }
29 }
30 -->recvok
31
32 -->title = Fetch all rows in Cursor.Open
33
34 Mysqlx.Cursor.Open {
35 cursor_id: 1
36 stmt: {
37 type: PREPARE_EXECUTE
38 prepare_execute: {
39 stmt_id: 1
40 }
41 }
42 fetch_rows: 3
43 }
44 -->recvresult_store_metadata META_ID
45
46 Mysqlx.Cursor.Fetch {
47 cursor_id: 1
48 fetch_rows: 2
49 }
50 -->recverror 5123
51 -->clear_stored_metadata
52
53 -->title = Fetch no rows in Cursor.Open
54
55 Mysqlx.Cursor.Open {
56 cursor_id: 2
57 stmt: {
58 type: PREPARE_EXECUTE
59 prepare_execute: {
60 stmt_id: 1
61 }
62 }
63 fetch_rows: 0
64 }
65 -->recvresult_store_metadata META_ID
66
67 Mysqlx.Cursor.Fetch {
68 cursor_id: 2
69 fetch_rows: 3
70 }
71 -->recv_with_stored_metadata META_ID
72 -->clear_stored_metadata
73
74 -->title = Fetch part of rows in Cursor.Open
75
76 Mysqlx.Cursor.Open {
77 cursor_id: 2
78 stmt: {
79 type: PREPARE_EXECUTE
80 prepare_execute: {
81 stmt_id: 1
82 }
83 }
84 fetch_rows: 1
85 }
86 -->recvresult_store_metadata META_ID
87
88 Mysqlx.Cursor.Fetch {
89 cursor_id: 2
90 fetch_rows: 2
91 }
92 -->recv_with_stored_metadata META_ID
93 -->clear_stored_metadata
94
95 -->title = Multiple cursor fetch messages
96
97 Mysqlx.Cursor.Open {
98 cursor_id: 2
99 stmt: {
100 type: PREPARE_EXECUTE
101 prepare_execute: {
102 stmt_id: 1
103 }
104 }
105 fetch_rows: 0
106 }
107 -->recvresult_store_metadata META_ID
108
109 Mysqlx.Cursor.Fetch {
110 cursor_id: 2
111 fetch_rows: 1
112 }
113 -->recv_with_stored_metadata META_ID
114
115 Mysqlx.Cursor.Fetch {
116 cursor_id: 2
117 fetch_rows: 1
118 }
119 -->recv_with_stored_metadata META_ID
120
121 Mysqlx.Cursor.Fetch {
122 cursor_id: 2
123 fetch_rows: 1
124 }
125 -->recv_with_stored_metadata META_ID
126 -->clear_stored_metadata
127
128 -->title = Fetch more results than available in one fetch
129
130 Mysqlx.Cursor.Open {
131 cursor_id: 2
132 stmt: {
133 type: PREPARE_EXECUTE
134 prepare_execute: {
135 stmt_id: 1
136 }
137 }
138 fetch_rows: 0
139 }
140 -->recvresult_store_metadata META_ID
141
142 Mysqlx.Cursor.Fetch {
143 cursor_id: 2
144 fetch_rows: 8
145 }
146 -->recvresult
147 -->clear_stored_metadata
148
149 -->title = Fetch more results than available in multiple fetches
150
151 Mysqlx.Cursor.Open {
152 cursor_id: 2
153 stmt: {
154 type: PREPARE_EXECUTE
155 prepare_execute: {
156 stmt_id: 1
157 }
158 }
159 fetch_rows: 0
160 }
161 -->recvresult_store_metadata META_ID
162
163 Mysqlx.Cursor.Fetch {
164 cursor_id: 2
165 fetch_rows: 1
166 }
167 -->recv_with_stored_metadata META_ID
168
169 Mysqlx.Cursor.Fetch {
170 cursor_id: 2
171 fetch_rows: 1
172 }
173 -->recv_with_stored_metadata META_ID
174
175 Mysqlx.Cursor.Fetch {
176 cursor_id: 2
177 fetch_rows: 1
178 }
179 -->recv_with_stored_metadata META_ID
180
181 Mysqlx.Cursor.Fetch {
182 cursor_id: 2
183 fetch_rows: 1
184 }
185 -->recverror 5123
186 -->clear_stored_metadata
187
188 -->title = Fetch result with multiple column metadata
189
190 Mysqlx.Cursor.Open {
191 cursor_id: 2
192 stmt: {
193 type: PREPARE_EXECUTE
194 prepare_execute: {
195 stmt_id: 2
196 }
197 }
198 fetch_rows: 0
199 }
200 -->recvresult_store_metadata META_ID
201
202 Mysqlx.Cursor.Fetch {
203 cursor_id: 2
204 fetch_rows: 3
205 }
206 -->recv_with_stored_metadata META_ID
207 -->clear_stored_metadata
208
209 -->title = Alternating cursor fetch
210
211 Mysqlx.Cursor.Open {
212 cursor_id: 1
213 stmt: {
214 type: PREPARE_EXECUTE
215 prepare_execute: {
216 stmt_id: 1
217 }
218 }
219 fetch_rows: 0
220 }
221 -->recvresult_store_metadata CURSOR1_META_ID
222
223 Mysqlx.Cursor.Open {
224 cursor_id: 2
225 stmt: {
226 type: PREPARE_EXECUTE
227 prepare_execute: {
228 stmt_id: 2
229 }
230 }
231 fetch_rows: 0
232 }
233 -->recvresult_store_metadata CURSOR2_META_ID
234
235 Mysqlx.Cursor.Fetch {
236 cursor_id: 1
237 fetch_rows: 1
238 }
239 -->recv_with_stored_metadata CURSOR1_META_ID
240
241 Mysqlx.Cursor.Fetch {
242 cursor_id: 2
243 fetch_rows: 2
244 }
245 -->recv_with_stored_metadata CURSOR2_META_ID
246
247 Mysqlx.Cursor.Fetch {
248 cursor_id: 1
249 fetch_rows: 1
250 }
251 -->recv_with_stored_metadata CURSOR1_META_ID
252
253 Mysqlx.Cursor.Fetch {
254 cursor_id: 2
255 fetch_rows: 2
256 }
257 -->recv_with_stored_metadata CURSOR2_META_ID
258
259 -->clear_stored_metadata
260
261 EOF
262
263 CREATE SCHEMA IF NOT EXISTS xtest;
264 USE xtest;
265 CREATE TABLE t1 (phrase VARCHAR(30));
266 INSERT INTO t1 (phrase) VALUES ('Alice has a cat');
267 INSERT INTO t1 (phrase) VALUES ('Bob has a dog');
268
269 CREATE TABLE t2 (x INT, y FLOAT, z TINYINT);
270 INSERT INTO t2 VALUES (1, 1.1, 11);
271 INSERT INTO t2 VALUES (2, 2.22, 22);
272 INSERT INTO t2 VALUES (3, 3.0, 33);
273
274 exec $MYSQLXTEST
275 -ux_root --password=''
276 --file=$MYSQL_TMP_DIR/cursor_fetch.xpl 2>&1;
277
278 ## Cleanup
279 --source ../include/xplugin_cleanup.inc