Hi Guys I want to access Mysql 5 from lua. The wiki is not too clear on this. Do I need to install lua and lua mysql? Regards
Nik, I see your point about the wiki entry regarding luasql. If someone could clarify then I will be happy to help get the wiki documentation updated appropriately. -MC Sent from my iPhone On Feb 8, 2009, at 2:41 PM, "Nik Middleton" <nik.middleton@noblesolutions.co.uk
wrote:
Hi Guys
I want to access Mysql 5 from lua. The wiki is not too clear on this. Do I need to install lua and lua mysql?
Regards
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Hi. Well you need to install luasql, and work only with lua 5.0 or major. You need a ODBC connection to MySQL. And there is an lua script example: ============================================================ #!/usr/local/bin/lua require "luasql.mysql" env = assert (luasql.mysql()) con = assert (env:connect("DB","user","password","localhost)) cur = assert (con:execute"SELECT id, name FROM test") row = cur:fetch ({}, "a") while row do print(string.format("Id: %s, Name: %s", row.id, row.name)) -- reusing the table of results row = cur:fetch (row, "a") end cur:close() con:close() env:close() ========================================================== regards javar
participants (3)
-
Javier Aristizábal
-
Michael S Collins
-
Nik Middleton