Merge lp:~vlad-lesin/percona-server/5.5-bug1049871-injections into lp:percona-server/5.5

Proposed by Vlad Lesin
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 384
Proposed branch: lp:~vlad-lesin/percona-server/5.5-bug1049871-injections
Merge into: lp:percona-server/5.5
Diff against target: 3353 lines (+1256/-507)
42 files modified
Percona-Server/client/CMakeLists.txt (+1/-1)
Percona-Server/client/sql_string.cc (+44/-0)
Percona-Server/client/sql_string.h (+10/-0)
Percona-Server/mysql-test/r/func_compress.result (+2/-2)
Percona-Server/mysql-test/r/func_math.result (+4/-4)
Percona-Server/mysql-test/r/mysqlbinlog.result (+16/-16)
Percona-Server/mysql-test/r/mysqlbinlog2.result (+35/-35)
Percona-Server/mysql-test/r/mysqlbinlog_row.result (+1/-1)
Percona-Server/mysql-test/r/mysqlbinlog_row_innodb.result (+4/-4)
Percona-Server/mysql-test/r/mysqlbinlog_row_myisam.result (+4/-4)
Percona-Server/mysql-test/r/mysqlbinlog_row_trans.result (+1/-1)
Percona-Server/mysql-test/r/user_var-binlog.result (+1/-1)
Percona-Server/mysql-test/r/variables.result (+1/-1)
Percona-Server/mysql-test/suite/binlog/r/binlog_base64_flag.result (+1/-1)
Percona-Server/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result (+1/-1)
Percona-Server/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result (+2/-2)
Percona-Server/mysql-test/suite/rpl/r/rpl_mdev382.result (+326/-0)
Percona-Server/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result (+4/-4)
Percona-Server/mysql-test/suite/rpl/r/rpl_sp.result (+6/-6)
Percona-Server/mysql-test/suite/rpl/t/rpl_mdev382.test (+256/-0)
Percona-Server/sql/ha_ndbcluster_binlog.cc (+17/-8)
Percona-Server/sql/item.cc (+17/-1)
Percona-Server/sql/item.h (+1/-0)
Percona-Server/sql/item_func.cc (+3/-3)
Percona-Server/sql/item_func.h (+1/-1)
Percona-Server/sql/log.cc (+6/-6)
Percona-Server/sql/log_event.cc (+258/-204)
Percona-Server/sql/log_event.h (+25/-22)
Percona-Server/sql/log_event_old.cc (+1/-1)
Percona-Server/sql/log_event_old.h (+1/-1)
Percona-Server/sql/sql_base.cc (+24/-13)
Percona-Server/sql/sql_db.cc (+19/-29)
Percona-Server/sql/sql_load.cc (+37/-54)
Percona-Server/sql/sql_repl.cc (+1/-1)
Percona-Server/sql/sql_select.cc (+11/-2)
Percona-Server/sql/sql_show.cc (+6/-37)
Percona-Server/sql/sql_show.h (+1/-1)
Percona-Server/sql/sql_string.cc (+61/-10)
Percona-Server/sql/sql_string.h (+11/-0)
Percona-Server/sql/sql_table.cc (+11/-10)
Percona-Server/sql/sql_truncate.cc (+23/-18)
Percona-Server/sql/sql_yacc.yy (+1/-1)
To merge this branch: bzr merge lp:~vlad-lesin/percona-server/5.5-bug1049871-injections
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Laurynas Biveinis (community) Approve
Review via email: mp+127723@code.launchpad.net

Description of the change

The fix for bug #1049871.

Jenkins build:
http://jenkins.percona.com/view/PS 5.5/job/percona-server-5.5-param/529

The original patch is here:
http://bazaar.launchpad.net/~maria-captains/maria/5.5/revision/3508

The difference between original patch and this one is this patch doesn't
use custom %`s "printf" specifier for identifiers quoting. Using that specifier
leads to compiller warnings/errors. That warnings/errors could be suppressed
with certain compiler options but such approach can lead to runtime errors
in the code that is not checked on valid printf specifiers. Besides that
the original patch contains two quoting functions (one for mysqlsql string
class and one for mysql prinf functions) which leads to necessity to edit
two places if something should be changed in quoting function.

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

This is only a partial review.

   - The commit message for 5.5 should just say "merge|automerge|some
     other merge from 5.1" and describe the differences, if any,
     from the 5.1 version. This way it becomes easier to tell
     merges/new patches apart in the bzr log.
   - #if 0 block in sql_insert.cc
   - Same comments as for 5.1 version, except that formatting issue at
     1177-1178.

review: Needs Fixing
Revision history for this message
Vlad Lesin (vlad-lesin) wrote :

> - The commit message for 5.5 should just say "merge|automerge|some
> other merge from 5.1" and describe the differences, if any,
> from the 5.1 version. This way it becomes easier to tell
> merges/new patches apart in the bzr log.
> - #if 0 block in sql_insert.cc
> - Same comments as for 5.1 version, except that formatting issue at
> 1177-1178.
Done.

Revision history for this message
Vlad Lesin (vlad-lesin) wrote :
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Looks good to me. This is still a partial review, please coordinate with Stewart on how to proceed.

review: Approve
Revision history for this message
Stewart Smith (stewart) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Percona-Server/client/CMakeLists.txt'
--- Percona-Server/client/CMakeLists.txt 2012-02-16 09:48:16 +0000
+++ Percona-Server/client/CMakeLists.txt 2012-10-10 20:41:51 +0000
@@ -57,7 +57,7 @@
57MYSQL_ADD_EXECUTABLE(mysql_plugin mysql_plugin.c)57MYSQL_ADD_EXECUTABLE(mysql_plugin mysql_plugin.c)
58TARGET_LINK_LIBRARIES(mysql_plugin mysqlclient)58TARGET_LINK_LIBRARIES(mysql_plugin mysqlclient)
5959
60MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc)60MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc sql_string.cc)
61TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient)61TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient)
6262
63MYSQL_ADD_EXECUTABLE(mysqladmin mysqladmin.cc)63MYSQL_ADD_EXECUTABLE(mysqladmin mysqladmin.cc)
6464
=== modified file 'Percona-Server/client/sql_string.cc'
--- Percona-Server/client/sql_string.cc 2012-05-10 07:49:14 +0000
+++ Percona-Server/client/sql_string.cc 2012-10-10 20:41:51 +0000
@@ -478,6 +478,50 @@
478 return FALSE;478 return FALSE;
479}479}
480480
481bool String::append_identifier(const char *name,
482 uint length,
483 CHARSET_INFO *ci,
484 int quote_char)
485{
486 const char *name_end;
487 char q= (char)quote_char;
488 CHARSET_INFO *lci = ci ? ci : charset();
489
490 if (quote_char == EOF)
491 return append(name, length, charset());
492
493 /*
494 The identifier must be quoted as it includes a quote character or
495 it's a keyword
496 */
497
498 (void)reserve(length*2 + 2);
499 if (append(&q, 1, lci))
500 return true;
501
502 for (name_end= name+length ; name < name_end ; name+= length)
503 {
504 uchar chr= (uchar) *name;
505 length= my_mbcharlen(lci, chr);
506 /*
507 my_mbcharlen can return 0 on a wrong multibyte
508 sequence. It is possible when upgrading from 4.0,
509 and identifier contains some accented characters.
510 The manual says it does not work. So we'll just
511 change length to 1 not to hang in the endless loop.
512 */
513 if (!length)
514 length= 1;
515 if (length == 1 && chr == (uchar) q &&
516 append(&q, 1, lci))
517 return true;
518 if (append(name, length, lci))
519 return true;
520 }
521 return append(&q, 1, lci);
522}
523
524
481uint32 String::numchars()525uint32 String::numchars()
482{526{
483 return str_charset->cset->numchars(str_charset, Ptr, Ptr+str_length);527 return str_charset->cset->numchars(str_charset, Ptr, Ptr+str_length);
484528
=== modified file 'Percona-Server/client/sql_string.h'
--- Percona-Server/client/sql_string.h 2012-05-10 07:49:14 +0000
+++ Percona-Server/client/sql_string.h 2012-10-10 20:41:51 +0000
@@ -22,6 +22,12 @@
22#pragma interface /* gcc class implementation */22#pragma interface /* gcc class implementation */
23#endif23#endif
2424
25#define QUOTED_IDENTIFIER(str_name, buf_size, q, cs, id_name, id_size) \
26 char buf_##str_name[(buf_size)]; \
27 String str_name((buf_##str_name), (buf_size), (cs)); \
28 str_name.length(0); \
29 str_name.append_identifier((id_name), (id_size), (cs), (q));
30
25class String;31class String;
26int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);32int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
27String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);33String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
@@ -244,6 +250,10 @@
244 bool append(IO_CACHE* file, uint32 arg_length);250 bool append(IO_CACHE* file, uint32 arg_length);
245 bool append_with_prefill(const char *s, uint32 arg_length, 251 bool append_with_prefill(const char *s, uint32 arg_length,
246 uint32 full_length, char fill_char);252 uint32 full_length, char fill_char);
253 bool append_identifier(const char *name,
254 uint length,
255 CHARSET_INFO *ci,
256 int quote_char);
247 int strstr(const String &search,uint32 offset=0); // Returns offset to substring or -1257 int strstr(const String &search,uint32 offset=0); // Returns offset to substring or -1
248 int strrstr(const String &search,uint32 offset=0); // Returns offset to substring or -1258 int strrstr(const String &search,uint32 offset=0); // Returns offset to substring or -1
249 bool replace(uint32 offset,uint32 arg_length,const char *to,uint32 length);259 bool replace(uint32 offset,uint32 arg_length,const char *to,uint32 length);
250260
=== modified file 'Percona-Server/mysql-test/r/func_compress.result'
--- Percona-Server/mysql-test/r/func_compress.result 2009-09-10 09:18:29 +0000
+++ Percona-Server/mysql-test/r/func_compress.result 2012-10-10 20:41:51 +0000
@@ -11,7 +11,7 @@
11id select_type table type possible_keys key key_len ref rows filtered Extra11id select_type table type possible_keys key key_len ref rows filtered Extra
121 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used121 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
13Warnings:13Warnings:
14Note 1003 select uncompress(compress((@test_compress_string))) AS `uncompress(compress(@test_compress_string))`14Note 1003 select uncompress(compress((@`test_compress_string`))) AS `uncompress(compress(@test_compress_string))`
15select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);15select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
16uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)16uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)
171171
@@ -19,7 +19,7 @@
19id select_type table type possible_keys key key_len ref rows filtered Extra19id select_type table type possible_keys key key_len ref rows filtered Extra
201 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used201 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
21Warnings:21Warnings:
22Note 1003 select (uncompressed_length(compress((@test_compress_string))) = length((@test_compress_string))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`22Note 1003 select (uncompressed_length(compress((@`test_compress_string`))) = length((@`test_compress_string`))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`
23select uncompressed_length(compress(@test_compress_string));23select uncompressed_length(compress(@test_compress_string));
24uncompressed_length(compress(@test_compress_string))24uncompressed_length(compress(@test_compress_string))
2511725117
2626
=== modified file 'Percona-Server/mysql-test/r/func_math.result'
--- Percona-Server/mysql-test/r/func_math.result 2011-07-18 09:21:14 +0000
+++ Percona-Server/mysql-test/r/func_math.result 2012-10-10 20:41:51 +0000
@@ -638,13 +638,13 @@
638DROP TABLE t1;638DROP TABLE t1;
639SET @a:=999999999999999999999999999999999999999999999999999999999999999999999999999999999;639SET @a:=999999999999999999999999999999999999999999999999999999999999999999999999999999999;
640SELECT @a + @a;640SELECT @a + @a;
641ERROR 22003: DECIMAL value is out of range in '((@a) + (@a))'641ERROR 22003: DECIMAL value is out of range in '((@`a`) + (@`a`))'
642SELECT @a * @a;642SELECT @a * @a;
643ERROR 22003: DECIMAL value is out of range in '((@a) * (@a))'643ERROR 22003: DECIMAL value is out of range in '((@`a`) * (@`a`))'
644SELECT -@a - @a;644SELECT -@a - @a;
645ERROR 22003: DECIMAL value is out of range in '(-((@a)) - (@a))'645ERROR 22003: DECIMAL value is out of range in '(-((@`a`)) - (@`a`))'
646SELECT @a / 0.5;646SELECT @a / 0.5;
647ERROR 22003: DECIMAL value is out of range in '((@a) / 0.5)'647ERROR 22003: DECIMAL value is out of range in '((@`a`) / 0.5)'
648SELECT COT(1/0);648SELECT COT(1/0);
649COT(1/0)649COT(1/0)
650NULL650NULL
651651
=== modified file 'Percona-Server/mysql-test/r/mysqlbinlog.result'
--- Percona-Server/mysql-test/r/mysqlbinlog.result 2012-05-10 07:49:14 +0000
+++ Percona-Server/mysql-test/r/mysqlbinlog.result 2012-10-10 20:41:51 +0000
@@ -18,7 +18,7 @@
18/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;18/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
19DELIMITER /*!*/;19DELIMITER /*!*/;
20ROLLBACK/*!*/;20ROLLBACK/*!*/;
21use test/*!*/;21use `test`/*!*/;
22SET TIMESTAMP=1000000000/*!*/;22SET TIMESTAMP=1000000000/*!*/;
23SET @@session.pseudo_thread_id=999999999/*!*/;23SET @@session.pseudo_thread_id=999999999/*!*/;
24SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;24SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -111,7 +111,7 @@
111SET @@session.collation_database=DEFAULT/*!*/;111SET @@session.collation_database=DEFAULT/*!*/;
112BEGIN112BEGIN
113/*!*/;113/*!*/;
114use test/*!*/;114use `test`/*!*/;
115SET TIMESTAMP=1000000000/*!*/;115SET TIMESTAMP=1000000000/*!*/;
116LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`word`)116LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`word`)
117/*!*/;117/*!*/;
@@ -202,7 +202,7 @@
202SET @@session.collation_database=DEFAULT/*!*/;202SET @@session.collation_database=DEFAULT/*!*/;
203BEGIN203BEGIN
204/*!*/;204/*!*/;
205use test/*!*/;205use `test`/*!*/;
206SET TIMESTAMP=1000000000/*!*/;206SET TIMESTAMP=1000000000/*!*/;
207insert into t1 values ("Alas")207insert into t1 values ("Alas")
208/*!*/;208/*!*/;
@@ -219,7 +219,7 @@
219/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;219/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
220DELIMITER /*!*/;220DELIMITER /*!*/;
221ROLLBACK/*!*/;221ROLLBACK/*!*/;
222use test/*!*/;222use `test`/*!*/;
223SET TIMESTAMP=1000000000/*!*/;223SET TIMESTAMP=1000000000/*!*/;
224SET @@session.pseudo_thread_id=999999999/*!*/;224SET @@session.pseudo_thread_id=999999999/*!*/;
225SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;225SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -312,7 +312,7 @@
312SET @@session.collation_database=DEFAULT/*!*/;312SET @@session.collation_database=DEFAULT/*!*/;
313BEGIN313BEGIN
314/*!*/;314/*!*/;
315use test/*!*/;315use `test`/*!*/;
316SET TIMESTAMP=1000000000/*!*/;316SET TIMESTAMP=1000000000/*!*/;
317LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`word`)317LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`word`)
318/*!*/;318/*!*/;
@@ -403,7 +403,7 @@
403SET @@session.collation_database=DEFAULT/*!*/;403SET @@session.collation_database=DEFAULT/*!*/;
404BEGIN404BEGIN
405/*!*/;405/*!*/;
406use test/*!*/;406use `test`/*!*/;
407SET TIMESTAMP=1000000000/*!*/;407SET TIMESTAMP=1000000000/*!*/;
408insert into t1 values ("Alas")408insert into t1 values ("Alas")
409/*!*/;409/*!*/;
@@ -420,7 +420,7 @@
420/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;420/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
421DELIMITER /*!*/;421DELIMITER /*!*/;
422ROLLBACK/*!*/;422ROLLBACK/*!*/;
423use test/*!*/;423use `test`/*!*/;
424SET TIMESTAMP=1108844556/*!*/;424SET TIMESTAMP=1108844556/*!*/;
425SET @@session.pseudo_thread_id=999999999/*!*/;425SET @@session.pseudo_thread_id=999999999/*!*/;
426SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;426SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
@@ -438,7 +438,7 @@
438/*!40019 SET @@session.max_insert_delayed_threads=0*/;438/*!40019 SET @@session.max_insert_delayed_threads=0*/;
439/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;439/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
440DELIMITER /*!*/;440DELIMITER /*!*/;
441use test/*!*/;441use `test`/*!*/;
442SET TIMESTAMP=1108844556/*!*/;442SET TIMESTAMP=1108844556/*!*/;
443SET @@session.pseudo_thread_id=999999999/*!*/;443SET @@session.pseudo_thread_id=999999999/*!*/;
444SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;444SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
@@ -498,7 +498,7 @@
498/*!40019 SET @@session.max_insert_delayed_threads=0*/;498/*!40019 SET @@session.max_insert_delayed_threads=0*/;
499/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;499/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
500DELIMITER /*!*/;500DELIMITER /*!*/;
501use test/*!*/;501use `test`/*!*/;
502SET TIMESTAMP=1000000000/*!*/;502SET TIMESTAMP=1000000000/*!*/;
503SET @@session.pseudo_thread_id=999999999/*!*/;503SET @@session.pseudo_thread_id=999999999/*!*/;
504SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;504SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -548,7 +548,7 @@
548/*!40019 SET @@session.max_insert_delayed_threads=0*/;548/*!40019 SET @@session.max_insert_delayed_threads=0*/;
549/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;549/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
550DELIMITER /*!*/;550DELIMITER /*!*/;
551use test/*!*/;551use `test`/*!*/;
552SET TIMESTAMP=1000000000/*!*/;552SET TIMESTAMP=1000000000/*!*/;
553SET @@session.pseudo_thread_id=999999999/*!*/;553SET @@session.pseudo_thread_id=999999999/*!*/;
554SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;554SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -725,7 +725,7 @@
725/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;725/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
726DELIMITER /*!*/;726DELIMITER /*!*/;
727ROLLBACK/*!*/;727ROLLBACK/*!*/;
728use test/*!*/;728use `test`/*!*/;
729SET TIMESTAMP=1253783037/*!*/;729SET TIMESTAMP=1253783037/*!*/;
730SET @@session.pseudo_thread_id=999999999/*!*/;730SET @@session.pseudo_thread_id=999999999/*!*/;
731SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;731SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -822,22 +822,22 @@
822SET @@session.collation_database=DEFAULT/*!*/;822SET @@session.collation_database=DEFAULT/*!*/;
823BEGIN823BEGIN
824/*!*/;824/*!*/;
825use test/*!*/;825use `test`/*!*/;
826SET TIMESTAMP=1266652094/*!*/;826SET TIMESTAMP=1266652094/*!*/;
827SavePoint mixed_cases827SavePoint mixed_cases
828/*!*/;828/*!*/;
829use db1/*!*/;829use `db1`/*!*/;
830SET TIMESTAMP=1266652094/*!*/;830SET TIMESTAMP=1266652094/*!*/;
831INSERT INTO db1.t2 VALUES("in savepoint mixed_cases")831INSERT INTO db1.t2 VALUES("in savepoint mixed_cases")
832/*!*/;832/*!*/;
833SET TIMESTAMP=1266652094/*!*/;833SET TIMESTAMP=1266652094/*!*/;
834INSERT INTO db1.t1 VALUES(40)834INSERT INTO db1.t1 VALUES(40)
835/*!*/;835/*!*/;
836use test/*!*/;836use `test`/*!*/;
837SET TIMESTAMP=1266652094/*!*/;837SET TIMESTAMP=1266652094/*!*/;
838ROLLBACK TO mixed_cases838ROLLBACK TO mixed_cases
839/*!*/;839/*!*/;
840use db1/*!*/;840use `db1`/*!*/;
841SET TIMESTAMP=1266652094/*!*/;841SET TIMESTAMP=1266652094/*!*/;
842INSERT INTO db1.t2 VALUES("after rollback to")842INSERT INTO db1.t2 VALUES("after rollback to")
843/*!*/;843/*!*/;
@@ -865,7 +865,7 @@
865SET @@session.collation_database=DEFAULT/*!*/;865SET @@session.collation_database=DEFAULT/*!*/;
866BEGIN866BEGIN
867/*!*/;867/*!*/;
868use test/*!*/;868use `test`/*!*/;
869SET TIMESTAMP=1266652094/*!*/;869SET TIMESTAMP=1266652094/*!*/;
870SavePoint mixed_cases870SavePoint mixed_cases
871/*!*/;871/*!*/;
872872
=== modified file 'Percona-Server/mysql-test/r/mysqlbinlog2.result'
--- Percona-Server/mysql-test/r/mysqlbinlog2.result 2010-01-07 15:39:11 +0000
+++ Percona-Server/mysql-test/r/mysqlbinlog2.result 2012-10-10 20:41:51 +0000
@@ -19,7 +19,7 @@
19/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;19/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
20DELIMITER /*!*/;20DELIMITER /*!*/;
21ROLLBACK/*!*/;21ROLLBACK/*!*/;
22use test/*!*/;22use `test`/*!*/;
23SET TIMESTAMP=1579609942/*!*/;23SET TIMESTAMP=1579609942/*!*/;
24SET @@session.pseudo_thread_id=999999999/*!*/;24SET @@session.pseudo_thread_id=999999999/*!*/;
25SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;25SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -103,7 +103,7 @@
103BEGIN103BEGIN
104/*!*/;104/*!*/;
105SET INSERT_ID=1/*!*/;105SET INSERT_ID=1/*!*/;
106use test/*!*/;106use `test`/*!*/;
107SET TIMESTAMP=1579609942/*!*/;107SET TIMESTAMP=1579609942/*!*/;
108insert into t1 values(null, "a")108insert into t1 values(null, "a")
109/*!*/;109/*!*/;
@@ -172,7 +172,7 @@
172BEGIN172BEGIN
173/*!*/;173/*!*/;
174SET INSERT_ID=3/*!*/;174SET INSERT_ID=3/*!*/;
175use test/*!*/;175use `test`/*!*/;
176SET TIMESTAMP=1579609944/*!*/;176SET TIMESTAMP=1579609944/*!*/;
177insert into t1 values(null, "c")177insert into t1 values(null, "c")
178/*!*/;178/*!*/;
@@ -209,7 +209,7 @@
209/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;209/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
210DELIMITER /*!*/;210DELIMITER /*!*/;
211ROLLBACK/*!*/;211ROLLBACK/*!*/;
212use test/*!*/;212use `test`/*!*/;
213SET TIMESTAMP=1579609942/*!*/;213SET TIMESTAMP=1579609942/*!*/;
214SET @@session.pseudo_thread_id=999999999/*!*/;214SET @@session.pseudo_thread_id=999999999/*!*/;
215SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;215SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -263,7 +263,7 @@
263BEGIN263BEGIN
264/*!*/;264/*!*/;
265SET INSERT_ID=3/*!*/;265SET INSERT_ID=3/*!*/;
266use test/*!*/;266use `test`/*!*/;
267SET TIMESTAMP=1579609944/*!*/;267SET TIMESTAMP=1579609944/*!*/;
268insert into t1 values(null, "c")268insert into t1 values(null, "c")
269/*!*/;269/*!*/;
@@ -289,7 +289,7 @@
289BEGIN289BEGIN
290/*!*/;290/*!*/;
291SET INSERT_ID=3/*!*/;291SET INSERT_ID=3/*!*/;
292use test/*!*/;292use `test`/*!*/;
293SET TIMESTAMP=1579609944/*!*/;293SET TIMESTAMP=1579609944/*!*/;
294insert into t1 values(null, "c")294insert into t1 values(null, "c")
295/*!*/;295/*!*/;
@@ -326,7 +326,7 @@
326/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;326/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
327DELIMITER /*!*/;327DELIMITER /*!*/;
328ROLLBACK/*!*/;328ROLLBACK/*!*/;
329use test/*!*/;329use `test`/*!*/;
330SET TIMESTAMP=1579609942/*!*/;330SET TIMESTAMP=1579609942/*!*/;
331SET @@session.pseudo_thread_id=999999999/*!*/;331SET @@session.pseudo_thread_id=999999999/*!*/;
332SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;332SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -369,7 +369,7 @@
369/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;369/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
370DELIMITER /*!*/;370DELIMITER /*!*/;
371ROLLBACK/*!*/;371ROLLBACK/*!*/;
372use test/*!*/;372use `test`/*!*/;
373SET TIMESTAMP=1579609942/*!*/;373SET TIMESTAMP=1579609942/*!*/;
374SET @@session.pseudo_thread_id=999999999/*!*/;374SET @@session.pseudo_thread_id=999999999/*!*/;
375SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;375SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -445,7 +445,7 @@
445BEGIN445BEGIN
446/*!*/;446/*!*/;
447SET INSERT_ID=6/*!*/;447SET INSERT_ID=6/*!*/;
448use test/*!*/;448use `test`/*!*/;
449SET TIMESTAMP=1579609943/*!*/;449SET TIMESTAMP=1579609943/*!*/;
450insert into t1 values(null, "f")450insert into t1 values(null, "f")
451/*!*/;451/*!*/;
@@ -474,7 +474,7 @@
474BEGIN474BEGIN
475/*!*/;475/*!*/;
476SET INSERT_ID=1/*!*/;476SET INSERT_ID=1/*!*/;
477use test/*!*/;477use `test`/*!*/;
478SET TIMESTAMP=1579609942/*!*/;478SET TIMESTAMP=1579609942/*!*/;
479insert into t1 values(null, "a")479insert into t1 values(null, "a")
480/*!*/;480/*!*/;
@@ -535,7 +535,7 @@
535BEGIN535BEGIN
536/*!*/;536/*!*/;
537SET INSERT_ID=6/*!*/;537SET INSERT_ID=6/*!*/;
538use test/*!*/;538use `test`/*!*/;
539SET TIMESTAMP=1579609943/*!*/;539SET TIMESTAMP=1579609943/*!*/;
540insert into t1 values(null, "f")540insert into t1 values(null, "f")
541/*!*/;541/*!*/;
@@ -564,7 +564,7 @@
564BEGIN564BEGIN
565/*!*/;565/*!*/;
566SET INSERT_ID=3/*!*/;566SET INSERT_ID=3/*!*/;
567use test/*!*/;567use `test`/*!*/;
568SET TIMESTAMP=1579609944/*!*/;568SET TIMESTAMP=1579609944/*!*/;
569insert into t1 values(null, "c")569insert into t1 values(null, "c")
570/*!*/;570/*!*/;
@@ -605,7 +605,7 @@
605BEGIN605BEGIN
606/*!*/;606/*!*/;
607SET INSERT_ID=6/*!*/;607SET INSERT_ID=6/*!*/;
608use test/*!*/;608use `test`/*!*/;
609SET TIMESTAMP=1579609943/*!*/;609SET TIMESTAMP=1579609943/*!*/;
610insert into t1 values(null, "f")610insert into t1 values(null, "f")
611/*!*/;611/*!*/;
@@ -622,7 +622,7 @@
622/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;622/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
623DELIMITER /*!*/;623DELIMITER /*!*/;
624ROLLBACK/*!*/;624ROLLBACK/*!*/;
625use test/*!*/;625use `test`/*!*/;
626SET TIMESTAMP=1579609942/*!*/;626SET TIMESTAMP=1579609942/*!*/;
627SET @@session.pseudo_thread_id=999999999/*!*/;627SET @@session.pseudo_thread_id=999999999/*!*/;
628SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;628SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -720,7 +720,7 @@
720BEGIN720BEGIN
721/*!*/;721/*!*/;
722SET INSERT_ID=3/*!*/;722SET INSERT_ID=3/*!*/;
723use test/*!*/;723use `test`/*!*/;
724SET TIMESTAMP=1579609944/*!*/;724SET TIMESTAMP=1579609944/*!*/;
725insert into t1 values(null, "c")725insert into t1 values(null, "c")
726/*!*/;726/*!*/;
@@ -761,7 +761,7 @@
761BEGIN761BEGIN
762/*!*/;762/*!*/;
763SET INSERT_ID=6/*!*/;763SET INSERT_ID=6/*!*/;
764use test/*!*/;764use `test`/*!*/;
765SET TIMESTAMP=1579609943/*!*/;765SET TIMESTAMP=1579609943/*!*/;
766insert into t1 values(null, "f")766insert into t1 values(null, "f")
767/*!*/;767/*!*/;
@@ -778,7 +778,7 @@
778/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;778/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
779DELIMITER /*!*/;779DELIMITER /*!*/;
780ROLLBACK/*!*/;780ROLLBACK/*!*/;
781use test/*!*/;781use `test`/*!*/;
782SET TIMESTAMP=1579609942/*!*/;782SET TIMESTAMP=1579609942/*!*/;
783SET @@session.pseudo_thread_id=999999999/*!*/;783SET @@session.pseudo_thread_id=999999999/*!*/;
784SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;784SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -820,7 +820,7 @@
820/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;820/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
821DELIMITER /*!*/;821DELIMITER /*!*/;
822ROLLBACK/*!*/;822ROLLBACK/*!*/;
823use test/*!*/;823use `test`/*!*/;
824SET TIMESTAMP=1579609942/*!*/;824SET TIMESTAMP=1579609942/*!*/;
825SET @@session.pseudo_thread_id=999999999/*!*/;825SET @@session.pseudo_thread_id=999999999/*!*/;
826SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;826SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -904,7 +904,7 @@
904BEGIN904BEGIN
905/*!*/;905/*!*/;
906SET INSERT_ID=1/*!*/;906SET INSERT_ID=1/*!*/;
907use test/*!*/;907use `test`/*!*/;
908SET TIMESTAMP=1579609942/*!*/;908SET TIMESTAMP=1579609942/*!*/;
909insert into t1 values(null, "a")909insert into t1 values(null, "a")
910/*!*/;910/*!*/;
@@ -972,7 +972,7 @@
972BEGIN972BEGIN
973/*!*/;973/*!*/;
974SET INSERT_ID=3/*!*/;974SET INSERT_ID=3/*!*/;
975use test/*!*/;975use `test`/*!*/;
976SET TIMESTAMP=1579609944/*!*/;976SET TIMESTAMP=1579609944/*!*/;
977insert into t1 values(null, "c")977insert into t1 values(null, "c")
978/*!*/;978/*!*/;
@@ -1009,7 +1009,7 @@
1009/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;1009/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
1010DELIMITER /*!*/;1010DELIMITER /*!*/;
1011ROLLBACK/*!*/;1011ROLLBACK/*!*/;
1012use test/*!*/;1012use `test`/*!*/;
1013SET TIMESTAMP=1579609942/*!*/;1013SET TIMESTAMP=1579609942/*!*/;
1014SET @@session.pseudo_thread_id=999999999/*!*/;1014SET @@session.pseudo_thread_id=999999999/*!*/;
1015SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;1015SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -1062,7 +1062,7 @@
1062BEGIN1062BEGIN
1063/*!*/;1063/*!*/;
1064SET INSERT_ID=3/*!*/;1064SET INSERT_ID=3/*!*/;
1065use test/*!*/;1065use `test`/*!*/;
1066SET TIMESTAMP=1579609944/*!*/;1066SET TIMESTAMP=1579609944/*!*/;
1067insert into t1 values(null, "c")1067insert into t1 values(null, "c")
1068/*!*/;1068/*!*/;
@@ -1088,7 +1088,7 @@
1088BEGIN1088BEGIN
1089/*!*/;1089/*!*/;
1090SET INSERT_ID=3/*!*/;1090SET INSERT_ID=3/*!*/;
1091use test/*!*/;1091use `test`/*!*/;
1092SET TIMESTAMP=1579609944/*!*/;1092SET TIMESTAMP=1579609944/*!*/;
1093insert into t1 values(null, "c")1093insert into t1 values(null, "c")
1094/*!*/;1094/*!*/;
@@ -1125,7 +1125,7 @@
1125/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;1125/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
1126DELIMITER /*!*/;1126DELIMITER /*!*/;
1127ROLLBACK/*!*/;1127ROLLBACK/*!*/;
1128use test/*!*/;1128use `test`/*!*/;
1129SET TIMESTAMP=1579609942/*!*/;1129SET TIMESTAMP=1579609942/*!*/;
1130SET @@session.pseudo_thread_id=999999999/*!*/;1130SET @@session.pseudo_thread_id=999999999/*!*/;
1131SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;1131SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -1167,7 +1167,7 @@
1167/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;1167/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
1168DELIMITER /*!*/;1168DELIMITER /*!*/;
1169ROLLBACK/*!*/;1169ROLLBACK/*!*/;
1170use test/*!*/;1170use `test`/*!*/;
1171SET TIMESTAMP=1579609942/*!*/;1171SET TIMESTAMP=1579609942/*!*/;
1172SET @@session.pseudo_thread_id=999999999/*!*/;1172SET @@session.pseudo_thread_id=999999999/*!*/;
1173SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;1173SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -1243,7 +1243,7 @@
1243BEGIN1243BEGIN
1244/*!*/;1244/*!*/;
1245SET INSERT_ID=6/*!*/;1245SET INSERT_ID=6/*!*/;
1246use test/*!*/;1246use `test`/*!*/;
1247SET TIMESTAMP=1579609943/*!*/;1247SET TIMESTAMP=1579609943/*!*/;
1248insert into t1 values(null, "f")1248insert into t1 values(null, "f")
1249/*!*/;1249/*!*/;
@@ -1272,7 +1272,7 @@
1272BEGIN1272BEGIN
1273/*!*/;1273/*!*/;
1274SET INSERT_ID=1/*!*/;1274SET INSERT_ID=1/*!*/;
1275use test/*!*/;1275use `test`/*!*/;
1276SET TIMESTAMP=1579609942/*!*/;1276SET TIMESTAMP=1579609942/*!*/;
1277insert into t1 values(null, "a")1277insert into t1 values(null, "a")
1278/*!*/;1278/*!*/;
@@ -1333,7 +1333,7 @@
1333BEGIN1333BEGIN
1334/*!*/;1334/*!*/;
1335SET INSERT_ID=6/*!*/;1335SET INSERT_ID=6/*!*/;
1336use test/*!*/;1336use `test`/*!*/;
1337SET TIMESTAMP=1579609943/*!*/;1337SET TIMESTAMP=1579609943/*!*/;
1338insert into t1 values(null, "f")1338insert into t1 values(null, "f")
1339/*!*/;1339/*!*/;
@@ -1361,7 +1361,7 @@
1361BEGIN1361BEGIN
1362/*!*/;1362/*!*/;
1363SET INSERT_ID=3/*!*/;1363SET INSERT_ID=3/*!*/;
1364use test/*!*/;1364use `test`/*!*/;
1365SET TIMESTAMP=1579609944/*!*/;1365SET TIMESTAMP=1579609944/*!*/;
1366insert into t1 values(null, "c")1366insert into t1 values(null, "c")
1367/*!*/;1367/*!*/;
@@ -1402,7 +1402,7 @@
1402BEGIN1402BEGIN
1403/*!*/;1403/*!*/;
1404SET INSERT_ID=6/*!*/;1404SET INSERT_ID=6/*!*/;
1405use test/*!*/;1405use `test`/*!*/;
1406SET TIMESTAMP=1579609943/*!*/;1406SET TIMESTAMP=1579609943/*!*/;
1407insert into t1 values(null, "f")1407insert into t1 values(null, "f")
1408/*!*/;1408/*!*/;
@@ -1419,7 +1419,7 @@
1419/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;1419/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
1420DELIMITER /*!*/;1420DELIMITER /*!*/;
1421ROLLBACK/*!*/;1421ROLLBACK/*!*/;
1422use test/*!*/;1422use `test`/*!*/;
1423SET TIMESTAMP=1579609942/*!*/;1423SET TIMESTAMP=1579609942/*!*/;
1424SET @@session.pseudo_thread_id=999999999/*!*/;1424SET @@session.pseudo_thread_id=999999999/*!*/;
1425SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;1425SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -1516,7 +1516,7 @@
1516BEGIN1516BEGIN
1517/*!*/;1517/*!*/;
1518SET INSERT_ID=3/*!*/;1518SET INSERT_ID=3/*!*/;
1519use test/*!*/;1519use `test`/*!*/;
1520SET TIMESTAMP=1579609944/*!*/;1520SET TIMESTAMP=1579609944/*!*/;
1521insert into t1 values(null, "c")1521insert into t1 values(null, "c")
1522/*!*/;1522/*!*/;
@@ -1557,7 +1557,7 @@
1557BEGIN1557BEGIN
1558/*!*/;1558/*!*/;
1559SET INSERT_ID=6/*!*/;1559SET INSERT_ID=6/*!*/;
1560use test/*!*/;1560use `test`/*!*/;
1561SET TIMESTAMP=1579609943/*!*/;1561SET TIMESTAMP=1579609943/*!*/;
1562insert into t1 values(null, "f")1562insert into t1 values(null, "f")
1563/*!*/;1563/*!*/;
@@ -1574,7 +1574,7 @@
1574/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;1574/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
1575DELIMITER /*!*/;1575DELIMITER /*!*/;
1576ROLLBACK/*!*/;1576ROLLBACK/*!*/;
1577use test/*!*/;1577use `test`/*!*/;
1578SET TIMESTAMP=1579609942/*!*/;1578SET TIMESTAMP=1579609942/*!*/;
1579SET @@session.pseudo_thread_id=999999999/*!*/;1579SET @@session.pseudo_thread_id=999999999/*!*/;
1580SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;1580SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -1616,7 +1616,7 @@
1616/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;1616/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
1617DELIMITER /*!*/;1617DELIMITER /*!*/;
1618ROLLBACK/*!*/;1618ROLLBACK/*!*/;
1619use test/*!*/;1619use `test`/*!*/;
1620SET TIMESTAMP=1579609942/*!*/;1620SET TIMESTAMP=1579609942/*!*/;
1621SET @@session.pseudo_thread_id=999999999/*!*/;1621SET @@session.pseudo_thread_id=999999999/*!*/;
1622SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;1622SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
16231623
=== modified file 'Percona-Server/mysql-test/r/mysqlbinlog_row.result'
--- Percona-Server/mysql-test/r/mysqlbinlog_row.result 2010-08-23 22:31:12 +0000
+++ Percona-Server/mysql-test/r/mysqlbinlog_row.result 2012-10-10 20:41:51 +0000
@@ -336,7 +336,7 @@
336ROLLBACK/*!*/;336ROLLBACK/*!*/;
337# at #337# at #
338#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0338#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
339use test/*!*/;339use `test`/*!*/;
340SET TIMESTAMP=1000000000/*!*/;340SET TIMESTAMP=1000000000/*!*/;
341SET @@session.pseudo_thread_id=#/*!*/;341SET @@session.pseudo_thread_id=#/*!*/;
342SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;342SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
343343
=== modified file 'Percona-Server/mysql-test/r/mysqlbinlog_row_innodb.result'
--- Percona-Server/mysql-test/r/mysqlbinlog_row_innodb.result 2010-03-24 15:03:44 +0000
+++ Percona-Server/mysql-test/r/mysqlbinlog_row_innodb.result 2012-10-10 20:41:51 +0000
@@ -2253,7 +2253,7 @@
2253ROLLBACK/*!*/;2253ROLLBACK/*!*/;
2254# at #2254# at #
2255#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=02255#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
2256use test/*!*/;2256use `test`/*!*/;
2257SET TIMESTAMP=1000000000/*!*/;2257SET TIMESTAMP=1000000000/*!*/;
2258SET @@session.pseudo_thread_id=#/*!*/;2258SET @@session.pseudo_thread_id=#/*!*/;
2259SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;2259SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -3876,7 +3876,7 @@
3876ROLLBACK/*!*/;3876ROLLBACK/*!*/;
3877# at #3877# at #
3878#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=03878#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
3879use test/*!*/;3879use `test`/*!*/;
3880SET TIMESTAMP=1000000000/*!*/;3880SET TIMESTAMP=1000000000/*!*/;
3881SET @@session.pseudo_thread_id=#/*!*/;3881SET @@session.pseudo_thread_id=#/*!*/;
3882SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;3882SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -4243,7 +4243,7 @@
4243ROLLBACK/*!*/;4243ROLLBACK/*!*/;
4244# at #4244# at #
4245#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=04245#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
4246use test/*!*/;4246use `test`/*!*/;
4247SET TIMESTAMP=1000000000/*!*/;4247SET TIMESTAMP=1000000000/*!*/;
4248SET @@session.pseudo_thread_id=#/*!*/;4248SET @@session.pseudo_thread_id=#/*!*/;
4249SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;4249SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -4804,7 +4804,7 @@
4804ROLLBACK/*!*/;4804ROLLBACK/*!*/;
4805# at #4805# at #
4806#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=04806#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
4807use test/*!*/;4807use `test`/*!*/;
4808SET TIMESTAMP=1000000000/*!*/;4808SET TIMESTAMP=1000000000/*!*/;
4809SET @@session.pseudo_thread_id=#/*!*/;4809SET @@session.pseudo_thread_id=#/*!*/;
4810SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;4810SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
48114811
=== modified file 'Percona-Server/mysql-test/r/mysqlbinlog_row_myisam.result'
--- Percona-Server/mysql-test/r/mysqlbinlog_row_myisam.result 2010-03-12 12:42:30 +0000
+++ Percona-Server/mysql-test/r/mysqlbinlog_row_myisam.result 2012-10-10 20:41:51 +0000
@@ -2253,7 +2253,7 @@
2253ROLLBACK/*!*/;2253ROLLBACK/*!*/;
2254# at #2254# at #
2255#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=02255#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
2256use test/*!*/;2256use `test`/*!*/;
2257SET TIMESTAMP=1000000000/*!*/;2257SET TIMESTAMP=1000000000/*!*/;
2258SET @@session.pseudo_thread_id=#/*!*/;2258SET @@session.pseudo_thread_id=#/*!*/;
2259SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;2259SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -3898,7 +3898,7 @@
3898ROLLBACK/*!*/;3898ROLLBACK/*!*/;
3899# at #3899# at #
3900#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=03900#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
3901use test/*!*/;3901use `test`/*!*/;
3902SET TIMESTAMP=1000000000/*!*/;3902SET TIMESTAMP=1000000000/*!*/;
3903SET @@session.pseudo_thread_id=#/*!*/;3903SET @@session.pseudo_thread_id=#/*!*/;
3904SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;3904SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -4271,7 +4271,7 @@
4271ROLLBACK/*!*/;4271ROLLBACK/*!*/;
4272# at #4272# at #
4273#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=04273#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
4274use test/*!*/;4274use `test`/*!*/;
4275SET TIMESTAMP=1000000000/*!*/;4275SET TIMESTAMP=1000000000/*!*/;
4276SET @@session.pseudo_thread_id=#/*!*/;4276SET @@session.pseudo_thread_id=#/*!*/;
4277SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;4277SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -4842,7 +4842,7 @@
4842ROLLBACK/*!*/;4842ROLLBACK/*!*/;
4843# at #4843# at #
4844#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=04844#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
4845use test/*!*/;4845use `test`/*!*/;
4846SET TIMESTAMP=1000000000/*!*/;4846SET TIMESTAMP=1000000000/*!*/;
4847SET @@session.pseudo_thread_id=#/*!*/;4847SET @@session.pseudo_thread_id=#/*!*/;
4848SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;4848SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
48494849
=== modified file 'Percona-Server/mysql-test/r/mysqlbinlog_row_trans.result'
--- Percona-Server/mysql-test/r/mysqlbinlog_row_trans.result 2010-01-07 15:39:11 +0000
+++ Percona-Server/mysql-test/r/mysqlbinlog_row_trans.result 2012-10-10 20:41:51 +0000
@@ -132,7 +132,7 @@
132ROLLBACK/*!*/;132ROLLBACK/*!*/;
133# at #133# at #
134#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0134#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
135use test/*!*/;135use `test`/*!*/;
136SET TIMESTAMP=1000000000/*!*/;136SET TIMESTAMP=1000000000/*!*/;
137SET @@session.pseudo_thread_id=#/*!*/;137SET @@session.pseudo_thread_id=#/*!*/;
138SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;138SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
139139
=== modified file 'Percona-Server/mysql-test/r/user_var-binlog.result'
--- Percona-Server/mysql-test/r/user_var-binlog.result 2010-01-07 15:39:11 +0000
+++ Percona-Server/mysql-test/r/user_var-binlog.result 2012-10-10 20:41:51 +0000
@@ -34,7 +34,7 @@
34BEGIN34BEGIN
35/*!*/;35/*!*/;
36SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`/*!*/;36SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`/*!*/;
37use test/*!*/;37use `test`/*!*/;
38SET TIMESTAMP=10000/*!*/;38SET TIMESTAMP=10000/*!*/;
39INSERT INTO t1 VALUES(@`a b`)39INSERT INTO t1 VALUES(@`a b`)
40/*!*/;40/*!*/;
4141
=== modified file 'Percona-Server/mysql-test/r/variables.result'
--- Percona-Server/mysql-test/r/variables.result 2011-03-28 10:57:54 +0000
+++ Percona-Server/mysql-test/r/variables.result 2012-10-10 20:41:51 +0000
@@ -77,7 +77,7 @@
77id select_type table type possible_keys key key_len ref rows filtered Extra77id select_type table type possible_keys key key_len ref rows filtered Extra
781 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used781 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
79Warnings:79Warnings:
80Note 1003 select (@t1:=((@t2:=1) + (@t3:=4))) AS `@t1:=(@t2:=1)+@t3:=4`,(@t1) AS `@t1`,(@t2) AS `@t2`,(@t3) AS `@t3`80Note 1003 select (@t1:=((@t2:=1) + (@t3:=4))) AS `@t1:=(@t2:=1)+@t3:=4`,(@`t1`) AS `@t1`,(@`t2`) AS `@t2`,(@`t3`) AS `@t3`
81select @t5;81select @t5;
82@t582@t5
831.23456831.23456
8484
=== modified file 'Percona-Server/mysql-test/suite/binlog/r/binlog_base64_flag.result'
--- Percona-Server/mysql-test/suite/binlog/r/binlog_base64_flag.result 2011-02-23 11:54:58 +0000
+++ Percona-Server/mysql-test/suite/binlog/r/binlog_base64_flag.result 2012-10-10 20:41:51 +0000
@@ -35,7 +35,7 @@
35# at 435# at 4
36<#>ROLLBACK/*!*/;36<#>ROLLBACK/*!*/;
37# at 10237# at 102
38<#>use test/*!*/;38<#>use `test`/*!*/;
39SET TIMESTAMP=1196959712/*!*/;39SET TIMESTAMP=1196959712/*!*/;
40<#>SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;40<#>SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
41SET @@session.sql_mode=0/*!*/;41SET @@session.sql_mode=0/*!*/;
4242
=== modified file 'Percona-Server/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result'
--- Percona-Server/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result 2010-01-07 15:39:11 +0000
+++ Percona-Server/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result 2012-10-10 20:41:51 +0000
@@ -26,7 +26,7 @@
26BEGIN26BEGIN
27/*!*/;27/*!*/;
28SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`/*!*/;28SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`/*!*/;
29use test/*!*/;29use `test`/*!*/;
30SET TIMESTAMP=10000/*!*/;30SET TIMESTAMP=10000/*!*/;
31insert into t2 values (@v)31insert into t2 values (@v)
32/*!*/;32/*!*/;
3333
=== modified file 'Percona-Server/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result'
--- Percona-Server/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result 2011-05-12 04:56:41 +0000
+++ Percona-Server/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result 2012-10-10 20:41:51 +0000
@@ -698,7 +698,7 @@
698master-bin.000001 # Intvar # # INSERT_ID=10698master-bin.000001 # Intvar # # INSERT_ID=10
699master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#699master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
700master-bin.000001 # Intvar # # INSERT_ID=10700master-bin.000001 # Intvar # # INSERT_ID=10
701master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @b) SET `b`= @b + bug27417(2) ;file_id=#701master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @`b`) SET `b`= @b + bug27417(2) ;file_id=#
702master-bin.000001 # Query # # ROLLBACK702master-bin.000001 # Query # # ROLLBACK
703/* the output must denote there is the query */;703/* the output must denote there is the query */;
704drop trigger trg_del_t2;704drop trigger trg_del_t2;
@@ -950,7 +950,7 @@
950master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#950master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
951master-bin.000001 # Intvar # # INSERT_ID=10951master-bin.000001 # Intvar # # INSERT_ID=10
952master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci952master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
953master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @b) SET `b`= @b + bug27417(2) ;file_id=#953master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @`b`) SET `b`= @b + bug27417(2) ;file_id=#
954master-bin.000001 # Query # # ROLLBACK954master-bin.000001 # Query # # ROLLBACK
955drop trigger trg_del_t2;955drop trigger trg_del_t2;
956drop table t1,t2,t3,t4,t5;956drop table t1,t2,t3,t4,t5;
957957
=== added file 'Percona-Server/mysql-test/suite/rpl/r/rpl_mdev382.result'
--- Percona-Server/mysql-test/suite/rpl/r/rpl_mdev382.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/rpl/r/rpl_mdev382.result 2012-10-10 20:41:51 +0000
@@ -0,0 +1,326 @@
1include/master-slave.inc
2[connection master]
3create table t1 (a int primary key) engine=innodb;
4create table t2 (a int primary key) engine=myisam;
5begin;
6insert into t1 values (1);
7SET sql_mode = 'ANSI_QUOTES';
8savepoint `a``; create database couldbebadthingshere; savepoint ``dummy`;
9insert into t1 values (2);
10insert into t2 values (1);
11SET sql_mode = '';
12rollback to savepoint `a``; create database couldbebadthingshere; savepoint ``dummy`;
13Warnings:
14Warning 1196 Some non-transactional changed tables couldn't be rolled back
15insert into t1 values (3);
16commit;
17show binlog events from <binlog_start>;
18Log_name Pos Event_type Server_id End_log_pos Info
19master-bin.000001 # Query # # use `test`; create table t1 (a int primary key) engine=innodb
20master-bin.000001 # Query # # use `test`; create table t2 (a int primary key) engine=myisam
21master-bin.000001 # Query # # BEGIN
22master-bin.000001 # Query # # use `test`; insert into t2 values (1)
23master-bin.000001 # Query # # COMMIT
24master-bin.000001 # Query # # BEGIN
25master-bin.000001 # Query # # use `test`; insert into t1 values (1)
26master-bin.000001 # Query # # SAVEPOINT "a`; create database couldbebadthingshere; savepoint `dummy"
27master-bin.000001 # Query # # use `test`; insert into t1 values (2)
28master-bin.000001 # Query # # ROLLBACK TO `a``; create database couldbebadthingshere; savepoint ``dummy`
29master-bin.000001 # Query # # use `test`; insert into t1 values (3)
30master-bin.000001 # Xid # # COMMIT /* XID */
31BEGIN;
32insert into t1 values(10);
33set sql_mode = 'ANSI_QUOTES';
34set sql_quote_show_create = 1;
35savepoint a;
36insert into t1 values(11);
37savepoint "a""a";
38insert into t1 values(12);
39set sql_quote_show_create = 0;
40savepoint b;
41insert into t1 values(13);
42savepoint "b""b";
43insert into t1 values(14);
44set sql_mode = '';
45set sql_quote_show_create = 1;
46savepoint c;
47insert into t1 values(15);
48savepoint `c``c`;
49insert into t1 values(16);
50set sql_quote_show_create = 0;
51savepoint d;
52insert into t1 values(17);
53savepoint `d``d`;
54insert into t1 values(18);
55COMMIT;
56set sql_quote_show_create = 1;
57show binlog events from <binlog_start>;
58Log_name Pos Event_type Server_id End_log_pos Info
59master-bin.000001 # Query # # BEGIN
60master-bin.000001 # Query # # use `test`; insert into t1 values(10)
61master-bin.000001 # Query # # SAVEPOINT "a"
62master-bin.000001 # Query # # use `test`; insert into t1 values(11)
63master-bin.000001 # Query # # SAVEPOINT "a""a"
64master-bin.000001 # Query # # use `test`; insert into t1 values(12)
65master-bin.000001 # Query # # SAVEPOINT b
66master-bin.000001 # Query # # use `test`; insert into t1 values(13)
67master-bin.000001 # Query # # SAVEPOINT "b""b"
68master-bin.000001 # Query # # use `test`; insert into t1 values(14)
69master-bin.000001 # Query # # SAVEPOINT `c`
70master-bin.000001 # Query # # use `test`; insert into t1 values(15)
71master-bin.000001 # Query # # SAVEPOINT `c``c`
72master-bin.000001 # Query # # use `test`; insert into t1 values(16)
73master-bin.000001 # Query # # SAVEPOINT d
74master-bin.000001 # Query # # use `test`; insert into t1 values(17)
75master-bin.000001 # Query # # SAVEPOINT `d``d`
76master-bin.000001 # Query # # use `test`; insert into t1 values(18)
77master-bin.000001 # Xid # # COMMIT /* XID */
78*** Test correct USE statement in SHOW BINLOG EVENTS ***
79set sql_mode = 'ANSI_QUOTES';
80CREATE DATABASE "db1`; SELECT 'oops!'";
81use "db1`; SELECT 'oops!'";
82CREATE TABLE t1 (a INT PRIMARY KEY) engine=MyISAM;
83INSERT INTO t1 VALUES (1);
84set sql_mode = '';
85INSERT INTO t1 VALUES (2);
86set sql_mode = 'ANSI_QUOTES';
87show binlog events from <binlog_start>;
88Log_name Pos Event_type Server_id End_log_pos Info
89master-bin.000001 # Query # # CREATE DATABASE "db1`; SELECT 'oops!'"
90master-bin.000001 # Query # # use "db1`; SELECT 'oops!'"; CREATE TABLE t1 (a INT PRIMARY KEY) engine=MyISAM
91master-bin.000001 # Query # # BEGIN
92master-bin.000001 # Query # # use "db1`; SELECT 'oops!'"; INSERT INTO t1 VALUES (1)
93master-bin.000001 # Query # # COMMIT
94master-bin.000001 # Query # # BEGIN
95master-bin.000001 # Query # # use "db1`; SELECT 'oops!'"; INSERT INTO t1 VALUES (2)
96master-bin.000001 # Query # # COMMIT
97set sql_mode = '';
98set sql_quote_show_create = 0;
99show binlog events from <binlog_start>;
100Log_name Pos Event_type Server_id End_log_pos Info
101master-bin.000001 # Query # # CREATE DATABASE "db1`; SELECT 'oops!'"
102master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; CREATE TABLE t1 (a INT PRIMARY KEY) engine=MyISAM
103master-bin.000001 # Query # # BEGIN
104master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; INSERT INTO t1 VALUES (1)
105master-bin.000001 # Query # # COMMIT
106master-bin.000001 # Query # # BEGIN
107master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; INSERT INTO t1 VALUES (2)
108master-bin.000001 # Query # # COMMIT
109set sql_quote_show_create = 1;
110show binlog events from <binlog_start>;
111Log_name Pos Event_type Server_id End_log_pos Info
112master-bin.000001 # Query # # CREATE DATABASE "db1`; SELECT 'oops!'"
113master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; CREATE TABLE t1 (a INT PRIMARY KEY) engine=MyISAM
114master-bin.000001 # Query # # BEGIN
115master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; INSERT INTO t1 VALUES (1)
116master-bin.000001 # Query # # COMMIT
117master-bin.000001 # Query # # BEGIN
118master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; INSERT INTO t1 VALUES (2)
119master-bin.000001 # Query # # COMMIT
120DROP TABLE t1;
121use test;
122***Test LOAD DATA INFILE with various identifiers that need correct quoting ***
123use `db1``; SELECT 'oops!'`;
124set timestamp=1000000000;
125CREATE TABLE `t``1` (`a``1` VARCHAR(4) PRIMARY KEY, `b``2` VARCHAR(3),
126`c``3` VARCHAR(7));
127LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/f''le.txt' INTO TABLE `t``1`
128 FIELDS TERMINATED BY ',' ESCAPED BY '\\' ENCLOSED BY ''''
129 LINES TERMINATED BY '\n'
130 (`a``1`, @`b```) SET `b``2` = @`b```, `c``3` = concat('|', "b""a'z", "!");
131SELECT * FROM `t``1`;
132a`1 b`2 c`3
133fo\o bar |b"a'z!
134truncate `t``1`;
135use test;
136LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/f''le.txt'
137 INTO TABLE `db1``; SELECT 'oops!'`.`t``1`
138 FIELDS TERMINATED BY ',' ESCAPED BY '\\' ENCLOSED BY ''''
139 LINES TERMINATED BY '\n'
140 (`a``1`, `b``2`) SET `c``3` = concat('|', "b""a'z", "!");
141SELECT * FROM `db1``; SELECT 'oops!'`.`t``1`;
142a`1 b`2 c`3
143fo\o bar |b"a'z!
144show binlog events from <binlog_start>;
145Log_name Pos Event_type Server_id End_log_pos Info
146master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; CREATE TABLE `t``1` (`a``1` VARCHAR(4) PRIMARY KEY, `b``2` VARCHAR(3),
147`c``3` VARCHAR(7))
148master-bin.000001 # Query # # BEGIN
149master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
150master-bin.000001 # Execute_load_query # # use `db1``; SELECT 'oops!'`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/f\'le.txt' INTO TABLE `t``1` FIELDS TERMINATED BY ',' ENCLOSED BY '\'' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a``1`, @`b```) SET `b``2`= @`b```, `c``3`= concat('|', "b""a'z", "!") ;file_id=#
151master-bin.000001 # Xid # # COMMIT /* XID */
152master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; truncate `t``1`
153master-bin.000001 # Query # # BEGIN
154master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
155master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/f\'le.txt' INTO TABLE `db1``; SELECT 'oops!'`.`t``1` FIELDS TERMINATED BY ',' ENCLOSED BY '\'' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a``1`, `b``2`) SET `c``3`= concat('|', "b""a'z", "!") ;file_id=#
156master-bin.000001 # Xid # # COMMIT /* XID */
157/*!40019 SET @@session.max_insert_delayed_threads=0*/;
158/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
159DELIMITER /*!*/;
160ROLLBACK/*!*/;
161use `db1``; SELECT 'oops!'`/*!*/;
162SET TIMESTAMP=1000000000/*!*/;
163SET @@session.pseudo_thread_id=999999999/*!*/;
164SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
165SET @@session.sql_mode=0/*!*/;
166SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
167/*!\C latin1 *//*!*/;
168SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
169SET @@session.lc_time_names=0/*!*/;
170SET @@session.collation_database=DEFAULT/*!*/;
171CREATE TABLE `t``1` (`a``1` VARCHAR(4) PRIMARY KEY, `b``2` VARCHAR(3),
172`c``3` VARCHAR(7))
173/*!*/;
174SET TIMESTAMP=1000000000/*!*/;
175BEGIN
176/*!*/;
177SET TIMESTAMP=1000000000/*!*/;
178LOAD DATA LOCAL INFILE '<name>' INTO TABLE `t``1` FIELDS TERMINATED BY ',' ENCLOSED BY '\'' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a``1`, @`b```) SET `b``2`= @`b```, `c``3`= concat('|', "b""a'z", "!")
179/*!*/;
180COMMIT/*!*/;
181SET TIMESTAMP=1000000000/*!*/;
182truncate `t``1`
183/*!*/;
184SET TIMESTAMP=1000000000/*!*/;
185BEGIN
186/*!*/;
187use `test`/*!*/;
188SET TIMESTAMP=1000000000/*!*/;
189LOAD DATA LOCAL INFILE '<name>' INTO TABLE `db1``; SELECT 'oops!'`.`t``1` FIELDS TERMINATED BY ',' ENCLOSED BY '\'' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a``1`, `b``2`) SET `c``3`= concat('|', "b""a'z", "!")
190/*!*/;
191COMMIT/*!*/;
192DELIMITER ;
193# End of log file
194ROLLBACK /* added by mysqlbinlog */;
195/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
196SELECT * FROM `db1``; SELECT 'oops!'`.`t``1`;
197a`1 b`2 c`3
198fo\o bar |b"a'z!
199DROP TABLE `db1``; SELECT 'oops!'`.`t``1`;
200drop table t1,t2;
201*** Test truncation of long SET expression in LOAD DATA ***
202CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(1000));
203LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/file.txt' INTO TABLE t1
204FIELDS TERMINATED BY ','
205 (a, @b) SET b = CONCAT(@b, '| 123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P123456789Q123456789R123456789123456789T123456789U123456789V123456789W123456789X123456789Y123456789Z123456789|', @b);
206SELECT * FROM t1 ORDER BY a;
207a b
2081 X| 123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P123456789Q123456789R123456789123456789T123456789U123456789V123456789W123456789X123456789Y123456789Z123456789|X
2092 A| 123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P123456789Q123456789R123456789123456789T123456789U123456789V123456789W123456789X123456789Y123456789Z123456789|A
210show binlog events from <binlog_start>;
211Log_name Pos Event_type Server_id End_log_pos Info
212master-bin.000001 # Query # # BEGIN
213master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
214master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/file.txt' INTO TABLE `t1` FIELDS TERMINATED BY ',' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @`b`) SET `b`= CONCAT(@b, '| 123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P123456789Q123456789R123456789123456789T123456789U123456789V123456789W123456789X123456789Y123456789Z123456789|', @b) ;file_id=#
215master-bin.000001 # Xid # # COMMIT /* XID */
216SELECT * FROM t1 ORDER BY a;
217a b
2181 X| 123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P123456789Q123456789R123456789123456789T123456789U123456789V123456789W123456789X123456789Y123456789Z123456789|X
2192 A| 123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P123456789Q123456789R123456789123456789T123456789U123456789V123456789W123456789X123456789Y123456789Z123456789|A
220DROP TABLE t1;
221*** Test user variables whose names require correct quoting ***
222use `db1``; SELECT 'oops!'`;
223CREATE TABLE t1 (a1 BIGINT PRIMARY KEY, a2 BIGINT, a3 BIGINT, a4 BIGINT UNSIGNED, b DOUBLE, c DECIMAL(65,10), d VARCHAR(100));
224INSERT INTO t1 VALUES (-9223372036854775808,42,9223372036854775807,18446744073709551615,-1234560123456789e110, -1234501234567890123456789012345678901234567890123456789.0123456789, REPEAT("x", 100));
225SELECT @`a``1`:=a1, @`a``2`:=a2, @`a``3`:=a3, @`a``4`:=a4, @`b```:=b, @```c`:=c, @```d```:=d FROM t1;
226@`a``1`:=a1 @`a``2`:=a2 @`a``3`:=a3 @`a``4`:=a4 @`b```:=b @```c`:=c @```d```:=d
227-9223372036854775808 42 9223372036854775807 18446744073709551615 -1.234560123456789e125 -1234501234567890123456789012345678901234567890123456789.0123456789 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
228INSERT INTO t1 VALUES (@`a``1`+1, @`a``2`*100, @`a``3`-1, @`a``4`-1, @`b```/2, @```c`, substr(@```d```, 2, 98));
229show binlog events from <binlog_start>;
230Log_name Pos Event_type Server_id End_log_pos Info
231master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; CREATE TABLE t1 (a1 BIGINT PRIMARY KEY, a2 BIGINT, a3 BIGINT, a4 BIGINT UNSIGNED, b DOUBLE, c DECIMAL(65,10), d VARCHAR(100))
232master-bin.000001 # Query # # BEGIN
233master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; INSERT INTO t1 VALUES (-9223372036854775808,42,9223372036854775807,18446744073709551615,-1234560123456789e110, -1234501234567890123456789012345678901234567890123456789.0123456789, REPEAT("x", 100))
234master-bin.000001 # Xid # # COMMIT /* XID */
235master-bin.000001 # Query # # BEGIN
236master-bin.000001 # User var # # @`a``1`=-9223372036854775808
237master-bin.000001 # User var # # @`a``2`=42
238master-bin.000001 # User var # # @`a``3`=9223372036854775807
239master-bin.000001 # User var # # @`a``4`=18446744073709551615
240master-bin.000001 # User var # # @`b```=-1.234560123456789e125
241master-bin.000001 # User var # # @```c`=-1234501234567890123456789012345678901234567890123456789.0123456789
242master-bin.000001 # User var # # @```d```=_latin1 0x78787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878 COLLATE latin1_swedish_ci
243master-bin.000001 # Query # # use `db1``; SELECT 'oops!'`; INSERT INTO t1 VALUES (@`a``1`+1, @`a``2`*100, @`a``3`-1, @`a``4`-1, @`b```/2, @```c`, substr(@```d```, 2, 98))
244master-bin.000001 # Xid # # COMMIT /* XID */
245/*!40019 SET @@session.max_insert_delayed_threads=0*/;
246/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
247DELIMITER /*!*/;
248ROLLBACK/*!*/;
249use `db1``; SELECT 'oops!'`/*!*/;
250SET TIMESTAMP=1000000000/*!*/;
251SET @@session.pseudo_thread_id=999999999/*!*/;
252SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
253SET @@session.sql_mode=0/*!*/;
254SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
255/*!\C latin1 *//*!*/;
256SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
257SET @@session.lc_time_names=0/*!*/;
258SET @@session.collation_database=DEFAULT/*!*/;
259CREATE TABLE t1 (a1 BIGINT PRIMARY KEY, a2 BIGINT, a3 BIGINT, a4 BIGINT UNSIGNED, b DOUBLE, c DECIMAL(65,10), d VARCHAR(100))
260/*!*/;
261SET TIMESTAMP=1000000000/*!*/;
262BEGIN
263/*!*/;
264SET TIMESTAMP=1000000000/*!*/;
265INSERT INTO t1 VALUES (-9223372036854775808,42,9223372036854775807,18446744073709551615,-1234560123456789e110, -1234501234567890123456789012345678901234567890123456789.0123456789, REPEAT("x", 100))
266/*!*/;
267COMMIT/*!*/;
268SET TIMESTAMP=1000000000/*!*/;
269BEGIN
270/*!*/;
271SET @`a``1`:=-9223372036854775808/*!*/;
272SET @`a``2`:=42/*!*/;
273SET @`a``3`:=9223372036854775807/*!*/;
274SET @`a``4`:=18446744073709551615/*!*/;
275SET @`b```:=-1.2345601234568e+125/*!*/;
276SET @```c`:=-1234501234567890123456789012345678901234567890123456789.0123456789/*!*/;
277SET @```d```:=_latin1 0x78787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878 COLLATE `latin1_swedish_ci`/*!*/;
278SET TIMESTAMP=1000000000/*!*/;
279INSERT INTO t1 VALUES (@`a``1`+1, @`a``2`*100, @`a``3`-1, @`a``4`-1, @`b```/2, @```c`, substr(@```d```, 2, 98))
280/*!*/;
281COMMIT/*!*/;
282DELIMITER ;
283# End of log file
284ROLLBACK /* added by mysqlbinlog */;
285/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
286SELECT * FROM `db1``; SELECT 'oops!'`.t1 ORDER BY a1;
287a1 a2 a3 a4 b c d
288-9223372036854775808 42 9223372036854775807 18446744073709551615 -1.234560123456789e125 -1234501234567890123456789012345678901234567890123456789.0123456789 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
289-9223372036854775807 4200 9223372036854775806 18446744073709551614 -6.172800617283945e124 -1234501234567890123456789012345678901234567890123456789.0123456789 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
290DROP TABLE t1;
291*** Test correct quoting in foreign key error message ***
292use `db1``; SELECT 'oops!'`;
293CREATE TABLE `t``1` ( `a``` INT PRIMARY KEY) ENGINE=innodb;
294CREATE TABLE `t``2` ( `b``` INT PRIMARY KEY, `c``` INT NOT NULL,
295FOREIGN KEY fk (`c```) REFERENCES `t``1`(`a```)) ENGINE=innodb;
296TRUNCATE `t``1`;
297ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`db1``; SELECT 'oops!'`.`t``2`, CONSTRAINT `INNODB_FOREIGN_KEY_NAME` FOREIGN KEY (`c```) REFERENCES `db1``; SELECT 'oops!'`.`t``1` (`a```))
298DROP TABLE `t``2`;
299DROP TABLE `t``1`;
300*** Test correct quoting of DELETE FROM statement binlogged for HEAP table that is emptied due to server restart
301include/stop_slave.inc
302CREATE TABLE `db1``; SELECT 'oops!'`.`t``1` (`a``` INT PRIMARY KEY) ENGINE=heap;
303INSERT INTO `db1``; SELECT 'oops!'`.`t``1` VALUES (1), (2), (5);
304SELECT * FROM `db1``; SELECT 'oops!'`.`t``1` ORDER BY 1;
305a`
3061
3072
3085
309set timestamp=1000000000;
310# The table should be empty on the master.
311SELECT * FROM `db1``; SELECT 'oops!'`.`t``1`;
312a`
313# The DELETE statement should be correctly quoted
314show binlog events in 'master-bin.000002' from <binlog_start>;
315Log_name Pos Event_type Server_id End_log_pos Info
316master-bin.000002 # Query # # BEGIN
317master-bin.000002 # Query # # use `test`; DELETE FROM `db1``; SELECT 'oops!'`.`t``1`
318master-bin.000002 # Query # # COMMIT
319include/start_slave.inc
320# The table should be empty on the slave also.
321SELECT * FROM `db1``; SELECT 'oops!'`.`t``1`;
322a`
323DROP TABLE `db1``; SELECT 'oops!'`.`t``1`;
324use test;
325DROP DATABASE `db1``; SELECT 'oops!'`;
326include/rpl_end.inc
0327
=== modified file 'Percona-Server/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result'
--- Percona-Server/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result 2010-12-19 17:15:12 +0000
+++ Percona-Server/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result 2012-10-10 20:41:51 +0000
@@ -154,7 +154,7 @@
154/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;154/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
155DELIMITER /*!*/;155DELIMITER /*!*/;
156ROLLBACK/*!*/;156ROLLBACK/*!*/;
157use test/*!*/;157use `test`/*!*/;
158SET TIMESTAMP=1000000000/*!*/;158SET TIMESTAMP=1000000000/*!*/;
159SET @@session.pseudo_thread_id=999999999/*!*/;159SET @@session.pseudo_thread_id=999999999/*!*/;
160SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;160SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -176,7 +176,7 @@
176/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;176/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
177DELIMITER /*!*/;177DELIMITER /*!*/;
178ROLLBACK/*!*/;178ROLLBACK/*!*/;
179use test/*!*/;179use `test`/*!*/;
180SET TIMESTAMP=1000000000/*!*/;180SET TIMESTAMP=1000000000/*!*/;
181SET @@session.pseudo_thread_id=999999999/*!*/;181SET @@session.pseudo_thread_id=999999999/*!*/;
182SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;182SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -287,7 +287,7 @@
287/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;287/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
288DELIMITER /*!*/;288DELIMITER /*!*/;
289ROLLBACK/*!*/;289ROLLBACK/*!*/;
290use test/*!*/;290use `test`/*!*/;
291SET TIMESTAMP=1000000000/*!*/;291SET TIMESTAMP=1000000000/*!*/;
292SET @@session.pseudo_thread_id=999999999/*!*/;292SET @@session.pseudo_thread_id=999999999/*!*/;
293SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;293SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@@ -318,7 +318,7 @@
318/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;318/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
319DELIMITER /*!*/;319DELIMITER /*!*/;
320ROLLBACK/*!*/;320ROLLBACK/*!*/;
321use test/*!*/;321use `test`/*!*/;
322SET TIMESTAMP=1000000000/*!*/;322SET TIMESTAMP=1000000000/*!*/;
323SET @@session.pseudo_thread_id=999999999/*!*/;323SET @@session.pseudo_thread_id=999999999/*!*/;
324SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;324SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
325325
=== modified file 'Percona-Server/mysql-test/suite/rpl/r/rpl_sp.result'
--- Percona-Server/mysql-test/suite/rpl/r/rpl_sp.result 2010-12-19 17:15:12 +0000
+++ Percona-Server/mysql-test/suite/rpl/r/rpl_sp.result 2012-10-10 20:41:51 +0000
@@ -670,7 +670,7 @@
670SET TIMESTAMP=t/*!*/;670SET TIMESTAMP=t/*!*/;
671create database mysqltest1671create database mysqltest1
672/*!*/;672/*!*/;
673use mysqltest1/*!*/;673use `mysqltest1`/*!*/;
674SET TIMESTAMP=t/*!*/;674SET TIMESTAMP=t/*!*/;
675create table t1 (a varchar(100))675create table t1 (a varchar(100))
676/*!*/;676/*!*/;
@@ -1015,7 +1015,7 @@
1015SET TIMESTAMP=t/*!*/;1015SET TIMESTAMP=t/*!*/;
1016drop user "zedjzlcsjhd"@127.0.0.11016drop user "zedjzlcsjhd"@127.0.0.1
1017/*!*/;1017/*!*/;
1018use test/*!*/;1018use `test`/*!*/;
1019SET TIMESTAMP=t/*!*/;1019SET TIMESTAMP=t/*!*/;
1020drop function if exists f11020drop function if exists f1
1021/*!*/;1021/*!*/;
@@ -1112,7 +1112,7 @@
1112SET TIMESTAMP=t/*!*/;1112SET TIMESTAMP=t/*!*/;
1113create database mysqltest21113create database mysqltest2
1114/*!*/;1114/*!*/;
1115use mysqltest2/*!*/;1115use `mysqltest2`/*!*/;
1116SET TIMESTAMP=t/*!*/;1116SET TIMESTAMP=t/*!*/;
1117create table t ( t integer )1117create table t ( t integer )
1118/*!*/;1118/*!*/;
@@ -1139,7 +1139,7 @@
1139SET TIMESTAMP=t/*!*/;1139SET TIMESTAMP=t/*!*/;
1140BEGIN1140BEGIN
1141/*!*/;1141/*!*/;
1142use mysqltest/*!*/;1142use `mysqltest`/*!*/;
1143SET TIMESTAMP=t/*!*/;1143SET TIMESTAMP=t/*!*/;
1144SELECT `mysqltest2`.`f1`()1144SELECT `mysqltest2`.`f1`()
1145/*!*/;1145/*!*/;
@@ -1152,14 +1152,14 @@
1152SET TIMESTAMP=t/*!*/;1152SET TIMESTAMP=t/*!*/;
1153drop database mysqltest21153drop database mysqltest2
1154/*!*/;1154/*!*/;
1155use test/*!*/;1155use `test`/*!*/;
1156SET TIMESTAMP=t/*!*/;1156SET TIMESTAMP=t/*!*/;
1157CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltestbug36570_p1`()1157CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltestbug36570_p1`()
1158begin1158begin
1159select 1;1159select 1;
1160end1160end
1161/*!*/;1161/*!*/;
1162use mysql/*!*/;1162use `mysql`/*!*/;
1163SET TIMESTAMP=t/*!*/;1163SET TIMESTAMP=t/*!*/;
1164CREATE DEFINER=`root`@`localhost` PROCEDURE `test`.` mysqltestbug36570_p2`( a int)1164CREATE DEFINER=`root`@`localhost` PROCEDURE `test`.` mysqltestbug36570_p2`( a int)
1165`label`:1165`label`:
11661166
=== added file 'Percona-Server/mysql-test/suite/rpl/t/rpl_mdev382.test'
--- Percona-Server/mysql-test/suite/rpl/t/rpl_mdev382.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/rpl/t/rpl_mdev382.test 2012-10-10 20:41:51 +0000
@@ -0,0 +1,256 @@
1--source include/have_innodb.inc
2--source include/have_binlog_format_statement.inc
3--source include/master-slave.inc
4
5# MDEV-382: multiple SQL injections in replication code.
6
7# Test previous SQL injection attack against binlog for SAVEPOINT statement.
8# The test would cause syntax error on slave due to improper quoting of
9# the savepoint name.
10connection master;
11create table t1 (a int primary key) engine=innodb;
12create table t2 (a int primary key) engine=myisam;
13
14begin;
15insert into t1 values (1);
16SET sql_mode = 'ANSI_QUOTES';
17savepoint `a``; create database couldbebadthingshere; savepoint ``dummy`;
18insert into t1 values (2);
19insert into t2 values (1);
20SET sql_mode = '';
21rollback to savepoint `a``; create database couldbebadthingshere; savepoint ``dummy`;
22insert into t1 values (3);
23commit;
24
25--source include/show_binlog_events.inc
26
27# This failed due to syntax error in query when the bug was not fixed.
28sync_slave_with_master;
29connection slave;
30
31# Test some more combinations of ANSI_QUOTES and sql_quote_show_create
32connection master;
33let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
34BEGIN;
35insert into t1 values(10);
36set sql_mode = 'ANSI_QUOTES';
37set sql_quote_show_create = 1;
38savepoint a;
39insert into t1 values(11);
40savepoint "a""a";
41insert into t1 values(12);
42set sql_quote_show_create = 0;
43savepoint b;
44insert into t1 values(13);
45savepoint "b""b";
46insert into t1 values(14);
47set sql_mode = '';
48set sql_quote_show_create = 1;
49savepoint c;
50insert into t1 values(15);
51savepoint `c``c`;
52insert into t1 values(16);
53set sql_quote_show_create = 0;
54savepoint d;
55insert into t1 values(17);
56savepoint `d``d`;
57insert into t1 values(18);
58COMMIT;
59set sql_quote_show_create = 1;
60
61--source include/show_binlog_events.inc
62
63--echo *** Test correct USE statement in SHOW BINLOG EVENTS ***
64connection master;
65let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
66set sql_mode = 'ANSI_QUOTES';
67CREATE DATABASE "db1`; SELECT 'oops!'";
68use "db1`; SELECT 'oops!'";
69CREATE TABLE t1 (a INT PRIMARY KEY) engine=MyISAM;
70INSERT INTO t1 VALUES (1);
71set sql_mode = '';
72INSERT INTO t1 VALUES (2);
73set sql_mode = 'ANSI_QUOTES';
74--source include/show_binlog_events.inc
75set sql_mode = '';
76set sql_quote_show_create = 0;
77--source include/show_binlog_events.inc
78set sql_quote_show_create = 1;
79--source include/show_binlog_events.inc
80DROP TABLE t1;
81
82use test;
83
84--echo ***Test LOAD DATA INFILE with various identifiers that need correct quoting ***
85
86--let $load_file= $MYSQLTEST_VARDIR/tmp/f'le.txt
87--write_file $load_file
88'fo\\o','bar'
89EOF
90
91use `db1``; SELECT 'oops!'`;
92let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
93set timestamp=1000000000;
94CREATE TABLE `t``1` (`a``1` VARCHAR(4) PRIMARY KEY, `b``2` VARCHAR(3),
95 `c``3` VARCHAR(7));
96--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
97eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/f''le.txt' INTO TABLE `t``1`
98 FIELDS TERMINATED BY ',' ESCAPED BY '\\\\' ENCLOSED BY ''''
99 LINES TERMINATED BY '\\n'
100 (`a``1`, @`b```) SET `b``2` = @`b```, `c``3` = concat('|', "b""a'z", "!");
101
102SELECT * FROM `t``1`;
103# Also test when code prefixes table name with database.
104truncate `t``1`;
105use test;
106--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
107eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/f''le.txt'
108 INTO TABLE `db1``; SELECT 'oops!'`.`t``1`
109 FIELDS TERMINATED BY ',' ESCAPED BY '\\\\' ENCLOSED BY ''''
110 LINES TERMINATED BY '\\n'
111 (`a``1`, `b``2`) SET `c``3` = concat('|', "b""a'z", "!");
112SELECT * FROM `db1``; SELECT 'oops!'`.`t``1`;
113let $pos2= query_get_value(SHOW MASTER STATUS, Position, 1);
114
115--source include/show_binlog_events.inc
116let $MYSQLD_DATADIR= `select @@datadir`;
117--replace_regex /LOCAL INFILE '.*SQL_LOAD.*' INTO/LOCAL INFILE '<name>' INTO/
118--exec $MYSQL_BINLOG --short-form --start-position=$binlog_start --stop-position=$pos2 $MYSQLD_DATADIR/master-bin.000001
119
120sync_slave_with_master;
121connection slave;
122SELECT * FROM `db1``; SELECT 'oops!'`.`t``1`;
123connection master;
124
125DROP TABLE `db1``; SELECT 'oops!'`.`t``1`;
126--remove_file $load_file
127
128connection master;
129drop table t1,t2;
130
131
132--echo *** Test truncation of long SET expression in LOAD DATA ***
133CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(1000));
134--let $load_file= $MYSQLTEST_VARDIR/tmp/file.txt
135--write_file $load_file
1361,X
1372,A
138EOF
139
140let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
141# The bug was that the SET expression was truncated to 256 bytes, so test with
142# an expression longer than that.
143--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
144eval LOAD DATA INFILE '$load_file' INTO TABLE t1
145 FIELDS TERMINATED BY ','
146 (a, @b) SET b = CONCAT(@b, '| 123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P123456789Q123456789R123456789123456789T123456789U123456789V123456789W123456789X123456789Y123456789Z123456789|', @b);
147
148SELECT * FROM t1 ORDER BY a;
149--source include/show_binlog_events.inc
150
151sync_slave_with_master;
152connection slave;
153SELECT * FROM t1 ORDER BY a;
154
155connection master;
156--remove_file $load_file
157DROP TABLE t1;
158
159
160--echo *** Test user variables whose names require correct quoting ***
161use `db1``; SELECT 'oops!'`;
162let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
163CREATE TABLE t1 (a1 BIGINT PRIMARY KEY, a2 BIGINT, a3 BIGINT, a4 BIGINT UNSIGNED, b DOUBLE, c DECIMAL(65,10), d VARCHAR(100));
164INSERT INTO t1 VALUES (-9223372036854775808,42,9223372036854775807,18446744073709551615,-1234560123456789e110, -1234501234567890123456789012345678901234567890123456789.0123456789, REPEAT("x", 100));
165SELECT @`a``1`:=a1, @`a``2`:=a2, @`a``3`:=a3, @`a``4`:=a4, @`b```:=b, @```c`:=c, @```d```:=d FROM t1;
166INSERT INTO t1 VALUES (@`a``1`+1, @`a``2`*100, @`a``3`-1, @`a``4`-1, @`b```/2, @```c`, substr(@```d```, 2, 98));
167let $pos2= query_get_value(SHOW MASTER STATUS, Position, 1);
168
169--source include/show_binlog_events.inc
170
171--exec $MYSQL_BINLOG --short-form --start-position=$binlog_start --stop-position=$pos2 $MYSQLD_DATADIR/master-bin.000001
172
173sync_slave_with_master;
174connection slave;
175SELECT * FROM `db1``; SELECT 'oops!'`.t1 ORDER BY a1;
176
177connection master;
178DROP TABLE t1;
179
180--echo *** Test correct quoting in foreign key error message ***
181use `db1``; SELECT 'oops!'`;
182CREATE TABLE `t``1` ( `a``` INT PRIMARY KEY) ENGINE=innodb;
183CREATE TABLE `t``2` ( `b``` INT PRIMARY KEY, `c``` INT NOT NULL,
184 FOREIGN KEY fk (`c```) REFERENCES `t``1`(`a```)) ENGINE=innodb;
185--replace_regex /t@[0-9]+_ibfk_[0-9]+/INNODB_FOREIGN_KEY_NAME/
186--error ER_TRUNCATE_ILLEGAL_FK
187TRUNCATE `t``1`;
188DROP TABLE `t``2`;
189DROP TABLE `t``1`;
190
191
192--echo *** Test correct quoting of DELETE FROM statement binlogged for HEAP table that is emptied due to server restart
193
194# Let's keep the slave stopped during master restart, to avoid any potential
195# races between slave reconnect and master restart.
196connection slave;
197--source include/stop_slave.inc
198
199connection master;
200CREATE TABLE `db1``; SELECT 'oops!'`.`t``1` (`a``` INT PRIMARY KEY) ENGINE=heap;
201INSERT INTO `db1``; SELECT 'oops!'`.`t``1` VALUES (1), (2), (5);
202SELECT * FROM `db1``; SELECT 'oops!'`.`t``1` ORDER BY 1;
203
204# Restart the master mysqld.
205# This will cause an implicit truncation of the memory-based table, which will
206# cause logging of an explicit DELETE FROM to binlog.
207--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
208wait-rpl_mdev382.test
209EOF
210
211--shutdown_server 30
212
213--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
214--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
215restart-rpl_mdev382.test
216EOF
217
218connection default;
219--enable_reconnect
220--source include/wait_until_connected_again.inc
221# rpl_end.inc needs to use the connection server_1
222connection server_1;
223--enable_reconnect
224--source include/wait_until_connected_again.inc
225connection master;
226--enable_reconnect
227--source include/wait_until_connected_again.inc
228set timestamp=1000000000;
229
230--echo # The table should be empty on the master.
231let $binlog_file= master-bin.000002;
232let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
233SELECT * FROM `db1``; SELECT 'oops!'`.`t``1`;
234
235--echo # The DELETE statement should be correctly quoted
236--source include/show_binlog_events.inc
237
238connection slave;
239--source include/start_slave.inc
240
241connection master;
242sync_slave_with_master;
243connection slave;
244--echo # The table should be empty on the slave also.
245SELECT * FROM `db1``; SELECT 'oops!'`.`t``1`;
246
247connection master;
248DROP TABLE `db1``; SELECT 'oops!'`.`t``1`;
249sync_slave_with_master;
250
251
252connection master;
253use test;
254DROP DATABASE `db1``; SELECT 'oops!'`;
255
256--source include/rpl_end.inc
0257
=== modified file 'Percona-Server/sql/ha_ndbcluster_binlog.cc'
--- Percona-Server/sql/ha_ndbcluster_binlog.cc 2011-07-03 23:48:19 +0000
+++ Percona-Server/sql/ha_ndbcluster_binlog.cc 2012-10-10 20:41:51 +0000
@@ -1296,7 +1296,9 @@
1296 DBUG_RETURN(0);1296 DBUG_RETURN(0);
1297 }1297 }
12981298
1299 char tmp_buf2[FN_REFLEN];1299 char tmp_buf2_mem[FN_REFLEN];
1300 String tmp_buf2(tmp_buf2_mem, sizeof(tmp_buf2_mem), system_charset_info);
1301 tmp_buf2.length(0);
1300 const char *type_str;1302 const char *type_str;
1301 switch (type)1303 switch (type)
1302 {1304 {
@@ -1305,17 +1307,24 @@
1305 if (thd->lex->sql_command == SQLCOM_DROP_DB)1307 if (thd->lex->sql_command == SQLCOM_DROP_DB)
1306 DBUG_RETURN(0);1308 DBUG_RETURN(0);
1307 /* redo the drop table query as is may contain several tables */1309 /* redo the drop table query as is may contain several tables */
1308 query= tmp_buf2;1310 tmp_buf2.append(STRING_WITH_LEN("drop table "));
1309 query_length= (uint) (strxmov(tmp_buf2, "drop table `",1311 append_identifier(thd, &tmp_buf2, table_name, strlen(table_name));
1310 table_name, "`", NullS) - tmp_buf2);1312 query= tmp_buf2.c_ptr_safe();
1313 query_length= tmp_buf2.length();
1311 type_str= "drop table";1314 type_str= "drop table";
1312 break;1315 break;
1313 case SOT_RENAME_TABLE:1316 case SOT_RENAME_TABLE:
1314 /* redo the rename table query as is may contain several tables */1317 /* redo the rename table query as is may contain several tables */
1315 query= tmp_buf2;1318 tmp_buf2.append(STRING_WITH_LEN("rename table "));
1316 query_length= (uint) (strxmov(tmp_buf2, "rename table `",1319 append_identifier(thd, &tmp_buf2, db, strlen(db));
1317 db, ".", table_name, "` to `",1320 tmp_buf2.append(STRING_WITH_LEN("."));
1318 new_db, ".", new_table_name, "`", NullS) - tmp_buf2);1321 append_identifier(thd, &tmp_buf2, table_name, strlen(table_name));
1322 tmp_buf2.append(STRING_WITH_LEN(" to "));
1323 append_identifier(thd, &tmp_buf2, new_db, strlen(new_db));
1324 tmp_buf2.append(STRING_WITH_LEN("."));
1325 append_identifier(thd, &tmp_buf2, new_table_name, strlen(new_table_name));
1326 query= tmp_buf2.c_ptr_safe();
1327 query_length= tmp_buf2.length();
1319 type_str= "rename table";1328 type_str= "rename table";
1320 break;1329 break;
1321 case SOT_CREATE_TABLE:1330 case SOT_CREATE_TABLE:
13221331
=== modified file 'Percona-Server/sql/item.cc'
--- Percona-Server/sql/item.cc 2012-09-17 13:08:32 +0000
+++ Percona-Server/sql/item.cc 2012-10-10 20:41:51 +0000
@@ -792,15 +792,31 @@
792 if (!my_charset_same(cs, system_charset_info))792 if (!my_charset_same(cs, system_charset_info))
793 {793 {
794 size_t res_length;794 size_t res_length;
795 name= sql_strmake_with_convert(str, name_length= length, cs,795 name= sql_strmake_with_convert(str, length, cs,
796 MAX_ALIAS_NAME, system_charset_info,796 MAX_ALIAS_NAME, system_charset_info,
797 &res_length);797 &res_length);
798 name_length= res_length;
798 }799 }
799 else800 else
800 name= sql_strmake(str, (name_length= min(length,MAX_ALIAS_NAME)));801 name= sql_strmake(str, (name_length= min(length,MAX_ALIAS_NAME)));
801}802}
802803
803804
805void Item::set_name_no_truncate(const char *str, uint length, CHARSET_INFO *cs)
806{
807 if (!my_charset_same(cs, system_charset_info))
808 {
809 size_t res_length;
810 name= sql_strmake_with_convert(str, length, cs,
811 UINT_MAX, system_charset_info,
812 &res_length);
813 name_length= res_length;
814 }
815 else
816 name= sql_strmake(str, (name_length= length));
817}
818
819
804/**820/**
805 @details821 @details
806 This function is called when:822 This function is called when:
807823
=== modified file 'Percona-Server/sql/item.h'
--- Percona-Server/sql/item.h 2012-02-29 08:45:15 +0000
+++ Percona-Server/sql/item.h 2012-10-10 20:41:51 +0000
@@ -588,6 +588,7 @@
588#endif588#endif
589 } /*lint -e1509 */589 } /*lint -e1509 */
590 void set_name(const char *str, uint length, CHARSET_INFO *cs);590 void set_name(const char *str, uint length, CHARSET_INFO *cs);
591 void set_name_no_truncate(const char *str, uint length, CHARSET_INFO *cs);
591 void rename(char *new_name);592 void rename(char *new_name);
592 void init_make_field(Send_field *tmp_field,enum enum_field_types type);593 void init_make_field(Send_field *tmp_field,enum enum_field_types type);
593 virtual void cleanup();594 virtual void cleanup();
594595
=== modified file 'Percona-Server/sql/item_func.cc'
--- Percona-Server/sql/item_func.cc 2011-11-15 09:01:29 +0000
+++ Percona-Server/sql/item_func.cc 2012-10-10 20:41:51 +0000
@@ -5161,7 +5161,7 @@
5161void Item_func_get_user_var::print(String *str, enum_query_type query_type)5161void Item_func_get_user_var::print(String *str, enum_query_type query_type)
5162{5162{
5163 str->append(STRING_WITH_LEN("(@"));5163 str->append(STRING_WITH_LEN("(@"));
5164 str->append(name.str,name.length);5164 append_identifier(current_thd, str, name.str, name.length);
5165 str->append(')');5165 str->append(')');
5166}5166}
51675167
@@ -5257,10 +5257,10 @@
5257}5257}
52585258
52595259
5260void Item_user_var_as_out_param::print(String *str, enum_query_type query_type)5260void Item_user_var_as_out_param::print_for_load(THD *thd, String *str)
5261{5261{
5262 str->append('@');5262 str->append('@');
5263 str->append(name.str,name.length);5263 append_identifier(thd, str, name.str, name.length);
5264}5264}
52655265
52665266
52675267
=== modified file 'Percona-Server/sql/item_func.h'
--- Percona-Server/sql/item_func.h 2011-07-03 23:48:19 +0000
+++ Percona-Server/sql/item_func.h 2012-10-10 20:41:51 +0000
@@ -1574,7 +1574,7 @@
1574 my_decimal *val_decimal(my_decimal *decimal_buffer);1574 my_decimal *val_decimal(my_decimal *decimal_buffer);
1575 /* fix_fields() binds variable name with its entry structure */1575 /* fix_fields() binds variable name with its entry structure */
1576 bool fix_fields(THD *thd, Item **ref);1576 bool fix_fields(THD *thd, Item **ref);
1577 virtual void print(String *str, enum_query_type query_type);1577 void print_for_load(THD *thd, String *str);
1578 void set_null_value(CHARSET_INFO* cs);1578 void set_null_value(CHARSET_INFO* cs);
1579 void set_value(const char *str, uint length, CHARSET_INFO* cs);1579 void set_value(const char *str, uint length, CHARSET_INFO* cs);
1580};1580};
15811581
=== modified file 'Percona-Server/sql/log.cc'
--- Percona-Server/sql/log.cc 2012-09-28 01:36:45 +0000
+++ Percona-Server/sql/log.cc 2012-10-10 20:41:51 +0000
@@ -51,6 +51,8 @@
51#include "sql_plugin.h"51#include "sql_plugin.h"
52#include "rpl_handler.h"52#include "rpl_handler.h"
53#include "debug_sync.h"53#include "debug_sync.h"
54#include "sql_show.h"
55
54/* max size of the log message */56/* max size of the log message */
55#define MAX_LOG_BUFFER_SIZE 102457#define MAX_LOG_BUFFER_SIZE 1024
56#define MAX_TIME_SIZE 3258#define MAX_TIME_SIZE 32
@@ -2044,9 +2046,8 @@
20442046
2045 String log_query;2047 String log_query;
2046 if (log_query.append(STRING_WITH_LEN("SAVEPOINT ")) ||2048 if (log_query.append(STRING_WITH_LEN("SAVEPOINT ")) ||
2047 log_query.append("`") ||2049 append_identifier(thd, &log_query,
2048 log_query.append(thd->lex->ident.str, thd->lex->ident.length) ||2050 thd->lex->ident.str, thd->lex->ident.length))
2049 log_query.append("`"))
2050 DBUG_RETURN(1);2051 DBUG_RETURN(1);
2051 int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);2052 int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
2052 Query_log_event qinfo(thd, log_query.c_ptr_safe(), log_query.length(),2053 Query_log_event qinfo(thd, log_query.c_ptr_safe(), log_query.length(),
@@ -2068,9 +2069,8 @@
2068 {2069 {
2069 String log_query;2070 String log_query;
2070 if (log_query.append(STRING_WITH_LEN("ROLLBACK TO ")) ||2071 if (log_query.append(STRING_WITH_LEN("ROLLBACK TO ")) ||
2071 log_query.append("`") ||2072 append_identifier(thd, &log_query,
2072 log_query.append(thd->lex->ident.str, thd->lex->ident.length) ||2073 thd->lex->ident.str, thd->lex->ident.length))
2073 log_query.append("`"))
2074 DBUG_RETURN(1);2074 DBUG_RETURN(1);
2075 int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);2075 int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
2076 Query_log_event qinfo(thd, log_query.c_ptr_safe(), log_query.length(),2076 Query_log_event qinfo(thd, log_query.c_ptr_safe(), log_query.length(),
20772077
=== modified file 'Percona-Server/sql/log_event.cc'
--- Percona-Server/sql/log_event.cc 2012-09-17 13:08:32 +0000
+++ Percona-Server/sql/log_event.cc 2012-10-10 20:41:51 +0000
@@ -45,12 +45,14 @@
45#include "rpl_record.h"45#include "rpl_record.h"
46#include "transaction.h"46#include "transaction.h"
47#include <my_dir.h>47#include <my_dir.h>
48#include "sql_show.h"
4849
49#endif /* MYSQL_CLIENT */50#endif /* MYSQL_CLIENT */
5051
51#include <base64.h>52#include <base64.h>
52#include <my_bitmap.h>53#include <my_bitmap.h>
53#include "rpl_utility.h"54#include "rpl_utility.h"
55#include "sql_string.h"
5456
55#define log_cs &my_charset_latin157#define log_cs &my_charset_latin1
5658
@@ -426,29 +428,28 @@
426 pretty_print_str()428 pretty_print_str()
427*/429*/
428430
429static char *pretty_print_str(char *packet, const char *str, int len)431static void
432pretty_print_str(String *packet, const char *str, int len)
430{433{
431 const char *end= str + len;434 const char *end= str + len;
432 char *pos= packet;435 packet->append(STRING_WITH_LEN("'"));
433 *pos++= '\'';
434 while (str < end)436 while (str < end)
435 {437 {
436 char c;438 char c;
437 switch ((c=*str++)) {439 switch ((c=*str++)) {
438 case '\n': *pos++= '\\'; *pos++= 'n'; break;440 case '\n': packet->append(STRING_WITH_LEN("\\n")); break;
439 case '\r': *pos++= '\\'; *pos++= 'r'; break;441 case '\r': packet->append(STRING_WITH_LEN("\\r")); break;
440 case '\\': *pos++= '\\'; *pos++= '\\'; break;442 case '\\': packet->append(STRING_WITH_LEN("\\\\")); break;
441 case '\b': *pos++= '\\'; *pos++= 'b'; break;443 case '\b': packet->append(STRING_WITH_LEN("\\b")); break;
442 case '\t': *pos++= '\\'; *pos++= 't'; break;444 case '\t': packet->append(STRING_WITH_LEN("\\t")); break;
443 case '\'': *pos++= '\\'; *pos++= '\''; break;445 case '\'': packet->append(STRING_WITH_LEN("\\'")); break;
444 case 0 : *pos++= '\\'; *pos++= '0'; break;446 case 0 : packet->append(STRING_WITH_LEN("\\0")); break;
445 default:447 default:
446 *pos++= c;448 packet->append(&c, 1);
447 break;449 break;
448 }450 }
449 }451 }
450 *pos++= '\'';452 packet->append(STRING_WITH_LEN("'"));
451 return pos;
452}453}
453#endif /* !MYSQL_CLIENT */454#endif /* !MYSQL_CLIENT */
454455
@@ -879,7 +880,7 @@
879 Log_event::pack_info()880 Log_event::pack_info()
880*/881*/
881882
882void Log_event::pack_info(Protocol *protocol)883void Log_event::pack_info(THD *thd, Protocol *protocol)
883{884{
884 protocol->store("", &my_charset_bin);885 protocol->store("", &my_charset_bin);
885}886}
@@ -888,7 +889,8 @@
888/**889/**
889 Only called by SHOW BINLOG EVENTS890 Only called by SHOW BINLOG EVENTS
890*/891*/
891int Log_event::net_send(Protocol *protocol, const char* log_name, my_off_t pos)892int Log_event::net_send(THD *thd, Protocol *protocol, const char* log_name,
893 my_off_t pos)
892{894{
893 const char *p= strrchr(log_name, FN_LIBCHAR);895 const char *p= strrchr(log_name, FN_LIBCHAR);
894 const char *event_type;896 const char *event_type;
@@ -902,7 +904,7 @@
902 protocol->store(event_type, strlen(event_type), &my_charset_bin);904 protocol->store(event_type, strlen(event_type), &my_charset_bin);
903 protocol->store((uint32) server_id);905 protocol->store((uint32) server_id);
904 protocol->store((ulonglong) log_pos);906 protocol->store((ulonglong) log_pos);
905 pack_info(protocol);907 pack_info(thd, protocol);
906 return protocol->write();908 return protocol->write();
907}909}
908#endif /* HAVE_REPLICATION */910#endif /* HAVE_REPLICATION */
@@ -2157,27 +2159,22 @@
2157 show the catalog ??2159 show the catalog ??
2158*/2160*/
21592161
2160void Query_log_event::pack_info(Protocol *protocol)2162void Query_log_event::pack_info(THD *thd, Protocol *protocol)
2161{2163{
2162 // TODO: show the catalog ??2164 // TODO: show the catalog ??
2163 char *buf, *pos;2165 char buf_mem[1024];
2164 if (!(buf= (char*) my_malloc(9 + db_len + q_len, MYF(MY_WME))))2166 String buf(buf_mem, sizeof(buf_mem), system_charset_info);
2165 return;2167 buf.real_alloc(9 + db_len + q_len);
2166 pos= buf;
2167 if (!(flags & LOG_EVENT_SUPPRESS_USE_F)2168 if (!(flags & LOG_EVENT_SUPPRESS_USE_F)
2168 && db && db_len)2169 && db && db_len)
2169 {2170 {
2170 pos= strmov(buf, "use `");2171 buf.append(STRING_WITH_LEN("use "));
2171 memcpy(pos, db, db_len);2172 append_identifier(thd, &buf, db, db_len);
2172 pos= strmov(pos+db_len, "`; ");2173 buf.append("; ");
2173 }2174 }
2174 if (query && q_len)2175 if (query && q_len)
2175 {2176 buf.append(query, q_len);
2176 memcpy(pos, query, q_len);2177 protocol->store(&buf);
2177 pos+= q_len;
2178 }
2179 protocol->store(buf, pos-buf, &my_charset_bin);
2180 my_free(buf);
2181}2178}
2182#endif2179#endif
21832180
@@ -3047,7 +3044,19 @@
3047 if (different_db)3044 if (different_db)
3048 memcpy(print_event_info->db, db, db_len + 1);3045 memcpy(print_event_info->db, db, db_len + 1);
3049 if (db[0] && different_db) 3046 if (db[0] && different_db)
3050 my_b_printf(file, "use %s%s\n", db, print_event_info->delimiter);3047 {
3048 QUOTED_IDENTIFIER(q_db,
3049 /* Room for expand ` to `` + initial/final ` + \0 */
3050 FN_REFLEN*2+3,
3051 '`',
3052 &my_charset_bin,
3053 db,
3054 db_len);
3055 my_b_printf(file,
3056 "use %s%s\n",
3057 q_db.c_ptr(),
3058 print_event_info->delimiter);
3059 }
3051 }3060 }
30523061
3053 end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10);3062 end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10);
@@ -3710,7 +3719,7 @@
3710*/3719*/
37113720
3712#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)3721#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
3713void Start_log_event_v3::pack_info(Protocol *protocol)3722void Start_log_event_v3::pack_info(THD *thd, Protocol *protocol)
3714{3723{
3715 char buf[12 + ST_SERVER_VER_LEN + 14 + 22], *pos;3724 char buf[12 + ST_SERVER_VER_LEN + 14 + 22], *pos;
3716 pos= strmov(buf, "Server ver: ");3725 pos= strmov(buf, "Server ver: ");
@@ -4359,131 +4368,115 @@
4359*/4368*/
43604369
4361#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)4370#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
4362uint Load_log_event::get_query_buffer_length()4371void Load_log_event::print_query(THD *thd, bool need_db, const char *cs,
4363{4372 String *buf, my_off_t *fn_start,
4364 return4373 my_off_t *fn_end, const char *qualify_db)
4365 5 + db_len + 3 + // "use DB; "4374{
4366 18 + fname_len + 2 + // "LOAD DATA INFILE 'file''"
4367 11 + // "CONCURRENT "
4368 7 + // LOCAL
4369 9 + // " REPLACE or IGNORE "
4370 13 + table_name_len*2 + // "INTO TABLE `table`"
4371 21 + sql_ex.field_term_len*4 + 2 + // " FIELDS TERMINATED BY 'str'"
4372 23 + sql_ex.enclosed_len*4 + 2 + // " OPTIONALLY ENCLOSED BY 'str'"
4373 12 + sql_ex.escaped_len*4 + 2 + // " ESCAPED BY 'str'"
4374 21 + sql_ex.line_term_len*4 + 2 + // " LINES TERMINATED BY 'str'"
4375 19 + sql_ex.line_start_len*4 + 2 + // " LINES STARTING BY 'str'"
4376 15 + 22 + // " IGNORE xxx LINES"
4377 3 + (num_fields-1)*2 + field_block_len; // " (field1, field2, ...)"
4378}
4379
4380
4381void Load_log_event::print_query(bool need_db, const char *cs, char *buf,
4382 char **end, char **fn_start, char **fn_end)
4383{
4384 char *pos= buf;
4385
4386 if (need_db && db && db_len)4375 if (need_db && db && db_len)
4387 {4376 {
4388 pos= strmov(pos, "use `");4377 buf->append(STRING_WITH_LEN("use "));
4389 memcpy(pos, db, db_len);4378 append_identifier(thd, buf, db, db_len);
4390 pos= strmov(pos+db_len, "`; ");4379 buf->append(STRING_WITH_LEN("; "));
4391 }4380 }
43924381
4393 pos= strmov(pos, "LOAD DATA ");4382 buf->append(STRING_WITH_LEN("LOAD DATA "));
43944383
4395 if (is_concurrent)4384 if (is_concurrent)
4396 pos= strmov(pos, "CONCURRENT ");4385 buf->append(STRING_WITH_LEN("CONCURRENT "));
43974386
4398 if (fn_start)4387 if (fn_start)
4399 *fn_start= pos;4388 *fn_start= buf->length();
44004389
4401 if (check_fname_outside_temp_buf())4390 if (check_fname_outside_temp_buf())
4402 pos= strmov(pos, "LOCAL ");4391 buf->append(STRING_WITH_LEN("LOCAL "));
4403 pos= strmov(pos, "INFILE '");4392 buf->append(STRING_WITH_LEN("INFILE '"));
4404 memcpy(pos, fname, fname_len);4393 buf->append_for_single_quote(fname, fname_len);
4405 pos= strmov(pos+fname_len, "' ");4394 buf->append(STRING_WITH_LEN("' "));
44064395
4407 if (sql_ex.opt_flags & REPLACE_FLAG)4396 if (sql_ex.opt_flags & REPLACE_FLAG)
4408 pos= strmov(pos, "REPLACE ");4397 buf->append(STRING_WITH_LEN("REPLACE "));
4409 else if (sql_ex.opt_flags & IGNORE_FLAG)4398 else if (sql_ex.opt_flags & IGNORE_FLAG)
4410 pos= strmov(pos, "IGNORE ");4399 buf->append(STRING_WITH_LEN("IGNORE "));
44114400
4412 pos= strmov(pos ,"INTO");4401 buf->append(STRING_WITH_LEN("INTO"));
44134402
4414 if (fn_end)4403 if (fn_end)
4415 *fn_end= pos;4404 *fn_end= buf->length();
44164405
4417 pos= strmov(pos ," TABLE `");4406 buf->append(STRING_WITH_LEN(" TABLE "));
4418 memcpy(pos, table_name, table_name_len);4407 if (qualify_db)
4419 pos+= table_name_len;4408 {
4409 append_identifier(thd, buf, qualify_db, strlen(qualify_db));
4410 buf->append(STRING_WITH_LEN("."));
4411 }
4412 append_identifier(thd, buf, table_name, table_name_len);
44204413
4421 if (cs != NULL)4414 if (cs != NULL)
4422 {4415 {
4423 pos= strmov(pos ,"` CHARACTER SET ");4416 buf->append(STRING_WITH_LEN(" CHARACTER SET "));
4424 pos= strmov(pos , cs);4417 buf->append(cs, strlen(cs));
4425 }4418 }
4426 else
4427 pos= strmov(pos, "`");
44284419
4429 /* We have to create all optional fields as the default is not empty */4420 /* We have to create all optional fields as the default is not empty */
4430 pos= strmov(pos, " FIELDS TERMINATED BY ");4421 buf->append(STRING_WITH_LEN(" FIELDS TERMINATED BY "));
4431 pos= pretty_print_str(pos, sql_ex.field_term, sql_ex.field_term_len);4422 pretty_print_str(buf, sql_ex.field_term, sql_ex.field_term_len);
4432 if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG)4423 if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG)
4433 pos= strmov(pos, " OPTIONALLY ");4424 buf->append(STRING_WITH_LEN(" OPTIONALLY "));
4434 pos= strmov(pos, " ENCLOSED BY ");4425 buf->append(STRING_WITH_LEN(" ENCLOSED BY "));
4435 pos= pretty_print_str(pos, sql_ex.enclosed, sql_ex.enclosed_len);4426 pretty_print_str(buf, sql_ex.enclosed, sql_ex.enclosed_len);
44364427
4437 pos= strmov(pos, " ESCAPED BY ");4428 buf->append(STRING_WITH_LEN(" ESCAPED BY "));
4438 pos= pretty_print_str(pos, sql_ex.escaped, sql_ex.escaped_len);4429 pretty_print_str(buf, sql_ex.escaped, sql_ex.escaped_len);
44394430
4440 pos= strmov(pos, " LINES TERMINATED BY ");4431 buf->append(STRING_WITH_LEN(" LINES TERMINATED BY "));
4441 pos= pretty_print_str(pos, sql_ex.line_term, sql_ex.line_term_len);4432 pretty_print_str(buf, sql_ex.line_term, sql_ex.line_term_len);
4442 if (sql_ex.line_start_len)4433 if (sql_ex.line_start_len)
4443 {4434 {
4444 pos= strmov(pos, " STARTING BY ");4435 buf->append(STRING_WITH_LEN(" STARTING BY "));
4445 pos= pretty_print_str(pos, sql_ex.line_start, sql_ex.line_start_len);4436 pretty_print_str(buf, sql_ex.line_start, sql_ex.line_start_len);
4446 }4437 }
44474438
4448 if ((long) skip_lines > 0)4439 if ((long) skip_lines > 0)
4449 {4440 {
4450 pos= strmov(pos, " IGNORE ");4441 char skipbuf[22];
4451 pos= longlong10_to_str((longlong) skip_lines, pos, 10);4442 buf->append(STRING_WITH_LEN(" IGNORE "));
4452 pos= strmov(pos," LINES "); 4443 longlong10_to_str((longlong) skip_lines, skipbuf, 10);
4444 buf->append(skipbuf);
4445 buf->append(STRING_WITH_LEN(" LINES "));
4453 }4446 }
44544447
4455 if (num_fields)4448 if (num_fields)
4456 {4449 {
4457 uint i;4450 uint i;
4458 const char *field= fields;4451 const char *field= fields;
4459 pos= strmov(pos, " (");4452 buf->append(STRING_WITH_LEN(" ("));
4460 for (i = 0; i < num_fields; i++)4453 for (i = 0; i < num_fields; i++)
4461 {4454 {
4462 if (i)4455 if (i)
4463 {4456 {
4464 *pos++= ' ';4457 /*
4465 *pos++= ',';4458 Yes, the space and comma is reversed here. But this is mostly dead
4459 code, at most used when reading really old binlogs from old servers,
4460 so better just leave it as is...
4461 */
4462 buf->append(STRING_WITH_LEN(" ,"));
4466 }4463 }
4467 memcpy(pos, field, field_lens[i]);4464 append_identifier(thd, buf, field, field_lens[i]);
4468 pos+= field_lens[i];
4469 field+= field_lens[i] + 1;4465 field+= field_lens[i] + 1;
4470 }4466 }
4471 *pos++= ')';4467 buf->append(STRING_WITH_LEN(")"));
4472 }4468 }
4473
4474 *end= pos;
4475}4469}
44764470
44774471
4478void Load_log_event::pack_info(Protocol *protocol)4472void Load_log_event::pack_info(THD *thd, Protocol *protocol)
4479{4473{
4480 char *buf, *end;4474 char query_buffer[1024];
4475 String query_str(query_buffer, sizeof(query_buffer), system_charset_info);
44814476
4482 if (!(buf= (char*) my_malloc(get_query_buffer_length(), MYF(MY_WME))))4477 query_str.length(0);
4483 return;4478 print_query(thd, TRUE, NULL, &query_str, 0, 0, NULL);
4484 print_query(TRUE, NULL, buf, &end, 0, 0);4479 protocol->store(query_str.ptr(), query_str.length(), &my_charset_bin);
4485 protocol->store(buf, end-buf, &my_charset_bin);
4486 my_free(buf);
4487}4480}
4488#endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */4481#endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */
44894482
@@ -4758,7 +4751,13 @@
4758 else if (sql_ex.opt_flags & IGNORE_FLAG)4751 else if (sql_ex.opt_flags & IGNORE_FLAG)
4759 my_b_printf(&cache,"IGNORE ");4752 my_b_printf(&cache,"IGNORE ");
4760 4753
4761 my_b_printf(&cache, "INTO TABLE `%s`", table_name);4754 QUOTED_IDENTIFIER(quoted_table_name,
4755 512,
4756 '`',
4757 &my_charset_bin,
4758 table_name,
4759 strlen(table_name));
4760 my_b_printf(&cache, "INTO TABLE %s", quoted_table_name.c_ptr());
4762 my_b_printf(&cache, " FIELDS TERMINATED BY ");4761 my_b_printf(&cache, " FIELDS TERMINATED BY ");
4763 pretty_print_str(&cache, sql_ex.field_term, sql_ex.field_term_len);4762 pretty_print_str(&cache, sql_ex.field_term, sql_ex.field_term_len);
47644763
@@ -4939,29 +4938,21 @@
4939 else4938 else
4940 {4939 {
4941 char llbuff[22];4940 char llbuff[22];
4942 char *end;
4943 enum enum_duplicates handle_dup;4941 enum enum_duplicates handle_dup;
4944 bool ignore= 0;4942 bool ignore= 0;
4945 char *load_data_query;4943 char *load_data_query;
4946 int query_buf_len;4944 char query_buffer[1024];
4945 String query_str(query_buffer, sizeof(query_buffer), system_charset_info);
4946 query_str.length(0);
49474947
4948 /*4948 print_query(thd, FALSE, NULL, &query_str, NULL, NULL, NULL);
4949 We must allocate some extra memory for query cache
4950 The query buffer layout is:
4951 buffer :==
4952 <statement> The input statement(s)
4953 '\0' Terminating null char (1 byte)
4954 <length> Length of following current database name (size_t)
4955 <db_name> Name of current database
4956 <flags> Flags struct
4957 */
4958 query_buf_len = get_query_buffer_length() + 1 + sizeof(size_t) + thd->db_length
4959 + QUERY_CACHE_FLAGS_SIZE + 1;
4960 /*4949 /*
4961 Forge LOAD DATA INFILE query which will be used in SHOW PROCESS LIST4950 Forge LOAD DATA INFILE query which will be used in SHOW PROCESS LIST
4962 and written to slave's binlog if binlogging is on.4951 and written to slave's binlog if binlogging is on.
4963 */4952 */
4964 if (!(load_data_query= (char *)thd->alloc(query_buf_len)))4953 if (!(load_data_query= (char *) thd->strmake(query_str.ptr(),
4954 query_str.length() +
4955 sizeof(size_t))))
4965 {4956 {
4966 /*4957 /*
4967 This will set thd->fatal_error in case of OOM. So we surely will notice4958 This will set thd->fatal_error in case of OOM. So we surely will notice
@@ -4970,10 +4961,11 @@
4970 goto error;4961 goto error;
4971 }4962 }
49724963
4973 print_query(FALSE, NULL, load_data_query, &end, NULL, NULL);4964 memcpy(load_data_query + query_str.length() + 1,
4974 *end= 0;4965 (char *) &thd->db_length,
4975 memcpy(end+1, (char *) &thd->db_length, sizeof(size_t));4966 sizeof(size_t));
4976 thd->set_query(load_data_query, (uint) (end - load_data_query));4967
4968 thd->set_query(load_data_query, query_str.length());
49774969
4978 if (sql_ex.opt_flags & REPLACE_FLAG)4970 if (sql_ex.opt_flags & REPLACE_FLAG)
4979 handle_dup= DUP_REPLACE;4971 handle_dup= DUP_REPLACE;
@@ -5151,7 +5143,7 @@
5151*/5143*/
51525144
5153#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)5145#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
5154void Rotate_log_event::pack_info(Protocol *protocol)5146void Rotate_log_event::pack_info(THD *thd, Protocol *protocol)
5155{5147{
5156 char buf1[256], buf[22];5148 char buf1[256], buf[22];
5157 String tmp(buf1, sizeof(buf1), log_cs);5149 String tmp(buf1, sizeof(buf1), log_cs);
@@ -5366,7 +5358,7 @@
5366*/5358*/
53675359
5368#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)5360#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
5369void Intvar_log_event::pack_info(Protocol *protocol)5361void Intvar_log_event::pack_info(THD *thd, Protocol *protocol)
5370{5362{
5371 char buf[256], *pos;5363 char buf[256], *pos;
5372 pos= strmake(buf, get_var_type_name(), sizeof(buf)-23);5364 pos= strmake(buf, get_var_type_name(), sizeof(buf)-23);
@@ -5519,7 +5511,7 @@
5519**************************************************************************/5511**************************************************************************/
55205512
5521#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)5513#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
5522void Rand_log_event::pack_info(Protocol *protocol)5514void Rand_log_event::pack_info(THD *thd, Protocol *protocol)
5523{5515{
5524 char buf1[256], *pos;5516 char buf1[256], *pos;
5525 pos= strmov(buf1,"rand_seed1=");5517 pos= strmov(buf1,"rand_seed1=");
@@ -5643,7 +5635,7 @@
5643**************************************************************************/5635**************************************************************************/
56445636
5645#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)5637#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
5646void Xid_log_event::pack_info(Protocol *protocol)5638void Xid_log_event::pack_info(THD *thd, Protocol *protocol)
5647{5639{
5648 char buf[128], *pos;5640 char buf[128], *pos;
5649 pos= strmov(buf, "COMMIT /* xid=");5641 pos= strmov(buf, "COMMIT /* xid=");
@@ -5739,84 +5731,122 @@
5739**************************************************************************/5731**************************************************************************/
57405732
5741#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)5733#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
5742void User_var_log_event::pack_info(Protocol* protocol)5734static bool
5735user_var_append_name_part(THD *thd, String *buf,
5736 const char *name, size_t name_len)
5743{5737{
5744 char *buf= 0;5738 return buf->append("@") ||
5745 uint val_offset= 4 + name_len;5739 append_identifier(thd, buf, name, name_len) ||
5746 uint event_len= val_offset;5740 buf->append("=");
5741}
57475742
5743void User_var_log_event::pack_info(THD *thd, Protocol* protocol)
5744{
5748 if (is_null)5745 if (is_null)
5749 {5746 {
5750 if (!(buf= (char*) my_malloc(val_offset + 5, MYF(MY_WME))))5747 char buf_mem[FN_REFLEN+7];
5748 String buf(buf_mem, sizeof(buf_mem), system_charset_info);
5749 buf.length(0);
5750 if (user_var_append_name_part(thd, &buf, name, name_len) ||
5751 buf.append("NULL"))
5751 return;5752 return;
5752 strmov(buf + val_offset, "NULL");5753 protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
5753 event_len= val_offset + 4;
5754 }5754 }
5755 else5755 else
5756 {5756 {
5757 switch (type) {5757 switch (type) {
5758 case REAL_RESULT:5758 case REAL_RESULT:
5759 {
5759 double real_val;5760 double real_val;
5761 char buf2[MY_GCVT_MAX_FIELD_WIDTH + 1];
5762 char buf_mem[FN_REFLEN + MY_GCVT_MAX_FIELD_WIDTH + 1];
5763 String buf(buf_mem, sizeof(buf_mem), system_charset_info);
5760 float8get(real_val, val);5764 float8get(real_val, val);
5761 if (!(buf= (char*) my_malloc(val_offset + MY_GCVT_MAX_FIELD_WIDTH + 1,5765 my_gcvt(real_val, MY_GCVT_ARG_DOUBLE, MY_GCVT_MAX_FIELD_WIDTH,
5762 MYF(MY_WME))))5766 buf2, NULL);
5763 return;5767 buf.length(0);
5764 event_len+= my_gcvt(real_val, MY_GCVT_ARG_DOUBLE, MY_GCVT_MAX_FIELD_WIDTH,5768 if (user_var_append_name_part(thd, &buf, name, name_len) ||
5765 buf + val_offset, NULL);5769 buf.append(buf2))
5770 return;
5771 protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
5766 break;5772 break;
5773 }
5767 case INT_RESULT:5774 case INT_RESULT:
5768 if (!(buf= (char*) my_malloc(val_offset + 22, MYF(MY_WME))))5775 {
5776 char buf2[22];
5777 char buf_mem[FN_REFLEN + 22];
5778 String buf(buf_mem, sizeof(buf_mem), system_charset_info);
5779 buf.length(0);
5780 if (user_var_append_name_part(thd, &buf, name, name_len) ||
5781 buf.append(buf2,
5782 longlong10_to_str(uint8korr(val),
5783 buf2,
5784 (flags &
5785 User_var_log_event::UNSIGNED_F) ?
5786 10 : -10)
5787 -buf2))
5769 return;5788 return;
5770 event_len= longlong10_to_str(uint8korr(val), buf + val_offset, 5789 protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
5771 ((flags & User_var_log_event::UNSIGNED_F) ?
5772 10 : -10))-buf;
5773 break;5790 break;
5791 }
5774 case DECIMAL_RESULT:5792 case DECIMAL_RESULT:
5775 {5793 {
5776 if (!(buf= (char*) my_malloc(val_offset + DECIMAL_MAX_STR_LENGTH,5794 char buf_mem[FN_REFLEN + DECIMAL_MAX_STR_LENGTH];
5777 MYF(MY_WME))))5795 String buf(buf_mem, sizeof(buf_mem), system_charset_info);
5778 return;5796 char buf2[DECIMAL_MAX_STR_LENGTH+1];
5779 String str(buf+val_offset, DECIMAL_MAX_STR_LENGTH, &my_charset_bin);5797 String str(buf2, sizeof(buf2), &my_charset_bin);
5780 my_decimal dec;5798 my_decimal dec;
5799 buf.length(0);
5781 binary2my_decimal(E_DEC_FATAL_ERROR, (uchar*) (val+2), &dec, val[0],5800 binary2my_decimal(E_DEC_FATAL_ERROR, (uchar*) (val+2), &dec, val[0],
5782 val[1]);5801 val[1]);
5783 my_decimal2string(E_DEC_FATAL_ERROR, &dec, 0, 0, 0, &str);5802 my_decimal2string(E_DEC_FATAL_ERROR, &dec, 0, 0, 0, &str);
5784 event_len= str.length() + val_offset;5803 if (user_var_append_name_part(thd, &buf, name, name_len) ||
5804 buf.append(buf2))
5805 return;
5806 protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
5785 break;5807 break;
5786 } 5808 }
5787 case STRING_RESULT:5809 case STRING_RESULT:
5810 {
5788 /* 15 is for 'COLLATE' and other chars */5811 /* 15 is for 'COLLATE' and other chars */
5789 buf= (char*) my_malloc(event_len+val_len*2+1+2*MY_CS_NAME_SIZE+15,5812 char buf_mem[FN_REFLEN + 512 + 1 + 2*MY_CS_NAME_SIZE+15];
5790 MYF(MY_WME));5813 String buf(buf_mem, sizeof(buf_mem), system_charset_info);
5791 CHARSET_INFO *cs;5814 CHARSET_INFO *cs;
5792 if (!buf)5815 buf.length(0);
5793 return;
5794 if (!(cs= get_charset(charset_number, MYF(0))))5816 if (!(cs= get_charset(charset_number, MYF(0))))
5795 {5817 {
5796 strmov(buf+val_offset, "???");5818 if (buf.append("???"))
5797 event_len+= 3;5819 return;
5798 }5820 }
5799 else5821 else
5800 {5822 {
5801 char *p= strxmov(buf + val_offset, "_", cs->csname, " ", NullS);5823 size_t old_len;
5802 p= str_to_hex(p, val, val_len);5824 char *beg, *end;
5803 p= strxmov(p, " COLLATE ", cs->name, NullS);5825 if (user_var_append_name_part(thd, &buf, name, name_len) ||
5804 event_len= p-buf;5826 buf.append("_") ||
5827 buf.append(cs->csname) ||
5828 buf.append(" "))
5829 return;
5830 old_len= buf.length();
5831 if (buf.reserve(old_len + val_len*2 + 2 + sizeof(" COLLATE ") +
5832 MY_CS_NAME_SIZE))
5833 return;
5834 beg= const_cast<char *>(buf.ptr()) + old_len;
5835 end= str_to_hex(beg, val, val_len);
5836 buf.length(old_len + (end - beg));
5837 if (buf.append(" COLLATE ") ||
5838 buf.append(cs->name))
5839 return;
5805 }5840 }
5841 protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
5806 break;5842 break;
5843 }
5807 case ROW_RESULT:5844 case ROW_RESULT:
5808 default:5845 default:
5809 DBUG_ASSERT(1);5846 DBUG_ASSERT(1);
5810 return;5847 return;
5811 }5848 }
5812 }5849 }
5813 buf[0]= '@';
5814 buf[1]= '`';
5815 memcpy(buf+2, name, name_len);
5816 buf[2+name_len]= '`';
5817 buf[3+name_len]= '=';
5818 protocol->store(buf, event_len, &my_charset_bin);
5819 my_free(buf);
5820}5850}
5821#endif /* !MYSQL_CLIENT */5851#endif /* !MYSQL_CLIENT */
58225852
@@ -5960,9 +5990,14 @@
5960 my_b_printf(&cache, "\tUser_var\n");5990 my_b_printf(&cache, "\tUser_var\n");
5961 }5991 }
59625992
5963 my_b_printf(&cache, "SET @`");5993 QUOTED_IDENTIFIER(quoted_name,
5964 my_b_write(&cache, (uchar*) name, (uint) (name_len));5994 512,
5965 my_b_printf(&cache, "`");5995 '`',
5996 &my_charset_bin,
5997 name,
5998 name_len);
5999 my_b_printf(&cache, "SET @");
6000 my_b_printf(&cache, quoted_name.c_ptr());
59666001
5967 if (is_null)6002 if (is_null)
5968 {6003 {
@@ -6036,9 +6071,17 @@
6036 */6071 */
6037 my_b_printf(&cache, ":=???%s\n", print_event_info->delimiter);6072 my_b_printf(&cache, ":=???%s\n", print_event_info->delimiter);
6038 else6073 else
6039 my_b_printf(&cache, ":=_%s %s COLLATE `%s`%s\n",6074 {
6040 cs->csname, hex_str, cs->name,6075 QUOTED_IDENTIFIER(quoted_charset_name,
6076 512,
6077 '`',
6078 &my_charset_bin,
6079 cs->name,
6080 strlen(cs->name));
6081 my_b_printf(&cache, ":=_%s %s COLLATE %s%s\n",
6082 cs->csname, hex_str, quoted_charset_name.c_ptr(),
6041 print_event_info->delimiter);6083 print_event_info->delimiter);
6084 }
6042 my_afree(hex_str);6085 my_afree(hex_str);
6043 }6086 }
6044 break;6087 break;
@@ -6184,7 +6227,7 @@
6184#endif 6227#endif
61856228
6186#ifndef MYSQL_CLIENT6229#ifndef MYSQL_CLIENT
6187void Slave_log_event::pack_info(Protocol *protocol)6230void Slave_log_event::pack_info(THD *thd, Protocol *protocol)
6188{6231{
6189 char buf[256+HOSTNAME_LENGTH], *pos;6232 char buf[256+HOSTNAME_LENGTH], *pos;
6190 pos= strmov(buf, "host=");6233 pos= strmov(buf, "host=");
@@ -6566,7 +6609,7 @@
6566*/6609*/
65676610
6568#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)6611#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
6569void Create_file_log_event::pack_info(Protocol *protocol)6612void Create_file_log_event::pack_info(THD *thd, Protocol *protocol)
6570{6613{
6571 char buf[NAME_LEN*2 + 30 + 21*2], *pos;6614 char buf[NAME_LEN*2 + 30 + 21*2], *pos;
6572 pos= strmov(buf, "db=");6615 pos= strmov(buf, "db=");
@@ -6751,7 +6794,7 @@
6751*/6794*/
67526795
6753#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)6796#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
6754void Append_block_log_event::pack_info(Protocol *protocol)6797void Append_block_log_event::pack_info(THD *thd, Protocol *protocol)
6755{6798{
6756 char buf[256];6799 char buf[256];
6757 size_t length;6800 size_t length;
@@ -6908,7 +6951,7 @@
6908*/6951*/
69096952
6910#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)6953#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
6911void Delete_file_log_event::pack_info(Protocol *protocol)6954void Delete_file_log_event::pack_info(THD *thd, Protocol *protocol)
6912{6955{
6913 char buf[64];6956 char buf[64];
6914 size_t length;6957 size_t length;
@@ -7006,7 +7049,7 @@
7006*/7049*/
70077050
7008#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)7051#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
7009void Execute_load_log_event::pack_info(Protocol *protocol)7052void Execute_load_log_event::pack_info(THD *thd, Protocol *protocol)
7010{7053{
7011 char buf[64];7054 char buf[64];
7012 size_t length;7055 size_t length;
@@ -7267,27 +7310,26 @@
72677310
72687311
7269#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)7312#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
7270void Execute_load_query_log_event::pack_info(Protocol *protocol)7313void Execute_load_query_log_event::pack_info(THD *thd, Protocol *protocol)
7271{7314{
7272 char *buf, *pos;7315 char buf_mem[1024];
7273 if (!(buf= (char*) my_malloc(9 + db_len + q_len + 10 + 21, MYF(MY_WME))))7316 char file_id_buf[22];
7274 return;7317 String buf(buf_mem, sizeof(buf_mem), system_charset_info);
7275 pos= buf;7318 buf.real_alloc(9 + db_len + q_len + 10 + 21);
7276 if (db && db_len)7319 if (db && db_len)
7277 {7320 {
7278 pos= strmov(buf, "use `");7321 if (buf.append("use ") ||
7279 memcpy(pos, db, db_len);7322 append_identifier(thd, &buf, db, db_len) ||
7280 pos= strmov(pos+db_len, "`; ");7323 buf.append("; "))
7281 }7324 return;
7282 if (query && q_len)7325 }
7283 {7326 if (query && q_len && buf.append(query, q_len))
7284 memcpy(pos, query, q_len);7327 return;
7285 pos+= q_len;7328 int10_to_str((long) file_id, file_id_buf, 10);
7286 }7329 if (buf.append(" ;file_id=") ||
7287 pos= strmov(pos, " ;file_id=");7330 buf.append(file_id_buf))
7288 pos= int10_to_str((long) file_id, pos, 10);7331 return;
7289 protocol->store(buf, pos-buf, &my_charset_bin);7332 protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
7290 my_free(buf);
7291}7333}
72927334
72937335
@@ -8248,7 +8290,7 @@
8248#endif8290#endif
82498291
8250#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)8292#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
8251void Rows_log_event::pack_info(Protocol *protocol)8293void Rows_log_event::pack_info(THD *thd, Protocol *protocol)
8252{8294{
8253 char buf[256];8295 char buf[256];
8254 char const *const flagstr=8296 char const *const flagstr=
@@ -8851,7 +8893,7 @@
8851 */8893 */
88528894
8853#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)8895#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
8854void Table_map_log_event::pack_info(Protocol *protocol)8896void Table_map_log_event::pack_info(THD *thd, Protocol *protocol)
8855{8897{
8856 char buf[256];8898 char buf[256];
8857 size_t bytes= my_snprintf(buf, sizeof(buf),8899 size_t bytes= my_snprintf(buf, sizeof(buf),
@@ -8871,9 +8913,21 @@
8871 if (!print_event_info->short_form)8913 if (!print_event_info->short_form)
8872 {8914 {
8873 print_header(&print_event_info->head_cache, print_event_info, TRUE);8915 print_header(&print_event_info->head_cache, print_event_info, TRUE);
8916 QUOTED_IDENTIFIER(db_nam,
8917 512,
8918 '`',
8919 &my_charset_bin,
8920 m_dbnam,
8921 strlen(m_dbnam));
8922 QUOTED_IDENTIFIER(tbl_nam,
8923 512,
8924 '`',
8925 &my_charset_bin,
8926 m_tblnam,
8927 strlen(m_tblnam));
8874 my_b_printf(&print_event_info->head_cache,8928 my_b_printf(&print_event_info->head_cache,
8875 "\tTable_map: `%s`.`%s` mapped to number %lu\n",8929 "\tTable_map: %s.%s mapped to number %lu\n",
8876 m_dbnam, m_tblnam, m_table_id);8930 db_nam.c_ptr(), tbl_nam.c_ptr(), m_table_id);
8877 print_base64(&print_event_info->body_cache, print_event_info, TRUE);8931 print_base64(&print_event_info->body_cache, print_event_info, TRUE);
8878 }8932 }
8879}8933}
@@ -10142,7 +10196,7 @@
1014210196
1014310197
10144#ifndef MYSQL_CLIENT10198#ifndef MYSQL_CLIENT
10145void Incident_log_event::pack_info(Protocol *protocol)10199void Incident_log_event::pack_info(THD *thd, Protocol *protocol)
10146{10200{
10147 char buf[256];10201 char buf[256];
10148 size_t bytes;10202 size_t bytes;
1014910203
=== modified file 'Percona-Server/sql/log_event.h'
--- Percona-Server/sql/log_event.h 2012-09-17 13:08:32 +0000
+++ Percona-Server/sql/log_event.h 2012-10-10 20:41:51 +0000
@@ -1010,14 +1010,15 @@
1010 */1010 */
1011 static void init_show_field_list(List<Item>* field_list);1011 static void init_show_field_list(List<Item>* field_list);
1012#ifdef HAVE_REPLICATION1012#ifdef HAVE_REPLICATION
1013 int net_send(Protocol *protocol, const char* log_name, my_off_t pos);1013 int net_send(THD *thd, Protocol *protocol, const char* log_name,
1014 my_off_t pos);
10141015
1015 /*1016 /*
1016 pack_info() is used by SHOW BINLOG EVENTS; as print() it prepares and sends1017 pack_info() is used by SHOW BINLOG EVENTS; as print() it prepares and sends
1017 a string to display to the user, so it resembles print().1018 a string to display to the user, so it resembles print().
1018 */1019 */
10191020
1020 virtual void pack_info(Protocol *protocol);1021 virtual void pack_info(THD *thd, Protocol *protocol);
10211022
1022#endif /* HAVE_REPLICATION */1023#endif /* HAVE_REPLICATION */
1023 virtual const char* get_db()1024 virtual const char* get_db()
@@ -1723,7 +1724,7 @@
1723 bool using_trans, bool direct, bool suppress_use, int error);1724 bool using_trans, bool direct, bool suppress_use, int error);
1724 const char* get_db() { return db; }1725 const char* get_db() { return db; }
1725#ifdef HAVE_REPLICATION1726#ifdef HAVE_REPLICATION
1726 void pack_info(Protocol* protocol);1727 void pack_info(THD *thd, Protocol* protocol);
1727#endif /* HAVE_REPLICATION */1728#endif /* HAVE_REPLICATION */
1728#else1729#else
1729 void print_query_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info);1730 void print_query_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info);
@@ -1853,7 +1854,7 @@
18531854
1854#ifdef MYSQL_SERVER1855#ifdef MYSQL_SERVER
1855 Slave_log_event(THD* thd_arg, Relay_log_info* rli);1856 Slave_log_event(THD* thd_arg, Relay_log_info* rli);
1856 void pack_info(Protocol* protocol);1857 void pack_info(THD *thd, Protocol* protocol);
1857#else1858#else
1858 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);1859 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
1859#endif1860#endif
@@ -2086,9 +2087,11 @@
2086 const Format_description_log_event* description_event);2087 const Format_description_log_event* description_event);
20872088
2088public:2089public:
2089 uint get_query_buffer_length();2090#ifndef MYSQL_CLIENT
2090 void print_query(bool need_db, const char *cs, char *buf, char **end,2091 void print_query(THD *thd, bool need_db, const char *cs, String *buf,
2091 char **fn_start, char **fn_end);2092 my_off_t *fn_start, my_off_t *fn_end,
2093 const char *qualify_db);
2094#endif
2092 ulong thread_id;2095 ulong thread_id;
2093 ulong slave_proxy_id;2096 ulong slave_proxy_id;
2094 uint32 table_name_len;2097 uint32 table_name_len;
@@ -2149,7 +2152,7 @@
2149 Name_resolution_context *context);2152 Name_resolution_context *context);
2150 const char* get_db() { return db; }2153 const char* get_db() { return db; }
2151#ifdef HAVE_REPLICATION2154#ifdef HAVE_REPLICATION
2152 void pack_info(Protocol* protocol);2155 void pack_info(THD *thd, Protocol* protocol);
2153#endif /* HAVE_REPLICATION */2156#endif /* HAVE_REPLICATION */
2154#else2157#else
2155 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);2158 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
@@ -2248,7 +2251,7 @@
2248#ifdef MYSQL_SERVER2251#ifdef MYSQL_SERVER
2249 Start_log_event_v3();2252 Start_log_event_v3();
2250#ifdef HAVE_REPLICATION2253#ifdef HAVE_REPLICATION
2251 void pack_info(Protocol* protocol);2254 void pack_info(THD *thd, Protocol* protocol);
2252#endif /* HAVE_REPLICATION */2255#endif /* HAVE_REPLICATION */
2253#else2256#else
2254 Start_log_event_v3() {}2257 Start_log_event_v3() {}
@@ -2400,7 +2403,7 @@
2400 :Log_event(thd_arg,0,0),val(val_arg),type(type_arg)2403 :Log_event(thd_arg,0,0),val(val_arg),type(type_arg)
2401 {}2404 {}
2402#ifdef HAVE_REPLICATION2405#ifdef HAVE_REPLICATION
2403 void pack_info(Protocol* protocol);2406 void pack_info(THD *thd, Protocol* protocol);
2404#endif /* HAVE_REPLICATION */2407#endif /* HAVE_REPLICATION */
2405#else2408#else
2406 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);2409 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
@@ -2476,7 +2479,7 @@
2476 :Log_event(thd_arg,0,0),seed1(seed1_arg),seed2(seed2_arg)2479 :Log_event(thd_arg,0,0),seed1(seed1_arg),seed2(seed2_arg)
2477 {}2480 {}
2478#ifdef HAVE_REPLICATION2481#ifdef HAVE_REPLICATION
2479 void pack_info(Protocol* protocol);2482 void pack_info(THD *thd, Protocol* protocol);
2480#endif /* HAVE_REPLICATION */2483#endif /* HAVE_REPLICATION */
2481#else2484#else
2482 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);2485 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
@@ -2520,7 +2523,7 @@
2520#ifdef MYSQL_SERVER2523#ifdef MYSQL_SERVER
2521 Xid_log_event(THD* thd_arg, my_xid x): Log_event(thd_arg, 0, TRUE), xid(x) {}2524 Xid_log_event(THD* thd_arg, my_xid x): Log_event(thd_arg, 0, TRUE), xid(x) {}
2522#ifdef HAVE_REPLICATION2525#ifdef HAVE_REPLICATION
2523 void pack_info(Protocol* protocol);2526 void pack_info(THD *thd, Protocol* protocol);
2524#endif /* HAVE_REPLICATION */2527#endif /* HAVE_REPLICATION */
2525#else2528#else
2526 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);2529 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
@@ -2576,7 +2579,7 @@
2576 val_len(val_len_arg), type(type_arg), charset_number(charset_number_arg),2579 val_len(val_len_arg), type(type_arg), charset_number(charset_number_arg),
2577 flags(flags_arg), deferred(false)2580 flags(flags_arg), deferred(false)
2578 { is_null= !val; }2581 { is_null= !val; }
2579 void pack_info(Protocol* protocol);2582 void pack_info(THD *thd, Protocol* protocol);
2580#else2583#else
2581 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);2584 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2582#endif2585#endif
@@ -2714,7 +2717,7 @@
2714 uint ident_len_arg,2717 uint ident_len_arg,
2715 ulonglong pos_arg, uint flags);2718 ulonglong pos_arg, uint flags);
2716#ifdef HAVE_REPLICATION2719#ifdef HAVE_REPLICATION
2717 void pack_info(Protocol* protocol);2720 void pack_info(THD *thd, Protocol* protocol);
2718#endif /* HAVE_REPLICATION */2721#endif /* HAVE_REPLICATION */
2719#else2722#else
2720 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);2723 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
@@ -2775,7 +2778,7 @@
2775 uchar* block_arg, uint block_len_arg,2778 uchar* block_arg, uint block_len_arg,
2776 bool using_trans);2779 bool using_trans);
2777#ifdef HAVE_REPLICATION2780#ifdef HAVE_REPLICATION
2778 void pack_info(Protocol* protocol);2781 void pack_info(THD *thd, Protocol* protocol);
2779#endif /* HAVE_REPLICATION */2782#endif /* HAVE_REPLICATION */
2780#else2783#else
2781 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);2784 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
@@ -2847,7 +2850,7 @@
2847 Append_block_log_event(THD* thd, const char* db_arg, uchar* block_arg,2850 Append_block_log_event(THD* thd, const char* db_arg, uchar* block_arg,
2848 uint block_len_arg, bool using_trans);2851 uint block_len_arg, bool using_trans);
2849#ifdef HAVE_REPLICATION2852#ifdef HAVE_REPLICATION
2850 void pack_info(Protocol* protocol);2853 void pack_info(THD *thd, Protocol* protocol);
2851 virtual int get_create_or_append() const;2854 virtual int get_create_or_append() const;
2852#endif /* HAVE_REPLICATION */2855#endif /* HAVE_REPLICATION */
2853#else2856#else
@@ -2888,7 +2891,7 @@
2888#ifdef MYSQL_SERVER2891#ifdef MYSQL_SERVER
2889 Delete_file_log_event(THD* thd, const char* db_arg, bool using_trans);2892 Delete_file_log_event(THD* thd, const char* db_arg, bool using_trans);
2890#ifdef HAVE_REPLICATION2893#ifdef HAVE_REPLICATION
2891 void pack_info(Protocol* protocol);2894 void pack_info(THD *thd, Protocol* protocol);
2892#endif /* HAVE_REPLICATION */2895#endif /* HAVE_REPLICATION */
2893#else2896#else
2894 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);2897 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
@@ -2929,7 +2932,7 @@
2929#ifdef MYSQL_SERVER2932#ifdef MYSQL_SERVER
2930 Execute_load_log_event(THD* thd, const char* db_arg, bool using_trans);2933 Execute_load_log_event(THD* thd, const char* db_arg, bool using_trans);
2931#ifdef HAVE_REPLICATION2934#ifdef HAVE_REPLICATION
2932 void pack_info(Protocol* protocol);2935 void pack_info(THD *thd, Protocol* protocol);
2933#endif /* HAVE_REPLICATION */2936#endif /* HAVE_REPLICATION */
2934#else2937#else
2935 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);2938 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
@@ -3025,7 +3028,7 @@
3025 bool using_trans, bool direct,3028 bool using_trans, bool direct,
3026 bool suppress_use, int errcode);3029 bool suppress_use, int errcode);
3027#ifdef HAVE_REPLICATION3030#ifdef HAVE_REPLICATION
3028 void pack_info(Protocol* protocol);3031 void pack_info(THD *thd, Protocol* protocol);
3029#endif /* HAVE_REPLICATION */3032#endif /* HAVE_REPLICATION */
3030#else3033#else
3031 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);3034 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
@@ -3470,7 +3473,7 @@
3470#endif3473#endif
34713474
3472#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)3475#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
3473 virtual void pack_info(Protocol *protocol);3476 virtual void pack_info(THD *thd, Protocol *protocol);
3474#endif3477#endif
34753478
3476#ifdef MYSQL_CLIENT3479#ifdef MYSQL_CLIENT
@@ -3582,7 +3585,7 @@
3582 flag_set get_flags(flag_set flags_arg) const { return m_flags & flags_arg; }3585 flag_set get_flags(flag_set flags_arg) const { return m_flags & flags_arg; }
35833586
3584#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)3587#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
3585 virtual void pack_info(Protocol *protocol);3588 virtual void pack_info(THD *thd, Protocol *protocol);
3586#endif3589#endif
35873590
3588#ifdef MYSQL_CLIENT3591#ifdef MYSQL_CLIENT
@@ -4021,7 +4024,7 @@
4021#endif4024#endif
40224025
4023#ifdef MYSQL_SERVER4026#ifdef MYSQL_SERVER
4024 void pack_info(Protocol*);4027 void pack_info(THD *thd, Protocol*);
4025#endif4028#endif
40264029
4027 Incident_log_event(const char *buf, uint event_len,4030 Incident_log_event(const char *buf, uint event_len,
40284031
=== modified file 'Percona-Server/sql/log_event_old.cc'
--- Percona-Server/sql/log_event_old.cc 2012-05-07 20:20:42 +0000
+++ Percona-Server/sql/log_event_old.cc 2012-10-10 20:41:51 +0000
@@ -1926,7 +1926,7 @@
19261926
19271927
1928#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)1928#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
1929void Old_rows_log_event::pack_info(Protocol *protocol)1929void Old_rows_log_event::pack_info(THD *thd, Protocol *protocol)
1930{1930{
1931 char buf[256];1931 char buf[256];
1932 char const *const flagstr=1932 char const *const flagstr=
19331933
=== modified file 'Percona-Server/sql/log_event_old.h'
--- Percona-Server/sql/log_event_old.h 2007-12-05 19:00:14 +0000
+++ Percona-Server/sql/log_event_old.h 2012-10-10 20:41:51 +0000
@@ -108,7 +108,7 @@
108 flag_set get_flags(flag_set flags_arg) const { return m_flags & flags_arg; }108 flag_set get_flags(flag_set flags_arg) const { return m_flags & flags_arg; }
109109
110#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)110#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
111 virtual void pack_info(Protocol *protocol);111 virtual void pack_info(THD *thd, Protocol *protocol);
112#endif112#endif
113113
114#ifdef MYSQL_CLIENT114#ifdef MYSQL_CLIENT
115115
=== modified file 'Percona-Server/sql/sql_base.cc'
--- Percona-Server/sql/sql_base.cc 2012-09-17 13:08:32 +0000
+++ Percona-Server/sql/sql_base.cc 2012-10-10 20:41:51 +0000
@@ -3855,22 +3855,22 @@
3855 entry->file->implicit_emptied= 0;3855 entry->file->implicit_emptied= 0;
3856 if (mysql_bin_log.is_open())3856 if (mysql_bin_log.is_open())
3857 {3857 {
3858 char *query, *end;3858 char query_buf[2*FN_REFLEN + 21];
3859 uint query_buf_size= 20 + share->db.length + share->table_name.length +1;3859 String query(query_buf, sizeof(query_buf), system_charset_info);
3860 if ((query= (char*) my_malloc(query_buf_size,MYF(MY_WME))))3860 query.length(0);
3861 if (query.ptr())
3861 {3862 {
3862 /* this DELETE FROM is needed even with row-based binlogging */3863 /* this DELETE FROM is needed even with row-based binlogging */
3863 end = strxmov(strmov(query, "DELETE FROM `"),3864 query.append("DELETE FROM ");
3864 share->db.str,"`.`",share->table_name.str,"`", NullS);3865 append_identifier(thd, &query, share->db.str, share->db.length);
3866 query.append(".");
3867 append_identifier(thd, &query, share->table_name.str,
3868 share->table_name.length);
3865 int errcode= query_error_code(thd, TRUE);3869 int errcode= query_error_code(thd, TRUE);
3866 if (thd->binlog_query(THD::STMT_QUERY_TYPE,3870 if (thd->binlog_query(THD::STMT_QUERY_TYPE,
3867 query, (ulong)(end-query),3871 query.ptr(), query.length(),
3868 FALSE, FALSE, FALSE, errcode))3872 FALSE, FALSE, FALSE, errcode))
3869 {3873 return FALSE;
3870 my_free(query);
3871 return TRUE;
3872 }
3873 my_free(query);
3874 }3874 }
3875 else3875 else
3876 {3876 {
@@ -3879,9 +3879,20 @@
3879 DBA on top of warning the client (which will automatically be done3879 DBA on top of warning the client (which will automatically be done
3880 because of MYF(MY_WME) in my_malloc() above).3880 because of MYF(MY_WME) in my_malloc() above).
3881 */3881 */
3882 char q_db_c[512];
3883 char q_table_name_c[512];
3884 String q_db(q_db_c, sizeof(q_db_c), system_charset_info);
3885 String q_table_name(q_table_name_c, sizeof(q_table_name), system_charset_info);
3886 q_db.length(0);
3887 q_table_name.length(0);
3888 append_identifier(thd, &q_db, share->db.str, share->db.length);
3889 append_identifier(thd,
3890 &q_table_name,
3891 share->table_name.str,
3892 share->table_name.length);
3882 sql_print_error("When opening HEAP table, could not allocate memory "3893 sql_print_error("When opening HEAP table, could not allocate memory "
3883 "to write 'DELETE FROM `%s`.`%s`' to the binary log",3894 "to write 'DELETE FROM %s.%s' to the binary log",
3884 share->db.str, share->table_name.str);3895 q_db.c_ptr(), q_table_name.c_ptr());
3885 delete entry->triggers;3896 delete entry->triggers;
3886 return TRUE;3897 return TRUE;
3887 }3898 }
38883899
=== modified file 'Percona-Server/sql/sql_db.cc'
--- Percona-Server/sql/sql_db.cc 2011-07-03 23:48:19 +0000
+++ Percona-Server/sql/sql_db.cc 2012-10-10 20:41:51 +0000
@@ -542,7 +542,6 @@
542 bool silent)542 bool silent)
543{543{
544 char path[FN_REFLEN+16];544 char path[FN_REFLEN+16];
545 char tmp_query[FN_REFLEN+16];
546 long result= 1;545 long result= 1;
547 int error= 0;546 int error= 0;
548 MY_STAT stat_info;547 MY_STAT stat_info;
@@ -620,17 +619,9 @@
620 char *query;619 char *query;
621 uint query_length;620 uint query_length;
622621
623 if (!thd->query()) // Only in replication622 query= thd->query();
624 {623 query_length= thd->query_length();
625 query= tmp_query;624 DBUG_ASSERT(query);
626 query_length= (uint) (strxmov(tmp_query,"create database `",
627 db, "`", NullS) - tmp_query);
628 }
629 else
630 {
631 query= thd->query();
632 query_length= thd->query_length();
633 }
634625
635 ha_binlog_log_query(thd, 0, LOGCOM_CREATE_DB,626 ha_binlog_log_query(thd, 0, LOGCOM_CREATE_DB,
636 query, query_length,627 query, query_length,
@@ -883,18 +874,11 @@
883 {874 {
884 const char *query;875 const char *query;
885 ulong query_length;876 ulong query_length;
886 if (!thd->query())877
887 {878 query= thd->query();
888 /* The client used the old obsolete mysql_drop_db() call */879 query_length= thd->query_length();
889 query= path;880 DBUG_ASSERT(query);
890 query_length= (uint) (strxmov(path, "drop database `", db, "`",881
891 NullS) - path);
892 }
893 else
894 {
895 query= thd->query();
896 query_length= thd->query_length();
897 }
898 if (mysql_bin_log.is_open())882 if (mysql_bin_log.is_open())
899 {883 {
900 int errcode= query_error_code(thd, TRUE);884 int errcode= query_error_code(thd, TRUE);
@@ -948,8 +932,16 @@
948 if (exists)932 if (exists)
949 continue;933 continue;
950934
951 /* 3 for the quotes and the comma*/935 char quoted_name_c[FN_REFLEN+3];
952 tbl_name_len= strlen(tbl->table_name) + 3;936 String quoted_name(quoted_name_c,
937 sizeof(quoted_name_c),
938 system_charset_info);
939 quoted_name.length(0);
940 quoted_name.append_identifier(tbl->table_name,
941 strlen(tbl->table_name),
942 system_charset_info,
943 '`');
944 tbl_name_len= quoted_name.length() + 1; /* +1 for the comma */
953 if (query_pos + tbl_name_len + 1 >= query_end)945 if (query_pos + tbl_name_len + 1 >= query_end)
954 {946 {
955 /*947 /*
@@ -964,9 +956,7 @@
964 query_pos= query_data_start;956 query_pos= query_data_start;
965 }957 }
966958
967 *query_pos++ = '`';959 query_pos= strmov(query_pos, quoted_name.c_ptr());
968 query_pos= strmov(query_pos,tbl->table_name);
969 *query_pos++ = '`';
970 *query_pos++ = ',';960 *query_pos++ = ',';
971 }961 }
972962
973963
=== modified file 'Percona-Server/sql/sql_load.cc'
--- Percona-Server/sql/sql_load.cc 2012-02-16 09:48:16 +0000
+++ Percona-Server/sql/sql_load.cc 2012-10-10 20:41:51 +0000
@@ -38,6 +38,7 @@
38#include "sql_repl.h"38#include "sql_repl.h"
39#include "sp_head.h"39#include "sp_head.h"
40#include "sql_trigger.h"40#include "sql_trigger.h"
41#include "sql_show.h"
4142
42class XML_TAG {43class XML_TAG {
43public:44public:
@@ -665,20 +666,28 @@
665 bool transactional_table,666 bool transactional_table,
666 int errcode)667 int errcode)
667{668{
668 char *load_data_query,669 char *load_data_query;
669 *end,670 my_off_t fname_start,
670 *fname_start,671 fname_end;
671 *fname_end,
672 *p= NULL;
673 size_t pl= 0;
674 List<Item> fv;672 List<Item> fv;
675 Item *item, *val;673 Item *item, *val;
676 String pfield, pfields;
677 int n;674 int n;
678 const char *tbl= table_name_arg;
679 const char *tdb= (thd->db != NULL ? thd->db : db_arg);675 const char *tdb= (thd->db != NULL ? thd->db : db_arg);
680 String string_buf;676 const char *qualify_db= NULL;
681677 char command_buffer[1024];
678 String query_str(command_buffer, sizeof(command_buffer),
679 system_charset_info);
680
681 Load_log_event lle(thd, ex, tdb, table_name_arg, fv, is_concurrent,
682 duplicates, ignore, transactional_table);
683
684 /*
685 force in a LOCAL if there was one in the original.
686 */
687 if (thd->lex->local_file)
688 lle.set_fname_outside_temp_buf(ex->file_name, strlen(ex->file_name));
689
690 query_str.length(0);
682 if (!thd->db || strcmp(db_arg, thd->db)) 691 if (!thd->db || strcmp(db_arg, thd->db))
683 {692 {
684 /*693 /*
@@ -686,23 +695,10 @@
686 prefix table name with database name so that it 695 prefix table name with database name so that it
687 becomes a FQ name.696 becomes a FQ name.
688 */697 */
689 string_buf.set_charset(system_charset_info);698 qualify_db= db_arg;
690 string_buf.append(db_arg);
691 string_buf.append("`");
692 string_buf.append(".");
693 string_buf.append("`");
694 string_buf.append(table_name_arg);
695 tbl= string_buf.c_ptr_safe();
696 }699 }
697700 lle.print_query(thd, FALSE, (const char *) ex->cs?ex->cs->csname:NULL,
698 Load_log_event lle(thd, ex, tdb, tbl, fv, is_concurrent,701 &query_str, &fname_start, &fname_end, qualify_db);
699 duplicates, ignore, transactional_table);
700
701 /*
702 force in a LOCAL if there was one in the original.
703 */
704 if (thd->lex->local_file)
705 lle.set_fname_outside_temp_buf(ex->file_name, strlen(ex->file_name));
706702
707 /*703 /*
708 prepare fields-list and SET if needed; print_query won't do that for us.704 prepare fields-list and SET if needed; print_query won't do that for us.
@@ -711,23 +707,23 @@
711 {707 {
712 List_iterator<Item> li(thd->lex->field_list);708 List_iterator<Item> li(thd->lex->field_list);
713709
714 pfields.append(" (");710 query_str.append(" (");
715 n= 0;711 n= 0;
716712
717 while ((item= li++))713 while ((item= li++))
718 {714 {
719 if (n++)715 if (n++)
720 pfields.append(", ");716 query_str.append(", ");
721 if (item->type() == Item::FIELD_ITEM)717 if (item->type() == Item::FIELD_ITEM)
718 append_identifier(thd, &query_str, item->name, strlen(item->name));
719 else
722 {720 {
723 pfields.append("`");721 /* Actually Item_user_var_as_out_param despite claiming STRING_ITEM. */
724 pfields.append(item->name);722 DBUG_ASSERT(item->type() == Item::STRING_ITEM);
725 pfields.append("`");723 ((Item_user_var_as_out_param *)item)->print_for_load(thd, &query_str);
726 }724 }
727 else
728 item->print(&pfields, QT_ORDINARY);
729 }725 }
730 pfields.append(")");726 query_str.append(")");
731 }727 }
732728
733 if (!thd->lex->update_list.is_empty())729 if (!thd->lex->update_list.is_empty())
@@ -735,38 +731,25 @@
735 List_iterator<Item> lu(thd->lex->update_list);731 List_iterator<Item> lu(thd->lex->update_list);
736 List_iterator<Item> lv(thd->lex->value_list);732 List_iterator<Item> lv(thd->lex->value_list);
737733
738 pfields.append(" SET ");734 query_str.append(" SET ");
739 n= 0;735 n= 0;
740736
741 while ((item= lu++))737 while ((item= lu++))
742 {738 {
743 val= lv++;739 val= lv++;
744 if (n++)740 if (n++)
745 pfields.append(", ");741 query_str.append(", ");
746 pfields.append("`");742 append_identifier(thd, &query_str, item->name, strlen(item->name));
747 pfields.append(item->name);743 query_str.append(val->name);
748 pfields.append("`");
749 pfields.append(val->name);
750 }744 }
751 }745 }
752746
753 p= pfields.c_ptr_safe();747 if (!(load_data_query= (char *)thd->strmake(query_str.ptr(), query_str.length())))
754 pl= strlen(p);
755
756 if (!(load_data_query= (char *)thd->alloc(lle.get_query_buffer_length() + 1 + pl)))
757 return TRUE;748 return TRUE;
758749
759 lle.print_query(FALSE, (const char *) ex->cs?ex->cs->csname:NULL,
760 load_data_query, &end,
761 (char **)&fname_start, (char **)&fname_end);
762
763 strcpy(end, p);
764 end += pl;
765
766 Execute_load_query_log_event750 Execute_load_query_log_event
767 e(thd, load_data_query, end-load_data_query,751 e(thd, load_data_query, query_str.length(),
768 (uint) ((char*) fname_start - load_data_query - 1),752 (uint) (fname_start - 1), (uint) fname_end,
769 (uint) ((char*) fname_end - load_data_query),
770 (duplicates == DUP_REPLACE) ? LOAD_DUP_REPLACE :753 (duplicates == DUP_REPLACE) ? LOAD_DUP_REPLACE :
771 (ignore ? LOAD_DUP_IGNORE : LOAD_DUP_ERROR),754 (ignore ? LOAD_DUP_IGNORE : LOAD_DUP_ERROR),
772 transactional_table, FALSE, FALSE, errcode);755 transactional_table, FALSE, FALSE, errcode);
773756
=== modified file 'Percona-Server/sql/sql_repl.cc'
--- Percona-Server/sql/sql_repl.cc 2012-09-17 13:08:32 +0000
+++ Percona-Server/sql/sql_repl.cc 2012-10-10 20:41:51 +0000
@@ -1849,7 +1849,7 @@
1849 description_event)); )1849 description_event)); )
1850 {1850 {
1851 if (event_count >= limit_start &&1851 if (event_count >= limit_start &&
1852 ev->net_send(protocol, linfo.log_file_name, pos))1852 ev->net_send(thd, protocol, linfo.log_file_name, pos))
1853 {1853 {
1854 errmsg = "Net error";1854 errmsg = "Net error";
1855 delete ev;1855 delete ev;
18561856
=== modified file 'Percona-Server/sql/sql_select.cc'
--- Percona-Server/sql/sql_select.cc 2012-09-17 13:08:32 +0000
+++ Percona-Server/sql/sql_select.cc 2012-10-10 20:41:51 +0000
@@ -48,6 +48,7 @@
48#include "filesort.h" // filesort_free_buffers48#include "filesort.h" // filesort_free_buffers
49#include "sql_union.h" // mysql_union49#include "sql_union.h" // mysql_union
50#include "debug_sync.h" // DEBUG_SYNC50#include "debug_sync.h" // DEBUG_SYNC
51#include "sql_string.h"
51#include <m_ctype.h>52#include <m_ctype.h>
52#include <my_bit.h>53#include <my_bit.h>
53#include <hash.h>54#include <hash.h>
@@ -12125,8 +12126,16 @@
12125 */12126 */
12126 if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT12127 if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT
12127 && !table->in_use->killed)12128 && !table->in_use->killed)
12128 sql_print_error("Got error %d when reading table '%s'",12129 {
12129 error, table->s->path.str);12130 QUOTED_IDENTIFIER(tbl_nam,
12131 512,
12132 '`',
12133 &my_charset_bin,
12134 table->s->path.str,
12135 table->s->path.length);
12136 sql_print_error("Got error %d when reading table %s",
12137 error, tbl_nam.c_ptr());
12138 }
12130 table->file->print_error(error,MYF(0));12139 table->file->print_error(error,MYF(0));
12131 return 1;12140 return 1;
12132}12141}
1213312142
=== modified file 'Percona-Server/sql/sql_show.cc'
--- Percona-Server/sql/sql_show.cc 2012-09-17 13:08:32 +0000
+++ Percona-Server/sql/sql_show.cc 2012-10-10 20:41:51 +0000
@@ -984,48 +984,17 @@
984 packet target string984 packet target string
985 name the identifier to be appended985 name the identifier to be appended
986 name_length length of the appending identifier986 name_length length of the appending identifier
987
988 RETURN VALUES
989 true Error
990 false Ok
987*/991*/
988992
989void993bool
990append_identifier(THD *thd, String *packet, const char *name, uint length)994append_identifier(THD *thd, String *packet, const char *name, uint length)
991{995{
992 const char *name_end;
993 char quote_char;
994 int q= get_quote_char_for_identifier(thd, name, length);996 int q= get_quote_char_for_identifier(thd, name, length);
995997 return packet->append_identifier(name, length, system_charset_info, q);
996 if (q == EOF)
997 {
998 packet->append(name, length, packet->charset());
999 return;
1000 }
1001
1002 /*
1003 The identifier must be quoted as it includes a quote character or
1004 it's a keyword
1005 */
1006
1007 (void) packet->reserve(length*2 + 2);
1008 quote_char= (char) q;
1009 packet->append(&quote_char, 1, system_charset_info);
1010
1011 for (name_end= name+length ; name < name_end ; name+= length)
1012 {
1013 uchar chr= (uchar) *name;
1014 length= my_mbcharlen(system_charset_info, chr);
1015 /*
1016 my_mbcharlen can return 0 on a wrong multibyte
1017 sequence. It is possible when upgrading from 4.0,
1018 and identifier contains some accented characters.
1019 The manual says it does not work. So we'll just
1020 change length to 1 not to hang in the endless loop.
1021 */
1022 if (!length)
1023 length= 1;
1024 if (length == 1 && chr == (uchar) quote_char)
1025 packet->append(&quote_char, 1, system_charset_info);
1026 packet->append(name, length, system_charset_info);
1027 }
1028 packet->append(&quote_char, 1, system_charset_info);
1029}998}
1030999
10311000
10321001
=== modified file 'Percona-Server/sql/sql_show.h'
--- Percona-Server/sql/sql_show.h 2011-06-30 15:46:53 +0000
+++ Percona-Server/sql/sql_show.h 2012-10-10 20:41:51 +0000
@@ -90,7 +90,7 @@
9090
91int copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table);91int copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table);
9292
93void append_identifier(THD *thd, String *packet, const char *name,93bool append_identifier(THD *thd, String *packet, const char *name,
94 uint length);94 uint length);
95void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild);95void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild);
96int mysqld_dump_create_info(THD *thd, TABLE_LIST *table_list, int fd);96int mysqld_dump_create_info(THD *thd, TABLE_LIST *table_list, int fd);
9797
=== modified file 'Percona-Server/sql/sql_string.cc'
--- Percona-Server/sql/sql_string.cc 2012-05-10 07:49:14 +0000
+++ Percona-Server/sql/sql_string.cc 2012-10-10 20:41:51 +0000
@@ -519,6 +519,49 @@
519 return FALSE;519 return FALSE;
520}520}
521521
522bool String::append_identifier(const char *name,
523 uint length,
524 CHARSET_INFO *ci,
525 int quote_char)
526{
527 const char *name_end;
528 char q= (char)quote_char;
529 CHARSET_INFO *lci = ci ? ci : charset();
530
531 if (quote_char == EOF)
532 return append(name, length, charset());
533
534 /*
535 The identifier must be quoted as it includes a quote character or
536 it's a keyword
537 */
538
539 (void)reserve(length*2 + 2);
540 if (append(&q, 1, lci))
541 return true;
542
543 for (name_end= name+length ; name < name_end ; name+= length)
544 {
545 uchar chr= (uchar) *name;
546 length= my_mbcharlen(lci, chr);
547 /*
548 my_mbcharlen can return 0 on a wrong multibyte
549 sequence. It is possible when upgrading from 4.0,
550 and identifier contains some accented characters.
551 The manual says it does not work. So we'll just
552 change length to 1 not to hang in the endless loop.
553 */
554 if (!length)
555 length= 1;
556 if (length == 1 && chr == (uchar) q &&
557 append(&q, 1, lci))
558 return true;
559 if (append(name, length, lci))
560 return true;
561 }
562 return append(&q, 1, lci);
563}
564
522uint32 String::numchars()565uint32 String::numchars()
523{566{
524 return str_charset->cset->numchars(str_charset, Ptr, Ptr+str_length);567 return str_charset->cset->numchars(str_charset, Ptr, Ptr+str_length);
@@ -1120,39 +1163,47 @@
11201163
11211164
11221165
11231166/*
1124void String::print(String *str)1167 Append characters to a single-quoted string '...', escaping special
1168 characters as necessary.
1169 Does not add the enclosing quotes, this is left up to caller.
1170*/
1171void String::append_for_single_quote(const char *st, uint len)
1125{1172{
1126 char *st= (char*)Ptr, *end= st+str_length;1173 const char *end= st+len;
1127 for (; st < end; st++)1174 for (; st < end; st++)
1128 {1175 {
1129 uchar c= *st;1176 uchar c= *st;
1130 switch (c)1177 switch (c)
1131 {1178 {
1132 case '\\':1179 case '\\':
1133 str->append(STRING_WITH_LEN("\\\\"));1180 append(STRING_WITH_LEN("\\\\"));
1134 break;1181 break;
1135 case '\0':1182 case '\0':
1136 str->append(STRING_WITH_LEN("\\0"));1183 append(STRING_WITH_LEN("\\0"));
1137 break;1184 break;
1138 case '\'':1185 case '\'':
1139 str->append(STRING_WITH_LEN("\\'"));1186 append(STRING_WITH_LEN("\\'"));
1140 break;1187 break;
1141 case '\n':1188 case '\n':
1142 str->append(STRING_WITH_LEN("\\n"));1189 append(STRING_WITH_LEN("\\n"));
1143 break;1190 break;
1144 case '\r':1191 case '\r':
1145 str->append(STRING_WITH_LEN("\\r"));1192 append(STRING_WITH_LEN("\\r"));
1146 break;1193 break;
1147 case '\032': // Ctrl-Z1194 case '\032': // Ctrl-Z
1148 str->append(STRING_WITH_LEN("\\Z"));1195 append(STRING_WITH_LEN("\\Z"));
1149 break;1196 break;
1150 default:1197 default:
1151 str->append(c);1198 append(c);
1152 }1199 }
1153 }1200 }
1154}1201}
11551202
1203void String::print(String *str)
1204{
1205 str->append_for_single_quote(Ptr, str_length);
1206}
11561207
1157/*1208/*
1158 Exchange state of this object and argument.1209 Exchange state of this object and argument.
11591210
=== modified file 'Percona-Server/sql/sql_string.h'
--- Percona-Server/sql/sql_string.h 2012-05-10 07:49:14 +0000
+++ Percona-Server/sql/sql_string.h 2012-10-10 20:41:51 +0000
@@ -26,6 +26,12 @@
26#include "my_sys.h" /* alloc_root, my_free, my_realloc */26#include "my_sys.h" /* alloc_root, my_free, my_realloc */
27#include "m_string.h" /* TRASH */27#include "m_string.h" /* TRASH */
2828
29#define QUOTED_IDENTIFIER(str_name, buf_size, q, cs, id_name, id_size) \
30 char buf_##str_name[(buf_size)]; \
31 String str_name((buf_##str_name), (buf_size), (cs)); \
32 str_name.length(0); \
33 str_name.append_identifier((id_name), (id_size), (cs), (q));
34
29class String;35class String;
30typedef struct charset_info_st CHARSET_INFO;36typedef struct charset_info_st CHARSET_INFO;
31typedef struct st_io_cache IO_CACHE;37typedef struct st_io_cache IO_CACHE;
@@ -292,6 +298,10 @@
292 bool append(IO_CACHE* file, uint32 arg_length);298 bool append(IO_CACHE* file, uint32 arg_length);
293 bool append_with_prefill(const char *s, uint32 arg_length, 299 bool append_with_prefill(const char *s, uint32 arg_length,
294 uint32 full_length, char fill_char);300 uint32 full_length, char fill_char);
301 bool append_identifier(const char *name,
302 uint length,
303 CHARSET_INFO *ci,
304 int quote_char);
295 int strstr(const String &search,uint32 offset=0); // Returns offset to substring or -1305 int strstr(const String &search,uint32 offset=0); // Returns offset to substring or -1
296 int strrstr(const String &search,uint32 offset=0); // Returns offset to substring or -1306 int strrstr(const String &search,uint32 offset=0); // Returns offset to substring or -1
297 bool replace(uint32 offset,uint32 arg_length,const char *to,uint32 length);307 bool replace(uint32 offset,uint32 arg_length,const char *to,uint32 length);
@@ -395,6 +405,7 @@
395 return FALSE;405 return FALSE;
396 }406 }
397 void print(String *print);407 void print(String *print);
408 void append_for_single_quote(const char *st, uint len);
398409
399 /* Swap two string objects. Efficient way to exchange data without memcpy. */410 /* Swap two string objects. Efficient way to exchange data without memcpy. */
400 void swap(String &s);411 void swap(String &s);
401412
=== modified file 'Percona-Server/sql/sql_table.cc'
--- Percona-Server/sql/sql_table.cc 2012-08-07 06:10:00 +0000
+++ Percona-Server/sql/sql_table.cc 2012-10-10 20:41:51 +0000
@@ -2053,6 +2053,7 @@
2053 {2053 {
2054 bool is_trans;2054 bool is_trans;
2055 char *db=table->db;2055 char *db=table->db;
2056 size_t db_length= table->db_length;
2056 handlerton *table_type;2057 handlerton *table_type;
2057 enum legacy_db_type frm_db_type= DB_TYPE_UNKNOWN;2058 enum legacy_db_type frm_db_type= DB_TYPE_UNKNOWN;
20582059
@@ -2114,14 +2115,14 @@
2114 Don't write the database name if it is the current one (or if2115 Don't write the database name if it is the current one (or if
2115 thd->db is NULL).2116 thd->db is NULL).
2116 */2117 */
2117 built_ptr_query->append("`");
2118 if (thd->db == NULL || strcmp(db,thd->db) != 0)2118 if (thd->db == NULL || strcmp(db,thd->db) != 0)
2119 {2119 {
2120 built_ptr_query->append(db);2120 append_identifier(thd, built_ptr_query, db, db_length);
2121 built_ptr_query->append("`.`");2121 built_ptr_query->append(".");
2122 }2122 }
2123 built_ptr_query->append(table->table_name);2123 append_identifier(thd, built_ptr_query, table->table_name,
2124 built_ptr_query->append("`,");2124 table->table_name_length);
2125 built_ptr_query->append(",");
2125 }2126 }
2126 /*2127 /*
2127 This means that a temporary table was droped and as such there2128 This means that a temporary table was droped and as such there
@@ -2180,15 +2181,15 @@
2180 Don't write the database name if it is the current one (or if2181 Don't write the database name if it is the current one (or if
2181 thd->db is NULL).2182 thd->db is NULL).
2182 */2183 */
2183 built_query.append("`");
2184 if (thd->db == NULL || strcmp(db,thd->db) != 0)2184 if (thd->db == NULL || strcmp(db,thd->db) != 0)
2185 {2185 {
2186 built_query.append(db);2186 append_identifier(thd, &built_query, db, db_length);
2187 built_query.append("`.`");2187 built_query.append(".");
2188 }2188 }
21892189
2190 built_query.append(table->table_name);2190 append_identifier(thd, &built_query, table->table_name,
2191 built_query.append("`,");2191 table->table_name_length);
2192 built_query.append(",");
2192 }2193 }
2193 }2194 }
2194 DEBUG_SYNC(thd, "rm_table_no_locks_before_delete_table");2195 DEBUG_SYNC(thd, "rm_table_no_locks_before_delete_table");
21952196
=== modified file 'Percona-Server/sql/sql_truncate.cc'
--- Percona-Server/sql/sql_truncate.cc 2011-03-07 09:08:10 +0000
+++ Percona-Server/sql/sql_truncate.cc 2012-10-10 20:41:51 +0000
@@ -24,6 +24,7 @@
24#include "sql_acl.h" // DROP_ACL24#include "sql_acl.h" // DROP_ACL
25#include "sql_parse.h" // check_one_table_access()25#include "sql_parse.h" // check_one_table_access()
26#include "sql_truncate.h"26#include "sql_truncate.h"
27#include "sql_show.h"
2728
2829
29/**30/**
@@ -35,7 +36,8 @@
35 @return TRUE on failure, FALSE otherwise.36 @return TRUE on failure, FALSE otherwise.
36*/37*/
3738
38static bool fk_info_append_fields(String *str, List<LEX_STRING> *fields)39static bool fk_info_append_fields(THD *thd, String *str,
40 List<LEX_STRING> *fields)
39{41{
40 bool res= FALSE;42 bool res= FALSE;
41 LEX_STRING *field;43 LEX_STRING *field;
@@ -43,9 +45,8 @@
4345
44 while ((field= it++))46 while ((field= it++))
45 {47 {
46 res|= str->append("`");48 res|= append_identifier(thd, str, field->str, field->length);
47 res|= str->append(field);49 res|= str->append(", ");
48 res|= str->append("`, ");
49 }50 }
5051
51 str->chop();52 str->chop();
@@ -76,20 +77,24 @@
76 `db`.`tbl`, CONSTRAINT `id` FOREIGN KEY (`fk`) REFERENCES `db`.`tbl` (`fk`)77 `db`.`tbl`, CONSTRAINT `id` FOREIGN KEY (`fk`) REFERENCES `db`.`tbl` (`fk`)
77 */78 */
7879
79 res|= str.append('`');80 res|= append_identifier(thd, &str, fk_info->foreign_db->str,
80 res|= str.append(fk_info->foreign_db);81 fk_info->foreign_db->length);
81 res|= str.append("`.`");82 res|= str.append(".");
82 res|= str.append(fk_info->foreign_table);83 res|= append_identifier(thd, &str, fk_info->foreign_table->str,
83 res|= str.append("`, CONSTRAINT `");84 fk_info->foreign_table->length);
84 res|= str.append(fk_info->foreign_id);85 res|= str.append(", CONSTRAINT ");
85 res|= str.append("` FOREIGN KEY (");86 res|= append_identifier(thd, &str, fk_info->foreign_id->str,
86 res|= fk_info_append_fields(&str, &fk_info->foreign_fields);87 fk_info->foreign_id->length);
87 res|= str.append(") REFERENCES `");88 res|= str.append(" FOREIGN KEY (");
88 res|= str.append(fk_info->referenced_db);89 res|= fk_info_append_fields(thd, &str, &fk_info->foreign_fields);
89 res|= str.append("`.`");90 res|= str.append(") REFERENCES ");
90 res|= str.append(fk_info->referenced_table);91 res|= append_identifier(thd, &str, fk_info->referenced_db->str,
91 res|= str.append("` (");92 fk_info->referenced_db->length);
92 res|= fk_info_append_fields(&str, &fk_info->referenced_fields);93 res|= str.append(".");
94 res|= append_identifier(thd, &str, fk_info->referenced_table->str,
95 fk_info->referenced_table->length);
96 res|= str.append(" (");
97 res|= fk_info_append_fields(thd, &str, &fk_info->referenced_fields);
93 res|= str.append(')');98 res|= str.append(')');
9499
95 return res ? NULL : thd->strmake(str.ptr(), str.length());100 return res ? NULL : thd->strmake(str.ptr(), str.length());
96101
=== modified file 'Percona-Server/sql/sql_yacc.yy'
--- Percona-Server/sql/sql_yacc.yy 2012-09-17 13:08:32 +0000
+++ Percona-Server/sql/sql_yacc.yy 2012-10-10 20:41:51 +0000
@@ -11735,7 +11735,7 @@
11735 if (lex->update_list.push_back($1) || 11735 if (lex->update_list.push_back($1) ||
11736 lex->value_list.push_back($4))11736 lex->value_list.push_back($4))
11737 MYSQL_YYABORT;11737 MYSQL_YYABORT;
11738 $4->set_name($3, (uint) ($5 - $3), YYTHD->charset());11738 $4->set_name_no_truncate($3, (uint) ($5 - $3), YYTHD->charset());
11739 }11739 }
11740 ;11740 ;
1174111741

Subscribers

People subscribed via source and target branches