Subject Re: [IBO] RowsAffected - Is it reliable?
Author Jason Wharton
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
>
>
>
>
>