1
SET GLOBAL logging_query_filename="DRIZZLETEST_VARDIR/logging_query.log";
3
Number of queries logged : 1
4
preparing the test bed...
5
# The logging_query plugin is not enabled and hence none of the queries in prepare phase should be logged
6
CREATE SCHEMA Test_Update;
8
CREATE TABLE test_info (id INT, name CHAR(10));
9
INSERT INTO test_info VALUES (1,"create"),(2,"select"),(3,"insert"),(4,"update"),(5,"delete");
10
# This should print 1 indicating that the log file is still empty
11
Number of queries logged : 1
13
UPDATE test in progress...
14
# The logging_query plugin is not enabled and the following update query should not be logged
15
UPDATE test_info SET name="CREATE" WHERE id=1;
16
# This should print 1 indicating that the log file is still empty
17
Number of queries logged : 1
19
# Enabling the logging_query plugin
20
SET GLOBAL logging_query_enable=true;
22
# The logging_query plugin is enabled and the following update query should be logged
23
UPDATE test_info SET name="SELECT" WHERE id=2;
24
# This should print 3 indicating that the above query is logged
25
Number of queries logged : 1
27
# Enabling the logging_query plugin to log only select queries
28
SET GLOBAL logging_query_pcre="SELECT.+";
30
# The following UPDATE query should not be logged
31
UPDATE test_info SET name="INSERT" WHERE id=3;
32
SELECT * FROM test_info;
39
# This should print 5 indicating that, only the UPDATE query is NOT logged
40
Number of queries logged : 2
42
# Enabling the logging_query plugin to log UPDATE queries
43
SET GLOBAL logging_query_pcre="UPDATE.+";
45
# The followihng UPDATE query should be logged
46
UPDATE test_info SET name="UPDATE" WHERE id=6;
47
# The above query will not update the table since a tuple with id=6 does not exist
48
SELECT * FROM test_info;
55
# This should print 7 indicating that, only the UPDATE query is logged and not the select query
56
Number of queries logged : 2
59
SET GLOBAL logging_query_enable=false;
60
SET GLOBAL logging_query_pcre=".+";
61
DROP SCHEMA Test_Update;