Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
9d5751f6
Commit
9d5751f6
authored
Aug 21, 2019
by
Carsten Rose
Browse files
Add QIFEMPTY().
parent
2c6246ad
Pipeline
#2203
passed with stages
in 2 minutes and 44 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Documentation/Manual.rst
View file @
9d5751f6
...
...
@@ -6729,9 +6729,24 @@ Example::
10.sql = SELECT QMORE("This is a text which is longer than 10 characters", 10)
Output:
Output:
:
This is a `more..`
This is a `more..`
.. _qifempty:
QIFEMPTY: if empty show token
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The SQL function QIFEMPTY(input, token) returns 'token' if 'input' is empty else 'input'.
Example::
10.sql = SELECT QIFEMPTY('hello world','-'), QIFEMPTY('','-')
Output::
hello world-
.. _download:
...
...
extension/Classes/Sql/function.sql
View file @
9d5751f6
...
...
@@ -51,7 +51,6 @@ SET output = REPLACE(input, '|', '\\|');
RETURN
output
;
END
;
###
#
#
QNL2BR
(
input
)
...
...
@@ -65,4 +64,19 @@ BEGIN
DECLARE
output
TEXT
;
SET
output
=
REPLACE
(
REPLACE
(
input
,
CHAR
(
13
),
''
),
CHAR
(
10
),
'<br>'
);
RETURN
output
;
END
\ No newline at end of file
END
;
###
#
#
QIFEMPTY
(
input
,
token
)
#
If
'input'
is
empty
,
replaces
by
'token'
#
DROP
FUNCTION
IF
EXISTS
QIFEMPTY
;
CREATE
FUNCTION
QIFEMPTY
(
input
TEXT
,
token
TEXT
)
RETURNS
TEXT
DETERMINISTIC
BEGIN
DECLARE
output
TEXT
;
SET
output
=
IF
(
input
=
''
,
token
,
input
);
RETURN
output
;
END
;
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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