[Gambas-user] [Gambas Bug Tracker] Bug #1013: gb.db.odbc new GetRecordCount mechanism seem not work with firebird database

bugtracker at ...3416... bugtracker at ...3416...
Fri Oct 28 12:14:30 CEST 2016


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

Comment #8 by zxMarce:

Christian,

Sorry for the time it takes for me to answer.

Well, the example code is correct (and I have seen it before), but if you follow the SQLRowCount() link in the explanatory text you get to the call's documentation, which says:

  SQLRowCount
  	returns the number of rows affected by INSERT, UPDATE or DELETE. Many drivers (but not all) return the number of rows returned by the last executed SELECT statement too.

The important bit here is "Many drivers (but not all)". That alone makes an important part of Gambas fail with "some" database engines, and the worst part is that there's no way to know whether the called driver supports or not returning row counts for SELECT statements.

What's worse, if you think of it, the call should actually always fail for SELECT statements, because on a multithreaded multiuser RDBMS, there's always the chance that another thread/user adds or deletes records while your SELECT runs, making the call lie to you!

Let me find out what to do by installing a FB DB and its ODBC driver as I said earlier. I guess I'll use some sort of IF statement. When I get a SQLRowCount() of -1 (the default value for MSSQL if memory serves), I'll make the component call my alternate routine; otherwise, I'll keep what SQLRowCount() returns. But before implementing, I must test.

To mimic your setup as much as possible, please tell me what version of FB Server to get (I'm using Ubuntu 16.04 Desktop, and when I tried to install it I found there are a lot of FB flavors) and where should I get the same ODBC driver you're using if at all possible.

Sounds like we have a plan?






More information about the User mailing list