VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
nik.middleton at noble... Guest
|
Posted: Sun Feb 08, 2009 5:44 pm Post subject: [Freeswitch-users] connecting to mysql using lua |
|
|
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 |
|
Back to top |
|
|
msc at freeswitch.org Guest
|
Posted: Sun Feb 08, 2009 6:28 pm Post subject: [Freeswitch-users] connecting to mysql using lua |
|
|
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 (nik.middleton@noblesolutions.co.uk)> wrote:
|
|
Back to top |
|
|
javieraristizabal at g... Guest
|
Posted: Mon Feb 09, 2009 10:06 am Post subject: [Freeswitch-users] connecting to mysql using lua |
|
|
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 |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|