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
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
|
include/master-slave.inc
[connection master]
==== Initialization ====
connection master;
SET @m_default_week_format= @@global.default_week_format;
SET @m_init_slave= @@global.init_slave;
SET @m_lc_time_names= @@global.lc_time_names;
SET @m_low_priority_updates= @@global.low_priority_updates;
SET @m_relay_log_purge= @@global.relay_log_purge;
SET @m_slave_exec_mode= @@global.slave_exec_mode;
SET @m_sql_mode= @@global.sql_mode;
SET @m_sync_binlog= @@global.sync_binlog;
connection slave;
SET @s_default_week_format= @@global.default_week_format;
SET @s_init_slave= @@global.init_slave;
SET @s_lc_time_names= @@global.lc_time_names;
SET @s_low_priority_updates= @@global.low_priority_updates;
SET @s_relay_log_purge= @@global.relay_log_purge;
SET @s_slave_exec_mode= @@global.slave_exec_mode;
SET @s_sql_mode= @@global.sql_mode;
SET @s_sync_binlog= @@global.sync_binlog;
SET @@global.relay_log_purge = OFF;
SET @@global.sync_binlog = 1000000;
SET @@global.slave_exec_mode = 'STRICT';
SET @@sql_big_selects = OFF;
SET @@last_insert_id = 10;
SET @@global.low_priority_updates = OFF;
SET @@local.low_priority_updates = OFF;
SET @@global.default_week_format = 1;
SET @@local.default_week_format = 2;
SET @@global.lc_time_names = 'zh_HK';
SET @@local.lc_time_names = 'zh_TW';
SET @@global.sql_mode = 'ALLOW_INVALID_DATES';
SET @@local.sql_mode = 'ANSI_QUOTES,ERROR_FOR_DIVISION_BY_ZERO,HIGH_NOT_PRECEDENCE';
SET @user_num = 10;
SET @user_text = 'Alunda';
include/stop_slave.inc
include/start_slave.inc
SET @@global.init_slave = 'SELECT 1';
connection master;
SELECT @@pid_file, @@datadir;
@@pid_file MYSQLTEST_VARDIR/run/mysqld.1.pid
@@datadir MYSQLTEST_VARDIR/mysqld.1/data/
**** Relay log variables
SELECT @@relay_log, @@relay_log_index, @@relay_log_basename;
@@relay_log master-relay-bin
@@relay_log_index MYSQLTEST_VARDIR/mysqld.1/data/master-relay-bin.index
@@relay_log_basename MYSQLTEST_VARDIR/mysqld.1/data/master-relay-bin
**** Binary log variables
SELECT @@log_bin, @@log_bin_index, @@log_bin_basename;
@@log_bin 1
@@log_bin_index MYSQLTEST_VARDIR/mysqld.1/data/master-bin.index
@@log_bin_basename MYSQLTEST_VARDIR/mysqld.1/data/master-bin
connection slave;
SELECT @@pid_file, @@datadir;
@@pid_file MYSQLTEST_VARDIR/run/mysqld.2.pid
@@datadir MYSQLTEST_VARDIR/mysqld.2/data/
**** Relay log variables
SELECT @@relay_log, @@relay_log_index, @@relay_log_basename;
@@relay_log slave-relay-bin
@@relay_log_index MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.index
@@relay_log_basename MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin
**** Binary log variables
SELECT @@log_bin, @@log_bin_index, @@log_bin_basename;
@@log_bin 1
@@log_bin_index MYSQLTEST_VARDIR/mysqld.2/data/slave-bin.index
@@log_bin_basename MYSQLTEST_VARDIR/mysqld.2/data/slave-bin
connection master;
CREATE TABLE tstmt (id INT AUTO_INCREMENT PRIMARY KEY,
truth BOOLEAN,
num INT,
text VARCHAR(100));
CREATE TABLE tproc LIKE tstmt;
CREATE TABLE tfunc LIKE tstmt;
CREATE TABLE ttrig LIKE tstmt;
CREATE TABLE tprep LIKE tstmt;
CREATE TABLE trigger_table (text CHAR(4));
==== Insert variables directly ====
---- global variables ----
SET @@global.relay_log_purge = ON;
INSERT INTO tstmt(truth) VALUES (@@global.relay_log_purge);
SET @@global.relay_log_purge = OFF;
INSERT INTO tstmt(truth) VALUES (@@global.relay_log_purge);
SET @@global.sync_binlog = 2000000;
INSERT INTO tstmt(num) VALUES (@@global.sync_binlog);
SET @@global.sync_binlog = 3000000;
INSERT INTO tstmt(num) VALUES (@@global.sync_binlog);
SET @@global.init_slave = 'SELECT 2';
INSERT INTO tstmt(text) VALUES (@@global.init_slave);
SET @@global.init_slave = 'SELECT 3';
INSERT INTO tstmt(text) VALUES (@@global.init_slave);
SET @@global.slave_exec_mode = 'IDEMPOTENT';
INSERT INTO tstmt(text) VALUES (@@global.slave_exec_mode);
SET @@global.slave_exec_mode = 'STRICT';
INSERT INTO tstmt(text) VALUES (@@global.slave_exec_mode);
---- session variables ----
SET @@sql_big_selects = ON;
INSERT INTO tstmt(truth) VALUES (@@sql_big_selects);
SET @@sql_big_selects = OFF;
INSERT INTO tstmt(truth) VALUES (@@sql_big_selects);
SET @@last_insert_id = 20;
INSERT INTO tstmt(num) VALUES (@@last_insert_id);
SET @@last_insert_id = 30;
INSERT INTO tstmt(num) VALUES (@@last_insert_id);
---- global and session variables ----
SET @@global.low_priority_updates = ON;
SET @@local.low_priority_updates = OFF;
INSERT INTO tstmt(truth) VALUES (@@global.low_priority_updates);
INSERT INTO tstmt(truth) VALUES (@@local.low_priority_updates);
SET @@global.low_priority_updates = OFF;
SET @@local.low_priority_updates = ON;
INSERT INTO tstmt(truth) VALUES (@@global.low_priority_updates);
INSERT INTO tstmt(truth) VALUES (@@local.low_priority_updates);
SET @@global.default_week_format = 3;
SET @@local.default_week_format = 4;
INSERT INTO tstmt(num) VALUES (@@global.default_week_format);
INSERT INTO tstmt(num) VALUES (@@local.default_week_format);
SET @@global.default_week_format = 5;
SET @@local.default_week_format = 6;
INSERT INTO tstmt(num) VALUES (@@global.default_week_format);
INSERT INTO tstmt(num) VALUES (@@local.default_week_format);
SET @@global.lc_time_names = 'sv_SE';
SET @@local.lc_time_names = 'sv_FI';
INSERT INTO tstmt(text) VALUES (@@global.lc_time_names);
INSERT INTO tstmt(text) VALUES (@@local.lc_time_names);
SET @@global.lc_time_names = 'ar_TN';
SET @@local.lc_time_names = 'ar_IQ';
INSERT INTO tstmt(text) VALUES (@@global.lc_time_names);
INSERT INTO tstmt(text) VALUES (@@local.lc_time_names);
SET @@global.sql_mode = '';
SET @@local.sql_mode = 'IGNORE_SPACE,NO_AUTO_CREATE_USER';
INSERT INTO tstmt(text) VALUES (@@global.sql_mode);
INSERT INTO tstmt(text) VALUES (@@local.sql_mode);
SET @@global.sql_mode = 'NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,NO_DIR_IN_CREATE,NO_ENGINE_SUBSTITUTION';
SET @@local.sql_mode = 'NO_FIELD_OPTIONS,NO_KEY_OPTIONS,NO_TABLE_OPTIONS';
INSERT INTO tstmt(text) VALUES (@@global.sql_mode);
INSERT INTO tstmt(text) VALUES (@@local.sql_mode);
---- user variables ----
SET @user_num = 20;
INSERT INTO tstmt(num) VALUES (@user_num);
SET @user_num = 30;
INSERT INTO tstmt(num) VALUES (@user_num);
SET @user_text = 'Bergsbrunna';
INSERT INTO tstmt(text) VALUES (@user_text);
SET @user_text = 'Centrum';
INSERT INTO tstmt(text) VALUES (@user_text);
==== Insert variables from a stored procedure ====
CREATE PROCEDURE proc()
BEGIN
# GLOBAL
# boolean
SET @@global.relay_log_purge = ON;
INSERT INTO tproc(truth) VALUES (@@global.relay_log_purge);
SET @@global.relay_log_purge = OFF;
INSERT INTO tproc(truth) VALUES (@@global.relay_log_purge);
# numeric
SET @@global.sync_binlog = 2000000;
INSERT INTO tproc(num) VALUES (@@global.sync_binlog);
SET @@global.sync_binlog = 3000000;
INSERT INTO tproc(num) VALUES (@@global.sync_binlog);
# string
SET @@global.init_slave = 'SELECT 2';
INSERT INTO tproc(text) VALUES (@@global.init_slave);
SET @@global.init_slave = 'SELECT 3';
INSERT INTO tproc(text) VALUES (@@global.init_slave);
# enumeration
SET @@global.slave_exec_mode = 'IDEMPOTENT';
INSERT INTO tproc(text) VALUES (@@global.slave_exec_mode);
SET @@global.slave_exec_mode = 'STRICT';
INSERT INTO tproc(text) VALUES (@@global.slave_exec_mode);
# SESSION
# boolean
SET @@sql_big_selects = ON;
INSERT INTO tproc(truth) VALUES (@@sql_big_selects);
SET @@sql_big_selects = OFF;
INSERT INTO tproc(truth) VALUES (@@sql_big_selects);
# numeric
SET @@last_insert_id = 20;
INSERT INTO tproc(num) VALUES (@@last_insert_id);
SET @@last_insert_id = 30;
INSERT INTO tproc(num) VALUES (@@last_insert_id);
# BOTH
# boolean
SET @@global.low_priority_updates = ON;
SET @@local.low_priority_updates = OFF;
INSERT INTO tproc(truth) VALUES (@@global.low_priority_updates);
INSERT INTO tproc(truth) VALUES (@@local.low_priority_updates);
SET @@global.low_priority_updates = OFF;
SET @@local.low_priority_updates = ON;
INSERT INTO tproc(truth) VALUES (@@global.low_priority_updates);
INSERT INTO tproc(truth) VALUES (@@local.low_priority_updates);
# numeric
SET @@global.default_week_format = 3;
SET @@local.default_week_format = 4;
INSERT INTO tproc(num) VALUES (@@global.default_week_format);
INSERT INTO tproc(num) VALUES (@@local.default_week_format);
SET @@global.default_week_format = 5;
SET @@local.default_week_format = 6;
INSERT INTO tproc(num) VALUES (@@global.default_week_format);
INSERT INTO tproc(num) VALUES (@@local.default_week_format);
# text
SET @@global.lc_time_names = 'sv_SE';
SET @@local.lc_time_names = 'sv_FI';
INSERT INTO tproc(text) VALUES (@@global.lc_time_names);
INSERT INTO tproc(text) VALUES (@@local.lc_time_names);
SET @@global.lc_time_names = 'ar_TN';
SET @@local.lc_time_names = 'ar_IQ';
INSERT INTO tproc(text) VALUES (@@global.lc_time_names);
INSERT INTO tproc(text) VALUES (@@local.lc_time_names);
# enum
SET @@global.sql_mode = '';
SET @@local.sql_mode = 'IGNORE_SPACE,NO_AUTO_CREATE_USER';
INSERT INTO tproc(text) VALUES (@@global.sql_mode);
INSERT INTO tproc(text) VALUES (@@local.sql_mode);
SET @@global.sql_mode = 'NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,NO_DIR_IN_CREATE,NO_ENGINE_SUBSTITUTION';
SET @@local.sql_mode = 'NO_FIELD_OPTIONS,NO_KEY_OPTIONS,NO_TABLE_OPTIONS';
INSERT INTO tproc(text) VALUES (@@global.sql_mode);
INSERT INTO tproc(text) VALUES (@@local.sql_mode);
# USER
# numeric
SET @user_num = 20;
INSERT INTO tproc(num) VALUES (@user_num);
SET @user_num = 30;
INSERT INTO tproc(num) VALUES (@user_num);
# string
SET @user_text = 'Bergsbrunna';
INSERT INTO tproc(text) VALUES (@user_text);
SET @user_text = 'Centrum';
INSERT INTO tproc(text) VALUES (@user_text);
END|
CALL proc();
==== Insert variables from a stored function ====
CREATE FUNCTION func()
RETURNS INT
BEGIN
# GLOBAL
# boolean
SET @@global.relay_log_purge = ON;
INSERT INTO tfunc(truth) VALUES (@@global.relay_log_purge);
SET @@global.relay_log_purge = OFF;
INSERT INTO tfunc(truth) VALUES (@@global.relay_log_purge);
# numeric
SET @@global.sync_binlog = 2000000;
INSERT INTO tfunc(num) VALUES (@@global.sync_binlog);
SET @@global.sync_binlog = 3000000;
INSERT INTO tfunc(num) VALUES (@@global.sync_binlog);
# string
SET @@global.init_slave = 'SELECT 2';
INSERT INTO tfunc(text) VALUES (@@global.init_slave);
SET @@global.init_slave = 'SELECT 3';
INSERT INTO tfunc(text) VALUES (@@global.init_slave);
# enumeration
SET @@global.slave_exec_mode = 'IDEMPOTENT';
INSERT INTO tfunc(text) VALUES (@@global.slave_exec_mode);
SET @@global.slave_exec_mode = 'STRICT';
INSERT INTO tfunc(text) VALUES (@@global.slave_exec_mode);
# SESSION
# boolean
SET @@sql_big_selects = ON;
INSERT INTO tfunc(truth) VALUES (@@sql_big_selects);
SET @@sql_big_selects = OFF;
INSERT INTO tfunc(truth) VALUES (@@sql_big_selects);
# numeric
SET @@last_insert_id = 20;
INSERT INTO tfunc(num) VALUES (@@last_insert_id);
SET @@last_insert_id = 30;
INSERT INTO tfunc(num) VALUES (@@last_insert_id);
# BOTH
# boolean
SET @@global.low_priority_updates = ON;
SET @@local.low_priority_updates = OFF;
INSERT INTO tfunc(truth) VALUES (@@global.low_priority_updates);
INSERT INTO tfunc(truth) VALUES (@@local.low_priority_updates);
SET @@global.low_priority_updates = OFF;
SET @@local.low_priority_updates = ON;
INSERT INTO tfunc(truth) VALUES (@@global.low_priority_updates);
INSERT INTO tfunc(truth) VALUES (@@local.low_priority_updates);
# numeric
SET @@global.default_week_format = 3;
SET @@local.default_week_format = 4;
INSERT INTO tfunc(num) VALUES (@@global.default_week_format);
INSERT INTO tfunc(num) VALUES (@@local.default_week_format);
SET @@global.default_week_format = 5;
SET @@local.default_week_format = 6;
INSERT INTO tfunc(num) VALUES (@@global.default_week_format);
INSERT INTO tfunc(num) VALUES (@@local.default_week_format);
# text
SET @@global.lc_time_names = 'sv_SE';
SET @@local.lc_time_names = 'sv_FI';
INSERT INTO tfunc(text) VALUES (@@global.lc_time_names);
INSERT INTO tfunc(text) VALUES (@@local.lc_time_names);
SET @@global.lc_time_names = 'ar_TN';
SET @@local.lc_time_names = 'ar_IQ';
INSERT INTO tfunc(text) VALUES (@@global.lc_time_names);
INSERT INTO tfunc(text) VALUES (@@local.lc_time_names);
# enum
SET @@global.sql_mode = '';
SET @@local.sql_mode = 'IGNORE_SPACE,NO_AUTO_CREATE_USER';
INSERT INTO tfunc(text) VALUES (@@global.sql_mode);
INSERT INTO tfunc(text) VALUES (@@local.sql_mode);
SET @@global.sql_mode = 'NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,NO_DIR_IN_CREATE,NO_ENGINE_SUBSTITUTION';
SET @@local.sql_mode = 'NO_FIELD_OPTIONS,NO_KEY_OPTIONS,NO_TABLE_OPTIONS';
INSERT INTO tfunc(text) VALUES (@@global.sql_mode);
INSERT INTO tfunc(text) VALUES (@@local.sql_mode);
# USER
# numeric
SET @user_num = 20;
INSERT INTO tfunc(num) VALUES (@user_num);
SET @user_num = 30;
INSERT INTO tfunc(num) VALUES (@user_num);
# string
SET @user_text = 'Bergsbrunna';
INSERT INTO tfunc(text) VALUES (@user_text);
SET @user_text = 'Centrum';
INSERT INTO tfunc(text) VALUES (@user_text);
RETURN 0;
END|
SELECT func();
func()
0
==== Insert variables from a trigger ====
CREATE TRIGGER trig
BEFORE INSERT ON trigger_table
FOR EACH ROW
BEGIN
# GLOBAL
# boolean
SET @@global.relay_log_purge = ON;
INSERT INTO ttrig(truth) VALUES (@@global.relay_log_purge);
SET @@global.relay_log_purge = OFF;
INSERT INTO ttrig(truth) VALUES (@@global.relay_log_purge);
# numeric
SET @@global.sync_binlog = 2000000;
INSERT INTO ttrig(num) VALUES (@@global.sync_binlog);
SET @@global.sync_binlog = 3000000;
INSERT INTO ttrig(num) VALUES (@@global.sync_binlog);
# string
SET @@global.init_slave = 'SELECT 2';
INSERT INTO ttrig(text) VALUES (@@global.init_slave);
SET @@global.init_slave = 'SELECT 3';
INSERT INTO ttrig(text) VALUES (@@global.init_slave);
# enumeration
SET @@global.slave_exec_mode = 'IDEMPOTENT';
INSERT INTO ttrig(text) VALUES (@@global.slave_exec_mode);
SET @@global.slave_exec_mode = 'STRICT';
INSERT INTO ttrig(text) VALUES (@@global.slave_exec_mode);
# SESSION
# boolean
SET @@sql_big_selects = ON;
INSERT INTO ttrig(truth) VALUES (@@sql_big_selects);
SET @@sql_big_selects = OFF;
INSERT INTO ttrig(truth) VALUES (@@sql_big_selects);
# numeric
SET @@last_insert_id = 20;
INSERT INTO ttrig(num) VALUES (@@last_insert_id);
SET @@last_insert_id = 30;
INSERT INTO ttrig(num) VALUES (@@last_insert_id);
# BOTH
# boolean
SET @@global.low_priority_updates = ON;
SET @@local.low_priority_updates = OFF;
INSERT INTO ttrig(truth) VALUES (@@global.low_priority_updates);
INSERT INTO ttrig(truth) VALUES (@@local.low_priority_updates);
SET @@global.low_priority_updates = OFF;
SET @@local.low_priority_updates = ON;
INSERT INTO ttrig(truth) VALUES (@@global.low_priority_updates);
INSERT INTO ttrig(truth) VALUES (@@local.low_priority_updates);
# numeric
SET @@global.default_week_format = 3;
SET @@local.default_week_format = 4;
INSERT INTO ttrig(num) VALUES (@@global.default_week_format);
INSERT INTO ttrig(num) VALUES (@@local.default_week_format);
SET @@global.default_week_format = 5;
SET @@local.default_week_format = 6;
INSERT INTO ttrig(num) VALUES (@@global.default_week_format);
INSERT INTO ttrig(num) VALUES (@@local.default_week_format);
# text
SET @@global.lc_time_names = 'sv_SE';
SET @@local.lc_time_names = 'sv_FI';
INSERT INTO ttrig(text) VALUES (@@global.lc_time_names);
INSERT INTO ttrig(text) VALUES (@@local.lc_time_names);
SET @@global.lc_time_names = 'ar_TN';
SET @@local.lc_time_names = 'ar_IQ';
INSERT INTO ttrig(text) VALUES (@@global.lc_time_names);
INSERT INTO ttrig(text) VALUES (@@local.lc_time_names);
# enum
SET @@global.sql_mode = '';
SET @@local.sql_mode = 'IGNORE_SPACE,NO_AUTO_CREATE_USER';
INSERT INTO ttrig(text) VALUES (@@global.sql_mode);
INSERT INTO ttrig(text) VALUES (@@local.sql_mode);
SET @@global.sql_mode = 'NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,NO_DIR_IN_CREATE,NO_ENGINE_SUBSTITUTION';
SET @@local.sql_mode = 'NO_FIELD_OPTIONS,NO_KEY_OPTIONS,NO_TABLE_OPTIONS';
INSERT INTO ttrig(text) VALUES (@@global.sql_mode);
INSERT INTO ttrig(text) VALUES (@@local.sql_mode);
# USER
# numeric
SET @user_num = 20;
INSERT INTO ttrig(num) VALUES (@user_num);
SET @user_num = 30;
INSERT INTO ttrig(num) VALUES (@user_num);
# string
SET @user_text = 'Bergsbrunna';
INSERT INTO ttrig(text) VALUES (@user_text);
SET @user_text = 'Centrum';
INSERT INTO ttrig(text) VALUES (@user_text);
END|
INSERT INTO trigger_table VALUES ('bye.');
==== Insert variables from a prepared statement ====
PREPARE p1 FROM 'SET @@global.relay_log_purge = ON';
PREPARE p2 FROM 'INSERT INTO tprep(truth) VALUES (@@global.relay_log_purge)';
PREPARE p3 FROM 'SET @@global.relay_log_purge = OFF';
PREPARE p4 FROM 'INSERT INTO tprep(truth) VALUES (@@global.relay_log_purge)';
PREPARE p5 FROM 'SET @@global.sync_binlog = 2000000';
PREPARE p6 FROM 'INSERT INTO tprep(num) VALUES (@@global.sync_binlog)';
PREPARE p7 FROM 'SET @@global.sync_binlog = 3000000';
PREPARE p8 FROM 'INSERT INTO tprep(num) VALUES (@@global.sync_binlog)';
PREPARE p9 FROM 'SET @@global.init_slave = \'SELECT 2\'';
PREPARE p10 FROM 'INSERT INTO tprep(text) VALUES (@@global.init_slave)';
PREPARE p11 FROM 'SET @@global.init_slave = \'SELECT 3\'';
PREPARE p12 FROM 'INSERT INTO tprep(text) VALUES (@@global.init_slave)';
PREPARE p13 FROM 'SET @@global.slave_exec_mode = \'IDEMPOTENT\'';
PREPARE p14 FROM 'INSERT INTO tprep(text) VALUES (@@global.slave_exec_mode)';
PREPARE p15 FROM 'SET @@global.slave_exec_mode = \'STRICT\'';
PREPARE p16 FROM 'INSERT INTO tprep(text) VALUES (@@global.slave_exec_mode)';
PREPARE p17 FROM 'SET @@sql_big_selects = ON';
PREPARE p18 FROM 'INSERT INTO tprep(truth) VALUES (@@sql_big_selects)';
PREPARE p19 FROM 'SET @@sql_big_selects = OFF';
PREPARE p20 FROM 'INSERT INTO tprep(truth) VALUES (@@sql_big_selects)';
PREPARE p21 FROM 'SET @@last_insert_id = 20';
PREPARE p22 FROM 'INSERT INTO tprep(num) VALUES (@@last_insert_id)';
PREPARE p23 FROM 'SET @@last_insert_id = 30';
PREPARE p24 FROM 'INSERT INTO tprep(num) VALUES (@@last_insert_id)';
PREPARE p25 FROM 'SET @@global.low_priority_updates = ON';
PREPARE p26 FROM 'SET @@local.low_priority_updates = OFF';
PREPARE p27 FROM 'INSERT INTO tprep(truth) VALUES (@@global.low_priority_updates)';
PREPARE p28 FROM 'INSERT INTO tprep(truth) VALUES (@@local.low_priority_updates)';
PREPARE p29 FROM 'SET @@global.low_priority_updates = OFF';
PREPARE p30 FROM 'SET @@local.low_priority_updates = ON';
PREPARE p31 FROM 'INSERT INTO tprep(truth) VALUES (@@global.low_priority_updates)';
PREPARE p32 FROM 'INSERT INTO tprep(truth) VALUES (@@local.low_priority_updates)';
PREPARE p33 FROM 'SET @@global.default_week_format = 3';
PREPARE p34 FROM 'SET @@local.default_week_format = 4';
PREPARE p35 FROM 'INSERT INTO tprep(num) VALUES (@@global.default_week_format)';
PREPARE p36 FROM 'INSERT INTO tprep(num) VALUES (@@local.default_week_format)';
PREPARE p37 FROM 'SET @@global.default_week_format = 5';
PREPARE p38 FROM 'SET @@local.default_week_format = 6';
PREPARE p39 FROM 'INSERT INTO tprep(num) VALUES (@@global.default_week_format)';
PREPARE p40 FROM 'INSERT INTO tprep(num) VALUES (@@local.default_week_format)';
PREPARE p41 FROM 'SET @@global.lc_time_names = \'sv_SE\'';
PREPARE p42 FROM 'SET @@local.lc_time_names = \'sv_FI\'';
PREPARE p43 FROM 'INSERT INTO tprep(text) VALUES (@@global.lc_time_names)';
PREPARE p44 FROM 'INSERT INTO tprep(text) VALUES (@@local.lc_time_names)';
PREPARE p45 FROM 'SET @@global.lc_time_names = \'ar_TN\'';
PREPARE p46 FROM 'SET @@local.lc_time_names = \'ar_IQ\'';
PREPARE p47 FROM 'INSERT INTO tprep(text) VALUES (@@global.lc_time_names)';
PREPARE p48 FROM 'INSERT INTO tprep(text) VALUES (@@local.lc_time_names)';
PREPARE p49 FROM 'SET @@global.sql_mode = \'\'';
PREPARE p50 FROM 'SET @@local.sql_mode = \'IGNORE_SPACE,NO_AUTO_CREATE_USER\'';
PREPARE p51 FROM 'INSERT INTO tprep(text) VALUES (@@global.sql_mode)';
PREPARE p52 FROM 'INSERT INTO tprep(text) VALUES (@@local.sql_mode)';
PREPARE p53 FROM 'SET @@global.sql_mode = \'NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,NO_DIR_IN_CREATE,NO_ENGINE_SUBSTITUTION\'';
PREPARE p54 FROM 'SET @@local.sql_mode = \'NO_FIELD_OPTIONS,NO_KEY_OPTIONS,NO_TABLE_OPTIONS\'';
PREPARE p55 FROM 'INSERT INTO tprep(text) VALUES (@@global.sql_mode)';
PREPARE p56 FROM 'INSERT INTO tprep(text) VALUES (@@local.sql_mode)';
PREPARE p57 FROM 'SET @user_num = 20';
PREPARE p58 FROM 'INSERT INTO tprep(num) VALUES (@user_num)';
PREPARE p59 FROM 'SET @user_num = 30';
PREPARE p60 FROM 'INSERT INTO tprep(num) VALUES (@user_num)';
PREPARE p61 FROM 'SET @user_text = \'Bergsbrunna\'';
PREPARE p62 FROM 'INSERT INTO tprep(text) VALUES (@user_text)';
PREPARE p63 FROM 'SET @user_text = \'Centrum\'';
PREPARE p64 FROM 'INSERT INTO tprep(text) VALUES (@user_text)';
EXECUTE p1;
EXECUTE p2;
EXECUTE p3;
EXECUTE p4;
EXECUTE p5;
EXECUTE p6;
EXECUTE p7;
EXECUTE p8;
EXECUTE p9;
EXECUTE p10;
EXECUTE p11;
EXECUTE p12;
EXECUTE p13;
EXECUTE p14;
EXECUTE p15;
EXECUTE p16;
EXECUTE p17;
EXECUTE p18;
EXECUTE p19;
EXECUTE p20;
EXECUTE p21;
EXECUTE p22;
EXECUTE p23;
EXECUTE p24;
EXECUTE p25;
EXECUTE p26;
EXECUTE p27;
EXECUTE p28;
EXECUTE p29;
EXECUTE p30;
EXECUTE p31;
EXECUTE p32;
EXECUTE p33;
EXECUTE p34;
EXECUTE p35;
EXECUTE p36;
EXECUTE p37;
EXECUTE p38;
EXECUTE p39;
EXECUTE p40;
EXECUTE p41;
EXECUTE p42;
EXECUTE p43;
EXECUTE p44;
EXECUTE p45;
EXECUTE p46;
EXECUTE p47;
EXECUTE p48;
EXECUTE p49;
EXECUTE p50;
EXECUTE p51;
EXECUTE p52;
EXECUTE p53;
EXECUTE p54;
EXECUTE p55;
EXECUTE p56;
EXECUTE p57;
EXECUTE p58;
EXECUTE p59;
EXECUTE p60;
EXECUTE p61;
EXECUTE p62;
EXECUTE p63;
EXECUTE p64;
connection slave;
connection master;
==== Results ====
SELECT * FROM tstmt ORDER BY id;
id truth num text
1 1 NULL NULL
2 0 NULL NULL
3 NULL 2000000 NULL
4 NULL 3000000 NULL
5 NULL NULL SELECT 2
6 NULL NULL SELECT 3
7 NULL NULL IDEMPOTENT
8 NULL NULL STRICT
9 1 NULL NULL
10 0 NULL NULL
11 NULL 20 NULL
12 NULL 30 NULL
13 1 NULL NULL
14 0 NULL NULL
15 0 NULL NULL
16 1 NULL NULL
17 NULL 3 NULL
18 NULL 4 NULL
19 NULL 5 NULL
20 NULL 6 NULL
21 NULL NULL sv_SE
22 NULL NULL sv_FI
23 NULL NULL ar_TN
24 NULL NULL ar_IQ
25 NULL NULL
26 NULL NULL IGNORE_SPACE,NO_AUTO_CREATE_USER
27 NULL NULL NO_DIR_IN_CREATE,NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,NO_ENGINE_SUBSTITUTION
28 NULL NULL NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS
29 NULL 20 NULL
30 NULL 30 NULL
31 NULL NULL Bergsbrunna
32 NULL NULL Centrum
connection slave;
include/diff_tables.inc [master:tstmt, master:tproc, master:tfunc, master:ttrig, master:tprep, slave:tstmt, slave:tproc, slave:tfunc, slave:ttrig, slave:tprep]
==== Clean up ====
connection master;
DROP PROCEDURE proc;
DROP FUNCTION func;
DROP TRIGGER trig;
DROP TABLE tstmt, tproc, tfunc, ttrig, tprep, trigger_table;
SET @@global.default_week_format= @m_default_week_format;
SET @@global.init_slave= @m_init_slave;
SET @@global.lc_time_names= @m_lc_time_names;
SET @@global.low_priority_updates= @m_low_priority_updates;
SET @@global.relay_log_purge= @m_relay_log_purge;
SET @@global.slave_exec_mode= @m_slave_exec_mode;
SET @@global.sql_mode= @m_sql_mode;
SET @@global.sync_binlog= @m_sync_binlog;
connection slave;
SET @@global.default_week_format= @s_default_week_format;
SET @@global.init_slave= @s_init_slave;
SET @@global.lc_time_names= @s_lc_time_names;
SET @@global.low_priority_updates= @s_low_priority_updates;
SET @@global.relay_log_purge= @s_relay_log_purge;
SET @@global.slave_exec_mode= @s_slave_exec_mode;
SET @@global.sql_mode= @s_sql_mode;
SET @@global.sync_binlog= @s_sync_binlog;
connection master;
connection slave;
include/rpl_end.inc
|