Created
July 31, 2017 07:35
-
-
Save chriwo/b6c035af97016aa0af123b0bdb8d4274 to your computer and use it in GitHub Desktop.
TYPO3 Query debug function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Debugs a SQL query from a QueryResult | |
* | |
* @param QueryResult $queryResult | |
* @param boolean $explainOutput | |
* @return void | |
*/ | |
public function debugQuery(QueryResult $queryResult, $explainOutput = false) | |
{ | |
$GLOBALS['TYPO3_DB']->debugOuput = 2; | |
if ($explainOutput) { | |
$GLOBALS['TYPO3_DB']->explainOutput = true; | |
} | |
$GLOBALS['TYPO3_DB']->store_lastBuiltQuery = true; | |
$queryResult->toArray(); | |
DebuggerUtility::var_dump($GLOBALS['TYPO3_DB']->debug_lastBuiltQuery); | |
$GLOBALS['TYPO3_DB']->store_lastBuiltQuery = false; | |
$GLOBALS['TYPO3_DB']->explainOutput = false; | |
$GLOBALS['TYPO3_DB']->debugOuput = false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment