~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to conf/transactions.yy

initial import from internal tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# This test performs zero-sum queries, that is, queries after which the average value of all integers in the table remains the same.
 
3
# Some queries move values within a single row, others between rows and some insert new values or delete existing ones.
 
4
#
 
5
# 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
 
6
# insertions and deletions.
 
7
#
 
8
# Rows beyond the 10th are just inserted and delted randomly because each row in that part of the table is self-contained
 
9
#
 
10
 
 
11
query_init:
 
12
        SET AUTOCOMMIT=OFF ; START TRANSACTION ;
 
13
 
 
14
query:
 
15
        START TRANSACTION ; body ; commit_rollback ;
 
16
 
 
17
body:
 
18
        update_all |
 
19
        update_multi |
 
20
        update_one |
 
21
        update_between |
 
22
#       update_two |    # Not fully consistent
 
23
        update_limit |  # Broken in Falcon
 
24
        update_in |
 
25
        insert_one |    # Broken with Falcon
 
26
        insert_multi |  # Broken with Falcon
 
27
        insert_select | # Broken with Falcon
 
28
        insert_delete | # Broken with Falcon
 
29
#       insert_update | # Not fully consistent
 
30
        replace |       # Broken in Falcon
 
31
        delete_one | 
 
32
        delete_multi 
 
33
;
 
34
 
 
35
commit_rollback:
 
36
        COMMIT |
 
37
        SAVEPOINT A |
 
38
        ROLLBACK TO SAVEPOINT A |
 
39
        ROLLBACK
 
40
;
 
41
 
 
42
update_all:
 
43
        UPDATE _table SET update_both ;
 
44
 
 
45
update_multi:
 
46
        UPDATE _table SET update_both WHERE key_nokey_pk > _digit ;
 
47
 
 
48
update_one:
 
49
        UPDATE _table SET update_both WHERE `pk` = value ;
 
50
 
 
51
update_between:
 
52
        SET @var = half_digit ; UPDATE _table SET update_both WHERE `pk` >= @var AND `pk` <= @var + 1 |
 
53
        SET @var = half_digit ; UPDATE _table SET update_both WHERE `pk` BETWEEN @var AND @var + 1 ;
 
54
        
 
55
update_two:
 
56
        UPDATE _table SET `int_key` = `int_key` - 10 WHERE `pk` = small ; UPDATE _table SET `int_key` = `int_key` + 10 WHERE `pk` = big ;
 
57
 
 
58
update_limit:
 
59
        UPDATE _table SET update_one_half + IF(`pk` % 2 = 1 , 20, -20) WHERE `pk` >= half_digit ORDER BY `pk` ASC LIMIT 2 ;
 
60
 
 
61
update_in:
 
62
        UPDATE _table SET update_one_half  + IF(`pk` % 2 = 1 , 30, -30) WHERE `pk` IN ( even_odd ) ;
 
63
 
 
64
insert_one:
 
65
        INSERT INTO _table ( `pk` , `int_key` , `int`) VALUES ( NULL , 100 , 100 ) |
 
66
        INSERT INTO _table ( `pk` ) VALUES ( NULL ) ; ROLLBACK ;
 
67
 
 
68
insert_multi:
 
69
        INSERT INTO _table ( `pk` , `int_key` , `int`) VALUES ( NULL , 100 , 100 ) , ( NULL , 100 , 100 ) |
 
70
        INSERT INTO _table ( `pk` ) VALUES ( NULL ) , ( NULL ) , ( NULL ) ; ROLLBACK ;
 
71
 
 
72
insert_select:
 
73
        INSERT INTO _table ( `int_key` , `int` ) SELECT `int` , `int_key` FROM _table WHERE `pk` > 10 LIMIT _digit ;
 
74
 
 
75
insert_delete:
 
76
        INSERT INTO _table ( `pk` , `int_key` , `int` ) VALUES ( NULL , 50 , 60 ) ; DELETE FROM _table WHERE `pk` = @@LAST_INSERT_ID ;
 
77
 
 
78
insert_update:
 
79
        INSERT INTO _table ( `pk` , `int_key` , `int` ) VALUES ( NULL, 170 , 180 ) ; UPDATE _table SET `int_key` = `int_key` - 80 , `int` = `int` - 70 WHERE `pk` = _digit ;
 
80
 
 
81
replace:
 
82
        REPLACE INTO _table ( `pk` , `int_key` , `int` ) VALUES ( NULL, 100 , 100 ) |
 
83
        REPLACE INTO _table ( `pk` ) VALUES ( _digit ) ; ROLLBACK ;
 
84
 
 
85
delete_one:
 
86
        DELETE FROM _table WHERE `pk` = _tinyint_unsigned AND `pk` > 10;
 
87
 
 
88
delete_multi:
 
89
        DELETE FROM _table WHERE `pk` > _tinyint_unsigned AND `pk` > 10 LIMIT _digit ;
 
90
 
 
91
update_both:
 
92
        `int_key` = `int_key` - 20, `int` = `int` + 20 |
 
93
        `int` = `int` + 30, `int_key` = `int_key` - 30 ;
 
94
 
 
95
update_one_half:
 
96
        `int_key` = `int_key` |
 
97
        `int` = `int` ;
 
98
 
 
99
key_nokey_pk:
 
100
        `int_key` | `int` | `pk` ;
 
101
 
 
102
value:
 
103
        _digit;
 
104
 
 
105
half_digit:
 
106
        1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 ;
 
107
 
 
108
even_odd:
 
109
        odd , even | even , odd ;
 
110
 
 
111
odd:
 
112
        1 | 3 | 5 | 7 | 9 ;
 
113
 
 
114
even:
 
115
        2 | 4 | 6 | 8 ;
 
116
 
 
117
small:
 
118
        1 | 2 | 3 | 4 ;
 
119
 
 
120
big:
 
121
        5 | 6 | 7 | 8 | 9 ;
 
122
 
 
123
_digit:
 
124
        1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 ;