[Gambas-devel] Change to gb.db.odbc to use ODBC Connection Strings.
Benoît Minisini
gambas at ...1...
Thu Sep 24 02:23:26 CEST 2015
Is it better with revision #7334?
Le 21/09/2015 15:08, zxMarce a écrit :
> Benoît,
>
> First off, with ODBC all .MoveXXX methods fail with "Result is forward only"
> as expected, except .MoveFirst() and .MoveNext(). That is OK.
>
> Second, I got the low level driver to return -1 as record count by
> specifying different "TDS_Version" values in the connection string. For
> example, "TDS_Version=7.2" returns zero, other versions return the expected
> -1 (4.2, 7, 7.1, 7.3, etc). This is also OK, because it is
> user-controllable.
>
> But now that I have tested your mods, I must report the bad news: Both
> .MoveNext and .Available properties always return FALSE, so there is no way
> to cleanly exit a data retrieval loop.
>
> I think the problem is in CResult.c at around line 145. That particular line
> calls the driver's query_fill function but disregards the return value, so
> the DB_ERROR, DB_OK and DB_NO_DATA return values are ignored.
>
> If it helps, I cooked this mod in CResult.c, which made it work as expected
> with ODBC, adjusting the return values of .MoveNext and .Available:
>
> //Next original line does not store the FILL call result,
> //therefore any call will be assumed OK even when the
> //ODBC driver says it failed.
> /*THIS->driver->Result.Fill(&THIS->conn->db,
> THIS->handle,
> pos,
> THIS->buffer,
> (pos > 0) && (pos ==
> (DELETE_MAP_virtual_to_real(THIS->dmap, THIS->pos) + 1))
> );*/
>
> //This next replacement line stores the FILL call result
> //in fillFailed so it can be checked later.
> int fillFailed = THIS->driver->Result.Fill(&THIS->conn->db,
> THIS->handle,
> pos,
> THIS->buffer,
> (pos > 0) && (pos ==
> (DELETE_MAP_virtual_to_real(THIS->dmap, THIS->pos) + 1))
> );
>
> //Next, check whether the FILL above succeeded or failed and
> //return proper states in Result.MoveNext and Result.Available.
> if (fillFailed)
> {
> THIS->available = FALSE;
> return TRUE;
> }
>
> Finally, if I misinterpreted your intentions (yet again), please disregard
> my suggestions.
>
> Regards,
> zxMarce.
>
--
Benoît Minisini
More information about the Devel
mailing list