Re: [INTERFACES] Always get TranBlock notice using 'c'

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Robert Rothe <rrothe(at)mindspring(dot)com>
Cc: "pgsql-interfaces(at)postgreSQL(dot)org" <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: [INTERFACES] Always get TranBlock notice using 'c'
Date: 1999-12-24 09:56:33
Message-ID: 19991224105633.B357@fam-meskes.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

On Thu, Dec 23, 1999 at 03:51:28PM -0500, Robert Rothe wrote:
> When writing apps using 'c' and the preprocessor, I always get a
> "NOTICE: BeginTransactionBlock not in default state" with my first BEGIN

If you want to expclicitely call BEGIN you either have to call ecpg with
option '-t' to change the default value or issue a EXEC SQL SET AUTOCOMMIT ON
in your program.

> statement. I've tried placing a COMMIT and END at the beginning of the
> app, but then I just get a NOTICE on the commit and another one on the
> BEGIN.

The default of ecpg is that it creates a transaction for all your action
automatically and you just issue COMMITs. After a COMMIT ecpg issues a BEGIN
all by himself. With SUTOCOMMIT set to ON ecpg uses the same logic as psql
for instance, namely that each statement is a transaction of its own unless
you issue a BEGIN.

Michael
--
Michael Meskes | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz | Go Rhein Fire!
Tel.: (+49) 2431/72651 | Use Debian GNU/Linux!
Email: Michael(at)Fam-Meskes(dot)De | Use PostgreSQL!

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message S.F. Lee 1999-12-27 08:02:42 manipulate array wiht ecpg
Previous Message Thomas Lockhart 1999-12-24 01:44:31 Re: [INTERFACES] RE: ODBC and RDO