[Gambas-devel] Probable bug in Postgres db driver
Benoît Minisini
gambas at ...1...
Sun Mar 1 16:15:45 CET 2009
> I found the core problem was the driver misreports the size of the blob so
> about 10-20 bytes get truncated from the end.
> This patch fixes it:
>
> Index: main/lib/db/main.c
> ===================================================================
> --- main/lib/db/main.c (revision 1885)
> +++ main/lib/db/main.c (working copy)
> @@ -427,7 +427,7 @@
>
> int q_length(void)
> {
> - return GB.StringLength(_query);
> + return GB.StringLength(_query)+_temp_len;
> }
>
> void DB_SetDebug(int debug)
Thaaaanks!
The q_length() function is used at CConnection.c:511:
query = make_query(THIS, q_get(), q_length(), GB.NParam(), arg);
The q_get() function correctly dumps the temporary buffer into the _query
variable. So *if* the compiler compiles the q_get() call before the q_length()
call, everything works as expected. On the contrary, the query is truncated.
And apparently it is what happened.
Richard, please tell us if it fixes your problems with the postgresql driver!
Regards,
--
Benoît
More information about the Devel
mailing list