Merge lp:~ben-kersten/mysql-proxy/packet-empty-set into lp:mysql-proxy/0.8
Status: | Needs review |
---|---|
Proposed branch: | lp:~ben-kersten/mysql-proxy/packet-empty-set |
Merge into: | lp:mysql-proxy/0.8 |
Diff against target: |
11 lines (+1/-0) 1 file modified
src/network-mysqld-packet.c (+1/-0) |
To merge this branch: | bzr merge lp:~ben-kersten/mysql-proxy/packet-empty-set |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Registry Administrators | Pending | ||
Review via email: mp+37427@code.launchpad.net |
Description of the change
When a query goes through the lua layer and mysqld returns an error it is possible for the query status to be set to OK if the error packet is preceded by field header packets.
=======
-- test script for a failing query that gets error packet after field packets
function read_query(packet)
if string.byte(packet) ~= proxy.COM_QUERY then
return
end
local query = string.sub(packet, 2)
if string.
print("testing the bug")
proxy.
return proxy.PROXY_
end
end
function read_query_result (inj)
if inj.id == 1 then
local status = inj.resultset.
if not status or status == proxy.MYSQLD_
print("An error occurred in query: " .. inj.query:sub(2))
return -- original results
end
-- resultset rewrite
local response = {
['type'] = proxy.MYSQLD_
['resultset'] = {
['fields'] = {
{
type = proxy.MYSQL_
name = "fake_field",
}
},
['rows'] = {}
}
}
-- copy the hopefully empty resultset
local rows = response.
for row in inj.resultset.rows do
rows[#rows+1] = row
end
print("row count: " .. #rows)
proxy.response = response
return proxy.PROXY_
end
end
Unmerged revisions
- 1133. By Ben Kersten <bkersten@mel601855>
-
Fixed bug where query status is not set to error when error packet is preceded by field header packets.