phpOpenTracker/phpOpenTracker/Database/Driver MSSQL.php,1.2,1.3 MySQL.php,1.2,1.3 Oracle.php,1.2,1.3 PostgreSQL.php,1.2,1.3

Sebastian Bergmann <[email protected]>
Newsgroups gmane.comp.web.phpopentracker.cvs
Message-ID <[email protected]>
Update of /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/Database/Driver
In directory sc8-pr-cvs1:/tmp/cvs-serv5432/Driver

Modified Files:
	MSSQL.php MySQL.php Oracle.php PostgreSQL.php 
Log Message:
Flush.

Index: Oracle.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/Database/Driver/Oracle.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Oracle.php	16 Dec 2003 11:08:53 -0000	1.2
--- Oracle.php	16 Dec 2003 11:24:30 -0000	1.3
***************
*** 16,19 ****
--- 16,38 ----
  
  class phpOpenTracker_Database_Driver_Oracle extends phpOpenTracker_Database_Driver {
+     protected function connect() {
+         $database = ($this->config['db_database'] == 'default') ? '' : $this->config['db_database'];
+ 
+         $this->connection = @OCILogon(
+           $this->config['db_user'],
+           $this->config['db_password'],
+           $database
+         );
+ 
+         if (!$this->connection) {
+           throw new phpOpenTracker_Database_Exception(
+             'Could not connect to database.'
+           );
+         }
+     }
+ 
+     protected function disconnect() {
+     }
+ 
      protected function fetchRow() {
          if (is_resource($this->result)) {

Index: MSSQL.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/Database/Driver/MSSQL.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MSSQL.php	16 Dec 2003 11:08:53 -0000	1.2
--- MSSQL.php	16 Dec 2003 11:24:30 -0000	1.3
***************
*** 16,19 ****
--- 16,42 ----
  
  class phpOpenTracker_Database_Driver_MSSQL extends phpOpenTracker_Database_Driver {
+     protected function connect() {
+         $this->connection = @mssql_connect(
+           $this->config['db_host'],
+           $this->config['db_user'],
+           $this->config['db_password']
+         );
+ 
+         if (!$this->connection) {
+           throw new phpOpenTracker_Database_Exception(
+             'Could not connect to database.'
+           );
+         }
+ 
+         if (!@mssql_select_db($this->config['db_database'], $this->connection)) {
+           throw new phpOpenTracker_Database_Exception(
+             'Could not select database.'
+           );
+         }
+     }
+ 
+     protected function disconnect() {
+     }
+ 
      protected function fetchRow() {
          if (is_resource($this->result)) {

Index: PostgreSQL.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/Database/Driver/PostgreSQL.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** PostgreSQL.php	16 Dec 2003 11:08:53 -0000	1.2
--- PostgreSQL.php	16 Dec 2003 11:24:30 -0000	1.3
***************
*** 16,19 ****
--- 16,39 ----
  
  class phpOpenTracker_Database_Driver_PostgreSQL extends phpOpenTracker_Database_Driver {
+     protected function connect() {
+         $connectionString = sprintf(
+           "%s %s dbname=%s user=%s password=%s",
+           ($this->config['db_host'] == 'socket')  ? '' : 'host=' . $this->config['db_host'],
+           ($this->config['db_port'] == 'default') ? '' : 'port=' . $this->config['db_port'],
+           $this->config['db_database'],
+           $this->config['db_user'],
+           $this->config['db_password']
+         );
+ 
+         if (!$this->connection = @pg_connect($connectionString)) {
+           throw new phpOpenTracker_Database_Exception(
+             'Could not connect to database.'
+           );
+         }
+     }
+ 
+     protected function disconnect() {
+     }
+ 
      public function prepareString($string) {
          return str_replace(

Index: MySQL.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/Database/Driver/MySQL.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MySQL.php	16 Dec 2003 11:08:53 -0000	1.2
--- MySQL.php	16 Dec 2003 11:24:30 -0000	1.3
***************
*** 16,23 ****
--- 16,38 ----
  
  class phpOpenTracker_Database_Driver_MySQL extends phpOpenTracker_Database_Driver {
+     protected function connect() {
+     }
+ 
+     protected function disconnect() {
+     }
+ 
      public function prepareString($string) {
      }
  
      protected function fetchRow() {
+         if (is_resource($this->result)) {
+             $row = @mysqli_fetch_assoc($this->result);
+ 
+             if (is_array($row)) {
+                 return $row;
+             }
+         }
+ 
+         return false;
      }
  




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.