Re: possible bug in DB/pgsql.php

From: Date: Mon, 19 Feb 2001 19:06:54 +0000
Subject: Re: possible bug in DB/pgsql.php
References: 1  Groups: php.pear 
Request: Send a blank email to php-pear+get-1384@lists.php.net to get a copy of this message
On 19 Feb 2001, at 13:27, Stig S. Bakken wrote: > fabrizio.ermini@sysdat.it wrote: > > > > Hmm, maybe I'm straying too far...I'm not too content of my own > > suggestions. Your turn... > > I've implemented your suggestion now and added a transaction test for > pgsql as well. Could you give it a shot and see if it solves your > problem? > Hmm. Sadly, my work took out whole afternoon and I didn't have the time to do a real test of the source, so I just v-grepped it. I'll do a real benchmark ASAP... for the moment, I'm still wondering if it could work without storing somewhere the connection id. If you have more than one connection in a page, how do you recognize when one has an open transaction or not? PS: However, there was an error in the way that PHP handled PGsql's permanent connections that could lead to serious troubles. In Pg main list they said the fix it's in the cvs, otherway this is the relevant part: > > a bunch of scripts that randomly give errors "Warning: <some number> is > > not a valid PostgreSQL link resource in <file>". I have noticed this > > since moving to PHP4, and it appears to only be random (it just started > > happening on a website that previously worked for months without > > problems -- only change to system was increasing kern.maxfiles to 8192). > > i've commited a fix for this to PHP 4 CVS yesterday. > > if you don't want to live on the "bleeding edge" (use PHP > from CVS) just replace the php_pgsql_set_default_link > function in pgsql.c against this one and you're all-set! > > regards, > tc > > static void php_pgsql_set_default_link(int id) > { > PGLS_FETCH(); > > if ((PGG(default_link) != -1) && (PGG(default_link) != id)) { > zend_list_delete(PGG(default_link)); > } > > if (PGG(default_link) != id) { > PGG(default_link) = id; > zend_list_addref(id); > } > } > > > /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ Fabrizio Ermini Alternate E-mail: C.so Umberto, 7 faermini@tin.it loc. Meleto Valdarno Mail on GSM: (keep it short!) 52020 Cavriglia (AR) faermini@sms.tin.it

« previous php.pear (#1384) next »