Commit 99490870 authored by monty@mashka.mysql.fi's avatar monty@mashka.mysql.fi

Cleaned up last bug fixes

Fix bug in SHOW GRANTS when there is a column privilege but no table privilege
parent 434cea19
...@@ -424,6 +424,8 @@ int simple_command(MYSQL *mysql,enum enum_server_command command, ...@@ -424,6 +424,8 @@ int simple_command(MYSQL *mysql,enum enum_server_command command,
unsigned long net_safe_read(MYSQL* mysql); unsigned long net_safe_read(MYSQL* mysql);
void mysql_once_init(void); void mysql_once_init(void);
extern my_bool server_inited;
#ifdef __NETWARE__ #ifdef __NETWARE__
#pragma pack(pop) /* restore alignment */ #pragma pack(pop) /* restore alignment */
#endif #endif
......
...@@ -74,8 +74,6 @@ static int send_file_to_server(MYSQL *mysql,const char *filename); ...@@ -74,8 +74,6 @@ static int send_file_to_server(MYSQL *mysql,const char *filename);
static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to, static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
const char *from, ulong length); const char *from, ulong length);
extern char server_inited;
#define init_sigpipe_variables #define init_sigpipe_variables
#define set_sigpipe(mysql) #define set_sigpipe(mysql)
#define reset_sigpipe(mysql) #define reset_sigpipe(mysql)
......
...@@ -91,39 +91,39 @@ show grants for mysqltest_1@localhost; ...@@ -91,39 +91,39 @@ show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT SELECT, INSERT, INSERT (a), REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost' GRANT SELECT, INSERT, INSERT (a), REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost'
REVOKE insert,insert (a) on t1 from mysqltest_1@localhost; REVOKE select,update,insert,insert (a) on t1 from mysqltest_1@localhost;
GRANT references on t1 to mysqltest_1@localhost;
show grants for mysqltest_1@localhost; show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT SELECT, REFERENCES, REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost' GRANT REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost'
GRANT select,references on t1 to mysqltest_1@localhost;
select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1"; select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
table_priv column_priv table_priv column_priv
Select,References References Select,References References
grant all on test.* to user1@localhost with grant option; grant all on test.* to mysqltest_3@localhost with grant option;
revoke all on test.* from user1@localhost; revoke all on test.* from mysqltest_3@localhost;
show grants for user1@localhost; show grants for mysqltest_3@localhost;
Grants for user1@localhost Grants for mysqltest_3@localhost
GRANT USAGE ON *.* TO 'user1'@'localhost' GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
GRANT USAGE ON `test`.* TO 'user1'@'localhost' WITH GRANT OPTION GRANT USAGE ON `test`.* TO 'mysqltest_3'@'localhost' WITH GRANT OPTION
revoke grant option on test.* from user1@localhost; revoke grant option on test.* from mysqltest_3@localhost;
show grants for user1@localhost; show grants for mysqltest_3@localhost;
Grants for user1@localhost Grants for mysqltest_3@localhost
GRANT USAGE ON *.* TO 'user1'@'localhost' GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
grant all on test.t1 to user2@localhost with grant option; grant all on test.t1 to mysqltest_2@localhost with grant option;
revoke all on test.t1 from user2@localhost; revoke all on test.t1 from mysqltest_2@localhost;
show grants for user2@localhost; show grants for mysqltest_2@localhost;
Grants for user2@localhost Grants for mysqltest_2@localhost
GRANT USAGE ON *.* TO 'user2'@'localhost' GRANT USAGE ON *.* TO 'mysqltest_2'@'localhost'
GRANT USAGE ON `test`.`t1` TO 'user2'@'localhost' WITH GRANT OPTION GRANT USAGE ON `test`.`t1` TO 'mysqltest_2'@'localhost' WITH GRANT OPTION
revoke grant option on test.t1 from user2@localhost; revoke grant option on test.t1 from mysqltest_2@localhost;
show grants for user2@localhost; show grants for mysqltest_2@localhost;
Grants for user2@localhost Grants for mysqltest_2@localhost
GRANT USAGE ON *.* TO 'user2'@'localhost' GRANT USAGE ON *.* TO 'mysqltest_2'@'localhost'
delete from mysql.user where user='mysqltest_1'; delete from mysql.user where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
delete from mysql.db where user='mysqltest_1'; delete from mysql.db where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
delete from mysql.tables_priv where user='mysqltest_1'; delete from mysql.tables_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
delete from mysql.columns_priv where user='mysqltest_1'; delete from mysql.columns_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
flush privileges; flush privileges;
drop table t1; drop table t1;
GRANT FILE on mysqltest.* to mysqltest_1@localhost; GRANT FILE on mysqltest.* to mysqltest_1@localhost;
......
drop table if exists ti, tm; drop table if exists t1, t2;
create table ti (a int) type=innodb; create table t1 (a int) type=innodb;
create table tm (a int) type=myisam; create table t2 (a int) type=myisam;
reset master; reset master;
begin; begin;
insert into ti values(1); insert into t1 values(1);
insert into tm select * from ti; insert into t2 select * from t1;
commit; commit;
show binlog events from 79; show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 79 Query 1 79 use test; BEGIN master-bin.001 79 Query 1 79 use test; BEGIN
master-bin.001 119 Query 1 79 use test; insert into ti values(1) master-bin.001 119 Query 1 79 use test; insert into t1 values(1)
master-bin.001 178 Query 1 79 use test; insert into tm select * from ti master-bin.001 178 Query 1 79 use test; insert into t2 select * from t1
master-bin.001 244 Query 1 244 use test; COMMIT master-bin.001 244 Query 1 244 use test; COMMIT
delete from ti; delete from t1;
delete from tm; delete from t2;
reset master; reset master;
begin; begin;
insert into ti values(2); insert into t1 values(2);
insert into tm select * from ti; insert into t2 select * from t1;
rollback; rollback;
Warning: Some non-transactional changed tables couldn't be rolled back Warning: Some non-transactional changed tables couldn't be rolled back
show binlog events from 79; show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 79 Query 1 79 use test; BEGIN master-bin.001 79 Query 1 79 use test; BEGIN
master-bin.001 119 Query 1 79 use test; insert into ti values(2) master-bin.001 119 Query 1 79 use test; insert into t1 values(2)
master-bin.001 178 Query 1 79 use test; insert into tm select * from ti master-bin.001 178 Query 1 79 use test; insert into t2 select * from t1
master-bin.001 244 Query 1 244 use test; ROLLBACK master-bin.001 244 Query 1 244 use test; ROLLBACK
delete from ti; delete from t1;
delete from tm; delete from t2;
reset master; reset master;
begin; begin;
insert into ti values(3); insert into t1 values(3);
savepoint my_savepoint; savepoint my_savepoint;
insert into ti values(4); insert into t1 values(4);
insert into tm select * from ti; insert into t2 select * from t1;
rollback to savepoint my_savepoint; rollback to savepoint my_savepoint;
Warning: Some non-transactional changed tables couldn't be rolled back Warning: Some non-transactional changed tables couldn't be rolled back
commit; commit;
show binlog events from 79; show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 79 Query 1 79 use test; BEGIN master-bin.001 79 Query 1 79 use test; BEGIN
master-bin.001 119 Query 1 79 use test; insert into ti values(3) master-bin.001 119 Query 1 79 use test; insert into t1 values(3)
master-bin.001 178 Query 1 79 use test; savepoint my_savepoint master-bin.001 178 Query 1 79 use test; savepoint my_savepoint
master-bin.001 235 Query 1 79 use test; insert into ti values(4) master-bin.001 235 Query 1 79 use test; insert into t1 values(4)
master-bin.001 294 Query 1 79 use test; insert into tm select * from ti master-bin.001 294 Query 1 79 use test; insert into t2 select * from t1
master-bin.001 360 Query 1 79 use test; rollback to savepoint my_savepoint master-bin.001 360 Query 1 79 use test; rollback to savepoint my_savepoint
master-bin.001 429 Query 1 429 use test; COMMIT master-bin.001 429 Query 1 429 use test; COMMIT
delete from ti; delete from t1;
delete from tm; delete from t2;
reset master; reset master;
begin; begin;
insert into ti values(5); insert into t1 values(5);
savepoint my_savepoint; savepoint my_savepoint;
insert into ti values(6); insert into t1 values(6);
insert into tm select * from ti; insert into t2 select * from t1;
rollback to savepoint my_savepoint; rollback to savepoint my_savepoint;
Warning: Some non-transactional changed tables couldn't be rolled back Warning: Some non-transactional changed tables couldn't be rolled back
insert into ti values(7); insert into t1 values(7);
commit; commit;
select a from ti order by a; select a from t1 order by a;
a a
5 5
7 7
show binlog events from 79; show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 79 Query 1 79 use test; BEGIN master-bin.001 79 Query 1 79 use test; BEGIN
master-bin.001 119 Query 1 79 use test; insert into ti values(5) master-bin.001 119 Query 1 79 use test; insert into t1 values(5)
master-bin.001 178 Query 1 79 use test; savepoint my_savepoint master-bin.001 178 Query 1 79 use test; savepoint my_savepoint
master-bin.001 235 Query 1 79 use test; insert into ti values(6) master-bin.001 235 Query 1 79 use test; insert into t1 values(6)
master-bin.001 294 Query 1 79 use test; insert into tm select * from ti master-bin.001 294 Query 1 79 use test; insert into t2 select * from t1
master-bin.001 360 Query 1 79 use test; rollback to savepoint my_savepoint master-bin.001 360 Query 1 79 use test; rollback to savepoint my_savepoint
master-bin.001 429 Query 1 79 use test; insert into ti values(7) master-bin.001 429 Query 1 79 use test; insert into t1 values(7)
master-bin.001 488 Query 1 488 use test; COMMIT master-bin.001 488 Query 1 488 use test; COMMIT
delete from ti; delete from t1;
delete from tm; delete from t2;
reset master; reset master;
select get_lock("a",10); select get_lock("a",10);
get_lock("a",10) get_lock("a",10)
1 1
begin; begin;
insert into ti values(8); insert into t1 values(8);
insert into tm select * from ti; insert into t2 select * from t1;
select get_lock("a",10); select get_lock("a",10);
get_lock("a",10) get_lock("a",10)
1 1
show binlog events from 79; show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 79 Query 1 79 use test; BEGIN master-bin.001 79 Query 1 79 use test; BEGIN
master-bin.001 119 Query 1 79 use test; insert into ti values(8) master-bin.001 119 Query 1 79 use test; insert into t1 values(8)
master-bin.001 178 Query 1 79 use test; insert into tm select * from ti master-bin.001 178 Query 1 79 use test; insert into t2 select * from t1
master-bin.001 244 Query 1 244 use test; ROLLBACK master-bin.001 244 Query 1 244 use test; ROLLBACK
delete from ti; delete from t1;
delete from tm; delete from t2;
reset master; reset master;
insert into ti values(9); insert into t1 values(9);
insert into tm select * from ti; insert into t2 select * from t1;
show binlog events from 79; show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 79 Query 1 79 use test; insert into ti values(9) master-bin.001 79 Query 1 79 use test; insert into t1 values(9)
master-bin.001 138 Query 1 138 use test; insert into tm select * from ti master-bin.001 138 Query 1 138 use test; insert into t2 select * from t1
delete from ti; delete from t1;
delete from tm; delete from t2;
reset master; reset master;
insert into ti values(10); insert into t1 values(10);
begin; begin;
insert into tm select * from ti; insert into t2 select * from t1;
show binlog events from 79; show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 79 Query 1 79 use test; insert into ti values(10) master-bin.001 79 Query 1 79 use test; insert into t1 values(10)
master-bin.001 139 Query 1 139 use test; insert into tm select * from ti master-bin.001 139 Query 1 139 use test; insert into t2 select * from t1
insert into ti values(11); insert into t1 values(11);
commit; commit;
show binlog events from 79; show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 79 Query 1 79 use test; insert into ti values(10) master-bin.001 79 Query 1 79 use test; insert into t1 values(10)
master-bin.001 139 Query 1 139 use test; insert into tm select * from ti master-bin.001 139 Query 1 139 use test; insert into t2 select * from t1
master-bin.001 205 Query 1 205 use test; BEGIN master-bin.001 205 Query 1 205 use test; BEGIN
master-bin.001 245 Query 1 205 use test; insert into ti values(11) master-bin.001 245 Query 1 205 use test; insert into t1 values(11)
master-bin.001 305 Query 1 305 use test; COMMIT master-bin.001 305 Query 1 305 use test; COMMIT
alter table tm type=INNODB; alter table t2 type=INNODB;
delete from ti; delete from t1;
delete from tm; delete from t2;
reset master; reset master;
begin; begin;
insert into ti values(12); insert into t1 values(12);
insert into tm select * from ti; insert into t2 select * from t1;
commit; commit;
show binlog events from 79; show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 79 Query 1 79 use test; BEGIN master-bin.001 79 Query 1 79 use test; BEGIN
master-bin.001 119 Query 1 79 use test; insert into ti values(12) master-bin.001 119 Query 1 79 use test; insert into t1 values(12)
master-bin.001 179 Query 1 79 use test; insert into tm select * from ti master-bin.001 179 Query 1 79 use test; insert into t2 select * from t1
master-bin.001 245 Query 1 245 use test; COMMIT master-bin.001 245 Query 1 245 use test; COMMIT
delete from ti; delete from t1;
delete from tm; delete from t2;
reset master; reset master;
begin; begin;
insert into ti values(13); insert into t1 values(13);
insert into tm select * from ti; insert into t2 select * from t1;
rollback; rollback;
show binlog events from 79; show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
delete from ti; delete from t1;
delete from tm; delete from t2;
reset master; reset master;
begin; begin;
insert into ti values(14); insert into t1 values(14);
savepoint my_savepoint; savepoint my_savepoint;
insert into ti values(15); insert into t1 values(15);
insert into tm select * from ti; insert into t2 select * from t1;
rollback to savepoint my_savepoint; rollback to savepoint my_savepoint;
commit; commit;
show binlog events from 79; show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 79 Query 1 79 use test; BEGIN master-bin.001 79 Query 1 79 use test; BEGIN
master-bin.001 119 Query 1 79 use test; insert into ti values(14) master-bin.001 119 Query 1 79 use test; insert into t1 values(14)
master-bin.001 179 Query 1 179 use test; COMMIT master-bin.001 179 Query 1 179 use test; COMMIT
delete from ti; delete from t1;
delete from tm; delete from t2;
reset master; reset master;
begin; begin;
insert into ti values(16); insert into t1 values(16);
savepoint my_savepoint; savepoint my_savepoint;
insert into ti values(17); insert into t1 values(17);
insert into tm select * from ti; insert into t2 select * from t1;
rollback to savepoint my_savepoint; rollback to savepoint my_savepoint;
insert into ti values(18); insert into t1 values(18);
commit; commit;
select a from ti order by a; select a from t1 order by a;
a a
16 16
18 18
show binlog events from 79; show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 79 Query 1 79 use test; BEGIN master-bin.001 79 Query 1 79 use test; BEGIN
master-bin.001 119 Query 1 79 use test; insert into ti values(16) master-bin.001 119 Query 1 79 use test; insert into t1 values(16)
master-bin.001 179 Query 1 79 use test; insert into ti values(18) master-bin.001 179 Query 1 79 use test; insert into t1 values(18)
master-bin.001 239 Query 1 239 use test; COMMIT master-bin.001 239 Query 1 239 use test; COMMIT
drop table ti,tm; drop table t1,t2;
...@@ -62,24 +62,24 @@ show grants for mysqltest_1@localhost; ...@@ -62,24 +62,24 @@ show grants for mysqltest_1@localhost;
select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1"; select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
REVOKE select (a), update on t1 from mysqltest_1@localhost; REVOKE select (a), update on t1 from mysqltest_1@localhost;
show grants for mysqltest_1@localhost; show grants for mysqltest_1@localhost;
REVOKE insert,insert (a) on t1 from mysqltest_1@localhost; REVOKE select,update,insert,insert (a) on t1 from mysqltest_1@localhost;
GRANT references on t1 to mysqltest_1@localhost;
show grants for mysqltest_1@localhost; show grants for mysqltest_1@localhost;
GRANT select,references on t1 to mysqltest_1@localhost;
select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1"; select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
grant all on test.* to user1@localhost with grant option; grant all on test.* to mysqltest_3@localhost with grant option;
revoke all on test.* from user1@localhost; revoke all on test.* from mysqltest_3@localhost;
show grants for user1@localhost; show grants for mysqltest_3@localhost;
revoke grant option on test.* from user1@localhost; revoke grant option on test.* from mysqltest_3@localhost;
show grants for user1@localhost; show grants for mysqltest_3@localhost;
grant all on test.t1 to user2@localhost with grant option; grant all on test.t1 to mysqltest_2@localhost with grant option;
revoke all on test.t1 from user2@localhost; revoke all on test.t1 from mysqltest_2@localhost;
show grants for user2@localhost; show grants for mysqltest_2@localhost;
revoke grant option on test.t1 from user2@localhost; revoke grant option on test.t1 from mysqltest_2@localhost;
show grants for user2@localhost; show grants for mysqltest_2@localhost;
delete from mysql.user where user='mysqltest_1'; delete from mysql.user where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
delete from mysql.db where user='mysqltest_1'; delete from mysql.db where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
delete from mysql.tables_priv where user='mysqltest_1'; delete from mysql.tables_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
delete from mysql.columns_priv where user='mysqltest_1'; delete from mysql.columns_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
flush privileges; flush privileges;
drop table t1; drop table t1;
......
# Check that binlog is ok when a transaction mixes updates to InnoDB and # Check that binlog is ok when a transaction mixes updates to InnoDB and
# MyISAM. It would be nice to make this a replication test, but in 4.0 the slave # MyISAM.
# is always with --skip-innodb in the testsuite. I (Guilhem) however did some # It would be nice to make this a replication test, but in 4.0 the
# tests manually on a slave; tables are replicated fine and Exec_master_log_pos # slave is always with --skip-innodb in the testsuite. I (Guilhem) however
# advances as expected. # did some tests manually on a slave; tables are replicated fine and
# Exec_master_log_pos advances as expected.
-- source include/have_innodb.inc -- source include/have_innodb.inc
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
connection con1; connection con1;
create table t1 (a int) type=innodb;
drop table if exists ti, tm; create table t2 (a int) type=myisam;
create table ti (a int) type=innodb;
create table tm (a int) type=myisam;
reset master; reset master;
begin; begin;
insert into ti values(1); insert into t1 values(1);
insert into tm select * from ti; insert into t2 select * from t1;
commit; commit;
show binlog events from 79; show binlog events from 79;
delete from ti; delete from t1;
delete from tm; delete from t2;
reset master; reset master;
begin; begin;
insert into ti values(2); insert into t1 values(2);
insert into tm select * from ti; insert into t2 select * from t1;
# should say some changes to non-transactional tables couldn't be rolled back # should say some changes to non-transact1onal tables couldn't be rolled back
--error 1196 --error 1196
rollback; rollback;
show binlog events from 79; show binlog events from 79;
delete from ti; delete from t1;
delete from tm; delete from t2;
reset master; reset master;
begin; begin;
insert into ti values(3); insert into t1 values(3);
savepoint my_savepoint; savepoint my_savepoint;
insert into ti values(4); insert into t1 values(4);
insert into tm select * from ti; insert into t2 select * from t1;
--error 1196 --error 1196
rollback to savepoint my_savepoint; rollback to savepoint my_savepoint;
commit; commit;
show binlog events from 79; show binlog events from 79;
delete from ti; delete from t1;
delete from tm; delete from t2;
reset master; reset master;
begin; begin;
insert into ti values(5); insert into t1 values(5);
savepoint my_savepoint; savepoint my_savepoint;
insert into ti values(6); insert into t1 values(6);
insert into tm select * from ti; insert into t2 select * from t1;
--error 1196 --error 1196
rollback to savepoint my_savepoint; rollback to savepoint my_savepoint;
insert into ti values(7); insert into t1 values(7);
commit; commit;
select a from ti order by a; # check that savepoints work :) select a from t1 order by a; # check that savepoints work :)
show binlog events from 79; show binlog events from 79;
# and when ROLLBACK is not explicit? # and when ROLLBACK is not explicit?
delete from ti; delete from t1;
delete from tm; delete from t2;
reset master; reset master;
select get_lock("a",10); select get_lock("a",10);
begin; begin;
insert into ti values(8); insert into t1 values(8);
insert into tm select * from ti; insert into t2 select * from t1;
disconnect con1; disconnect con1;
connection con2; connection con2;
...@@ -89,87 +92,87 @@ connection con2; ...@@ -89,87 +92,87 @@ connection con2;
select get_lock("a",10); select get_lock("a",10);
show binlog events from 79; show binlog events from 79;
# and when not in a transaction? # and when not in a transact1on?
delete from ti; delete from t1;
delete from tm; delete from t2;
reset master; reset master;
insert into ti values(9); insert into t1 values(9);
insert into tm select * from ti; insert into t2 select * from t1;
show binlog events from 79; show binlog events from 79;
# Check that when the query updating the MyISAM table is the first in the # Check that when the query updat1ng the MyISAM table is the first in the
# transaction, we log it immediately. # transact1on, we log it immediately.
delete from ti; delete from t1;
delete from tm; delete from t2;
reset master; reset master;
insert into ti values(10); # first make ti non-empty insert into t1 values(10); # first make t1 non-empty
begin; begin;
insert into tm select * from ti; insert into t2 select * from t1;
show binlog events from 79; show binlog events from 79;
insert into ti values(11); insert into t1 values(11);
commit; commit;
show binlog events from 79; show binlog events from 79;
# Check that things work like before this BEGIN/ROLLBACK code was added, when tm # Check that things work like before this BEGIN/ROLLBACK code was added,
# is INNODB # when t2 is INNODB
alter table tm type=INNODB; alter table t2 type=INNODB;
delete from ti; delete from t1;
delete from tm; delete from t2;
reset master; reset master;
begin; begin;
insert into ti values(12); insert into t1 values(12);
insert into tm select * from ti; insert into t2 select * from t1;
commit; commit;
show binlog events from 79; show binlog events from 79;
delete from ti; delete from t1;
delete from tm; delete from t2;
reset master; reset master;
begin; begin;
insert into ti values(13); insert into t1 values(13);
insert into tm select * from ti; insert into t2 select * from t1;
rollback; rollback;
show binlog events from 79; show binlog events from 79;
delete from ti; delete from t1;
delete from tm; delete from t2;
reset master; reset master;
begin; begin;
insert into ti values(14); insert into t1 values(14);
savepoint my_savepoint; savepoint my_savepoint;
insert into ti values(15); insert into t1 values(15);
insert into tm select * from ti; insert into t2 select * from t1;
rollback to savepoint my_savepoint; rollback to savepoint my_savepoint;
commit; commit;
show binlog events from 79; show binlog events from 79;
delete from ti; delete from t1;
delete from tm; delete from t2;
reset master; reset master;
begin; begin;
insert into ti values(16); insert into t1 values(16);
savepoint my_savepoint; savepoint my_savepoint;
insert into ti values(17); insert into t1 values(17);
insert into tm select * from ti; insert into t2 select * from t1;
rollback to savepoint my_savepoint; rollback to savepoint my_savepoint;
insert into ti values(18); insert into t1 values(18);
commit; commit;
select a from ti order by a; # check that savepoints work :) select a from t1 order by a; # check that savepoints work :)
show binlog events from 79; show binlog events from 79;
drop table ti,tm; drop table t1,t2;
...@@ -3091,17 +3091,19 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) ...@@ -3091,17 +3091,19 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
if ((table_access | grant_table->cols) != 0) if ((table_access | grant_table->cols) != 0)
{ {
String global(buff,sizeof(buff)); String global(buff,sizeof(buff));
ulong test_access= (table_access | grant_table->cols) & ~GRANT_ACL;
global.length(0); global.length(0);
global.append("GRANT ",6); global.append("GRANT ",6);
if (test_all_bits(table_access, (TABLE_ACLS & ~GRANT_ACL))) if (test_all_bits(table_access, (TABLE_ACLS & ~GRANT_ACL)))
global.append("ALL PRIVILEGES",14); global.append("ALL PRIVILEGES",14);
else if (!(table_access & ~GRANT_ACL)) else if (!test_access)
global.append("USAGE",5); global.append("USAGE",5);
else else
{ {
int found= 0; int found= 0;
ulong j,test_access= (table_access | grant_table->cols) & ~GRANT_ACL; ulong j;
for (counter= 0, j= SELECT_ACL; j <= TABLE_ACLS; counter++, j<<= 1) for (counter= 0, j= SELECT_ACL; j <= TABLE_ACLS; counter++, j<<= 1)
{ {
......
...@@ -1500,7 +1500,7 @@ mysql_execute_command(void) ...@@ -1500,7 +1500,7 @@ mysql_execute_command(void)
break; break;
} }
#ifndef EMBEDDED_LIBRARY #ifdef HAVE_REPLICATION
case SQLCOM_CHANGE_MASTER: case SQLCOM_CHANGE_MASTER:
{ {
if (check_global_access(thd, SUPER_ACL)) if (check_global_access(thd, SUPER_ACL))
...@@ -1538,7 +1538,7 @@ mysql_execute_command(void) ...@@ -1538,7 +1538,7 @@ mysql_execute_command(void)
res = load_master_data(thd); res = load_master_data(thd);
break; break;
#endif /*!EMBEDDED_LIBRARY*/ #endif /* HAVE_REPLICATION */
#ifdef HAVE_INNOBASE_DB #ifdef HAVE_INNOBASE_DB
case SQLCOM_SHOW_INNODB_STATUS: case SQLCOM_SHOW_INNODB_STATUS:
...@@ -1550,7 +1550,7 @@ mysql_execute_command(void) ...@@ -1550,7 +1550,7 @@ mysql_execute_command(void)
} }
#endif #endif
#ifndef EMBEDDED_LIBRARY #ifdef HAVE_REPLICATION
case SQLCOM_LOAD_MASTER_TABLE: case SQLCOM_LOAD_MASTER_TABLE:
{ {
if (!tables->db) if (!tables->db)
...@@ -1577,7 +1577,7 @@ mysql_execute_command(void) ...@@ -1577,7 +1577,7 @@ mysql_execute_command(void)
UNLOCK_ACTIVE_MI; UNLOCK_ACTIVE_MI;
break; break;
} }
#endif /*!EMBEDDED_LIBRARY*/ #endif /* HAVE_REPLICATION */
case SQLCOM_CREATE_TABLE: case SQLCOM_CREATE_TABLE:
{ {
...@@ -1683,7 +1683,7 @@ mysql_execute_command(void) ...@@ -1683,7 +1683,7 @@ mysql_execute_command(void)
res = mysql_create_index(thd, tables, lex->key_list); res = mysql_create_index(thd, tables, lex->key_list);
break; break;
#ifndef EMBEDDED_LIBRARY #ifdef HAVE_REPLICATION
case SQLCOM_SLAVE_START: case SQLCOM_SLAVE_START:
{ {
LOCK_ACTIVE_MI; LOCK_ACTIVE_MI;
...@@ -1716,7 +1716,7 @@ mysql_execute_command(void) ...@@ -1716,7 +1716,7 @@ mysql_execute_command(void)
UNLOCK_ACTIVE_MI; UNLOCK_ACTIVE_MI;
break; break;
} }
#endif /*!EMBEDDED_LIBRARY*/ #endif /* HAVE_REPLICATION */
case SQLCOM_ALTER_TABLE: case SQLCOM_ALTER_TABLE:
#if defined(DONT_ALLOW_SHOW_COMMANDS) #if defined(DONT_ALLOW_SHOW_COMMANDS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment