Date: 02/17/01
- Next message: Kristian Koehntopp: "Re: [phplib] Strange Connection Behavior - too many connections"
- Previous message: Brent J. Nordquist: "[phplib] ct_ldap.inc use of $id_"
- Next in thread: Kristian Koehntopp: "Re: [phplib] Strange Connection Behavior - too many connections"
- Reply: Kristian Koehntopp: "Re: [phplib] Strange Connection Behavior - too many connections"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I've added some debugging output to my phplib install. I was checking on
link ids to see how it was handling them. I've altered the connect()
function so that it looks like this so that I can monitor when a new
connection id is requested:
function connect()
{
if ( !$this->Link_ID )
{
$cstr = "dbname=".$this->Database.
$this->ifadd($this->Host, "host=").
$this->ifadd($this->Port, "port=").
$this->ifadd($this->User, "user=").
$this->ifadd($this->Password, "password=");
$this->Link_ID=pg_pconnect($cstr);
if( $this->Link_ID and $this->debug ) echo "<P><b>DB connection
established.</b> <br>Link ID: $this->Link_ID";
}
if (!$this->Link_ID)
{
$this->halt("Link-ID == false, pconnect failed");
}
}
With debug on, I noticed the following output when debugging my phplib
application:
DB connection established.
Link ID: Resource id #1
Debug: query = select val from phplib_active_sessions where sid =
'43c4c0ed90d33528b3ab20bce4ce18c1' and name = 'pr_session'
Last error:
DB connection established.
Link ID: Resource id #1 [Connection requested again.]
Debug: query = SELECT name FROM pr_cat WHERE cat_id = 10
Last error:
Debug: query = SELECT name FROM pr_cat WHERE prog_name='kids_culture';
Last error:
The part I'm unhappy about is the second call to pg_pconnect. I'm guessing
this is happening because my application and phplib are both creating
instances of the database abstraction object. Since the second instance
doesn't already know that there's a valid connection id, it would try to
establish a new connect. I'd like to avoid this at all possible.
One might consider this a bug. Is it? Please comment on possible solutions.
Matt Friedman
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>
- Next message: Kristian Koehntopp: "Re: [phplib] Strange Connection Behavior - too many connections"
- Previous message: Brent J. Nordquist: "[phplib] ct_ldap.inc use of $id_"
- Next in thread: Kristian Koehntopp: "Re: [phplib] Strange Connection Behavior - too many connections"
- Reply: Kristian Koehntopp: "Re: [phplib] Strange Connection Behavior - too many connections"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

