2 declare(strict_types = 1);
44 $input = preg_replace(
'/^(?:ORDER[[:space:]]*BY[[:space:]]*)+/i',
'', trim($input)) ?:
'';
45 $orderExpressions = GeneralUtility::trimExplode(
',', $input,
true);
48 function ($expression) {
49 $fieldNameOrderArray = GeneralUtility::trimExplode(
' ', $expression,
true);
50 $fieldName = $fieldNameOrderArray[0] ??
null;
51 $order = $fieldNameOrderArray[1] ??
null;
53 return [$fieldName, $order];
72 $input = preg_replace(
'/^(?:FROM[[:space:]]+)+/i',
'', trim($input)) ?:
'';
73 $tableExpressions = GeneralUtility::trimExplode(
',', $input,
true);
76 function ($expression) {
77 [$tableName, $as, $alias] = array_pad(GeneralUtility::trimExplode(
' ', $expression,
true), 3,
null);
79 if (!empty($as) && strtolower($as) ===
'as' && !empty($alias)) {
80 return [$tableName, $alias];
82 if (!empty($as) && empty($alias)) {
83 return [$tableName, $as];
85 return [$tableName,
null];
102 $input = preg_replace(
'/^(?:GROUP[[:space:]]*BY[[:space:]]*)+/i',
'', trim($input)) ?:
'';
104 return GeneralUtility::trimExplode(
',', $input,
true);
115 $input = trim($input);
116 $quoteCharacter =
' ';
118 if ($input[0] ===
'`' || $input[0] ===
'"') {
119 $quoteCharacter .= $input[0];
120 $input = substr($input, 1);
121 $tableName = strtok($input, $quoteCharacter);
123 $tableName = strtok($input, $quoteCharacter);
126 $tableAlias = strtok($quoteCharacter);
127 if (strtolower($tableAlias) ===
'as') {
128 $tableAlias = strtok($quoteCharacter);
131 $joinCondition = strtok(
'');
132 } elseif (strtolower($tableAlias) ===
'on') {
134 $joinCondition = strtok(
'');
138 $joinCondition = strtok(
'');
144 $firstCharacterOfTableAlias = $tableAlias[0] ??
null;
145 if ($firstCharacterOfTableAlias ===
'`' || $firstCharacterOfTableAlias ===
'"') {
146 $tableAlias = substr($tableAlias, 1, -1);
149 $tableAlias = $tableAlias ?: $tableName;
151 return [
'tableName' => $tableName,
'tableAlias' => $tableAlias,
'joinCondition' => $joinCondition];
165 return preg_replace(
'/^(?:(AND|OR)[[:space:]]*)+/i',
'', trim($constraint)) ?:
'';
179 'empty' =>
'0000-00-00',
183 'empty' =>
'0000-00-00 00:00:00',
184 'format' =>
'Y-m-d H:i:s'
187 'empty' =>
'00:00:00',
219 if (strpos($sql,
'{#') !==
false) {
220 $sql = preg_replace_callback(
221 '/{#(?P<identifier>[^}]+)}/',
222 function (array $matches) use ($connection) {