Re: [GENERAL] What does this mean ?

From: Remigiusz Sokolowski <rems(at)gdansk(dot)sprint(dot)pl>
To: mjnf(at)uevora(dot)pt
Cc: "pgsql-general(at)postgreSQL(dot)org" <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: [GENERAL] What does this mean ?
Date: 1999-06-28 11:49:56
Message-ID: Pine.GS4.4.02A.9906281334501.13057-100000@netra.gdansk.sprint.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Remigiusz Sokolowski wrote:
> > Error is that You just dont END your transaction
> > before pg_Close You should have a line pg_Exec( $conn, "END;" );
> > pg_Close closes Your connection, but doesn't end Your transactions
>
> Ok! I'll give it a try ut i find that to be wierd since the code only
> enters that section that i sent before if the exec doesn't return
> anything usefull...
>
But as I remember well (I've deleted previous mails)
Your pg_Exec($conn, "BEGIN;"); call was before "if" statement -
and pg_Close( $conn ) and pg_Exec( $conn, "END;") (if You add it) inside
if - so there are two possible ways of programm flow
First one - You connect to database, open transaction and if "if"
condition is true there are executed statement inside "if" - this should
lead us to point when all is ok - and transaction and connection are
closed

if "if" condition is false then You have an open transaction and no end.

so the whole piece of code should look like:

pg_Connect
pg_Exec( $conn, "BEGIN;");
if condition {
some things, You wanna do
pg_Exec( $conn, "END;" );
} else {
pg_Exec( $conn, "ABORT;")
}
pg_Close( $conn )

I don't remember well, so I could be wrong
Rem

-------------------------------------------------------------------*------------
Remigiusz Sokolowski e-mail: rems(at)gdansk(dot)sprint(dot)pl * *
-----------------------------------------------------------------*****----------

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chris Bitmead 1999-06-28 13:00:04 Re: [GENERAL] Re: Data warehousing
Previous Message Hub.Org News Admin 1999-06-28 10:31:37