mirror of
				https://github.com/MariaDB/server.git
				synced 2025-11-03 14:33:32 +03:00 
			
		
		
		
	Recommit with post-review fixes. mysql-test/r/log_tables.result: update result mysql-test/t/log_tables.test: add a test sql/log.cc: Fix NULL handling in log tables storage/csv/ha_tina.cc: Explicitly check fo NULLs, when writing a row. We should not hope, that the null field was cleaned up. Though usually we do call Field::reset() or restore_row(), before calling Field::set_null(), this depency is neither documented nor enforced by other means. mysql-test/t/log_tables-master.opt: New BitKeeper file ``mysql-test/t/log_tables-master.opt''
		
			
				
	
	
		
			75 lines
		
	
	
		
			3.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			75 lines
		
	
	
		
			3.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
use mysql;
 | 
						|
truncate table general_log;
 | 
						|
select * from general_log;
 | 
						|
event_time	user_host	thread_id	server_id	command_type	argument
 | 
						|
TIMESTAMP	root[root] @ localhost []	1	1	Query	select * from general_log
 | 
						|
truncate table slow_log;
 | 
						|
select * from slow_log;
 | 
						|
start_time	user_host	query_time	lock_time	rows_sent	rows_examined	db	last_insert_id	insert_id	server_id	sql_text
 | 
						|
truncate table general_log;
 | 
						|
select * from general_log where argument like '%general_log%';
 | 
						|
event_time	user_host	thread_id	server_id	command_type	argument
 | 
						|
TIMESTAMP	root[root] @ localhost []	1	1	Query	select * from general_log where argument like '%general_log%'
 | 
						|
create table join_test (verbose_comment varchar (80), command_type varchar(64));
 | 
						|
insert into join_test values ("User performed a usual SQL query", "Query");
 | 
						|
insert into join_test values ("New DB connection was registered", "Connect");
 | 
						|
insert into join_test values ("Get the table info", "Field List");
 | 
						|
select verbose_comment, user_host, argument
 | 
						|
from  mysql.general_log join join_test
 | 
						|
on (mysql.general_log.command_type = join_test.command_type);
 | 
						|
verbose_comment	user_host	argument
 | 
						|
User performed a usual SQL query	root[root] @ localhost []	select * from general_log where argument like '%general_log%'
 | 
						|
User performed a usual SQL query	root[root] @ localhost []	create table join_test (verbose_comment varchar (80), command_type varchar(64))
 | 
						|
User performed a usual SQL query	root[root] @ localhost []	insert into join_test values ("User performed a usual SQL query", "Query")
 | 
						|
User performed a usual SQL query	root[root] @ localhost []	insert into join_test values ("New DB connection was registered", "Connect")
 | 
						|
User performed a usual SQL query	root[root] @ localhost []	insert into join_test values ("Get the table info", "Field List")
 | 
						|
User performed a usual SQL query	root[root] @ localhost []	select verbose_comment, user_host, argument
 | 
						|
from  mysql.general_log join join_test
 | 
						|
on (mysql.general_log.command_type = join_test.command_type)
 | 
						|
drop table join_test;
 | 
						|
flush logs;
 | 
						|
lock tables mysql.general_log WRITE;
 | 
						|
ERROR HY000: You can't write-lock a log table. Only read access is possible.
 | 
						|
lock tables mysql.slow_log WRITE;
 | 
						|
ERROR HY000: You can't write-lock a log table. Only read access is possible.
 | 
						|
lock tables mysql.general_log READ;
 | 
						|
ERROR HY000: You can't use usual read lock with log tables. Try READ LOCAL instead.
 | 
						|
lock tables mysql.slow_log READ;
 | 
						|
ERROR HY000: You can't use usual read lock with log tables. Try READ LOCAL instead.
 | 
						|
lock tables mysql.slow_log READ LOCAL, mysql.general_log READ LOCAL;
 | 
						|
unlock tables;
 | 
						|
lock tables mysql.general_log READ LOCAL;
 | 
						|
 flush logs;
 | 
						|
unlock tables;
 | 
						|
select "Mark that we woke up from flush logs in the test"
 | 
						|
       as "test passed";
 | 
						|
test passed
 | 
						|
Mark that we woke up from flush logs in the test
 | 
						|
lock tables mysql.general_log READ LOCAL;
 | 
						|
 truncate mysql.general_log;
 | 
						|
unlock tables;
 | 
						|
select "Mark that we woke up from TRUNCATE in the test"
 | 
						|
       as "test passed";
 | 
						|
test passed
 | 
						|
Mark that we woke up from TRUNCATE in the test
 | 
						|
use test;
 | 
						|
truncate table mysql.general_log;
 | 
						|
set names utf8;
 | 
						|
create table bug16905 (s char(15) character set utf8 default 'пусто');
 | 
						|
insert into bug16905 values ('новое');
 | 
						|
select * from mysql.general_log;
 | 
						|
event_time	user_host	thread_id	server_id	command_type	argument
 | 
						|
TIMESTAMP	root[root] @ localhost []	2	1	Query	set names utf8
 | 
						|
TIMESTAMP	root[root] @ localhost []	2	1	Query	create table bug16905 (s char(15) character set utf8 default 'пусто')
 | 
						|
TIMESTAMP	root[root] @ localhost []	2	1	Query	insert into bug16905 values ('новое')
 | 
						|
TIMESTAMP	root[root] @ localhost []	2	1	Query	select * from mysql.general_log
 | 
						|
drop table bug16905;
 | 
						|
truncate table mysql.slow_log;
 | 
						|
set session long_query_time=1;
 | 
						|
select sleep(2);
 | 
						|
sleep(2)
 | 
						|
0
 | 
						|
select * from mysql.slow_log;
 | 
						|
start_time	user_host	query_time	lock_time	rows_sent	rows_examined	db	last_insert_id	insert_id	server_id	sql_text
 | 
						|
TIMESTAMP,	root[root] @ localhost []	USER_HOST,	QUERY_TIME	1	0	test	0	0	1	select sleep(2)
 |