[TASK] Provide QueryHelper to prepare SQL fragments for the QueryBuilder 36/47636/4
authorMorton Jonuschat <m.jonuschat@mojocode.de>
Tue, 12 Apr 2016 20:52:16 +0000 (22:52 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Wed, 13 Apr 2016 06:24:40 +0000 (08:24 +0200)
commit5cf26f1adcd93d8c9861a1a38e28ece84b376f1a
tree11592a26fb27b76eb82f3b0685df3a3c8588b52e
parent1afd95e1a9c02e4eabcb662dc3c0991d64c86531
[TASK] Provide QueryHelper to prepare SQL fragments for the QueryBuilder

The QueryHelper deals with GROUP BY and ORDER BY strings coming from
sources where the data format is not strictly defined and the input
might be a string prefixes or otherwise unsuitable for immediate further
usage.

For GROUP BY strings the prefix is removed and the remainder of the
string is treated as a comma separated list of column names that get
parsed into an array.

For ORDER BY strings the prefix is removed and the remainder of the
string is treated as a list of comma separated column names, possibly
with a sort direction separated from the column name, that gets parsed
into an array.

For WHERE SQL fragments leading the leading logical operators "AND" and
"OR" get removed, no further modifications are performed on the string.

Resolves: #75559
Releases: master
Change-Id: I37016eda6597cab49b274f498188a8579dec7b2c
Reviewed-on: https://review.typo3.org/47636
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/core/Classes/Database/Query/QueryHelper.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Database/Query/QueryHelperTest.php [new file with mode: 0644]