Re: Filtering - Injection - Redirection
The lua code for this looks like this:
----
local is_in_transaction = 0
function read_query( packet )
if packet:byte() == proxy.COM_QUIT then
proxy.response = {
type = proxy.MYSQLD_PACKET_ERR,
errmsg = "ignored the COM_QUIT"
}
return proxy.PROXY_SEND_RESULT
end
proxy.queries:append(1, packet)
if is_in_transaction == 0 and
packet:byte() == proxy.COM_QUERY and
packet:sub(2, 7) == "SELECT" then
-- send to slave
print("sending to slave");
else
-- send to master
print("sending to master");
end
return proxy.PROXY_SEND_QUERY
end
function read_query_result( inj )
local res = assert(inj.resultset)
local flags = res.flags
is_in_transaction = flags.in_trans
end
----
Now I only have to add the host-selector :)
Jan
Subject
Views
Written By
Posted
4676
July 09, 2007 12:18PM
2848
July 09, 2007 01:07PM
2874
July 09, 2007 01:42PM
2985
July 09, 2007 01:53PM
2964
July 09, 2007 01:58PM
Re: Filtering - Injection - Redirection
3000
July 09, 2007 04:34PM
2871
July 09, 2007 08:40PM
2938
July 10, 2007 02:28AM
2905
July 10, 2007 10:42AM
2862
July 10, 2007 11:00AM
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.