2 namespace TYPO3\CMS\Dbal\Database\SqlCompilers;
47 switch ($components[
'type']) {
64 $query =
'DROP TABLE' . ($components[
'ifExists'] ?
' IF EXISTS' :
'') .
' ' . $components[
'TABLE'];
92 $limit = $components[
'LIMIT'];
94 $query =
'SELECT ' . ($components[
'STRAIGHT_JOIN'] ?:
'') .
' ' .
97 ' WHERE ' . $where :
'') . ($groupBy !==
'' ?
98 ' GROUP BY ' . $groupBy :
'') . ($orderBy !==
'' ?
99 ' ORDER BY ' . $orderBy :
'') . ((
string)$limit !==
'' ?
100 ' LIMIT ' . $limit :
'');
117 foreach ($components[
'FIELDS'] as $fN => $fV) {
121 $query =
'UPDATE ' . $components[
'TABLE'] .
' SET ' . implode(
',', $fields) .
122 ($where !==
'' ?
' WHERE ' . $where :
'');
148 $query =
'DELETE FROM ' . $components[
'TABLE'] . ($where !==
'' ?
' WHERE ' . $where :
'');
181 $query =
'TRUNCATE TABLE ' . $components[
'TABLE'];
196 abstract public function compileFieldList($selectFields, $compileComments =
true, $functionMapping =
true);
236 if ($identifierParts[
'type'] ===
'cast') {
237 return sprintf(
'CAST(%s AS %s)',
238 $identifierParts[
'table'] ? $identifierParts[
'table'] .
'.' . $identifierParts[
'field'] : $identifierParts[
'field'],
239 $identifierParts[
'datatype'][0]
242 return $identifierParts[
'table'] ? $identifierParts[
'table'] .
'.' . $identifierParts[
'field'] : $identifierParts[
'field'];
256 $outputParts = array();
258 if (is_array($tablesArray)) {
259 foreach ($tablesArray as $k => $v) {
261 $outputParts[$k] = $v[
'table'];
264 $outputParts[$k] .=
' ' . $v[
'as_keyword'] .
' ' . $v[
'as'];
266 if (is_array($v[
'JOIN'])) {
267 foreach ($v[
'JOIN'] as $join) {
268 $outputParts[$k] .=
' ' . $join[
'type'] .
' ' . $join[
'withTable'];
270 if (isset($join[
'as']) && $join[
'as']) {
271 $outputParts[$k] .=
' ' . $join[
'as_keyword'] .
' ' . $join[
'as'];
273 $outputParts[$k] .=
' ON ';
274 foreach ($join[
'ON'] as $condition) {
275 if ($condition[
'operator'] !==
'') {
276 $outputParts[$k] .=
' ' . $condition[
'operator'] .
' ';
279 $outputParts[$k] .= $condition[
'comparator'];
280 if (!empty($condition[
'right'][
'value'])) {
281 $value = $condition[
'right'][
'value'];
292 return implode(
', ', $outputParts);
306 if (isset($components[
'case_field'])) {
307 $statement .=
' ' . $components[
'case_field'];
308 }
elseif (isset($components[
'case_value'])) {
309 $statement .=
' ' . $components[
'case_value'][1] . $components[
'case_value'][0] . $components[
'case_value'][1];
311 foreach ($components[
'when'] as $when) {
312 $statement .=
' WHEN ';
314 $statement .=
' THEN ';
315 $statement .= $when[
'then_value'][1] . $when[
'then_value'][0] . $when[
'then_value'][1];
317 if (isset($components[
'else'])) {
318 $statement .=
' ELSE ';
319 $statement .= $components[
'else'][1] . $components[
'else'][0] . $components[
'else'][1];
321 $statement .=
' END';