~drizzle-trunk/drizzle/development

2311.1.1 by Daniel Nichter
Add query_log plugin. It's tested and documented.
1
Log file does not exist
2
select * from data_dictionary.plugins join data_dictionary.modules on plugins.plugin_name=modules.module_name where plugin_name='query_log';
3
PLUGIN_NAME	query_log
4
PLUGIN_TYPE	EventObserver
5
IS_ACTIVE	YES
6
MODULE_NAME	query_log
7
MODULE_NAME	query_log
8
MODULE_VERSION	1.0
9
MODULE_AUTHOR	Daniel Nichter
10
IS_BUILTIN	NO
11
MODULE_LIBRARY	query_log
12
MODULE_DESCRIPTION	Query Log
13
MODULE_LICENSE	GPL
14
SELECT @@query_log_enabled, @@query_log_file_enabled;
15
@@query_log_enabled	@@query_log_file_enabled
16
1	0
17
SELECT 1;
18
1
19
1
20
SET GLOBAL query_log_file_enabled=TRUE;
21
SELECT @@query_log_enabled, @@query_log_file_enabled;
22
@@query_log_enabled	@@query_log_file_enabled
23
1	1
2420.1.1 by Daniel
Make first event line start_ts=TS. Update and expand docu; fix a typo (wrong version).
24
# start_ts=0-00-00T00:00:00.000000
2311.1.1 by Daniel Nichter
Add query_log plugin. It's tested and documented.
25
# session_id=0 query_id=0 rows_examined=0 rows_sent=0 tmp_tables=0 warnings=0
26
# execution_time=0.000000 lock_time=0.000000 session_time=0.000000
27
# error=false
28
# schema="test"
29
SET GLOBAL query_log_file_enabled=TRUE;
30
#
2420.1.1 by Daniel
Make first event line start_ts=TS. Update and expand docu; fix a typo (wrong version).
31
# start_ts=0-00-00T00:00:00.000000
2311.1.1 by Daniel Nichter
Add query_log plugin. It's tested and documented.
32
# session_id=0 query_id=0 rows_examined=0 rows_sent=0 tmp_tables=0 warnings=0
33
# execution_time=0.000000 lock_time=0.000000 session_time=0.000000
34
# error=false
35
# schema="test"
36
SELECT @@query_log_enabled, @@query_log_file_enabled;
37
#
38
SET GLOBAL query_log_enabled=FALSE;
39
SELECT @@query_log_enabled, @@query_log_file_enabled;
40
@@query_log_enabled	@@query_log_file_enabled
41
0	1
42
SELECT 2;
43
2
44
2
2420.1.1 by Daniel
Make first event line start_ts=TS. Update and expand docu; fix a typo (wrong version).
45
# start_ts=0-00-00T00:00:00.000000
2311.1.1 by Daniel Nichter
Add query_log plugin. It's tested and documented.
46
# session_id=0 query_id=0 rows_examined=0 rows_sent=0 tmp_tables=0 warnings=0
47
# execution_time=0.000000 lock_time=0.000000 session_time=0.000000
48
# error=false
49
# schema="test"
50
SET GLOBAL query_log_file_enabled=TRUE;
51
#
2420.1.1 by Daniel
Make first event line start_ts=TS. Update and expand docu; fix a typo (wrong version).
52
# start_ts=0-00-00T00:00:00.000000
2311.1.1 by Daniel Nichter
Add query_log plugin. It's tested and documented.
53
# session_id=0 query_id=0 rows_examined=0 rows_sent=0 tmp_tables=0 warnings=0
54
# execution_time=0.000000 lock_time=0.000000 session_time=0.000000
55
# error=false
56
# schema="test"
57
SELECT @@query_log_enabled, @@query_log_file_enabled;
58
#
59
SET GLOBAL query_log_file_enabled=FALSE;
60
SELECT @@query_log_enabled, @@query_log_file_enabled;
61
@@query_log_enabled	@@query_log_file_enabled
62
0	0
63
SET GLOBAL query_log_file="DRIZZLETEST_VARDIR/query-2.log";
64
SELECT @@query_log_enabled, @@query_log_file_enabled, @@query_log_file;
65
@@query_log_enabled	@@query_log_file_enabled	@@query_log_file
66
0	0	DRIZZLETEST_VARDIR/query-2.log
67
Log file does not exist
68
SET GLOBAL query_log_enabled=TRUE;
69
SET GLOBAL query_log_file_enabled=TRUE;
70
SELECT 'this is the second log file';
71
this is the second log file
72
this is the second log file
73
Log file exists
2420.1.1 by Daniel
Make first event line start_ts=TS. Update and expand docu; fix a typo (wrong version).
74
# start_ts=0-00-00T00:00:00.000000
2311.1.10 by Daniel Nichter
Make tests idempotent.
75
# session_id=0 query_id=0 rows_examined=0 rows_sent=0 tmp_tables=0 warnings=0
2311.1.1 by Daniel Nichter
Add query_log plugin. It's tested and documented.
76
# execution_time=0.000000 lock_time=0.000000 session_time=0.000000
77
# error=false
78
# schema="test"
79
SET GLOBAL query_log_file_enabled=TRUE;
80
#
2420.1.1 by Daniel
Make first event line start_ts=TS. Update and expand docu; fix a typo (wrong version).
81
# start_ts=0-00-00T00:00:00.000000
2311.1.10 by Daniel Nichter
Make tests idempotent.
82
# session_id=0 query_id=0 rows_examined=0 rows_sent=0 tmp_tables=0 warnings=0
2311.1.1 by Daniel Nichter
Add query_log plugin. It's tested and documented.
83
# execution_time=0.000000 lock_time=0.000000 session_time=0.000000
84
# error=false
85
# schema="test"
86
SELECT 'this is the second log file';
87
#
88
SET GLOBAL query_log_file="DRIZZLETEST_VARDIR/query-3.log";
89
SELECT @@query_log_enabled, @@query_log_file_enabled, @@query_log_file;
90
@@query_log_enabled	@@query_log_file_enabled	@@query_log_file
91
1	1	DRIZZLETEST_VARDIR/query-3.log
92
Log file exists
93
SELECT 'this is the third log file';
94
this is the third log file
95
this is the third log file
2420.1.1 by Daniel
Make first event line start_ts=TS. Update and expand docu; fix a typo (wrong version).
96
# start_ts=0-00-00T00:00:00.000000
2311.1.10 by Daniel Nichter
Make tests idempotent.
97
# session_id=0 query_id=0 rows_examined=0 rows_sent=0 tmp_tables=0 warnings=0
2311.1.1 by Daniel Nichter
Add query_log plugin. It's tested and documented.
98
# execution_time=0.000000 lock_time=0.000000 session_time=0.000000
99
# error=false
100
# schema="third-log-file"
101
SET GLOBAL query_log_file="third-log-file";
102
#
2420.1.1 by Daniel
Make first event line start_ts=TS. Update and expand docu; fix a typo (wrong version).
103
# start_ts=0-00-00T00:00:00.000000
2311.1.10 by Daniel Nichter
Make tests idempotent.
104
# session_id=0 query_id=0 rows_examined=0 rows_sent=0 tmp_tables=0 warnings=0
2311.1.1 by Daniel Nichter
Add query_log plugin. It's tested and documented.
105
# execution_time=0.000000 lock_time=0.000000 session_time=0.000000
106
# error=false
107
# schema="third-log-file"
108
SELECT @@query_log_enabled, @@query_log_file_enabled, @@query_log_file;
109
#
2420.1.1 by Daniel
Make first event line start_ts=TS. Update and expand docu; fix a typo (wrong version).
110
# start_ts=0-00-00T00:00:00.000000
2311.1.10 by Daniel Nichter
Make tests idempotent.
111
# session_id=0 query_id=0 rows_examined=0 rows_sent=0 tmp_tables=0 warnings=0
2311.1.1 by Daniel Nichter
Add query_log plugin. It's tested and documented.
112
# execution_time=0.000000 lock_time=0.000000 session_time=0.000000
113
# error=false
114
# schema="third-log-file"
115
SELECT 'this is the third log file';
116
#
2420.1.1 by Daniel
Make first event line start_ts=TS. Update and expand docu; fix a typo (wrong version).
117
# start_ts=0-00-00T00:00:00.000000
2311.1.1 by Daniel Nichter
Add query_log plugin. It's tested and documented.
118
# session_id=0 query_id=0 rows_examined=0 rows_sent=0 tmp_tables=0 warnings=0
119
# execution_time=0.000000 lock_time=0.000000 session_time=0.000000
120
# error=false
121
# schema="test"
122
SET GLOBAL query_log_file_enabled=TRUE;
123
#
2420.1.1 by Daniel
Make first event line start_ts=TS. Update and expand docu; fix a typo (wrong version).
124
# start_ts=0-00-00T00:00:00.000000
2311.1.1 by Daniel Nichter
Add query_log plugin. It's tested and documented.
125
# session_id=0 query_id=0 rows_examined=0 rows_sent=0 tmp_tables=0 warnings=0
126
# execution_time=0.000000 lock_time=0.000000 session_time=0.000000
127
# error=false
128
# schema="test"
129
SELECT @@query_log_enabled, @@query_log_file_enabled;
130
#
2420.1.1 by Daniel
Make first event line start_ts=TS. Update and expand docu; fix a typo (wrong version).
131
# start_ts=0-00-00T00:00:00.000000
2311.1.10 by Daniel Nichter
Make tests idempotent.
132
# session_id=0 query_id=0 rows_examined=0 rows_sent=0 tmp_tables=0 warnings=0
2311.1.1 by Daniel Nichter
Add query_log plugin. It's tested and documented.
133
# execution_time=0.000000 lock_time=0.000000 session_time=0.000000
134
# error=false
135
# schema="test"
136
SET GLOBAL query_log_file_enabled=TRUE;
137
#
2420.1.1 by Daniel
Make first event line start_ts=TS. Update and expand docu; fix a typo (wrong version).
138
# start_ts=0-00-00T00:00:00.000000
2311.1.10 by Daniel Nichter
Make tests idempotent.
139
# session_id=0 query_id=0 rows_examined=0 rows_sent=0 tmp_tables=0 warnings=0
2311.1.1 by Daniel Nichter
Add query_log plugin. It's tested and documented.
140
# execution_time=0.000000 lock_time=0.000000 session_time=0.000000
141
# error=false
142
# schema="test"
143
SELECT 'this is the second log file';
144
#
145
SET GLOBAL query_log_file="DRIZZLETEST_VARDIR/query.log";
146
Checking attributes and values of query SELECT DATE(NOW());
2420.1.1 by Daniel
Make first event line start_ts=TS. Update and expand docu; fix a typo (wrong version).
147
start_ts value matches OK
2311.1.1 by Daniel Nichter
Add query_log plugin. It's tested and documented.
148
Checking attributes and values of query SELECT DATE(NOW());
149
execution_time value matches OK
150
lock_time value matches OK
151
session_time value matches OK
152
Checking attributes and values of query SELECT DATE(NOW());
153
rows_examined value equals 0 OK
154
tmp_tables value equals 0 OK
155
warnings value equals 0 OK
156
error value equals false OK
157
schema value equals test OK
158
SELECT SLEEP(0.5);
159
SLEEP(0.5)
160
0
161
Checking attributes and values of query SELECT SLEEP(0.5);
162
execution_time value between 0.5 and 0.59 OK
2311.1.10 by Daniel Nichter
Make tests idempotent.
163
SET GLOBAL query_log_enabled=TRUE;
164
SET GLOBAL query_log_file_enabled=FALSE;