[Gambas-user] [Gambas Bug Tracker] Bug #1101: ODBC driver super buggy 2: rs.max return always negative and always -2 event in lasted

bugtracker at ...3416... bugtracker at ...3416...
Wed May 3 00:08:20 CEST 2017


http://gambaswiki.org/bugtracker/edit?object=BUG.1101&from=L21haW4-

Comment #1 by zxMarce:

Actually, per practically any available documentation you can check, ODBC doesn't return a row count for SELECT statements.
I'll refer you to MSDN, for example (https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlrowcount-function), but you can also check IBM's docs, which say the exact same:

Quote:
  SQLRowCount Function

  Conformance
  Version Introduced: ODBC 1.0 Standards Compliance: ISO 92

  Summary
  SQLRowCount returns the number of rows affected by an UPDATE, INSERT, or DELETE statement;
  an SQL_ADD, SQL_UPDATE_BY_BOOKMARK, or SQL_DELETE_BY_BOOKMARK operation in SQLBulkOperations; 
  or an SQL_UPDATE or SQL_DELETE operation in SQLSetPos

So, unless some not-so-easy mechanism is implemented, no ODBC interface will return you a row count for SELECTs.
The problem implementing the mechanism is that not all queries return a Result, for example the USE <database> command in MSSQL.

A high level ODBC interface would have a ton of things to take into account just to check whether a row count is returnable, necessary or even factible.
Add to that difficulty the fact that ODBC is actually not a driver per-se, but a driver manager and the problem only gets worse, because not all drivers implement all calls.

The -2 returned is, IIRC, actually an internal flag (this could need correction) to signal some low-level Gambas interfaces how to act when using ODBC.

Regards,
zxMarce.






More information about the User mailing list