Subject | [IBO] Re: Adding search criteria to WHERE clause and more..not working as expected. |
---|---|
Author | mspencewasunavailable |
Post date | 2007-01-13T18:55:01Z |
--- In IBObjects@yahoogroups.com, "Adrian Wreyford" <wreymed@...>
wrote:
only point where it is valid to add items to this stringlist."
There are a lot of little hooks like this that are available that
make the TIBODataset stuff go. For example, the TIBOTable.Filter
stuff is supported by fiddling with the WHERE clause, but it works
in concert with other stuff that might get injected in
OnPrepareSQL. While we're on the topic, you can use SQL for filter
expressions using an escape:
nameFilter := '::SQL::UPPER(CUST."Last Name") starts with ''' +
letter + '''';
You might also want to look at TIBODataset.OrderingItems and
OrderingItemNo (the full explanation is actually given in the help
for TIB_Query.OrderingItemNo). This lets you affect the ORDER BY
clause without having to regenerate all of the SQL.
OnMacroSubstitute can also be useful. I have a longish script that
sets up a new database, and I use this to inject the path that the
user chooses for the directory where the database is stored. That
way, I can just set up the script at design time using the component
editor.
Michael D. Spence
Mockingbird Data Systems, Inc.
wrote:
>was
> Thanks Michael
>
> It works .. but still not sure why. I think it works as follows?
>
> So it appears the SQLWhere clause only holds the Search SQL that
> assigned, but when the SQL for the Query is prepared for sendingto the
> server for execution, then the SQLWhereItemsAdd part you assignedso
> elegantly, is actually added to the where clause.<g> It says as much in the help file: "The OnPrepareSQL phase is the
>
only point where it is valid to add items to this stringlist."
There are a lot of little hooks like this that are available that
make the TIBODataset stuff go. For example, the TIBOTable.Filter
stuff is supported by fiddling with the WHERE clause, but it works
in concert with other stuff that might get injected in
OnPrepareSQL. While we're on the topic, you can use SQL for filter
expressions using an escape:
nameFilter := '::SQL::UPPER(CUST."Last Name") starts with ''' +
letter + '''';
You might also want to look at TIBODataset.OrderingItems and
OrderingItemNo (the full explanation is actually given in the help
for TIB_Query.OrderingItemNo). This lets you affect the ORDER BY
clause without having to regenerate all of the SQL.
OnMacroSubstitute can also be useful. I have a longish script that
sets up a new database, and I use this to inject the path that the
user chooses for the directory where the database is stored. That
way, I can just set up the script at design time using the component
editor.
Michael D. Spence
Mockingbird Data Systems, Inc.