summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-12-06 17:15:54 +0200
committerunknown <monty@mysql.com>2004-12-06 17:15:54 +0200
commit7bd0e1a439b1987455d7a77c5a6581867fe10ff7 (patch)
treeadca7e39f11a6ff5883c21958f614b2e665a3d84
parent87591df6d161577559f9257f08a4299dc6171a40 (diff)
downloadmariadb-git-7bd0e1a439b1987455d7a77c5a6581867fe10ff7.tar.gz
After merge fixes
Fixed compiler warnings Fix core dump when sending SIGHUP to mysqld mysql-test/r/drop_temp_table.result: After merge fixes mysql-test/r/grant.result: After merge fixes mysql-test/r/group_min_max.result: After merge fixes mysql-test/r/innodb.result: After merge fixes mysql-test/r/insert_select.result: After merge fixes mysql-test/r/rpl_charset.result: After merge fixes mysql-test/r/rpl_create_database.result: After merge fixes mysql-test/r/rpl_loaddata_rule_m.result: After merge fixes mysql-test/t/rpl_charset.test: After merge fixes mysql-test/t/rpl_create_database.test: After merge fixes sql-common/client.c: After merge fixes sql/item.cc: After merge fixes sql/mysqld.cc: Fix core dump when sending SIGHUP to mysqld sql/sql_acl.cc: Better comment sql/sql_derived.cc: Fixed comment Added missing DBUG_RETURN sql/sql_insert.cc: Fixed compiler warnings After merge fixes sql/sql_lex.cc: After merge fixes Removed compiler warnings sql/sql_parse.cc: After merge fixes sql/sql_select.cc: More debugging sql/sql_table.cc: Added missing DBUG_VOID_RETURN sql/sql_update.cc: Fixed compiler warning sql/sql_view.cc: Added missing DBUG_RETURN Fixed compiler warnings Added flag to signal that the view is a derived table
-rw-r--r--mysql-test/r/drop_temp_table.result8
-rw-r--r--mysql-test/r/grant.result4
-rw-r--r--mysql-test/r/group_min_max.result2
-rw-r--r--mysql-test/r/innodb.result2
-rw-r--r--mysql-test/r/insert_select.result4
-rw-r--r--mysql-test/r/rpl_charset.result18
-rw-r--r--mysql-test/r/rpl_create_database.result28
-rw-r--r--mysql-test/r/rpl_loaddata_rule_m.result4
-rw-r--r--mysql-test/t/rpl_charset.test21
-rw-r--r--mysql-test/t/rpl_create_database.test1
-rw-r--r--sql-common/client.c2
-rw-r--r--sql/item.cc2
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/sql_acl.cc3
-rw-r--r--sql/sql_derived.cc6
-rw-r--r--sql/sql_insert.cc27
-rw-r--r--sql/sql_lex.cc3
-rw-r--r--sql/sql_parse.cc12
-rw-r--r--sql/sql_select.cc50
-rw-r--r--sql/sql_table.cc1
-rw-r--r--sql/sql_update.cc6
-rw-r--r--sql/sql_view.cc5
22 files changed, 120 insertions, 91 deletions
diff --git a/mysql-test/r/drop_temp_table.result b/mysql-test/r/drop_temp_table.result
index 08793bcbd57..34c08f08788 100644
--- a/mysql-test/r/drop_temp_table.result
+++ b/mysql-test/r/drop_temp_table.result
@@ -11,8 +11,8 @@ get_lock("a",10)
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 95 Query 1 190 use `test`; create database `drop-temp+table-test`
-master-bin.000001 190 Query 1 306 use `drop-temp+table-test`; create temporary table `table:name` (a int)
-master-bin.000001 306 Query 1 457 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name`
-master-bin.000001 457 Query 1 550 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
+master-bin.000001 95 Query 1 206 create database `drop-temp+table-test`
+master-bin.000001 206 Query 1 322 use `drop-temp+table-test`; create temporary table `table:name` (a int)
+master-bin.000001 322 Query 1 473 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name`
+master-bin.000001 473 Query 1 566 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
drop database `drop-temp+table-test`;
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 33ca38a3bad..b69ba9702a6 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -332,10 +332,10 @@ GRANT USAGE ON *.* TO 'grant_user'@'localhost'
GRANT INSERT (a, d, c, b) ON `test`.`t1` TO 'grant_user'@'localhost'
select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
Host Db User Table_name Column_name Column_priv
-localhost test grant_user t1 c Insert
localhost test grant_user t1 b Insert
-localhost test grant_user t1 a Insert
localhost test grant_user t1 d Insert
+localhost test grant_user t1 a Insert
+localhost test grant_user t1 c Insert
revoke ALL PRIVILEGES on t1 from grant_user@localhost;
show grants for grant_user@localhost;
Grants for grant_user@localhost
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result
index c291599b078..006e7052376 100644
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@ -1365,7 +1365,7 @@ where exists ( select * from t2 where t2.c > 'b1' )
group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by
-2 SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using index
+2 SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
explain select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 4cce4ef51e0..9f19dd479c8 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -1696,7 +1696,7 @@ Variable_name Value
Innodb_rows_inserted 31706
show status like "Innodb_rows_read";
Variable_name Value
-Innodb_rows_read 80178
+Innodb_rows_read 80161
show status like "Innodb_rows_updated";
Variable_name Value
Innodb_rows_updated 29530
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index bb7d520dcab..94d33f8090b 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -87,8 +87,8 @@ reset master;
create table t2(unique(a)) select a from t1;
ERROR 23000: Duplicate entry '1' for key 1
show binlog events;
-Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
drop table t1;
create table t1 (a int not null);
create table t2 (a int not null);
diff --git a/mysql-test/r/rpl_charset.result b/mysql-test/r/rpl_charset.result
index 9a002953b45..0224bd6dba2 100644
--- a/mysql-test/r/rpl_charset.result
+++ b/mysql-test/r/rpl_charset.result
@@ -105,15 +105,15 @@ drop database mysqltest2;
drop database mysqltest3;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 1 # use `test`; drop database if exists mysqltest2
-master-bin.000001 # Query 1 # use `test`; drop database if exists mysqltest3
-master-bin.000001 # Query 1 # use `test`; create database mysqltest2 character set latin2
+master-bin.000001 # Query 1 # drop database if exists mysqltest2
+master-bin.000001 # Query 1 # drop database if exists mysqltest3
+master-bin.000001 # Query 1 # create database mysqltest2 character set latin2
master-bin.000001 # Query 1 # use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=30
-master-bin.000001 # Query 1 # use `test`; create database mysqltest3
+master-bin.000001 # Query 1 # create database mysqltest3
master-bin.000001 # Query 1 # use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
-master-bin.000001 # Query 1 # use `test`; drop database mysqltest3
+master-bin.000001 # Query 1 # drop database mysqltest3
master-bin.000001 # Query 1 # use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
-master-bin.000001 # Query 1 # use `test`; create database mysqltest3
+master-bin.000001 # Query 1 # create database mysqltest3
master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Query 1 # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100))
master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
@@ -158,7 +158,7 @@ master-bin.000001 # Intvar 1 # INSERT_ID=1
master-bin.000001 # User var 1 # @`a`=_cp850 0x4DFC6C6C6572 COLLATE cp850_general_ci
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(collation(@a))
master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
-master-bin.000001 # Query 1 # use `mysqltest2`; drop database mysqltest2
+master-bin.000001 # Query 1 # drop database mysqltest2
master-bin.000001 # Query 1 # SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Query 1 # drop database mysqltest3
set global character_set_server=latin2;
@@ -200,8 +200,8 @@ hex(c1) hex(c2)
CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
stop slave;
delete from t1;
-change master to master_log_pos=6763;
-start slave until master_log_file='master-bin.000001', master_log_pos=6921;
+change master to master_log_pos=6809;
+start slave until master_log_file='master-bin.000001', master_log_pos=6967;
start slave;
select hex(c1), hex(c2) from t1;
hex(c1) hex(c2)
diff --git a/mysql-test/r/rpl_create_database.result b/mysql-test/r/rpl_create_database.result
index 2375e13bb5c..86282ce3cc5 100644
--- a/mysql-test/r/rpl_create_database.result
+++ b/mysql-test/r/rpl_create_database.result
@@ -41,20 +41,20 @@ CREATE DATABASE mysqltest_sisyfos;
USE mysqltest_sisyfos;
CREATE TABLE t2 (a INT);
SHOW BINLOG EVENTS;
-Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
-master-bin.000001 79 Query 1 79 DROP DATABASE IF EXISTS mysqltest_prometheus
-master-bin.000001 174 Query 1 174 DROP DATABASE IF EXISTS mysqltest_sisyfos
-master-bin.000001 263 Query 1 263 CREATE DATABASE mysqltest_prometheus
-master-bin.000001 350 Query 1 350 CREATE DATABASE mysqltest_sisyfos
-master-bin.000001 431 Query 1 431 use `mysqltest_sisyfos`; CREATE TABLE t1 (b int)
-master-bin.000001 502 Query 1 502 use `mysqltest_sisyfos`; INSERT INTO t1 VALUES(1)
-master-bin.000001 574 Query 1 574 ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1
-master-bin.000001 675 Query 1 675 DROP DATABASE IF EXISTS mysqltest_sisyfos
-master-bin.000001 764 Query 1 764 use `mysqltest_prometheus`; CREATE TABLE t1 (a INT)
-master-bin.000001 838 Query 1 838 use `mysqltest_prometheus`; INSERT INTO t1 VALUES (1)
-master-bin.000001 914 Query 1 914 CREATE DATABASE mysqltest_sisyfos
-master-bin.000001 995 Query 1 995 use `mysqltest_sisyfos`; CREATE TABLE t2 (a INT)
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
+master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS mysqltest_prometheus
+master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS mysqltest_sisyfos
+master-bin.000001 # Query 1 # CREATE DATABASE mysqltest_prometheus
+master-bin.000001 # Query 1 # CREATE DATABASE mysqltest_sisyfos
+master-bin.000001 # Query 1 # use `mysqltest_sisyfos`; CREATE TABLE t1 (b int)
+master-bin.000001 # Query 1 # use `mysqltest_sisyfos`; INSERT INTO t1 VALUES(1)
+master-bin.000001 # Query 1 # ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1
+master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS mysqltest_sisyfos
+master-bin.000001 # Query 1 # use `mysqltest_prometheus`; CREATE TABLE t1 (a INT)
+master-bin.000001 # Query 1 # use `mysqltest_prometheus`; INSERT INTO t1 VALUES (1)
+master-bin.000001 # Query 1 # CREATE DATABASE mysqltest_sisyfos
+master-bin.000001 # Query 1 # use `mysqltest_sisyfos`; CREATE TABLE t2 (a INT)
SHOW DATABASES;
Database
mysql
diff --git a/mysql-test/r/rpl_loaddata_rule_m.result b/mysql-test/r/rpl_loaddata_rule_m.result
index d11ca31fc87..b241fc9ce0b 100644
--- a/mysql-test/r/rpl_loaddata_rule_m.result
+++ b/mysql-test/r/rpl_loaddata_rule_m.result
@@ -12,6 +12,6 @@ use mysqltest;
load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 79 Query 1 79 drop database if exists mysqltest
-master-bin.000001 152 Query 1 152 create database mysqltest
+master-bin.000001 95 Query 1 190 drop database if exists mysqltest
+master-bin.000001 190 Query 1 277 create database mysqltest
drop database mysqltest;
diff --git a/mysql-test/t/rpl_charset.test b/mysql-test/t/rpl_charset.test
index a6a3cbe9f1b..52ace9a6aa5 100644
--- a/mysql-test/t/rpl_charset.test
+++ b/mysql-test/t/rpl_charset.test
@@ -129,7 +129,7 @@ select @@character_set_server;
select @@character_set_server;
# ONE_SHOT on not charset/collation stuff is not allowed
-error 1382;
+-- error 1382
set one_shot max_join_size=10;
# Test of wrong character set numbers;
@@ -155,17 +155,22 @@ select hex(c1), hex(c2) from t1;
stop slave;
delete from t1;
-change master to master_log_pos=5847;
-start slave until master_log_file='master-bin.000001', master_log_pos=5983;
-# Slave is supposed to stop _after_ the INSERT, even though 5983 is
+# Slave is now supposed to have stopped _after_ the INSERT
# Note that the following positions may change between MySQL versions!
-# This position should be position for the SET
-change master to master_log_pos=6763;
+# This position should be position for the SET ONE SHOT CHARACTER_SET_CLIENT
+# command just before the INSERT.
+# You can find it by doing:
+# ../client/mysqlbinlog var/log/master-bin.000001 | grep -3 CHARACTER_SET | tail -7
+change master to master_log_pos=6809;
-# This position should be position of the INSERT command
-start slave until master_log_file='master-bin.000001', master_log_pos=6921;
+# This position should be position of the INSERT command.
+# You can find it by doing:
+#
+# ../client/mysqlbinlog var/log/master-bin.000001 | grep -3 INSERT | tail -4
+
+start slave until master_log_file='master-bin.000001', master_log_pos=6967;
# Slave is supposed to stop _after_ the INSERT, even though 'master_log_pos' is
# the position of the beginning of the INSERT; after SET slave is not
diff --git a/mysql-test/t/rpl_create_database.test b/mysql-test/t/rpl_create_database.test
index 7ed0d5dbdbb..c63b0bc85ef 100644
--- a/mysql-test/t/rpl_create_database.test
+++ b/mysql-test/t/rpl_create_database.test
@@ -56,6 +56,7 @@ USE mysqltest_sisyfos;
CREATE TABLE t2 (a INT);
let $VERSION=`select version()`;
--replace_result $VERSION VERSION
+--replace_column 2 # 5 #
SHOW BINLOG EVENTS;
SHOW DATABASES;
sync_slave_with_master;
diff --git a/sql-common/client.c b/sql-common/client.c
index fa1488f4f11..aa50b9fe27b 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1512,6 +1512,7 @@ static MYSQL_METHODS client_methods=
#endif
};
+
MYSQL *
CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
const char *passwd, const char *db,
@@ -1534,7 +1535,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
#ifdef HAVE_SYS_UN_H
struct sockaddr_un UNIXaddr;
#endif
-
init_sigpipe_variables
DBUG_ENTER("mysql_real_connect");
LINT_INIT(host_info);
diff --git a/sql/item.cc b/sql/item.cc
index 001fbef9505..03bbbe2ad49 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -187,6 +187,7 @@ Item_ident::Item_ident(THD *thd, Item_ident *item)
void Item_ident::cleanup()
{
DBUG_ENTER("Item_ident::cleanup");
+#ifdef CANT_BE_USED_AS_MEMORY_IS_FREED
DBUG_PRINT("enter", ("b:%s(%s), t:%s(%s), f:%s(%s)",
db_name ? db_name : "(null)",
orig_db_name ? orig_db_name : "(null)",
@@ -194,6 +195,7 @@ void Item_ident::cleanup()
orig_table_name ? orig_table_name : "(null)",
field_name ? field_name : "(null)",
orig_field_name ? orig_field_name : "(null)"));
+#endif
Item::cleanup();
db_name= orig_db_name;
table_name= orig_table_name;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 5e0cc47ecc5..42ae6982eb0 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2128,7 +2128,7 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
{
reload_acl_and_cache((THD*) 0,
(REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST |
- REFRESH_STATUS | REFRESH_GRANT |
+ REFRESH_GRANT |
REFRESH_THREADS | REFRESH_HOSTS),
(TABLE_LIST*) 0, NULL); // Flush logs
mysql_print_status((THD*) 0); // Send debug some info
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index b69ee068407..4d4923d16b8 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -446,7 +446,8 @@ void acl_free(bool end)
SYNOPSIS
acl_reload()
- thd Thread handle
+ thd Thread handle. Note that this may be NULL if we refresh
+ because we got a signal
*/
void acl_reload(THD *thd)
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 10ef6a081b6..69511018880 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -77,7 +77,7 @@ mysql_handle_derived(LEX *lex, int (*processor)(THD*, LEX*, TABLE_LIST*))
Create temporary table structure (but do not fill it)
SYNOPSIS
- mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t)
+ mysql_derived_prepare()
thd Thread handle
lex LEX for this thread
orig_table_list TABLE_LIST for the upper SELECT
@@ -103,6 +103,7 @@ int mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *orig_table_list)
{
SELECT_LEX_UNIT *unit= orig_table_list->derived;
int res= 0;
+ DBUG_ENTER("mysql_derived_prepare");
if (unit)
{
SELECT_LEX *first_select= unit->first_select();
@@ -110,7 +111,6 @@ int mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *orig_table_list)
select_union *derived_result;
bool is_union= first_select->next_select() &&
first_select->next_select()->linkage == UNION_TYPE;
- DBUG_ENTER("mysql_derived");
if (!(derived_result= new select_union(0)))
DBUG_RETURN(1); // out of memory
@@ -173,7 +173,7 @@ exit:
}
else if (orig_table_list->ancestor)
orig_table_list->set_ancestor();
- return (res);
+ DBUG_RETURN(res);
}
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 77a669e4c96..0814c7a747e 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -116,7 +116,8 @@ check_insert_fields(THD *thd, TABLE_LIST *table_list, List<Item> &fields,
Item *item;
TABLE_LIST *tbl= 0;
table_map map= 0;
- while (item= it++)
+
+ while ((item= it++))
map|= item->used_tables();
if (table_list->check_single_table(&tbl, map) || tbl == 0)
{
@@ -1840,19 +1841,23 @@ bool select_insert::send_data(List<Item> &values)
DBUG_RETURN(0);
}
- thd->count_cuted_fields= CHECK_FIELD_WARN; // calc cuted fields
+ thd->count_cuted_fields= CHECK_FIELD_WARN; // Calculate cuted fields
store_values(values);
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
if (thd->net.report_error)
DBUG_RETURN(1);
- switch (table_list->view_check_option(thd,
- thd->lex->duplicates == DUP_IGNORE)) {
- case VIEW_CHECK_SKIP:
- DBUG_RETURN(0);
- case VIEW_CHECK_ERROR:
- DBUG_RETURN(1);
+ if (table_list) // Not CREATE ... SELECT
+ {
+ switch (table_list->view_check_option(thd,
+ thd->lex->duplicates ==
+ DUP_IGNORE)) {
+ case VIEW_CHECK_SKIP:
+ DBUG_RETURN(0);
+ case VIEW_CHECK_ERROR:
+ DBUG_RETURN(1);
+ }
}
- if (!(error= write_record(table,&info)) && table->next_number_field)
+ if (!(error= write_record(thd, table,&info)) && table->next_number_field)
{
/* Clear for next record */
table->next_number_field->reset();
@@ -1866,9 +1871,9 @@ bool select_insert::send_data(List<Item> &values)
void select_insert::store_values(List<Item> &values)
{
if (fields->elements)
- fill_record(*fields, values, 1);
+ fill_record(thd, *fields, values, 1);
else
- fill_record(table->field, values, 1);
+ fill_record(thd, table->field, values, 1);
}
void select_insert::send_error(uint errcode,const char *err)
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 8a705a7438b..12e4d912f15 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -144,8 +144,9 @@ void lex_start(THD *thd, uchar *buf,uint length)
lex->select_lex.init_order();
lex->select_lex.group_list.empty();
lex->describe= 0;
- lex->subqueries= lex->derived_tables= FALSE;
+ lex->subqueries= FALSE;
lex->view_prepare_mode= FALSE;
+ lex->derived_tables= 0;
lex->lock_option= TL_READ;
lex->found_colon= 0;
lex->safe_to_cache_query= 1;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 44adc28d41d..168632f7578 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -615,7 +615,7 @@ end:
}
-static void reset_mqh(THD *thd, LEX_USER *lu, bool get_them= 0)
+static void reset_mqh(LEX_USER *lu, bool get_them= 0)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
(void) pthread_mutex_lock(&LOCK_user_conn);
@@ -3396,7 +3396,7 @@ create_error:
{
if (mysql_bin_log.is_open())
{
- Query_log_event qinfo(thd, thd->query, thd->query_length, 0);
+ Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
mysql_bin_log.write(&qinfo);
}
send_ok(thd);
@@ -3512,7 +3512,7 @@ create_error:
List_iterator <LEX_USER> str_list(lex->users_list);
LEX_USER *user;
while ((user=str_list++))
- reset_mqh(thd,user);
+ reset_mqh(user);
}
}
}
@@ -5637,7 +5637,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
acl_reload(thd);
grant_reload(thd);
if (mqh_used)
- reset_mqh(thd,(LEX_USER *) NULL,TRUE);
+ reset_mqh((LEX_USER *) NULL,TRUE);
}
#endif
if (options & REFRESH_LOG)
@@ -5713,7 +5713,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
}
if (options & REFRESH_HOSTS)
hostname_cache_refresh();
- if (options & REFRESH_STATUS)
+ if (thd && (options & REFRESH_STATUS))
refresh_status();
if (options & REFRESH_THREADS)
flush_thread_cache();
@@ -5743,7 +5743,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
}
#endif
if (options & REFRESH_USER_RESOURCES)
- reset_mqh(thd,(LEX_USER *) NULL);
+ reset_mqh((LEX_USER *) NULL);
if (write_to_binlog)
*write_to_binlog= tmp_write_to_binlog;
return result;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index ba9933a3d15..1049c074ce1 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1249,7 +1249,7 @@ JOIN::exec()
/* Copy data to the temporary table */
thd->proc_info= "Copying to tmp table";
-
+ DBUG_PRINT("info", ("%s", thd->proc_info));
if ((tmp_error= do_select(curr_join, (List<Item> *) 0, curr_tmp_table, 0)))
{
error= tmp_error;
@@ -1377,6 +1377,7 @@ JOIN::exec()
}
thd->proc_info="Copying to group table";
+ DBUG_PRINT("info", ("%s", thd->proc_info));
tmp_error= -1;
if (curr_join != this)
{
@@ -1615,6 +1616,7 @@ JOIN::exec()
else
{
thd->proc_info="Sending data";
+ DBUG_PRINT("info", ("%s", thd->proc_info));
error= do_select(curr_join, curr_fields_list, NULL, procedure);
thd->limit_found_rows= curr_join->send_records;
thd->examined_row_count= curr_join->examined_rows;
@@ -1910,6 +1912,8 @@ void
Cursor::close()
{
THD *thd= join->thd;
+ DBUG_ENTER("Cursor::close");
+
join->join_free(0);
if (unit)
{
@@ -1940,6 +1944,7 @@ Cursor::close()
}
join= 0;
unit= 0;
+ DBUG_VOID_RETURN;
}
@@ -4718,11 +4723,12 @@ get_best_combination(JOIN *join)
KEYUSE *keyuse;
uint table_count;
THD *thd=join->thd;
+ DBUG_ENTER("get_best_combination");
table_count=join->tables;
if (!(join->join_tab=join_tab=
(JOIN_TAB*) thd->alloc(sizeof(JOIN_TAB)*table_count)))
- return TRUE;
+ DBUG_RETURN(TRUE);
join->full_join=0;
@@ -4736,6 +4742,7 @@ get_best_combination(JOIN *join)
form->reginfo.join_tab=j;
if (!*j->on_expr_ref)
form->reginfo.not_exists_optimize=0; // Only with LEFT JOIN
+ DBUG_PRINT("info",("type: %d", j->type));
if (j->type == JT_CONST)
continue; // Handled in make_join_stat..
@@ -4751,13 +4758,13 @@ get_best_combination(JOIN *join)
join->full_join=1;
}
else if (create_ref_for_key(join, j, keyuse, used_tables))
- return TRUE; // Something went wrong
+ DBUG_RETURN(TRUE); // Something went wrong
}
for (i=0 ; i < table_count ; i++)
join->map2table[join->join_tab[i].table->tablenr]=join->join_tab+i;
update_depend_map(join);
- return 0;
+ DBUG_RETURN(0);
}
@@ -4770,6 +4777,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse,
uint keyparts,length,key;
TABLE *table;
KEY *keyinfo;
+ DBUG_ENTER("create_ref_for_key");
/* Use best key from find_best */
table=j->table;
@@ -4819,7 +4827,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse,
(keyparts+1)))) ||
!(j->ref.items= (Item**) thd->alloc(sizeof(Item*)*keyparts)))
{
- return TRUE;
+ DBUG_RETURN(TRUE);
}
j->ref.key_buff2=j->ref.key_buff+ALIGN_SIZE(length);
j->ref.key_err=1;
@@ -4832,7 +4840,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse,
{
j->ref.items[0]=((Item_func*)(keyuse->val))->key_item();
if (keyuse->used_tables)
- return TRUE; // not supported yet. SerG
+ DBUG_RETURN(TRUE); // not supported yet. SerG
j->type=JT_FT;
}
@@ -4856,7 +4864,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse,
maybe_null ? (char*) key_buff : 0,
keyinfo->key_part[i].length, keyuse->val);
if (thd->is_fatal_error)
- return TRUE;
+ DBUG_RETURN(TRUE);
tmp.copy();
}
else
@@ -4876,7 +4884,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse,
} /* not ftkey */
*ref_key=0; // end_marker
if (j->type == JT_FT)
- return 0;
+ DBUG_RETURN(0);
if (j->type == JT_CONST)
j->table->const_table= 1;
else if (((keyinfo->flags & (HA_NOSAME | HA_NULL_PART_KEY |
@@ -4900,7 +4908,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse,
}
else
j->type=JT_EQ_REF;
- return 0;
+ DBUG_RETURN(0);
}
@@ -4963,10 +4971,11 @@ make_simple_join(JOIN *join,TABLE *tmp_table)
{
TABLE **tableptr;
JOIN_TAB *join_tab;
+ DBUG_ENTER("make_simple_join");
if (!(tableptr=(TABLE**) join->thd->alloc(sizeof(TABLE*))) ||
!(join_tab=(JOIN_TAB*) join->thd->alloc(sizeof(JOIN_TAB))))
- return TRUE;
+ DBUG_RETURN(TRUE);
join->join_tab=join_tab;
join->table=tableptr; tableptr[0]=tmp_table;
join->tables=1;
@@ -4996,10 +5005,11 @@ make_simple_join(JOIN *join,TABLE *tmp_table)
join_tab->not_used_in_distinct=0;
join_tab->read_first_record= join_init_read_record;
join_tab->join=join;
+ join_tab->ref.key_parts= 0;
bzero((char*) &join_tab->read_record,sizeof(join_tab->read_record));
tmp_table->status=0;
tmp_table->null_row=0;
- return FALSE;
+ DBUG_RETURN(FALSE);
}
@@ -8122,6 +8132,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
keyinfo->key_length=0;
keyinfo->rec_per_key=0;
keyinfo->algorithm= HA_KEY_ALG_UNDEF;
+ keyinfo->name= (char*) "group_key";
for (; group ; group=group->next,key_part_info++)
{
Field *field=(*group->item)->get_tmp_table_field();
@@ -8192,7 +8203,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
keyinfo->key_part=key_part_info;
keyinfo->flags=HA_NOSAME | HA_NULL_ARE_EQUAL;
keyinfo->key_length=(uint16) reclength;
- keyinfo->name=(char*) "tmp";
+ keyinfo->name= (char*) "distinct_key";
keyinfo->algorithm= HA_KEY_ALG_UNDEF;
if (null_pack_length)
{
@@ -11973,6 +11984,8 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
{
List_iterator_fast<Item> it(all_fields);
Item *item_field,*item;
+ DBUG_ENTER("change_to_use_tmp_fields");
+
res_selected_fields.empty();
res_all_fields.empty();
@@ -11996,8 +12009,8 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
else
item_field= (Item*) new Item_field(field);
if (!item_field)
- return TRUE; // Fatal error
- item_field->name= item->name; /*lint -e613 */
+ DBUG_RETURN(TRUE); // Fatal error
+ item_field->name= item->name;
#ifndef DBUG_OFF
if (_db_on_ && !item_field->name)
{
@@ -12021,7 +12034,7 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
for (i= 0; i < border; i++)
itr++;
itr.sublist(res_selected_fields, elements);
- return FALSE;
+ DBUG_RETURN(FALSE);
}
@@ -12092,10 +12105,11 @@ change_refs_to_tmp_fields(THD *thd, Item **ref_pointer_array,
static bool setup_sum_funcs(THD *thd, Item_sum **func_ptr)
{
Item_sum *func;
+ DBUG_ENTER("setup_sum_funcs");
while ((func= *(func_ptr++)))
if (func->setup(thd))
- return TRUE;
- return FALSE;
+ DBUG_RETURN(TRUE);
+ DBUG_RETURN(FALSE);
}
@@ -12617,10 +12631,10 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
item_list.push_back(new Item_string(join_type_str[tab->type],
strlen(join_type_str[tab->type]),
cs));
- uint j;
/* Build "possible_keys" value and add it to item_list */
if (!tab->keys.is_clear_all())
{
+ uint j;
for (j=0 ; j < table->keys ; j++)
{
if (tab->keys.is_set(j))
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index a1e09d74620..c0ddfdb2f07 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1670,6 +1670,7 @@ void close_cached_table(THD *thd, TABLE *table)
/* When lock on LOCK_open is freed other threads can continue */
pthread_cond_broadcast(&COND_refresh);
+ DBUG_VOID_RETURN;
}
static int send_check_errmsg(THD *thd, TABLE_LIST* table,
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 7c55f281f38..9613e39d403 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -776,12 +776,10 @@ bool mysql_multi_update_prepare(THD *thd)
*/
List_iterator_fast<Item> it(*fields);
Item *item;
- while (item= it++)
- {
+ while ((item= it++))
item->cleanup();
- }
- /* We have to cleunup translation tables of views. */
+ /* We have to cleanup translation tables of views. */
for (TABLE_LIST *tbl= table_list; tbl; tbl= tbl->next_global)
tbl->cleanup_items();
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index ec63bb92c54..993a4d1987b 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -312,7 +312,7 @@ bool mysql_create_view(THD *thd,
send_ok(thd);
lex->link_first_table_back(view, link_to_local);
- return 0;
+ DBUG_RETURN(0);
err:
thd->proc_info= "end";
@@ -793,7 +793,7 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table)
/* re-nest tables of VIEW */
{
List_iterator_fast<TABLE_LIST> ti(nested_join->join_list);
- while(tbl= ti++)
+ while ((tbl= ti++))
{
tbl->join_list= &nested_join->join_list;
tbl->embedding= table;
@@ -832,6 +832,7 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table)
view_select->linkage= DERIVED_TABLE_TYPE;
table->updatable= 0;
table->effective_with_check= VIEW_CHECK_NONE;
+ old_lex->subqueries= TRUE;
/* SELECT tree link */
lex->unit.include_down(table->select_lex);