added wfFetchRow() besides wfFetchObject. Used by objectcache code
authorDomas Mituzas <midom@users.mediawiki.org>
Thu, 10 Jun 2004 13:02:27 +0000 (13:02 +0000)
committerDomas Mituzas <midom@users.mediawiki.org>
Thu, 10 Jun 2004 13:02:27 +0000 (13:02 +0000)
includes/Database.php
includes/DatabaseFunctions.php
includes/DatabasePostgreSQL.php

index c1b258d..3209c50 100644 (file)
@@ -1,4 +1,8 @@
 <?php
+# $Id$
+# This file deals with MySQL interface functions 
+# and query specifics/optimisations
+#
 require_once( "CacheManager.php" );
 
 define( "DB_READ", -1 );
@@ -205,6 +209,15 @@ class Database {
                }
                return $row;
        }
+       
+       function fetchRow( $res ) {
+               @$row = mysql_fetch_array( $res );
+               if (mysql_errno() ) {
+                       wfDebugDieBacktrace( "SQL error: " . htmlspecialchars( mysql_error() ) );
+               }
+               return $row;
+       }       
+
        function numRows( $res ) {
                @$n = mysql_num_rows( $res ); 
                if( mysql_errno() ) {
index 6244ea7..89f1bef 100644 (file)
@@ -91,6 +91,12 @@ function wfFetchObject( $res )
        return $db->fetchObject( $res ); 
 }
 
+function wfFetchRow( $res )
+{
+       $db =& wfGetDB();
+       return $db->fetchRow ( $res );
+}
+
 function wfNumRows( $res ) 
 { 
        $db =& wfGetDB();
index 1f43e0b..eade5b5 100644 (file)
@@ -209,6 +209,15 @@ class Database {
                }
                return $row;
        }
+
+       function fetchRow( $res ) {
+               @$row = pg_fetch_array( $res );
+                if( pg_last_error($this->mConn) ) {
+                        wfDebugDieBacktrace( "SQL error: " . htmlspecialchars( pg_last_error($this->mConn) ) );
+                }
+               return $row;
+       }
+
        function numRows( $res ) {
                @$n = pg_num_rows( $res ); 
                if( pg_last_error($this->mConn) ) {