#
# This test performs zero-sum queries, that is, queries after which the average value of all integers in the table remains the same.
# Some queries move values within a single row, others between rows and some insert new values or delete existing ones.
#
# 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
# insertions and deletions.
#
# Rows beyond the 10th are just inserted and delted randomly because each row in that part of the table is self-contained
#

query_init:
	SET AUTOCOMMIT=OFF ; START TRANSACTION ;

query:
	update_one1 | insert_delete1 ;

update_one1:
	START TRANSACTION ; update_one ; commit_rollback ;

insert_delete1:
	START TRANSACTION ; insert_delete ; commit_rollback ;

commit_rollback:
	COMMIT | ROLLBACK ;

update_one:
	UPDATE _table SET update_both WHERE `pk` = value ;

insert_delete:
	INSERT INTO _table ( `pk` , `int_key` , `int` ) VALUES ( NULL , 50 , 60 ) ; DELETE FROM _table WHERE `pk` = @@LAST_INSERT_ID ;

update_both:
	`int_key` = `int_key` - 20, `int` = `int` + 20 |
	`int` = `int` + 30, `int_key` = `int_key` - 30 ;

update_one_half:
	`int_key` = `int_key` |
	`int` = `int` ;

key_nokey_pk:
	`int_key` | `int` | `pk` ;

value:
	_digit;

half_digit:
	1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 ;

even_odd:
	odd , even | even , odd ;

odd:
	1 | 3 | 5 | 7 | 9 ;

even:
	2 | 4 | 6 | 8 ;

small:
	1 | 2 | 3 | 4 ;

big:
	5 | 6 | 7 | 8 | 9 ;

_digit:
	1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 ;
