From: | Adam Haberlach <haberlaa(at)ricochet(dot)net> |
---|---|
To: | mjnf(at)uevora(dot)pt |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: [GENERAL] What does this mean ? |
Date: | 1999-06-26 18:03:20 |
Message-ID: | 19990626110320.A24520@ricochet.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Jun 25, 1999 at 05:01:29PM +0100, Mario Jorge Nunes Filipe wrote:
> Thomas Reinke wrote:
> >
> > You have already started a transaction and haven't yet
> > finished it.
> >
> > E.g.
> >
> > psql template;
> > BEGIN;
> > BEGIN;
>
> Not that i don't believe you but i think that in my case that is a tid
> bit impossible. The error comes from a php script. On that script i open
> the connection, then i do a select and then the begin. So there isn't
> anyother begin. I've tryed to run an abort before that but it still
> doen't return a result, althoug there is no message error either.
>
> I really need help here, because i really need this thing working with
> transactions. Just in case here is the code:
>
> pg_Exec($conn, "abort");
> $result = @pg_Exec($conn, "begin");
> if (!$result);
> $msg ="sac-pcgra (2):".addslashes(pg_ErrorMessage($conn));
> $msg = chop($msg);
> echo "<script>alert(\"$msg\");history.go(-1)</script>";
> pg_Close($conn);
> exit;
> }
Here is some code from one of my projects (displays the top 15
speakers in a database of irc transactions). I don't bother to post
a COMMIT in this case because it is just a select. On another system,
I do get warning (not error) messages about not COMMITing transactions,
btw.
$pgconn = pg_connect("socket", "5432", "", "", "slashnet");
$result = pg_exec($pgconn, "BEGIN");
$result = pg_exec($pgconn, "DECLARE foo CURSOR FOR select nick, count(*) as tcoun
t from messages group by nick order by tcount desc");
$result = pg_exec($pgconn, "FETCH 15 IN foo");
$rows = pg_numrows($result);
From | Date | Subject | |
---|---|---|---|
Next Message | Kenneth Been | 1999-06-27 01:25:39 | large object minimum storage |
Previous Message | Karl DeBisschop | 1999-06-26 12:45:14 | Re: [GENERAL] Questions regarding OID |