[Gambas-user] Problem with boolean values in a class file

richard terry rterry at ...1822...
Mon Feb 4 22:27:48 CET 2008


On Tue, 5 Feb 2008 02:40:25 am Benoit Minisini wrote:
> On lundi 4 février 2008, Leonardo Miliani wrote:
> > I think that the TRUE and FALSE constants in Gambas aren't "true"
> > boolean values.
> > Try to convert them in real bool values with *CBool* before to store
> >
> > them in your DB, i.e.:
> > > currentAddress preferred_address = *CBool*(chkpreferredAddress.value)
> > > currentAddress postal_address = *CBool*(chkPostalAddress.value)
> > > currentAddress .HeadOffice = FALSE  (which I want to be false here)
>
> TRUE and FALSE are "true" boolean values, what else could they be? But the
> CheckBox.Value property is an integer, not a boolean.
>
> Regards,

Changed the code as suggested:

The resultant query once passed to postgres becomes:

INSERT INTO contacts.data_addresses (street, fk_town, fk_type, 
postal_address,country_code)
 VALUES ('1 street', 780, 1, T, 'AU') ;

and postgres objects with:

ERROR:  column "t" does not exist
LINE 2:  VALUES ('1 street', 780, 1, T, 'AU') ;

If I manually in PGADMIN  paste the query as I have above from the console, 
and change the T to a TRUE:

INSERT INTO contacts.data_addresses (street, fk_town, fk_type, 
postal_address,country_code)
 VALUES ('1 street', 780, 1, TRUE, 'AU') ;

Then the query executes ok. Similarly  the FALSE ends up in the query as 
nothing , ,

Any more ideas

Richard




More information about the User mailing list