~stewart/drizzle/embedded-innodb-create-select-transaction-arrgh

« back to all changes in this revision

Viewing changes to mysql-test/suite/parts/inc/partition_trigg2.inc

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
################################################################################
 
2
# inc/partition_trigg2.inc                                                     #
 
3
#                                                                              #
 
4
# Purpose:                                                                     #
 
5
#   Auxiliary script, only useful when sourced by inc/partition_check.inc.     #
 
6
#   The trigger uses new values (--> event UPDATE, INSERT only)                #
 
7
#                                                                              #
 
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                                                  #
 
12
#                                                                              #
 
13
#------------------------------------------------------------------------------#
 
14
# Original Author: mleich                                                      #
 
15
# Original Date: 2006-03-05                                                    #
 
16
# Change Author:                                                               #
 
17
# Change Date:                                                                 #
 
18
# Change:                                                                      #
 
19
################################################################################
 
20
 
 
21
delimiter |;
 
22
eval CREATE TRIGGER trg_2 $event ON t1 FOR EACH ROW
 
23
BEGIN
 
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####';
 
27
END|
 
28
delimiter ;|
 
29
eval $statement;
 
30
#      Check of preceding statement via Select
 
31
if ($no_debug)
 
32
{
 
33
  --disable_query_log
 
34
}
 
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####';
 
39
--enable_query_log
 
40
DROP TRIGGER trg_2;
 
41
# Revert the changes
 
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,'===');
 
45
inc $num;