Bug #18221 » class.t3lib_db.7545.patch
/develop/projects/wiesfurthstr/t3lib/class.t3lib_db.php (working copy) | ||
---|---|---|
* @return boolean True if explain was run, false otherwise
|
||
*/
|
||
protected function explain($query,$from_table,$row_count) {
|
||
$sqlParserObj = t3lib_div::makeInstance('t3lib_sqlparser');
|
||
$from_table = $sqlParserObj->trimSQL($from_table);
|
||
if ((int)$this->explainOutput==1 || ((int)$this->explainOutput==2 && t3lib_div::cmpIP(t3lib_div::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask']))) {
|
||
$explainMode = 1; // raw HTML output
|
||
} elseif ((int)$this->explainOutput==3 && is_object($GLOBALS['TT'])) {
|
||
... | ... | |
$indices_output = array();
|
||
if ($explain_output[0]['rows']>1 || t3lib_div::inList('ALL',$explain_output[0]['type'])) {
|
||
$debug = true; // only enable output if it's really useful
|
||
$res = $this->sql_query('SHOW INDEX FROM '.$from_table, $this->link);
|
||
if (is_resource($res)) {
|
||
while ($tempRow = $this->sql_fetch_assoc($res)) {
|
||
$indices_output[] = $tempRow;
|
||
|
||
$fromPartsArray = $sqlParserObj->parseFromTables($from_table);
|
||
// Split the From Part by the Buildin Parser
|
||
// if parser is succesfull, the rsult is an array
|
||
if (is_array($fromPartsArray)) {
|
||
$fromParts = $sqlParserObj->compileFromTables($fromPartsArray);
|
||
foreach ((explode(',',$fromParts)) as $oneTable) {
|
||
$res = $this->sql_query('SHOW INDEX FROM '.$oneTable, $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);
|
||
}
|
||
} else {
|
||
$debug = false;
|
||
... | ... | |
$data['explain'] = $explain_output;
|
||
}
|
||
if (count($indices_output)) {
|
||
$data['indices'] = $indices;
|
||
$data['indices'] = $indices_output;
|
||
}
|
||
$GLOBALS['TT']->setTSselectQuery($data);
|
||
}
|
- « Previous
- 1
- 2
- Next »