Subject | RE: [IBO] SQLWhere Items ??? |
---|---|
Author | Alan McDonald |
Post date | 2003-04-27T02:10:47Z |
I don't know but in the GSG it states...
"For example, you might prefer to leave the SQL statement without any
clauses to qualify criteria. At run-time, in the OnPrepareSQL event
handler, you can set the properties SQLWhereItems and SQLOrder to "fill in"
WHERE and ORDER BY clauses"
Sounds to me like you have a choice of putting this stuff in the
OnPrepareSQL event or not. BUT it is not possible to put anything in the
SQLWhereItems OTHER THAN in the OnPrepareSQL event.
huh?
Alan
"For example, you might prefer to leave the SQL statement without any
clauses to qualify criteria. At run-time, in the OnPrepareSQL event
handler, you can set the properties SQLWhereItems and SQLOrder to "fill in"
WHERE and ORDER BY clauses"
Sounds to me like you have a choice of putting this stuff in the
OnPrepareSQL event or not. BUT it is not possible to put anything in the
SQLWhereItems OTHER THAN in the OnPrepareSQL event.
huh?
Alan
> -----Original Message-----
> From: Alan McDonald [mailto:alan@...]
> Sent: Sunday, 27 April 2003 10:10 AM
> To: IBObjects@yahoogroups.com
> Subject: [IBO] SQLWhere Items ???
>
>
> I don't seem to understand when/how SQLWhereItems get added so
> that they are
> active. The snippet below shows what I thought would be valid. I've even
> tried invalidating the sql and refreshing, but no matter what the
> sequence,
> I only ever get the SQL being executed.. i.e. without the where
> clauses. If
> I add the where clauses directly into the SQL, it works fine.
> What do need
> to do to take advantage of the SQLWhereItems add - I need to provide a lot
> definition to the where section - it's be nice not to worry about whether
> I've added a 'WHERE' and 'AND' stuff.
> If I use the onPrepareSQL, I don;t have valid values for building
> the where
> clause, so I have to use this sort of sequence.
> Can someone enlighten me?
> Thanks
> Alan
>
> IB_CMembers.Open;
> while not IB_CMembers.Eof do begin
> IB_CAdverts.SQL.Clear;
> IB_CAdverts.SQL.Add('SELECT ID, LINKTOMEMBER, LINKTOROLECATEGORY,
> LINKTOLOCATION, ADREF, JOBTITLE, ');
> IB_CAdverts.SQL.Add('SHORTDESCRIPTION, JOBDESCRIPTION, CONTACTPERSON,
> EMPTIME, EMPSTATUS, LOCATION, ');
> IB_CAdverts.SQL.Add('INCFOOTER, FOOTER, SUBMITDATE, GOLIVE, EXPIRY,
> ADACTIVE ');
> IB_CAdverts.SQL.Add('FROM ADVERTISEMENTS');
> IB_CAdverts.SQLWhereItems.Add('LINKTOLOCATION IN
> ('+IB_CMembers.FieldByName('JSLOCATION').AsString+')');
> IB_CAdverts.SQLWhereItems.Add('LINKTOROLECATEGORY IN
> ('+IB_CMembers.FieldByName('JSEMPROLE').AsString+')');
> if (IB_CMembers.FieldByName('JSEMPTIME').AsString<>'either') then
> IB_CAdverts.SQLWhereItems.Add('EMPTIME =
> '''+IB_CMembers.FieldByName('JSEMPTIME').AsString+'''');
> if (IB_CMembers.FieldByName('JSEMPSTATUS').AsString<>'either') then
> IB_CAdverts.SQLWhereItems.Add('EMPSTATUS =
> '''+IB_CMembers.FieldByName('JSEMPSTATUS').AsString+'''');
> // IB_CAdverts.InvalidateSQL;
> // IB_CAdverts.Refresh;
> IB_CAdverts.Open;
> while not IB_CAdverts.Eof do begin
> inc(matches);
> IB_CAdverts.Next;
> end;
> IB_CAdverts.Close;
> IB_CMembers.Next;
> end;
> IB_CMembers.Close;
>
>
>
>
> __________________________________________________________________
> _________
> 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 !
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>