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
4972
July 09, 2007 12:18PM
3000
July 09, 2007 01:07PM
3008
July 09, 2007 01:42PM
3129
July 09, 2007 01:53PM
3121
July 09, 2007 01:58PM
Re: Filtering - Injection - Redirection
3160
July 09, 2007 04:34PM
3035
July 09, 2007 08:40PM
3086
July 10, 2007 02:28AM
3072
July 10, 2007 10:42AM
3007
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.