<div dir="ltr">Scope - row only exists inside the function since it's a function argument</div><div class="gmail_extra"><br><br><div class="gmail_quote">On 12 August 2014 08:58, Shabbir abbasi <span dir="ltr"><<a href="mailto:shabbirabbasi92@gmail.com" target="_blank">shabbirabbasi92@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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>
<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div>