Merge lp://qastaging/~roger-booth/mysql-proxy/laminator into lp://qastaging/mysql-proxy

Proposed by Roger Booth
Status: Needs review
Proposed branch: lp://qastaging/~roger-booth/mysql-proxy/laminator
Merge into: lp://qastaging/mysql-proxy
Diff against target: 61 lines (+20/-5)
1 file modified
lib/proxy/parser.lua (+20/-5)
To merge this branch: bzr merge lp://qastaging/~roger-booth/mysql-proxy/laminator
Reviewer Review Type Date Requested Status
Registry Administrators Pending
Review via email: mp+17192@code.qastaging.launchpad.net
To post a comment you must log in.
Revision history for this message
Roger Booth (roger-booth) wrote :

This branch contains a fix for bug #36151.
It includes a version of parser.lua that produces the correct output for the test case recently added to the bug report.

Thanks,
Roger Booth

Revision history for this message
Roger Booth (roger-booth) wrote :

Link to MySQL bug report: http://bugs.mysql.com/bug.php?id=36151

Unmerged revisions

945. By Roger Booth

Fix for Proxy parser.lua MySQL Bug #36151

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/proxy/parser.lua'
2--- lib/proxy/parser.lua 2008-10-30 20:40:25 +0000
3+++ lib/proxy/parser.lua 2010-01-12 04:03:11 +0000
4@@ -38,6 +38,7 @@
5 local next_is_tblname = false
6 local in_braces = 0
7 local db_name = nil
8+ local ddl_type = nil
9
10 local tables = {}
11
12@@ -129,10 +130,14 @@
13 elseif ddl_type == "TABLE" then
14 if in_tablelist and
15 token["token_name"] == "TK_LITERAL" then
16- tables[tablename_expand(token.text)] = (sql_stmt == "SELECT" and "read" or "write")
17+ if not db_name and tokens[i + 1] and tokens[i + 1].token_name == "TK_DOT" then
18+ db_name = token.text
19+ else
20+ tables[tablename_expand(token.text, db_name)] = (sql_stmt == "SELECT" and "read" or "write")
21+ db_name = nil
22+ end
23 else
24 in_tablelist = false
25-
26 break
27 end
28 end
29@@ -140,8 +145,14 @@
30 -- INSERT INTO ...
31 if in_tablelist then
32 if token["token_name"] == "TK_LITERAL" then
33- tables[tablename_expand(token.text)] = (sql_stmt == "SELECT" and "read" or "write")
34+ if not db_name and tokens[i + 1] and tokens[i + 1].token_name == "TK_DOT" then
35+ db_name = token.text
36+ else
37+ tables[tablename_expand(token.text, db_name)] = (sql_stmt == "SELECT" and "read" or "write")
38+ db_name = nil
39+ end
40 elseif token["token_name"] == "TK_SQL_INTO" then
41+ elseif token["token_name"] == "TK_DOT" then
42 else
43 in_tablelist = false
44 end
45@@ -150,10 +161,14 @@
46 -- UPDATE <tbl> SET ..
47 if in_tablelist then
48 if token["token_name"] == "TK_LITERAL" then
49- tables[tablename_expand(token.text)] = (sql_stmt == "SELECT" and "read" or "write")
50+ if not db_name and tokens[i + 1] and tokens[i + 1].token_name == "TK_DOT" then
51+ db_name = token.text
52+ else
53+ tables[tablename_expand(token.text, db_name)] = (sql_stmt == "SELECT" and "read" or "write")
54+ db_name = nil
55+ end
56 elseif token["token_name"] == "TK_SQL_SET" then
57 in_tablelist = false
58-
59 break
60 end
61 end

Subscribers

People subscribed via source and target branches