Re: Change Database base on query
Hello again.
I figured a solution that worked for me in this test scenario. I figured I would post the result in case anyone else was interested.
function read_query (packet)
print(packet:sub(2))
print(packet:byte()..":"..proxy.COM_QUERY)
if packet:byte() == proxy.COM_QUERY then
if packet:sub(2,7) == "select" then
print(" query: " .. packet:sub(2))
proxy.queries:append(1, string.char(proxy.COM_INIT_DB) .. "proxy_read", { resultset_is_needed = true })
proxy.queries:append(2,packet, { resultset_is_needed = true } )
else
proxy.queries:append(1, string.char(proxy.COM_INIT_DB) .. "proxy_write", { resultset_is_needed = true })
proxy.queries:append(2,packet, { resultset_is_needed = true } )
end
return proxy.PROXY_SEND_QUERY
end
end
function read_query_result(inj)
print("injected result-set: id = " .. inj.type)
-- we injected the SELECT NOW() with the id = 2
if (inj.type == 2) then
for row in inj.resultset.rows do
print("injected query returned: " .. row[0])
end
return proxy.PROXY_SEND_RESULT
else
return proxy.PROXY_IGNORE_RESULT
end
end
Subject
Views
Written By
Posted
4700
July 07, 2009 04:48PM
Re: Change Database base on query
2833
July 10, 2009 03:13PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.