Class IdentifierQuoter
Contains all the logic related to quoting identifiers in a Query object
Method Summary
-
__construct() public
Constructor
-
basicQuoter() protected
A generic identifier quoting function used for various parts of the query
-
quote() public
Iterates over each of the clauses in a query looking for identifiers and quotes them
-
quoteComparison() protected
Quotes identifiers in expression objects implementing the field interface
-
quoteDelete() protected
Quotes all identifiers in each of the clauses of a DELETE query
-
quoteExpression() public
Quotes identifiers inside expression objects
-
quoteIdentifier() public
Quotes a database identifier (a column name, table name, etc..) to be used safely in queries without the risk of using reserved words
-
quoteIdentifierExpression() protected
Quotes identifiers in "order by" expression objects
-
quoteInsert() protected
Quotes the table name and columns for an insert query
-
quoteJoins() protected
Quotes both the table and alias for an array of joins as stored in a Query object
-
quoteOrderBy() protected
Quotes identifiers in "order by" expression objects
Strings with spaces are treated as literal expressions and will not have identifiers quoted.
-
quoteParts() protected
Quotes all identifiers in each of the clauses/parts of a query
-
quoteSelect() protected
Quotes all identifiers in each of the clauses of a SELECT query
-
quoteUpdate() protected
Quotes the table name for an update query
Method Detail
__construct() ¶ public
__construct(string $startQuote, string $endQuote)
Constructor
Parameters
-
string$startQuote String used to start a database identifier quoting to make it safe.
-
string$endQuote String used to end a database identifier quoting to make it safe.
basicQuoter() ¶ protected
basicQuoter(array<string, mixed> $part): array<string, mixed>
A generic identifier quoting function used for various parts of the query
Parameters
-
array<string, mixed>$part the part of the query to quote
Returns
array<string, mixed>quote() ¶ public
quote(Cake\Database\Query $query): Cake\Database\Query
Iterates over each of the clauses in a query looking for identifiers and quotes them
Parameters
-
Cake\Database\Query$query The query to have its identifiers quoted
Returns
Cake\Database\QueryquoteComparison() ¶ protected
quoteComparison(Cake\Database\Expression\FieldInterface $expression): void
Quotes identifiers in expression objects implementing the field interface
Parameters
-
Cake\Database\Expression\FieldInterface$expression The expression to quote.
Returns
voidquoteDelete() ¶ protected
quoteDelete(Cake\Database\Query\DeleteQuery $query): void
Quotes all identifiers in each of the clauses of a DELETE query
Parameters
-
Cake\Database\Query\DeleteQuery$query The query to quote.
Returns
voidquoteExpression() ¶ public
quoteExpression(Cake\Database\ExpressionInterface $expression): void
Quotes identifiers inside expression objects
Parameters
-
Cake\Database\ExpressionInterface$expression The expression object to walk and quote.
Returns
voidquoteIdentifier() ¶ public
quoteIdentifier(string $identifier): string
Quotes a database identifier (a column name, table name, etc..) to be used safely in queries without the risk of using reserved words
Parameters
-
string$identifier The identifier to quote.
Returns
stringquoteIdentifierExpression() ¶ protected
quoteIdentifierExpression(Cake\Database\Expression\IdentifierExpression $expression): void
Quotes identifiers in "order by" expression objects
Parameters
-
Cake\Database\Expression\IdentifierExpression$expression The identifiers to quote.
Returns
voidquoteInsert() ¶ protected
quoteInsert(Cake\Database\Query\InsertQuery $query): void
Quotes the table name and columns for an insert query
Parameters
-
Cake\Database\Query\InsertQuery$query The insert query to quote.
Returns
voidquoteJoins() ¶ protected
quoteJoins(array<array> $joins): array<string, array>
Quotes both the table and alias for an array of joins as stored in a Query object
Parameters
-
array<array>$joins The joins to quote.
Returns
array<string, array>quoteOrderBy() ¶ protected
quoteOrderBy(Cake\Database\Expression\OrderByExpression $expression): void
Quotes identifiers in "order by" expression objects
Strings with spaces are treated as literal expressions and will not have identifiers quoted.
Parameters
-
Cake\Database\Expression\OrderByExpression$expression The expression to quote.
Returns
voidquoteParts() ¶ protected
quoteParts(Cake\Database\Query $query, array<string> $parts): void
Quotes all identifiers in each of the clauses/parts of a query
Parameters
-
Cake\Database\Query$query The query to quote.
-
array<string>$parts Query clauses.
Returns
voidquoteSelect() ¶ protected
quoteSelect(Cake\Database\Query\SelectQuery<mixed> $query): void
Quotes all identifiers in each of the clauses of a SELECT query
Parameters
-
Cake\Database\Query\SelectQuery<mixed>$query The query to quote.
Returns
voidquoteUpdate() ¶ protected
quoteUpdate(Cake\Database\Query\UpdateQuery $query): void
Quotes the table name for an update query
Parameters
-
Cake\Database\Query\UpdateQuery$query The update query to quote.
Returns
void