Subject Re: [IBO] TIB_Import
Author peter@cyionics.com
Thanks Jason

I'll do that.

Rgds

Peter
----- Original Message -----
From: Jason Wharton
To: IBObjects@yahoogroups.com
Sent: Saturday, November 15, 2003 3:22 PM
Subject: Re: [IBO] TIB_Import


> I am using a TIB_Import successfully , however
> I need to do an edit on a field if the key exists rather
> than an Insert.
> Is this possible using the before post or similar ?
>
> One way I thought of was to pick up on the before post event ,
> pass the data to a stored procedure that does a edit / insert
> then skip the post in the TIB_Import.
>
> Anyone have any other advice ?

Make yourself a stored procedure that receives the data fields.
Inside that procedure do an error trap on SQLCODE -803 around your insert.
This is for a duplicate primary key violation.
If this happens then there is a record there already and you can then handle
that exception by performing an update.

Your client application need only pass the data to the server and this way
your server efficiently handles the data however necessary.

Always approach your database development this way when possible...

Jason Wharton


Yahoo! Groups Sponsor



___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


[Non-text portions of this message have been removed]