Reduce some PHP oddities, implement Seek() properly
authorJoey Schulze <joey@infodrom.org>
Wed, 24 Mar 2010 21:44:06 +0000 (22:44 +0100)
committerJoey Schulze <joey@infodrom.org>
Wed, 24 Mar 2010 21:44:06 +0000 (22:44 +0100)
lib/dbClass.php
lib/rico/dbClass2.php

index 191f334..7dab19f 100644 (file)
@@ -16,9 +16,9 @@ class dbClass_postgresql
   function FieldType($rsMain,$i) { return pg_field_type($rsMain,$i); }
   function FetchRow($rsMain,&$result) { $result=pg_fetch_row($rsMain); return ($result==false) ? false : true; }
   function FetchAssoc($rsMain,&$result) { $result=pg_fetch_assoc($rsMain); return ($result==false) ? false : true; }
-  function FetchArray($rsMain,&$result) { $result=pg_fetch_array($rsMain,MYSQL_NUM); return ($result==false) ? false : true; }
+  function FetchArray($rsMain,&$result) { $result=pg_fetch_array($rsMain); return ($result==false) ? false : true; }
   function AffectedRows($rsMain) { return pg_affected_rows($this->conn); }
-  function Seek($rsMain,$offset) { error_log("mysql_data_seek($rsMain,$offset);"); return false; }
+  function Seek($rsMain,$offset) { return pg_result_seek($rsMain,$offset); }
   function RunParamQuery($query, $phs = array()) {
     foreach ($phs as $ph) {   // from php.net
       if ( isset($ph) ) {
@@ -95,7 +95,7 @@ class dbClass extends dbClassRico
 
     $dsn = sprintf('host=%s dbname=%s user=%s password=%s',DBHOST,$DefDB,$userid,$pw);
     $this->dbMain = pg_connect($dsn);
-    $this->db =& new dbClass_postgresql($this->dbMain);
+    $this->db = new dbClass_postgresql($this->dbMain);
 
     if ($this->dbMain === false && $this->CheckForError("opening connection")) return false;
     return true;
index 891d124..48f5af9 100644 (file)
@@ -865,7 +865,7 @@ class dbClassRico
     $this->dbDefault = $DefDB;
     $this->dbMain = mysql_connect($this->Provider,$userid,$pw);
     mysql_select_db($DefDB,$this->dbMain);
-    $this->db =& new dbClass_mysql($this->dbMain);
+    $this->db = new dbClass_mysql($this->dbMain);
     if ($this->CheckForError("opening connection")) return false;
     return true;
   }
@@ -878,7 +878,7 @@ class dbClassRico
     $this->Dialect="Oracle";
     $this->dbDefault = $user;
     $this->dbMain = ocilogon($user,$pw,$sim);
-    $this->db =& new dbClass_oci($this->dbMain);
+    $this->db = new dbClass_oci($this->dbMain);
     if ($this->CheckForError("opening connection")) return false;
     $this->RunActionQuery("alter session set nls_date_format = 'YYYY-MM-DD HH24:MI:SS'");
     return true;
@@ -897,7 +897,7 @@ class dbClassRico
       $this->LastErrorMsg="Error while connecting to ".$servername;
       return false;
     }
-    $this->db =& new dbClass_mssql($this->dbMain);
+    $this->db = new dbClass_mssql($this->dbMain);
     mssql_select_db($DefDB,$this->dbMain);
     return true;
   }