[Freeswitch-users] Lua freeswitch.Dbh() question

Steven Ayre steveayre at gmail.com
Thu Nov 17 20:00:12 MSK 2016


Currently the answer is no.

It is possible with a patch though. If you look at
src/mod/languages/mod_lua/freeswitch_lua.cpp you'll see it
calls switch_cache_db_execute_sql_callback/switch_cache_db_execute_sql with
NULL as the err parameter. If it was given that would return NULL (no
error) or a the error string, the same one you see logged. That could be
copied to the object and exposed with a last_error() function.

Steve




On 15 November 2016 at 16:54, Abaci B <abaci64 at gmail.com> wrote:

> Basically what I want is the text of the error returned from the database,
> something like how it's handled in LuaSQL http://keplerproject.github.
> io/luasql/manual.html#errors pcall is for lua errors in this case there
> is no lua error.
>
> On Tue, Nov 15, 2016 at 2:10 AM, Artur Mega <findmeinwland at gmail.com>
> wrote:
>
>> Do you need to get text of an error? And to catch it in lua code? Why not
>> just to check returned value? I dont remember, but returned value can be
>> nul or item with type `userdata`. If you still want text of an error, i
>> think you can try to catch it with pcall https://www.lua.org/pil/8.4.html
>>
>> 2016-11-14 23:11 GMT+05:00 Abaci B <abaci64 at gmail.com>:
>>
>>> when runned a query using freeswitch.Dbh dbh:query, if there is results
>>> it a function for each returned row where you can see the data. however, if
>>> there is an error you can see the database returned error in the console on
>>> level ERR but you don't get it back in lua
>>> is someone aware of a way to get the rror back into lua?
>>>
>>> ____________________________________________________________
>>> _____________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://confluence.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://confluence.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://confluence.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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20161117/a76a53c5/attachment-0001.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list