summaryrefslogtreecommitdiff
path: root/mysql-test/main/ps_missed_cmds.result
blob: 966c4c6313be611b26e9d4c6ec2e34d8dac5242a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
SET @save_storage_engine= @@default_storage_engine;
SET default_storage_engine= InnoDB;
#
# MDEV-16708: Unsupported commands for prepared statements
#
# Disable ps-protocol explicitly in order to test support of
# prepared statements for use case when statements passed
# to the server via text client-server protocol (in contrast
# with binary protocol used in the test file
# ps_missed_cmds_bin_prot.test)
# Test case 1: Check that the statement 'LOAD DATA' is supported
# by prepared statements
# First, set up environment for use by the 'LOAD DATA' statement
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1);
COMMIT;
SELECT * INTO OUTFILE 'load.data' FROM t1;
PREPARE stmt_1 FROM "LOAD DATA INFILE 'load.data' INTO TABLE t1";
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'LOAD DATA' statement
# were damaged.
EXECUTE stmt_1;
SELECT * FROM t1;
a
1
1
1
# Clean up
DEALLOCATE PREPARE stmt_1;
DROP TABLE t1;
# Test case 2: Check that the 'LOCK TABLE', 'UNLOCK TABLES' statements
# are supported by prepared statements
CREATE TABLE t1 (a INT);
PREPARE stmt_1 FROM "LOCK TABLE t1 READ";
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'LOCK TABLE READ'
# statement were damaged.
EXECUTE stmt_1;
PREPARE stmt_1 FROM "UNLOCK TABLE";
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'UNLOCK TABLE' statement
# were damaged.
EXECUTE stmt_1;
PREPARE stmt_1 FROM "LOCK TABLE t1 WRITE";
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'LOCK TABLE WRITE'
# statement were damaged.
EXECUTE stmt_1;
# Clean up
DEALLOCATE PREPARE stmt_1;
UNLOCK TABLE;
DROP TABLE t1;
# Test case 3: Check that the 'USE' statement is supported by
# prepared statements
CREATE DATABASE mdev_16708_db;
PREPARE stmt_1 FROM 'USE mdev_16708_db';
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'USE' statement
# were damaged.
EXECUTE stmt_1;
# Check that the current database has been changed
SELECT DATABASE();
DATABASE()
mdev_16708_db
# Clean up
DEALLOCATE PREPARE stmt_1;
USE test;
DROP DATABASE mdev_16708_db;
# Test case 4: Check that the 'ALTER DATABASE' statement is supported
# by prepared statements
CREATE DATABASE mdev_16708_db;
PREPARE stmt_1 FROM "ALTER DATABASE mdev_16708_db COMMENT 'New comment'";
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'ALTER DATABASE' statement
# were damaged.
EXECUTE stmt_1;
# Clean up
DEALLOCATE PREPARE stmt_1;
USE test;
DROP DATABASE mdev_16708_db;
# Test case 5: Check that the 'CREATE FUNCTION/ALTER FUNCTION/
# DROP FUNCTION' statements are supported by prepared statements
PREPARE stmt_1 FROM 'CREATE FUNCTION f1() RETURNS INT RETURN 1';
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'CREATE FUNCTION'
# statement were damaged. The second attempt to execute the prepared
# statement stmt_1 results in error ER_SP_ALREADY_EXISTS since
# the stored function f() has been created on first run of stmt1.
EXECUTE stmt_1;
ERROR 42000: FUNCTION f1 already exists
PREPARE stmt_1 FROM 'ALTER FUNCTION f1 SQL SECURITY INVOKER';
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'ALTER FUNCTION'
# statement were damaged.
EXECUTE stmt_1;
PREPARE stmt_1 FROM 'DROP FUNCTION f1';
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling 'DROP FUNCTION' statement
# were damaged. The second attempt to run 'DROP FUNCTION f1' using
# prepared statement expectedly results in issuing the error
# ER_SP_DOES_NOT_EXIST since the stored function was dropped on first
# executuon of the prepared statement stmt_1.
EXECUTE stmt_1;
ERROR 42000: FUNCTION test.f1 does not exist
# Test case 6: Check that the 'CHECK TABLE' statement is supported
# by prepared statements
CREATE TABLE t1 (a INT);
PREPARE stmt_1 FROM 'CHECK TABLE t1';
EXECUTE stmt_1;
Table	Op	Msg_type	Msg_text
test.t1	check	status	OK
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'CHECK TABLE' statement
# were damaged.
EXECUTE stmt_1;
Table	Op	Msg_type	Msg_text
test.t1	check	status	OK
# Clean up
DEALLOCATE PREPARE stmt_1;
DROP TABLE t1;
# Test case 7: Check that the BEGIN/SAVEPOINT/RELEASE SAVEPOINT
# statements are supported by prepared statements
# Set up environmentr for the test case
CREATE TABLE t1 (a INT);
PREPARE stmt_1 FROM 'BEGIN';
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'BEGIN' statement
# were damaged.
EXECUTE stmt_1;
INSERT INTO t1 VALUES (1);
# Run 'SAVEPOINT s1' using prepared statements
PREPARE stmt_2 FROM 'SAVEPOINT s1';
EXECUTE stmt_2;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'SAVEPOINT' statement
# were damaged.
EXECUTE stmt_2;
INSERT INTO t1 VALUES (2);
# Expected rows: '1' and '2'
SELECT * FROM t1;
a
1
2
# Rollback the last row inserted ('2')
ROLLBACK TO SAVEPOINT s1;
# Expected output from t1 after transaction has been rolled back
# to the savepoint is '1'. If it is case then the statement SAVEPOINT
# was handled successfully with prepared statement
SELECT * FROM t1;
a
1
PREPARE stmt_3 FROM 'RELEASE SAVEPOINT s1';
EXECUTE stmt_3;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'RELEASE' statement
# were damaged. The second attempt to release the same savepoint
# expectedly lead to error 'SAVEPOINT s1 does not exist'
# that's just ignored.
EXECUTE stmt_3;
ERROR 42000: SAVEPOINT s1 does not exist
# Clean up
DEALLOCATE PREPARE stmt_1;
DEALLOCATE PREPARE stmt_2;
DEALLOCATE PREPARE stmt_3;
DROP TABLE t1;
# Test case 8: Check that the 'PURGE BINARY LOGS BEFORE' statement
# is supported by prepared statements
PREPARE stmt_1 FROM "PURGE BINARY LOGS BEFORE '2020-11-17'";
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'PURGE BINARY LOGS BEFORE'
# statement were damaged.
EXECUTE stmt_1;
# Check that the 'PURGE BINARY LOGS TO' statement is supported by
# prepared statements
PREPARE stmt_1 FROM "PURGE BINARY LOGS TO 'mariadb-bin.000063'";
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'PURGE BINARY LOGS TO'
# statement were damaged.
EXECUTE stmt_1;
# Test case 9: Check that the 'HANDLER OPEN/HANDLER READ/
# HANDLER CLOSE' statements are supported by prepared statements
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
COMMIT;
PREPARE stmt_1 FROM 'HANDLER t1 OPEN';
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'HANDLER OPEN'
# statement were damaged. Execution of this statement the second
# time expectedly results in emitting the error ER_NONUNIQ_TABLE.
# The same error is issued in case the statement 'HANDLER t1 OPEN' is
# executed twice using a regular statement.
EXECUTE stmt_1;
ERROR 42000: Not unique table/alias: 't1'
PREPARE stmt_2 FROM 'HANDLER t1 READ FIRST';
PREPARE stmt_3 FROM 'HANDLER t1 READ NEXT';
PREPARE stmt_4 FROM 'HANDLER t1 CLOSE';
EXECUTE stmt_2;
a
1
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'HANDLER READ FIRST'
# statement were damaged.
EXECUTE stmt_2;
a
1
EXECUTE stmt_3;
a
1
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'HANDLER READ NEXT'
# statement were damaged.
EXECUTE stmt_3;
a
EXECUTE stmt_4;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'HANDLER CLOSE'
# statement were damaged. Execution of this statement the second
# time results in emitting the error ER_UNKNOWN_TABLE. The same error
# is issued in case the statement 'HANDLER t1 CLOSE' executed twice
# using a regular statement.
EXECUTE stmt_4;
ERROR 42S02: Unknown table 't1' in HANDLER
# Clean up
DEALLOCATE PREPARE stmt_1;
DEALLOCATE PREPARE stmt_2;
DEALLOCATE PREPARE stmt_3;
DEALLOCATE PREPARE stmt_4;
DROP TABLE t1;
# Test case 10: Check that the HELP statement
# is supported by prepared statements
INSERT INTO mysql.help_topic VALUES (0, 'Tamagotchi', 0, 'This digital pet is not a KB article', 'no example', 'https://tamagotchi.com/');
PREPARE stmt_1 FROM "HELP `Tamagotchi`";
EXECUTE stmt_1;
name	description	example
Tamagotchi	This digital pet is not a KB article	no example
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'HELP' statement
# were damaged.
EXECUTE stmt_1;
name	description	example
Tamagotchi	This digital pet is not a KB article	no example
DELETE FROM mysql.help_topic WHERE help_topic_id = 0;
# Test case 11: Check that the 'CREATE PROCEDURE' statement
# is supported by prepared statements
PREPARE stmt_1 FROM 'CREATE PROCEDURE p1() SET @a=1';
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'CREATE PROCEDURE'
# statement were damaged. Execution of this statement the second
# time expectedly results in emitting the error ER_SP_ALREADY_EXISTS.
# The same error is issued in case the 'HANDLER t1 OPEN' statement
# is executed twice using a regular statement.
EXECUTE stmt_1;
ERROR 42000: PROCEDURE p1 already exists
# Test case 12: Check that the 'ALTER PROCEDURE' statement is supported
# by prepared statements.
PREPARE stmt_1 FROM 'ALTER PROCEDURE p1 SQL SECURITY INVOKER';
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'ALTER PROCEDURE'
# statement were damaged.
EXECUTE stmt_1;
# Test case 13: Check that the 'DROP PROCEDURE' statement is supported
# by prepared statements.
PREPARE stmt_1 FROM 'DROP PROCEDURE p1';
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'DROP PROCEDURE' statement
# were damaged. Execution of this statement the second time expectedly
# results in emitting the error ER_SP_DOES_NOT_EXIST.
EXECUTE stmt_1;
ERROR 42000: PROCEDURE test.p1 does not exist
# Test case 14: Check that the 'CALL' statement is supported
# by prepared statements.
CREATE PROCEDURE p1() SET @a=1;
PREPARE stmt_1 FROM 'CALL p1()';
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'CALL' statement
# were damaged.
EXECUTE stmt_1;
# Clean up
DEALLOCATE PREPARE stmt_1;
DROP PROCEDURE p1;
# Test case 15: Check that the 'CREATE VIEW' statement can be executed
# as a prepared statement.
# Create environment for the test case
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1);
COMMIT;
PREPARE stmt_1 FROM 'CREATE VIEW v1 AS SELECT * FROM t1';
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'CREATE VIEW'
# statement were damaged. The second execution of the prepared
# statement stmt_1 results in error ER_TABLE_EXISTS_ERROR since
# the view v1 does already exist. It is expected behaviour.
EXECUTE stmt_1;
ERROR 42S01: Table 'v1' already exists
# Clean up
DEALLOCATE PREPARE stmt_1;
DROP VIEW v1;
DROP TABLE t1;
# Test case 16: Check that the 'CREATE TRIGGER' statement can be executed
# as a prepared statement.
CREATE TABLE t1 (a INT);
PREPARE stmt_1 FROM 'CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a=1';
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'CREATE VIEW' statement
# were damaged. The second execution of the prepared statement stmt_1
# results in error ER_TRG_ALREADY_EXISTS since the trigger trg1 does
# already exist. It is expected behaviour.
EXECUTE stmt_1;
ERROR HY000: Trigger 'test.trg1' already exists
# Test case 17: Check that the 'DROP TRIGGER' statement can be executed
# as a prepared statement.
# This test relies on presence of the trigger trg1 created by
# the test case 16.
PREPARE stmt_1 FROM 'DROP TRIGGER trg1';
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'DROP TRIGGER' statement
# were damaged. Execution of this statement the second time expectedly
# results in emitting the error ER_TRG_DOES_NOT_EXIST.
EXECUTE stmt_1;
ERROR HY000: Trigger does not exist
# Clean up
DEALLOCATE PREPARE stmt_1;
DROP TABLE t1;
# Test case 18: Check that XA related SQL statements can be executed
# as prepared statements.
# Create the table t1 used by XA transaction.
CREATE TABLE t1 (a INT);
PREPARE stmt_1 FROM "XA START 'xid1'";
PREPARE stmt_2 FROM "XA END 'xid1'";
PREPARE stmt_3 FROM "XA PREPARE 'xid1'";
PREPARE stmt_4 FROM "XA RECOVER";
PREPARE stmt_5 FROM "XA COMMIT 'xid1'";
PREPARE stmt_6 FROM "XA ROLLBACK 'xid1'";
# Start a new XA transaction
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'XA START' statement
# were damaged. Execution of this statement the second time expectedly
# results in emitting the error XAER_RMFAIL since there is active
# XA transaction that has just been already.
EXECUTE stmt_1;
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the  ACTIVE state
INSERT INTO t1 VALUES (1);
# End the current XA transaction
EXECUTE stmt_2;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'XA END' statement
# were damaged. Execution of this statement the second time expectedly
# results in emitting the error XAER_RMFAIL since the XA transaction
# with XID 'xid1' has been already ended.
EXECUTE stmt_2;
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the  IDLE state
# Prepare the current XA transaction for finalization
EXECUTE stmt_3;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'XA END' statement
# were damaged. Execution of this statement the second time expectedly
# results in emitting the error XAER_RMFAIL since the XA transaction
# with XID 'xid1' has been already ended.
EXECUTE stmt_3;
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the  PREPARED state
# Run XA RECOVER as a prepared statement
EXECUTE stmt_4;
formatID	gtrid_length	bqual_length	data
1	4	0	xid1
# And execute it yet another time to check that no internal structures
# used for handling the statement 'XA RECOVER' were damaged.
EXECUTE stmt_4;
formatID	gtrid_length	bqual_length	data
1	4	0	xid1
# Commit the current XA transaction
EXECUTE stmt_5;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'XA COMMIT' statement
# were damaged. Execution of this statement the second time expectedly
# results in emitting the error XAER_NOTA since the XA transaction
# with XID 'xid1' has been finalized and no more exists.
EXECUTE stmt_5;
ERROR XAE04: XAER_NOTA: Unknown XID
# Query the table t1 to check that it contains a record inserted by
# the XA transaction just finished.
SELECT * FROM t1;
a
1
# Using prepared statements start a new XA transaction, INSERT a row
# into the table t1, prepare the XA transaction and rollback it.
# This use case is similar to precedence one except it does rollback
# XA transaction instead commit it. Therefore every prepared statement
# is executed only once except the last XA ROLLBACK.
# Start a new XA transaction
EXECUTE stmt_1;
INSERT INTO t1 VALUES (1);
# End the current XA transaction
EXECUTE stmt_2;
# Prepare the current XA transaction for finalization
EXECUTE stmt_3;
# Rolback the current XA transaction
EXECUTE stmt_6;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the statement 'XA ROLLBACK'
# were damaged. Execution of this statement the second time expectedly
# results in emitting the error XAER_NOTA since the XA transaction
# with XID 'xid1' has been finalized and no more exists.
EXECUTE stmt_6;
ERROR XAE04: XAER_NOTA: Unknown XID
# Clean up
DROP TABLE t1;
DEALLOCATE PREPARE stmt_1;
DEALLOCATE PREPARE stmt_2;
DEALLOCATE PREPARE stmt_3;
DEALLOCATE PREPARE stmt_4;
DEALLOCATE PREPARE stmt_5;
DEALLOCATE PREPARE stmt_6;
# Test case 19: Check that the  CREATE SERVER/ALTER SERVER/DROP SERVER
# statements can be executed as prepared statements.
PREPARE stmt_1 FROM "CREATE SERVER s FOREIGN DATA WRAPPER mysql OPTIONS (USER 'u1', HOST '127.0.0.1')";
PREPARE stmt_2 FROM "ALTER SERVER s OPTIONS (USER 'u2')";
PREPARE stmt_3 FROM "DROP SERVER s";
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'CREATE SERVER' statement
# were damaged. Execution of this statement the second time expectedly
# results in emitting the error ER_FOREIGN_SERVER_EXISTS
# since a server with same has just been created.
EXECUTE stmt_1;
ERROR HY000: Cannot create foreign server 's' as it already exists
EXECUTE stmt_2;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'ALTER SERVER' statement
# were damaged.
EXECUTE stmt_2;
EXECUTE stmt_3;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'DROP SERVER' statement
# were damaged. Execution of this statement the second time expectedly
# results in emitting the error ER_FOREIGN_SERVER_DOESNT_EXIST
# since the server with same has just been dropped.
EXECUTE stmt_3;
ERROR HY000: The foreign server name you are trying to reference does not exist. Data source error:  s
# Clean up
DEALLOCATE PREPARE stmt_1;
DEALLOCATE PREPARE stmt_2;
DEALLOCATE PREPARE stmt_3;
# Test case 21: Check that the SIGNAL and RESIGNAL statements
# can be executed as a prepared statement
PREPARE stmt_1 FROM "SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT='Hello, world!'";
EXECUTE stmt_1;
ERROR 45000: Hello, world!
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'SIGNAL' statement
# were damaged.
EXECUTE stmt_1;
ERROR 45000: Hello, world!
PREPARE stmt_1 FROM 'RESIGNAL SET MYSQL_ERRNO = 5';
EXECUTE stmt_1;
ERROR 0K000: RESIGNAL when handler not active
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'RESIGNAL' statement
# were damaged.
EXECUTE stmt_1;
ERROR 0K000: RESIGNAL when handler not active
# Clean up
DEALLOCATE PREPARE stmt_1;
# Test case 23: Check the 'GET DIAGNOSTICS' statement
# can be executed as a prepared statement
PREPARE stmt_1 FROM 'GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE, @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT';
# Query from non existent table to fill the diagnostics area
# with information
SELECT * FROM non_existent_table_1;
ERROR 42S02: Table 'test.non_existent_table_1' doesn't exist
EXECUTE stmt_1;
# Check that information from diagnostics area has been retrieved
SELECT @sqlstate, @errno, @text;
@sqlstate	@errno	@text
42S02	1146	Table 'test.non_existent_table_1' doesn't exist
SELECT * FROM non_existent_table_1;
ERROR 42S02: Table 'test.non_existent_table_1' doesn't exist
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the
# 'GET DIAGNOSTICS CONDITION' statement were damaged.
EXECUTE stmt_1;
# Clean up
DEALLOCATE PREPARE stmt_1;
# Test case 24: Check the statements 'BACKUP'/'BACKUP UNLOCK'
# can be executed as a prepared statement
CREATE TABLE t1 (a INT);
PREPARE stmt_1 FROM 'BACKUP LOCK t1';
PREPARE stmt_2 FROM 'BACKUP UNLOCK';
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'BACKUP LOCK'
# statement were damaged.
EXECUTE stmt_1;
EXECUTE stmt_2;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'BACKUP UNLOCK'
# statement were damaged.
EXECUTE stmt_2;
# Clean up
DROP TABLE t1;
DEALLOCATE PREPARE stmt_1;
DEALLOCATE PREPARE stmt_2;
# Test Test case 25: Check the statements 'CREATE/ALTER/DROP TABLEPSPACE'
# can be executed as a prepared statement
PREPARE stmt_1 FROM "CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENGINE=InnoDB";
PREPARE stmt_2 FROM "ALTER TABLESPACE ts1 ADD DATAFILE 'ts1_1.ibd' ENGINE=InnoDB";
PREPARE stmt_3 FROM "DROP TABLESPACE ts1 ENGINE=InnoDB";
EXECUTE stmt_1;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'CREATE TABLESPACE'
# statement were damaged.
EXECUTE stmt_1;
EXECUTE stmt_2;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'ALTER TABLESPACE'
# statement were damaged.
EXECUTE stmt_2;
EXECUTE stmt_3;
# Execute the same prepared statement the second time to check that
# no internal structures used for handling the 'DROP TABLESPACE'
# statement were damaged.
EXECUTE stmt_3;
DEALLOCATE PREPARE stmt_1;
DEALLOCATE PREPARE stmt_2;
DEALLOCATE PREPARE stmt_3;
SET default_storage_engine= @save_storage_engine;