Subject | RE: [IBO] SQLWhere + Union |
---|---|
Author | Jason Wharton |
Post date | 2005-11-10T01:34:38Z |
There is an event called OnMacroSubstitute and on the TIB_Connection you can
set what the macro markers are. By default they are << and >>.
To do a quick sample I started a new project and added to the main form
these components:
object IB_Connection1: TIB_Connection
Params.Strings = (
'SERVER=localhost'
'PATH=c:\Program Files\Common Files\Borland Shared\Data\employee.' +
'gdb'
'PROTOCOL=TCP/IP'
'USER NAME=SYSDBA')
Left = 184
Top = 80
end
object IB_Cursor1: TIB_Cursor
DatabaseName =
'localhost:c:\Program Files\Common Files\Borland Shared\Data\empl' +
'oyee.gdb'
IB_Connection = IB_Connection1
SQL.Strings = (
'select <<FIELDS>> FROM CUSTOMER')
OnMacroSubstitute = IB_Cursor1MacroSubstitute
Left = 256
Top = 80
end
And on the form I added these two event handlers.
procedure TForm1.IB_Cursor1MacroSubstitute(Sender: TIB_Component;
const ATextBlock: String; var ATextResult: String);
begin
if ATextBlock = 'FIELDS' then ATextResult := '*';
end;
procedure TForm1.FormDblClick(Sender: TObject);
begin
IB_Cursor1.Prepare;
IB_Cursor1.Unprepare;
end;
I ran the app with a breakpoint and assured myself that it worked.
Jason Wharton
set what the macro markers are. By default they are << and >>.
To do a quick sample I started a new project and added to the main form
these components:
object IB_Connection1: TIB_Connection
Params.Strings = (
'SERVER=localhost'
'PATH=c:\Program Files\Common Files\Borland Shared\Data\employee.' +
'gdb'
'PROTOCOL=TCP/IP'
'USER NAME=SYSDBA')
Left = 184
Top = 80
end
object IB_Cursor1: TIB_Cursor
DatabaseName =
'localhost:c:\Program Files\Common Files\Borland Shared\Data\empl' +
'oyee.gdb'
IB_Connection = IB_Connection1
SQL.Strings = (
'select <<FIELDS>> FROM CUSTOMER')
OnMacroSubstitute = IB_Cursor1MacroSubstitute
Left = 256
Top = 80
end
And on the form I added these two event handlers.
procedure TForm1.IB_Cursor1MacroSubstitute(Sender: TIB_Component;
const ATextBlock: String; var ATextResult: String);
begin
if ATextBlock = 'FIELDS' then ATextResult := '*';
end;
procedure TForm1.FormDblClick(Sender: TObject);
begin
IB_Cursor1.Prepare;
IB_Cursor1.Unprepare;
end;
I ran the app with a breakpoint and assured myself that it worked.
Jason Wharton
> -----Original Message-----
> From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]On
> Behalf Of Guto
> Sent: Monday, November 07, 2005 11:31 AM
> To: IBObjects@yahoogroups.com
> Subject: Re: [IBO] SQLWhere + Union
>
>
> on IBOTDataset descendants? Like TIBOQuery?
>
> How I use macros on a TIBOQuery?
>
> On 11/7/05, Jason Wharton <jwharton@...> wrote:
> > What do you mean, there already is macro processing implemented.
> >
> > Jason Wharton
> >
> >
> > > -----Original Message-----
> > > From: IBObjects@yahoogroups.com
> [mailto:IBObjects@yahoogroups.com]On
> > > Behalf Of Guto
> > > Sent: Monday, November 07, 2005 8:58 AM
> > > To: IBObjects@yahoogroups.com
> > > Subject: Re: [IBO] SQLWhere + Union
> > >
> > > ok.
> > > There are plans to implement macros on TIBODatasets ???
> > >
> > > Thanks.
> > >
> > > On 11/7/05, Jason Wharton <jwharton@...> wrote:
> > > > > How SQLWhere method will behavior if my SQL have a UNION
> > > statement?
> > > >
> > > > This is a potentially problematic issue because you have
> > > potentially two SQL
> > > > WHERE clauses in your entire statement. I believe it will
> > > only affect the
> > > > WHERE clause of the first SQL statement and leave the
> > > entire statement below
> > > > the UNION clause alone.
> > > >
> > > > Jason Wharton
> >
> >
> >
> >
> >
> ______________________________________________________________
> _____________
> > 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
> >
> >
> >
> >
> >
> >
> >
> >
>
>
> --
> Guto
>
>
> ------------------------ Yahoo! Groups Sponsor
> --------------------~-->
> Get Bzzzy! (real tools to help you find a job). Welcome to
> the Sweet Life.
> http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/PhFolB/TM
> --------------------------------------------------------------
> ------~->
>
> ______________________________________________________________
> _____________
> 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
>
>
>
>
>
>
>
>