Commit 52b5f919 authored by Carsten  Rose's avatar Carsten Rose
Browse files

sqlHint: Note if a query fails and contains some unreplaced variables.

parent 87af8060
......@@ -289,14 +289,14 @@ class Database {
// Check if there is a comma before FROM: 'SELECT ... , FROM ...'
$pos=stripos($sql, ' FROM ');
if($pos!==false && $pos>0 && $sql[$pos -1]==','){
$msg .= "HINT: remove extra ',' before FROM\n";
$msg .= "HINT: Remove extra ',' before FROM\n";
}
// Look for QFQ variables which haven't been replaced
$matches=array();
preg_match_all( "/{{[^}}]*}}/", $sql, $matches);
if(count($matches[0])>0){
$msg .= "The following variables couldn't be replaced: " . implode(', ', $matches[0]) . "\n";
$msg .= "HINT: The following variables couldn't be replaced: " . implode(', ', $matches[0]) . "\n";
}
return $msg;
......
......@@ -117,6 +117,7 @@ class AbstractException extends \Exception {
}
$htmlDebug = OnArray::arrayToHtmlTable(OnArray::htmlentitiesOnArray(array_merge($arrMsg, $arrDebugShow)), 'Debug', EXCEPTION_TABLE_CLASS);
$htmlDebug = str_replace("\n", "<br>", $htmlDebug);
$arrDebugHiddenClean = OnArray::htmlentitiesOnArray($arrDebugHidden);
$arrDebugHiddenClean[EXCEPTION_STACKTRACE] = implode($arrTrace, '<br>');
......@@ -129,7 +130,7 @@ class AbstractException extends \Exception {
}
}
$qfqLog = ($store==null) ? SYSTEM_QFQ_LOG_FILE : $store->getVar(SYSTEM_QFQ_LOG, STORE_SYSTEM);
$qfqLog = ($store == null) ? SYSTEM_QFQ_LOG_FILE : $store->getVar(SYSTEM_QFQ_LOG, STORE_SYSTEM);
$arrDebugHidden[EXCEPTION_STACKTRACE] = PHP_EOL . implode($arrTrace, PHP_EOL);
$arrLogAll = array_merge($arrMsg, $arrShow, $arrDebugShow, $arrDebugHidden);
$logAll = OnArray::arrayToLog($arrLogAll);
......@@ -151,6 +152,7 @@ class AbstractException extends \Exception {
return OnArray::filterValueSubstring($arrTrace, '/typo3conf/ext/' . EXT_KEY . '/');
}
/**
* @param $arrShow
* @return string
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment