[geeklog-cvs] geeklog-1.3/system/databases mysql.class.php,1.16,1.17

vinny at iowaoutdoors.org vinny at iowaoutdoors.org
Mon Apr 26 12:49:17 EDT 2004


Update of /var/cvs/geeklog-1.3/system/databases
In directory www:/tmp/cvs-serv30862

Modified Files:
	mysql.class.php 
Log Message:
The mysql class now only does one mysql_connect per page load


Index: mysql.class.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/system/databases/mysql.class.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** mysql.class.php	21 Mar 2004 20:53:34 -0000	1.16
--- mysql.class.php	26 Apr 2004 16:49:13 -0000	1.17
***************
*** 62,65 ****
--- 62,69 ----
      * @access private
      */
+     var $_db = '';
+     /**
+     * @access private
+     */
      var $_verbose = false;
      /**
***************
*** 106,115 ****
  
          // Connect to MySQL server
!         $conn = mysql_connect($this->_host,$this->_user,$this->_pass) or die('Cannnot connect to DB server');
  
          // Set the database
          @mysql_select_db($this->_name) or die('error selecting database');
  
!         if (!$conn) {
              if ($this->isVerbose()) {
                  $this->_errorlog("\n*** Error in database->_connect ***");
--- 110,119 ----
  
          // Connect to MySQL server
!         $this->_db = mysql_connect($this->_host,$this->_user,$this->_pass) or die('Cannnot connect to DB server');
  
          // Set the database
          @mysql_select_db($this->_name) or die('error selecting database');
  
!         if (!($this->_db)) {
              if ($this->isVerbose()) {
                  $this->_errorlog("\n*** Error in database->_connect ***");
***************
*** 123,129 ****
              $this->_errorlog("\n***leaving database->_connect***<br>");
          }
- 
-         // return connection object
-         return $conn;
      }
  
--- 127,130 ----
***************
*** 150,153 ****
--- 151,156 ----
          $this->_verbose = false;
          $this->_errorlog_fn = $errorlogfn;
+ 
+         $this->_connect();
      }
  
***************
*** 228,239 ****
          }
  
-         // Connect to database server
-         $db = $this->_connect();
- 
          // Run query
          if ($ignore_errors == 1) {
!             $result = @mysql_query($sql,$db);
          } else {
!             $result = @mysql_query($sql,$db) or die($this->dbError($sql));
          }
  
--- 231,239 ----
          }
  
          // Run query
          if ($ignore_errors == 1) {
!             $result = @mysql_query($sql,$this->_db);
          } else {
!             $result = @mysql_query($sql,$this->_db) or die($this->dbError($sql));
          }
  
***************
*** 672,677 ****
              }
          }
! 	
! 	return;
      }
  }
--- 672,677 ----
              }
          }
! 
!         return;
      }
  }




More information about the geeklog-cvs mailing list