Fixed bug #3855: Log number of returned or affected rows
authorXavier Perseguers <typo3@perseguers.ch>
Sat, 19 Jun 2010 12:51:49 +0000 (12:51 +0000)
committerXavier Perseguers <typo3@perseguers.ch>
Sat, 19 Jun 2010 12:51:49 +0000 (12:51 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/dbal/trunk@34572 735d13b6-9817-0410-8766-e36946ffe9aa

typo3/sysext/dbal/ChangeLog
typo3/sysext/dbal/class.ux_t3lib_db.php
typo3/sysext/dbal/doc/manual.sxw

index c5dcb1e..90a9f93 100644 (file)
@@ -1,5 +1,6 @@
 2010-06-19  Xavier Perseguers  <typo3@perseguers.ch>
 
+       * Fixed bug #3855: Log number of returned or affected rows
        * Updated copyright year in manual
 
 2010-06-12  Xavier Perseguers  <typo3@perseguers.ch>
index 7e241ef..2885330 100644 (file)
@@ -738,14 +738,18 @@ class ux_t3lib_DB extends t3lib_DB {
                }
 
                if ($this->debug) {
+                       $data = array(
+                               'handlerType' => $hType,
+                               'args' => array($from_table, $select_fields, $where_clause, $groupBy, $orderBy, $limit),
+                               'ORIG_from_table' => $ORIG_tableName,
+                       );
+                       if ($this->conf['debugOptions']['numberRows']) {
+                               $data['numberRows'] = $this->sql_num_rows($sqlResult);
+                       }
                        $this->debugHandler(
                                'exec_SELECTquery',
                                t3lib_div::milliseconds()-$pt,
-                               array(
-                                       'handlerType' => $hType,
-                                       'args' => array($from_table,$select_fields,$where_clause,$groupBy,$orderBy,$limit),
-                                       'ORIG_from_table' => $ORIG_tableName
-                               )
+                               $data
                        );
                }
 
@@ -3219,6 +3223,19 @@ class ux_t3lib_DB extends t3lib_DB {
                                $query = $this->lastQuery;
                        }
 
+                       if ($this->conf['debugOptions']['numberRows']) {
+                               switch ($function) {
+                                       case 'exec_INSERTquery':
+                                       case 'exec_UPDATEquery':
+                                       case 'exec_DELETEquery':
+                                               $data['numberRows'] = $this->sql_affected_rows();
+                                               break;
+                                       case 'exec_SELECTquery':
+                                               $data['numberRows'] = $inData['numberRows'];
+                                               break;
+                               }
+                       }
+
                        if ($this->conf['debugOptions']['backtrace']) {
                                $backtrace = debug_backtrace();
                                unset($backtrace[0]); // skip this very method :)
index 58cff19..fa2f4a8 100644 (file)
Binary files a/typo3/sysext/dbal/doc/manual.sxw and b/typo3/sysext/dbal/doc/manual.sxw differ