Fixed bug #10003: t3lib_db explainOutput does not work with table alias (thanks to...
authorXavier Perseguers <typo3@perseguers.ch>
Wed, 3 Mar 2010 09:41:13 +0000 (09:41 +0000)
committerXavier Perseguers <typo3@perseguers.ch>
Wed, 3 Mar 2010 09:41:13 +0000 (09:41 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7073 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_db.php

index 52b2cac..2a6b425 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-03-03  Xavier Perseguers  <typo3@perseguers.ch>
+
+       * Fixed bug #10003: t3lib_db explainOutput does not work with table alias (thanks to Dan Osipov)
+
 2010-02-27  Andreas Otto  <andreas@otto-hanika.de>
 
        * Fixed bug #13685: Recursive copy and move of alternative page languages (thanks to Albrecht K√∂hnlein)
index 46cc175..32272fc 100644 (file)
@@ -1459,13 +1459,18 @@ class t3lib_DB {
                        $debug = true;
 
                        foreach ($explain_tables as $table) {
-                               $res = $this->sql_query('SHOW INDEX FROM ' . $table, $this->link);
-                               if (is_resource($res)) {
-                                       while ($tempRow = $this->sql_fetch_assoc($res)) {
-                                               $indices_output[] = $tempRow;
+                               $tableRes = $this->sql_query('SHOW TABLE STATUS LIKE \'' . $table . '\'');
+                               $isTable = $this->sql_num_rows($tableRes);
+                               if ($isTable) {
+                                       $res = $this->sql_query('SHOW INDEX FROM ' . $table, $this->link);
+                                       if (is_resource($res)) {
+                                               while ($tempRow = $this->sql_fetch_assoc($res)) {
+                                                       $indices_output[] = $tempRow;
+                                               }
+                                               $this->sql_free_result($res);
                                        }
-                                       $this->sql_free_result($res);
                                }
+                               $this->sql_free_result($tableRes);
                        }
                } else {
                        $debug = false;