Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
52b5f919
Commit
52b5f919
authored
Jun 20, 2018
by
Carsten Rose
Browse files
sqlHint: Note if a query fails and contains some unreplaced variables.
parent
87af8060
Changes
2
Hide whitespace changes
Inline
Side-by-side
extension/qfq/qfq/database/Database.php
View file @
52b5f919
...
...
@@ -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:
r
emove extra ',' before FROM
\n
"
;
$msg
.
=
"HINT:
R
emove 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
;
...
...
extension/qfq/qfq/exceptions/AbstractException.php
View file @
52b5f919
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment