Skip to content
Snippets Groups Projects
  • Alexei Gradinari's avatar
    e6a69ea2
    res_odbc: fix missing SQL error diagnostic · e6a69ea2
    Alexei Gradinari authored
    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
    e6a69ea2
    History
    res_odbc: fix missing SQL error diagnostic
    Alexei Gradinari authored
    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