MySQL Forums
Forum List  »  Router & Proxy

using external mysql connections in lua for mysql-proxy
Posted by: Pavel Dobryakov
Date: August 04, 2011 08:06AM

I tried do somethink like this:
test.lua


require "mysql"
function read_query( packet )
if packet:byte() == proxy.COM_QUERY then
local env = assert(mysql())
local con, err = env:connect("t1", "pavel", "123", "localhost")
local query = string.sub(packet, 2)
local result = con:execute("insert into hst values("..query..")")
result:colse()
con:close()
env:close()
end
return proxy.PROXY_IGNORE_RESULT
end


and get this error
2011-08-04 18:02:24: (critical) (lua-error) [/usr/share/mysql-proxy/test.lua]
error loading module 'mysql' from file '/usr/lib/mysql-proxy/lua/mysql.so':
/usr/lib/mysql-proxy/lua/mysql.so: undefined symbol: luaopen_mysql
2011-08-04 18:02:24: (debug) last message repeated 1 times
2011-08-04 18:02:24: (debug) abs wait-for-event::done usec= 0
2011-08-04 18:02:24: (debug) abs lua-exec::done usec= 0

Options: ReplyQuote


Subject
Views
Written By
Posted
using external mysql connections in lua for mysql-proxy
3123
August 04, 2011 08:06AM


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.