pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PQputCopyData and Rollback/Commit
2+ messages / 2 participants
[nested] [flat]

* PQputCopyData and Rollback/Commit
@ 2007-02-02 06:32 Sandeep Khandelwal <sandeep_khandelwal27@yahoo.com>
  2007-02-02 15:09 ` Re: PQputCopyData and Rollback/Commit Michael Fuhr <mike@fuhr.org>
  0 siblings, 1 reply; 2+ messages in thread

From: Sandeep Khandelwal @ 2007-02-02 06:32 UTC (permalink / raw)
  To: pgsql-interfaces

Hi All.

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.


Thanks, 
Sandeep Khandelwal


 
____________________________________________________________________________________
No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail 



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: PQputCopyData and Rollback/Commit
  2007-02-02 06:32 PQputCopyData and Rollback/Commit Sandeep Khandelwal <sandeep_khandelwal27@yahoo.com>
@ 2007-02-02 15:09 ` Michael Fuhr <mike@fuhr.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Fuhr @ 2007-02-02 15:09 UTC (permalink / raw)
  To: Sandeep Khandelwal <sandeep_khandelwal27@yahoo.com>; +Cc: pgsql-interfaces

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-02-02 15:09 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-02-02 06:32 PQputCopyData and Rollback/Commit Sandeep Khandelwal <sandeep_khandelwal27@yahoo.com>
2007-02-02 15:09 ` Michael Fuhr <mike@fuhr.org>

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