Re: question about postgres persistent connection in php

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Yulius Tjahjadi <yulius(at)xfire(dot)com>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: question about postgres persistent connection in php
Date: 2005-03-29 07:05:01
Message-ID: 4248FE1D.8070304@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

> A majority of our sql statements in the logs are BEGIN; ROLLBACK;
> that is created by the php persistent connection and I want to
> see if I can get rid of them.

Try changing these lines:

orig = PGG(ignore_notices);
PGG(ignore_notices) = 1;
res = PQexec(link,"BEGIN;");
PQclear(res);
res = PQexec(link,"ROLLBACK;");
PQclear(res);
PGG(ignore_notices) = orig;

to this:

if ((PQprotocolVersion(link) >= 3 && PQtransactionStatus(link)
!= PQTRANS_IDLE) || PQprotocolVersion(link) < 3)
{
orig = PGG(ignore_notices);
PGG(ignore_notices) = 1;
res = PQexec(link,"ROLLBACK;");
PQclear(res);
PGG(ignore_notices) = orig;
}

And recompile.

Chris

Browse pgsql-php by date

  From Date Subject
Next Message Christopher Kings-Lynne 2005-03-30 06:32:45 Help needed to rewrite PHP PostgreSQL docs
Previous Message Eko Budi Setiyo 2005-03-29 05:12:08 sql command