‪TYPO3CMS  9.5
QueryBuilder.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
18 use Doctrine\DBAL\Platforms\MySqlPlatform;
19 use Doctrine\DBAL\Platforms\OraclePlatform;
20 use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
21 use Doctrine\DBAL\Platforms\SqlitePlatform;
22 use Doctrine\DBAL\Platforms\SQLServerPlatform;
23 use Doctrine\DBAL\Query\Expression\CompositeExpression;
29 
47 {
53  protected ‪$connection;
54 
58  protected ‪$concreteQueryBuilder;
59 
63  protected ‪$restrictionContainer;
64 
69 
78  public function ‪__construct(
81  \Doctrine\DBAL\Query\‪QueryBuilder ‪$concreteQueryBuilder = null,
82  array ‪$additionalRestrictions = null
83  ) {
84  $this->connection = ‪$connection;
85  $this->additionalRestrictions = ‪$additionalRestrictions ?: ‪$GLOBALS['TYPO3_CONF_VARS']['DB']['additionalQueryRestrictions'] ?? [];
86  $this->‪setRestrictions(‪$restrictionContainer ?: GeneralUtility::makeInstance(DefaultRestrictionContainer::class));
87  $this->concreteQueryBuilder = ‪$concreteQueryBuilder ?: GeneralUtility::makeInstance(\Doctrine\DBAL\Query\QueryBuilder::class, ‪$connection);
88  }
89 
93  public function ‪getRestrictions()
94  {
96  }
97 
102  {
103  foreach ($this->additionalRestrictions as $restrictionClass => $options) {
104  if (empty($options['disabled'])) {
105  $restriction = GeneralUtility::makeInstance($restrictionClass);
106  ‪$restrictionContainer->‪add($restriction);
107  }
108  }
109  $this->restrictionContainer = ‪$restrictionContainer;
110  }
111 
115  public function ‪resetRestrictions()
116  {
117  $this->‪setRestrictions(GeneralUtility::makeInstance(DefaultRestrictionContainer::class));
118  }
119 
129  public function ‪expr(): ‪ExpressionBuilder
130  {
131  return $this->connection->getExpressionBuilder();
132  }
133 
140  public function ‪getType(): int
141  {
142  return $this->concreteQueryBuilder->getType();
143  }
144 
150  public function ‪getConnection(): ‪Connection
151  {
152  return ‪$this->connection;
153  }
154 
161  public function ‪getState(): int
162  {
163  return $this->concreteQueryBuilder->getState();
164  }
165 
172  public function ‪getConcreteQueryBuilder(): \Doctrine\DBAL\Query\QueryBuilder
173  {
175  }
176 
182  public function ‪execute()
183  {
184  if ($this->‪getType() !== \Doctrine\DBAL\Query\QueryBuilder::SELECT) {
185  return $this->concreteQueryBuilder->execute();
186  }
187 
188  // Set additional query restrictions
189  $originalWhereConditions = $this->‪addAdditionalWhereConditions();
190 
191  $result = $this->concreteQueryBuilder->execute();
192 
193  // Restore the original query conditions in case the user keeps
194  // on modifying the state.
195  $this->concreteQueryBuilder->add('where', $originalWhereConditions, false);
196 
197  return $result;
198  }
199 
208  public function ‪getSQL(): string
209  {
210  if ($this->‪getType() !== \Doctrine\DBAL\Query\QueryBuilder::SELECT) {
211  return $this->concreteQueryBuilder->getSQL();
212  }
213 
214  // Set additional query restrictions
215  $originalWhereConditions = $this->‪addAdditionalWhereConditions();
216 
217  $sql = $this->concreteQueryBuilder->getSQL();
218 
219  // Restore the original query conditions in case the user keeps
220  // on modifying the state.
221  $this->concreteQueryBuilder->add('where', $originalWhereConditions, false);
222 
223  return $sql;
224  }
225 
235  public function ‪setParameter($key, $value, int $type = null): QueryBuilder
236  {
237  $this->concreteQueryBuilder->setParameter($key, $value, $type);
238 
239  return $this;
240  }
241 
250  public function ‪setParameters(array $params, array $types = []): QueryBuilder
251  {
252  $this->concreteQueryBuilder->setParameters($params, $types);
253 
254  return $this;
255  }
256 
262  public function ‪getParameters(): array
263  {
264  return $this->concreteQueryBuilder->getParameters();
265  }
266 
274  public function ‪getParameter($key)
275  {
276  return $this->concreteQueryBuilder->getParameter($key);
277  }
278 
284  public function ‪getParameterTypes(): array
285  {
286  return $this->concreteQueryBuilder->getParameterTypes();
287  }
288 
296  public function ‪getParameterType($key)
297  {
298  return $this->concreteQueryBuilder->getParameterType($key);
299  }
300 
308  public function ‪setFirstResult(int $firstResult): QueryBuilder
309  {
310  $this->concreteQueryBuilder->setFirstResult($firstResult);
311 
312  return $this;
313  }
314 
321  public function ‪getFirstResult(): int
322  {
323  return (int)$this->concreteQueryBuilder->getFirstResult();
324  }
325 
333  public function ‪setMaxResults(int $maxResults): QueryBuilder
334  {
335  $this->concreteQueryBuilder->setMaxResults($maxResults);
336 
337  return $this;
338  }
339 
346  public function ‪getMaxResults(): int
347  {
348  return (int)$this->concreteQueryBuilder->getMaxResults();
349  }
350 
363  public function ‪add(string $sqlPartName, $sqlPart, bool $append = false): QueryBuilder
364  {
365  $this->concreteQueryBuilder->add($sqlPartName, $sqlPart, $append);
366 
367  return $this;
368  }
369 
377  public function ‪count(string $item): QueryBuilder
378  {
379  $countExpr = $this->‪getConnection()->getDatabasePlatform()->getCountExpression(
380  $item === '*' ? $item : $this->‪quoteIdentifier($item)
381  );
382  $this->concreteQueryBuilder->‪select($countExpr);
383 
384  return $this;
385  }
386 
394  public function ‪select(string ...$selects): QueryBuilder
395  {
396  $this->concreteQueryBuilder->select(...$this->‪quoteIdentifiersForSelect($selects));
397 
398  return $this;
399  }
400 
408  public function ‪addSelect(string ...$selects): QueryBuilder
409  {
410  $this->concreteQueryBuilder->addSelect(...$this->‪quoteIdentifiersForSelect($selects));
411 
412  return $this;
413  }
414 
424  public function ‪selectLiteral(string ...$selects): QueryBuilder
425  {
426  $this->concreteQueryBuilder->select(...$selects);
427 
428  return $this;
429  }
430 
439  public function ‪addSelectLiteral(string ...$selects): QueryBuilder
440  {
441  $this->concreteQueryBuilder->addSelect(...$selects);
442 
443  return $this;
444  }
445 
457  public function delete(string $delete, string $alias = null): QueryBuilder
458  {
459  $this->concreteQueryBuilder->delete(
460  $this->‪quoteIdentifier($delete),
461  empty($alias) ? $alias : $this->‪quoteIdentifier($alias)
462  );
463 
464  return $this;
465  }
466 
476  public function ‪update(string $update, string $alias = null): QueryBuilder
477  {
478  $this->concreteQueryBuilder->update(
479  $this->‪quoteIdentifier($update),
480  empty($alias) ? $alias : $this->‪quoteIdentifier($alias)
481  );
482 
483  return $this;
484  }
485 
494  public function ‪insert(string $insert): QueryBuilder
495  {
496  $this->concreteQueryBuilder->insert($this->‪quoteIdentifier($insert));
497 
498  return $this;
499  }
500 
510  public function ‪from(string $from, string $alias = null): QueryBuilder
511  {
512  $this->concreteQueryBuilder->from(
513  $this->‪quoteIdentifier($from),
514  empty($alias) ? $alias : $this->‪quoteIdentifier($alias)
515  );
516 
517  return $this;
518  }
519 
530  public function ‪join(string $fromAlias, string $join, string $alias, string $condition = null): QueryBuilder
531  {
532  $this->concreteQueryBuilder->innerJoin(
533  $this->‪quoteIdentifier($fromAlias),
534  $this->‪quoteIdentifier($join),
535  $this->‪quoteIdentifier($alias),
536  $condition
537  );
538 
539  return $this;
540  }
541 
552  public function ‪innerJoin(string $fromAlias, string $join, string $alias, string $condition = null): QueryBuilder
553  {
554  $this->concreteQueryBuilder->innerJoin(
555  $this->‪quoteIdentifier($fromAlias),
556  $this->‪quoteIdentifier($join),
557  $this->‪quoteIdentifier($alias),
558  $condition
559  );
560 
561  return $this;
562  }
563 
574  public function ‪leftJoin(string $fromAlias, string $join, string $alias, string $condition = null): QueryBuilder
575  {
576  $this->concreteQueryBuilder->leftJoin(
577  $this->‪quoteIdentifier($fromAlias),
578  $this->‪quoteIdentifier($join),
579  $this->‪quoteIdentifier($alias),
580  $condition
581  );
582 
583  return $this;
584  }
585 
596  public function ‪rightJoin(string $fromAlias, string $join, string $alias, string $condition = null): QueryBuilder
597  {
598  $this->concreteQueryBuilder->rightJoin(
599  $this->‪quoteIdentifier($fromAlias),
600  $this->‪quoteIdentifier($join),
601  $this->‪quoteIdentifier($alias),
602  $condition
603  );
604 
605  return $this;
606  }
607 
617  public function set(string $key, $value, bool $createNamedParameter = true): QueryBuilder
618  {
619  $this->concreteQueryBuilder->set(
620  $this->‪quoteIdentifier($key),
621  $createNamedParameter ? $this->‪createNamedParameter($value) : $value
622  );
623 
624  return $this;
625  }
626 
634  public function ‪where(...$predicates): QueryBuilder
635  {
636  $this->concreteQueryBuilder->where(...$predicates);
637 
638  return $this;
639  }
640 
651  public function ‪andWhere(...$where): QueryBuilder
652  {
653  $this->concreteQueryBuilder->andWhere(...$where);
654 
655  return $this;
656  }
657 
668  public function ‪orWhere(...$where): QueryBuilder
669  {
670  $this->concreteQueryBuilder->orWhere(...$where);
671 
672  return $this;
673  }
674 
683  public function ‪groupBy(...$groupBy): QueryBuilder
684  {
685  $this->concreteQueryBuilder->groupBy(...$this->‪quoteIdentifiers($groupBy));
686 
687  return $this;
688  }
689 
697  public function ‪addGroupBy(...$groupBy): QueryBuilder
698  {
699  $this->concreteQueryBuilder->addGroupBy(...$this->‪quoteIdentifiers($groupBy));
700 
701  return $this;
702  }
703 
713  public function ‪setValue(string $column, $value, bool $createNamedParameter = true): QueryBuilder
714  {
715  $this->concreteQueryBuilder->setValue(
716  $this->‪quoteIdentifier($column),
717  $createNamedParameter ? $this->‪createNamedParameter($value) : $value
718  );
719 
720  return $this;
721  }
722 
732  public function ‪values(array $values, bool $createNamedParameters = true): QueryBuilder
733  {
734  if ($createNamedParameters === true) {
735  foreach ($values as &$value) {
736  $value = $this->‪createNamedParameter($value);
737  }
738  }
739 
740  $this->concreteQueryBuilder->values($this->‪quoteColumnValuePairs($values));
741 
742  return $this;
743  }
744 
753  public function ‪having(...$having): QueryBuilder
754  {
755  $this->concreteQueryBuilder->having(...$having);
756  return $this;
757  }
758 
767  public function ‪andHaving(...$having): QueryBuilder
768  {
769  $this->concreteQueryBuilder->andHaving(...$having);
770 
771  return $this;
772  }
773 
782  public function ‪orHaving(...$having): QueryBuilder
783  {
784  $this->concreteQueryBuilder->orHaving(...$having);
785 
786  return $this;
787  }
788 
798  public function ‪orderBy(string $fieldName, string $order = null): QueryBuilder
799  {
800  $this->concreteQueryBuilder->orderBy($this->connection->quoteIdentifier($fieldName), $order);
801 
802  return $this;
803  }
804 
813  public function ‪addOrderBy(string $fieldName, string $order = null): QueryBuilder
814  {
815  $this->concreteQueryBuilder->addOrderBy($this->connection->quoteIdentifier($fieldName), $order);
816 
817  return $this;
818  }
819 
827  public function ‪getQueryPart(string $queryPartName)
828  {
829  return $this->concreteQueryBuilder->getQueryPart($queryPartName);
830  }
831 
837  public function ‪getQueryParts(): array
838  {
839  return $this->concreteQueryBuilder->getQueryParts();
840  }
841 
849  public function ‪resetQueryParts(array $queryPartNames = null): QueryBuilder
850  {
851  $this->concreteQueryBuilder->resetQueryParts($queryPartNames);
852 
853  return $this;
854  }
855 
863  public function ‪resetQueryPart($queryPartName): QueryBuilder
864  {
865  $this->concreteQueryBuilder->resetQueryPart($queryPartName);
866 
867  return $this;
868  }
869 
876  public function ‪__toString(): string
877  {
878  return $this->‪getSQL();
879  }
880 
898  public function ‪createNamedParameter($value, int $type = \PDO::PARAM_STR, string $placeHolder = null): string
899  {
900  return $this->concreteQueryBuilder->createNamedParameter($value, $type, $placeHolder);
901  }
902 
916  public function ‪createPositionalParameter($value, int $type = \PDO::PARAM_STR): string
917  {
918  return $this->concreteQueryBuilder->createPositionalParameter($value, $type);
919  }
920 
928  public function ‪escapeLikeWildcards(string $value): string
929  {
930  return addcslashes($value, '_%');
931  }
932 
941  public function ‪quote($input, int $type = null)
942  {
943  return $this->‪getConnection()->quote($input, $type);
944  }
945 
956  public function ‪quoteIdentifier(string $identifier): string
957  {
958  return $this->‪getConnection()->‪quoteIdentifier($identifier);
959  }
960 
970  public function ‪quoteIdentifiers(array $input): array
971  {
972  return $this->‪getConnection()->‪quoteIdentifiers($input);
973  }
974 
987  public function ‪quoteIdentifiersForSelect(array $input): array
988  {
989  foreach ($input as &$select) {
990  list($fieldName, $alias, $suffix) = array_pad(
991  GeneralUtility::trimExplode(
992  ' AS ',
993  str_ireplace(' as ', ' AS ', $select),
994  true,
995  3
996  ),
997  3,
998  null
999  );
1000  if (!empty($suffix)) {
1001  throw new \InvalidArgumentException(
1002  'QueryBuilder::quoteIdentifiersForSelect() could not parse the select ' . $select . '.',
1003  1461170686
1004  );
1005  }
1006 
1007  // The SQL * operator must not be quoted. As it can only occur either by itself
1008  // or preceded by a tablename (tablename.*) check if the last character of a select
1009  // expression is the * and quote only prepended table name. In all other cases the
1010  // full expression is being quoted.
1011  if (substr($fieldName, -2) === '.*') {
1012  $select = $this->‪quoteIdentifier(substr($fieldName, 0, -2)) . '.*';
1013  } elseif ($fieldName !== '*') {
1014  $select = $this->‪quoteIdentifier($fieldName);
1015  }
1016 
1017  // Quote the alias for the current fieldName, if given
1018  if (!empty($alias)) {
1019  $select .= ' AS ' . $this->‪quoteIdentifier($alias);
1020  }
1021  }
1022  return $input;
1023  }
1024 
1035  public function ‪quoteColumnValuePairs(array $input): array
1036  {
1037  return $this->‪getConnection()->‪quoteColumnValuePairs($input);
1038  }
1039 
1046  public function ‪castFieldToTextType(string $fieldName): string
1047  {
1048  $databasePlatform = $this->connection->getDatabasePlatform();
1049  // https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#function_convert
1050  if ($databasePlatform instanceof MySqlPlatform) {
1051  return sprintf('CONVERT(%s, CHAR)', $this->connection->quoteIdentifier($fieldName));
1052  }
1053  // https://www.postgresql.org/docs/current/sql-createcast.html
1054  if ($databasePlatform instanceof PostgreSqlPlatform) {
1055  return sprintf('%s::text', $this->connection->quoteIdentifier($fieldName));
1056  }
1057  // https://www.sqlite.org/lang_expr.html#castexpr
1058  if ($databasePlatform instanceof SqlitePlatform) {
1059  return sprintf('CAST(%s as TEXT)', $this->connection->quoteIdentifier($fieldName));
1060  }
1061  // https://docs.microsoft.com/en-us/sql/t-sql/functions/cast-and-convert-transact-sql?view=sql-server-ver15#implicit-conversions
1062  if ($databasePlatform instanceof SQLServerPlatform) {
1063  return sprintf('CAST(%s as VARCHAR)', $this->connection->quoteIdentifier($fieldName));
1064  }
1065  // https://docs.oracle.com/javadb/10.8.3.0/ref/rrefsqlj33562.html
1066  if ($databasePlatform instanceof OraclePlatform) {
1067  return sprintf('CAST(%s as VARCHAR)', $this->connection->quoteIdentifier($fieldName));
1068  }
1069 
1070  throw new \RuntimeException(
1071  sprintf(
1072  '%s is not implemented for the used database platform "%s", yet!',
1073  __METHOD__,
1074  get_class($this->connection->getDatabasePlatform())
1075  ),
1076  1584637096
1077  );
1078  }
1079 
1087  protected function ‪unquoteSingleIdentifier(string $identifier): string
1088  {
1089  $identifier = trim($identifier);
1090  $platform = $this->‪getConnection()->getDatabasePlatform();
1091  if ($platform instanceof SQLServerPlatform) {
1092  // mssql quotes identifiers with [ and ], not a single character
1093  $identifier = ltrim($identifier, '[');
1094  $identifier = rtrim($identifier, ']');
1095  } else {
1096  $quoteChar = $platform->getIdentifierQuoteCharacter();
1097  $identifier = trim($identifier, $quoteChar);
1098  $identifier = str_replace($quoteChar . $quoteChar, $quoteChar, $identifier);
1099  }
1100  return $identifier;
1101  }
1102 
1111  protected function ‪getQueriedTables(): array
1112  {
1113  $queriedTables = [];
1114 
1115  // Loop through all FROM tables
1116  foreach ($this->‪getQueryPart('from') as $from) {
1117  $tableName = $this->‪unquoteSingleIdentifier($from['table']);
1118  $tableAlias = isset($from['alias']) ? $this->‪unquoteSingleIdentifier($from['alias']) : $tableName;
1119  $queriedTables[$tableAlias] = $tableName;
1120  }
1121 
1122  // Loop through all JOIN tables
1123  foreach ($this->‪getQueryPart('join') as $fromTable => $joins) {
1124  foreach ($joins as $join) {
1125  $tableName = $this->‪unquoteSingleIdentifier($join['joinTable']);
1126  $tableAlias = isset($join['joinAlias']) ? $this->‪unquoteSingleIdentifier($join['joinAlias']) : $tableName;
1127  $queriedTables[$tableAlias] = $tableName;
1128  }
1129  }
1130 
1131  return $queriedTables;
1132  }
1133 
1141  protected function ‪addAdditionalWhereConditions()
1142  {
1143  $originalWhereConditions = $this->concreteQueryBuilder->getQueryPart('where');
1144  $expression = $this->restrictionContainer->buildExpression($this->‪getQueriedTables(), $this->‪expr());
1145  // This check would be obsolete, as the composite expression would not add empty expressions anyway
1146  // But we keep it here to only clone the previous state, in case we really will change it.
1147  // Once we remove this state preserving functionality, we can remove the count check here
1148  // and just add the expression to the query builder.
1149  if ($expression->count() > 0) {
1150  if ($originalWhereConditions instanceof CompositeExpression) {
1151  // Save the original query conditions so we can restore
1152  // them after the query has been built.
1153  $originalWhereConditions = clone $originalWhereConditions;
1154  }
1155  $this->concreteQueryBuilder->andWhere($expression);
1156  }
1157 
1158  return $originalWhereConditions;
1159  }
1160 
1165  public function ‪__clone()
1166  {
1167  $this->concreteQueryBuilder = clone ‪$this->concreteQueryBuilder;
1168  $this->restrictionContainer = clone ‪$this->restrictionContainer;
1169  }
1170 }
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getQueryPart
‪mixed getQueryPart(string $queryPartName)
Definition: QueryBuilder.php:823
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\quoteIdentifier
‪string quoteIdentifier(string $identifier)
Definition: QueryBuilder.php:952
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\__toString
‪string __toString()
Definition: QueryBuilder.php:872
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\resetRestrictions
‪resetRestrictions()
Definition: QueryBuilder.php:111
‪TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder
Definition: ExpressionBuilder.php:33
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\groupBy
‪QueryBuilder groupBy(... $groupBy)
Definition: QueryBuilder.php:679
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\innerJoin
‪QueryBuilder innerJoin(string $fromAlias, string $join, string $alias, string $condition=null)
Definition: QueryBuilder.php:548
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\andHaving
‪QueryBuilder andHaving(... $having)
Definition: QueryBuilder.php:763
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getParameters
‪array getParameters()
Definition: QueryBuilder.php:258
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\select
‪QueryBuilder select(string ... $selects)
Definition: QueryBuilder.php:390
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\rightJoin
‪QueryBuilder rightJoin(string $fromAlias, string $join, string $alias, string $condition=null)
Definition: QueryBuilder.php:592
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getType
‪int getType()
Definition: QueryBuilder.php:136
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\values
‪QueryBuilder values(array $values, bool $createNamedParameters=true)
Definition: QueryBuilder.php:728
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\resetQueryPart
‪QueryBuilder resetQueryPart($queryPartName)
Definition: QueryBuilder.php:859
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\$restrictionContainer
‪QueryRestrictionContainerInterface $restrictionContainer
Definition: QueryBuilder.php:60
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getQueriedTables
‪string[] getQueriedTables()
Definition: QueryBuilder.php:1107
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\createNamedParameter
‪string createNamedParameter($value, int $type=\PDO::PARAM_STR, string $placeHolder=null)
Definition: QueryBuilder.php:894
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\__clone
‪__clone()
Definition: QueryBuilder.php:1161
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\escapeLikeWildcards
‪string escapeLikeWildcards(string $value)
Definition: QueryBuilder.php:924
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getParameter
‪mixed getParameter($key)
Definition: QueryBuilder.php:270
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\setValue
‪QueryBuilder setValue(string $column, $value, bool $createNamedParameter=true)
Definition: QueryBuilder.php:709
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\join
‪QueryBuilder join(string $fromAlias, string $join, string $alias, string $condition=null)
Definition: QueryBuilder.php:526
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\orderBy
‪QueryBuilder orderBy(string $fieldName, string $order=null)
Definition: QueryBuilder.php:794
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\quoteIdentifiers
‪array quoteIdentifiers(array $input)
Definition: QueryBuilder.php:966
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\setParameter
‪QueryBuilder setParameter($key, $value, int $type=null)
Definition: QueryBuilder.php:231
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\quoteColumnValuePairs
‪array quoteColumnValuePairs(array $input)
Definition: QueryBuilder.php:1031
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getMaxResults
‪int getMaxResults()
Definition: QueryBuilder.php:342
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getRestrictions
‪QueryRestrictionContainerInterface getRestrictions()
Definition: QueryBuilder.php:89
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\addSelect
‪QueryBuilder addSelect(string ... $selects)
Definition: QueryBuilder.php:404
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getConnection
‪Connection getConnection()
Definition: QueryBuilder.php:146
‪TYPO3\CMS\Core\Database\Query\Restriction\QueryRestrictionContainerInterface
Definition: QueryRestrictionContainerInterface.php:23
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\update
‪QueryBuilder update(string $update, string $alias=null)
Definition: QueryBuilder.php:472
‪TYPO3\CMS\Core\Database\Connection\quoteIdentifier
‪string quoteIdentifier($identifier)
Definition: Connection.php:126
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\$connection
‪Connection $connection
Definition: QueryBuilder.php:52
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\unquoteSingleIdentifier
‪string unquoteSingleIdentifier(string $identifier)
Definition: QueryBuilder.php:1083
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\quoteIdentifiersForSelect
‪array quoteIdentifiersForSelect(array $input)
Definition: QueryBuilder.php:983
‪TYPO3\CMS\Core\Database\Query\QueryBuilder
Definition: QueryBuilder.php:47
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\from
‪QueryBuilder from(string $from, string $alias=null)
Definition: QueryBuilder.php:506
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getSQL
‪string getSQL()
Definition: QueryBuilder.php:204
‪TYPO3\CMS\Core\Database\Connection\select
‪Statement select(array $columns, string $tableName, array $identifiers=[], array $groupBy=[], array $orderBy=[], int $limit=0, int $offset=0)
Definition: Connection.php:241
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getConcreteQueryBuilder
‪Doctrine DBAL Query QueryBuilder getConcreteQueryBuilder()
Definition: QueryBuilder.php:168
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\__construct
‪__construct(Connection $connection, QueryRestrictionContainerInterface $restrictionContainer=null, \Doctrine\DBAL\Query\QueryBuilder $concreteQueryBuilder=null, array $additionalRestrictions=null)
Definition: QueryBuilder.php:74
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getQueryParts
‪array getQueryParts()
Definition: QueryBuilder.php:833
‪TYPO3\CMS\Core\Database\Connection\quoteColumnValuePairs
‪array quoteColumnValuePairs(array $input)
Definition: Connection.php:159
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\andWhere
‪QueryBuilder andWhere(... $where)
Definition: QueryBuilder.php:647
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getState
‪int getState()
Definition: QueryBuilder.php:157
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\delete
‪QueryBuilder delete(string $delete, string $alias=null)
Definition: QueryBuilder.php:453
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\addGroupBy
‪QueryBuilder addGroupBy(... $groupBy)
Definition: QueryBuilder.php:693
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\selectLiteral
‪QueryBuilder selectLiteral(string ... $selects)
Definition: QueryBuilder.php:420
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\addAdditionalWhereConditions
‪Doctrine DBAL Query Expression CompositeExpression mixed addAdditionalWhereConditions()
Definition: QueryBuilder.php:1137
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\insert
‪QueryBuilder insert(string $insert)
Definition: QueryBuilder.php:490
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\$concreteQueryBuilder
‪Doctrine DBAL Query QueryBuilder $concreteQueryBuilder
Definition: QueryBuilder.php:56
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\execute
‪Doctrine DBAL Driver Statement int execute()
Definition: QueryBuilder.php:178
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\createPositionalParameter
‪string createPositionalParameter($value, int $type=\PDO::PARAM_STR)
Definition: QueryBuilder.php:912
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getFirstResult
‪int getFirstResult()
Definition: QueryBuilder.php:317
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\setMaxResults
‪QueryBuilder setMaxResults(int $maxResults)
Definition: QueryBuilder.php:329
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\resetQueryParts
‪QueryBuilder resetQueryParts(array $queryPartNames=null)
Definition: QueryBuilder.php:845
‪TYPO3\CMS\Core\Database\Connection
Definition: Connection.php:31
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\add
‪QueryBuilder add(string $sqlPartName, $sqlPart, bool $append=false)
Definition: QueryBuilder.php:359
‪TYPO3\CMS\Core\Database\Connection\quoteIdentifiers
‪array quoteIdentifiers(array $input)
Definition: Connection.php:144
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\setFirstResult
‪QueryBuilder setFirstResult(int $firstResult)
Definition: QueryBuilder.php:304
‪TYPO3\CMS\Core\Database\Query
Definition: BulkInsertQuery.php:3
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getParameterType
‪mixed getParameterType($key)
Definition: QueryBuilder.php:292
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\set
‪QueryBuilder set(string $key, $value, bool $createNamedParameter=true)
Definition: QueryBuilder.php:613
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\orWhere
‪QueryBuilder orWhere(... $where)
Definition: QueryBuilder.php:664
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\quote
‪mixed quote($input, int $type=null)
Definition: QueryBuilder.php:937
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\addOrderBy
‪QueryBuilder addOrderBy(string $fieldName, string $order=null)
Definition: QueryBuilder.php:809
‪TYPO3\CMS\Core\Database\Query\Restriction\QueryRestrictionContainerInterface\add
‪QueryRestrictionContainerInterface add(QueryRestrictionInterface $restriction)
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\$additionalRestrictions
‪array $additionalRestrictions
Definition: QueryBuilder.php:64
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\count
‪QueryBuilder count(string $item)
Definition: QueryBuilder.php:373
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\setRestrictions
‪setRestrictions(QueryRestrictionContainerInterface $restrictionContainer)
Definition: QueryBuilder.php:97
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\having
‪QueryBuilder having(... $having)
Definition: QueryBuilder.php:749
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\addSelectLiteral
‪QueryBuilder addSelectLiteral(string ... $selects)
Definition: QueryBuilder.php:435
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\where
‪QueryBuilder where(... $predicates)
Definition: QueryBuilder.php:630
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\expr
‪ExpressionBuilder expr()
Definition: QueryBuilder.php:125
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\setParameters
‪QueryBuilder setParameters(array $params, array $types=[])
Definition: QueryBuilder.php:246
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\orHaving
‪QueryBuilder orHaving(... $having)
Definition: QueryBuilder.php:778
‪TYPO3\CMS\Core\Database\Query\Restriction\DefaultRestrictionContainer
Definition: DefaultRestrictionContainer.php:22
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\leftJoin
‪QueryBuilder leftJoin(string $fromAlias, string $join, string $alias, string $condition=null)
Definition: QueryBuilder.php:570
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\castFieldToTextType
‪string castFieldToTextType(string $fieldName)
Definition: QueryBuilder.php:1042
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getParameterTypes
‪array getParameterTypes()
Definition: QueryBuilder.php:280