Subject | RE: [IBO] Converting BDE to IBO |
---|---|
Author | Enrico Raviglione |
Post date | 2005-11-04T19:01:48Z |
Hi,
sorry but i don't understand what road do you have chosen.
In your TIBOTable, your BOOLEAN fields are coded as TBooleanFields or
TStringFields ?
When i ported all my applications from BDE/Paradox to FireBird, i have
keep all my BOOLEAN fields as TBooleanFields in my TIBOTable or
TIBOQuery, without any problem using it in CheckBox or testing it in my
code.
Here what i do:
Into my database i create a DOMAIN:
CREATE DOMAIN D_BOOLEAN AS
CHAR(1)
DEFAULT 'F'
CHECK (value in ('F', 'T'))
All BOOLEAN fields in my database tables are declare as TYPE =
D_BOOLEAN, i add also one Trigger for any table where i set to 'F' the
value of D_BOOLEAN fields who are passed as NULL, see my example:
CREATE TABLE UTENTI (
KEYUTENTE D_KEYDB NOT NULL,
... some fields ...
PERSGIU D_BOOLEAN,
... some fields ...
ADDED D_DATE,
EDITED D_DATE,
DBUSER D_USER
);
CREATE TRIGGER UTENTI_BOOL_TRIGGER FOR UTENTI
ACTIVE BEFORE INSERT OR UPDATE POSITION 10
AS
BEGIN
IF ( NEW.PERSGIU IS NULL ) THEN NEW.PERSGIU = 'F';
END
;
In C++Builder/Delphi i add my TIBOTable components, then i set this
properties:
ColumnAttributes = PERSGIU=BOOLEAN=T,F
DefaultValues = UTENTI.PERSGIU=F
Then i add all fields into TIBOTable Fields Editor, and i can see who
PERSGIU are added as TBooleanFields.
Now i can use my TBooleanFields without any problem.
Enrico.
sorry but i don't understand what road do you have chosen.
In your TIBOTable, your BOOLEAN fields are coded as TBooleanFields or
TStringFields ?
When i ported all my applications from BDE/Paradox to FireBird, i have
keep all my BOOLEAN fields as TBooleanFields in my TIBOTable or
TIBOQuery, without any problem using it in CheckBox or testing it in my
code.
Here what i do:
Into my database i create a DOMAIN:
CREATE DOMAIN D_BOOLEAN AS
CHAR(1)
DEFAULT 'F'
CHECK (value in ('F', 'T'))
All BOOLEAN fields in my database tables are declare as TYPE =
D_BOOLEAN, i add also one Trigger for any table where i set to 'F' the
value of D_BOOLEAN fields who are passed as NULL, see my example:
CREATE TABLE UTENTI (
KEYUTENTE D_KEYDB NOT NULL,
... some fields ...
PERSGIU D_BOOLEAN,
... some fields ...
ADDED D_DATE,
EDITED D_DATE,
DBUSER D_USER
);
CREATE TRIGGER UTENTI_BOOL_TRIGGER FOR UTENTI
ACTIVE BEFORE INSERT OR UPDATE POSITION 10
AS
BEGIN
IF ( NEW.PERSGIU IS NULL ) THEN NEW.PERSGIU = 'F';
END
;
In C++Builder/Delphi i add my TIBOTable components, then i set this
properties:
ColumnAttributes = PERSGIU=BOOLEAN=T,F
DefaultValues = UTENTI.PERSGIU=F
Then i add all fields into TIBOTable Fields Editor, and i can see who
PERSGIU are added as TBooleanFields.
Now i can use my TBooleanFields without any problem.
Enrico.
> -----Original Message-----
> From: IBObjects@yahoogroups.com
> [mailto:IBObjects@yahoogroups.com] On Behalf Of Andrei Luís
> Sent: Friday, November 04, 2005 7:10 PM
> To: 'IBObjects@yahoogroups.com'
> Subject: Re: [IBO] Converting BDE to IBO
>
>
> Hi, I wrote something wrong...
>
> This: if tbCustomerActive then ....
>
> Should be this: if tbCustomerActive.asBoolean then ....
>
> :-)
>
> Andrei
>
> 2005/11/4, Andrei Luís <compuvale.software@...>:
> > Hi to all,
> >
> > Finally I get sucess with TDBCheckBox, changing ValueChecked to 'T'
> > and ValueUnchecked to 'F'.
> >
> > But, I have in this application, several times, boolean comparison,
> > like if tbCustomerActive then .... This is still not
> solved. How can
> > I simulate those char fields as boolean?
> >
> > []
> > Andrei
> >
> > 2005/11/4, Daniel Rail <daniel@...>:
> > > Hi,
> > >
> > > At November 4, 2005, 9:18 AM, Andrei Luís wrote:
> > >
> > > > 2005/11/4, Helen Borrie <helebor@...>:
> > > >> At 09:41 AM 4/11/2005 -0300, you wrote:
> > > >> >Hi Helen,
> > > >> >
> > > >> >CREATE DOMAIN BOOLEAN AS
> > > >> >CHAR(1) CHARACTER SET WIN1252
> > > >> >DEFAULT 'N'
> > > >> >CHECK (value in ('N', 'S'))
> > > >> >COLLATE WIN1252
> > > >> >
> > > >> >I do the tests with two fields. One using the domain
> above, and
> > > >> >other field without domain. The result was the same: both 'N'
> > > >> >(false) and 'S' (true) are handle as false!!! Tried
> with 'T' and
> > > >> >'F', and didn't works too.
> > > >> >
> > > >> >I don't know what is happen.
> > > >>
> > > >> Do you have these properties set in your DBCheckBox?
> > > >>
> > > >> DBCheckBox1.ValueChecked := 'S';
> DBCheckBox1.ValueChecked := 'N';
> > > >>
> > > >> I don't think TDBCheckBox is specifically for Boolean
> pairs like
> > > >> TIB_CheckBox is...
> > >
> > > > Just changed that properties and still didn't work. I
> used a lot
> > > > of TDBCheckbox with Paradox, and it always works fine
> with boolean
> > > > fields. As I concern it is specially made for this.
> > >
> > > With TDBCheckBox, there are two properties that you can set in
> > > design-time or in run-time(as Helen already pointed out). Those
> > > properties are ValueChecked and ValueUnchecked. By default, they
> > > are set to True and False, but they can be changed to
> whatever value
> > > you need. As an example, I assign them as follows
> ValueChecked:='T'
> > > and ValueUnchecked:='F'. You can use whatever value you need for
> > > those properties. And, I did the same exercise 5 years
> ago when I
> > > migrated a Paradox application to Firebird using Delphi 5 and IBO.
> > >
> > > --
> > > Best regards,
> > > Daniel Rail
> > > Senior System Engineer
> > > ACCRA Group Inc. (www.accra.ca)
> > > ACCRA Med Software Inc. (www.filopto.com)
>
>
> ______________________________________________________________
> _____________
> IB Objects - direct, complete, custom connectivity to
> Firebird or InterBase
> without the need for BDE, ODBC or any other
> layer.
> ______________________________________________________________
> _____________
> http://www.ibobjects.com - your IBO community resource for
> Tech Info papers,
> keyword-searchable FAQ, community code contributions and more
> !
> Yahoo! Groups Links
>
>
>
>
>
>