MySQL Forums
Forum List  »  Router & Proxy

Strange error messages with example script code
Posted by: Cameron Guill
Date: January 04, 2008 08:07AM

I wsa trying to work with the read_query_results function and was getting some strange errors so I went to the documentation and copied the example and pasted it into the script I was using.

I even restarted the mysql-proxy.

Is this something I am doing wrong, a bug, or what? Any ideas would be helpful.


[root@localhost share]# ../sbin/mysql-proxy --version
mysql-proxy 0.6.0

[root@localhost share]# ps -ef | grep mysql-proxy
root 2902 8569 0 01:13 pts/0 00:00:00 ../sbin/mysql-proxy --proxy-lua-script=logging.lua



[root@localhost share]# mysql -u root -pPASSWORD -h 127.0.0.1 -P 4040 -e "select count(user) from mysql.user"
(read_query_result) logging.lua:54: attempt to concatenate field '?' (a nil value)
query-time: 1.983ms
response-time: 1.993ms
network-mysqld-proxy.c.2049: got asked to send a resultset, but ignoring it as we already have sent 1 resultset(s). injection-id: 1
(read_query_result) logging.lua:54: attempt to concatenate field '?' (a nil value)
network-mysqld-proxy.c.2049: got asked to send a resultset, but ignoring it as we already have sent 2 resultset(s). injection-id: 2
(read_query_result) logging.lua:54: attempt to concatenate field '?' (a nil value)
query-time: 2.996ms
response-time: 3.003ms
network-mysqld-proxy.c.2049: got asked to send a resultset, but ignoring it as we already have sent 1 resultset(s). injection-id: 1
(read_query_result) logging.lua:54: attempt to concatenate field '?' (a nil value)
network-mysqld-proxy.c.2049: got asked to send a resultset, but ignoring it as we already have sent 2 resultset(s). injection-id: 2
+---------------------+
| NOW() |
+---------------------+
| 2007-11-16 09:12:53 |
+---------------------+



The lua script
--[[
SOME COMMENTED OUT CODE HERE
--]]

function read_query( packet )
if packet:byte() == proxy.COM_QUERY then
proxy.queries:append(2, string.char(proxy.COM_QUERY) .. "SELECT NOW()" )
proxy.queries:append(1, packet )
proxy.queries:append(2, string.char(proxy.COM_QUERY) .. "SELECT NOW()" )

return proxy.PROXY_SEND_QUERY
end
end


function read_query_result(inj)
if inj.id == 2 then
for row in inj.resultset.rows do
print("injected query returned: " .. row[0])
end
return proxy.PROXY_IGNORE_RESULT
else
print("query-time: " .. (inj.query_time / 1000) .. "ms")
print("response-time: " .. (inj.response_time / 1000) .. "ms")
end
end



Thanks
- Cameron

Options: ReplyQuote


Subject
Views
Written By
Posted
Strange error messages with example script code
4628
January 04, 2008 08:07AM


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.