[Gambas-devel] gb.odbc probably won't work correctly

Andrea Bortolan andrea_bortolan at ...112...
Thu Oct 27 09:26:43 CEST 2005

Sorry for the late answer, I had some problems on my Linux box... and after the problem were fixed I was very busy for my job.

danielcampos at ...45... ha scritto: 

(Gambas-1.9.20 / gb.db / gb.db.odbc / Informix)


I've been testing gb.db.odbc with Informix, and it does not work. The problem is that gb.db tries to get the row count of a "SELECT" query, and that value is not reported by the major part of ODBC drivers (well, MySQL does, but it has not very much sense having a native driver). For example you can look at the IB M documentation about ODBC:



This is related only to the DB2 UDB for zSeries.....there are many DB2 UDB (for zSeries, iSeries, pSeries, for Windows and Linux Intel and PowerPC....) that have some little differences, the ODBC driver for iSeries i.e. supports FetcScroll, I don't know all the others DB2

...or the Perl-ODBC documentation (I have not the link now,sorry)

The major part of ODBC drivers report the row count only for INSERT, UPDATE or DELETE queries, and return -1 for SELECT queries, when using the SQLRowCount() method.

I've made a hack for me, that repeats twice the query, the first one to count the number or rows, and the second one to fill the data. It works OK, but I remember an old mail from Benoit saying that this is "horrible", however is the only thing I can do from the driver currently. It seems there's a commented code in the gb.db part about this, however it is disabled...


After  you've submitted the query, if the number of rows is -1 you can fetch the rows until the gb.odbc module rise an error, if you catch it it's done. 


The second porblem is that "FetchScroll()" method does not work for Informix, and it seems it will not work for DB2, according to IBM documentation, that says nothing about that method, so, in my hack, I've replaced it by "Fetch()"...

I'm working on a work-around in order to check if the driver supports the FetchScroll or not, if the driver doesn't support fetchscroll fetch will be called instead. ASAP it will be ready I'll ask you to try it because I haven't Informix DB.

Once I stabilize my hacks trying to make it work correctly, I will release it as an "odbc2" or something like that unnoficial driver, as I need these features for Informix, and may be It will help other developers. 

However, I think something more clean should be done with that, may be a complete component for ODBC with a different interface, or modify the current gb.db component so it can handle drivers having not row counting and a forward-only cursor (I think MoveFirst, MovePrevious, etc won't work correctly with the current interface). It is important to support DB2 and Informix!


Daniel Campos

NetCourrier, votre bureau virtuel sur Internet : Mail, Agenda, Clubs, Toolbar...
Web/Wap : www.netcourrier.com
Téléphone/Fax : 08 92 69 00 21 (0,34 € TTC/min)
Minitel: 3615 NETCOURRIER (0,16 € TTC/min)

This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
Gambas-devel mailing list
Gambas-devel at lists.sourceforge.net




Yahoo! Messenger: chiamate gratuite in tutto il mondo 
Yahoo! Messenger: chiamate gratuite in tutto il mondo 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20051027/3f0169f1/attachment.html>

More information about the Devel mailing list