]> 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:31 +0000 (09:24 -0500)
commitd03661bcafc3f92ef7f4b7120bb12d56132eac7c
tree51fac52a01bbc967c36a17ce0d53d38459b356f4
parentff8f46bf75ae2baa9a6384a4af89b4a105a50833
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