[Freeswitch-users] How to get and store values from mysql database to Lua script

virendra bhati virbhati at gmail.com
Sun Mar 11 13:22:10 MSK 2012


Hi List,

Below is my code by which I have connected Lua and mysql DB and displayed
into FreeSwitch CLI.

local dbh = freeswitch.Dbh("Billing","Billing","Tzru9unbcfuW6PV")
if assert(dbh:connected()) == true then
freeswitch.consoleLog("info", "connected");
assert(dbh:query("SELECT id, profile_name FROM sofia_conf", function(row)
for key, val in pairs(row) do
            row[key] = val
-- freeswitch.consoleLog("info", " row.id");
-- freeswitch.consoleLog("info", " profile_name");
freeswitch.consoleLog("info", "row[key]");
-- freeswitch.consoleLog("info", " profile_name");
        end
        end))
  -- stream:write(string.format("%5s : %s\n", row.id, row.profile_name))
-- end)
else
freeswitch.consoleLog("info", "not connected");
end

How to get and store values from mysql database to Lua variables ?

-- 

Thanks and regards

 Virendra Bhati
+91-8885268942
Software Engineer
E-mail-: virbhati at gmail.com
Skype id:- virbhati2
Hyderabad(India)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120311/e48b233e/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list