Loading client/mysql.cc +14 −15 Original line number Diff line number Diff line Loading @@ -2602,13 +2602,14 @@ com_use(String *buffer __attribute__((unused)), char *line) put_info("USE must be followed by a database name", INFO_ERROR); return 0; } /* We need to recheck the current database, because it may change under our feet, for example if DROP DATABASE or RENAME DATABASE (latter one not yet available by the time the comment was written) */ current_db= 0; // Let's reset current_db, assume it's gone /* Let's reset current_db, assume it's gone */ my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); current_db= 0; /* We don't care about in case of an error below because current_db was just set to 0. Loading @@ -2617,17 +2618,15 @@ com_use(String *buffer __attribute__((unused)), char *line) (res= mysql_use_result(&mysql))) { row= mysql_fetch_row(res); if (row[0] && (!current_db || cmp_database(charset_info, current_db, row[0]))) if (row[0]) { my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); current_db= my_strdup(row[0], MYF(MY_WME)); } (void) mysql_fetch_row(res); // Read eof mysql_free_result(res); } if (!current_db || cmp_database(charset_info, current_db, tmp)) if (!current_db || cmp_database(current_db,tmp)) { if (one_database) skip_updates= 1; Loading mysql-test/r/rpl_set_charset.result +0 −1 Original line number Diff line number Diff line Loading @@ -45,5 +45,4 @@ C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF C0 D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF D0 E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF E0 F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF F0 drop table t1; drop database mysqltest1; mysql-test/r/select.result +16 −0 Original line number Diff line number Diff line Loading @@ -2348,3 +2348,19 @@ select * from t2,t3 where t2.s = t3.s; s s two two drop table t1, t2, t3; CREATE TABLE t1 ( i int(11) NOT NULL default '0', c char(10) NOT NULL default '', PRIMARY KEY (i), UNIQUE KEY c (c) ) TYPE=MyISAM; INSERT INTO t1 VALUES (1,'a'); INSERT INTO t1 VALUES (2,'b'); INSERT INTO t1 VALUES (3,'c'); EXPLAIN SELECT i FROM t1 WHERE i=1; table type possible_keys key key_len ref rows Extra t1 const PRIMARY PRIMARY 4 const 1 Using index EXPLAIN SELECT i FROM t1 WHERE i=1; table type possible_keys key key_len ref rows Extra t1 const PRIMARY PRIMARY 4 const 1 Using index DROP TABLE t1; mysql-test/t/rpl_set_charset.test +1 −3 Original line number Diff line number Diff line Loading @@ -27,9 +27,7 @@ use mysqltest1; select "--- on slave ---"; select hex(a),b from t1 order by b; connection master; drop table t1; drop database mysqltest1; save_master_pos; connection slave; sync_with_master; connection master; drop database mysqltest1; mysql-test/t/select.test +21 −0 Original line number Diff line number Diff line Loading @@ -1880,3 +1880,24 @@ select * from t3 where s = 'one'; select * from t1,t2 where t1.s = t2.s; select * from t2,t3 where t2.s = t3.s; drop table t1, t2, t3; # # Covering index is mentioned in EXPLAIN output for const tables (bug #5333) # CREATE TABLE t1 ( i int(11) NOT NULL default '0', c char(10) NOT NULL default '', PRIMARY KEY (i), UNIQUE KEY c (c) ) TYPE=MyISAM; INSERT INTO t1 VALUES (1,'a'); INSERT INTO t1 VALUES (2,'b'); INSERT INTO t1 VALUES (3,'c'); EXPLAIN SELECT i FROM t1 WHERE i=1; EXPLAIN SELECT i FROM t1 WHERE i=1; DROP TABLE t1; Loading
client/mysql.cc +14 −15 Original line number Diff line number Diff line Loading @@ -2602,13 +2602,14 @@ com_use(String *buffer __attribute__((unused)), char *line) put_info("USE must be followed by a database name", INFO_ERROR); return 0; } /* We need to recheck the current database, because it may change under our feet, for example if DROP DATABASE or RENAME DATABASE (latter one not yet available by the time the comment was written) */ current_db= 0; // Let's reset current_db, assume it's gone /* Let's reset current_db, assume it's gone */ my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); current_db= 0; /* We don't care about in case of an error below because current_db was just set to 0. Loading @@ -2617,17 +2618,15 @@ com_use(String *buffer __attribute__((unused)), char *line) (res= mysql_use_result(&mysql))) { row= mysql_fetch_row(res); if (row[0] && (!current_db || cmp_database(charset_info, current_db, row[0]))) if (row[0]) { my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); current_db= my_strdup(row[0], MYF(MY_WME)); } (void) mysql_fetch_row(res); // Read eof mysql_free_result(res); } if (!current_db || cmp_database(charset_info, current_db, tmp)) if (!current_db || cmp_database(current_db,tmp)) { if (one_database) skip_updates= 1; Loading
mysql-test/r/rpl_set_charset.result +0 −1 Original line number Diff line number Diff line Loading @@ -45,5 +45,4 @@ C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF C0 D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF D0 E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF E0 F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF F0 drop table t1; drop database mysqltest1;
mysql-test/r/select.result +16 −0 Original line number Diff line number Diff line Loading @@ -2348,3 +2348,19 @@ select * from t2,t3 where t2.s = t3.s; s s two two drop table t1, t2, t3; CREATE TABLE t1 ( i int(11) NOT NULL default '0', c char(10) NOT NULL default '', PRIMARY KEY (i), UNIQUE KEY c (c) ) TYPE=MyISAM; INSERT INTO t1 VALUES (1,'a'); INSERT INTO t1 VALUES (2,'b'); INSERT INTO t1 VALUES (3,'c'); EXPLAIN SELECT i FROM t1 WHERE i=1; table type possible_keys key key_len ref rows Extra t1 const PRIMARY PRIMARY 4 const 1 Using index EXPLAIN SELECT i FROM t1 WHERE i=1; table type possible_keys key key_len ref rows Extra t1 const PRIMARY PRIMARY 4 const 1 Using index DROP TABLE t1;
mysql-test/t/rpl_set_charset.test +1 −3 Original line number Diff line number Diff line Loading @@ -27,9 +27,7 @@ use mysqltest1; select "--- on slave ---"; select hex(a),b from t1 order by b; connection master; drop table t1; drop database mysqltest1; save_master_pos; connection slave; sync_with_master; connection master; drop database mysqltest1;
mysql-test/t/select.test +21 −0 Original line number Diff line number Diff line Loading @@ -1880,3 +1880,24 @@ select * from t3 where s = 'one'; select * from t1,t2 where t1.s = t2.s; select * from t2,t3 where t2.s = t3.s; drop table t1, t2, t3; # # Covering index is mentioned in EXPLAIN output for const tables (bug #5333) # CREATE TABLE t1 ( i int(11) NOT NULL default '0', c char(10) NOT NULL default '', PRIMARY KEY (i), UNIQUE KEY c (c) ) TYPE=MyISAM; INSERT INTO t1 VALUES (1,'a'); INSERT INTO t1 VALUES (2,'b'); INSERT INTO t1 VALUES (3,'c'); EXPLAIN SELECT i FROM t1 WHERE i=1; EXPLAIN SELECT i FROM t1 WHERE i=1; DROP TABLE t1;