Subject Re: [IBO] Re: SQLWhereItems Problem
Author Jason Wharton
Why is there an update in there? SQLWhereItems is only designed to work with
Select statements.

I should look into making it work with UPDATE and DELETE statements too.

Added to wish list.

Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: <paulhope@...>
To: <IBObjects@yahoogroups.com>
Sent: Friday, February 16, 2001 1:02 PM
Subject: [IBO] Re: SQLWhereItems Problem


> Jason
>
> > You don't set the Text property. You simply Add( ) items in. it
> starts fresh
> > with each prepare cycle.
>
> I assumed it was based on a TStringlist and that I could. It worked
> for select statements on many previous occasions.
>
> However I changed the procedure to
>
> procedure TfNewPickList.ibMarkPrepareSQL(Sender: TIB_Statement);
> var i:integer;
> begin
> with TStringList.Create do
> try
> ibMark.SQLWhereItems.Clear;
> Text:=WhereItemsString;
> for i:=0 to Count-1 do ibMark.SQLWhereItems.Add(Strings[i]);
> finally
> Free;
> end;
> end;
>
> > You do not add WHERE to it either. IBO takes care
> > of that for you.
>
> I didn't.
>
> The SQL is
>
> update do_header o set o.status=bin_or(o.status,4096)
>
> This is the resulting SQLMonitor statement that is being prepared
>
> WHERE o.DO_TYPE='D'
> AND o.company='A'
> AND o.delivery_number<=79126
> AND o.delivery_number>=79126
> update do_header o set o.status=bin_or(o.status,4096)
>
> Regards
> Paul
>
>
> > ----- Original Message -----
> > From: <paulhope@a...>
> > To: <IBObjects@y...>
> > Sent: Friday, February 16, 2001 5:57 AM
> > Subject: [IBO] Re: SQLWhereItems Problem
> >
> >
> > > Set
> > >
> > > > Could this be as simple as you assigning the UpdateSQL property
> > > rather than
> > > > the SQL property?
> > > >
> > > > Set
> > > I dont think so, this is the assignment
> > >
> > > procedure TfNewPickList.ibMarkPrepareSQL(Sender: TIB_Statement);
> > > begin
> > > ibMark.SQLWhereItems.Text:=WhereItemsString;
> > > end;
> > >
> > > which is the same as the one for the select query
> > >
> > > Regards
> > > Paul
> > >
> > >
> > >
> > > >
> > > > At 12:34 16.02.2001 -0000, you wrote:
> > > > >First of all - late but sincerely meant congratulations to
> Jason
> > > and
> > > > >the other contributors to IBO on the Delphi Informant Readers
> > > Choice
> > > > >2001 award!
> > > > >
> > > > >I have a unit which prints documents. It is passed a string
> which
> > > > >contains the SQLWhereItems.Text from another unit. This
> string is
> > > > >then stored in a local variable in the print form for use by
> the
> > > > >queries OnPrepares.
> > > > >
> > > > >The first TIBOQuery which extracts the document headers for
> > > printing
> > > > >works fine. When printing is complete another query is
> executed
> > > > >with an update statement to mark the documents as printed. This
> > > > >creates an error 'unknown token line 2 char 1 WHERE'.
> Examining
> > > the
> > > > >SQLMonitor output shows that the SQL has been created as
> follows
> > > > >
> > > > >line 1 - blank
> > > > >line 2 - WHERE ... all the correct conditions
> > > > >line last - UPDATE table set . . .
> > > > >
> > > > >the SQL appears to be upside down with the update statement at
> the
> > > > >end :-/
> > > > >
> > > > >Any ideas?
> > > > >
> > > > >D5 V3.6A
> > > > >
> > > > >Regards
> > > > >Paul
> > >
> > >
> > >
> > >
> > >
>
>
>
>
>