Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: PQputCopyData and Rollback/Commit



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



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group