Include function name for SQL statements dumped to debug log
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 18 Mar 2005 04:22:05 +0000 (04:22 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 18 Mar 2005 04:22:05 +0000 (04:22 +0000)
includes/Database.php

index 2364551..64004f6 100644 (file)
@@ -274,17 +274,17 @@ class Database {
                
                $this->mLastQuery = $sql;
                
-               if ( $this->debug() ) {
-                       $sqlx = substr( $sql, 0, 500 );
-                       $sqlx = wordwrap(strtr($sqlx,"\t\n",'  '));
-                       wfDebug( "SQL: $sqlx\n" );
-               }
                # Add a comment for easy SHOW PROCESSLIST interpretation
                if ( $fname ) {
                        $commentedSql = "/* $fname */ $sql";
                } else {
                        $commentedSql = $sql;
                }
+               if ( $this->debug() ) {
+                       $sqlx = substr( $commentedSql, 0, 500 );
+                       $sqlx = wordwrap(strtr($sqlx,"\t\n",'  '));
+                       wfDebug( "SQL: $sqlx\n" );
+               }
                
                # If DBO_TRX is set, start a transaction
                if ( ( $this->mFlags & DBO_TRX ) && !$this->trxLevel() && $sql != 'BEGIN' ) {