Subject Re: SQLWhereItems
Author George
--- In IBObjects@yahoogroups.com, "Alan McDonald" <alan@...> wrote:
>
> With regard to SQLWhereItems, The help file says:
> "Each unit of entries must aggregate to a syntactically valid SQL
expression
> that evaluates to a Boolean True or False. It is possible to include
> parentheses to to provide for nesting of items. By default, all
items are
> "ANDed" together, but if the OR operator is placed as an item on
its own, it
> will be used instead of the default 'AND'."
>
> But if I do this
> IB_QJobsAccounts.SQLWhereItems.Add('(PROCESSED=''N'')');
> IB_QJobsAccounts.SQLWhereItems.Add('OR');
> IB_QJobsAccounts.SQLWhereItems.Add('(ABORTED=''Y'')');
>
> The SQL Monitor reveals this translation:
>
> WHERE (
> (
> (PROCESSED='N')
> )
> AND OR
> )
> AND (ABORTED='Y')
>
> and of course there is a syntax error here at "AND OR"
>
> Does anyone know what the trick is to make items get parsed the way
I think
> the help file intends?
>
> regards
> Alan McDonald
>

Alan

I don't know if it helps but I got round it by using a TIBOQuery and
using the SQL property direct, ignoring the 'Where', 'Insert' etc.
SQL properties. That way I have full control. It seems to work fine,
no idea whether or not it is best practice though.

Regards

George Elton