[Asterisk-code-review] res odbc: fix missing SQL error diagnostic (asterisk[13])

Alexei Gradinari asteriskteam at digium.com
Fri Sep 21 09:52:17 CDT 2018


Alexei Gradinari has posted comments on this change. ( https://gerrit.asterisk.org/10226 )

Change subject: res_odbc: fix missing SQL error diagnostic
......................................................................


Patch Set 2:

> Does following MS's example code not work correctly?
 > 
 > https://docs.microsoft.com/en-us/sql/odbc/reference/develop-app/using-sqlgetdiagrec-and-sqlgetdiagfield

Calling
SQLGetDiagField(handle_type, handle, 0, SQL_DIAG_NUMBER, &numfields, SQL_IS_INTEGER, &diagbytes);
instead of
SQLGetDiagField(handle_type, handle, 1, SQL_DIAG_NUMBER, &numfields, SQL_IS_INTEGER, &diagbytes);
works in my case.

But according
https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlgetdiagfield-function
====
RecNumber
[Input] Indicates the status record from which the application seeks information. Status records are numbered from 1. If the DiagIdentifier argument indicates any field of the diagnostics header, RecNumber is ignored. If not, it should be more than 0.
====

I doubt if RecNumber=0 will work in other cases (another ODBC driver, another database, etc).

So I think better to get rid of calling ambiguous SQLGetDiagField,
especially since the call of SQLGetDiagField is excess in the case when there is a error diagnostic record.


-- 
To view, visit https://gerrit.asterisk.org/10226
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: comment
Gerrit-Change-Id: Iba5ae5470ac49ecd911dd084effbe9efac68ccc1
Gerrit-Change-Number: 10226
Gerrit-PatchSet: 2
Gerrit-Owner: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-Comment-Date: Fri, 21 Sep 2018 14:52:17 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: No
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180921/a5168f19/attachment.html>


More information about the asterisk-code-review mailing list