1
# Copyright (C) 2008-2009 Sun Microsystems, Inc. All rights reserved.
2
# Use is subject to license terms.
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; version 2 of the License.
8
# This program is distributed in the hope that it will be useful, but
9
# WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
# General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
19
# This test performs zero-sum queries, that is, queries after which the average value of all integers in the table remains the same.
20
# Some queries move values within a single row, others between rows and some insert new values or delete existing ones.
22
# The values in the first 10 rows are updated so that values from one row may move into another row. This makes those rows unsuitable for random
23
# insertions and deletions.
25
# Rows beyond the 10th are just inserted and delted randomly because each row in that part of the table is self-contained
29
SET AUTOCOMMIT=OFF ; START TRANSACTION ;
32
update_all1 | update_multi1 | update_one1 | update_between1 | insert_one1 | insert_multi1 | insert_select1 | replace1 | delete_one1 | delete_multi1 ;
35
START TRANSACTION ; update_all ; commit_rollback ;
38
START TRANSACTION ; update_multi ; commit_rollback ;
41
START TRANSACTION ; update_one ; commit_rollback ;
44
START TRANSACTION ; update_between ; commit_rollback ;
45
# START TRANSACTION ; update_two ; commit_rollback | # Not fully consistent
46
# START TRANSACTION ; update_limit ; commit_rollback | # Broken in Falcon
49
START TRANSACTION ; update_in ; commit_rollback ;
52
START TRANSACTION ; insert_one ; commit_rollback ;
55
START TRANSACTION ; insert_multi ; commit_rollback ;
58
START TRANSACTION ; insert_select ; commit_rollback ;
61
START TRANSACTION ; insert_delete ; commit_rollback ;
63
# START TRANSACTION ; insert_update ; commit_rollback | # Not fully consistent
66
START TRANSACTION ; replace ; commit_rollback ;
69
START TRANSACTION ; delete_one ; commit_rollback ;
72
START TRANSACTION ; delete_multi ; commit_rollback ;
77
ROLLBACK TO SAVEPOINT A |
82
UPDATE _table SET update_both ;
85
UPDATE _table SET update_both WHERE key_nokey_pk > _digit ;
88
UPDATE _table SET update_both WHERE `pk` = value ;
91
SET @var = half_digit ; UPDATE _table SET update_both WHERE `pk` >= @var AND `pk` <= @var + 1 |
92
SET @var = half_digit ; UPDATE _table SET update_both WHERE `pk` BETWEEN @var AND @var + 1 ;
95
UPDATE _table SET `col_int_key` = `col_int_key` - 10 WHERE `pk` = small ; UPDATE _table SET `col_int_key` = `col_int_key` + 10 WHERE `pk` = big ;
98
UPDATE _table SET update_one_half + IF(`pk` % 2 = 1 , 20, -20) WHERE `pk` >= half_digit ORDER BY `pk` ASC LIMIT 2 ;
101
UPDATE _table SET update_one_half + IF(`pk` % 2 = 1 , 30, -30) WHERE `pk` IN ( even_odd ) ;
104
INSERT INTO _table ( `pk` , `col_int_key` , `col_int`) VALUES ( NULL , 100 , 100 ) |
105
INSERT INTO _table ( `pk` ) VALUES ( NULL ) ; ROLLBACK ;
108
INSERT INTO _table ( `pk` , `col_int_key` , `col_int`) VALUES ( NULL , 100 , 100 ) , ( NULL , 100 , 100 ) |
109
INSERT INTO _table ( `pk` ) VALUES ( NULL ) , ( NULL ) , ( NULL ) ; ROLLBACK ;
112
INSERT INTO _table ( `col_int_key` , `col_int` ) SELECT `col_int` , `col_int_key` FROM _table WHERE `pk` > 10 LIMIT _digit ;
115
INSERT INTO _table ( `pk` , `col_int_key` , `col_int` ) VALUES ( NULL , 50 , 60 ) ; DELETE FROM _table WHERE `pk` = @@LAST_INSERT_ID ;
118
INSERT INTO _table ( `pk` , `col_int_key` , `col_int` ) VALUES ( NULL, 170 , 180 ) ; UPDATE _table SET `col_int_key` = `col_int_key` - 80 , `col_int` = `col_int` - 70 WHERE `pk` = _digit ;
121
REPLACE INTO _table ( `pk` , `col_int_key` , `col_int` ) VALUES ( NULL, 100 , 100 ) |
122
REPLACE INTO _table ( `pk` ) VALUES ( _digit ) ; ROLLBACK ;
125
DELETE FROM _table WHERE `pk` = _tinyint_unsigned AND `pk` > 10;
128
DELETE FROM _table WHERE `pk` > _tinyint_unsigned AND `pk` > 10 LIMIT _digit ;
131
`col_int_key` = `col_int_key` - 20, `col_int` = `col_int` + 20 |
132
`col_int` = `col_int` + 30, `col_int_key` = `col_int_key` - 30 ;
135
`col_int_key` = `col_int_key` |
136
`col_int` = `col_int` ;
139
`col_int_key` | `col_int` | `pk` ;
145
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 ;
148
odd , even | even , odd ;
163
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 ;