Subject | Re: [IBO] aggregate fields? Persistant fields? |
---|---|
Author | Paul Vinkenoog |
Post date | 2004-03-21T22:15:36Z |
Hello,
alias) and they wind up as columns in the dataset. Nothing complicated
about it!
it is unprepared. What I often do (in C++ Builder) is the following.
Suppose I have a query qryPersons returning two columns: Name and
Address. I don't want to use FieldByName all the time and in loops it
could even slow things down. So I make an AfterPrepare handler for the
query with this code (or calling a function with this code):
...
colName = qryPersons->FieldByName( "Name" );
colAddr = qryPersons->FieldByName( "Address" );
...
...colName and colAddr being TIB_Column* fields of the Form (or global
variables, depending on the situation).
Upon unprepare, they should be reset to NULL (nil in Delphi). Actually
I use the same function for that, called with a parameter from the
AfterPrepare handler.
Now if I need to access those fields in my code I just do:
HisName = colName->AsString;
colAddr->AsString = "27 Penny Lane";
etc.
Greetings,
Paul Vinkenoog
(persistent IBO user)
> I am new to IBO and would like to know if there is an elegantYou can just use them in your queries (optionally giving them an SQL
> solution to aggregate fields in IBO?
alias) and they wind up as columns in the dataset. Nothing complicated
about it!
> How about persistant fields? I don't like to refer to fields inFields are "persistent" from the moment the dataset is prepared until
> code with FieldByName.
it is unprepared. What I often do (in C++ Builder) is the following.
Suppose I have a query qryPersons returning two columns: Name and
Address. I don't want to use FieldByName all the time and in loops it
could even slow things down. So I make an AfterPrepare handler for the
query with this code (or calling a function with this code):
...
colName = qryPersons->FieldByName( "Name" );
colAddr = qryPersons->FieldByName( "Address" );
...
...colName and colAddr being TIB_Column* fields of the Form (or global
variables, depending on the situation).
Upon unprepare, they should be reset to NULL (nil in Delphi). Actually
I use the same function for that, called with a parameter from the
AfterPrepare handler.
Now if I need to access those fields in my code I just do:
HisName = colName->AsString;
colAddr->AsString = "27 Penny Lane";
etc.
Greetings,
Paul Vinkenoog
(persistent IBO user)