From: Michael Fuhr <mike@fuhr.org>
To: Sandeep Khandelwal <sandeep_khandelwal27@yahoo.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: PQputCopyData and Rollback/Commit
Date: Fri, 2 Feb 2007 08:09:04 -0700
Message-ID: <20070202150903.GA11313@winnie.fuhr.org> (raw)
In-Reply-To: <301290.97125.qm@web33313.mail.mud.yahoo.com>
References: <301290.97125.qm@web33313.mail.mud.yahoo.com>
On Thu, Feb 01, 2007 at 10:32:21PM -0800, Sandeep Khandelwal wrote:
> I am using PQputCopyData function to send data to server one row at
> a time. When I am done with the data then I call PQputCopyEnd.
>
> I want to do rollback when any error occurs. Please help me how
> to achieve rollback using these functions.
As the documentation for PQputCopyEnd() says, you can pass a non-NULL
second argument to force the copy to fail. You could also use PQexec()
to execute a BEGIN before the copy and a COMMIT or ROLLBACK after the
copy.
--
Michael Fuhr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: mike@fuhr.org, sandeep_khandelwal27@yahoo.com
Subject: Re: PQputCopyData and Rollback/Commit
In-Reply-To: <20070202150903.GA11313@winnie.fuhr.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox