From 31ff9e9a1077d24287a36a3ff1e9e946e11a6a38 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 11 Jan 2006 17:31:52 +0300 Subject: [PATCH 1/3] A fix for Bug#13944 "libmysqlclient exporting sha1_result function": rename sha1_* to mysql_sha1_* include/sha1.h: rename sha1_* to mysql_sha1_* mysys/sha1.c: rename sha1_* to mysql_sha1_* sql/item_strfunc.cc: rename sha1_* to mysql_sha1_* sql/password.c: rename sha1_* to mysql_sha1_* --- include/sha1.h | 6 +++--- mysys/sha1.c | 16 ++++++++-------- sql/item_strfunc.cc | 8 +++++--- sql/password.c | 46 ++++++++++++++++++++++----------------------- 4 files changed, 39 insertions(+), 37 deletions(-) diff --git a/include/sha1.h b/include/sha1.h index 1c345469d3c..e67acbf96b8 100644 --- a/include/sha1.h +++ b/include/sha1.h @@ -60,8 +60,8 @@ typedef struct SHA1_CONTEXT C_MODE_START -int sha1_reset( SHA1_CONTEXT* ); -int sha1_input( SHA1_CONTEXT*, const uint8 *, unsigned int ); -int sha1_result( SHA1_CONTEXT* , uint8 Message_Digest[SHA1_HASH_SIZE] ); +int mysql_sha1_reset(SHA1_CONTEXT*); +int mysql_sha1_input(SHA1_CONTEXT*, const uint8 *, unsigned int); +int mysql_sha1_result(SHA1_CONTEXT* , uint8 Message_Digest[SHA1_HASH_SIZE]); C_MODE_END diff --git a/mysys/sha1.c b/mysys/sha1.c index d93b4571baf..110d24f8bfc 100644 --- a/mysys/sha1.c +++ b/mysys/sha1.c @@ -69,7 +69,7 @@ static void SHA1ProcessMessageBlock(SHA1_CONTEXT*); Initialize SHA1Context SYNOPSIS - sha1_reset() + mysql_sha1_reset() context [in/out] The context to reset. DESCRIPTION @@ -92,7 +92,7 @@ const uint32 sha_const_key[5]= }; -int sha1_reset(SHA1_CONTEXT *context) +int mysql_sha1_reset(SHA1_CONTEXT *context) { #ifndef DBUG_OFF if (!context) @@ -119,7 +119,7 @@ int sha1_reset(SHA1_CONTEXT *context) Return the 160-bit message digest into the array provided by the caller SYNOPSIS - sha1_result() + mysql_sha1_result() context [in/out] The context to use to calculate the SHA-1 hash. Message_Digest: [out] Where the digest is returned. @@ -132,8 +132,8 @@ int sha1_reset(SHA1_CONTEXT *context) != SHA_SUCCESS sha Error Code. */ -int sha1_result(SHA1_CONTEXT *context, - uint8 Message_Digest[SHA1_HASH_SIZE]) +int mysql_sha1_result(SHA1_CONTEXT *context, + uint8 Message_Digest[SHA1_HASH_SIZE]) { int i; @@ -165,7 +165,7 @@ int sha1_result(SHA1_CONTEXT *context, Accepts an array of octets as the next portion of the message. SYNOPSIS - sha1_input() + mysql_sha1_input() context [in/out] The SHA context to update message_array An array of characters representing the next portion of the message. @@ -176,8 +176,8 @@ int sha1_result(SHA1_CONTEXT *context, != SHA_SUCCESS sha Error Code. */ -int sha1_input(SHA1_CONTEXT *context, const uint8 *message_array, - unsigned length) +int mysql_sha1_input(SHA1_CONTEXT *context, const uint8 *message_array, + unsigned length) { if (!length) return SHA_SUCCESS; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 60cb3348590..04765e18191 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -131,11 +131,13 @@ String *Item_func_sha::val_str(String *str) SHA1_CONTEXT context; /* Context used to generate SHA1 hash */ /* Temporary buffer to store 160bit digest */ uint8 digest[SHA1_HASH_SIZE]; - sha1_reset(&context); /* We do not have to check for error here */ + mysql_sha1_reset(&context); /* We do not have to check for error here */ /* No need to check error as the only case would be too long message */ - sha1_input(&context,(const unsigned char *) sptr->ptr(), sptr->length()); + mysql_sha1_input(&context, + (const unsigned char *) sptr->ptr(), sptr->length()); /* Ensure that memory is free and we got result */ - if (!( str->alloc(SHA1_HASH_SIZE*2) || (sha1_result(&context,digest)))) + if (!( str->alloc(SHA1_HASH_SIZE*2) || + (mysql_sha1_result(&context,digest)))) { sprintf((char *) str->ptr(), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\ diff --git a/sql/password.c b/sql/password.c index 04b3a46bd48..94b9dc440be 100644 --- a/sql/password.c +++ b/sql/password.c @@ -392,15 +392,15 @@ make_scrambled_password(char *to, const char *password) SHA1_CONTEXT sha1_context; uint8 hash_stage2[SHA1_HASH_SIZE]; - sha1_reset(&sha1_context); + mysql_sha1_reset(&sha1_context); /* stage 1: hash password */ - sha1_input(&sha1_context, (uint8 *) password, strlen(password)); - sha1_result(&sha1_context, (uint8 *) to); + mysql_sha1_input(&sha1_context, (uint8 *) password, strlen(password)); + mysql_sha1_result(&sha1_context, (uint8 *) to); /* stage 2: hash stage1 output */ - sha1_reset(&sha1_context); - sha1_input(&sha1_context, (uint8 *) to, SHA1_HASH_SIZE); + mysql_sha1_reset(&sha1_context); + mysql_sha1_input(&sha1_context, (uint8 *) to, SHA1_HASH_SIZE); /* separate buffer is used to pass 'to' in octet2hex */ - sha1_result(&sha1_context, hash_stage2); + mysql_sha1_result(&sha1_context, hash_stage2); /* convert hash_stage2 to hex string */ *to++= PVERSION41_CHAR; octet2hex(to, hash_stage2, SHA1_HASH_SIZE); @@ -431,20 +431,20 @@ scramble(char *to, const char *message, const char *password) uint8 hash_stage1[SHA1_HASH_SIZE]; uint8 hash_stage2[SHA1_HASH_SIZE]; - sha1_reset(&sha1_context); + mysql_sha1_reset(&sha1_context); /* stage 1: hash password */ - sha1_input(&sha1_context, (uint8 *) password, strlen(password)); - sha1_result(&sha1_context, hash_stage1); + mysql_sha1_input(&sha1_context, (uint8 *) password, strlen(password)); + mysql_sha1_result(&sha1_context, hash_stage1); /* stage 2: hash stage 1; note that hash_stage2 is stored in the database */ - sha1_reset(&sha1_context); - sha1_input(&sha1_context, hash_stage1, SHA1_HASH_SIZE); - sha1_result(&sha1_context, hash_stage2); + mysql_sha1_reset(&sha1_context); + mysql_sha1_input(&sha1_context, hash_stage1, SHA1_HASH_SIZE); + mysql_sha1_result(&sha1_context, hash_stage2); /* create crypt string as sha1(message, hash_stage2) */; - sha1_reset(&sha1_context); - sha1_input(&sha1_context, (const uint8 *) message, SCRAMBLE_LENGTH); - sha1_input(&sha1_context, hash_stage2, SHA1_HASH_SIZE); + mysql_sha1_reset(&sha1_context); + mysql_sha1_input(&sha1_context, (const uint8 *) message, SCRAMBLE_LENGTH); + mysql_sha1_input(&sha1_context, hash_stage2, SHA1_HASH_SIZE); /* xor allows 'from' and 'to' overlap: lets take advantage of it */ - sha1_result(&sha1_context, (uint8 *) to); + mysql_sha1_result(&sha1_context, (uint8 *) to); my_crypt(to, (const uchar *) to, hash_stage1, SCRAMBLE_LENGTH); } @@ -477,17 +477,17 @@ check_scramble(const char *scramble, const char *message, uint8 buf[SHA1_HASH_SIZE]; uint8 hash_stage2_reassured[SHA1_HASH_SIZE]; - sha1_reset(&sha1_context); + mysql_sha1_reset(&sha1_context); /* create key to encrypt scramble */ - sha1_input(&sha1_context, (const uint8 *) message, SCRAMBLE_LENGTH); - sha1_input(&sha1_context, hash_stage2, SHA1_HASH_SIZE); - sha1_result(&sha1_context, buf); + mysql_sha1_input(&sha1_context, (const uint8 *) message, SCRAMBLE_LENGTH); + mysql_sha1_input(&sha1_context, hash_stage2, SHA1_HASH_SIZE); + mysql_sha1_result(&sha1_context, buf); /* encrypt scramble */ my_crypt((char *) buf, buf, (const uchar *) scramble, SCRAMBLE_LENGTH); /* now buf supposedly contains hash_stage1: so we can get hash_stage2 */ - sha1_reset(&sha1_context); - sha1_input(&sha1_context, buf, SHA1_HASH_SIZE); - sha1_result(&sha1_context, hash_stage2_reassured); + mysql_sha1_reset(&sha1_context); + mysql_sha1_input(&sha1_context, buf, SHA1_HASH_SIZE); + mysql_sha1_result(&sha1_context, hash_stage2_reassured); return memcmp(hash_stage2, hash_stage2_reassured, SHA1_HASH_SIZE); } From 65bffb0f6dbb2f034c327d68b5bc49cc2125dd61 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 11 Jan 2006 16:18:11 -0600 Subject: [PATCH 2/3] simple Windows compile fixes. include/config-win.h: use the ll and ull postfix codes for create longlong and ulonglong symbols. This allows ULL(a) and LL(a) to be used in more complex macro definitions than the previous definitions. This may work on other compilers but we just tested on Visual 7.1 and 8.0 Also, define HAVE_STRNLEN for all windows platforms. Our own strnlen offers no performance improvements over the CRT version. --- include/config-win.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/include/config-win.h b/include/config-win.h index 53483f3f39d..b2bd63efc30 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -108,11 +108,17 @@ functions */ #undef _REENTRANT /* Crashes something for win32 */ #undef SAFE_MUTEX /* Can't be used on windows */ -#define LONGLONG_MIN ((__int64) 0x8000000000000000) -#define LONGLONG_MAX ((__int64) 0x7FFFFFFFFFFFFFFF) -#define ULONGLONG_MAX ((unsigned __int64) 0xFFFFFFFFFFFFFFFF) -#define LL(A) ((__int64) A) -#define ULL(A) ((unsigned __int64) A) +#if defined(_MSC_VER) && _MSC_VER >= 1310 +#define LL(A) A##ll +#define ULL(A) A##ull +#else +#define LL(A) ((__int64) A) +#define ULL(A) ((unsigned __int64) A) +#endif + +#define LONGLONG_MIN LL(0x8000000000000000) +#define LONGLONG_MAX LL(0x7FFFFFFFFFFFFFFF) +#define ULONGLONG_MAX ULL(0xFFFFFFFFFFFFFFFF) /* Type information */ @@ -333,11 +339,7 @@ inline double ulonglong2double(ulonglong value) #define SPRINTF_RETURNS_INT #define HAVE_SETFILEPOINTER #define HAVE_VIO_READ_BUFF - -#if defined(_WIN64) && defined(_M_X64) -/* Avoid type conflicts with built-in functions. */ #define HAVE_STRNLEN -#endif #ifndef __NT__ #undef FILE_SHARE_DELETE From f315b0b8a74edac5acd369c4024e82b4c26a098f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 12 Jan 2006 03:02:52 +0300 Subject: [PATCH 3/3] Fix for BUG#15103: SHOW TRIGGERS: small output alignment problem. mysql-test/r/information_schema.result: Remove extra spaces from result file. mysql-test/r/mysqldump.result: Remove extra spaces from result file. mysql-test/r/rpl_ddl.result: Remove extra spaces from result file. mysql-test/r/trigger-compat.result: Remove extra spaces from result file. mysql-test/r/trigger-grant.result: Remove extra spaces from result file. mysql-test/r/trigger.result: Remove extra spaces from result file. sql/sql_yacc.yy: Remove leading spaces. --- mysql-test/r/information_schema.result | 18 ++++++---------- mysql-test/r/mysqldump.result | 30 ++++++++++---------------- mysql-test/r/rpl_ddl.result | 4 ++-- mysql-test/r/trigger-compat.result | 6 ++---- mysql-test/r/trigger-grant.result | 21 ++++++------------ mysql-test/r/trigger.result | 4 ++-- sql/sql_yacc.yy | 2 ++ 7 files changed, 32 insertions(+), 53 deletions(-) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 05f2118a8c7..e7d82f48691 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -816,40 +816,34 @@ end if; end| show triggers; Trigger Event Table Statement Timing Created sql_mode Definer -trg1 INSERT t1 -begin +trg1 INSERT t1 begin if new.j > 10 then set new.j := 10; end if; end BEFORE NULL root@localhost -trg2 UPDATE t1 -begin +trg2 UPDATE t1 begin if old.i % 2 = 0 then set new.j := -1; end if; end BEFORE NULL root@localhost -trg3 UPDATE t1 -begin +trg3 UPDATE t1 begin if new.j = -1 then set @fired:= "Yes"; end if; end AFTER NULL root@localhost select * from information_schema.triggers; TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER -NULL test trg1 INSERT NULL test t1 0 NULL -begin +NULL test trg1 INSERT NULL test t1 0 NULL begin if new.j > 10 then set new.j := 10; end if; end ROW BEFORE NULL NULL OLD NEW NULL root@localhost -NULL test trg2 UPDATE NULL test t1 0 NULL -begin +NULL test trg2 UPDATE NULL test t1 0 NULL begin if old.i % 2 = 0 then set new.j := -1; end if; end ROW BEFORE NULL NULL OLD NEW NULL root@localhost -NULL test trg3 UPDATE NULL test t1 0 NULL -begin +NULL test trg3 UPDATE NULL test t1 0 NULL begin if new.j = -1 then set @fired:= "Yes"; end if; diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 4e2564c69da..717d9f67774 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -1937,18 +1937,16 @@ end| set sql_mode=default| show triggers like "t1"; Trigger Event Table Statement Timing Created sql_mode Definer -trg1 INSERT t1 -begin +trg1 INSERT t1 begin if new.a > 10 then set new.a := 10; set new.a := 11; end if; end BEFORE 0000-00-00 00:00:00 root@localhost -trg2 UPDATE t1 begin +trg2 UPDATE t1 begin if old.a % 2 = 0 then set new.b := 12; end if; end BEFORE 0000-00-00 00:00:00 root@localhost -trg3 UPDATE t1 -begin +trg3 UPDATE t1 begin if new.a = -1 then set @fired:= "Yes"; end if; @@ -1986,8 +1984,7 @@ UNLOCK TABLES; /*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/; DELIMITER ;; /*!50003 SET SESSION SQL_MODE="" */;; -/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg1` BEFORE INSERT ON `t1` FOR EACH ROW -begin +/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg1` BEFORE INSERT ON `t1` FOR EACH ROW begin if new.a > 10 then set new.a := 10; set new.a := 11; @@ -2000,8 +1997,7 @@ if old.a % 2 = 0 then set new.b := 12; end if; end */;; /*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */;; -/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg3` AFTER UPDATE ON `t1` FOR EACH ROW -begin +/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg3` AFTER UPDATE ON `t1` FOR EACH ROW begin if new.a = -1 then set @fired:= "Yes"; end if; @@ -2023,8 +2019,7 @@ UNLOCK TABLES; /*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/; DELIMITER ;; /*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */;; -/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg4` BEFORE INSERT ON `t2` FOR EACH ROW -begin +/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg4` BEFORE INSERT ON `t2` FOR EACH ROW begin if new.a > 10 then set @fired:= "No"; end if; @@ -2096,24 +2091,21 @@ t1 t2 show triggers; Trigger Event Table Statement Timing Created sql_mode Definer -trg1 INSERT t1 -begin +trg1 INSERT t1 begin if new.a > 10 then set new.a := 10; set new.a := 11; end if; end BEFORE # root@localhost -trg2 UPDATE t1 begin +trg2 UPDATE t1 begin if old.a % 2 = 0 then set new.b := 12; end if; end BEFORE # root@localhost -trg3 UPDATE t1 -begin +trg3 UPDATE t1 begin if new.a = -1 then set @fired:= "Yes"; end if; end AFTER # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER root@localhost -trg4 INSERT t2 -begin +trg4 INSERT t2 begin if new.a > 10 then set @fired:= "No"; end if; @@ -2141,7 +2133,7 @@ a2 1 SHOW TRIGGERS; Trigger Event Table Statement Timing Created sql_mode Definer -testref INSERT test1 BEGIN +testref INSERT test1 BEGIN INSERT INTO test2 SET a2 = NEW.a1; END BEFORE NULL root@localhost SELECT * FROM `test1`; a1 diff --git a/mysql-test/r/rpl_ddl.result b/mysql-test/r/rpl_ddl.result index 4d8f2f11d4a..c56c9f20cf8 100644 --- a/mysql-test/r/rpl_ddl.result +++ b/mysql-test/r/rpl_ddl.result @@ -1466,12 +1466,12 @@ flush logs; -------- switch to master ------- SHOW TRIGGERS; Trigger Event Table Statement Timing Created sql_mode Definer -trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost +trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost -------- switch to slave ------- SHOW TRIGGERS; Trigger Event Table Statement Timing Created sql_mode Definer -trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost +trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost ######## DROP TRIGGER trg1 ######## diff --git a/mysql-test/r/trigger-compat.result b/mysql-test/r/trigger-compat.result index 5c104a2d2d5..7721a55449b 100644 --- a/mysql-test/r/trigger-compat.result +++ b/mysql-test/r/trigger-compat.result @@ -34,7 +34,5 @@ Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'wl2818_trg1'. The SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name; TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER -NULL mysqltest_db1 wl2818_trg1 INSERT NULL mysqltest_db1 t1 0 NULL -INSERT INTO t2 VALUES(CURRENT_USER()) ROW BEFORE NULL NULL OLD NEW NULL -NULL mysqltest_db1 wl2818_trg2 INSERT NULL mysqltest_db1 t1 0 NULL -INSERT INTO t2 VALUES(CURRENT_USER()) ROW AFTER NULL NULL OLD NEW NULL mysqltest_dfn@localhost +NULL mysqltest_db1 wl2818_trg1 INSERT NULL mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW BEFORE NULL NULL OLD NEW NULL +NULL mysqltest_db1 wl2818_trg2 INSERT NULL mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW AFTER NULL NULL OLD NEW NULL mysqltest_dfn@localhost diff --git a/mysql-test/r/trigger-grant.result b/mysql-test/r/trigger-grant.result index eda1adfdf65..858cab7a04a 100644 --- a/mysql-test/r/trigger-grant.result +++ b/mysql-test/r/trigger-grant.result @@ -185,10 +185,8 @@ INSERT INTO t1 VALUES(6); ERROR 42000: Access denied; you need the SUPER privilege for this operation SHOW TRIGGERS; Trigger Event Table Statement Timing Created sql_mode Definer -trg1 INSERT t1 -SET @new_sum = 0 BEFORE NULL mysqltest_inv@localhost -trg2 INSERT t1 -SET @new_sum = 0 AFTER NULL mysqltest_nonexs@localhost +trg1 INSERT t1 SET @new_sum = 0 BEFORE NULL mysqltest_inv@localhost +trg2 INSERT t1 SET @new_sum = 0 AFTER NULL mysqltest_nonexs@localhost DROP TRIGGER trg1; DROP TRIGGER trg2; CREATE TRIGGER trg1 BEFORE INSERT ON t1 @@ -219,16 +217,11 @@ Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'trg1'. The trigge SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name; TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER -NULL mysqltest_db1 trg1 INSERT NULL mysqltest_db1 t1 0 NULL -SET @a = 1 ROW BEFORE NULL NULL OLD NEW NULL -NULL mysqltest_db1 trg2 INSERT NULL mysqltest_db1 t1 0 NULL -SET @a = 2 ROW AFTER NULL NULL OLD NEW NULL @ -NULL mysqltest_db1 trg3 UPDATE NULL mysqltest_db1 t1 0 NULL -SET @a = 3 ROW BEFORE NULL NULL OLD NEW NULL @abc@def@@ -NULL mysqltest_db1 trg4 UPDATE NULL mysqltest_db1 t1 0 NULL -SET @a = 4 ROW AFTER NULL NULL OLD NEW NULL @hostname -NULL mysqltest_db1 trg5 DELETE NULL mysqltest_db1 t1 0 NULL -SET @a = 5 ROW BEFORE NULL NULL OLD NEW NULL @abcdef@@@hostname +NULL mysqltest_db1 trg1 INSERT NULL mysqltest_db1 t1 0 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW NULL +NULL mysqltest_db1 trg2 INSERT NULL mysqltest_db1 t1 0 NULL SET @a = 2 ROW AFTER NULL NULL OLD NEW NULL @ +NULL mysqltest_db1 trg3 UPDATE NULL mysqltest_db1 t1 0 NULL SET @a = 3 ROW BEFORE NULL NULL OLD NEW NULL @abc@def@@ +NULL mysqltest_db1 trg4 UPDATE NULL mysqltest_db1 t1 0 NULL SET @a = 4 ROW AFTER NULL NULL OLD NEW NULL @hostname +NULL mysqltest_db1 trg5 DELETE NULL mysqltest_db1 t1 0 NULL SET @a = 5 ROW BEFORE NULL NULL OLD NEW NULL @abcdef@@@hostname ---> connection: default DROP USER mysqltest_dfn@localhost; diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index 38dff6f8ca5..9cfecde7610 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -613,7 +613,7 @@ select @a; show triggers; Trigger Event Table Statement Timing Created sql_mode Definer t1_bi INSERT t1 set new."t1 column" = 5 BEFORE # REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI root@localhost -t1_af INSERT t1 set @a=10 AFTER # root@localhost +t1_af INSERT t1 set @a=10 AFTER # root@localhost drop table t1; set sql_mode="traditional"; create table t1 (a date); @@ -634,7 +634,7 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show triggers; Trigger Event Table Statement Timing Created sql_mode Definer -t1_bi INSERT t1 set new.a = '2004-01-00' BEFORE # root@localhost +t1_bi INSERT t1 set new.a = '2004-01-00' BEFORE # root@localhost drop table t1; create table t1 (id int); create trigger t1_ai after insert on t1 for each row flush tables; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 25e10362ece..ce0cb35dcf8 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -9103,6 +9103,8 @@ trigger_tail: bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics)); lex->sphead->m_chistics= &lex->sp_chistics; lex->sphead->m_body_begin= lex->ptr; + while (my_isspace(system_charset_info, lex->sphead->m_body_begin[0])) + ++lex->sphead->m_body_begin; } sp_proc_stmt {