diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index 1b6a0d43738..04dabcb5481 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -59,9 +59,12 @@ ASIN(0.8+0.2) SELECT ASIN(1.2-0.2); ASIN(1.2-0.2) 1.570796 +select floor(log(4)/log(2)); floor(log(4)/log(2)) 2 +select floor(log(8)/log(2)); floor(log(8)/log(2)) 3 +select floor(log(16)/log(2)); floor(log(16)/log(2)) 4 diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index df24a1cfd58..12cb965f045 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -386,17 +386,17 @@ SELECT * from t2; a 1 DROP TABLE t1,t2; -create table `t1` ( `p_id` int(10) unsigned NOT NULL auto_increment, `p_code` varchar(20) NOT NULL default '', `p_created` datetime NOT NULL default '0000-00-00 00:00:00', `p_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`p_id`) ); -create table `t2` ( `c2_id` int(10) unsigned NULL auto_increment, `c2_p_id` int(10) unsigned NOT NULL default '0', `c2_note` text NOT NULL, `c2_created` datetime NOT NULL default '0000-00-00 00:00:00', `c2_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`c2_id`), KEY `c2_p_id` (`c2_p_id`) ); -insert into t1 values (0,'A01-Comp',now(),1); -insert into t1 values (0,'B01-Comp',now(),1); -insert into t2 values (0,1,'A Note',now(),1); +create table `t1` (`p_id` int(10) unsigned NOT NULL auto_increment, `p_code` varchar(20) NOT NULL default '', `p_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`p_id`) ); +create table `t2` (`c2_id` int(10) unsigned NULL auto_increment, `c2_p_id` int(10) unsigned NOT NULL default '0', `c2_note` text NOT NULL, `c2_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`c2_id`), KEY `c2_p_id` (`c2_p_id`) ); +insert into t1 values (0,'A01-Comp',1); +insert into t1 values (0,'B01-Comp',1); +insert into t2 values (0,1,'A Note',1); update t1 left join t2 on p_id = c2_p_id set c2_note = 'asdf-1' where p_id = 2; select * from t1; -p_id p_code p_created p_active -1 A01-Comp 2004-03-11 23:21:29 1 -2 B01-Comp 2004-03-11 23:21:29 1 +p_id p_code p_active +1 A01-Comp 1 +2 B01-Comp 1 select * from t2; -c2_id c2_p_id c2_note c2_created c2_active -1 1 A Note 2004-03-11 23:21:29 1 +c2_id c2_p_id c2_note c2_active +1 1 A Note 1 drop table t1, t2; diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index df472eb9c80..79bf46280dd 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -14,6 +14,7 @@ insert into t1 values ("Alas"); flush logs; --- Local -- +/*!40019 SET @@session.max_insert_delayed_threads=0*/; use test; SET TIMESTAMP=1000000000; create table t1 (word varchar(20)); @@ -31,19 +32,23 @@ LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-4-0' INTO TABLE `t1` FI LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-5-0' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word); --- Broken LOAD DATA -- +/*!40019 SET @@session.max_insert_delayed_threads=0*/; use test; SET TIMESTAMP=1000000000; insert into t1 values ("Alas"); --- --database -- +/*!40019 SET @@session.max_insert_delayed_threads=0*/; SET INSERT_ID=1; --- --position -- +/*!40019 SET @@session.max_insert_delayed_threads=0*/; use test; SET TIMESTAMP=1000000000; insert into t1 values ("Alas"); --- Remote -- +/*!40019 SET @@session.max_insert_delayed_threads=0*/; use test; SET TIMESTAMP=1000000000; create table t1 (word varchar(20)); @@ -64,14 +69,17 @@ SET TIMESTAMP=1000000000; insert into t1 values ("Alas"); --- Broken LOAD DATA -- +/*!40019 SET @@session.max_insert_delayed_threads=0*/; use test; SET TIMESTAMP=1000000000; insert into t1 values ("Alas"); --- --database -- +/*!40019 SET @@session.max_insert_delayed_threads=0*/; SET INSERT_ID=1; --- --position -- +/*!40019 SET @@session.max_insert_delayed_threads=0*/; use test; SET TIMESTAMP=1000000000; insert into t1 values ("Alas"); diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 6ed340ad92b..39ea136bde1 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -330,11 +330,11 @@ DROP TABLE t1,t2; # Test update with const tables # -create table `t1` ( `p_id` int(10) unsigned NOT NULL auto_increment, `p_code` varchar(20) NOT NULL default '', `p_created` datetime NOT NULL default '0000-00-00 00:00:00', `p_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`p_id`) ); -create table `t2` ( `c2_id` int(10) unsigned NULL auto_increment, `c2_p_id` int(10) unsigned NOT NULL default '0', `c2_note` text NOT NULL, `c2_created` datetime NOT NULL default '0000-00-00 00:00:00', `c2_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`c2_id`), KEY `c2_p_id` (`c2_p_id`) ); -insert into t1 values (0,'A01-Comp',now(),1); -insert into t1 values (0,'B01-Comp',now(),1); -insert into t2 values (0,1,'A Note',now(),1); +create table `t1` (`p_id` int(10) unsigned NOT NULL auto_increment, `p_code` varchar(20) NOT NULL default '', `p_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`p_id`) ); +create table `t2` (`c2_id` int(10) unsigned NULL auto_increment, `c2_p_id` int(10) unsigned NOT NULL default '0', `c2_note` text NOT NULL, `c2_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`c2_id`), KEY `c2_p_id` (`c2_p_id`) ); +insert into t1 values (0,'A01-Comp',1); +insert into t1 values (0,'B01-Comp',1); +insert into t2 values (0,1,'A Note',1); update t1 left join t2 on p_id = c2_p_id set c2_note = 'asdf-1' where p_id = 2; select * from t1; select * from t2; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 5b1487aa313..9d19458abf4 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -65,7 +65,7 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result, bool skip_first); static bool check_one_table_access(THD *thd, ulong want_access, TABLE_LIST *table, bool no_errors); -static inline bool all_tables_not_ok(THD *thd, TABLE_LIST *tables); + const char *any_db="*any*"; // Special symbol for check_access @@ -108,6 +108,7 @@ static void unlock_locked_tables(THD *thd) } } + static bool end_active_trans(THD *thd) { int error=0; @@ -123,6 +124,14 @@ static bool end_active_trans(THD *thd) } +inline bool all_tables_not_ok(THD *thd, TABLE_LIST *tables) +{ + return (table_rules_on && tables && !tables_ok(thd,tables) && + ((thd->lex.sql_command != SQLCOM_DELETE_MULTI) || + !tables_ok(thd,(TABLE_LIST *)thd->lex.auxilliary_table_list.first))); +} + + static HASH hash_user_connections; extern pthread_mutex_t LOCK_user_conn; @@ -2967,12 +2976,6 @@ void mysql_init_multi_delete(LEX *lex) lex->select->table_list.save_and_clear(&lex->auxilliary_table_list); } -static inline bool all_tables_not_ok(THD *thd, TABLE_LIST *tables) -{ - return (table_rules_on && tables && !tables_ok(thd,tables) && - ((thd->lex.sql_command != SQLCOM_DELETE_MULTI) || - !tables_ok(thd,(TABLE_LIST *)thd->lex.auxilliary_table_list.first))); -} /* When you modify mysql_parse(), you may need to mofify