[Gambas-user] [Gambas Bug Tracker] Bug #1113: ODBC driver problem: driver connects but does not exec query

bugtracker at ...3416... bugtracker at ...3416...
Sun Jun 18 06:04:02 CEST 2017


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

Comment #9 by zxMarce:

Piccoro,

As I already told you more than once, ODBC will return the row count thanks to the patch I already made given a couple of conditions that depend on the low-level driver being correctly configured.

The conditions are:
A- The driver supports ODBC's SQLFetchScroll() call (this is not a driver config, but a driver feature), and
B- The driver is configured in such a way that it supports the SQL_ATTR_CURSOR_SCROLLABLE flag.

My patch uses condition B to use three times the call in point A in this way:
1- Remember the current row for later getting back to it.
2- Seek up to the first row in the rowset (using SQLFetchScroll)
3- Get the first row's index (firstRecNo)
4- Seek down to the last row in the rowset (using SQLFetchScroll)
5- Get the last row's index (lastRecNo)
6- Seek back to wherever we were at in step 1 (using SQLFetchScroll)
7- Return (lastRecNo - firstRecNo + 1), AKA "Record Count".

For some combinations of driver protocol and MSSQL versions (speaking FreeTDS against MSSQL here), I found out that condition B was not met, so I could not get a record count.
But for some other -documented- protocol and server combinations the call succeeded. The same happens with Firebird, for example.
I never tested it with SQLite3 yet. But I explained this point to you several times now. Will not do it again, and this contaminates this particular bug report.
zxMare.






More information about the User mailing list