use object error retrieval functions, that work properly within connection context
authorDomas Mituzas <midom@users.mediawiki.org>
Sat, 15 Jul 2006 19:22:37 +0000 (19:22 +0000)
committerDomas Mituzas <midom@users.mediawiki.org>
Sat, 15 Jul 2006 19:22:37 +0000 (19:22 +0000)
includes/Database.php

index f8e579b..79de313 100644 (file)
@@ -760,8 +760,8 @@ class Database {
         */
        function fetchObject( $res ) {
                @/**/$row = mysql_fetch_object( $res );
-               if( mysql_errno() ) {
-                       throw new DBUnexpectedError( $this, 'Error in fetchObject(): ' . htmlspecialchars( mysql_error() ) );
+               if( $this->lastErrno() ) {
+                       throw new DBUnexpectedError( $this, 'Error in fetchObject(): ' . htmlspecialchars( $this->lastError() ) );
                }
                return $row;
        }
@@ -772,8 +772,8 @@ class Database {
         */
        function fetchRow( $res ) {
                @/**/$row = mysql_fetch_array( $res );
-               if (mysql_errno() ) {
-                       throw new DBUnexpectedError( $this, 'Error in fetchRow(): ' . htmlspecialchars( mysql_error() ) );
+               if ( $this->lastErrno() ) {
+                       throw new DBUnexpectedError( $this, 'Error in fetchRow(): ' . htmlspecialchars( $this->lastError() ) );
                }
                return $row;
        }
@@ -783,8 +783,8 @@ class Database {
         */
        function numRows( $res ) {
                @/**/$n = mysql_num_rows( $res );
-               if( mysql_errno() ) {
-                       throw new DBUnexpectedError( $this, 'Error in numRows(): ' . htmlspecialchars( mysql_error() ) );
+               if( $this->lastErrno() ) {
+                       throw new DBUnexpectedError( $this, 'Error in numRows(): ' . htmlspecialchars( $this->lastError() ) );
                }
                return $n;
        }