[Freeswitch-users] Calling db in lua script

François Delawarde fdelawarde at wirelessmundi.com
Tue Feb 12 18:45:58 MSK 2013


Try that:

sql=" {call procedure_name()}"
dbh:query(sql, mycallback)

(don't forget to define your callback function, mycallback in this case)

Regards,
François.


On Tue, 2013-02-12 at 14:35 +0000, Archana Venugopan wrote: 
> Dbh:query works. But I want execute a Stored procedure. In that case what can I use? Please suggest.
> Many thanks.
> 
> Regards,
> Archana
> 
> 
> -----Original Message-----
> From: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of François Delawarde
> Sent: 12 February 2013 14:31
> To: FreeSWITCH Users Help
> Subject: Re: [Freeswitch-users] Calling db in lua script
> 
> Maybe because dbh has no 'execute' method?
> 
> Try with:
> dbh:query(sql)
> 
> Regards,
> François.
> 
> On Tue, 2013-02-12 at 14:15 +0000, Archana Venugopan wrote: 
> > Hi,
> > 
> >  
> > 
> > I tried executing a simple DB query in lua script in freeswitch. 
> > 
> >  
> > 
> > dbh:execute{"Select * from dir_users"}
> > 
> >  
> > 
> > But I got this error
> > 
> > 2013-02-12 14:09:56.247165 [ERR]
> > mod_lua.cpp:198 /usr/local/freeswitch/scripts/directory.lua:184:
> > attempt to call method 'execute' (a nil value)
> > 
> > stack traceback:
> > 
> >         /usr/local/freeswitch/scripts/directory.lua:184: in main chunk
> > 
> > 2013-02-12 14:09:56.247165 [ERR] mod_lua.cpp:264 LUA script
> > parse/execute error!
> > 
> >  
> > 
> > Can anyone please point what is the mistake I have done and why
> > execute method is not being recognised? Thanks.
> > 
> >  
> > 
> > Regards,
> > 
> > Archana
> > 
> >  
> > 
> > 
> > _________________________________________________________________________
> > Professional FreeSWITCH Consulting Services:
> > consulting at freeswitch.org
> > http://www.freeswitchsolutions.com
> > 
> > 
> > 
> > 
> > Official FreeSWITCH Sites
> > http://www.freeswitch.org
> > http://wiki.freeswitch.org
> > http://www.cluecon.com
> > 
> > FreeSWITCH-users mailing list
> > FreeSWITCH-users at lists.freeswitch.org
> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> > http://www.freeswitch.org
> 
> 
> 
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
> 
> 
> 
> 
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
> 
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
> 
> 
> 
> 
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
> 
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org





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