← Back
Editing: test_sql_audit_log.result
call mtr.add_suppression("Plugin audit_log reported"); ########################################## # Run audit_log plugin ########################################## INSTALL PLUGIN audit_log SONAME 'audit_log.so'; # Creating tables CREATE TABLE t_int (c1 TINYINT, c2 SMALLINT, c3 MEDIUMINT, c4 INT, c5 INTEGER, c6 SMALLINT UNSIGNED, c7 MEDIUMINT UNSIGNED, c8 INT UNSIGNED, c9 INTEGER); CREATE TABLE t_bigint (c1 BIGINT, c2 BIGINT UNSIGNED); CREATE TABLE t_real (c1 REAL UNSIGNED, c2 DOUBLE UNSIGNED, c3 FLOAT UNSIGNED, c4 DECIMAL UNSIGNED, c5 NUMERIC UNSIGNED, c6 DOUBLE, c7 FLOAT, c8 DECIMAL, c9 NUMERIC); CREATE TABLE t_date (c1 DATE, c2 TIME, c3 TIMESTAMP, c4 DATETIME, c5 YEAR); # Inserting values into the tables INSERT INTO t_int VALUES (91,92,93,94,95,96,97,98,99),(81,82,83,84,85,86,87,88,89); INSERT INTO t_bigint VALUES (91,92),(81,82); INSERT INTO t_real VALUES (8.51,8.52,8.53,8.54,8.55,8.56,8.57,8.58,8.59); INSERT INTO t_real VALUES (9.51,9.52,9.53,9.54,9.55,9.56,9.57,9.58,9.59); INSERT INTO t_date VALUES ('2015-07-06','20:15','2015-12-31 14:59:48','2014-11-30 13:58:47','2015'); INSERT INTO t_date VALUES ('2015-07-07','20:17','2013-12-31 17:59:47','2012-10-31 15:57:47','2010'); ########################################## # Start plugin with audit log ########################################## INSTALL PLUGIN test_sql_2_sessions SONAME 'TEST_SQL_2_SESSIONS'; ########################################## # Stop plugin ########################################## UNINSTALL PLUGIN test_sql_2_sessions; ########################################## # Stop audit_log plugin ########################################## UNINSTALL PLUGIN audit_log; ########################################## # Plugin log ########################################## ======================================================================== Test in a server thread Opening Session 1 ======================================================================== Session 1 : ======================================================================== SELECT * FROM test.t_int num_cols: 9 nb rows: 2 c1 c2 c3 c4 c5 c6 c7 c8 c9 TINY(1) SHORT(2) INT24(9) LONG(3) LONG(3) SHORT(2) INT24(9) LONG(3) LONG(3) () () () () () (UNSIGNED ) (UNSIGNED ) (UNSIGNED ) () Write a string 91 92 93 94 95 96 97 98 99 81 82 83 84 85 86 87 88 89 affected rows : 0 server status : 34 warn count : 0 Opening Session 2 ======================================================================== Session 1 : ======================================================================== SELECT * FROM test.t_bigint num_cols: 2 nb rows: 2 c1 c2 LONGLONG(8) LONGLONG(8) () (UNSIGNED ) Write a string 91 92 81 82 affected rows : 0 server status : 34 warn count : 0 ======================================================================== Session 2 : ======================================================================== SELECT * FROM test.t_real num_cols: 9 nb rows: 2 c1 c2 c3 c4 c5 c6 c7 c8 c9 DOUBLE(5) DOUBLE(5) FLOAT(4) NEWDECIMAL(246) NEWDECIMAL(246) DOUBLE(5) FLOAT(4) NEWDECIMAL(246) NEWDECIMAL(246) (UNSIGNED ) (UNSIGNED ) (UNSIGNED ) (UNSIGNED ) (UNSIGNED ) () () () () Write a string 8.51 8.52 8.53 9 9 8.56 8.57 9 9 9.51 9.52 9.53 10 10 9.56 9.57 10 10 affected rows : 0 server status : 34 warn count : 0 Close Session 1 ======================================================================== Session 2 : ======================================================================== SELECT * FROM test.t_date num_cols: 5 nb rows: 2 c1 c2 c3 c4 c5 DATE(10) TIME(11) TIMESTAMP(7) DATETIME(12) YEAR(13) (BINARY ) (BINARY ) (NOT_NULL BINARY TIMESTAMP ON_UPDATE_NOW ) (BINARY ) (UNSIGNED ZEROFILL ) Write a string 2015-07-06 20:15:00 2015-12-31 14:59:48 2014-11-30 13:58:47 2015 2015-07-07 20:17:00 2013-12-31 17:59:47 2012-10-31 15:57:47 2010 affected rows : 0 server status : 34 warn count : 0 ======================================================================== Session 1 : ======================================================================== SELECT * FROM test.t_date Close Session 2 Follows threaded run ======================================================================== init thread Opening Session 1 ======================================================================== Session 1 : ======================================================================== SELECT * FROM test.t_int num_cols: 9 nb rows: 2 c1 c2 c3 c4 c5 c6 c7 c8 c9 TINY(1) SHORT(2) INT24(9) LONG(3) LONG(3) SHORT(2) INT24(9) LONG(3) LONG(3) () () () () () (UNSIGNED ) (UNSIGNED ) (UNSIGNED ) () Write a string 91 92 93 94 95 96 97 98 99 81 82 83 84 85 86 87 88 89 affected rows : 0 server status : 34 warn count : 0 Opening Session 2 ======================================================================== Session 1 : ======================================================================== SELECT * FROM test.t_bigint num_cols: 2 nb rows: 2 c1 c2 LONGLONG(8) LONGLONG(8) () (UNSIGNED ) Write a string 91 92 81 82 affected rows : 0 server status : 34 warn count : 0 ======================================================================== Session 2 : ======================================================================== SELECT * FROM test.t_real num_cols: 9 nb rows: 2 c1 c2 c3 c4 c5 c6 c7 c8 c9 DOUBLE(5) DOUBLE(5) FLOAT(4) NEWDECIMAL(246) NEWDECIMAL(246) DOUBLE(5) FLOAT(4) NEWDECIMAL(246) NEWDECIMAL(246) (UNSIGNED ) (UNSIGNED ) (UNSIGNED ) (UNSIGNED ) (UNSIGNED ) () () () () Write a string 8.51 8.52 8.53 9 9 8.56 8.57 9 9 9.51 9.52 9.53 10 10 9.56 9.57 10 10 affected rows : 0 server status : 34 warn count : 0 Close Session 1 ======================================================================== Session 2 : ======================================================================== SELECT * FROM test.t_date num_cols: 5 nb rows: 2 c1 c2 c3 c4 c5 DATE(10) TIME(11) TIMESTAMP(7) DATETIME(12) YEAR(13) (BINARY ) (BINARY ) (NOT_NULL BINARY TIMESTAMP ON_UPDATE_NOW ) (BINARY ) (UNSIGNED ZEROFILL ) Write a string 2015-07-06 20:15:00 2015-12-31 14:59:48 2014-11-30 13:58:47 2015 2015-07-07 20:17:00 2013-12-31 17:59:47 2012-10-31 15:57:47 2010 affected rows : 0 server status : 34 warn count : 0 ======================================================================== Session 1 : ======================================================================== SELECT * FROM test.t_date Close Session 2 deinit thread ########################################## # Check audit log file ########################################## CREATE TABLE t1 (c1 text); LOAD DATA INFILE 'MYSQL_LOGFILE' INTO TABLE t1(c1); SELECT * FROM t1 WHERE ExtractValue(c1, '/NAME')='Connect' ; c1 <NAME>Connect</NAME> <NAME>Connect</NAME> <NAME>Connect</NAME> <NAME>Connect</NAME> SELECT * FROM t1 WHERE ExtractValue(c1, '/SQLTEXT') LIKE '%FROM test.t_int%' ; c1 <SQLTEXT>SELECT * FROM test.t_int</SQLTEXT> <SQLTEXT>SELECT * FROM test.t_int</SQLTEXT> SELECT * FROM t1 WHERE ExtractValue(c1, '/SQLTEXT') LIKE '%FROM test.t_bigint%' ; c1 <SQLTEXT>SELECT * FROM test.t_bigint</SQLTEXT> <SQLTEXT>SELECT * FROM test.t_bigint</SQLTEXT> SELECT * FROM t1 WHERE ExtractValue(c1, '/NAME')='Quit' ; c1 <NAME>Quit</NAME> <NAME>Quit</NAME> <NAME>Quit</NAME> <NAME>Quit</NAME> ########################################## # Cleanup ########################################## # Dropping the created tables DROP TABLE t1; DROP TABLE t_int; DROP TABLE t_bigint; DROP TABLE t_real; DROP TABLE t_date;
Save File
Cancel