Subject | Re: [IBO] further understanding of transactions in IBO |
---|---|
Author | Jason Wharton |
Post date | 2002-09-05T15:10:24Z |
That's exactly right. You were running in AutoCommit = true mode and calling
StartTransaction suspends AutoCommit and puts you in control.
I highly recommend when importing data you use a stored procedure and
instead of failing a whole batch catch the exception for the record, log it
into a special errors table and allow the process to continue.
See InterBase language guide for how to catch and respond to exceptions.
Regards,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
-- We may not have it all together --
-- But together we have it all --
StartTransaction suspends AutoCommit and puts you in control.
I highly recommend when importing data you use a stored procedure and
instead of failing a whole batch catch the exception for the record, log it
into a special errors table and allow the process to continue.
See InterBase language guide for how to catch and respond to exceptions.
Regards,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
-- We may not have it all together --
-- But together we have it all --
----- Original Message -----
From: "Scronkey" <ryan@...>
To: <IBObjects@yahoogroups.com>
Sent: Wednesday, September 04, 2002 7:09 PM
Subject: [IBO] further understanding of transactions in IBO
> Hi there,
>
> I have just finished reading the chapter on Transactions in the IBO
> Getting Started Guide (a good read, and worth the money to anyone
> who is considering getting it), but still would like further
> clarification.
>
> I'm importing data from a paradox/bde app, using a TIB_Cursor (ibc).
> I assign my TIB_Connection to the cursor, then setup a parametrised
> query, and cycle through each paradox table record, and call Execute
> for the cursor, then move onto the next record, and so on.
> Once all records have been imported, I then call ibc.Commit
> What I would like to know is should I be using an explicit
> transaction to speed things up? I thought this was using an explicit
> transaction, until during the import, the routine stops due to an
> integrity problem on a unique record, before reaching the end of the
> import (i.e. the Commit never gets called) but when I inspect the
> table afterwards, all records up to the integrity violation are in
> the table.
> My understanding was that if it didn't get to the Commit, and
> crashed, the commit would never happen.
>
> So I'm assuming that an implicit Commit is being called with every
> Execute, and no doubt this has extra overhead.
>
> Is my understanding correct? Should I call StartTransaction
> explicitly to gain control?
>
> Thanks for any info.
> -Ryan