Re: question about postgres persistent connection in php - Mailing list pgsql-php

From Christopher Kings-Lynne
Subject Re: question about postgres persistent connection in php
Date
Msg-id 4248FE1D.8070304@familyhealth.com.au
Whole thread Raw
In response to question about postgres persistent connection in php  ("Yulius Tjahjadi" <yulius@xfire.com>)
List 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

pgsql-php by date:

Previous
From: "Yulius Tjahjadi"
Date:
Subject: question about postgres persistent connection in php
Next
From: Christopher Kings-Lynne
Date:
Subject: Help needed to rewrite PHP PostgreSQL docs