Re: AW: [HACKERS] Begin statement again

From: Michael Meskes <meskes(at)topsystem(dot)de>
To: jwieck(at)debis(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org (PostgreSQL Hacker)
Subject: Re: AW: [HACKERS] Begin statement again
Date: 1998-03-26 08:12:20
Message-ID: 199803260812.JAA19968@gauss.topsystem.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jan Wieck writes:
> I'm not that familiar with the C level of Oracle connections.
> But I used oratcl from Tom Poindexter sometimes and that has
> a AUTOCOMMIT ON/OFF statement that sets the autocommit flag
> in the library routines somewhere. Doesn't embedded SQL use
> the same libraries to connect to oracle that oratcl uses?

Don't know.

> Anyway - ecpg could work around. It can manage an autocommit
> flag and an in_trans status by itself. When autocommit is OFF
> and in_trans is false, it sends down a 'BEGIN TRANSACTION'
> right before the next query and sets in_trans to true.
> Later, when PostgreSQL responds 'COMMIT' from a query, it
> sets in_trans back to false and we have the behaviour of the
> AUTOCOMMIT. This way, a program that doesn't explicitly set
> autocommit to off might sometimes issue a COMMIT that results
> in an empty BEGIN/COMMIT sequence sent down to the backend -
> not too bad IMHO. As soon as a program requires real

Wait a moment. This is almost as it is handled currently. ecpg issues a
'BEGIN TRANSACTION' before the next statement if commited (as the variable
is called) is set to TRUE. Then it sets commited back to FALSE. Issuing a
COMMIT sets it back to TRUE.

> transactions, it sets autocommit to false and has (from the
> embedded SQL programmers point of view) total Oracle
> compatibility. And as long as autocommit is ON, there are no

Oracle compatibility means exactly the behaviour we currently have. BEGIN
TRANSACTION is issued automatically. COMMIT has to be called by hand. But
what we were talking about is forcing both to be called by the programmer.

> open locks laying around since ecpg doesn't send 'BEGIN
> TRANSACTION' and PostgreSQL's default is somewhat like
> autocommit too.
> ...
> Isn't EOF information enough? Must a client say BYE?

No, it need not. But it would be nice if it does, wouldn't it?

Michael
--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes(at)topsystem(dot)de | Europark A2, Adenauerstr. 20
meskes(at)debian(dot)org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Meskes 1998-03-26 08:12:55 Re: AW: AW: [HACKERS] Begin statement again
Previous Message Frank Ridderbusch 1998-03-26 07:44:50 [HACKERS] string.h and strings.h in ecpg