"Fossies" - the Fresh Open Source Software Archive

Member "drizzle-7.1.36-stable/tests/suite/regression/t/682563.test" (6 May 2012, 3632 Bytes) of package /linux/misc/old/drizzle-7.1.36-stable.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 connect (a,localhost,root,,);
    2 connect (b,localhost,root,,);
    3 
    4 connection a;
    5 --echo A
    6 CREATE TABLE t1 (a int);
    7 SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
    8 BEGIN;
    9 INSERT INTO t1 values (1);
   10 
   11 connection b;
   12 --echo B
   13 SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
   14 BEGIN;
   15 SELECT * from t1;
   16 
   17 connection a;
   18 --echo A
   19 INSERT INTO t1 values (2);
   20 
   21 connection b;
   22 --echo B
   23 SELECT * from t1;
   24 COMMIT;
   25 BEGIN;
   26 SELECT * FROM t1;
   27 
   28 connection a;
   29 --echo A
   30 COMMIT;
   31 
   32 connection b;
   33 --echo B
   34 SELECT * from t1 order by a;
   35 COMMIT;
   36 BEGIN;
   37 SELECT * from t1 order by a;
   38 
   39 COMMIT;
   40 DROP TABLE t1;
   41 
   42 disconnect a;
   43 disconnect b;
   44 connection default;
   45 # This is a test of various SQL statements
   46 # and looks at the statement and transaction
   47 # boundaries (start/end) to ensure they are sane
   48 
   49 SET AUTOCOMMIT= 0;
   50 
   51 # Expect 0 commit count since nothing 
   52 # has yet happened...
   53 
   54 SHOW STATUS LIKE 'Handler_commit%';
   55 
   56 BEGIN;
   57 
   58 # Expect 0 commit count since nothing 
   59 # has yet been committed...
   60 
   61 SHOW STATUS LIKE 'Handler_commit%';
   62 
   63 COMMIT;
   64 DROP SCHEMA IF EXISTS boundaries;
   65 
   66 # Expect 1 commit count since above DROP SCHEMA
   67 # will implicitly call COMMIT.
   68 #
   69 # When we get transactional DDL, should be 0.
   70 SHOW STATUS LIKE 'Handler_commit%';
   71 
   72 COMMIT;
   73 
   74 # Expect 1 commit count since 
   75 # an explicit call to COMMIT was made
   76 # even though nothing was changed...
   77 
   78 SHOW STATUS LIKE 'Handler_commit%';
   79 
   80 
   81 ## Enable AUOTOCOMMIT
   82 #
   83 SET AUTOCOMMIT= 1;
   84 
   85 SHOW STATUS LIKE 'Handler_commit%';
   86 BEGIN;
   87 COMMIT;
   88 DROP SCHEMA IF EXISTS boundaries;
   89 
   90 SHOW STATUS LIKE 'Handler_commit%';
   91 CREATE TABLE commit_test (a int);
   92 SHOW STATUS LIKE 'Handler_commit%';
   93 INSERT into commit_test VALUES (10);
   94 SHOW STATUS LIKE 'Handler_commit%';
   95 INSERT into commit_test VALUES (10), (20);
   96 SHOW STATUS LIKE 'Handler_commit%';
   97 INSERT into commit_test VALUES (10);
   98 SHOW STATUS LIKE 'Handler_commit%';
   99 
  100 BEGIN;
  101 
  102 INSERT into commit_test VALUES (10);
  103 SHOW STATUS LIKE 'Handler_commit%';
  104 
  105 COMMIT;
  106 
  107 SHOW STATUS LIKE 'Handler_commit%';
  108 BEGIN;
  109 
  110 INSERT into commit_test VALUES (10);
  111 SHOW STATUS LIKE 'Handler_commit%';
  112 
  113 ROLLBACK;
  114 
  115 SHOW STATUS LIKE 'Handler_commit%';
  116 BEGIN;
  117 
  118 
  119 INSERT into commit_test VALUES (10);
  120 SHOW STATUS LIKE 'Handler_commit%';
  121 
  122 COMMIT;
  123 SHOW STATUS LIKE 'Handler_commit%';
  124 
  125 SET AUTOCOMMIT= 0;
  126 INSERT into commit_test VALUES (10);
  127 INSERT into commit_test VALUES (10);
  128 
  129 
  130 SHOW STATUS LIKE 'Handler_commit%';
  131 COMMIT;
  132 drop table commit_test;
  133 SHOW STATUS LIKE 'Handler_commit%';
  134 # Tests a number of things related to transactions:
  135 # 
  136 # 1. Interaction of more than one engine in a transaction
  137 # 2. Correct commit and rollback behaviour
  138 # 3. XA protocol communication and recovery
  139 
  140 --disable_warnings
  141 DROP TABLE IF EXISTS t1_trx, t1_non_trx;
  142 --enable_warnings
  143 
  144 SET AUTOCOMMIT= 0;
  145 
  146 CREATE TABLE t1_trx (
  147   k VARCHAR(10) NOT NULL
  148 , v VARCHAR(10) NOT NULL
  149 , PRIMARY KEY (k)
  150 ) ENGINE=InnoDB;
  151 
  152 CREATE TEMPORARY TABLE t1_non_trx (
  153   k VARCHAR(10) NOT NULL
  154 , v VARCHAR(10) NOT NULL
  155 , PRIMARY KEY (k)
  156 ) ENGINE=MyISAM;
  157 
  158 START TRANSACTION;
  159 
  160 INSERT INTO t1_trx VALUES ('key1','value1');
  161 INSERT INTO t1_trx VALUES ('key2','value2');
  162 
  163 INSERT INTO t1_non_trx VALUES ('key1','value1');
  164 INSERT INTO t1_non_trx VALUES ('key2','value2');
  165 
  166 ROLLBACK;
  167 
  168 --echo Expected warning about non-trx data changes not being rolled back
  169 
  170 SELECT * FROM t1_trx;
  171 SELECT * FROM t1_non_trx;
  172 
  173 START TRANSACTION;
  174 
  175 INSERT INTO t1_trx VALUES ('key1','value1');
  176 INSERT INTO t1_trx VALUES ('key2','value2');
  177 
  178 SELECT t1_trx.k, t1_trx.v
  179 FROM t1_trx
  180 INNER JOIN t1_non_trx ON t1_trx.k = t1_non_trx.k;
  181 
  182 ROLLBACK;
  183 
  184 SELECT t1_trx.k, t1_trx.v
  185 FROM t1_trx
  186 INNER JOIN t1_non_trx ON t1_trx.k = t1_non_trx.k;
  187 
  188 COMMIT;
  189 DROP TABLE t1_trx;
  190 DROP TABLE t1_non_trx;