'#--------------------FN_DYNVARS_046_01-------------------------#'
SET @@global.innodb_support_xa = OFF;
'connect (con1,localhost,root,,,,)'
'connection con1'
SELECT @@global.innodb_support_xa;
@@global.innodb_support_xa
0
SELECT @@session.innodb_support_xa;
@@session.innodb_support_xa
0
'#--------------------FN_DYNVARS_046_01-------------------------#'
'connection default'
SET @@global.innodb_support_xa = 1;
drop table if exists t1, t2;
create table t1 (a int) engine=innodb;
'---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;
a
'---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;
a
'------general xa testing--------'
SET @@global.innodb_support_xa = 1;
SET @@innodb_support_xa = 1;
xa start 'testa','testb';
INSERT t1 values (30);
COMMIT;
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the  ACTIVE state
xa end 'testa','testb';
BEGIN;
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the  IDLE state
CREATE table t2 (a int);
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the  IDLE state
'connect (con1,localhost,root,,,,)'
'connection con1'
xa start 'testa','testb';
ERROR XAE08: XAER_DUPID: The XID already exists
xa start 'testa','testb', 123;
ERROR XAE08: XAER_DUPID: The XID already exists
xa start 0x7465737462, 0x2030405060, 0xb;
INSERT t1 values (40);
xa end 'testb',' 0@P`',11;
xa prepare 'testb',0x2030405060,11;
START TRANSACTION;
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the  PREPARED state
xa recover;
formatID	gtrid_length	bqual_length	data
11	5	5	testb 0@P`
'connection default'
xa prepare 'testa','testb';
xa recover;
formatID	gtrid_length	bqual_length	data
11	5	5	testb 0@P`
1	5	5	testatestb
xa commit 'testb',0x2030405060,11;
ERROR XAE04: XAER_NOTA: Unknown XID
xa commit 'testa','testb';
'connection con1'
xa rollback 'testb',0x2030405060,11;
SELECT * from t1;
a
30
DROP table t1;
