Loading client/mysql.cc +10 −8 Original line number Diff line number Diff line Loading @@ -2241,8 +2241,10 @@ print_table_data(MYSQL_RES *result) MYSQL_ROW cur; MYSQL_FIELD *field; bool *num_flag; bool *not_null_flag; num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result)); not_null_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result)); if (info_flag) { print_field_types(result); Loading @@ -2260,7 +2262,7 @@ print_table_data(MYSQL_RES *result) length=max(length,field->max_length); if (length < 4 && !IS_NOT_NULL(field->flags)) length=4; // Room for "NULL" field->max_length=length+1; field->max_length=length; separator.fill(separator.length()+length+2,'-'); separator.append('+'); } Loading @@ -2276,6 +2278,7 @@ print_table_data(MYSQL_RES *result) MAX_COLUMN_LENGTH), field->name); num_flag[off]= IS_NUM(field->type); not_null_flag[off]= IS_NOT_NULL(field->flags); } (void) tee_fputs("\n", PAGER); tee_puts((char*) separator.ptr(), PAGER); Loading @@ -2295,7 +2298,8 @@ print_table_data(MYSQL_RES *result) uint visible_length; uint extra_padding; if (lengths[off] == 0) /* If this column may have a null value, use "NULL" for empty. */ if (! not_null_flag[off] && (lengths[off] == 0)) { buffer= "NULL"; data_length= 4; Loading Loading @@ -2335,6 +2339,7 @@ print_table_data(MYSQL_RES *result) } tee_puts((char*) separator.ptr(), PAGER); my_afree((gptr) num_flag); my_afree((gptr) not_null_flag); } Loading @@ -2349,11 +2354,8 @@ tee_print_sized_data(const char *data, unsigned int data_length, unsigned int to unsigned int i; const char *p; total_bytes_to_send -= 1; /* Off by one, perhaps mistakenly accounting for a terminating NUL. */ if (right_justified) for (i= 0; i < (total_bytes_to_send - data_length); i++) for (i= data_length; i < total_bytes_to_send; i++) tee_putc((int)' ', PAGER); for (i= 0, p= data; i < data_length; i+= 1, p+= 1) Loading @@ -2365,7 +2367,7 @@ tee_print_sized_data(const char *data, unsigned int data_length, unsigned int to } if (! right_justified) for (i= 0; i < (total_bytes_to_send - data_length); i++) for (i= data_length; i < total_bytes_to_send; i++) tee_putc((int)' ', PAGER); } Loading client/mysqldump.c +3 −1 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ #include "mysql.h" #include "mysql_version.h" #include "mysqld_error.h" #include "sql/ha_ndbcluster_tables.h" /* Exit codes */ Loading Loading @@ -134,7 +135,6 @@ static CHARSET_INFO *charset_info= &my_charset_latin1; const char *default_dbug_option="d:t:o,/tmp/mysqldump.trace"; /* do we met VIEWs during tables scaning */ my_bool was_views= 0; const char *compatible_mode_names[]= { "MYSQL323", "MYSQL40", "POSTGRESQL", "ORACLE", "MSSQL", "DB2", Loading Loading @@ -2937,6 +2937,8 @@ static int dump_all_tables_in_db(char *database) afterdot= strmov(hash_key, database); *afterdot++= '.'; if (!strcmp(database, NDB_REP_DB)) /* Skip cluster internal database */ return 0; if (init_dumping(database)) return 1; if (opt_xml) Loading mysql-test/extra/rpl_tests/rpl_deadlock.test +7 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,9 @@ select * from t2; # check that no error is reported --replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # --replace_result $MASTER_MYPORT MASTER_MYPORT --vertical_results show slave status; --horizontal_results # 2) Test lock wait timeout Loading @@ -81,9 +83,11 @@ sync_with_master; select * from t1; # check that slave succeeded finally select * from t2; # check that no error is reported --replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # --replace_column 1 # 7 # 8 # 9 # 11 # 16 # 22 # 23 # 33 # --replace_result $MASTER_MYPORT MASTER_MYPORT --vertical_results show slave status; --horizontal_results # Now we repeat 2), but with BEGIN in the same relay log as # COMMIT (to see if seeking into hot log is ok). Loading @@ -103,7 +107,9 @@ select * from t1; select * from t2; --replace_column 1 # 7 # 8 # 9 # 11 # 16 # 22 # 23 # 33 # --replace_result $MASTER_MYPORT MASTER_MYPORT --vertical_results show slave status; --horizontal_results connection master; drop table t1,t2,t3,t4; Loading mysql-test/extra/rpl_tests/rpl_insert_id.test +70 −0 Original line number Diff line number Diff line Loading @@ -86,3 +86,73 @@ INSERT INTO t1 VALUES (1),(1); sync_slave_with_master; # End of 4.1 tests # # BUG#15728: LAST_INSERT_ID function inside a stored function returns 0 # # The solution is not to reset last_insert_id on enter to sub-statement. # connection master; --disable_warnings drop function if exists bug15728; drop function if exists bug15728_insert; drop table if exists t1, t2; --enable_warnings create table t1 ( id int not null auto_increment, last_id int, primary key (id) ); create function bug15728() returns int(11) return last_insert_id(); insert into t1 (last_id) values (0); insert into t1 (last_id) values (last_insert_id()); insert into t1 (last_id) values (bug15728()); # Check that nested call replicates too. create table t2 ( id int not null auto_increment, last_id int, primary key (id) ); delimiter |; create function bug15728_insert() returns int(11) modifies sql data begin insert into t2 (last_id) values (bug15728()); return bug15728(); end| create trigger t1_bi before insert on t1 for each row begin declare res int; select bug15728_insert() into res; set NEW.last_id = res; end| delimiter ;| insert into t1 (last_id) values (0); drop trigger t1_bi; # Check that nested call doesn't affect outer context. select last_insert_id(); select bug15728_insert(); select last_insert_id(); insert into t1 (last_id) values (bug15728()); # This should be exactly one greater than in the previous call. select last_insert_id(); save_master_pos; connection slave; sync_with_master; select * from t1; select * from t2; connection master; drop function bug15728; drop function bug15728_insert; drop table t1, t2; # End of 5.0 tests mysql-test/mysql-test-run.pl +1 −1 Original line number Diff line number Diff line Loading @@ -3580,7 +3580,7 @@ sub valgrind_arguments { if ( $opt_valgrind_options ) { mtr_add_arg($args, split(' ', $opt_valgrind_options)); mtr_add_arg($args, '%s', $_) for (split(' ', $opt_valgrind_options)); } Loading Loading
client/mysql.cc +10 −8 Original line number Diff line number Diff line Loading @@ -2241,8 +2241,10 @@ print_table_data(MYSQL_RES *result) MYSQL_ROW cur; MYSQL_FIELD *field; bool *num_flag; bool *not_null_flag; num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result)); not_null_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result)); if (info_flag) { print_field_types(result); Loading @@ -2260,7 +2262,7 @@ print_table_data(MYSQL_RES *result) length=max(length,field->max_length); if (length < 4 && !IS_NOT_NULL(field->flags)) length=4; // Room for "NULL" field->max_length=length+1; field->max_length=length; separator.fill(separator.length()+length+2,'-'); separator.append('+'); } Loading @@ -2276,6 +2278,7 @@ print_table_data(MYSQL_RES *result) MAX_COLUMN_LENGTH), field->name); num_flag[off]= IS_NUM(field->type); not_null_flag[off]= IS_NOT_NULL(field->flags); } (void) tee_fputs("\n", PAGER); tee_puts((char*) separator.ptr(), PAGER); Loading @@ -2295,7 +2298,8 @@ print_table_data(MYSQL_RES *result) uint visible_length; uint extra_padding; if (lengths[off] == 0) /* If this column may have a null value, use "NULL" for empty. */ if (! not_null_flag[off] && (lengths[off] == 0)) { buffer= "NULL"; data_length= 4; Loading Loading @@ -2335,6 +2339,7 @@ print_table_data(MYSQL_RES *result) } tee_puts((char*) separator.ptr(), PAGER); my_afree((gptr) num_flag); my_afree((gptr) not_null_flag); } Loading @@ -2349,11 +2354,8 @@ tee_print_sized_data(const char *data, unsigned int data_length, unsigned int to unsigned int i; const char *p; total_bytes_to_send -= 1; /* Off by one, perhaps mistakenly accounting for a terminating NUL. */ if (right_justified) for (i= 0; i < (total_bytes_to_send - data_length); i++) for (i= data_length; i < total_bytes_to_send; i++) tee_putc((int)' ', PAGER); for (i= 0, p= data; i < data_length; i+= 1, p+= 1) Loading @@ -2365,7 +2367,7 @@ tee_print_sized_data(const char *data, unsigned int data_length, unsigned int to } if (! right_justified) for (i= 0; i < (total_bytes_to_send - data_length); i++) for (i= data_length; i < total_bytes_to_send; i++) tee_putc((int)' ', PAGER); } Loading
client/mysqldump.c +3 −1 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ #include "mysql.h" #include "mysql_version.h" #include "mysqld_error.h" #include "sql/ha_ndbcluster_tables.h" /* Exit codes */ Loading Loading @@ -134,7 +135,6 @@ static CHARSET_INFO *charset_info= &my_charset_latin1; const char *default_dbug_option="d:t:o,/tmp/mysqldump.trace"; /* do we met VIEWs during tables scaning */ my_bool was_views= 0; const char *compatible_mode_names[]= { "MYSQL323", "MYSQL40", "POSTGRESQL", "ORACLE", "MSSQL", "DB2", Loading Loading @@ -2937,6 +2937,8 @@ static int dump_all_tables_in_db(char *database) afterdot= strmov(hash_key, database); *afterdot++= '.'; if (!strcmp(database, NDB_REP_DB)) /* Skip cluster internal database */ return 0; if (init_dumping(database)) return 1; if (opt_xml) Loading
mysql-test/extra/rpl_tests/rpl_deadlock.test +7 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,9 @@ select * from t2; # check that no error is reported --replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # --replace_result $MASTER_MYPORT MASTER_MYPORT --vertical_results show slave status; --horizontal_results # 2) Test lock wait timeout Loading @@ -81,9 +83,11 @@ sync_with_master; select * from t1; # check that slave succeeded finally select * from t2; # check that no error is reported --replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # --replace_column 1 # 7 # 8 # 9 # 11 # 16 # 22 # 23 # 33 # --replace_result $MASTER_MYPORT MASTER_MYPORT --vertical_results show slave status; --horizontal_results # Now we repeat 2), but with BEGIN in the same relay log as # COMMIT (to see if seeking into hot log is ok). Loading @@ -103,7 +107,9 @@ select * from t1; select * from t2; --replace_column 1 # 7 # 8 # 9 # 11 # 16 # 22 # 23 # 33 # --replace_result $MASTER_MYPORT MASTER_MYPORT --vertical_results show slave status; --horizontal_results connection master; drop table t1,t2,t3,t4; Loading
mysql-test/extra/rpl_tests/rpl_insert_id.test +70 −0 Original line number Diff line number Diff line Loading @@ -86,3 +86,73 @@ INSERT INTO t1 VALUES (1),(1); sync_slave_with_master; # End of 4.1 tests # # BUG#15728: LAST_INSERT_ID function inside a stored function returns 0 # # The solution is not to reset last_insert_id on enter to sub-statement. # connection master; --disable_warnings drop function if exists bug15728; drop function if exists bug15728_insert; drop table if exists t1, t2; --enable_warnings create table t1 ( id int not null auto_increment, last_id int, primary key (id) ); create function bug15728() returns int(11) return last_insert_id(); insert into t1 (last_id) values (0); insert into t1 (last_id) values (last_insert_id()); insert into t1 (last_id) values (bug15728()); # Check that nested call replicates too. create table t2 ( id int not null auto_increment, last_id int, primary key (id) ); delimiter |; create function bug15728_insert() returns int(11) modifies sql data begin insert into t2 (last_id) values (bug15728()); return bug15728(); end| create trigger t1_bi before insert on t1 for each row begin declare res int; select bug15728_insert() into res; set NEW.last_id = res; end| delimiter ;| insert into t1 (last_id) values (0); drop trigger t1_bi; # Check that nested call doesn't affect outer context. select last_insert_id(); select bug15728_insert(); select last_insert_id(); insert into t1 (last_id) values (bug15728()); # This should be exactly one greater than in the previous call. select last_insert_id(); save_master_pos; connection slave; sync_with_master; select * from t1; select * from t2; connection master; drop function bug15728; drop function bug15728_insert; drop table t1, t2; # End of 5.0 tests
mysql-test/mysql-test-run.pl +1 −1 Original line number Diff line number Diff line Loading @@ -3580,7 +3580,7 @@ sub valgrind_arguments { if ( $opt_valgrind_options ) { mtr_add_arg($args, split(' ', $opt_valgrind_options)); mtr_add_arg($args, '%s', $_) for (split(' ', $opt_valgrind_options)); } Loading