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
ec407c8f
Commit
ec407c8f
authored
Nov 03, 2019
by
Carsten Rose
Browse files
Extend QIFEMPTY: empty a) date, b) datetime, c) '0' is also treated as empty.
parent
aa498e00
Pipeline
#2580
passed with stages
in 2 minutes and 47 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Documentation/Manual.rst
View file @
ec407c8f
...
...
@@ -6916,7 +6916,7 @@ Output::
QIFEMPTY: if empty show token
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The SQL function QIFEMPTY(input, token) returns 'token' if 'input' is empty
else 'input
'.
The SQL function QIFEMPTY(input, token) returns 'token' if 'input' is
'
empty
string' / '0' / '0000-00-00' / '0000-00-00 00:00:00
'.
Example::
...
...
extension/Classes/Sql/function.sql
View file @
ec407c8f
...
...
@@ -71,7 +71,7 @@ END;
###
#
#
QIFEMPTY
(
input
,
token
)
#
If
'input'
is
empty
,
replace
s
by
'token'
#
If
'input'
is
empty
|
0
|
0000
-
00
-
00
|
0000
-
00
-
00
00
:
00
:
00
,
replace
by
'token'
#
DROP
FUNCTION
IF
EXISTS
QIFEMPTY
;
CREATE
FUNCTION
QIFEMPTY
(
input
TEXT
,
token
TEXT
)
...
...
@@ -80,7 +80,9 @@ CREATE FUNCTION QIFEMPTY(input TEXT, token TEXT)
SQL
SECURITY
INVOKER
BEGIN
DECLARE
output
TEXT
;
SET
output
=
IF
(
input
=
''
,
token
,
input
);
SET
output
=
IF
(
ISNULL
(
input
)
OR
input
=
''
OR
INPUT
=
'0'
OR
input
=
'0000-00-00'
OR
input
=
'0000-00-00 00:00:00'
,
token
,
input
);
RETURN
output
;
END
;
...
...
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