ORM: pass some __METHOD__ to database functions
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 23 Nov 2012 14:29:46 +0000 (15:29 +0100)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 9 Dec 2012 16:07:42 +0000 (16:07 +0000)
Change-Id: Ic76f88fe682118a097964e4011678ef4ad69113b

includes/db/ORMRow.php
includes/db/ORMTable.php

index d64530f..5c730fb 100644 (file)
@@ -120,7 +120,8 @@ abstract class ORMRow implements IORMRow {
                        $result = $this->table->rawSelectRow(
                                $this->table->getPrefixedFields( $fields ),
                                array( $this->table->getPrefixedField( 'id' ) => $this->getId() ),
-                               array( 'LIMIT' => 1 )
+                               array( 'LIMIT' => 1 ),
+                               __METHOD__
                        );
 
                        if ( $result !== false ) {
@@ -418,7 +419,7 @@ abstract class ORMRow implements IORMRow {
        public function remove() {
                $this->beforeRemove();
 
-               $success = $this->table->delete( array( 'id' => $this->getId() ) );
+               $success = $this->table->delete( array( 'id' => $this->getId() ), __METHOD__ );
 
                // DatabaseBase::delete does not always return true for success as documented...
                $success = $success !== false;
index e3c8aa7..1292963 100644 (file)
@@ -332,7 +332,8 @@ abstract class ORMTable extends DBAccessBase implements IORMTable {
                $res = $this->rawSelectRow(
                        array( 'rowcount' => 'COUNT(*)' ),
                        $this->getPrefixedValues( $conditions ),
-                       $options
+                       $options,
+                       __METHOD__
                );
 
                return $res->rowcount;
@@ -354,7 +355,7 @@ abstract class ORMTable extends DBAccessBase implements IORMTable {
                $result = $dbw->delete(
                        $this->getName(),
                        $conditions === array() ? '*' : $this->getPrefixedValues( $conditions ),
-                       $functionName
+                       is_null( $functionName ) ? __METHOD__ : $functionName
                ) !== false; // DatabaseBase::delete does not always return true for success as documented...
 
                $this->releaseConnection( $dbw );