[Gambas-user] Wrong variable type returning from PostgreSQL resultset

Gianluigi bagonergi at gmail.com
Sun Mar 13 13:46:12 CET 2022


Il giorno dom 13 mar 2022 alle ore 13:34 Constantin Teodorescu <
brailateo at gmail.com> ha scritto:

> My program worked perfectly on Gambas 3.14.3 version on Ubuntu Linux 20.04
> 64 bit
>
> I have copied the program on a Linux Mint 20.2 with Gambas 3.17.0
> installed and got an error running it.
> When debugging it I discovered that value returned by a resultset on an id
> (serial) column is no longer integer but STRING! :-o
>
> rst2 = Connections["PgDB"].Exec("SELECT * FROM companies")
> . . .
> If rst2["id"] <= someInteger Then  <= Error here
> ...
>
> The error is: "Type mismatch: wanted integer, got String instead
>
> I managed to cheat it with
> If Val(rst2["id"]) <= someInteger Then
>
> but it should be properly fixed in the next Gambas version!
>
> Best regards,
> Constantin Teodorescu
>

Hi,

You get the same error even if you write If rst2!id <= someInteger Then...
or rst2[id]... or If rst2["id"] <= cstr(someInteger) Then... ?

Regards
Gianluigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220313/0fe9e5ef/attachment.htm>


More information about the User mailing list