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
4830
July 09, 2007 12:18PM
2938
July 09, 2007 01:07PM
2954
July 09, 2007 01:42PM
3075
July 09, 2007 01:53PM
3065
July 09, 2007 01:58PM
Re: Filtering - Injection - Redirection
3098
July 09, 2007 04:34PM
2973
July 09, 2007 08:40PM
3032
July 10, 2007 02:28AM
3006
July 10, 2007 10:42AM
2953
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.