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

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-serv3095/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.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Oracle.php	24 Nov 2003 20:26:35 -0000	1.1
--- Oracle.php	16 Dec 2003 11:08:53 -0000	1.2
***************
*** 16,19 ****
--- 16,70 ----
  
  class phpOpenTracker_Database_Driver_Oracle extends phpOpenTracker_Database_Driver {
+     protected function fetchRow() {
+         if (is_resource($this->result)) {
+             if (@OCIFetchInto($this->result, $result, OCI_ASSOC)) {
+                 return array_change_key_case($result, CASE_LOWER);
+             }
+         } else {
+             return false;
+         }
+     }
+ 
+     protected function executeQuery($query, $isManip, $limit) {
+         if ($limit !== false) {
+             $query = sprintf(
+               'SELECT * FROM (%s) WHERE ROWNUM <= %d',
+ 
+             $query,
+             $limit
+           );
+         }
+ 
+         if ($this->configuration['debug_level'] > 1) {
+             $this->debugQuery($query);
+         }
+ 
+         if (is_resource($this->result)) {
+           @OCIFreeStatement($this->result);
+         }
+ 
+         $this->result = @OCIParse($this->connection, $query);
+ 
+         if (!$this->result) {
+             $this->result = null;
+ 
+             throw new phpOpenTracker_Database_Exception(
+               'Database query failed.'
+             );
+         }
+ 
+         @OCIExecute($this->result);
+ 
+         if (!$this->result) {
+             $this->result = null;
+ 
+             throw new phpOpenTracker_Database_Exception(
+               'Database query failed.'
+             );
+         }
+     }
+ 
+     protected function debugQuery($query) {
+     }
  }
  

Index: MSSQL.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/Database/Driver/MSSQL.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MSSQL.php	24 Nov 2003 20:26:35 -0000	1.1
--- MSSQL.php	16 Dec 2003 11:08:53 -0000	1.2
***************
*** 16,19 ****
--- 16,61 ----
  
  class phpOpenTracker_Database_Driver_MSSQL extends phpOpenTracker_Database_Driver {
+     protected function fetchRow() {
+         if (is_resource($this->result)) {
+             $row = @mssql_fetch_assoc($this->result);
+ 
+             if (is_array($row)) {
+                 return $row;
+             }
+         }
+ 
+         return false;
+     }
+ 
+     protected function executeQuery($query, $isManip, $limit) {
+         if ($limit !== false) {
+             $query = str_replace(
+               'SELECT',
+               'SELECT TOP ' . $limit,
+               $query
+             );
+         }
+ 
+         if ($this->configuration['debug_level'] > 1) {
+             $this->debugQuery($query);
+         }
+ 
+         if (is_resource($this->result)) {
+           @mssql_free_result($this->result);
+         }
+ 
+         $this->result = @mssql_query($query, $this->connection);
+ 
+         if (!$this->result) {
+             $this->result = null;
+ 
+             throw new phpOpenTracker_Database_Exception(
+               'Database query failed.'
+             );
+         }
+     }
+ 
+     protected function debugQuery($query) {
+     }
  }
  

Index: PostgreSQL.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/Database/Driver/PostgreSQL.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PostgreSQL.php	24 Nov 2003 20:26:35 -0000	1.1
--- PostgreSQL.php	16 Dec 2003 11:08:53 -0000	1.2
***************
*** 16,19 ****
--- 16,61 ----
  
  class phpOpenTracker_Database_Driver_PostgreSQL extends phpOpenTracker_Database_Driver {
+     public function prepareString($string) {
+         return str_replace(
+           array("'",  '\\'),
+           array("''", '\\\\'),
+           substr($string, 0, 254)
+         );
+     }
+ 
+     protected function fetchRow() {
+         if (is_resource($this->result)) {
+             return @pg_fetch_array($this->result);
+         } else {
+             return false;
+         }
+     }
+ 
+     protected function executeQuery($query, $isManip, $limit) {
+         if ($limit !== false) {
+             $query .= ' LIMIT ' . $limit;
+         }
+ 
+         if ($this->configuration['debug_level'] > 1) {
+             $this->debugQuery($query);
+         }
+ 
+         if (is_resource($this->result)) {
+           @pg_freeresult($this->result);
+         }
+ 
+         $this->result = @pg_exec($this->connection, $query);
+ 
+         if (!$this->result) {
+             $this->result = null;
+ 
+             throw new phpOpenTracker_Database_Exception(
+               'Database query failed.'
+             );
+         }
+     }
+ 
+     protected function debugQuery($query) {
+     }
  }
  

Index: MySQL.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/Database/Driver/MySQL.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MySQL.php	24 Nov 2003 20:26:35 -0000	1.1
--- MySQL.php	16 Dec 2003 11:08:53 -0000	1.2
***************
*** 16,19 ****
--- 16,30 ----
  
  class phpOpenTracker_Database_Driver_MySQL extends phpOpenTracker_Database_Driver {
+     public function prepareString($string) {
+     }
+ 
+     protected function fetchRow() {
+     }
+ 
+     protected function executeQuery($query, $isManip, $limit) {
+     }
+ 
+     protected function debugQuery($query) {
+     }
  }
  




-------------------------------------------------------
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.