| From: | Michael Fuhr <mike(at)fuhr(dot)org> |
|---|---|
| To: | Sandeep Khandelwal <sandeep_khandelwal27(at)yahoo(dot)com> |
| Cc: | pgsql-interfaces(at)postgresql(dot)org |
| Subject: | Re: PQputCopyData and Rollback/Commit |
| Date: | 2007-02-02 15:09:04 |
| Message-ID: | 20070202150903.GA11313@winnie.fuhr.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2007-02-06 05:14:52 | Re: libpq - PGexecPrepared - INT4OID binary parameter mode not working |
| Previous Message | jp.duval | 2007-02-02 13:11:18 | libpq - PGexecPrepared - INT4OID binary parameter mode not working |