Subject RE: Re[4]: [IBO] SQLWhereItems
Author Alan McDonald
> 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@...

That's fine if you are adding 2 items together. If I am adding an unknown
number of items to the SQLWhereItems and I want to AND some of them and OR
some others. This won't work. Try to add ONE item into the SQLWhereItems
which is OR'd amongst several which are AND'd.
Alan