Merge lp:~sharan-monikantan/drizzle/trunk-bug-723915-fixed into lp:drizzle
- trunk-bug-723915-fixed
- Merge into 7.2
Status: | Work in progress | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~sharan-monikantan/drizzle/trunk-bug-723915-fixed | ||||
Merge into: | lp:drizzle | ||||
Diff against target: |
2381 lines (+2002/-187) 25 files modified
plugin/logging_query/tests/parse-query-log.sh (+1/-1) plugin/logging_query/tests/r/blob.result (+46/-0) plugin/logging_query/tests/r/create.result (+61/-0) plugin/logging_query/tests/r/datatypes_datetime.result (+117/-0) plugin/logging_query/tests/r/datatypes_numeric.result (+97/-0) plugin/logging_query/tests/r/datatypes_string.result (+62/-0) plugin/logging_query/tests/r/delete.result (+104/-0) plugin/logging_query/tests/r/file.result (+36/-11) plugin/logging_query/tests/r/insert.result (+85/-0) plugin/logging_query/tests/r/select.result (+130/-0) plugin/logging_query/tests/r/thresholds.result (+11/-7) plugin/logging_query/tests/r/update.result (+62/-0) plugin/logging_query/tests/t/blob.test (+84/-0) plugin/logging_query/tests/t/create.test (+80/-0) plugin/logging_query/tests/t/datatypes_datetime.test (+151/-0) plugin/logging_query/tests/t/datatypes_numeric.test (+126/-0) plugin/logging_query/tests/t/datatypes_string.test (+111/-0) plugin/logging_query/tests/t/delete.test (+152/-0) plugin/logging_query/tests/t/file.bak (+0/-81) plugin/logging_query/tests/t/file.test (+92/-0) plugin/logging_query/tests/t/insert.test (+87/-0) plugin/logging_query/tests/t/select.test (+128/-0) plugin/logging_query/tests/t/thresholds.bak (+0/-87) plugin/logging_query/tests/t/thresholds.test (+91/-0) plugin/logging_query/tests/t/update.test (+88/-0) |
||||
To merge this branch: | bzr merge lp:~sharan-monikantan/drizzle/trunk-bug-723915-fixed | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Patrick Crews | Approve | ||
Review via email: mp+128576@code.launchpad.net |
Commit message
Description of the change
The test suite for logging_query plugin has been updated with a lot of intense tests.
Brian Aker (brianaker) wrote : | # |
The first run of this spit out some test errors. I can run it again once the current patches make it through.
Sharan Kumar (sharan-monikantan) wrote : | # |
> Running again.
Is the test running without errors? Will this patch make it to the trunk?
Brian Aker (brianaker) wrote : | # |
Still running:
https:/
On Oct 17, 2012, at 10:21 PM, M.Sharan Kumar <email address hidden> wrote:
>> Running again.
> Is the test running without errors? Will this patch make it to the trunk?
> --
> https:/
> Your team Drizzle Trunk is subscribed to branch lp:drizzle.
Brian Aker (brianaker) wrote : | # |
Still failing:
https:/
If you are on an Ubuntu box you can simulate this entire test run by running:
./bootstrap jenkins
Sharan Kumar (sharan-monikantan) wrote : | # |
> Still failing:
>
> https:/
> matrix/
>
> If you are on an Ubuntu box you can simulate this entire test run by running:
>
> ./bootstrap jenkins
Something which I traced yesterday. The statements like 'SET GLOBAL logging_
Brian Aker (brianaker) wrote : | # |
From Jenkins:
https:/
logging_
--- ./plugin/
+++ ./plugin/
@@ -98,7 +98,7 @@
id
3
# This should print 13 indicating that the above queries are logged
-Number of queries logged : 13
+Number of queries logged : 12
# Testing for select with order by
# The following queries should be logged
drizzletest: Result content mismatch
Stopping All Servers
Restoring snapshot of databases
Resuming Tests
logging_
logging_
--- ./plugin/
+++ ./plugin/
@@ -37,7 +37,7 @@
4 update
5 delete
# This should print 5 indicating that, only the UPDATE query is NOT logged
-Number of queries logged : 2
+Number of queries logged : 1
# Enabling the logging_query plugin to log UPDATE queries
SET GLOBAL logging_
drizzletest: Result content mismatch
Unmerged revisions
- 2597. By Sharan Kumar
-
Added the following tests to logging_query plugin
1.blob
2.create
3.datatypes_datetime
4.datatypes_numeric
5.datatypes_string
6.delete
7.insert
8.select
9.update
Preview Diff
1 | === modified file 'plugin/logging_query/tests/parse-query-log.sh' | |||
2 | --- plugin/logging_query/tests/parse-query-log.sh 2012-07-10 18:29:14 +0000 | |||
3 | +++ plugin/logging_query/tests/parse-query-log.sh 2012-10-08 20:02:27 +0000 | |||
4 | @@ -1,2 +1,2 @@ | |||
5 | 1 | #!/bin/sh | 1 | #!/bin/sh |
7 | 2 | wc -l "$1"|awk '{print($1)}' | 2 | wc -l "$1"|awk '{print("Number of queries logged : "$1)}' |
8 | 3 | 3 | ||
9 | === added file 'plugin/logging_query/tests/r/blob.result' | |||
10 | --- plugin/logging_query/tests/r/blob.result 1970-01-01 00:00:00 +0000 | |||
11 | +++ plugin/logging_query/tests/r/blob.result 2012-10-08 20:02:27 +0000 | |||
12 | @@ -0,0 +1,46 @@ | |||
13 | 1 | SET GLOBAL logging_query_filename="DRIZZLETEST_VARDIR/logging_query.log"; | ||
14 | 2 | Log file exists | ||
15 | 3 | Number of queries logged : 1 | ||
16 | 4 | # The logging_query plugin is not enabled and hence none of the following queries should be logged | ||
17 | 5 | DROP SCHEMA IF EXISTS Blob_Test; | ||
18 | 6 | Warnings: | ||
19 | 7 | Note 1008 Can't drop schema 'Blob_Test'; schema doesn't exist | ||
20 | 8 | CREATE SCHEMA Blob_Test; | ||
21 | 9 | USE Blob_Test; | ||
22 | 10 | CREATE TABLE test_blob (data BLOB); | ||
23 | 11 | # Enabling the logging_query plugin | ||
24 | 12 | SET GLOBAL logging_query_enable=true; | ||
25 | 13 | Inserting blob data | ||
26 | 14 | INSERT INTO test_blob VALUES (null); | ||
27 | 15 | INSERT INTO test_blob VALUES (""); | ||
28 | 16 | INSERT INTO test_blob VALUES ("A"); | ||
29 | 17 | INSERT INTO test_blob VALUES ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); | ||
30 | 18 | INSERT INTO test_blob VALUES ("ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"); | ||
31 | 19 | Number of queries logged : 7 | ||
32 | 20 | Selecting blob data | ||
33 | 21 | SELECT data FROM test_blob WHERE data LIKE null; | ||
34 | 22 | data | ||
35 | 23 | SELECT data FROM test_blob WHERE data LIKE ""; | ||
36 | 24 | data | ||
37 | 25 | |||
38 | 26 | SELECT data FROM test_blob WHERE data LIKE "A"; | ||
39 | 27 | data | ||
40 | 28 | A | ||
41 | 29 | SELECT data FROM test_blob WHERE LENGTH(data) < 100; | ||
42 | 30 | data | ||
43 | 31 | |||
44 | 32 | A | ||
45 | 33 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | ||
46 | 34 | SELECT data FROM test_blob WHERE LENGTH(data) > 1024; | ||
47 | 35 | data | ||
48 | 36 | ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ | ||
49 | 37 | Number of queries logged : 12 | ||
50 | 38 | Deleting blob data | ||
51 | 39 | DELETE FROM test_blob WHERE data LIKE null; | ||
52 | 40 | DELETE FROM test_blob WHERE LENGTH(data) > 1000; | ||
53 | 41 | DELETE FROM test_blob WHERE data = 'A'; | ||
54 | 42 | Number of queries logged : 15 | ||
55 | 43 | cleaning up... | ||
56 | 44 | SET GLOBAL logging_query_enable=false; | ||
57 | 45 | DROP SCHEMA Blob_Test; | ||
58 | 46 | ***done*** | ||
59 | 0 | 47 | ||
60 | === added file 'plugin/logging_query/tests/r/create.result' | |||
61 | --- plugin/logging_query/tests/r/create.result 1970-01-01 00:00:00 +0000 | |||
62 | +++ plugin/logging_query/tests/r/create.result 2012-10-08 20:02:27 +0000 | |||
63 | @@ -0,0 +1,61 @@ | |||
64 | 1 | # Logging query plugin is loaded into the system. This checks if the file which we passed through the command line is opened or not | ||
65 | 2 | SET GLOBAL logging_query_filename="DRIZZLETEST_VARDIR/logging_query.log"; | ||
66 | 3 | Log file exists | ||
67 | 4 | # Clearing the log file | ||
68 | 5 | # Checking if the log file is cleared | ||
69 | 6 | Number of queries logged : 1 | ||
70 | 7 | # The above command should print 1 indicating that the file is empty | ||
71 | 8 | # Preparation phase completed | ||
72 | 9 | |||
73 | 10 | # Starting the test | ||
74 | 11 | # The logging_query is not enabled and hence the following query should not be logged | ||
75 | 12 | DROP SCHEMA IF EXISTS test; | ||
76 | 13 | CREATE SCHEMA test; | ||
77 | 14 | # This should print 1 to indicate the log file is still empty | ||
78 | 15 | Number of queries logged : 1 | ||
79 | 16 | # Enabling the logging_query plugin | ||
80 | 17 | SET GLOBAL logging_query_enable=true; | ||
81 | 18 | # The following queries should be logged | ||
82 | 19 | DROP SCHEMA IF EXISTS test_db; | ||
83 | 20 | Warnings: | ||
84 | 21 | Note 1008 Can't drop schema 'test_db'; schema doesn't exist | ||
85 | 22 | CREATE SCHEMA test_db; | ||
86 | 23 | USE test_db; | ||
87 | 24 | # This should print 6 indicating that the above queries are logged | ||
88 | 25 | Number of queries logged : 6 | ||
89 | 26 | # Issuing another CREATE query. This should be logged | ||
90 | 27 | CREATE TABLE Test_Entries (test_id INT, test_name VARCHAR(10)); | ||
91 | 28 | # This should print 7 to indicate that the above query is logged | ||
92 | 29 | Number of queries logged : 7 | ||
93 | 30 | # Enabling logging_query pluging for only SELECT queries | ||
94 | 31 | SET GLOBAL logging_query_pcre="SELECT.+"; | ||
95 | 32 | # The following CREATE query should not be logged | ||
96 | 33 | CREATE TABLE Test_Entries_2 (test_id INT, test_name VARCHAR(10)); | ||
97 | 34 | # This should print 8 to indicate that the above query is not logged | ||
98 | 35 | Number of queries logged : 8 | ||
99 | 36 | # The following SELECT query should be logged | ||
100 | 37 | SELECT * FROM Test_Entries_2; | ||
101 | 38 | test_id test_name | ||
102 | 39 | # This should print 9 to indicate that the above query is logged | ||
103 | 40 | Number of queries logged : 9 | ||
104 | 41 | # Enabling logging_query plugin for only CREATE queries | ||
105 | 42 | SET GLOBAL logging_query_pcre="CREATE.+"; | ||
106 | 43 | # The following CREATE query should be logged | ||
107 | 44 | DROP SCHEMA IF EXISTS test_db_2; | ||
108 | 45 | Warnings: | ||
109 | 46 | Note 1008 Can't drop schema 'test_db_2'; schema doesn't exist | ||
110 | 47 | CREATE SCHEMA test_db_2; | ||
111 | 48 | # This should print 11 | ||
112 | 49 | Number of queries logged : 11 | ||
113 | 50 | # The following SELECT query should not be logged | ||
114 | 51 | SELECT * FROM Test_Entries_2; | ||
115 | 52 | test_id test_name | ||
116 | 53 | # This should print 11 indicating that the above query is not logged | ||
117 | 54 | Number of queries logged : 11 | ||
118 | 55 | cleaning up... | ||
119 | 56 | DROP SCHEMA test; | ||
120 | 57 | DROP SCHEMA test_db; | ||
121 | 58 | DROP SCHEMA test_db_2; | ||
122 | 59 | SET GLOBAL logging_query_enable=false; | ||
123 | 60 | SET GLOBAL logging_query_pcre=".+"; | ||
124 | 61 | ***done*** | ||
125 | 0 | 62 | ||
126 | === added file 'plugin/logging_query/tests/r/datatypes_datetime.result' | |||
127 | --- plugin/logging_query/tests/r/datatypes_datetime.result 1970-01-01 00:00:00 +0000 | |||
128 | +++ plugin/logging_query/tests/r/datatypes_datetime.result 2012-10-08 20:02:27 +0000 | |||
129 | @@ -0,0 +1,117 @@ | |||
130 | 1 | SET GLOBAL logging_query_filename="DRIZZLETEST_VARDIR/logging_query.log"; | ||
131 | 2 | Log file exists | ||
132 | 3 | Number of queries logged : 1 | ||
133 | 4 | # logging_query plugin is not enabled and hence none of the following queries should be logged | ||
134 | 5 | DROP SCHEMA IF EXISTS Test; | ||
135 | 6 | CREATE SCHEMA Test; | ||
136 | 7 | USE Test; | ||
137 | 8 | # Enabling the logging_query plugin | ||
138 | 9 | SET GLOBAL logging_query_enable=true; | ||
139 | 10 | #DATE | ||
140 | 11 | CREATE TABLE test_date (type DATE); | ||
141 | 12 | # Inserting a record with DATE value within the range | ||
142 | 13 | INSERT INTO test_date VALUES ('1990-01-01'); | ||
143 | 14 | INSERT INTO test_date VALUES ('2012-01-01'); | ||
144 | 15 | # Inserting a record with DATE value on range border | ||
145 | 16 | INSERT INTO test_date VALUES ('0001-01-01'); | ||
146 | 17 | INSERT INTO test_date VALUES ('9999-12-31'); | ||
147 | 18 | # Selecting the record | ||
148 | 19 | SELECT type FROM test_date WHERE (EXTRACT(year FROM type) == 1990); | ||
149 | 20 | type | ||
150 | 21 | 1990-01-01 | ||
151 | 22 | SELECT type FROM test_date WHERE (EXTRACT(month FROM type) == 01); | ||
152 | 23 | type | ||
153 | 24 | 1990-01-01 | ||
154 | 25 | 2012-01-01 | ||
155 | 26 | 0001-01-01 | ||
156 | 27 | SELECT type FROM test_date WHERE (EXTRACT(day FROM type) == 31); | ||
157 | 28 | type | ||
158 | 29 | 9999-12-31 | ||
159 | 30 | # Deleting the record | ||
160 | 31 | DELETE FROM test_date WHERE (EXTRACT(year FROM type) == 0001); | ||
161 | 32 | DELETE FROM test_date WHERE (EXTRACT(month FROM type) == 01); | ||
162 | 33 | DELETE FROM test_date WHERE (EXTRACT(day FROM type) == 31); | ||
163 | 34 | # Selecting the record ; this should return a NULL set | ||
164 | 35 | SELECT * FROM test_date; | ||
165 | 36 | type | ||
166 | 37 | Number of queries logged : 14 | ||
167 | 38 | #TIME | ||
168 | 39 | CREATE TABLE test_time (type TIME); | ||
169 | 40 | # Inserting a record with TIME value within the range | ||
170 | 41 | INSERT INTO test_time VALUES ('09:00:00'); | ||
171 | 42 | INSERT INTO test_time VALUES ('15:00:00'); | ||
172 | 43 | # Inserting a record with TIME value on range border | ||
173 | 44 | INSERT INTO test_time VALUES ('00:00:00'); | ||
174 | 45 | INSERT INTO test_time VALUES ('23:59:59'); | ||
175 | 46 | # Selecting the record | ||
176 | 47 | SELECT type FROM test_time WHERE (HOUR(type) == 09); | ||
177 | 48 | type | ||
178 | 49 | 09:00:00 | ||
179 | 50 | SELECT type FROM test_time WHERE (MINUTE(type) == 00); | ||
180 | 51 | type | ||
181 | 52 | 09:00:00 | ||
182 | 53 | 15:00:00 | ||
183 | 54 | 00:00:00 | ||
184 | 55 | SELECT type FROM test_time WHERE (SECOND(type) == 59); | ||
185 | 56 | type | ||
186 | 57 | 23:59:59 | ||
187 | 58 | # Deleting the record | ||
188 | 59 | DELETE FROM test_time WHERE (HOUR(type) == 09); | ||
189 | 60 | DELETE FROM test_time WHERE (MINUTE(type) == 00); | ||
190 | 61 | DELETE FROM test_time WHERE (SECOND(type) == 59); | ||
191 | 62 | # Selecting the record ; this should return a NULL set | ||
192 | 63 | SELECT * FROM test_time; | ||
193 | 64 | type | ||
194 | 65 | Number of queries logged : 26 | ||
195 | 66 | #DATETIME | ||
196 | 67 | CREATE TABLE test_datetime (type DATETIME); | ||
197 | 68 | # Inserting a record with DATETIME value within the range | ||
198 | 69 | INSERT INTO test_datetime VALUES ('1992-07-22 07:50:30'); | ||
199 | 70 | INSERT INTO test_datetime VALUES ('2012-09-29 20:49:50'); | ||
200 | 71 | # Insertingt a record with DATETIME value on range border | ||
201 | 72 | INSERT INTO test_datetime VALUES ('0001-01-01 00:00:00'); | ||
202 | 73 | INSERT INTO test_datetime VALUES ('9999-12-31 23:59:59'); | ||
203 | 74 | # Selecting the record | ||
204 | 75 | SELECT type FROM test_datetime WHERE (EXTRACT(year FROM type) == 1992); | ||
205 | 76 | type | ||
206 | 77 | 1992-07-22 07:50:30 | ||
207 | 78 | SELECT type FROM test_datetime WHERE (HOUR(type) == 07); | ||
208 | 79 | type | ||
209 | 80 | 1992-07-22 07:50:30 | ||
210 | 81 | # Deleting the record | ||
211 | 82 | DELETE FROM test_datetime WHERE (EXTRACT(year FROM type) == 2012); | ||
212 | 83 | DELETE FROM test_datetime WHERE (MINUTE(type) == 50); | ||
213 | 84 | # Selecting the records ; this should return 2 records | ||
214 | 85 | SELECT * FROM test_datetime; | ||
215 | 86 | type | ||
216 | 87 | 0001-01-01 00:00:00 | ||
217 | 88 | 9999-12-31 23:59:59 | ||
218 | 89 | Number of queries logged : 36 | ||
219 | 90 | #TIMESTAMP(6) | ||
220 | 91 | CREATE TABLE test_timestamp (type TIMESTAMP(6)); | ||
221 | 92 | # Inserting a record with TIMESTAMP value within the range | ||
222 | 93 | INSERT INTO test_timestamp VALUES ('1992-07-22 07:50:23.324543'); | ||
223 | 94 | INSERT INTO test_timestamp VALUES ('2012-09-29 23:12:20.232109'); | ||
224 | 95 | # Inserting a record with TIMESTAMP value on range border | ||
225 | 96 | INSERT INTO test_timestamp VALUES ('1970-01-01 00:00:01.000000'); | ||
226 | 97 | INSERT INTO test_timestamp VALUES ('2038-01-19 03:14:07.999999'); | ||
227 | 98 | # Selecting the record | ||
228 | 99 | SELECT type FROM test_timestamp WHERE (EXTRACT(year FROM type) == 1970); | ||
229 | 100 | type | ||
230 | 101 | 1970-01-01 00:00:01.000000 | ||
231 | 102 | SELECT type FROM test_timestamp WHERE (HOUR(type) == 03); | ||
232 | 103 | type | ||
233 | 104 | 2038-01-19 03:14:07.999999 | ||
234 | 105 | # Deleting the record | ||
235 | 106 | DELETE FROM test_timestamp WHERE (EXTRACT(year FROM type) == 1992); | ||
236 | 107 | DELETE FROM test_timestamp WHERE (MINUTE(type) == 12); | ||
237 | 108 | # Selecting the records ; this should return 2 records | ||
238 | 109 | SELECT * FROM test_timestamp; | ||
239 | 110 | type | ||
240 | 111 | 1970-01-01 00:00:01.000000 | ||
241 | 112 | 2038-01-19 03:14:07.999999 | ||
242 | 113 | Number of queries logged : 46 | ||
243 | 114 | cleaning up... | ||
244 | 115 | SET GLOBAL logging_query_enable=false; | ||
245 | 116 | DROP SCHEMA Test; | ||
246 | 117 | ***done*** | ||
247 | 0 | 118 | ||
248 | === added file 'plugin/logging_query/tests/r/datatypes_numeric.result' | |||
249 | --- plugin/logging_query/tests/r/datatypes_numeric.result 1970-01-01 00:00:00 +0000 | |||
250 | +++ plugin/logging_query/tests/r/datatypes_numeric.result 2012-10-08 20:02:27 +0000 | |||
251 | @@ -0,0 +1,97 @@ | |||
252 | 1 | SET GLOBAL logging_query_filename="DRIZZLETEST_VARDIR/logging_query.log"; | ||
253 | 2 | Log file exists | ||
254 | 3 | Number of queries logged : 1 | ||
255 | 4 | # logging_query plugin is not enabled and hence none of the following queries should be logged | ||
256 | 5 | DROP SCHEMA IF EXISTS Test; | ||
257 | 6 | CREATE SCHEMA Test; | ||
258 | 7 | USE Test; | ||
259 | 8 | # Enabling the logging_query plugin | ||
260 | 9 | SET GLOBAL logging_query_enable=true; | ||
261 | 10 | #INTEGER | ||
262 | 11 | CREATE TABLE test_integer (type INTEGER); | ||
263 | 12 | # Inserting a record with INTEGER value within range | ||
264 | 13 | INSERT INTO test_integer VALUES (2147483645); | ||
265 | 14 | INSERT INTO test_integer VALUES (-2147483645); | ||
266 | 15 | # Inserting a record with INTEGER value on range borders | ||
267 | 16 | INSERT INTO test_integer VALUES (2147483647); | ||
268 | 17 | INSERT INTO test_integer VALUES (-2147483648); | ||
269 | 18 | # Selecting the record from table | ||
270 | 19 | SELECT type FROM test_integer WHERE type > 0; | ||
271 | 20 | type | ||
272 | 21 | 2147483645 | ||
273 | 22 | 2147483647 | ||
274 | 23 | SELECT type FROM test_integer WHERE type < 0; | ||
275 | 24 | type | ||
276 | 25 | -2147483645 | ||
277 | 26 | -2147483648 | ||
278 | 27 | # Deleting a record from table | ||
279 | 28 | DELETE FROM test_integer WHERE type > 0; | ||
280 | 29 | # This SELECT should return only two records | ||
281 | 30 | SELECT * FROM test_integer; | ||
282 | 31 | type | ||
283 | 32 | -2147483645 | ||
284 | 33 | -2147483648 | ||
285 | 34 | # Deleting a record from table | ||
286 | 35 | DELETE FROM test_integer WHERE type < 0; | ||
287 | 36 | # This SELECT should return a NULL set | ||
288 | 37 | SELECT * FROM test_integer; | ||
289 | 38 | type | ||
290 | 39 | Number of queries logged : 13 | ||
291 | 40 | #BIGINT | ||
292 | 41 | CREATE TABLE test_bigint (type BIGINT); | ||
293 | 42 | # Inserting a record with BIGINT value within range | ||
294 | 43 | INSERT INTO test_bigint VALUES (9223372036854775805); | ||
295 | 44 | INSERT INTO test_bigint VALUES (-9223372036854775805); | ||
296 | 45 | # Inserting a record with BIGINT value on range borders | ||
297 | 46 | INSERT INTO test_bigint VALUES (9223372036854775807); | ||
298 | 47 | INSERT INTO test_bigint VALUES (-9223372036854775808); | ||
299 | 48 | # Selecting the record from table | ||
300 | 49 | SELECT type FROM test_bigint WHERE type > 0; | ||
301 | 50 | type | ||
302 | 51 | 9223372036854775805 | ||
303 | 52 | 9223372036854775807 | ||
304 | 53 | SELECT type FROM test_bigint WHERE type < 0; | ||
305 | 54 | type | ||
306 | 55 | -9223372036854775805 | ||
307 | 56 | -9223372036854775808 | ||
308 | 57 | # Deleting a record from table | ||
309 | 58 | DELETE FROM test_bigint WHERE type > 0; | ||
310 | 59 | # This SELECT should return only two records | ||
311 | 60 | SELECT * FROM test_bigint; | ||
312 | 61 | type | ||
313 | 62 | -9223372036854775805 | ||
314 | 63 | -9223372036854775808 | ||
315 | 64 | # Deleting a record from table | ||
316 | 65 | DELETE FROM test_bigint WHERE type < 0; | ||
317 | 66 | # This SELECT should return a NULL set | ||
318 | 67 | SELECT * FROM test_bigint; | ||
319 | 68 | type | ||
320 | 69 | Number of queries logged : 24 | ||
321 | 70 | #DOUBLE | ||
322 | 71 | CREATE TABLE test_double (type DOUBLE); | ||
323 | 72 | #Inserting a record with DOUBLE value within range | ||
324 | 73 | INSERT INTO test_double VALUES (-1.7976931348623155E+308); | ||
325 | 74 | INSERT INTO test_double VALUES (1.7976931348623157E+308); | ||
326 | 75 | # Selecting the record from table | ||
327 | 76 | SELECT type FROM test_double WHERE type > 0; | ||
328 | 77 | type | ||
329 | 78 | 1.79769313486232e308 | ||
330 | 79 | SELECT type FROM test_double WHERE type < 0; | ||
331 | 80 | type | ||
332 | 81 | -1.79769313486232e308 | ||
333 | 82 | # Deleting a record from table | ||
334 | 83 | DELETE FROM test_double WHERE type > 0; | ||
335 | 84 | # This SELECT should return only one record | ||
336 | 85 | SELECT * FROM test_double; | ||
337 | 86 | type | ||
338 | 87 | -1.79769313486232e308 | ||
339 | 88 | # Deleting a record from table | ||
340 | 89 | DELETE FROM test_double WHERE type < 0; | ||
341 | 90 | # This SELECT should return a NULL set | ||
342 | 91 | SELECT * FROM test_double; | ||
343 | 92 | type | ||
344 | 93 | Number of queries logged : 33 | ||
345 | 94 | cleaning up... | ||
346 | 95 | SET GLOBAL logging_query_enable=false; | ||
347 | 96 | DROP SCHEMA Test; | ||
348 | 97 | ***done*** | ||
349 | 0 | 98 | ||
350 | === added file 'plugin/logging_query/tests/r/datatypes_string.result' | |||
351 | --- plugin/logging_query/tests/r/datatypes_string.result 1970-01-01 00:00:00 +0000 | |||
352 | +++ plugin/logging_query/tests/r/datatypes_string.result 2012-10-08 20:02:27 +0000 | |||
353 | @@ -0,0 +1,62 @@ | |||
354 | 1 | SET GLOBAL logging_query_filename="DRIZZLETEST_VARDIR/logging_query.log"; | ||
355 | 2 | Log file exists | ||
356 | 3 | Number of queries logged : 1 | ||
357 | 4 | # logging_query plugin is not enabled and hence none of the following queries should be logged | ||
358 | 5 | DROP SCHEMA IF EXISTS Test; | ||
359 | 6 | CREATE SCHEMA Test; | ||
360 | 7 | USE Test; | ||
361 | 8 | # Enabling the logging_query plugin | ||
362 | 9 | SET GLOBAL logging_query_enable=true; | ||
363 | 10 | #VARCHAR | ||
364 | 11 | CREATE TABLE test_varchar (type VARCHAR(10)); | ||
365 | 12 | # Inserting a record with VARCHAR length within range | ||
366 | 13 | INSERT INTO test_varchar VALUES ('varchar'); | ||
367 | 14 | INSERT INTO test_varchar VALUES ('sql'); | ||
368 | 15 | # Inserting a record with VARCHAR length on range borders | ||
369 | 16 | INSERT INTO test_varchar VALUES ('drizzle-DB'); | ||
370 | 17 | INSERT INTO test_varchar VALUES (''); | ||
371 | 18 | # Selecting records from table | ||
372 | 19 | SELECT type FROM test_varchar WHERE LENGTH(type) = 3; | ||
373 | 20 | type | ||
374 | 21 | sql | ||
375 | 22 | SELECT type FROM test_varchar WHERE LENGTH(type) = 0; | ||
376 | 23 | type | ||
377 | 24 | |||
378 | 25 | # Deleting records | ||
379 | 26 | DELETE FROM test_varchar WHERE type LIKE REVERSE('rahcrav'); | ||
380 | 27 | DELETE FROM test_varchar WHERE type LIKE SUBSTRING('mysql',3); | ||
381 | 28 | # Selecting records from table ; this should return 2 rows | ||
382 | 29 | SELECT * FROM test_varchar; | ||
383 | 30 | type | ||
384 | 31 | drizzle-DB | ||
385 | 32 | |||
386 | 33 | Number of queries logged : 12 | ||
387 | 34 | #ENUM | ||
388 | 35 | CREATE TABLE test_enum (type ENUM('one','two','three','four','five','six','seven','eight','nine','ten')); | ||
389 | 36 | # Inserting a record with ENUM value within range | ||
390 | 37 | INSERT INTO test_enum VALUES (3); | ||
391 | 38 | INSERT INTO test_enum VALUES (7); | ||
392 | 39 | # Inserting a record with ENUM value on range border | ||
393 | 40 | INSERT INTO test_enum VALUES (1); | ||
394 | 41 | INSERT INTO test_enum VALUES (9); | ||
395 | 42 | # Selecting records from table | ||
396 | 43 | SELECT type FROM test_enum WHERE type > 5; | ||
397 | 44 | type | ||
398 | 45 | seven | ||
399 | 46 | nine | ||
400 | 47 | SELECT type FROM test_enum WHERE type < 5; | ||
401 | 48 | type | ||
402 | 49 | three | ||
403 | 50 | one | ||
404 | 51 | # Deleting records | ||
405 | 52 | DELETE FROM test_enum WHERE type = 9; | ||
406 | 53 | DELETE FROM test_enum WHERE type > 1; | ||
407 | 54 | # Selecting records from table ; this should return 1 row | ||
408 | 55 | SELECT * FROM test_enum; | ||
409 | 56 | type | ||
410 | 57 | one | ||
411 | 58 | Number of queries logged : 22 | ||
412 | 59 | cleaning up... | ||
413 | 60 | SET GLOBAL logging_query_enable=false; | ||
414 | 61 | DROP SCHEMA Test; | ||
415 | 62 | ***done*** | ||
416 | 0 | 63 | ||
417 | === added file 'plugin/logging_query/tests/r/delete.result' | |||
418 | --- plugin/logging_query/tests/r/delete.result 1970-01-01 00:00:00 +0000 | |||
419 | +++ plugin/logging_query/tests/r/delete.result 2012-10-08 20:02:27 +0000 | |||
420 | @@ -0,0 +1,104 @@ | |||
421 | 1 | SET GLOBAL logging_query_filename="DRIZZLETEST_VARDIR/logging_query.log"; | ||
422 | 2 | Log file exists | ||
423 | 3 | Number of queries logged : 1 | ||
424 | 4 | Preparing the test bed... | ||
425 | 5 | # The logging_query plugin is not yet enabled and hence none of the queries in the prepare phase should be logged | ||
426 | 6 | DROP SCHEMA IF EXISTS Test_Delete; | ||
427 | 7 | Warnings: | ||
428 | 8 | Note 1008 Can't drop schema 'Test_Delete'; schema doesn't exist | ||
429 | 9 | CREATE SCHEMA Test_Delete; | ||
430 | 10 | DROP SCHEMA IF EXISTS Test_Truncate; | ||
431 | 11 | Warnings: | ||
432 | 12 | Note 1008 Can't drop schema 'Test_Truncate'; schema doesn't exist | ||
433 | 13 | CREATE SCHEMA Test_Truncate; | ||
434 | 14 | DROP SCHEMA IF EXISTS Test_Drop; | ||
435 | 15 | Warnings: | ||
436 | 16 | Note 1008 Can't drop schema 'Test_Drop'; schema doesn't exist | ||
437 | 17 | CREATE SCHEMA Test_Drop; | ||
438 | 18 | # Preparing test bed for DELETE test | ||
439 | 19 | USE Test_Delete; | ||
440 | 20 | CREATE TABLE test_delete_1 ( test_id INT, test_name CHAR(10) ); | ||
441 | 21 | INSERT INTO test_delete_1 VALUES (1,"create"),(2,"select"),(3,"insert"),(4,"update"),(5,"delete"); | ||
442 | 22 | CREATE TABLE test_delete_2 ( test_id INT, test_name VARCHAR(10) ); | ||
443 | 23 | INSERT INTO test_delete_1 VALUES (1,"create"),(2,"select"),(3,"insert"),(4,"update"),(5,"delete"); | ||
444 | 24 | # Preparing test bed for TRUNCATE test | ||
445 | 25 | USE Test_Truncate; | ||
446 | 26 | CREATE TABLE test_truncate_1 ( test_id INT, test_name CHAR(10) ); | ||
447 | 27 | INSERT INTO test_truncate_1 VALUES (1,"create"),(2,"select"),(3,"insert"),(4,"update"),(5,"delete"); | ||
448 | 28 | CREATE TABLE test_truncate_2 ( test_id INT, test_name CHAR(10) ); | ||
449 | 29 | INSERT INTO test_truncate_2 VALUES (1,"create"),(2,"select"),(3,"insert"),(4,"update"),(5,"delete"); | ||
450 | 30 | # Preparing test bed for DROP test | ||
451 | 31 | USE Test_Drop; | ||
452 | 32 | CREATE TABLE test_drop ( test_id INT, test_name CHAR(10) ); | ||
453 | 33 | CREATE INDEX index_id ON test_drop ( test_id ); | ||
454 | 34 | INSERT INTO test_drop VALUES (1,"create"),(2,"select"),(3,"insert"),(4,"update"),(5,"delete"); | ||
455 | 35 | # This should print 1 indicating that, the log file is still empty | ||
456 | 36 | Number of queries logged : 1 | ||
457 | 37 | # enabling the logging_query plugin | ||
458 | 38 | SET GLOBAL logging_query_enable=true; | ||
459 | 39 | # Now the tests begin!!! | ||
460 | 40 | DELETE test in progress... | ||
461 | 41 | USE Test_Delete; | ||
462 | 42 | # The following 2 queries should be logged | ||
463 | 43 | DELETE FROM test_delete_1; | ||
464 | 44 | # The following query should return a null set | ||
465 | 45 | SELECT * FROM test_delete_1; | ||
466 | 46 | test_id test_name | ||
467 | 47 | # enabling the logging_query plugin to log only DELETE queries | ||
468 | 48 | SET GLOBAL logging_query_pcre="DELETE.+"; | ||
469 | 49 | # The following DELETE queries should be logged | ||
470 | 50 | DELETE FROM test_delete_2 WHERE test_id = 1; | ||
471 | 51 | DELETE FROM test_delete_2 WHERE test_name = "select"; | ||
472 | 52 | # The following query should select only tuples with id = (3,4,5) and this query should not be logged | ||
473 | 53 | SELECT * FROM test_delete_2; | ||
474 | 54 | test_id test_name | ||
475 | 55 | # enabling the logging_query plugin to log SELECT queries | ||
476 | 56 | SET GLOBAL logging_query_pcre="SELECT.+"; | ||
477 | 57 | # The following DELETE query should not be logged | ||
478 | 58 | DELETE FROM test_delete_2; | ||
479 | 59 | # The following SELECT query should return a null set and should be logged | ||
480 | 60 | SELECT * FROM test_delete_2; | ||
481 | 61 | test_id test_name | ||
482 | 62 | # Delete test is completed. Now checking the logging_query.log file. This should print 10 | ||
483 | 63 | Number of queries logged : 10 | ||
484 | 64 | TRUNCATE test in progress... | ||
485 | 65 | USE Test_Truncate; | ||
486 | 66 | # enabling the logging_query plugin to log TRUNCATE queries | ||
487 | 67 | SET GLOBAL logging_query_pcre="TRUNCATE.+"; | ||
488 | 68 | # The following TRUNCATE query should be logged | ||
489 | 69 | TRUNCATE TABLE test_truncate_1; | ||
490 | 70 | # This SELECT query should not be logged ; this should return a null set | ||
491 | 71 | SELECT * FROM test_truncate_1; | ||
492 | 72 | test_id test_name | ||
493 | 73 | # enabling the logging_query plugin to log RENAME query | ||
494 | 74 | SET GLOBAL logging_query_pcre="RENAME.+"; | ||
495 | 75 | # The following RENAME query should be logged | ||
496 | 76 | RENAME TABLE test_truncate_2 TO test_truncate; | ||
497 | 77 | # This TRUNCATE query should not be logged | ||
498 | 78 | TRUNCATE TABLE test_truncate; | ||
499 | 79 | # This SELECT query should not be logged ; this should return a null set | ||
500 | 80 | SELECT * FROM test_truncate; | ||
501 | 81 | test_id test_name | ||
502 | 82 | # Truncate test is completed. Now checking the logging_query.log file. This should print 14 | ||
503 | 83 | Number of queries logged : 14 | ||
504 | 84 | DROP test in progress... | ||
505 | 85 | USE Test_Drop; | ||
506 | 86 | # enabling the logging_query plugin to log DROP queries | ||
507 | 87 | SET GLOBAL logging_query_pcre="DROP.+"; | ||
508 | 88 | # dropping an index ; this query should be logged since it is a DROP query ( though implemented through ALTER query ) | ||
509 | 89 | ALTER TABLE test_drop DROP INDEX index_id; | ||
510 | 90 | # dropping a table ; this query should be logged | ||
511 | 91 | DROP TABLE test_drop; | ||
512 | 92 | # dropping a schema ; this query should be logged | ||
513 | 93 | DROP SCHEMA Test_Drop; | ||
514 | 94 | # Drop test is completed. Now checking the logging_query.log file. This should print 18 | ||
515 | 95 | Number of queries logged : 18 | ||
516 | 96 | cleaning up... | ||
517 | 97 | SET GLOBAL logging_query_enable=false; | ||
518 | 98 | SET GLOBAL logging_query_pcre=".+"; | ||
519 | 99 | DROP SCHEMA IF EXISTS Test_Delete; | ||
520 | 100 | DROP SCHEMA IF EXISTS Test_Truncate; | ||
521 | 101 | DROP SCHEMA IF EXISTS Test_Drop; | ||
522 | 102 | Warnings: | ||
523 | 103 | Note 1008 Can't drop schema 'Test_Drop'; schema doesn't exist | ||
524 | 104 | ***done*** | ||
525 | 0 | 105 | ||
526 | === modified file 'plugin/logging_query/tests/r/file.result' | |||
527 | --- plugin/logging_query/tests/r/file.result 2012-07-10 18:29:14 +0000 | |||
528 | +++ plugin/logging_query/tests/r/file.result 2012-10-08 20:02:27 +0000 | |||
529 | @@ -1,23 +1,33 @@ | |||
530 | 1 | SET GLOBAL logging_query_filename="DRIZZLETEST_VARDIR/logging_query.log"; | ||
531 | 1 | Log file exists | 2 | Log file exists |
533 | 2 | 1 | 3 | Number of queries logged : 1 |
534 | 4 | # Since logging_query_enable is OFF by default, this should not be logged into the log file. | ||
535 | 3 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; | 5 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; |
536 | 4 | Variable_name Value | 6 | Variable_name Value |
537 | 5 | logging_query_enable OFF | 7 | logging_query_enable OFF |
539 | 6 | logging_query_pcre | 8 | logging_query_pcre .+ |
540 | 7 | logging_query_threshold_big_examined 0 | 9 | logging_query_threshold_big_examined 0 |
541 | 8 | logging_query_threshold_big_resultset 0 | 10 | logging_query_threshold_big_resultset 0 |
542 | 9 | logging_query_threshold_slow 0 | 11 | logging_query_threshold_slow 0 |
544 | 10 | 1 | 12 | #This should not print anything |
545 | 13 | Number of queries logged : 1 | ||
546 | 14 | #Enabling logging_query plugin | ||
547 | 11 | SET GLOBAL logging_query_enable=true; | 15 | SET GLOBAL logging_query_enable=true; |
548 | 16 | #Now as logging_query_enable is set to true, this should be logged. | ||
549 | 12 | SELECT 1; | 17 | SELECT 1; |
550 | 13 | 1 | 18 | 1 |
551 | 14 | 1 | 19 | 1 |
553 | 15 | 3 | 20 | #This should print the content of log file as SET GLOBAL query and SELECT query |
554 | 21 | Number of queries logged : 3 | ||
555 | 22 | #Setting logging_query_pcre as "SHOW.+". Only queries starting with 'SHOW' will be logged from now. | ||
556 | 16 | SET GLOBAL logging_query_pcre="SHOW.+"; | 23 | SET GLOBAL logging_query_pcre="SHOW.+"; |
557 | 24 | #This should not be logged | ||
558 | 17 | SELECT @@logging_query_enable; | 25 | SELECT @@logging_query_enable; |
559 | 18 | @@logging_query_enable | 26 | @@logging_query_enable |
560 | 19 | 1 | 27 | 1 |
562 | 20 | 4 | 28 | #This should print the content of log file updated with |
563 | 29 | Number of queries logged : 4 | ||
564 | 30 | #This should be logged | ||
565 | 21 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; | 31 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; |
566 | 22 | Variable_name Value | 32 | Variable_name Value |
567 | 23 | logging_query_enable ON | 33 | logging_query_enable ON |
568 | @@ -25,14 +35,22 @@ | |||
569 | 25 | logging_query_threshold_big_examined 0 | 35 | logging_query_threshold_big_examined 0 |
570 | 26 | logging_query_threshold_big_resultset 0 | 36 | logging_query_threshold_big_resultset 0 |
571 | 27 | logging_query_threshold_slow 0 | 37 | logging_query_threshold_slow 0 |
573 | 28 | 5 | 38 | #This should print the content of log file updated with SHOW query as it matched the regex. |
574 | 39 | Number of queries logged : 5 | ||
575 | 40 | #Now changing the query log filename | ||
576 | 29 | SET GLOBAL logging_query_filename="DRIZZLETEST_VARDIR/logging_query1.log"; | 41 | SET GLOBAL logging_query_filename="DRIZZLETEST_VARDIR/logging_query1.log"; |
578 | 30 | 1 | 42 | New log file exists |
579 | 43 | # Clear log file. | ||
580 | 44 | # Double-check that log file is clear. | ||
581 | 45 | Number of queries logged : 1 | ||
582 | 46 | #This should not be logged. Neither into new log file. Nor into new log file. | ||
583 | 31 | SELECT @@logging_query_enable; | 47 | SELECT @@logging_query_enable; |
584 | 32 | @@logging_query_enable | 48 | @@logging_query_enable |
585 | 33 | 1 | 49 | 1 |
588 | 34 | 5 | 50 | #Checking the content of both the files. |
589 | 35 | 1 | 51 | Number of queries logged : 5 |
590 | 52 | Number of queries logged : 1 | ||
591 | 53 | #This should be logged into new log file | ||
592 | 36 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; | 54 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; |
593 | 37 | Variable_name Value | 55 | Variable_name Value |
594 | 38 | logging_query_enable ON | 56 | logging_query_enable ON |
595 | @@ -40,7 +58,14 @@ | |||
596 | 40 | logging_query_threshold_big_examined 0 | 58 | logging_query_threshold_big_examined 0 |
597 | 41 | logging_query_threshold_big_resultset 0 | 59 | logging_query_threshold_big_resultset 0 |
598 | 42 | logging_query_threshold_slow 0 | 60 | logging_query_threshold_slow 0 |
601 | 43 | 5 | 61 | #Checking the contents of boh the log files. |
602 | 44 | 2 | 62 | Number of queries logged : 5 |
603 | 63 | Number of queries logged : 2 | ||
604 | 64 | #Changing log file to null string. This should throw error. | ||
605 | 45 | SET GLOBAL logging_query_filename=""; | 65 | SET GLOBAL logging_query_filename=""; |
606 | 46 | ERROR HY000: Incorrect arguments to SET | 66 | ERROR HY000: Incorrect arguments to SET |
607 | 67 | cleaning up... | ||
608 | 68 | SET GLOBAL logging_query_enable=false; | ||
609 | 69 | SET GLOBAL logging_query_pcre="*"; | ||
610 | 70 | SET GLOBAL logging_query_filename="DRIZZLETEST_VARDIR/logging_query.log"; | ||
611 | 71 | ***done*** | ||
612 | 47 | 72 | ||
613 | === added file 'plugin/logging_query/tests/r/insert.result' | |||
614 | --- plugin/logging_query/tests/r/insert.result 1970-01-01 00:00:00 +0000 | |||
615 | +++ plugin/logging_query/tests/r/insert.result 2012-10-08 20:02:27 +0000 | |||
616 | @@ -0,0 +1,85 @@ | |||
617 | 1 | SET GLOBAL logging_query_filename="DRIZZLETEST_VARDIR/logging_query.log"; | ||
618 | 2 | Log file exists | ||
619 | 3 | Number of queries logged : 1 | ||
620 | 4 | preparing the test bed... | ||
621 | 5 | # The logging_query plugin is not enabled and hence the following queries should not be logged | ||
622 | 6 | DROP SCHEMA IF EXISTS Test; | ||
623 | 7 | CREATE SCHEMA Test; | ||
624 | 8 | USE Test; | ||
625 | 9 | CREATE TABLE test_info (test_id INT, test_name VARCHAR(10)); | ||
626 | 10 | INSERT INTO test_info (test_id,test_name) VALUES (0,null); | ||
627 | 11 | # This should print 1 indicating the log file is still empty | ||
628 | 12 | Number of queries logged : 1 | ||
629 | 13 | |||
630 | 14 | # Now the test begins!!! | ||
631 | 15 | # Enabling the logging_query plugin | ||
632 | 16 | SET GLOBAL logging_query_enable=true; | ||
633 | 17 | # The following queries should be logged | ||
634 | 18 | INSERT INTO test_info (test_id) VALUES (1); | ||
635 | 19 | INSERT INTO test_info (test_id,test_name) VALUES (1,"create"); | ||
636 | 20 | INSERT INTO test_info VALUES (2,"select"); | ||
637 | 21 | SELECT * FROM test_info; | ||
638 | 22 | test_id test_name | ||
639 | 23 | 0 NULL | ||
640 | 24 | 1 NULL | ||
641 | 25 | 1 create | ||
642 | 26 | 2 select | ||
643 | 27 | # This should print 6 indicating that, all of the above queries are logged | ||
644 | 28 | Number of queries logged : 6 | ||
645 | 29 | # Enabling the logging_query plugin to log only INSERT queries | ||
646 | 30 | SET GLOBAL logging_query_pcre="INSERT.+"; | ||
647 | 31 | # The following INSERT query should be logged | ||
648 | 32 | INSERT INTO test_info (test_id,test_name) VALUES (3,"insert"); | ||
649 | 33 | INSERT INTO test_info VALUES (4,"drop"),(5,"delete"); | ||
650 | 34 | SELECT test_name FROM test_info; | ||
651 | 35 | test_name | ||
652 | 36 | NULL | ||
653 | 37 | NULL | ||
654 | 38 | create | ||
655 | 39 | select | ||
656 | 40 | insert | ||
657 | 41 | drop | ||
658 | 42 | delete | ||
659 | 43 | DELETE FROM test_info WHERE test_id = 0; | ||
660 | 44 | SELECT * FROM test_info; | ||
661 | 45 | test_id test_name | ||
662 | 46 | 1 NULL | ||
663 | 47 | 1 create | ||
664 | 48 | 2 select | ||
665 | 49 | 3 insert | ||
666 | 50 | 4 drop | ||
667 | 51 | 5 delete | ||
668 | 52 | # This should print 9 indicating that, only the INSERT queries were logged | ||
669 | 53 | Number of queries logged : 9 | ||
670 | 54 | # Enabling the logging_query plugin to log SELECT queries | ||
671 | 55 | SET GLOBAL logging_query_pcre="SELECT.+"; | ||
672 | 56 | # The following INSERT queries should NOT be logged | ||
673 | 57 | INSERT INTO test_info VALUES (5,"delete"); | ||
674 | 58 | SELECT test_name AS tests FROM test_info; | ||
675 | 59 | tests | ||
676 | 60 | NULL | ||
677 | 61 | create | ||
678 | 62 | select | ||
679 | 63 | insert | ||
680 | 64 | drop | ||
681 | 65 | delete | ||
682 | 66 | delete | ||
683 | 67 | SELECT * FROM test_info WHERE test_id > 3; | ||
684 | 68 | test_id test_name | ||
685 | 69 | 4 drop | ||
686 | 70 | 5 delete | ||
687 | 71 | 5 delete | ||
688 | 72 | # This should print 12 indicating that, the INSERT query is NOT logged | ||
689 | 73 | Number of queries logged : 12 | ||
690 | 74 | # Enabling the logging_query plugin to log DELETE queries | ||
691 | 75 | SET GLOBAL logging_query_pcre="DELETE.+"; | ||
692 | 76 | # The following INSERT queries should NOT be logged | ||
693 | 77 | INSERT INTO test_info VALUES (6,""),(7,"enums"); | ||
694 | 78 | DELETE FROM test_info WHERE test_id=6 OR 7; | ||
695 | 79 | # This should print 14 indicating that, the INSERT query is NOT Logged | ||
696 | 80 | Number of queries logged : 14 | ||
697 | 81 | cleaning up... | ||
698 | 82 | SET GLOBAL logging_query_enable=false; | ||
699 | 83 | SET GLOBAL logging_query_pcre=".+"; | ||
700 | 84 | DROP SCHEMA Test; | ||
701 | 85 | ***done*** | ||
702 | 0 | 86 | ||
703 | === added file 'plugin/logging_query/tests/r/select.result' | |||
704 | --- plugin/logging_query/tests/r/select.result 1970-01-01 00:00:00 +0000 | |||
705 | +++ plugin/logging_query/tests/r/select.result 2012-10-08 20:02:27 +0000 | |||
706 | @@ -0,0 +1,130 @@ | |||
707 | 1 | SET GLOBAL logging_query_filename="DRIZZLETEST_VARDIR/logging_query.log"; | ||
708 | 2 | Log file exists | ||
709 | 3 | Number of queries logged : 1 | ||
710 | 4 | Preparing the test bed... | ||
711 | 5 | CREATE SCHEMA Select_Test; | ||
712 | 6 | USE Select_Test; | ||
713 | 7 | CREATE TABLE select_test_1 (id INT, type CHAR(20)); | ||
714 | 8 | INSERT INTO select_test_1 VALUES (1,"basic select"),(2,"select distinct"),(3,"select with where"),(4,"select with orderby"); | ||
715 | 9 | CREATE TABLE select_test_2 (id INT, time FLOAT); | ||
716 | 10 | INSERT INTO select_test_2 VALUES (1,10.01),(2,9.38),(3,5.6),(4,6.7); | ||
717 | 11 | prepare phase completed... | ||
718 | 12 | |||
719 | 13 | Testing basic select queries. | ||
720 | 14 | # The logging_query is not enabled and hence the following select queries should not be logged | ||
721 | 15 | SELECT 1; | ||
722 | 16 | 1 | ||
723 | 17 | 1 | ||
724 | 18 | SELECT "logging_query"; | ||
725 | 19 | logging_query | ||
726 | 20 | logging_query | ||
727 | 21 | # This should print 1 to indicate the log file is still empty | ||
728 | 22 | Number of queries logged : 1 | ||
729 | 23 | |||
730 | 24 | # Enabling the logging_query plugin | ||
731 | 25 | SET GLOBAL logging_query_enable=true; | ||
732 | 26 | |||
733 | 27 | # The logging_query is enabled and the following select query should be logged | ||
734 | 28 | SELECT 1; | ||
735 | 29 | 1 | ||
736 | 30 | 1 | ||
737 | 31 | # This should print 3 indicating that the above query is logged | ||
738 | 32 | Number of queries logged : 3 | ||
739 | 33 | # Issuing another select query | ||
740 | 34 | SELECT "hello world"; | ||
741 | 35 | hello world | ||
742 | 36 | hello world | ||
743 | 37 | # This should print 4 indicating that the above query is logged | ||
744 | 38 | Number of queries logged : 4 | ||
745 | 39 | |||
746 | 40 | # Enabling the logging_query to log only SHOW queries | ||
747 | 41 | SET GLOBAL logging_query_pcre="SHOW.+"; | ||
748 | 42 | |||
749 | 43 | # The following query should be logged | ||
750 | 44 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; | ||
751 | 45 | Variable_name Value | ||
752 | 46 | logging_query_enable ON | ||
753 | 47 | logging_query_pcre SHOW.+ | ||
754 | 48 | logging_query_threshold_big_examined 0 | ||
755 | 49 | logging_query_threshold_big_resultset 0 | ||
756 | 50 | logging_query_threshold_slow 0 | ||
757 | 51 | # This should print 6 indicating that the above query is logged | ||
758 | 52 | Number of queries logged : 6 | ||
759 | 53 | |||
760 | 54 | # The following select query should not be logged | ||
761 | 55 | SELECT 1; | ||
762 | 56 | 1 | ||
763 | 57 | 1 | ||
764 | 58 | # This should print 4 indicating that the above query is not logged | ||
765 | 59 | Number of queries logged : 6 | ||
766 | 60 | # Basic test completed... | ||
767 | 61 | |||
768 | 62 | drilling the SELECT queries test. | ||
769 | 63 | # Enabling the logging_query plugin to log SELECT queries | ||
770 | 64 | # ( since here after, the test deals with variants of SELECT queries and all such should be checked against logging) | ||
771 | 65 | SET GLOBAL logging_query_pcre="SELECT.+"; | ||
772 | 66 | |||
773 | 67 | # Testing for select with distinct | ||
774 | 68 | # The following queries should be logged | ||
775 | 69 | SELECT DISTINCT * FROM select_test_1; | ||
776 | 70 | id type | ||
777 | 71 | 1 basic select | ||
778 | 72 | 2 select distinct | ||
779 | 73 | 3 select with where | ||
780 | 74 | 4 select with orderby | ||
781 | 75 | SELECT DISTINCT * FROM select_test_2; | ||
782 | 76 | id time | ||
783 | 77 | 1 10.01 | ||
784 | 78 | 2 9.38 | ||
785 | 79 | 3 5.6 | ||
786 | 80 | 4 6.7 | ||
787 | 81 | # This should print 9 indicating that the above queries are logged | ||
788 | 82 | Number of queries logged : 9 | ||
789 | 83 | |||
790 | 84 | # Testing for select with where | ||
791 | 85 | # The following queries should be logged | ||
792 | 86 | SELECT * FROM select_test_1 WHERE id = 2; | ||
793 | 87 | id type | ||
794 | 88 | 2 select distinct | ||
795 | 89 | SELECT * FROM select_test_1 WHERE type = "select with where"; | ||
796 | 90 | id type | ||
797 | 91 | 3 select with where | ||
798 | 92 | SELECT time FROM select_test_2 WHERE id >= 2; | ||
799 | 93 | time | ||
800 | 94 | 9.38 | ||
801 | 95 | 5.6 | ||
802 | 96 | 6.7 | ||
803 | 97 | SELECT id FROM select_test_2 WHERE time < 6; | ||
804 | 98 | id | ||
805 | 99 | 3 | ||
806 | 100 | # This should print 13 indicating that the above queries are logged | ||
807 | 101 | Number of queries logged : 13 | ||
808 | 102 | |||
809 | 103 | # Testing for select with order by | ||
810 | 104 | # The following queries should be logged | ||
811 | 105 | SELECT * FROM select_test_2 ORDER BY id DESC; | ||
812 | 106 | id time | ||
813 | 107 | 4 6.7 | ||
814 | 108 | 3 5.6 | ||
815 | 109 | 2 9.38 | ||
816 | 110 | 1 10.01 | ||
817 | 111 | SELECT time FROM select_test_2 ORDER BY time; | ||
818 | 112 | time | ||
819 | 113 | 5.6 | ||
820 | 114 | 6.7 | ||
821 | 115 | 9.38 | ||
822 | 116 | 10.01 | ||
823 | 117 | SELECT id FROM select_test_2 ORDER BY time DESC; | ||
824 | 118 | id | ||
825 | 119 | 1 | ||
826 | 120 | 2 | ||
827 | 121 | 4 | ||
828 | 122 | 3 | ||
829 | 123 | # This should print 16 indicating all the above queries are logged | ||
830 | 124 | Number of queries logged : 16 | ||
831 | 125 | |||
832 | 126 | cleaning up... | ||
833 | 127 | DROP SCHEMA Select_Test; | ||
834 | 128 | SET GLOBAL logging_query_enable=false; | ||
835 | 129 | SET GLOBAL logging_query_pcre=".+"; | ||
836 | 130 | ***done*** | ||
837 | 0 | 131 | ||
838 | === modified file 'plugin/logging_query/tests/r/thresholds.result' | |||
839 | --- plugin/logging_query/tests/r/thresholds.result 2012-07-10 18:29:14 +0000 | |||
840 | +++ plugin/logging_query/tests/r/thresholds.result 2012-10-08 20:02:27 +0000 | |||
841 | @@ -14,16 +14,16 @@ | |||
842 | 14 | SELECT SLEEP(0.4); | 14 | SELECT SLEEP(0.4); |
843 | 15 | SLEEP(0.4) | 15 | SLEEP(0.4) |
844 | 16 | 0 | 16 | 0 |
846 | 17 | 1 | 17 | Number of queries logged : 1 |
847 | 18 | SELECT SLEEP(0.5); | 18 | SELECT SLEEP(0.5); |
848 | 19 | SLEEP(0.5) | 19 | SLEEP(0.5) |
849 | 20 | 0 | 20 | 0 |
851 | 21 | 2 | 21 | Number of queries logged : 2 |
852 | 22 | SET GLOBAL logging_query_threshold_slow=0; | 22 | SET GLOBAL logging_query_threshold_slow=0; |
853 | 23 | SELECT SLEEP(1); | 23 | SELECT SLEEP(1); |
854 | 24 | SLEEP(1) | 24 | SLEEP(1) |
855 | 25 | 0 | 25 | 0 |
857 | 26 | 4 | 26 | Number of queries logged : 4 |
858 | 27 | 27 | ||
859 | 28 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; | 28 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; |
860 | 29 | Variable_name Value | 29 | Variable_name Value |
861 | @@ -32,12 +32,12 @@ | |||
862 | 32 | logging_query_threshold_big_examined 0 | 32 | logging_query_threshold_big_examined 0 |
863 | 33 | logging_query_threshold_big_resultset 0 | 33 | logging_query_threshold_big_resultset 0 |
864 | 34 | logging_query_threshold_slow 0 | 34 | logging_query_threshold_slow 0 |
866 | 35 | 2 | 35 | Number of queries logged : 2 |
867 | 36 | SET GLOBAL logging_query_threshold_big_resultset=2; | 36 | SET GLOBAL logging_query_threshold_big_resultset=2; |
868 | 37 | SELECT "This should not be logged"; | 37 | SELECT "This should not be logged"; |
869 | 38 | This should not be logged | 38 | This should not be logged |
870 | 39 | This should not be logged | 39 | This should not be logged |
872 | 40 | 2 | 40 | Number of queries logged : 2 |
873 | 41 | 41 | ||
874 | 42 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; | 42 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; |
875 | 43 | Variable_name Value | 43 | Variable_name Value |
876 | @@ -46,9 +46,13 @@ | |||
877 | 46 | logging_query_threshold_big_examined 0 | 46 | logging_query_threshold_big_examined 0 |
878 | 47 | logging_query_threshold_big_resultset 2 | 47 | logging_query_threshold_big_resultset 2 |
879 | 48 | logging_query_threshold_slow 0 | 48 | logging_query_threshold_slow 0 |
881 | 49 | 2 | 49 | Number of queries logged : 2 |
882 | 50 | SET GLOBAL logging_query_threshold_big_examined=2; | 50 | SET GLOBAL logging_query_threshold_big_examined=2; |
883 | 51 | SELECT "This should not be logged"; | 51 | SELECT "This should not be logged"; |
884 | 52 | This should not be logged | 52 | This should not be logged |
885 | 53 | This should not be logged | 53 | This should not be logged |
887 | 54 | 2 | 54 | Number of queries logged : 2 |
888 | 55 | cleaning up... | ||
889 | 56 | SET GLOBAL logging_query_enable=false; | ||
890 | 57 | SET GLOBAL logging_query_pcre=".+"; | ||
891 | 58 | ***done*** | ||
892 | 55 | 59 | ||
893 | === added file 'plugin/logging_query/tests/r/update.result' | |||
894 | --- plugin/logging_query/tests/r/update.result 1970-01-01 00:00:00 +0000 | |||
895 | +++ plugin/logging_query/tests/r/update.result 2012-10-08 20:02:27 +0000 | |||
896 | @@ -0,0 +1,62 @@ | |||
897 | 1 | SET GLOBAL logging_query_filename="DRIZZLETEST_VARDIR/logging_query.log"; | ||
898 | 2 | Log file exists | ||
899 | 3 | Number of queries logged : 1 | ||
900 | 4 | preparing the test bed... | ||
901 | 5 | # The logging_query plugin is not enabled and hence none of the queries in prepare phase should be logged | ||
902 | 6 | CREATE SCHEMA Test_Update; | ||
903 | 7 | USE Test_Update; | ||
904 | 8 | CREATE TABLE test_info (id INT, name CHAR(10)); | ||
905 | 9 | INSERT INTO test_info VALUES (1,"create"),(2,"select"),(3,"insert"),(4,"update"),(5,"delete"); | ||
906 | 10 | # This should print 1 indicating that the log file is still empty | ||
907 | 11 | Number of queries logged : 1 | ||
908 | 12 | |||
909 | 13 | UPDATE test in progress... | ||
910 | 14 | # The logging_query plugin is not enabled and the following update query should not be logged | ||
911 | 15 | UPDATE test_info SET name="CREATE" WHERE id=1; | ||
912 | 16 | # This should print 1 indicating that the log file is still empty | ||
913 | 17 | Number of queries logged : 1 | ||
914 | 18 | |||
915 | 19 | # Enabling the logging_query plugin | ||
916 | 20 | SET GLOBAL logging_query_enable=true; | ||
917 | 21 | |||
918 | 22 | # The logging_query plugin is enabled and the following update query should be logged | ||
919 | 23 | UPDATE test_info SET name="SELECT" WHERE id=2; | ||
920 | 24 | # This should print 3 indicating that the above query is logged | ||
921 | 25 | Number of queries logged : 1 | ||
922 | 26 | |||
923 | 27 | # Enabling the logging_query plugin to log only select queries | ||
924 | 28 | SET GLOBAL logging_query_pcre="SELECT.+"; | ||
925 | 29 | |||
926 | 30 | # The following UPDATE query should not be logged | ||
927 | 31 | UPDATE test_info SET name="INSERT" WHERE id=3; | ||
928 | 32 | SELECT * FROM test_info; | ||
929 | 33 | id name | ||
930 | 34 | 1 CREATE | ||
931 | 35 | 2 SELECT | ||
932 | 36 | 3 INSERT | ||
933 | 37 | 4 update | ||
934 | 38 | 5 delete | ||
935 | 39 | # This should print 5 indicating that, only the UPDATE query is NOT logged | ||
936 | 40 | Number of queries logged : 2 | ||
937 | 41 | |||
938 | 42 | # Enabling the logging_query plugin to log UPDATE queries | ||
939 | 43 | SET GLOBAL logging_query_pcre="UPDATE.+"; | ||
940 | 44 | |||
941 | 45 | # The followihng UPDATE query should be logged | ||
942 | 46 | UPDATE test_info SET name="UPDATE" WHERE id=6; | ||
943 | 47 | # The above query will not update the table since a tuple with id=6 does not exist | ||
944 | 48 | SELECT * FROM test_info; | ||
945 | 49 | id name | ||
946 | 50 | 1 CREATE | ||
947 | 51 | 2 SELECT | ||
948 | 52 | 3 INSERT | ||
949 | 53 | 4 update | ||
950 | 54 | 5 delete | ||
951 | 55 | # This should print 7 indicating that, only the UPDATE query is logged and not the select query | ||
952 | 56 | Number of queries logged : 2 | ||
953 | 57 | |||
954 | 58 | cleaning up... | ||
955 | 59 | SET GLOBAL logging_query_enable=false; | ||
956 | 60 | SET GLOBAL logging_query_pcre=".+"; | ||
957 | 61 | DROP SCHEMA Test_Update; | ||
958 | 62 | ***done*** | ||
959 | 0 | 63 | ||
960 | === added file 'plugin/logging_query/tests/t/blob.test' | |||
961 | --- plugin/logging_query/tests/t/blob.test 1970-01-01 00:00:00 +0000 | |||
962 | +++ plugin/logging_query/tests/t/blob.test 2012-10-08 20:02:27 +0000 | |||
963 | @@ -0,0 +1,84 @@ | |||
964 | 1 | |||
965 | 2 | # ########################################################################################### | ||
966 | 3 | # This test runs several tests against the BLOB type | ||
967 | 4 | # ########################################################################################### | ||
968 | 5 | |||
969 | 6 | # logging_query plugin is loaded into the system. This is to check that the file passed through the command line is opened or not | ||
970 | 7 | --replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR | ||
971 | 8 | eval SET GLOBAL logging_query_filename="$DRIZZLETEST_VARDIR/logging_query.log"; | ||
972 | 9 | --exec if [ -f $DRIZZLETEST_VARDIR/logging_query.log ]; then echo "Log file exists"; else echo "log file does not exist"; fi | ||
973 | 10 | |||
974 | 11 | # Clearing the log file | ||
975 | 12 | --exec echo "" > $DRIZZLETEST_VARDIR/logging_query.log | ||
976 | 13 | # Checking if the file is cleared or not | ||
977 | 14 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
978 | 15 | # The above command should print 1 indicating that the log file is empty | ||
979 | 16 | |||
980 | 17 | --echo # The logging_query plugin is not enabled and hence none of the following queries should be logged | ||
981 | 18 | DROP SCHEMA IF EXISTS Blob_Test; | ||
982 | 19 | CREATE SCHEMA Blob_Test; | ||
983 | 20 | USE Blob_Test; | ||
984 | 21 | CREATE TABLE test_blob (data BLOB); | ||
985 | 22 | |||
986 | 23 | --echo # Enabling the logging_query plugin | ||
987 | 24 | SET GLOBAL logging_query_enable=true; | ||
988 | 25 | |||
989 | 26 | # ########################################################################################### | ||
990 | 27 | # Insert BLOB data | ||
991 | 28 | # ########################################################################################### | ||
992 | 29 | |||
993 | 30 | --echo Inserting blob data | ||
994 | 31 | INSERT INTO test_blob VALUES (null); | ||
995 | 32 | INSERT INTO test_blob VALUES (""); | ||
996 | 33 | INSERT INTO test_blob VALUES ("A"); | ||
997 | 34 | INSERT INTO test_blob VALUES ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); | ||
998 | 35 | INSERT INTO test_blob VALUES ("ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"); | ||
999 | 36 | |||
1000 | 37 | # Testing if the above queries are logged | ||
1001 | 38 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1002 | 39 | |||
1003 | 40 | |||
1004 | 41 | # ########################################################################################### | ||
1005 | 42 | # Select BLOB data | ||
1006 | 43 | # ########################################################################################### | ||
1007 | 44 | |||
1008 | 45 | --echo Selecting blob data | ||
1009 | 46 | SELECT data FROM test_blob WHERE data LIKE null; | ||
1010 | 47 | SELECT data FROM test_blob WHERE data LIKE ""; | ||
1011 | 48 | SELECT data FROM test_blob WHERE data LIKE "A"; | ||
1012 | 49 | SELECT data FROM test_blob WHERE LENGTH(data) < 100; | ||
1013 | 50 | SELECT data FROM test_blob WHERE LENGTH(data) > 1024; | ||
1014 | 51 | |||
1015 | 52 | |||
1016 | 53 | # Testing if the above queries are logged | ||
1017 | 54 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1018 | 55 | |||
1019 | 56 | |||
1020 | 57 | # ########################################################################################### | ||
1021 | 58 | # Deleting BLOB data | ||
1022 | 59 | # ########################################################################################### | ||
1023 | 60 | |||
1024 | 61 | --echo Deleting blob data | ||
1025 | 62 | DELETE FROM test_blob WHERE data LIKE null; | ||
1026 | 63 | DELETE FROM test_blob WHERE LENGTH(data) > 1000; | ||
1027 | 64 | DELETE FROM test_blob WHERE data = 'A'; | ||
1028 | 65 | |||
1029 | 66 | |||
1030 | 67 | # Testing if the above queries are logged | ||
1031 | 68 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1032 | 69 | |||
1033 | 70 | |||
1034 | 71 | |||
1035 | 72 | # #################################################################################################### | ||
1036 | 73 | # Cleaning up | ||
1037 | 74 | # #################################################################################################### | ||
1038 | 75 | --echo cleaning up... | ||
1039 | 76 | SET GLOBAL logging_query_enable=false; | ||
1040 | 77 | DROP SCHEMA Blob_Test; | ||
1041 | 78 | --exec rm $DRIZZLETEST_VARDIR/logging_query.log | ||
1042 | 79 | --echo ***done*** | ||
1043 | 80 | |||
1044 | 81 | # #################################################################################################### | ||
1045 | 82 | # Done | ||
1046 | 83 | # #################################################################################################### | ||
1047 | 84 | |||
1048 | 0 | 85 | ||
1049 | === added file 'plugin/logging_query/tests/t/create.test' | |||
1050 | --- plugin/logging_query/tests/t/create.test 1970-01-01 00:00:00 +0000 | |||
1051 | +++ plugin/logging_query/tests/t/create.test 2012-10-08 20:02:27 +0000 | |||
1052 | @@ -0,0 +1,80 @@ | |||
1053 | 1 | |||
1054 | 2 | # ################################################################################## | ||
1055 | 3 | # This tests the logging_query plugin for various create queries | ||
1056 | 4 | # ################################################################################## | ||
1057 | 5 | |||
1058 | 6 | --echo # Logging query plugin is loaded into the system. This checks if the file which we passed through the command line is opened or not | ||
1059 | 7 | --replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR | ||
1060 | 8 | eval SET GLOBAL logging_query_filename="$DRIZZLETEST_VARDIR/logging_query.log"; | ||
1061 | 9 | --exec if [ -f $DRIZZLETEST_VARDIR/logging_query.log ]; then echo "Log file exists"; else echo "Log file does not exist"; fi | ||
1062 | 10 | |||
1063 | 11 | --echo # Clearing the log file | ||
1064 | 12 | --exec echo "" > $DRIZZLETEST_VARDIR/logging_query.log | ||
1065 | 13 | --echo # Checking if the log file is cleared | ||
1066 | 14 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1067 | 15 | --echo # The above command should print 1 indicating that the file is empty | ||
1068 | 16 | --echo # Preparation phase completed | ||
1069 | 17 | --echo | ||
1070 | 18 | |||
1071 | 19 | --echo # Starting the test | ||
1072 | 20 | --echo # The logging_query is not enabled and hence the following query should not be logged | ||
1073 | 21 | DROP SCHEMA IF EXISTS test; | ||
1074 | 22 | CREATE SCHEMA test; | ||
1075 | 23 | --echo # This should print 1 to indicate the log file is still empty | ||
1076 | 24 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1077 | 25 | |||
1078 | 26 | --echo # Enabling the logging_query plugin | ||
1079 | 27 | SET GLOBAL logging_query_enable=true; | ||
1080 | 28 | |||
1081 | 29 | --echo # The following queries should be logged | ||
1082 | 30 | DROP SCHEMA IF EXISTS test_db; | ||
1083 | 31 | CREATE SCHEMA test_db; | ||
1084 | 32 | USE test_db; | ||
1085 | 33 | --echo # This should print 6 indicating that the above queries are logged | ||
1086 | 34 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1087 | 35 | |||
1088 | 36 | --echo # Issuing another CREATE query. This should be logged | ||
1089 | 37 | CREATE TABLE Test_Entries (test_id INT, test_name VARCHAR(10)); | ||
1090 | 38 | --echo # This should print 7 to indicate that the above query is logged | ||
1091 | 39 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1092 | 40 | |||
1093 | 41 | --echo # Enabling logging_query pluging for only SELECT queries | ||
1094 | 42 | SET GLOBAL logging_query_pcre="SELECT.+"; | ||
1095 | 43 | |||
1096 | 44 | --echo # The following CREATE query should not be logged | ||
1097 | 45 | CREATE TABLE Test_Entries_2 (test_id INT, test_name VARCHAR(10)); | ||
1098 | 46 | --echo # This should print 8 to indicate that the above query is not logged | ||
1099 | 47 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1100 | 48 | --echo # The following SELECT query should be logged | ||
1101 | 49 | SELECT * FROM Test_Entries_2; | ||
1102 | 50 | --echo # This should print 9 to indicate that the above query is logged | ||
1103 | 51 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1104 | 52 | |||
1105 | 53 | --echo # Enabling logging_query plugin for only CREATE queries | ||
1106 | 54 | SET GLOBAL logging_query_pcre="CREATE.+"; | ||
1107 | 55 | |||
1108 | 56 | --echo # The following CREATE query should be logged | ||
1109 | 57 | DROP SCHEMA IF EXISTS test_db_2; | ||
1110 | 58 | CREATE SCHEMA test_db_2; | ||
1111 | 59 | --echo # This should print 11 | ||
1112 | 60 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1113 | 61 | --echo # The following SELECT query should not be logged | ||
1114 | 62 | SELECT * FROM Test_Entries_2; | ||
1115 | 63 | --echo # This should print 11 indicating that the above query is not logged | ||
1116 | 64 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1117 | 65 | |||
1118 | 66 | # ################################################################################### | ||
1119 | 67 | # Clean up | ||
1120 | 68 | # ################################################################################### | ||
1121 | 69 | --echo cleaning up... | ||
1122 | 70 | DROP SCHEMA test; | ||
1123 | 71 | DROP SCHEMA test_db; | ||
1124 | 72 | DROP SCHEMA test_db_2; | ||
1125 | 73 | SET GLOBAL logging_query_enable=false; | ||
1126 | 74 | SET GLOBAL logging_query_pcre=".+"; | ||
1127 | 75 | --exec rm $DRIZZLETEST_VARDIR/logging_query.log | ||
1128 | 76 | --echo ***done*** | ||
1129 | 77 | |||
1130 | 78 | # ################################################################################### | ||
1131 | 79 | # Done | ||
1132 | 80 | # ################################################################################### | ||
1133 | 0 | 81 | ||
1134 | === added file 'plugin/logging_query/tests/t/datatypes_datetime.test' | |||
1135 | --- plugin/logging_query/tests/t/datatypes_datetime.test 1970-01-01 00:00:00 +0000 | |||
1136 | +++ plugin/logging_query/tests/t/datatypes_datetime.test 2012-10-08 20:02:27 +0000 | |||
1137 | @@ -0,0 +1,151 @@ | |||
1138 | 1 | |||
1139 | 2 | # ############################################################################################################################################## | ||
1140 | 3 | # Test for Drizzle's datatypes | ||
1141 | 4 | # Test whether the logging_query plugin logs each case of the datatype (we enable the plugin throughout the test and check if it logs each case) | ||
1142 | 5 | # cases: | ||
1143 | 6 | # 1.Type | ||
1144 | 7 | # 2.Range | ||
1145 | 8 | # 3.Select, Insert, Delete queries | ||
1146 | 9 | # ############################################################################################################################################## | ||
1147 | 10 | |||
1148 | 11 | # logging_query plugin is loaded into the system and this checks if the file we passed through the command line is opened or not | ||
1149 | 12 | --replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR | ||
1150 | 13 | eval SET GLOBAL logging_query_filename="$DRIZZLETEST_VARDIR/logging_query.log"; | ||
1151 | 14 | --exec if [ -f $DRIZZLETEST_VARDIR/logging_query.log ]; then echo "Log file exists"; else echo "Log file does not exist"; fi | ||
1152 | 15 | |||
1153 | 16 | # Clearing the log file | ||
1154 | 17 | --exec echo "" > $DRIZZLETEST_VARDIR/logging_query.log | ||
1155 | 18 | # Checking if the file is cleared or not | ||
1156 | 19 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1157 | 20 | # The above command should print 1 indicating that the log file is empty | ||
1158 | 21 | |||
1159 | 22 | # ################################################################################################### | ||
1160 | 23 | # Preparing the test bed | ||
1161 | 24 | # ################################################################################################### | ||
1162 | 25 | |||
1163 | 26 | --echo # logging_query plugin is not enabled and hence none of the following queries should be logged | ||
1164 | 27 | DROP SCHEMA IF EXISTS Test; | ||
1165 | 28 | CREATE SCHEMA Test; | ||
1166 | 29 | USE Test; | ||
1167 | 30 | |||
1168 | 31 | --echo # Enabling the logging_query plugin | ||
1169 | 32 | SET GLOBAL logging_query_enable=true; | ||
1170 | 33 | |||
1171 | 34 | # ################################################################################################### | ||
1172 | 35 | # DATE | ||
1173 | 36 | # ################################################################################################### | ||
1174 | 37 | |||
1175 | 38 | --echo #DATE | ||
1176 | 39 | CREATE TABLE test_date (type DATE); | ||
1177 | 40 | --echo # Inserting a record with DATE value within the range | ||
1178 | 41 | INSERT INTO test_date VALUES ('1990-01-01'); | ||
1179 | 42 | INSERT INTO test_date VALUES ('2012-01-01'); | ||
1180 | 43 | --echo # Inserting a record with DATE value on range border | ||
1181 | 44 | INSERT INTO test_date VALUES ('0001-01-01'); | ||
1182 | 45 | INSERT INTO test_date VALUES ('9999-12-31'); | ||
1183 | 46 | --echo # Selecting the record | ||
1184 | 47 | SELECT type FROM test_date WHERE (EXTRACT(year FROM type) == 1990); | ||
1185 | 48 | SELECT type FROM test_date WHERE (EXTRACT(month FROM type) == 01); | ||
1186 | 49 | SELECT type FROM test_date WHERE (EXTRACT(day FROM type) == 31); | ||
1187 | 50 | --echo # Deleting the record | ||
1188 | 51 | DELETE FROM test_date WHERE (EXTRACT(year FROM type) == 0001); | ||
1189 | 52 | DELETE FROM test_date WHERE (EXTRACT(month FROM type) == 01); | ||
1190 | 53 | DELETE FROM test_date WHERE (EXTRACT(day FROM type) == 31); | ||
1191 | 54 | --echo # Selecting the record ; this should return a NULL set | ||
1192 | 55 | SELECT * FROM test_date; | ||
1193 | 56 | |||
1194 | 57 | # Testing if the above queries are logged | ||
1195 | 58 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1196 | 59 | |||
1197 | 60 | |||
1198 | 61 | # #################################################################################################### | ||
1199 | 62 | # TIME | ||
1200 | 63 | # #################################################################################################### | ||
1201 | 64 | |||
1202 | 65 | --echo #TIME | ||
1203 | 66 | CREATE TABLE test_time (type TIME); | ||
1204 | 67 | --echo # Inserting a record with TIME value within the range | ||
1205 | 68 | INSERT INTO test_time VALUES ('09:00:00'); | ||
1206 | 69 | INSERT INTO test_time VALUES ('15:00:00'); | ||
1207 | 70 | --echo # Inserting a record with TIME value on range border | ||
1208 | 71 | INSERT INTO test_time VALUES ('00:00:00'); | ||
1209 | 72 | INSERT INTO test_time VALUES ('23:59:59'); | ||
1210 | 73 | --echo # Selecting the record | ||
1211 | 74 | SELECT type FROM test_time WHERE (HOUR(type) == 09); | ||
1212 | 75 | SELECT type FROM test_time WHERE (MINUTE(type) == 00); | ||
1213 | 76 | SELECT type FROM test_time WHERE (SECOND(type) == 59); | ||
1214 | 77 | --echo # Deleting the record | ||
1215 | 78 | DELETE FROM test_time WHERE (HOUR(type) == 09); | ||
1216 | 79 | DELETE FROM test_time WHERE (MINUTE(type) == 00); | ||
1217 | 80 | DELETE FROM test_time WHERE (SECOND(type) == 59); | ||
1218 | 81 | --echo # Selecting the record ; this should return a NULL set | ||
1219 | 82 | SELECT * FROM test_time; | ||
1220 | 83 | |||
1221 | 84 | # Testing if the above queries are logged | ||
1222 | 85 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1223 | 86 | |||
1224 | 87 | |||
1225 | 88 | # #################################################################################################### | ||
1226 | 89 | # DATETIME | ||
1227 | 90 | # #################################################################################################### | ||
1228 | 91 | |||
1229 | 92 | --echo #DATETIME | ||
1230 | 93 | CREATE TABLE test_datetime (type DATETIME); | ||
1231 | 94 | --echo # Inserting a record with DATETIME value within the range | ||
1232 | 95 | INSERT INTO test_datetime VALUES ('1992-07-22 07:50:30'); | ||
1233 | 96 | INSERT INTO test_datetime VALUES ('2012-09-29 20:49:50'); | ||
1234 | 97 | --echo # Insertingt a record with DATETIME value on range border | ||
1235 | 98 | INSERT INTO test_datetime VALUES ('0001-01-01 00:00:00'); | ||
1236 | 99 | INSERT INTO test_datetime VALUES ('9999-12-31 23:59:59'); | ||
1237 | 100 | --echo # Selecting the record | ||
1238 | 101 | SELECT type FROM test_datetime WHERE (EXTRACT(year FROM type) == 1992); | ||
1239 | 102 | SELECT type FROM test_datetime WHERE (HOUR(type) == 07); | ||
1240 | 103 | --echo # Deleting the record | ||
1241 | 104 | DELETE FROM test_datetime WHERE (EXTRACT(year FROM type) == 2012); | ||
1242 | 105 | DELETE FROM test_datetime WHERE (MINUTE(type) == 50); | ||
1243 | 106 | --echo # Selecting the records ; this should return 2 records | ||
1244 | 107 | SELECT * FROM test_datetime; | ||
1245 | 108 | |||
1246 | 109 | |||
1247 | 110 | # Testing if the above queries are logged | ||
1248 | 111 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1249 | 112 | |||
1250 | 113 | |||
1251 | 114 | # #################################################################################################### | ||
1252 | 115 | # TIMESTAMP(6) | ||
1253 | 116 | # #################################################################################################### | ||
1254 | 117 | |||
1255 | 118 | --echo #TIMESTAMP(6) | ||
1256 | 119 | CREATE TABLE test_timestamp (type TIMESTAMP(6)); | ||
1257 | 120 | --echo # Inserting a record with TIMESTAMP value within the range | ||
1258 | 121 | INSERT INTO test_timestamp VALUES ('1992-07-22 07:50:23.324543'); | ||
1259 | 122 | INSERT INTO test_timestamp VALUES ('2012-09-29 23:12:20.232109'); | ||
1260 | 123 | --echo # Inserting a record with TIMESTAMP value on range border | ||
1261 | 124 | INSERT INTO test_timestamp VALUES ('1970-01-01 00:00:01.000000'); | ||
1262 | 125 | INSERT INTO test_timestamp VALUES ('2038-01-19 03:14:07.999999'); | ||
1263 | 126 | --echo # Selecting the record | ||
1264 | 127 | SELECT type FROM test_timestamp WHERE (EXTRACT(year FROM type) == 1970); | ||
1265 | 128 | SELECT type FROM test_timestamp WHERE (HOUR(type) == 03); | ||
1266 | 129 | --echo # Deleting the record | ||
1267 | 130 | DELETE FROM test_timestamp WHERE (EXTRACT(year FROM type) == 1992); | ||
1268 | 131 | DELETE FROM test_timestamp WHERE (MINUTE(type) == 12); | ||
1269 | 132 | --echo # Selecting the records ; this should return 2 records | ||
1270 | 133 | SELECT * FROM test_timestamp; | ||
1271 | 134 | |||
1272 | 135 | |||
1273 | 136 | # Testing if the above queries are logged | ||
1274 | 137 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1275 | 138 | |||
1276 | 139 | |||
1277 | 140 | # #################################################################################################### | ||
1278 | 141 | # Cleaning up | ||
1279 | 142 | # #################################################################################################### | ||
1280 | 143 | --echo cleaning up... | ||
1281 | 144 | SET GLOBAL logging_query_enable=false; | ||
1282 | 145 | DROP SCHEMA Test; | ||
1283 | 146 | --exec rm $DRIZZLETEST_VARDIR/logging_query.log | ||
1284 | 147 | --echo ***done*** | ||
1285 | 148 | |||
1286 | 149 | # #################################################################################################### | ||
1287 | 150 | # Done | ||
1288 | 151 | # #################################################################################################### | ||
1289 | 0 | 152 | ||
1290 | === added file 'plugin/logging_query/tests/t/datatypes_numeric.test' | |||
1291 | --- plugin/logging_query/tests/t/datatypes_numeric.test 1970-01-01 00:00:00 +0000 | |||
1292 | +++ plugin/logging_query/tests/t/datatypes_numeric.test 2012-10-08 20:02:27 +0000 | |||
1293 | @@ -0,0 +1,126 @@ | |||
1294 | 1 | |||
1295 | 2 | # ############################################################################################################################################## | ||
1296 | 3 | # Test for Drizzle's datatypes | ||
1297 | 4 | # Test whether the logging_query plugin logs each case of the datatype (we enable the plugin throughout the test and check if it logs each case) | ||
1298 | 5 | # cases: | ||
1299 | 6 | # 1.Type | ||
1300 | 7 | # 2.Range | ||
1301 | 8 | # 3.Select, Insert, Delete queries | ||
1302 | 9 | # ############################################################################################################################################## | ||
1303 | 10 | |||
1304 | 11 | # logging_query plugin is loaded into the system and this checks if the file we passed through the command line is opened or not | ||
1305 | 12 | --replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR | ||
1306 | 13 | eval SET GLOBAL logging_query_filename="$DRIZZLETEST_VARDIR/logging_query.log"; | ||
1307 | 14 | --exec if [ -f $DRIZZLETEST_VARDIR/logging_query.log ]; then echo "Log file exists"; else echo "Log file does not exist"; fi | ||
1308 | 15 | |||
1309 | 16 | # Clearing the log file | ||
1310 | 17 | --exec echo "" > $DRIZZLETEST_VARDIR/logging_query.log | ||
1311 | 18 | # Checking if the file is cleared or not | ||
1312 | 19 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1313 | 20 | # The above command should print 1 indicating that the log file is empty | ||
1314 | 21 | |||
1315 | 22 | # ################################################################################################### | ||
1316 | 23 | # Preparing the test bed | ||
1317 | 24 | # ################################################################################################### | ||
1318 | 25 | |||
1319 | 26 | --echo # logging_query plugin is not enabled and hence none of the following queries should be logged | ||
1320 | 27 | DROP SCHEMA IF EXISTS Test; | ||
1321 | 28 | CREATE SCHEMA Test; | ||
1322 | 29 | USE Test; | ||
1323 | 30 | |||
1324 | 31 | --echo # Enabling the logging_query plugin | ||
1325 | 32 | SET GLOBAL logging_query_enable=true; | ||
1326 | 33 | |||
1327 | 34 | # #################################################################################################### | ||
1328 | 35 | # INTEGER | ||
1329 | 36 | # #################################################################################################### | ||
1330 | 37 | |||
1331 | 38 | --echo #INTEGER | ||
1332 | 39 | CREATE TABLE test_integer (type INTEGER); | ||
1333 | 40 | --echo # Inserting a record with INTEGER value within range | ||
1334 | 41 | INSERT INTO test_integer VALUES (2147483645); | ||
1335 | 42 | INSERT INTO test_integer VALUES (-2147483645); | ||
1336 | 43 | --echo # Inserting a record with INTEGER value on range borders | ||
1337 | 44 | INSERT INTO test_integer VALUES (2147483647); | ||
1338 | 45 | INSERT INTO test_integer VALUES (-2147483648); | ||
1339 | 46 | --echo # Selecting the record from table | ||
1340 | 47 | SELECT type FROM test_integer WHERE type > 0; | ||
1341 | 48 | SELECT type FROM test_integer WHERE type < 0; | ||
1342 | 49 | --echo # Deleting a record from table | ||
1343 | 50 | DELETE FROM test_integer WHERE type > 0; | ||
1344 | 51 | --echo # This SELECT should return only two records | ||
1345 | 52 | SELECT * FROM test_integer; | ||
1346 | 53 | --echo # Deleting a record from table | ||
1347 | 54 | DELETE FROM test_integer WHERE type < 0; | ||
1348 | 55 | --echo # This SELECT should return a NULL set | ||
1349 | 56 | SELECT * FROM test_integer; | ||
1350 | 57 | |||
1351 | 58 | # Testing if the above queries are logged | ||
1352 | 59 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1353 | 60 | |||
1354 | 61 | |||
1355 | 62 | # #################################################################################################### | ||
1356 | 63 | # BIGINT | ||
1357 | 64 | # #################################################################################################### | ||
1358 | 65 | |||
1359 | 66 | --echo #BIGINT | ||
1360 | 67 | CREATE TABLE test_bigint (type BIGINT); | ||
1361 | 68 | --echo # Inserting a record with BIGINT value within range | ||
1362 | 69 | INSERT INTO test_bigint VALUES (9223372036854775805); | ||
1363 | 70 | INSERT INTO test_bigint VALUES (-9223372036854775805); | ||
1364 | 71 | --echo # Inserting a record with BIGINT value on range borders | ||
1365 | 72 | INSERT INTO test_bigint VALUES (9223372036854775807); | ||
1366 | 73 | INSERT INTO test_bigint VALUES (-9223372036854775808); | ||
1367 | 74 | --echo # Selecting the record from table | ||
1368 | 75 | SELECT type FROM test_bigint WHERE type > 0; | ||
1369 | 76 | SELECT type FROM test_bigint WHERE type < 0; | ||
1370 | 77 | --echo # Deleting a record from table | ||
1371 | 78 | DELETE FROM test_bigint WHERE type > 0; | ||
1372 | 79 | --echo # This SELECT should return only two records | ||
1373 | 80 | SELECT * FROM test_bigint; | ||
1374 | 81 | --echo # Deleting a record from table | ||
1375 | 82 | DELETE FROM test_bigint WHERE type < 0; | ||
1376 | 83 | --echo # This SELECT should return a NULL set | ||
1377 | 84 | SELECT * FROM test_bigint; | ||
1378 | 85 | |||
1379 | 86 | # Testing if the above queries are logged | ||
1380 | 87 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1381 | 88 | |||
1382 | 89 | |||
1383 | 90 | # #################################################################################################### | ||
1384 | 91 | # DOUBLE | ||
1385 | 92 | # #################################################################################################### | ||
1386 | 93 | |||
1387 | 94 | --echo #DOUBLE | ||
1388 | 95 | CREATE TABLE test_double (type DOUBLE); | ||
1389 | 96 | --echo #Inserting a record with DOUBLE value within range | ||
1390 | 97 | INSERT INTO test_double VALUES (-1.7976931348623155E+308); | ||
1391 | 98 | INSERT INTO test_double VALUES (1.7976931348623157E+308); | ||
1392 | 99 | --echo # Selecting the record from table | ||
1393 | 100 | SELECT type FROM test_double WHERE type > 0; | ||
1394 | 101 | SELECT type FROM test_double WHERE type < 0; | ||
1395 | 102 | --echo # Deleting a record from table | ||
1396 | 103 | DELETE FROM test_double WHERE type > 0; | ||
1397 | 104 | --echo # This SELECT should return only one record | ||
1398 | 105 | SELECT * FROM test_double; | ||
1399 | 106 | --echo # Deleting a record from table | ||
1400 | 107 | DELETE FROM test_double WHERE type < 0; | ||
1401 | 108 | --echo # This SELECT should return a NULL set | ||
1402 | 109 | SELECT * FROM test_double; | ||
1403 | 110 | |||
1404 | 111 | # Testing if the above queries are logged | ||
1405 | 112 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1406 | 113 | |||
1407 | 114 | |||
1408 | 115 | # #################################################################################################### | ||
1409 | 116 | # Cleaning up | ||
1410 | 117 | # #################################################################################################### | ||
1411 | 118 | --echo cleaning up... | ||
1412 | 119 | SET GLOBAL logging_query_enable=false; | ||
1413 | 120 | DROP SCHEMA Test; | ||
1414 | 121 | --exec rm $DRIZZLETEST_VARDIR/logging_query.log | ||
1415 | 122 | --echo ***done*** | ||
1416 | 123 | |||
1417 | 124 | # #################################################################################################### | ||
1418 | 125 | # Done | ||
1419 | 126 | # #################################################################################################### | ||
1420 | 0 | 127 | ||
1421 | === added file 'plugin/logging_query/tests/t/datatypes_string.test' | |||
1422 | --- plugin/logging_query/tests/t/datatypes_string.test 1970-01-01 00:00:00 +0000 | |||
1423 | +++ plugin/logging_query/tests/t/datatypes_string.test 2012-10-08 20:02:27 +0000 | |||
1424 | @@ -0,0 +1,111 @@ | |||
1425 | 1 | |||
1426 | 2 | # ############################################################################################################################################## | ||
1427 | 3 | # Test for Drizzle's datatypes | ||
1428 | 4 | # Test whether the logging_query plugin logs each case of the datatype (we enable the plugin throughout the test and check if it logs each case) | ||
1429 | 5 | # cases: | ||
1430 | 6 | # 1.Type | ||
1431 | 7 | # 2.Range | ||
1432 | 8 | # 3.Select, Insert, Delete queries | ||
1433 | 9 | # ############################################################################################################################################## | ||
1434 | 10 | |||
1435 | 11 | # logging_query plugin is loaded into the system and this checks if the file we passed through the command line is opened or not | ||
1436 | 12 | --replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR | ||
1437 | 13 | eval SET GLOBAL logging_query_filename="$DRIZZLETEST_VARDIR/logging_query.log"; | ||
1438 | 14 | --exec if [ -f $DRIZZLETEST_VARDIR/logging_query.log ]; then echo "Log file exists"; else echo "Log file does not exist"; fi | ||
1439 | 15 | |||
1440 | 16 | # Clearing the log file | ||
1441 | 17 | --exec echo "" > $DRIZZLETEST_VARDIR/logging_query.log | ||
1442 | 18 | # Checking if the file is cleared or not | ||
1443 | 19 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1444 | 20 | # The above command should print 1 indicating that the log file is empty | ||
1445 | 21 | |||
1446 | 22 | # ################################################################################################### | ||
1447 | 23 | # Preparing the test bed | ||
1448 | 24 | # ################################################################################################### | ||
1449 | 25 | |||
1450 | 26 | --echo # logging_query plugin is not enabled and hence none of the following queries should be logged | ||
1451 | 27 | DROP SCHEMA IF EXISTS Test; | ||
1452 | 28 | CREATE SCHEMA Test; | ||
1453 | 29 | USE Test; | ||
1454 | 30 | |||
1455 | 31 | --echo # Enabling the logging_query plugin | ||
1456 | 32 | SET GLOBAL logging_query_enable=true; | ||
1457 | 33 | |||
1458 | 34 | # ################################################################################################### | ||
1459 | 35 | # VARCHAR | ||
1460 | 36 | # ################################################################################################### | ||
1461 | 37 | |||
1462 | 38 | --echo #VARCHAR | ||
1463 | 39 | CREATE TABLE test_varchar (type VARCHAR(10)); | ||
1464 | 40 | --echo # Inserting a record with VARCHAR length within range | ||
1465 | 41 | INSERT INTO test_varchar VALUES ('varchar'); | ||
1466 | 42 | INSERT INTO test_varchar VALUES ('sql'); | ||
1467 | 43 | --echo # Inserting a record with VARCHAR length on range borders | ||
1468 | 44 | INSERT INTO test_varchar VALUES ('drizzle-DB'); | ||
1469 | 45 | INSERT INTO test_varchar VALUES (''); | ||
1470 | 46 | --echo # Selecting records from table | ||
1471 | 47 | SELECT type FROM test_varchar WHERE LENGTH(type) = 3; | ||
1472 | 48 | SELECT type FROM test_varchar WHERE LENGTH(type) = 0; | ||
1473 | 49 | --echo # Deleting records | ||
1474 | 50 | DELETE FROM test_varchar WHERE type LIKE REVERSE('rahcrav'); | ||
1475 | 51 | DELETE FROM test_varchar WHERE type LIKE SUBSTRING('mysql',3); | ||
1476 | 52 | --echo # Selecting records from table ; this should return 2 rows | ||
1477 | 53 | SELECT * FROM test_varchar; | ||
1478 | 54 | |||
1479 | 55 | |||
1480 | 56 | # Testing if the above queries are logged | ||
1481 | 57 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1482 | 58 | |||
1483 | 59 | |||
1484 | 60 | |||
1485 | 61 | # #################################################################################################### | ||
1486 | 62 | # ENUM | ||
1487 | 63 | # #################################################################################################### | ||
1488 | 64 | |||
1489 | 65 | --echo #ENUM | ||
1490 | 66 | CREATE TABLE test_enum (type ENUM('one','two','three','four','five','six','seven','eight','nine','ten')); | ||
1491 | 67 | --echo # Inserting a record with ENUM value within range | ||
1492 | 68 | INSERT INTO test_enum VALUES (3); | ||
1493 | 69 | INSERT INTO test_enum VALUES (7); | ||
1494 | 70 | --echo # Inserting a record with ENUM value on range border | ||
1495 | 71 | INSERT INTO test_enum VALUES (1); | ||
1496 | 72 | INSERT INTO test_enum VALUES (9); | ||
1497 | 73 | --echo # Selecting records from table | ||
1498 | 74 | SELECT type FROM test_enum WHERE type > 5; | ||
1499 | 75 | SELECT type FROM test_enum WHERE type < 5; | ||
1500 | 76 | --echo # Deleting records | ||
1501 | 77 | DELETE FROM test_enum WHERE type = 9; | ||
1502 | 78 | DELETE FROM test_enum WHERE type > 1; | ||
1503 | 79 | --echo # Selecting records from table ; this should return 1 row | ||
1504 | 80 | SELECT * FROM test_enum; | ||
1505 | 81 | |||
1506 | 82 | |||
1507 | 83 | # Testing if the above queries are logged | ||
1508 | 84 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1509 | 85 | |||
1510 | 86 | |||
1511 | 87 | |||
1512 | 88 | # #################################################################################################### | ||
1513 | 89 | # Cleaning up | ||
1514 | 90 | # #################################################################################################### | ||
1515 | 91 | --echo cleaning up... | ||
1516 | 92 | SET GLOBAL logging_query_enable=false; | ||
1517 | 93 | DROP SCHEMA Test; | ||
1518 | 94 | --exec rm $DRIZZLETEST_VARDIR/logging_query.log | ||
1519 | 95 | --echo ***done*** | ||
1520 | 96 | |||
1521 | 97 | # #################################################################################################### | ||
1522 | 98 | # Done | ||
1523 | 99 | # #################################################################################################### | ||
1524 | 100 | |||
1525 | 101 | |||
1526 | 102 | |||
1527 | 103 | |||
1528 | 104 | |||
1529 | 105 | |||
1530 | 106 | |||
1531 | 107 | |||
1532 | 108 | |||
1533 | 109 | |||
1534 | 110 | |||
1535 | 111 | |||
1536 | 0 | 112 | ||
1537 | === added file 'plugin/logging_query/tests/t/delete.test' | |||
1538 | --- plugin/logging_query/tests/t/delete.test 1970-01-01 00:00:00 +0000 | |||
1539 | +++ plugin/logging_query/tests/t/delete.test 2012-10-08 20:02:27 +0000 | |||
1540 | @@ -0,0 +1,152 @@ | |||
1541 | 1 | |||
1542 | 2 | # ############################################################################################# | ||
1543 | 3 | # This tests the logging_query plugin for delete, truncate and drop statements | ||
1544 | 4 | # ############################################################################################# | ||
1545 | 5 | |||
1546 | 6 | # logging_query plugin is loaded into the system. This checks if the file passed through the command line argument is opened or not | ||
1547 | 7 | --replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR | ||
1548 | 8 | eval SET GLOBAL logging_query_filename="$DRIZZLETEST_VARDIR/logging_query.log"; | ||
1549 | 9 | --exec if [ -f $DRIZZLETEST_VARDIR/logging_query.log ]; then echo "Log file exists"; else echo "Log file does not exist"; fi | ||
1550 | 10 | |||
1551 | 11 | # Clearing the log file | ||
1552 | 12 | --exec echo "" > $DRIZZLETEST_VARDIR/logging_query.log | ||
1553 | 13 | # Checking if the log file is cleared | ||
1554 | 14 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1555 | 15 | # The above command should print 1 indicating the log file is empty | ||
1556 | 16 | |||
1557 | 17 | # ############################################################################################# | ||
1558 | 18 | # Preparing the test bed | ||
1559 | 19 | # ############################################################################################# | ||
1560 | 20 | --echo Preparing the test bed... | ||
1561 | 21 | |||
1562 | 22 | --echo # The logging_query plugin is not yet enabled and hence none of the queries in the prepare phase should be logged | ||
1563 | 23 | DROP SCHEMA IF EXISTS Test_Delete; | ||
1564 | 24 | CREATE SCHEMA Test_Delete; | ||
1565 | 25 | DROP SCHEMA IF EXISTS Test_Truncate; | ||
1566 | 26 | CREATE SCHEMA Test_Truncate; | ||
1567 | 27 | DROP SCHEMA IF EXISTS Test_Drop; | ||
1568 | 28 | CREATE SCHEMA Test_Drop; | ||
1569 | 29 | --echo # Preparing test bed for DELETE test | ||
1570 | 30 | USE Test_Delete; | ||
1571 | 31 | CREATE TABLE test_delete_1 ( test_id INT, test_name CHAR(10) ); | ||
1572 | 32 | INSERT INTO test_delete_1 VALUES (1,"create"),(2,"select"),(3,"insert"),(4,"update"),(5,"delete"); | ||
1573 | 33 | CREATE TABLE test_delete_2 ( test_id INT, test_name VARCHAR(10) ); | ||
1574 | 34 | INSERT INTO test_delete_1 VALUES (1,"create"),(2,"select"),(3,"insert"),(4,"update"),(5,"delete"); | ||
1575 | 35 | --echo # Preparing test bed for TRUNCATE test | ||
1576 | 36 | USE Test_Truncate; | ||
1577 | 37 | CREATE TABLE test_truncate_1 ( test_id INT, test_name CHAR(10) ); | ||
1578 | 38 | INSERT INTO test_truncate_1 VALUES (1,"create"),(2,"select"),(3,"insert"),(4,"update"),(5,"delete"); | ||
1579 | 39 | CREATE TABLE test_truncate_2 ( test_id INT, test_name CHAR(10) ); | ||
1580 | 40 | INSERT INTO test_truncate_2 VALUES (1,"create"),(2,"select"),(3,"insert"),(4,"update"),(5,"delete"); | ||
1581 | 41 | --echo # Preparing test bed for DROP test | ||
1582 | 42 | USE Test_Drop; | ||
1583 | 43 | CREATE TABLE test_drop ( test_id INT, test_name CHAR(10) ); | ||
1584 | 44 | CREATE INDEX index_id ON test_drop ( test_id ); | ||
1585 | 45 | INSERT INTO test_drop VALUES (1,"create"),(2,"select"),(3,"insert"),(4,"update"),(5,"delete"); | ||
1586 | 46 | |||
1587 | 47 | --echo # This should print 1 indicating that, the log file is still empty | ||
1588 | 48 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1589 | 49 | |||
1590 | 50 | |||
1591 | 51 | |||
1592 | 52 | --echo # enabling the logging_query plugin | ||
1593 | 53 | SET GLOBAL logging_query_enable=true; | ||
1594 | 54 | --echo # Now the tests begin!!! | ||
1595 | 55 | |||
1596 | 56 | # ############################################################################################# | ||
1597 | 57 | # Test: DELETE | ||
1598 | 58 | # ############################################################################################# | ||
1599 | 59 | --echo DELETE test in progress... | ||
1600 | 60 | USE Test_Delete; | ||
1601 | 61 | |||
1602 | 62 | --echo # The following 2 queries should be logged | ||
1603 | 63 | DELETE FROM test_delete_1; | ||
1604 | 64 | --echo # The following query should return a null set | ||
1605 | 65 | SELECT * FROM test_delete_1; | ||
1606 | 66 | |||
1607 | 67 | --echo # enabling the logging_query plugin to log only DELETE queries | ||
1608 | 68 | SET GLOBAL logging_query_pcre="DELETE.+"; | ||
1609 | 69 | |||
1610 | 70 | --echo # The following DELETE queries should be logged | ||
1611 | 71 | DELETE FROM test_delete_2 WHERE test_id = 1; | ||
1612 | 72 | DELETE FROM test_delete_2 WHERE test_name = "select"; | ||
1613 | 73 | --echo # The following query should select only tuples with id = (3,4,5) and this query should not be logged | ||
1614 | 74 | SELECT * FROM test_delete_2; | ||
1615 | 75 | |||
1616 | 76 | --echo # enabling the logging_query plugin to log SELECT queries | ||
1617 | 77 | SET GLOBAL logging_query_pcre="SELECT.+"; | ||
1618 | 78 | |||
1619 | 79 | --echo # The following DELETE query should not be logged | ||
1620 | 80 | DELETE FROM test_delete_2; | ||
1621 | 81 | --echo # The following SELECT query should return a null set and should be logged | ||
1622 | 82 | SELECT * FROM test_delete_2; | ||
1623 | 83 | |||
1624 | 84 | --echo # Delete test is completed. Now checking the logging_query.log file. This should print 10 | ||
1625 | 85 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1626 | 86 | |||
1627 | 87 | |||
1628 | 88 | # ############################################################################################# | ||
1629 | 89 | # Test: TRUNCATE | ||
1630 | 90 | # ############################################################################################# | ||
1631 | 91 | --echo TRUNCATE test in progress... | ||
1632 | 92 | USE Test_Truncate; | ||
1633 | 93 | |||
1634 | 94 | --echo # enabling the logging_query plugin to log TRUNCATE queries | ||
1635 | 95 | SET GLOBAL logging_query_pcre="TRUNCATE.+"; | ||
1636 | 96 | |||
1637 | 97 | --echo # The following TRUNCATE query should be logged | ||
1638 | 98 | TRUNCATE TABLE test_truncate_1; | ||
1639 | 99 | --echo # This SELECT query should not be logged ; this should return a null set | ||
1640 | 100 | SELECT * FROM test_truncate_1; | ||
1641 | 101 | |||
1642 | 102 | --echo # enabling the logging_query plugin to log RENAME query | ||
1643 | 103 | SET GLOBAL logging_query_pcre="RENAME.+"; | ||
1644 | 104 | |||
1645 | 105 | --echo # The following RENAME query should be logged | ||
1646 | 106 | RENAME TABLE test_truncate_2 TO test_truncate; | ||
1647 | 107 | --echo # This TRUNCATE query should not be logged | ||
1648 | 108 | TRUNCATE TABLE test_truncate; | ||
1649 | 109 | --echo # This SELECT query should not be logged ; this should return a null set | ||
1650 | 110 | SELECT * FROM test_truncate; | ||
1651 | 111 | |||
1652 | 112 | --echo # Truncate test is completed. Now checking the logging_query.log file. This should print 14 | ||
1653 | 113 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1654 | 114 | |||
1655 | 115 | |||
1656 | 116 | # ############################################################################################# | ||
1657 | 117 | # Test: Drop | ||
1658 | 118 | # ############################################################################################# | ||
1659 | 119 | --echo DROP test in progress... | ||
1660 | 120 | USE Test_Drop; | ||
1661 | 121 | |||
1662 | 122 | --echo # enabling the logging_query plugin to log DROP queries | ||
1663 | 123 | SET GLOBAL logging_query_pcre="DROP.+"; | ||
1664 | 124 | |||
1665 | 125 | --echo # dropping an index ; this query should be logged since it is a DROP query ( though implemented through ALTER query ) | ||
1666 | 126 | ALTER TABLE test_drop DROP INDEX index_id; | ||
1667 | 127 | |||
1668 | 128 | --echo # dropping a table ; this query should be logged | ||
1669 | 129 | DROP TABLE test_drop; | ||
1670 | 130 | |||
1671 | 131 | --echo # dropping a schema ; this query should be logged | ||
1672 | 132 | DROP SCHEMA Test_Drop; | ||
1673 | 133 | |||
1674 | 134 | --echo # Drop test is completed. Now checking the logging_query.log file. This should print 18 | ||
1675 | 135 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1676 | 136 | |||
1677 | 137 | |||
1678 | 138 | # ############################################################################################# | ||
1679 | 139 | # Cleaning up | ||
1680 | 140 | # ############################################################################################# | ||
1681 | 141 | --echo cleaning up... | ||
1682 | 142 | SET GLOBAL logging_query_enable=false; | ||
1683 | 143 | SET GLOBAL logging_query_pcre=".+"; | ||
1684 | 144 | DROP SCHEMA IF EXISTS Test_Delete; | ||
1685 | 145 | DROP SCHEMA IF EXISTS Test_Truncate; | ||
1686 | 146 | DROP SCHEMA IF EXISTS Test_Drop; | ||
1687 | 147 | --exec rm $DRIZZLETEST_VARDIR/logging_query.log | ||
1688 | 148 | --echo ***done*** | ||
1689 | 149 | |||
1690 | 150 | # ############################################################################################# | ||
1691 | 151 | # Done | ||
1692 | 152 | # ############################################################################################# | ||
1693 | 0 | 153 | ||
1694 | === removed file 'plugin/logging_query/tests/t/file.bak' | |||
1695 | --- plugin/logging_query/tests/t/file.bak 2012-09-30 18:45:40 +0000 | |||
1696 | +++ plugin/logging_query/tests/t/file.bak 1970-01-01 00:00:00 +0000 | |||
1697 | @@ -1,81 +0,0 @@ | |||
1698 | 1 | |||
1699 | 2 | # ########################################################################### | ||
1700 | 3 | # This tests the dynamic behaviour of logging_query plugin | ||
1701 | 4 | # ########################################################################### | ||
1702 | 5 | |||
1703 | 6 | # Logging_query plugin is loaded into the system. This checks if the file which we passed through the command line is opened or not. | ||
1704 | 7 | --replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR | ||
1705 | 8 | --exec if [ -f $DRIZZLETEST_VARDIR/logging_query.log ]; then echo "Log file exists"; else echo "Log file does not exist"; fi | ||
1706 | 9 | # Clear log file. | ||
1707 | 10 | --exec echo "" > $DRIZZLETEST_VARDIR/logging_query.log | ||
1708 | 11 | # Double-check that log file is clear. | ||
1709 | 12 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1710 | 13 | |||
1711 | 14 | # Since logging_query_enable is OFF by default, this should not be logged into the log file. | ||
1712 | 15 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; | ||
1713 | 16 | |||
1714 | 17 | #This should not print anything | ||
1715 | 18 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1716 | 19 | |||
1717 | 20 | #Enabling logging_query plugin | ||
1718 | 21 | SET GLOBAL logging_query_enable=true; | ||
1719 | 22 | |||
1720 | 23 | #Now as logging_query_enable is set to true, this should be logged. | ||
1721 | 24 | SELECT 1; | ||
1722 | 25 | |||
1723 | 26 | #This should print the content of log file as SET GLOBAL query and SELECT query | ||
1724 | 27 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1725 | 28 | |||
1726 | 29 | #Setting logging_query_pcre as "SHOW.+". Only queries starting with 'SHOW' will be logged from now. | ||
1727 | 30 | SET GLOBAL logging_query_pcre="SHOW.+"; | ||
1728 | 31 | |||
1729 | 32 | #This should not be logged | ||
1730 | 33 | SELECT @@logging_query_enable; | ||
1731 | 34 | |||
1732 | 35 | #This should print the content of log file updated with | ||
1733 | 36 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1734 | 37 | |||
1735 | 38 | #This should be logged | ||
1736 | 39 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; | ||
1737 | 40 | |||
1738 | 41 | #This should print the content of log file updated with SHOW query as it matched the regex. | ||
1739 | 42 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1740 | 43 | |||
1741 | 44 | #Now changing the query log filename | ||
1742 | 45 | --replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR | ||
1743 | 46 | eval SET GLOBAL logging_query_filename="$DRIZZLETEST_VARDIR/logging_query1.log"; | ||
1744 | 47 | --replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR | ||
1745 | 48 | #--exec if [ -f $DRIZZLETEST_VARDIR/logging_query1.log ]; then echo "New log file exists"; else echo "New log file does not exist"; fi | ||
1746 | 49 | |||
1747 | 50 | # Clear log file. | ||
1748 | 51 | --exec echo "" > $DRIZZLETEST_VARDIR/logging_query1.log | ||
1749 | 52 | |||
1750 | 53 | # Double-check that log file is clear. | ||
1751 | 54 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query1.log | ||
1752 | 55 | |||
1753 | 56 | #This should not be logged. Neither into new log file. Nor into new log file. | ||
1754 | 57 | SELECT @@logging_query_enable; | ||
1755 | 58 | |||
1756 | 59 | #Checking the content of both the files. | ||
1757 | 60 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1758 | 61 | |||
1759 | 62 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query1.log | ||
1760 | 63 | |||
1761 | 64 | #This should be logged into new log file | ||
1762 | 65 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; | ||
1763 | 66 | |||
1764 | 67 | #Checking the contents of boh the log files. | ||
1765 | 68 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1766 | 69 | |||
1767 | 70 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query1.log | ||
1768 | 71 | |||
1769 | 72 | #Changing log file to null string. This should throw error. | ||
1770 | 73 | --error ER_WRONG_ARGUMENTS | ||
1771 | 74 | eval SET GLOBAL logging_query_filename=""; | ||
1772 | 75 | |||
1773 | 76 | --exec rm $DRIZZLETEST_VARDIR/logging_query*.log | ||
1774 | 77 | |||
1775 | 78 | # ########################################################################### | ||
1776 | 79 | # Done. | ||
1777 | 80 | # ########################################################################### | ||
1778 | 81 | |||
1779 | 82 | 0 | ||
1780 | === added file 'plugin/logging_query/tests/t/file.test' | |||
1781 | --- plugin/logging_query/tests/t/file.test 1970-01-01 00:00:00 +0000 | |||
1782 | +++ plugin/logging_query/tests/t/file.test 2012-10-08 20:02:27 +0000 | |||
1783 | @@ -0,0 +1,92 @@ | |||
1784 | 1 | |||
1785 | 2 | # ################################################################################### | ||
1786 | 3 | # This tests the dynamic behaviour of logging_query plugin | ||
1787 | 4 | # ################################################################################### | ||
1788 | 5 | |||
1789 | 6 | # Logging_query plugin is loaded into the system. This checks if the file which we passed through the command line is opened or not. | ||
1790 | 7 | --replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR | ||
1791 | 8 | eval SET GLOBAL logging_query_filename="$DRIZZLETEST_VARDIR/logging_query.log"; | ||
1792 | 9 | --exec if [ -f $DRIZZLETEST_VARDIR/logging_query.log ]; then echo "Log file exists"; else echo "Log file does not exist"; fi | ||
1793 | 10 | # Clear log file. | ||
1794 | 11 | --exec echo "" > $DRIZZLETEST_VARDIR/logging_query.log | ||
1795 | 12 | # Double-check that log file is clear. | ||
1796 | 13 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1797 | 14 | |||
1798 | 15 | --echo # Since logging_query_enable is OFF by default, this should not be logged into the log file. | ||
1799 | 16 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; | ||
1800 | 17 | |||
1801 | 18 | --echo #This should not print anything | ||
1802 | 19 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1803 | 20 | |||
1804 | 21 | --echo #Enabling logging_query plugin | ||
1805 | 22 | SET GLOBAL logging_query_enable=true; | ||
1806 | 23 | |||
1807 | 24 | --echo #Now as logging_query_enable is set to true, this should be logged. | ||
1808 | 25 | SELECT 1; | ||
1809 | 26 | |||
1810 | 27 | --echo #This should print the content of log file as SET GLOBAL query and SELECT query | ||
1811 | 28 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1812 | 29 | |||
1813 | 30 | --echo #Setting logging_query_pcre as "SHOW.+". Only queries starting with 'SHOW' will be logged from now. | ||
1814 | 31 | SET GLOBAL logging_query_pcre="SHOW.+"; | ||
1815 | 32 | |||
1816 | 33 | --echo #This should not be logged | ||
1817 | 34 | SELECT @@logging_query_enable; | ||
1818 | 35 | |||
1819 | 36 | --echo #This should print the content of log file updated with | ||
1820 | 37 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1821 | 38 | |||
1822 | 39 | --echo #This should be logged | ||
1823 | 40 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; | ||
1824 | 41 | |||
1825 | 42 | --echo #This should print the content of log file updated with SHOW query as it matched the regex. | ||
1826 | 43 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1827 | 44 | |||
1828 | 45 | --echo #Now changing the query log filename | ||
1829 | 46 | --replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR | ||
1830 | 47 | eval SET GLOBAL logging_query_filename="$DRIZZLETEST_VARDIR/logging_query1.log"; | ||
1831 | 48 | |||
1832 | 49 | --replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR | ||
1833 | 50 | --exec if [ -f $DRIZZLETEST_VARDIR/logging_query1.log ]; then echo "New log file exists"; else echo "New log file does not exist"; fi | ||
1834 | 51 | |||
1835 | 52 | --echo # Clear log file. | ||
1836 | 53 | --exec echo "" > $DRIZZLETEST_VARDIR/logging_query1.log | ||
1837 | 54 | |||
1838 | 55 | --echo # Double-check that log file is clear. | ||
1839 | 56 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query1.log | ||
1840 | 57 | |||
1841 | 58 | --echo #This should not be logged. Neither into new log file. Nor into new log file. | ||
1842 | 59 | SELECT @@logging_query_enable; | ||
1843 | 60 | |||
1844 | 61 | --echo #Checking the content of both the files. | ||
1845 | 62 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1846 | 63 | |||
1847 | 64 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query1.log | ||
1848 | 65 | |||
1849 | 66 | --echo #This should be logged into new log file | ||
1850 | 67 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; | ||
1851 | 68 | |||
1852 | 69 | --echo #Checking the contents of boh the log files. | ||
1853 | 70 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1854 | 71 | |||
1855 | 72 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query1.log | ||
1856 | 73 | |||
1857 | 74 | --echo #Changing log file to null string. This should throw error. | ||
1858 | 75 | --error ER_WRONG_ARGUMENTS | ||
1859 | 76 | eval SET GLOBAL logging_query_filename=""; | ||
1860 | 77 | |||
1861 | 78 | # ################################################################################### | ||
1862 | 79 | # Clean up | ||
1863 | 80 | # ################################################################################### | ||
1864 | 81 | --echo cleaning up... | ||
1865 | 82 | SET GLOBAL logging_query_enable=false; | ||
1866 | 83 | SET GLOBAL logging_query_pcre="*"; | ||
1867 | 84 | --replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR | ||
1868 | 85 | eval SET GLOBAL logging_query_filename="$DRIZZLETEST_VARDIR/logging_query.log"; | ||
1869 | 86 | --exec rm $DRIZZLETEST_VARDIR/logging_query.log | ||
1870 | 87 | --echo ***done*** | ||
1871 | 88 | |||
1872 | 89 | # ################################################################################### | ||
1873 | 90 | # Done. | ||
1874 | 91 | # ################################################################################### | ||
1875 | 92 | |||
1876 | 0 | 93 | ||
1877 | === added file 'plugin/logging_query/tests/t/insert.test' | |||
1878 | --- plugin/logging_query/tests/t/insert.test 1970-01-01 00:00:00 +0000 | |||
1879 | +++ plugin/logging_query/tests/t/insert.test 2012-10-08 20:02:27 +0000 | |||
1880 | @@ -0,0 +1,87 @@ | |||
1881 | 1 | |||
1882 | 2 | # #################################################################################################### | ||
1883 | 3 | # This tests the logging_query plugin for various insert statements | ||
1884 | 4 | # #################################################################################################### | ||
1885 | 5 | |||
1886 | 6 | # logging_query plugin is loaded into the system. This checks if the file which we passed through the command line is opened or not | ||
1887 | 7 | --replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR | ||
1888 | 8 | eval SET GLOBAL logging_query_filename="$DRIZZLETEST_VARDIR/logging_query.log"; | ||
1889 | 9 | --exec if [ -f $DRIZZLETEST_VARDIR/logging_query.log ]; then echo "Log file exists"; else echo "Log file does not exist"; fi | ||
1890 | 10 | |||
1891 | 11 | # Clearing the log file | ||
1892 | 12 | --exec echo "" > $DRIZZLETEST_VARDIR/logging_query.log | ||
1893 | 13 | # Checking if the log file is cleared | ||
1894 | 14 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1895 | 15 | # The above command should print 1 to indicate the log file is empty | ||
1896 | 16 | |||
1897 | 17 | # #################################################################################################### | ||
1898 | 18 | # Preparing the test bed | ||
1899 | 19 | # #################################################################################################### | ||
1900 | 20 | --echo preparing the test bed... | ||
1901 | 21 | |||
1902 | 22 | --echo # The logging_query plugin is not enabled and hence the following queries should not be logged | ||
1903 | 23 | DROP SCHEMA IF EXISTS Test; | ||
1904 | 24 | CREATE SCHEMA Test; | ||
1905 | 25 | USE Test; | ||
1906 | 26 | CREATE TABLE test_info (test_id INT, test_name VARCHAR(10)); | ||
1907 | 27 | INSERT INTO test_info (test_id,test_name) VALUES (0,null); | ||
1908 | 28 | --echo # This should print 1 indicating the log file is still empty | ||
1909 | 29 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1910 | 30 | --echo | ||
1911 | 31 | |||
1912 | 32 | --echo # Now the test begins!!! | ||
1913 | 33 | --echo # Enabling the logging_query plugin | ||
1914 | 34 | SET GLOBAL logging_query_enable=true; | ||
1915 | 35 | |||
1916 | 36 | --echo # The following queries should be logged | ||
1917 | 37 | INSERT INTO test_info (test_id) VALUES (1); | ||
1918 | 38 | INSERT INTO test_info (test_id,test_name) VALUES (1,"create"); | ||
1919 | 39 | INSERT INTO test_info VALUES (2,"select"); | ||
1920 | 40 | SELECT * FROM test_info; | ||
1921 | 41 | --echo # This should print 6 indicating that, all of the above queries are logged | ||
1922 | 42 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1923 | 43 | |||
1924 | 44 | --echo # Enabling the logging_query plugin to log only INSERT queries | ||
1925 | 45 | SET GLOBAL logging_query_pcre="INSERT.+"; | ||
1926 | 46 | |||
1927 | 47 | --echo # The following INSERT query should be logged | ||
1928 | 48 | INSERT INTO test_info (test_id,test_name) VALUES (3,"insert"); | ||
1929 | 49 | INSERT INTO test_info VALUES (4,"drop"),(5,"delete"); | ||
1930 | 50 | SELECT test_name FROM test_info; | ||
1931 | 51 | DELETE FROM test_info WHERE test_id = 0; | ||
1932 | 52 | SELECT * FROM test_info; | ||
1933 | 53 | --echo # This should print 9 indicating that, only the INSERT queries were logged | ||
1934 | 54 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1935 | 55 | |||
1936 | 56 | --echo # Enabling the logging_query plugin to log SELECT queries | ||
1937 | 57 | SET GLOBAL logging_query_pcre="SELECT.+"; | ||
1938 | 58 | |||
1939 | 59 | --echo # The following INSERT queries should NOT be logged | ||
1940 | 60 | INSERT INTO test_info VALUES (5,"delete"); | ||
1941 | 61 | SELECT test_name AS tests FROM test_info; | ||
1942 | 62 | SELECT * FROM test_info WHERE test_id > 3; | ||
1943 | 63 | --echo # This should print 12 indicating that, the INSERT query is NOT logged | ||
1944 | 64 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1945 | 65 | |||
1946 | 66 | --echo # Enabling the logging_query plugin to log DELETE queries | ||
1947 | 67 | SET GLOBAL logging_query_pcre="DELETE.+"; | ||
1948 | 68 | |||
1949 | 69 | --echo # The following INSERT queries should NOT be logged | ||
1950 | 70 | INSERT INTO test_info VALUES (6,""),(7,"enums"); | ||
1951 | 71 | DELETE FROM test_info WHERE test_id=6 OR 7; | ||
1952 | 72 | --echo # This should print 14 indicating that, the INSERT query is NOT Logged | ||
1953 | 73 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1954 | 74 | |||
1955 | 75 | # #################################################################################################### | ||
1956 | 76 | # Cleaning up | ||
1957 | 77 | # #################################################################################################### | ||
1958 | 78 | --echo cleaning up... | ||
1959 | 79 | SET GLOBAL logging_query_enable=false; | ||
1960 | 80 | SET GLOBAL logging_query_pcre=".+"; | ||
1961 | 81 | DROP SCHEMA Test; | ||
1962 | 82 | --exec rm $DRIZZLETEST_VARDIR/logging_query.log | ||
1963 | 83 | --echo ***done*** | ||
1964 | 84 | |||
1965 | 85 | # #################################################################################################### | ||
1966 | 86 | # Done | ||
1967 | 87 | # #################################################################################################### | ||
1968 | 0 | 88 | ||
1969 | === added file 'plugin/logging_query/tests/t/select.test' | |||
1970 | --- plugin/logging_query/tests/t/select.test 1970-01-01 00:00:00 +0000 | |||
1971 | +++ plugin/logging_query/tests/t/select.test 2012-10-08 20:02:27 +0000 | |||
1972 | @@ -0,0 +1,128 @@ | |||
1973 | 1 | |||
1974 | 2 | # ################################################################################## | ||
1975 | 3 | # This tests the logging_query plugin for various select instances | ||
1976 | 4 | # ################################################################################## | ||
1977 | 5 | |||
1978 | 6 | # Logging query plugin is loaded into the system. This checks if the file which we passed through the command line is opened or not | ||
1979 | 7 | --replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR | ||
1980 | 8 | eval SET GLOBAL logging_query_filename="$DRIZZLETEST_VARDIR/logging_query.log"; | ||
1981 | 9 | --exec if [ -f $DRIZZLETEST_VARDIR/logging_query.log ]; then echo "Log file exists"; else echo "Log file does not exist"; fi | ||
1982 | 10 | |||
1983 | 11 | # Clearing the log file | ||
1984 | 12 | --exec echo "" > $DRIZZLETEST_VARDIR/logging_query.log | ||
1985 | 13 | # Checking if the log file is cleared | ||
1986 | 14 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
1987 | 15 | # The above command should print 1 to indicate that the log file is empty | ||
1988 | 16 | |||
1989 | 17 | # ################################################################################## | ||
1990 | 18 | # Preparing the test bed | ||
1991 | 19 | # ################################################################################## | ||
1992 | 20 | --echo Preparing the test bed... | ||
1993 | 21 | CREATE SCHEMA Select_Test; | ||
1994 | 22 | USE Select_Test; | ||
1995 | 23 | CREATE TABLE select_test_1 (id INT, type CHAR(20)); | ||
1996 | 24 | INSERT INTO select_test_1 VALUES (1,"basic select"),(2,"select distinct"),(3,"select with where"),(4,"select with orderby"); | ||
1997 | 25 | CREATE TABLE select_test_2 (id INT, time FLOAT); | ||
1998 | 26 | INSERT INTO select_test_2 VALUES (1,10.01),(2,9.38),(3,5.6),(4,6.7); | ||
1999 | 27 | --echo prepare phase completed... | ||
2000 | 28 | --echo | ||
2001 | 29 | |||
2002 | 30 | # ################################################################################### | ||
2003 | 31 | # Basic SELECT queries | ||
2004 | 32 | # ################################################################################### | ||
2005 | 33 | --echo Testing basic select queries. | ||
2006 | 34 | --echo # The logging_query is not enabled and hence the following select queries should not be logged | ||
2007 | 35 | SELECT 1; | ||
2008 | 36 | SELECT "logging_query"; | ||
2009 | 37 | --echo # This should print 1 to indicate the log file is still empty | ||
2010 | 38 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2011 | 39 | --echo | ||
2012 | 40 | |||
2013 | 41 | --echo # Enabling the logging_query plugin | ||
2014 | 42 | SET GLOBAL logging_query_enable=true; | ||
2015 | 43 | --echo | ||
2016 | 44 | |||
2017 | 45 | --echo # The logging_query is enabled and the following select query should be logged | ||
2018 | 46 | SELECT 1; | ||
2019 | 47 | --echo # This should print 3 indicating that the above query is logged | ||
2020 | 48 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2021 | 49 | --echo # Issuing another select query | ||
2022 | 50 | SELECT "hello world"; | ||
2023 | 51 | --echo # This should print 4 indicating that the above query is logged | ||
2024 | 52 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2025 | 53 | --echo | ||
2026 | 54 | |||
2027 | 55 | --echo # Enabling the logging_query to log only SHOW queries | ||
2028 | 56 | SET GLOBAL logging_query_pcre="SHOW.+"; | ||
2029 | 57 | --echo | ||
2030 | 58 | |||
2031 | 59 | --echo # The following query should be logged | ||
2032 | 60 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; | ||
2033 | 61 | --echo # This should print 6 indicating that the above query is logged | ||
2034 | 62 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2035 | 63 | --echo | ||
2036 | 64 | |||
2037 | 65 | --echo # The following select query should not be logged | ||
2038 | 66 | SELECT 1; | ||
2039 | 67 | --echo # This should print 4 indicating that the above query is not logged | ||
2040 | 68 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2041 | 69 | --echo # Basic test completed... | ||
2042 | 70 | --echo | ||
2043 | 71 | |||
2044 | 72 | |||
2045 | 73 | --echo drilling the SELECT queries test. | ||
2046 | 74 | --echo # Enabling the logging_query plugin to log SELECT queries | ||
2047 | 75 | --echo # ( since here after, the test deals with variants of SELECT queries and all such should be checked against logging) | ||
2048 | 76 | SET GLOBAL logging_query_pcre="SELECT.+"; | ||
2049 | 77 | --echo | ||
2050 | 78 | |||
2051 | 79 | # ################################################################################## | ||
2052 | 80 | # SELECT with DISTINCT | ||
2053 | 81 | # ################################################################################## | ||
2054 | 82 | --echo # Testing for select with distinct | ||
2055 | 83 | --echo # The following queries should be logged | ||
2056 | 84 | SELECT DISTINCT * FROM select_test_1; | ||
2057 | 85 | SELECT DISTINCT * FROM select_test_2; | ||
2058 | 86 | --echo # This should print 9 indicating that the above queries are logged | ||
2059 | 87 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2060 | 88 | --echo | ||
2061 | 89 | |||
2062 | 90 | # ################################################################################## | ||
2063 | 91 | # SELECT with WHERE | ||
2064 | 92 | # ################################################################################## | ||
2065 | 93 | --echo # Testing for select with where | ||
2066 | 94 | --echo # The following queries should be logged | ||
2067 | 95 | SELECT * FROM select_test_1 WHERE id = 2; | ||
2068 | 96 | SELECT * FROM select_test_1 WHERE type = "select with where"; | ||
2069 | 97 | SELECT time FROM select_test_2 WHERE id >= 2; | ||
2070 | 98 | SELECT id FROM select_test_2 WHERE time < 6; | ||
2071 | 99 | --echo # This should print 13 indicating that the above queries are logged | ||
2072 | 100 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2073 | 101 | --echo | ||
2074 | 102 | |||
2075 | 103 | # ################################################################################## | ||
2076 | 104 | # SELECT with ORDER BY | ||
2077 | 105 | # ################################################################################## | ||
2078 | 106 | --echo # Testing for select with order by | ||
2079 | 107 | --echo # The following queries should be logged | ||
2080 | 108 | SELECT * FROM select_test_2 ORDER BY id DESC; | ||
2081 | 109 | SELECT time FROM select_test_2 ORDER BY time; | ||
2082 | 110 | SELECT id FROM select_test_2 ORDER BY time DESC; | ||
2083 | 111 | --echo # This should print 16 indicating all the above queries are logged | ||
2084 | 112 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2085 | 113 | --echo | ||
2086 | 114 | |||
2087 | 115 | |||
2088 | 116 | # ################################################################################## | ||
2089 | 117 | # Cleaning up | ||
2090 | 118 | # ################################################################################## | ||
2091 | 119 | --echo cleaning up... | ||
2092 | 120 | DROP SCHEMA Select_Test; | ||
2093 | 121 | SET GLOBAL logging_query_enable=false; | ||
2094 | 122 | SET GLOBAL logging_query_pcre=".+"; | ||
2095 | 123 | --exec rm $DRIZZLETEST_VARDIR/logging_query.log | ||
2096 | 124 | --echo ***done*** | ||
2097 | 125 | |||
2098 | 126 | # ################################################################################## | ||
2099 | 127 | # Done | ||
2100 | 128 | # ################################################################################## | ||
2101 | 0 | 129 | ||
2102 | === removed file 'plugin/logging_query/tests/t/thresholds.bak' | |||
2103 | --- plugin/logging_query/tests/t/thresholds.bak 2012-09-30 21:58:50 +0000 | |||
2104 | +++ plugin/logging_query/tests/t/thresholds.bak 1970-01-01 00:00:00 +0000 | |||
2105 | @@ -1,87 +0,0 @@ | |||
2106 | 1 | |||
2107 | 2 | # ########################################################################### | ||
2108 | 3 | # This tests the various logging_query_threshold_ variables. | ||
2109 | 4 | # ########################################################################### | ||
2110 | 5 | |||
2111 | 6 | # First make sure the logging_query plugin is enabled. | ||
2112 | 7 | --replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR | ||
2113 | 8 | eval SET GLOBAL logging_query_filename="$DRIZZLETEST_VARDIR/logging_query.log"; | ||
2114 | 9 | eval SET GLOBAL logging_query_pcre=".+"; | ||
2115 | 10 | --replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR | ||
2116 | 11 | SET GLOBAL logging_query_enable=true; | ||
2117 | 12 | |||
2118 | 13 | # Make sure we have all our threshold variables and that they're all | ||
2119 | 14 | # off (zero) by default. | ||
2120 | 15 | SHOW VARIABLES LIKE 'logging_query_threshold%'; | ||
2121 | 16 | |||
2122 | 17 | # ########################################################################### | ||
2123 | 18 | # logging_query_threshold_slow | ||
2124 | 19 | # ########################################################################### | ||
2125 | 20 | |||
2126 | 21 | # Set a 0.5s execution time threshold. | ||
2127 | 22 | SET GLOBAL logging_query_threshold_slow=500000; | ||
2128 | 23 | SELECT @@logging_query_threshold_slow; | ||
2129 | 24 | |||
2130 | 25 | # Clear log file. | ||
2131 | 26 | --exec echo "" > $DRIZZLETEST_VARDIR/logging_query.log | ||
2132 | 27 | # Double-check that log file is clear. | ||
2133 | 28 | --cat_file $DRIZZLETEST_VARDIR/logging_query.log | ||
2134 | 29 | |||
2135 | 30 | # This query should *not* log since it's below the threshold. | ||
2136 | 31 | SELECT SLEEP(0.4); | ||
2137 | 32 | # This should not print anything. | ||
2138 | 33 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2139 | 34 | |||
2140 | 35 | # This query should log since it's just a few microseconds past the threshold. | ||
2141 | 36 | SELECT SLEEP(0.5); | ||
2142 | 37 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2143 | 38 | |||
2144 | 39 | # Set query_log_threshold_execution_time back to zero. | ||
2145 | 40 | SET GLOBAL logging_query_threshold_slow=0; | ||
2146 | 41 | #This should be logged | ||
2147 | 42 | SELECT SLEEP(1); | ||
2148 | 43 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2149 | 44 | |||
2150 | 45 | # Clear log file. | ||
2151 | 46 | --exec echo "" > $DRIZZLETEST_VARDIR/logging_query.log | ||
2152 | 47 | # Double-check that log file is clear. | ||
2153 | 48 | --cat_file $DRIZZLETEST_VARDIR/logging_query.log | ||
2154 | 49 | |||
2155 | 50 | # ########################################################################### | ||
2156 | 51 | # logging_query_threshold_big_resultset | ||
2157 | 52 | # ########################################################################### | ||
2158 | 53 | # This should be logged | ||
2159 | 54 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; | ||
2160 | 55 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2161 | 56 | SET GLOBAL logging_query_threshold_big_resultset=2; | ||
2162 | 57 | |||
2163 | 58 | #This should not be logged | ||
2164 | 59 | SELECT "This should not be logged"; | ||
2165 | 60 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2166 | 61 | |||
2167 | 62 | # Clear log file. | ||
2168 | 63 | --exec echo "" > $DRIZZLETEST_VARDIR/logging_query.log | ||
2169 | 64 | # Double-check that log file is clear. | ||
2170 | 65 | --cat_file $DRIZZLETEST_VARDIR/logging_query.log | ||
2171 | 66 | |||
2172 | 67 | # ########################################################################### | ||
2173 | 68 | # logging_query_threshold_big_examined | ||
2174 | 69 | # ########################################################################### | ||
2175 | 70 | # This should be logged | ||
2176 | 71 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; | ||
2177 | 72 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2178 | 73 | |||
2179 | 74 | #Changing threshold_big_examined to 2, so that queries which examine less that 2 rows will not be logged | ||
2180 | 75 | SET GLOBAL logging_query_threshold_big_examined=2; | ||
2181 | 76 | #This should not be logged | ||
2182 | 77 | SELECT "This should not be logged"; | ||
2183 | 78 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2184 | 79 | |||
2185 | 80 | # ############################################################################ | ||
2186 | 81 | # Clean up. | ||
2187 | 82 | # ############################################################################ | ||
2188 | 83 | --exec rm $DRIZZLETEST_VARDIR/logging_query*.log | ||
2189 | 84 | |||
2190 | 85 | # ########################################################################### | ||
2191 | 86 | # Done. | ||
2192 | 87 | # ########################################################################### | ||
2193 | 88 | 0 | ||
2194 | === added file 'plugin/logging_query/tests/t/thresholds.test' | |||
2195 | --- plugin/logging_query/tests/t/thresholds.test 1970-01-01 00:00:00 +0000 | |||
2196 | +++ plugin/logging_query/tests/t/thresholds.test 2012-10-08 20:02:27 +0000 | |||
2197 | @@ -0,0 +1,91 @@ | |||
2198 | 1 | |||
2199 | 2 | # ########################################################################### | ||
2200 | 3 | # This tests the various logging_query_threshold_ variables. | ||
2201 | 4 | # ########################################################################### | ||
2202 | 5 | |||
2203 | 6 | # First make sure the logging_query plugin is enabled. | ||
2204 | 7 | --replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR | ||
2205 | 8 | eval SET GLOBAL logging_query_filename="$DRIZZLETEST_VARDIR/logging_query.log"; | ||
2206 | 9 | eval SET GLOBAL logging_query_pcre=".+"; | ||
2207 | 10 | --replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR | ||
2208 | 11 | SET GLOBAL logging_query_enable=true; | ||
2209 | 12 | |||
2210 | 13 | # Make sure we have all our threshold variables and that they're all | ||
2211 | 14 | # off (zero) by default. | ||
2212 | 15 | SHOW VARIABLES LIKE 'logging_query_threshold%'; | ||
2213 | 16 | |||
2214 | 17 | # ########################################################################### | ||
2215 | 18 | # logging_query_threshold_slow | ||
2216 | 19 | # ########################################################################### | ||
2217 | 20 | |||
2218 | 21 | # Set a 0.5s execution time threshold. | ||
2219 | 22 | SET GLOBAL logging_query_threshold_slow=500000; | ||
2220 | 23 | SELECT @@logging_query_threshold_slow; | ||
2221 | 24 | |||
2222 | 25 | # Clear log file. | ||
2223 | 26 | --exec echo "" > $DRIZZLETEST_VARDIR/logging_query.log | ||
2224 | 27 | # Double-check that log file is clear. | ||
2225 | 28 | --cat_file $DRIZZLETEST_VARDIR/logging_query.log | ||
2226 | 29 | |||
2227 | 30 | # This query should *not* log since it's below the threshold. | ||
2228 | 31 | SELECT SLEEP(0.4); | ||
2229 | 32 | # This should not print anything. | ||
2230 | 33 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2231 | 34 | |||
2232 | 35 | # This query should log since it's just a few microseconds past the threshold. | ||
2233 | 36 | SELECT SLEEP(0.5); | ||
2234 | 37 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2235 | 38 | |||
2236 | 39 | # Set query_log_threshold_execution_time back to zero. | ||
2237 | 40 | SET GLOBAL logging_query_threshold_slow=0; | ||
2238 | 41 | #This should be logged | ||
2239 | 42 | SELECT SLEEP(1); | ||
2240 | 43 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2241 | 44 | |||
2242 | 45 | # Clear log file. | ||
2243 | 46 | --exec echo "" > $DRIZZLETEST_VARDIR/logging_query.log | ||
2244 | 47 | # Double-check that log file is clear. | ||
2245 | 48 | --cat_file $DRIZZLETEST_VARDIR/logging_query.log | ||
2246 | 49 | |||
2247 | 50 | # ########################################################################### | ||
2248 | 51 | # logging_query_threshold_big_resultset | ||
2249 | 52 | # ########################################################################### | ||
2250 | 53 | # This should be logged | ||
2251 | 54 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; | ||
2252 | 55 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2253 | 56 | SET GLOBAL logging_query_threshold_big_resultset=2; | ||
2254 | 57 | |||
2255 | 58 | #This should not be logged | ||
2256 | 59 | SELECT "This should not be logged"; | ||
2257 | 60 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2258 | 61 | |||
2259 | 62 | # Clear log file. | ||
2260 | 63 | --exec echo "" > $DRIZZLETEST_VARDIR/logging_query.log | ||
2261 | 64 | # Double-check that log file is clear. | ||
2262 | 65 | --cat_file $DRIZZLETEST_VARDIR/logging_query.log | ||
2263 | 66 | |||
2264 | 67 | # ########################################################################### | ||
2265 | 68 | # logging_query_threshold_big_examined | ||
2266 | 69 | # ########################################################################### | ||
2267 | 70 | # This should be logged | ||
2268 | 71 | SHOW VARIABLES WHERE Variable_Name NOT LIKE "%logging_query_filename%" AND Variable_Name LIKE "%logging_query%"; | ||
2269 | 72 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2270 | 73 | |||
2271 | 74 | #Changing threshold_big_examined to 2, so that queries which examine less that 2 rows will not be logged | ||
2272 | 75 | SET GLOBAL logging_query_threshold_big_examined=2; | ||
2273 | 76 | #This should not be logged | ||
2274 | 77 | SELECT "This should not be logged"; | ||
2275 | 78 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2276 | 79 | |||
2277 | 80 | # ############################################################################ | ||
2278 | 81 | # Clean up. | ||
2279 | 82 | # ############################################################################ | ||
2280 | 83 | --echo cleaning up... | ||
2281 | 84 | SET GLOBAL logging_query_enable=false; | ||
2282 | 85 | SET GLOBAL logging_query_pcre=".+"; | ||
2283 | 86 | --exec rm $DRIZZLETEST_VARDIR/logging_query*.log | ||
2284 | 87 | --echo ***done*** | ||
2285 | 88 | |||
2286 | 89 | # ########################################################################### | ||
2287 | 90 | # Done. | ||
2288 | 91 | # ########################################################################### | ||
2289 | 0 | 92 | ||
2290 | === added file 'plugin/logging_query/tests/t/update.test' | |||
2291 | --- plugin/logging_query/tests/t/update.test 1970-01-01 00:00:00 +0000 | |||
2292 | +++ plugin/logging_query/tests/t/update.test 2012-10-08 20:02:27 +0000 | |||
2293 | @@ -0,0 +1,88 @@ | |||
2294 | 1 | |||
2295 | 2 | # ######################################################################################### | ||
2296 | 3 | # This tests the logging_query plugin for various update statements | ||
2297 | 4 | # ######################################################################################### | ||
2298 | 5 | |||
2299 | 6 | # The logging_query plugin is loaded into the system. This checks if the file which we sent through the command line is opened or not | ||
2300 | 7 | --replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR | ||
2301 | 8 | eval SET GLOBAL logging_query_filename="$DRIZZLETEST_VARDIR/logging_query.log"; | ||
2302 | 9 | --exec if [ -f $DRIZZLETEST_VARDIR/logging_query.log ]; then echo "Log file exists"; else echo "Log file does not exist"; fi | ||
2303 | 10 | |||
2304 | 11 | # Clearing the log file | ||
2305 | 12 | --exec echo "" > $DRIZZLETEST_VARDIR/logging_query.log | ||
2306 | 13 | # Checking if the log file is empty or not | ||
2307 | 14 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2308 | 15 | # The above command should print 1 indicating that the log file is still empty | ||
2309 | 16 | |||
2310 | 17 | # ######################################################################################### | ||
2311 | 18 | # Preparing the test bed | ||
2312 | 19 | # ######################################################################################### | ||
2313 | 20 | --echo preparing the test bed... | ||
2314 | 21 | |||
2315 | 22 | --echo # The logging_query plugin is not enabled and hence none of the queries in prepare phase should be logged | ||
2316 | 23 | CREATE SCHEMA Test_Update; | ||
2317 | 24 | USE Test_Update; | ||
2318 | 25 | CREATE TABLE test_info (id INT, name CHAR(10)); | ||
2319 | 26 | INSERT INTO test_info VALUES (1,"create"),(2,"select"),(3,"insert"),(4,"update"),(5,"delete"); | ||
2320 | 27 | --echo # This should print 1 indicating that the log file is still empty | ||
2321 | 28 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2322 | 29 | --echo | ||
2323 | 30 | |||
2324 | 31 | # ######################################################################################### | ||
2325 | 32 | # UPDATE test | ||
2326 | 33 | # ######################################################################################### | ||
2327 | 34 | --echo UPDATE test in progress... | ||
2328 | 35 | |||
2329 | 36 | --echo # The logging_query plugin is not enabled and the following update query should not be logged | ||
2330 | 37 | UPDATE test_info SET name="CREATE" WHERE id=1; | ||
2331 | 38 | --echo # This should print 1 indicating that the log file is still empty | ||
2332 | 39 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2333 | 40 | --echo | ||
2334 | 41 | |||
2335 | 42 | --echo # Enabling the logging_query plugin | ||
2336 | 43 | SET GLOBAL logging_query_enable=true; | ||
2337 | 44 | --echo | ||
2338 | 45 | |||
2339 | 46 | --echo # The logging_query plugin is enabled and the following update query should be logged | ||
2340 | 47 | UPDATE test_info SET name="SELECT" WHERE id=2; | ||
2341 | 48 | --echo # This should print 3 indicating that the above query is logged | ||
2342 | 49 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2343 | 50 | --echo | ||
2344 | 51 | |||
2345 | 52 | --echo # Enabling the logging_query plugin to log only select queries | ||
2346 | 53 | SET GLOBAL logging_query_pcre="SELECT.+"; | ||
2347 | 54 | --echo | ||
2348 | 55 | |||
2349 | 56 | --echo # The following UPDATE query should not be logged | ||
2350 | 57 | UPDATE test_info SET name="INSERT" WHERE id=3; | ||
2351 | 58 | SELECT * FROM test_info; | ||
2352 | 59 | --echo # This should print 5 indicating that, only the UPDATE query is NOT logged | ||
2353 | 60 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2354 | 61 | --echo | ||
2355 | 62 | |||
2356 | 63 | --echo # Enabling the logging_query plugin to log UPDATE queries | ||
2357 | 64 | SET GLOBAL logging_query_pcre="UPDATE.+"; | ||
2358 | 65 | --echo | ||
2359 | 66 | |||
2360 | 67 | --echo # The followihng UPDATE query should be logged | ||
2361 | 68 | UPDATE test_info SET name="UPDATE" WHERE id=6; | ||
2362 | 69 | --echo # The above query will not update the table since a tuple with id=6 does not exist | ||
2363 | 70 | SELECT * FROM test_info; | ||
2364 | 71 | --echo # This should print 7 indicating that, only the UPDATE query is logged and not the select query | ||
2365 | 72 | --exec $TOP_SRCDIR/plugin/logging_query/tests/parse-query-log.sh $DRIZZLETEST_VARDIR/logging_query.log | ||
2366 | 73 | --echo | ||
2367 | 74 | |||
2368 | 75 | # ######################################################################################### | ||
2369 | 76 | # Clean up | ||
2370 | 77 | # ######################################################################################### | ||
2371 | 78 | --echo cleaning up... | ||
2372 | 79 | SET GLOBAL logging_query_enable=false; | ||
2373 | 80 | SET GLOBAL logging_query_pcre=".+"; | ||
2374 | 81 | DROP SCHEMA Test_Update; | ||
2375 | 82 | --exec rm $DRIZZLETEST_VARDIR/logging_query.log | ||
2376 | 83 | --echo ***done*** | ||
2377 | 84 | |||
2378 | 85 | # ######################################################################################### | ||
2379 | 86 | # Done | ||
2380 | 87 | # ######################################################################################### | ||
2381 | 88 |
Looks good. Thanks for taking the time to fix that one test and to create this suite of tests.