1 ################################################################################ 
    2 # inc/partition_trigg2.inc                                                     # 
    5 #   Auxiliary script, only useful when sourced by inc/partition_check.inc.     # 
    6 #   The trigger uses new values (--> event UPDATE, INSERT only)                # 
    8 # 1. Create a trigger                                                          # 
    9 # 2. Execute a statement, which activates the trigger                          # 
   10 # 3. Check the results of the trigger activity                                 # 
   11 # 4. Revert the modifications                                                  # 
   13 #------------------------------------------------------------------------------# 
   14 # Original Author: mleich                                                      # 
   15 # Original Date: 2006-03-05                                                    # 
   19 ################################################################################ 
   22 eval CREATE TRIGGER trg_2 $event ON t1 FOR EACH ROW
 
   24    SET 
new.f_int1 = $source.f_int1 + @max_row,
 
   25        new.f_int2 = $source.f_int2 - @max_row,
 
   26        new.f_charbig = 
'####updated per update trigger####';
 
   30 #      Check of preceding statement via Select 
   35 eval SELECT 
'# check trigger-$num success: ' AS 
"", COUNT(*) = 0 AS 
"" FROM t1
 
   36 WHERE f_int1 - CAST(f_char1 AS SIGNED INT) NOT IN (@max_row, 2 * @max_row)
 
   37    OR f_int2 - CAST(f_char1 AS SIGNED INT) NOT IN (-@max_row, - 2 * @max_row)
 
   38    OR f_charbig <> '
####updated per update trigger####'; 
   42 eval UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT),
 
   43               f_int2 = CAST(f_char1 AS SIGNED INT),
 
   44               f_charbig = CONCAT(
'===',f_char1,
'===');