[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...
Thu Nov 10 12:24:48 CET 2016


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

Comment #10 by zxMarce:

Christian,

Finally! I installed FB2.5, the ODBC driver, and even got a simple test DB with an eight record table, hand populated with ye olde ZX-Spectrum colors (fields ColorName and ColorValue).
Also connected to it successfully with a Connection String instead of an INI-based DSN. Sweet!

I think I may have a little insight regarding this issue, not having done yet any code changes.
The problem *seems* to be that the rec count routine does its work, but for some reason FB driver returns a zero-based record count.
When I run "SELECT * FROM Colors", I get back 7 records instead of 8. When I run "SELECT COUNT (*) FROM Colors" or "SELECT AVG (ColorValue) FROM Colors" instead, I get -as you do- 0 records back.
All of these statements work correctly on FlameRobin, of course!

Benoît further patched gb.db so when it gets back a record count of -1 the component simply keeps getting records until there are no more; that is why it works with SQLRowCount() which, as you know, returns -1.
When gb.db gets anything besides -1, it will loop fetching as many records as told. In the case of FB, it fails to retrieve correctly because the low-level driver returns a zero-based count via unixODBC.

Paraphrasing Matt Damon in "The Martian": I will have to science the f*ck out of it. Will start burning some neurones.

zxMarce changed the state of the bug to: Working.






More information about the User mailing list