<div dir="ltr"><div><div>i am testing a script new_chat.lua script is below<br></div><br>#!/usr/bin/lua<br>local dbh = freeswitch.Dbh("odbc://dbname:db_username:db_passwd") -- connect to ODBC database <br>
assert(dbh:connected()) -- exits the script if we didn't connect properly<br><br>if dbh:connected() == false then<br> freeswitch.consoleLog("ALERT", "lua cannot connect to database" .. dsn .. "\n");<br>
end<br><br>sql_query = "SELECT * FROM cc_card WHERE id ='197'"<br>dbh:query(sql_query ,function(row)<br>for key, val in pairs(row) do <br>key = val<br>end<br> freeswitch.consoleLog("INFO"," inside QUERY lastname = " .. row.lastname .. "\n");<br>
freeswitch.consoleLog("INFO"," inside QUERY redial = " .. row.redial .. "\n");<br>end)<br><br>freeswitch.consoleLog("INFO"," outside QUERY lastname = " .. row.lastname .. "\n");<br>
freeswitch.consoleLog("INFO"," outside QUERY redial = " .. row.redial .. "\n");<br><br>freeswitch.consoleLog("INFO"," outside QUERY lastname = " .. lastname .. "\n");<br>
freeswitch.consoleLog("INFO"," outside QUERY redial = " .. redial .. "\n");<br><br>dbh:release() -- optional<br><br></div>but here is some problum in this script inside query lines are working but outside query lines are not working WHY ?? <br>
any suggestions are very wellcome<br></div>