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

Proposed by Roger Booth
Status: Needs review
Proposed branch: lp:~roger-booth/mysql-proxy/laminator
Merge into: lp: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:~roger-booth/mysql-proxy/laminator
Reviewer Review Type Date Requested Status
Registry Administrators Pending
Review via email: mp+17192@code.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
=== modified file 'lib/proxy/parser.lua'
--- lib/proxy/parser.lua 2008-10-30 20:40:25 +0000
+++ lib/proxy/parser.lua 2010-01-12 04:03:11 +0000
@@ -38,6 +38,7 @@
38 local next_is_tblname = false38 local next_is_tblname = false
39 local in_braces = 039 local in_braces = 0
40 local db_name = nil40 local db_name = nil
41 local ddl_type = nil
4142
42 local tables = {}43 local tables = {}
4344
@@ -129,10 +130,14 @@
129 elseif ddl_type == "TABLE" then130 elseif ddl_type == "TABLE" then
130 if in_tablelist and 131 if in_tablelist and
131 token["token_name"] == "TK_LITERAL" then132 token["token_name"] == "TK_LITERAL" then
132 tables[tablename_expand(token.text)] = (sql_stmt == "SELECT" and "read" or "write")133 if not db_name and tokens[i + 1] and tokens[i + 1].token_name == "TK_DOT" then
134 db_name = token.text
135 else
136 tables[tablename_expand(token.text, db_name)] = (sql_stmt == "SELECT" and "read" or "write")
137 db_name = nil
138 end
133 else139 else
134 in_tablelist = false140 in_tablelist = false
135
136 break141 break
137 end142 end
138 end143 end
@@ -140,8 +145,14 @@
140 -- INSERT INTO ...145 -- INSERT INTO ...
141 if in_tablelist then146 if in_tablelist then
142 if token["token_name"] == "TK_LITERAL" then147 if token["token_name"] == "TK_LITERAL" then
143 tables[tablename_expand(token.text)] = (sql_stmt == "SELECT" and "read" or "write")148 if not db_name and tokens[i + 1] and tokens[i + 1].token_name == "TK_DOT" then
149 db_name = token.text
150 else
151 tables[tablename_expand(token.text, db_name)] = (sql_stmt == "SELECT" and "read" or "write")
152 db_name = nil
153 end
144 elseif token["token_name"] == "TK_SQL_INTO" then154 elseif token["token_name"] == "TK_SQL_INTO" then
155 elseif token["token_name"] == "TK_DOT" then
145 else156 else
146 in_tablelist = false157 in_tablelist = false
147 end158 end
@@ -150,10 +161,14 @@
150 -- UPDATE <tbl> SET ..161 -- UPDATE <tbl> SET ..
151 if in_tablelist then162 if in_tablelist then
152 if token["token_name"] == "TK_LITERAL" then163 if token["token_name"] == "TK_LITERAL" then
153 tables[tablename_expand(token.text)] = (sql_stmt == "SELECT" and "read" or "write")164 if not db_name and tokens[i + 1] and tokens[i + 1].token_name == "TK_DOT" then
165 db_name = token.text
166 else
167 tables[tablename_expand(token.text, db_name)] = (sql_stmt == "SELECT" and "read" or "write")
168 db_name = nil
169 end
154 elseif token["token_name"] == "TK_SQL_SET" then170 elseif token["token_name"] == "TK_SQL_SET" then
155 in_tablelist = false171 in_tablelist = false
156
157 break172 break
158 end173 end
159 end174 end

Subscribers

People subscribed via source and target branches