Hi,
Thanks for your answer, however, I was able to "intercept it" using the lua-layer.
This is my lua file (just modified from one of the examples
function read_query( packet )
--This will be TRUE when I send a LOAD DATA INFILE (not local infile)
--In my setup, I have a server 10.20.0.3 and then a client 10.20.0.10,
-- The file I am uploading is in the client 10.20.0.10 (in this way I can for sure have the lua-layer see the "data from the file being inserted into MySQL server
if string.byte(packet) == 34 then
local query = string.sub(packet, 2)
--print("This is the data you sent: " .. packet )
local f_s, f_e, command = string.find(packet, "^%s*(%w+)", 2)
local option
print("This is the content of the file from LOAd DATA INFILE: " .. packet)
-- This part is where I am stuck
-- How do I format the packet to go to the server
-- proxy.queries:append(1,string.char(proxy.COM_QUERY) .. models)
-- return proxy.PROXY_SEND_QUERY
end
end
what I do to verify that lua sees the data is:
1- On the MySQL server (same as the mysql-proxy server) I run
shell>/usr/local/mysql-proxy-0.6.0-linux-fc4-x86/sbin/mysql-proxy --proxy-lua-script=/home/lua/test.lua
(Note that I do not add an & at the end so that that shell screen will show me information from the lua-layer)
Than from the client (a different computer than the server, which also has the file I am sending using LOAD DATA INFILE) I login using
shell>/usr/local/mysql/bin/mysql --local-infile --host=10.20.0.3 --port=4040 --user=root --password test
mysql>load data local infile '/home/wizard/hp.csv' into table test fields terminated by ',' optionally enclosed by '"' lines terminated by "\r\n"(part_number,str)
I need something like
proxy.queries:append(1, string.char(proxy.COM_QUERY) .. "SHOW TABLES FROM " .. option )
but that works with LOAD DATA INFILE
If you need the database sample and the csv file I am using, just let me know.
Thanks you!
Diego Medina
Web Developer
http://www.fmpwizard.com
P.S. Please read
this post if you are going to post code