[phplib-dev] cvs commit From: negro (phplib-dev <email protected>)
Date: 12/13/00

From: negro
Date: Wed Dec 13 18:47:21 2000
Modified files:
      php-lib-stable/CHANGES
      php-lib-stable/php/db_pgsql.inc

Log message:
Added $this->Debug functionality to db_pgsl.inc for consistency
with docu and db_mysql class. (courtesy of Matteo Sgalaberni
<root <email protected>>)

Index: php-lib-stable/CHANGES
diff -u php-lib-stable/CHANGES:1.7 php-lib-stable/CHANGES:1.8
--- php-lib-stable/CHANGES:1.7 Sun Jul 2 00:13:20 2000
+++ php-lib-stable/CHANGES Wed Dec 13 18:46:50 2000
@@ -1,4 +1,9 @@
-$Id: CHANGES,v 1.7 2000/07/01 22:13:20 kir Exp $
+$Id: CHANGES,v 1.8 2000/12/13 17:46:50 negro Exp $
+
+13 Dec 2000 negro
+ - Added $this->Debug functionality to db_pgsl.inc for consistency
+ with docu and db_mysql class. (courtesy of Matteo Sgalaberni
+ <root <email protected>>)
 
 02 Jul 2000 kir
   - Fixed bug with empty query in all db_*sql.inc (PHP4 issue)
Index: php-lib-stable/php/db_pgsql.inc
diff -u php-lib-stable/php/db_pgsql.inc:1.5 php-lib-stable/php/db_pgsql.inc:1.6
--- php-lib-stable/php/db_pgsql.inc:1.5 Wed Jul 12 20:22:34 2000
+++ php-lib-stable/php/db_pgsql.inc Wed Dec 13 18:46:50 2000
@@ -5,7 +5,7 @@
  * Copyright (c) 1998-2000 NetUSE AG
  * Boris Erdmann, Kristian Koehntopp
  *
- * $Id: db_pgsql.inc,v 1.5 2000/07/12 18:22:34 kk Exp $
+ * $Id: db_pgsql.inc,v 1.6 2000/12/13 17:46:50 negro Exp $
  *
  */
 
@@ -24,12 +24,13 @@
 
   var $Errno = 0;
   var $Error = "";
+ var $Debug = 0;
 
   var $Auto_Free = 0; # Set this to 1 for automatic pg_freeresult on
                       # last record.
 
   function ifadd($add, $me) {
- if("" != $add) return " ".$me.$add;
+ if("" != $add) return " ".$me.$add;
   }
   
   /* public: constructor */
@@ -38,17 +39,17 @@
   }
 
   function connect() {
- if ( 0 == $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) {
- $this->halt("Link-ID == false, pconnect failed");
- }
- }
+ if ( 0 == $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) {
+ $this->halt("Link-ID == false, pconnect failed");
+ }
+ }
   }
 
   function query($Query_String) {
@@ -61,8 +62,9 @@
       return 0;
 
     $this->connect();
-
-# printf("<br>Debug: query = %s<br>\n", $Query_String);
+
+ if ($this->Debug)
+ printf("<br>Debug: query = %s<br>\n", $Query_String);
 
     $this->Query_ID = pg_Exec($this->Link_ID, $Query_String);
     $this->Row = 0;

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-dev-unsubscribe <email protected>
For additional commands, e-mail: phplib-dev-help <email protected>