Subject Re[4]: [IBO] SQLWhereItems
Author Ramil
Hello Alan,

> tried that - you get a syntax error at OR and the monitor shows it parsed as
> "AND OR" on that item
> as I say - they help file says if you add a single OR it will not use AND
> but use the OR but it doesn't - it sticks an AND in anyway.

Are you sure?
I had successfully tested with my example:

procedure TForm1.IB_Query1PrepareSQL(Sender: TIB_Statement);
begin
IB_Query1.SQLWhereItems.Add( '(' ); // !!! Don't omit!
IB_Query1.SQLWhereItems.Add( 'DRPLITTER = 4.8' );
IB_Query1.SQLWhereItems.Add( 'OR' );
IB_Query1.SQLWhereItems.Add( 'DRPHUMIDITY = 11.6' );
IB_Query1.SQLWhereItems.Add( ')' ); // !!! Don't omit!
end;

There are no problems here!
I get syntax error at OR only if I remove brackets.

--
Best regards,
Ramil R. Khabibullin khabibr@...

>
>
>
>
>
>> Hello Alan,
>>
>> Ok, according to the help file it is necessary for you:
>> SQLWhereItems.Add( '(' );
>> SQLWhereItems.Add( 'PROCESSED=''N''' );
>> SQLWhereItems.Add( 'OR' );
>> SQLWhereItems.Add( 'ABORTED=''Y''' );
>> SQLWhereItems.Add( ')' );
>>
>> and when parsed into the finalized SQL statement will end up as:
>> WHERE .... < original criteria plus other system stuff >
>> AND ( PROCESSED=''N'' OR ABORTED=''Y'' )
>>
>> --
>> Best regards,
>> Ramil R. Khabibullin khabibr@...
>
> tried that - you get a syntax error at OR and the monitor shows it parsed as
> "AND OR" on that item
> as I say - they help file says if you add a single OR it will not use AND
> but use the OR but it doesn't - it sticks an AND in anyway.
>
> Alan