From: | Michael Fork <mfork(at)toledolink(dot)com> |
---|---|
To: | Markus Fischer <mfischer(at)josefine(dot)ben(dot)tuwien(dot)ac(dot)at> |
Cc: | pgsql-php(at)postgresql(dot)org |
Subject: | Re: Strange behaviour with self written class |
Date: | 2001-03-05 13:53:38 |
Message-ID: | Pine.BSI.4.21.0103050849010.22733-100000@glass.toledolink.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
I believe you are running into a well-known PHP bug where multiple
pg_connect's or a pg_connect with multiple pg_pconnect's breaks
(http://bugs.php.net/bugs.php?id=9123) This has been fixed in CVS, but
here is the patch needed:
-------------------------
(this is from Thies Arntzen, thies(at)thieso(dot)net, the maintainer of the
Postgres module for PHP)
i've commited a fix for this to PHP 4 CVS yesterday (~ Feb 15).
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);
}
}
-------------------------
Michael Fork - CCNA - MCP - A+
Network Support - Toledo Internet Access - Toledo Ohio
On Mon, 5 Mar 2001, Markus Fischer wrote:
> Hello,
>
> I've written a class for the pgsql_* function ( just a
> wrapper to speed up things and have a cleaner interface, I've
> attached it). While working with it, I've made some interesting
> observation :
>
> When create my first instance of the class all works ok; then,
> later in a function in my new php file I create another instance
> of the same class; this time the connection can be established,
> but its somehow corrupted and subsequent queries fail because of
> this:
>
> called dbpg->connect()
> connectstring -> host=XXXXXXXXXXXXXX user=XXXXXX password=XXXXXXX dbname=XXXXXX
> connect() succeeded
> connectLink = resource
> resource(1) of type (pgsql link)
>
> called <- function called
> called dbpg->connect()
> connectstring -> host=XXXXXXXXXXXXXX user=XXXXXX password=XXXXXXX dbname=XXXXXX
> connect() succeeded
> connectLink = resource
> resource(1) of type (Unknown)
>
> its still of type resource, but its resource type is NOT pgsql
> link like above but 'Unknown'.
>
> Anyone know whats wrong or why this happening ?
>
> thanks
> Markus
>
> --
> Markus Fischer, http://josefine.ben.tuwien.ac.at/~mfischer/
> EMail: mfischer(at)josefine(dot)ben(dot)tuwien(dot)ac(dot)at
> PGP Public Key: http://josefine.ben.tuwien.ac.at/~mfischer/C2272BD0.asc
> PGP Fingerprint: D3B0 DD4F E12B F911 3CE1 C2B5 D674 B445 C227 2BD0
>
From | Date | Subject | |
---|---|---|---|
Next Message | Richie | 2001-03-10 17:48:48 | Javascript & PHP?? |
Previous Message | Markus Fischer | 2001-03-05 09:54:20 | Strange behaviour with self written class |