]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_odbc: fix missing SQL error diagnostic
authorAlexei Gradinari <alex2grad@gmail.com>
Thu, 20 Sep 2018 18:59:54 +0000 (14:59 -0400)
committerAlexei Gradinari <alex2grad@gmail.com>
Wed, 26 Sep 2018 14:24:53 +0000 (09:24 -0500)
commite04c49b51771e11c0c9c36c4f2bc789cb6e76a7e
treedad81ededfe47c226c5fe5b2a66906712d6d9e89
parenta6c3984175566cb91590b6288be5cdb1dd3d44a2
res_odbc: fix missing SQL error diagnostic

On SQL error there is not diagnostic information about this error.
There is only
WARNING res_odbc.c: SQL Execute error -1!

The function ast_odbc_print_errors calls a SQLGetDiagField to get the number
of available diagnostic records, but the SQLGetDiagField returns 0.
However SQLGetDiagRec could return one diagnostic records in this case.

Looking at many example of getting diagnostics error information
I found out that the best way it's to use only SQLGetDiagRec
while it returns SQL_SUCCESS.

Also this patch adds calls of ast_odbc_print_errors on SQL_ERROR
to res_config_odbc.

ASTERISK-28065 #close

Change-Id: Iba5ae5470ac49ecd911dd084effbe9efac68ccc1
res/res_config_odbc.c
res/res_odbc.c