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:
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)
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)
proxy.queries:append(1, string.char(proxy.COM_QUERY) .. "SHOW TABLES FROM " .. option )but that works with LOAD DATA INFILE
| Subject | Views | Written By | Posted |
|---|---|---|---|
| proxy.COM_QUERY Load data infile | 3733 | Diego Medina | 09/14/2007 10:13PM |
| Re: proxy.COM_QUERY Load data infile | 2046 | Jan Kneschke | 09/15/2007 02:58AM |
| Re: proxy.COM_QUERY Load data infile | 2550 | Diego Medina | 09/15/2007 09:38AM |
| Re: proxy.COM_QUERY Load data infile | 2086 | Jan Kneschke | 09/17/2007 01:05AM |
| Re: proxy.COM_QUERY Load data infile | 2013 | Diego Medina | 09/16/2007 10:14PM |
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.