Subject Re: [IBO] Transaction problems
Author Helen Borrie
At 07:02 AM 15-10-02 +0000, you wrote:
>I have a transaction that essentially imports records - check to see
>if there is an existing key ( edit ) or none ( inserts ). I then
>update all those records with an update statement ( execSQL ). This
>causes a 'Connection Lost To Database' ( in the interbase.log I get
>IBServer terminated abnormally )
>Is it bad to use edit/inserts and post along with execSQL statements
>in the same transaction ?

In the same transaction, no, it's not bad at all.

But an insert statement is a DIFFERENT statement to an update
statement. What is probably causing the crash is that you are passing the
insert statement to a statement object that has prepared the update
statement, or vice versa.

Since your statements are going to see-saw all the time, you'll need to
make your logic apply the SQL afresh each time you use the statement
object, and call Prepare before you call Execute.

To clarify, it's fine for you to execute *each* statement as your app
decides what the statement is to be and fills up its parameters, all within
a single transaction, and to COMMIT the lot at the end.

It sounds as if you would benefit from setting up an IB_Monitor and
watching what's happening at the interface when you prepare and execute
these statements.