Received: from ctron-dnm.ctron.com (ctron-dnm.cabletron.com [12.25.1.120]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f79DVMP37055 for ; Thu, 9 Aug 2001 09:31:22 -0400 (EDT) (envelope-from rhunter@enterasys.com) Received: (from uucp@localhost) by ctron-dnm.ctron.com (8.8.7/8.8.7) id JAA24890; Thu, 9 Aug 2001 09:38:51 -0400 (EDT) Received: from unknown(134.141.77.103) by ctron-dnm.ctron.com via smap (4.1) id xma024787; Thu, 9 Aug 01 09:38:24 -0400 Received: by cnc-exc2.ctron.com with Internet Mail Service (5.5.2653.19) id ; Thu, 9 Aug 2001 09:30:50 -0400 Message-ID: <59358A738F45D51186A30008C74CE2500A0846@slc-exc1.ctron.com> From: "Hunter, Ray" To: "'Chris Ruprecht'" Cc: "Pgsql-php (E-mail)" Subject: RE: pg_connect vs. pg_pconnect Date: Thu, 9 Aug 2001 09:30:47 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/mixed; boundary="----_=_NextPart_000_01C120D7.7FCFD930" X-Archive-Number: 200108/6 X-Sequence-Number: 501 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C120D7.7FCFD930 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C120D7.7FCFD930" ------_=_NextPart_001_01C120D7.7FCFD930 Content-Type: text/plain; charset="iso-8859-1" Chris, I am including the php source that has the pg_pconnect and the problems. On one php page, I am query the database multilple times to get specific data in order to populate a table for our engineers. I have to use it on the create_sub_table function. I have no idea why it does not work. RAY HUNTER Automated Test Group Software Support Engineer ENTERASYS NETWORKS Internal: 53888 Phone: 801 887-9888 Fax: 801 972-5789 Cellular: 801 698-0622 rhunter@enterasys.com www.enterasys.com -----Original Message----- From: Chris Ruprecht [mailto:chrup999@yahoo.com] Sent: Thursday, August 09, 2001 7:21 AM To: Hunter, Ray Subject: Re: [PHP] pg_connect vs. pg_pconnect Hi Ray, I don't know why pg_connect wouldn't work for you. It works in every procedure I have ever written (not all that many and not very complicated ones). I'm not much help when it comes to fixing the C sources, Tom Lane or Bruce Momijan are the people to talk to here. Can you send me an example of one of the pg_connects which doesn't work? What is the error message you're getting? Best regards, Chris ----- Original Message ----- From: Hunter, Ray To: 'Chris Ruprecht' Cc: Pgsql-php (E-mail) Sent: Thursday, August 09, 2001 8:02 AM Subject: RE: [PHP] pg_connect vs. pg_pconnect Chris, I am currently doing testing right now and finding that this is the case. I think that there is some kind of bug. I have to go in and manually kill the sleeping processes that are remaining after the pg_pconnect calls. Another question for you is why does pg_pconnect work when pg_connect does not. I am running into this problem as I change some of the connections to pg_connect from pg_pconnect? Thanks, RAY HUNTER Automated Test Group Software Support Engineer ENTERASYS NETWORKS rhunter@enterasys.com www.enterasys.com -----Original Message----- From: Chris Ruprecht [mailto:chrup999@yahoo.com] Sent: Thursday, August 09, 2001 6:52 AM To: Hunter, Ray Subject: Re: [PHP] pg_connect vs. pg_pconnect Ray, I had the same problem (PG 7.1.2 on RedHat 7.0) and changed the procedures to only use pg_connect. The is probably a bug in the pg_pconnect ... pg_close functions. Best regards, Chris ----- Original Message ----- From: Hunter, Ray To: Pgsql-php (E-mail) Sent: Thursday, August 09, 2001 7:42 AM Subject: RE: [PHP] pg_connect vs. pg_pconnect I am using both. When I use pg_pconnect it seems that the connections are still sleeping even after I close the connection ( pg_close( $conn ) ). RAY HUNTER Automated Test Group Software Support Engineer ENTERASYS NETWORKS Internal: 53888 Phone: 801 887-9888 Fax: 801 972-5789 Cellular: 801 698-0622 rhunter@enterasys.com www.enterasys.com -----Original Message----- From: Mitch Vincent [ mailto:mvincent@cablespeed.com ] Sent: Wednesday, August 08, 2001 6:10 PM To: Hunter, Ray; pgsql-php@postgresql.org Subject: Re: [PHP] pg_connect vs. pg_pconnect If you're using pg_connect they should be terminating... Are you using pg_connect or pg_pconnect? -Mitch Software development : You can have it cheap, fast or working. Choose two. ----- Original Message ----- From: "Hunter, Ray" To: Sent: Wednesday, August 08, 2001 7:40 PM Subject: [PHP] pg_connect vs. pg_pconnect > I understand the difference between the two functions. However, when I > watch my process under process management I notice that I have tons of > sleeping process that are lingering. How can I make it so that when I > connect to postgres and query that the connect process is then terminated? > These sleeping connections are eating up my resources. > > > Any suggestions? > > > > RAY HUNTER > Automated Test Group > Software Support Engineer > > ENTERASYS NETWORKS > > Internal: 53888 > Phone: 801 887-9888 > Fax: 801 972-5789 > Cellular: 801 698-0622 > > rhunter@enterasys.com > > www.enterasys.com > ------_=_NextPart_001_01C120D7.7FCFD930 Content-Type: text/html; charset="iso-8859-1" RE: [PHP] pg_connect vs. pg_pconnect
Chris,
 
I am including the php source that has the pg_pconnect and the problems.  On one php page, I am query the database multilple times to get specific data in order to populate a table for our engineers.
 
I have to use it on the create_sub_table function.
 
I have no idea why it does not work. 




RAY HUNTER
Automated Test Group
Software Support Engineer

ENTERASYS NETWORKS

Internal:    53888
Phone:       801 887-9888
Fax:         801 972-5789
Cellular:    801 698-0622

rhunter@enterasys.com

www.enterasys.com
-----Original Message-----
From: Chris Ruprecht [mailto:chrup999@yahoo.com]
Sent: Thursday, August 09, 2001 7:21 AM
To: Hunter, Ray
Subject: Re: [PHP] pg_connect vs. pg_pconnect

Hi Ray,
 
I don't know why pg_connect wouldn't work for you. It works in every procedure I have ever written (not all that many and not very complicated ones). I'm not much help when it comes to fixing the C sources, Tom Lane or Bruce Momijan are the people to talk to here.
Can you send me an example of one of the pg_connects which doesn't work? What is the error message you're getting?
 
Best regards,
Chris
 
----- Original Message -----
Sent: Thursday, August 09, 2001 8:02 AM
Subject: RE: [PHP] pg_connect vs. pg_pconnect

Chris,
 
I am currently doing testing right now and finding that this is the case.  I think that there is some kind of bug.  I have to go in and manually kill the sleeping processes that are remaining after the pg_pconnect calls. 
 
Another question for you is why does pg_pconnect work when pg_connect does not.  I am running into this problem as I change some of the connections to pg_connect from pg_pconnect?
 

Thanks,


RAY HUNTER
Automated Test Group
Software Support Engineer

ENTERASYS NETWORKS

rhunter@enterasys.com

www.enterasys.com


 

-----Original Message-----
From: Chris Ruprecht [mailto:chrup999@yahoo.com]
Sent: Thursday, August 09, 2001 6:52 AM
To: Hunter, Ray
Subject: Re: [PHP] pg_connect vs. pg_pconnect

Ray,
 
I had the same problem (PG 7.1.2 on RedHat 7.0) and changed the procedures to only use pg_connect. The is probably a bug in the pg_pconnect ... pg_close functions.
 
Best regards,
Chris
 
----- Original Message -----
Sent: Thursday, August 09, 2001 7:42 AM
Subject: RE: [PHP] pg_connect vs. pg_pconnect

I am using both.  When I use pg_pconnect it seems that the connections are still sleeping even after I close the connection ( pg_close( $conn ) ).


 
 
 
RAY HUNTER
Automated Test Group
Software Support Engineer
 
ENTERASYS NETWORKS
 
Internal:    53888
Phone:       801 887-9888
Fax:         801 972-5789
Cellular:    801 698-0622

rhunter@enterasys.com
 
www.enterasys.com


-----Original Message-----
From: Mitch Vincent [mailto:mvincent@cablespeed.com]
Sent: Wednesday, August 08, 2001 6:10 PM
To: Hunter, Ray; pgsql-php@postgresql.org
Subject: Re: [PHP] pg_connect vs. pg_pconnect


If you're using pg_connect they should be terminating... Are you using
pg_connect or pg_pconnect?

-Mitch
Software development :
You can have it cheap, fast or working. Choose two.

----- Original Message -----
From: "Hunter, Ray" <rhunter@enterasys.com>
To: <pgsql-php@postgresql.org>
Sent: Wednesday, August 08, 2001 7:40 PM
Subject: [PHP] pg_connect vs. pg_pconnect


> I understand the difference between the two functions.  However, when I
> watch my process under process management I notice that I have tons of
> sleeping process that are lingering.  How can I make it so that when I
> connect to postgres and query that the connect process is then terminated?
> These sleeping connections are eating up my resources.
>
>
> Any suggestions?
>
>
>
> RAY HUNTER
> Automated Test Group
> Software Support Engineer
>
> ENTERASYS NETWORKS
>
> Internal:    53888
> Phone:       801 887-9888
> Fax:         801 972-5789
> Cellular:    801 698-0622
>
> rhunter@enterasys.com
>
> www.enterasys.com
>

------_=_NextPart_001_01C120D7.7FCFD930-- ------_=_NextPart_000_01C120D7.7FCFD930 Content-Type: application/octet-stream; name="dbConnect.class" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="dbConnect.class" Error connecting to the database.
'; } =09 $num1 =3D @pg_numrows( $R1 );=20 $dbname =3D @pg_dbname( $conn ); echo ''; =09=09 echo ''; echo ""; echo ''; =09=09 $this->get_new_hardware( $params ); =09=09=09 $this->get_new_firmware( $params ); =09=09 for( $i =3D 0; $i < $num1; $i++ )=20 {=20 echo ''; $r1 =3D @pg_fetch_row( $R1, $i ); =09=09=09=09 echo ''; =09=09 echo ''; =09=09=09 }// end for-loop echo ''; echo '
DATABASE:= $dbname
'; echo "$r1[0]  ";=20 echo ' '; $this->create_cat_table( $r1[0], $params ); echo '
'; }// end function Get_Categories() function get_new_hardware( $params ) { $sql =3D "SELECT DISTINCT \"group\" FROM category_table WHERE \"group\" = =3D 'New_Hardware';"; =09=09=09 $conn =3D @pg_connect( $params ); =09=09=09 $result =3D @pg_exec( $conn, $sql ); =09=09=09 if( !$result ) { echo '
Error connecting to the database.
'; } =09=09=09 $num =3D @pg_numrows( $result ); =09=09=09=20 for( $i =3D 0; $i < $num; $i++ )=20 {=20 echo ''; $r =3D @pg_fetch_row( $result, $i ); =09=09=09=09 foreach( $r as $k =3D> $text ) { echo ''; echo "$text  ";=20 echo ''; =09=09=09=09=09 echo ''; $this->create_cat_table( $text, $params ); echo ''; }// end inner for-loop =20 }// end for-loop =09=09 }// end function get_new_hardware(); function get_new_firmware( $params ) { $sql =3D "SELECT DISTINCT \"group\" FROM category_table WHERE \"group\" = =3D 'New_Firmware';"; =09=09=09 $conn =3D @pg_connect( $params ); =09=09=09 $result =3D @pg_exec( $conn, $sql ); =09=09=09 if( !$result ) { echo '
Error connecting to the database.
'; } =09=09=09 $num =3D @pg_numrows( $result ); =09=09=09=20 for( $i =3D 0; $i < $num; $i++ )=20 {=20 echo ''; $r =3D @pg_fetch_row( $result, $i ); =09=09=09=09 foreach( $r as $k =3D> $text ) { echo ''; echo "$text ";=20 echo ''; echo ''; $this->create_cat_table( $text, $params ); echo ''; =09=09=09=09=09=09=09=09=09=09=09=09=09=09=09 }// end inner for-loop =20 }// end for-loop =09=09 }// end function get_new_hardware(); function create_cat_table( $cat, $params ) { $sql =3D "SELECT DISTINCT category FROM category_table WHERE \"group\" = =3D '" . $cat . "' ORDER BY category;"; $con =3D @pg_connect( $params );=20 =09=09=09 $result =3D @pg_exec( $con, $sql ); =09 if( !$result ) { echo '
Error connecting to the database.
'; } =09 $num =3D @pg_numrows( $result ); $dbname =3D @pg_dbname( $con ); echo ''; =09=09=09 for( $i =3D 0; $i < $num; $i++ )=20 {=20 $r =3D @pg_fetch_row( $result, $i ); =09=09=09=09 foreach( $r as $k =3D> $text ) { echo ''; echo ''; echo ''; echo ''; =09=09 }// end inner for-loop =09=09=09 }// end for-loop=09=09 =09=09 echo '
'; echo " " . $text . " "; echo ''; $this->create_sub_table( $text, $params ); echo '
'; =09=09=09 $sql =3D " "; }// end function create_cat_table() function create_sub_table( $cat, $params ) { $sql =3D "SELECT sub_category, status, percent, category FROM category_t= able WHERE category =3D '" . $cat . "' ORDER BY CATEGORY, SUB_CATEGORY, STA= TUS, PERCENT"; $con =3D @pg_pconnect( $params );=20 =09=09=09 $result =3D @pg_exec( $con, $sql ); =09 if( !$result ) { echo '
Error connecting to the database.
'; } =09 $num =3D @pg_numrows( $result ); $dbname =3D @pg_dbname( $con ); echo ''; =09=09=09 for( $i =3D 0; $i < $num; $i++ )=20 {=20 $r =3D @pg_fetch_row( $result, $i ); =09=09=09=09 foreach( $r as $k =3D> $text ) { if( $k =3D=3D 0 ) { echo ''; echo ''; } if( $k =3D=3D 1 ) { if( $text =3D=3D 0 ) { echo ''; } if( $text =3D=3D 1 ) { echo '";=09 } if( $text =3D=3D 2 ) { echo '"; =09=09=09=09=09=09 } =09=09=09=09=09=09 echo ""; echo "";=09=09=09 } =09=09 }// end inner for-loop =09=09=09 }// end for-loop=09=09 =09=09 echo '
'; echo "" . $text . " ";=20 echo ''; echo "FAIL"; echo ''; echo "PASS"; echo "'; echo "WAIT";=20 echo "$r[2]% Complete 
'; =09=09=09 $sql =3D " "; $close =3D pg_close( $con ); }// end function create_sub_table() function Get_Tests( $params, $SQL, $SUBCAT, $CAT ) { // Variables $ROWTOTAL =3D 0; =09=09=09 echo ''; echo ''; echo 'CATEGORY: ' . $CAT; echo '         '; echo 'SUB CATEGORY: ' . $SUBCAT; echo ''; echo ''; =09=09=09 $conn =3D @pg_connect( $params );=20 =09=09=09 $result =3D @pg_exec( $conn, $SQL ); =09=09=09 $dbname =3D @pg_dbname( $conn ); if( !$result ) { echo '
Error connecting to the database.
'; } $num =3D @pg_numrows( $result ); =09=09=09 for( $w =3D 0; $w < $num; $w++ ) { $total_row =3D 0; $r =3D @pg_fetch_row( $result, $w ); for( $i =3D 1; $i < ( count( $r ) - 3 ); $i++ ) { if( $r[$i] ) { ++$total_row; } } if( $total_row > $this->$ROWTOTAL ) { $this->$ROWTOTAL =3D $total_row; } } for( $i =3D 0; $i < $num; $i++ ) {=09 $r =3D @pg_fetch_row( $result, $i ); echo ''; for( $k =3D 1; $k <=3D $this->$ROWTOTAL; $k++ ) { echo ""; echo "$r[$k] "; echo ""; } =09=09=09=09=09 if( $r[12] =3D=3D 0 ) { echo ""; echo "FAIL"; echo ""; } =09=09=09=09 if( $r[12] =3D=3D 1 ) { echo ""; echo "Pass"; echo ""; } =09=09=09=09 if( $r[12] =3D=3D 2 ) { echo ""; echo "WAIT"; echo ""; } =09=09=09 =09=09=09=09 echo ''; echo "EDIT TEST"; echo ''; =09=09=09=09=09=09=09=09 echo ''; echo "Test Case"; echo ''; echo ''; echo "Results"; echo ''; =09=09 echo ''; echo "Pass/Fail"; echo ''; =09=09=09 echo ''; } =09=09=09 }// end function Get_Tests() =09=09 function Get_Records( $params, $SQL ) { echo ''; echo 'TEST RECORD(S)'; echo ''; $conn =3D @pg_connect( $params );=20 $result =3D @pg_exec( $conn, $SQL ); =09=09=09 if( !$result ) { echo '
Error connecting to the database.
'; } =09 =09 echo ''; echo 'Card'; echo 'Spin'; echo 'Firmware'; echo 'Bootprom'; echo 'FPGA'; echo 'Bug'; echo 'Engineer'; echo 'Status'; echo 'Edit'; echo ''; =09=09=09 $num =3D @pg_numrows( $result ); =09 for( $i =3D 0; $i < $num; $i++ ) {=09 echo ''; $r =3D @pg_fetch_row( $result, $i ); =09 for( $m =3D 0; $m < 7; $m++ ) { echo ''; echo "$r[$m] "; echo ''; } =09 if( $r[7] =3D=3D 1 ) { echo ''; echo "Pass"; echo ''; } =09=09=09=09 if( $r[7] =3D=3D 0 ) { echo ''; echo "Fail"; echo ''; } =09=09=09=09 if( $r[7] =3D=3D 2 ) { echo ''; echo "Wait"; echo ''; } echo ''; echo "Edit"; echo ''; =09 echo ''; } =09 }// end function Get_Records() }// end class dbConnect() =20=09 // eof=09 ?> ------_=_NextPart_000_01C120D7.7FCFD930--