Subject | Boolean Domain and correct value handling |
---|---|
Author | Maik Wojcieszak |
Post date | 2012-09-07T08:59:02Z |
Hi,
I've defined a domain in my database
CREATE DOMAIN BOOLEAN_DM AS
SMALLINT
DEFAULT 0
NOT NULL
CHECK (
VALUE IN (1,0)
);
now I want to configure IB_Database to handle the values correctly and tried to set
FieldEntryTypes = [fetDomainName]
ColumnAttributes = 'BOOLEAN_DM=BOOLEAN=1,0;'
I was expecting that my boolean values will be handled as 1=true and 0=false.
Doing this
cur.SQL.Add('insert into BOOLTEST_TB (DATA) values (:data)');
cur.ParamByName('data').AsBoolean := True;
cur.Execute;
created correct datasets with 1=true. After removing the ColumnAttributes it still worked this way.
Doing this
cur.SQL.Add('insert into BOOLTEST_TB (DATA) values (:data)');
cur.ParamByName('data').AsVariant := True;
cur.Execute;
resulted in an error that a check failed on a value -1
Again the setting of the columnattributes did not change this behavior.
As far as it seems the AsVariant works differently from AsBoolean and the columnAttributes in my example
do not have an effect here.
How can I use AsVariant with boolean values correctly to get/set boolean variants for fields/parameters ?
Thanks in advance,
Maik
[Non-text portions of this message have been removed]
I've defined a domain in my database
CREATE DOMAIN BOOLEAN_DM AS
SMALLINT
DEFAULT 0
NOT NULL
CHECK (
VALUE IN (1,0)
);
now I want to configure IB_Database to handle the values correctly and tried to set
FieldEntryTypes = [fetDomainName]
ColumnAttributes = 'BOOLEAN_DM=BOOLEAN=1,0;'
I was expecting that my boolean values will be handled as 1=true and 0=false.
Doing this
cur.SQL.Add('insert into BOOLTEST_TB (DATA) values (:data)');
cur.ParamByName('data').AsBoolean := True;
cur.Execute;
created correct datasets with 1=true. After removing the ColumnAttributes it still worked this way.
Doing this
cur.SQL.Add('insert into BOOLTEST_TB (DATA) values (:data)');
cur.ParamByName('data').AsVariant := True;
cur.Execute;
resulted in an error that a check failed on a value -1
Again the setting of the columnattributes did not change this behavior.
As far as it seems the AsVariant works differently from AsBoolean and the columnAttributes in my example
do not have an effect here.
How can I use AsVariant with boolean values correctly to get/set boolean variants for fields/parameters ?
Thanks in advance,
Maik
[Non-text portions of this message have been removed]