mariadb/mysql-test/t/innodb_support_xa_func.test
2008-04-10 15:14:28 +02:00

138 lines
4.5 KiB
Text

################# mysql-test\t\innodb_support_xa_func.test ###################
# #
# Variable Name: innodb_support_xa #
# Scope: GLOBAL | SESSION #
# Access Type: Dynamic #
# Data Type: boolean #
# Default Value: 1 #
# Range: 0,1 #
# #
# #
# Creation Date: 2008-03-08 #
# Author: Rizwan #
# #
# Description: Test Cases of Dynamic System Variable innodb_support_xa #
# that checks the behavior of this variable in the following ways#
# #
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
# server-system-variables.html #
# #
###############################################################################
--source include/have_innodb.inc
--echo '#--------------------FN_DYNVARS_046_01-------------------------#'
####################################################################
# Check if setting innodb_support_xa is changed in new connection #
####################################################################
SET @@global.innodb_support_xa = OFF;
--echo 'connect (con1,localhost,root,,,,)'
connect (con1,localhost,root,,,,);
--echo 'connection con1'
connection con1;
SELECT @@global.innodb_support_xa;
SELECT @@session.innodb_support_xa;
disconnect con1;
--echo '#--------------------FN_DYNVARS_046_01-------------------------#'
###########################################################
# Begin the functionality Testing of innodb_support_xa #
###########################################################
--echo 'connection default'
connection default;
SET @@global.innodb_support_xa = 1;
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
create table t1 (a int) engine=innodb;
#====================================================
--echo '---check when innodb_support_xa is 1---'
#====================================================
SET @@innodb_support_xa = 1;
xa start 'test1';
INSERT t1 values (10);
xa end 'test1';
xa prepare 'test1';
xa rollback 'test1';
SELECT * from t1;
#====================================================
--echo '---check when innodb_support_xa is 0---'
#====================================================
SET @@innodb_support_xa = 0;
#
xa start 'test1';
INSERT t1 values (10);
xa end 'test1';
xa prepare 'test1';
xa rollback 'test1';
SELECT * from t1;
#====================================================
--echo '------general xa testing--------'
#====================================================
SET @@global.innodb_support_xa = 1;
SET @@innodb_support_xa = 1;
xa start 'testa','testb';
INSERT t1 values (30);
--Error ER_XAER_RMFAIL
COMMIT;
xa end 'testa','testb';
--Error ER_XAER_RMFAIL
BEGIN;
--Error ER_XAER_RMFAIL
CREATE table t2 (a int);
--echo 'connect (con1,localhost,root,,,,)'
CONNECT (con1,localhost,root,,,,);
--echo 'connection con1'
connection con1;
--Error ER_XAER_DUPID
xa start 'testa','testb';
--Error ER_XAER_DUPID
xa start 'testa','testb', 123;
# gtrid [ , bqual [ , formatID ] ]
xa start 0x7465737462, 0x2030405060, 0xb;
INSERT t1 values (40);
xa end 'testb',' 0@P`',11;
xa prepare 'testb',0x2030405060,11;
--Error ER_XAER_RMFAIL
START TRANSACTION;
xa recover;
# uncomment the line below when binlog will be able to prepare
#disconnect con1;
--echo 'connection default'
CONNECTION default;
xa prepare 'testa','testb';
xa recover;
--Error ER_XAER_NOTA
xa commit 'testb',0x2030405060,11;
xa commit 'testa','testb';
--echo 'connection con1'
CONNECTION con1;
xa rollback 'testb',0x2030405060,11;
SELECT * from t1;
DROP table t1;
########################################################
# End of functionality Testing for innodb_support_xa #
########################################################