Commit 87af8060 authored by Carsten  Rose's avatar Carsten Rose
Browse files

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

parent f6f4290c
......@@ -2089,6 +2089,8 @@ Parameter
+-----------------------------+--------+----------------------------------------------------------------------------------------------------------+
| class | string | HTML div with given class, surrounding the whole form. Eg.: class=container-fluid. |
+-----------------------------+--------+----------------------------------------------------------------------------------------------------------+
| classTitle | string | CSS class inside of the `title` div. Default 'qfq-form-title'. |
+-----------------------------+--------+----------------------------------------------------------------------------------------------------------+
| classPill | string | HTML div with given class, surrounding the `pill` title line. |
+-----------------------------+--------+----------------------------------------------------------------------------------------------------------+
| classBody | string | HTML div with given class, surrounding all *FormElement*. |
......
......@@ -125,7 +125,8 @@ class BuildFormBootstrap extends AbstractBuildForm {
// Show title / frame only if there is a title given.
if ($this->formSpec[F_TITLE] != '') {
$title = Support::wrapTag('<div class="row"><div class="col-md-12">', Support::wrapTag('<div class="qfq-form-title">', $this->formSpec[F_TITLE]));
$classTitle = isset($this->formSpec[F_CLASS_TITLE]) ? $this->formSpec[F_CLASS_TITLE] : "qfq-form-title";
$title = Support::wrapTag('<div class="row"><div class="col-md-12">', Support::wrapTag('<div class="' . $classTitle .'">', $this->formSpec[F_TITLE]));
}
$html .= $button . $title;
......
......@@ -801,6 +801,7 @@ const F_ESCAPE_TYPE_DEFAULT = SYSTEM_ESCAPE_TYPE_DEFAULT;
const F_CLASS = 'class';
const F_CLASS_PILL = 'classPill';
const F_CLASS_BODY = 'classBody';
const F_CLASS_TITLE = 'classTitle';
const F_SHOW_BUTTON = 'showButton';
......
......@@ -284,15 +284,22 @@ class Database {
* @return string
*/
private function getSqlHint($sql){
$msg = '';
// Check if there is a comma before FROM: 'SELECT ... , FROM ...'
$pos=stripos($sql, ' FROM ');
if($pos!==false && $pos>0 && $sql[$pos -1]==','){
return 'HINT: remove extra "," before FROM';
$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";
}
return '';
return $msg;
}
/**
......
......@@ -329,7 +329,8 @@ class Sip {
* @param string|array $vars
*
* @return string
* @throws \qfq\UserFormException
* @throws UserFormException
* @throws UserReportException
*/
public function debugSip($vars) {
......
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