1 ######## include/ddl5.inc ###### 
    3 # Stress the storage engine with rapid CREATE/DROP TABLE/INDEX 
    4 # and following SELECT/INSERT/SHOW etc. 
    5 # Subtest 5 variants (5A - 5D) 
    8 #     $loop_size -- number of rounds till we look at the clock again 
    9 #     $runtime   -- rough intended runtime per subtest variant 
   10 #     $engine_type -- storage engine to be used in CREATE TABLE 
   11 # must be set within the routine sourcing this script. 
   13 # Other stuff which must already exist: 
   15 # - stmt_start and stmt_break prepared by the default connection 
   17 # Please look for more details within include/ddl1.inc. 
   19 # Creation of this test: 
   23 #---------------------------------------------------------------------- 
   24 # Settings for Subtest 5 variants 
   25 # Scenario: CREATE TABLE with AUTOINC/INSERT/SELECT/DROP TABLE 
   26 let $create_table=   CREATE 
TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = $engine_type;
 
   27 let $insert_into=    INSERT INTO t1 SET f2 = 9;
 
   28 let $select_record=  SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9;
 
   29 let $drop_table=     DROP 
TABLE t1;
 
   30 #---------------------------------------------------------------------- 
   33 --echo # Subtest 5
A (one connection, no PREPARE/EXECUTE)
 
   34 --echo #    connection  action
 
   35 --echo #    
default:    $create_table
 
   36 --echo #    
default:    $insert_into
 
   37 --echo #    
default:    $select_record
 
   38 --echo #    
default:    $drop_table
 
   42 # Determine the current time. 
   44 # Run execution loops till the planned runtime is reached 
   47    let $loop_run= $loop_size;
 
   56          --echo # Error: Unexpected content within t1.
 
   67    if (`EXECUTE stmt_break`)
 
   74 --echo # Subtest 5B (one connection, use PREPARE/EXECUTE)
 
   75 --echo #    connection  action
 
   76 --echo #    
default:    $create_table
 
   77 --echo #    
default:    $insert_into
 
   78 --echo #    
default:    $select_record
 
   79 --echo #    
default:    $drop_table
 
   84 eval PREPARE insert_into FROM 
"$insert_into";
 
   85 eval PREPARE select_record FROM 
"$select_record";
 
   86 eval PREPARE drop_table FROM 
"$drop_table";
 
   89 # Determine the current time. 
   91 # Run execution loops till the planned runtime is reached 
   94    let $loop_run= $loop_size;
 
   99       if (`EXECUTE select_record`)
 
  103          --echo # Error: Unexpected content within t1.
 
  106          EXECUTE select_record;
 
  114    if (`EXECUTE stmt_break`)
 
  120 DEALLOCATE PREPARE insert_into;
 
  121 DEALLOCATE PREPARE select_record;
 
  122 DEALLOCATE PREPARE drop_table;
 
  125 --echo # Subtest 5C (two connections, no PREPARE/EXECUTE)
 
  126 --echo #    connection  action
 
  127 --echo #    
default:    $create_table
 
  128 --echo #    con2:       $insert_into
 
  129 --echo #    
default:    $select_record
 
  130 --echo #    con2:       $drop_table
 
  134 # Determine the current time. 
  136 # Run execution loops till the planned runtime is reached 
  139    let $loop_run= $loop_size;
 
  146       if (`$select_record`)
 
  150          --echo # Error: Unexpected content within t1.
 
  163    if (`EXECUTE stmt_break`)
 
  170 --echo # Subtest 5D (two connections, use PREPARE/EXECUTE)
 
  171 --echo #    connection  action
 
  172 --echo #    
default:    $create_table
 
  173 --echo #    con2:       $insert_into
 
  174 --echo #    
default:    $select_record
 
  175 --echo #    con2:       $drop_table
 
  178 eval PREPARE create_table FROM 
"$create_table";
 
  180 eval PREPARE select_record FROM 
"$select_record";
 
  182 eval PREPARE insert_into FROM 
"$insert_into";
 
  183 eval PREPARE drop_table FROM 
"$drop_table";
 
  187 # Determine the current time. 
  189 # Run execution loops till the planned runtime is reached 
  192    let $loop_run= $loop_size;
 
  199       if (`EXECUTE select_record`)
 
  203          --echo # Error: Unexpected content within t1.
 
  206          EXECUTE select_record;
 
  216    if (`EXECUTE stmt_break`)
 
  222 DEALLOCATE PREPARE select_record;
 
  224 DEALLOCATE PREPARE insert_into;
 
  225 DEALLOCATE PREPARE drop_table;