Subject RE: [IBO] RowsAffected - Is it reliable?
Author Michael L. Horne
Jason,

I agree, the stored procedure is a better solution, and for production
code I would use it, but at times I have some conversions to do and
want the fastest, simplest code that will not add extra stuff to the
DB that is not used later.

Also, I would need a lot of SPs to handle all update circumstances.
Sometimes I just need to update 1 or 2 fields, except when the
record doesn't exist, so it seems inefficient to transmit enough
data to fill all the fields in the record for every update.

So is it safe to use the RowsAffected in the manor that I described?

Thanks
Michael L. Horne


> -----Original Message-----
> From:
> sentto-402930-3237-981084245-guardian=pobox.com@...
> [mailto:sentto-402930-3237-981084245-guardian=pobox.com@....
> com]On Behalf Of Jason Wharton
> Sent: Thursday, February 01, 2001 10:16 PM
> To: IBObjects@yahoogroups.com
> Subject: Re: [IBO] RowsAffected - Is it reliable?
>
>
> Yes, it should be.
>
> A better way to do what you are doing is to produce a stored
> procedure that
> receives all the information it needs in parameters and then it
> attempts to
> do the insert first. If there is a key violation it will catch it with the
>
> WHEN ERRCODE -803 DO
>
> and then it will do the update because the record is there to be updated.
>
> The benefit of this is you call the stored procedure once and reduce the
> amount of network traffic to accomplish the same thing.
>
> HTH,
> Jason Wharton
> CPS - Mesa AZ
> http://www.ibobjects.com
>
>
> ----- Original Message -----
> From: "Michael L. Horne" <guardian@...>
> To: <IBObjects@yahoogroups.com>
> Sent: Thursday, February 01, 2001 7:54 PM
> Subject: [IBO] RowsAffected - Is it reliable?
>
>
> > Hello
> >
> > I was just running some tests, using IB_DSQL to do
> > an update then checking RowsAffected to see if
> > it affected a row. If it didn't then I assume
> > that the row is not in the DB and I run a DSQL
> > to do an insert.
> >
> > This technique seems to work well and is faster
> > than select and then update or insert.
> >
> > So I just wanted to make sure that RowsAffected
> > is reliable?
> >
> > Thanks
> > Michael L. Horne
> >
> >
> >
> >
> >
>
>
>
>
>