Subject [IBO] Re: TIB_Cursor not returning correct result
Author sgharp
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> At 12:22 AM 26/08/2004 +0000, Steve Harp wrote:
>
> >procedure TDMFb.UpdateAveIdealUsage(const sItem : String);
> >Var
> > iInvItemID : Integer;
> > qry : TIB_Query; <---- You said TIB_Cursor previously
> >Begin
> > iInvItemID := DMFb.GetInvItemID(sItem);
> > if (iInvItemID <> 0) then
> > Begin
> > qry := TIB_Query.Create(Self);
> > Try
> > qry.IB_Connection := conIx;
> > qry.IB_Transaction := trnIx;
> > qry.DatabaseName := 'IxFB';
> > qry.SQL.Add('Select QtySold From xItemUsages');
> > qry.SQL.Add('Where InvItemID = ' + IntToStr(iInvItemID));
> > qry.Open;
> > qry.First; <------ for TIB_Cursor, not TIB_Query
>
> ....
>
> I'd be more interested to see the source for the SP...
>

I've tried TIB_Cursor and TIB_Query. They both give me the same
incorrect result.

Which SP? The one that calculates the numbers or the on that does
the update? Here's the one that does the update.

create procedure spUpdateAveIdealUsage(iInvItemID BigInt, dUsage
Double Precision)
as
Begin
update xInvItem
set Cycle3Ideal = Cycle2Ideal,
Cycle2Ideal = Cycle1Ideal,
Cycle1Ideal = AveIdealUsage,
AveIdealUsage = :dUsage
where (InvItemID = :iInvItemID);
End

The one that does the calculations is rather lengthy and complex.
It calls several other SPs including recursive calls. It is working
properly and is used in several other places in the application.
Besides, if it weren't working then IBExpert wouldn't be able to
give me the correct result set.

Steve