Class QueryCompiler
Responsible for compiling a Query object into its SQL representation
Property Summary
- 
        $_deleteParts protectedarrayThe list of query clauses to traverse for generating a DELETE statement 
- 
        $_insertParts protectedarrayThe list of query clauses to traverse for generating an INSERT statement 
- 
        $_orderedUnion protectedboolIndicate whether or not this query dialect supports ordered unions. 
- 
        $_selectParts protectedarrayThe list of query clauses to traverse for generating a SELECT statement 
- 
        $_templates protectedarrayList of sprintf templates that will be used for compiling the SQL for this query. There are some clauses that can be built as just as the direct concatenation of the internal parts, those are listed here. 
- 
        $_updateParts protectedarrayThe list of query clauses to traverse for generating an UPDATE statement 
Method Summary
- 
          _buildFromPart() protectedHelper function used to build the string representation of a FROM clause, it constructs the tables list taking care of aliasing and converting expression objects to string. 
- 
          _buildInsertPart() protectedBuilds the SQL fragment for INSERT INTO. 
- 
          _buildJoinPart() protectedHelper function used to build the string representation of multiple JOIN clauses, it constructs the joins list taking care of aliasing and converting expression objects to string in both the table to be joined and the conditions to be used. 
- 
          _buildSelectPart() protectedHelper function used to build the string representation of a SELECT clause, it constructs the field list taking care of aliasing and converting expression objects to string. This function also constructs the DISTINCT clause for the query. 
- 
          _buildSetPart() protectedHelper function to generate SQL for SET expressions. 
- 
          _buildUnionPart() protectedBuilds the SQL string for all the UNION clauses in this query, when dealing with query objects it will also transform them using their configured SQL dialect. 
- 
          _buildValuesPart() protectedBuilds the SQL fragment for INSERT INTO. 
- 
          _sqlCompiler() protectedReturns a callable object that can be used to compile a SQL string representation of this query. 
- 
          _stringifyExpressions() protectedHelper function used to covert ExpressionInterface objects inside an array into their string representation. 
- 
          compile() publicReturns the SQL representation of the provided query after generating the placeholders for the bound values using the provided generator 
Method Detail
_buildFromPart() ¶ protected
_buildFromPart(array $parts, Cake\Database\Query $query, Cake\Database\ValueBinder $generator): stringHelper function used to build the string representation of a FROM clause, it constructs the tables list taking care of aliasing and converting expression objects to string.
Parameters
- 
                array$parts
- list of tables to be transformed to string 
- 
                Cake\Database\Query$query
- The query that is being compiled 
- 
                Cake\Database\ValueBinder$generator
- the placeholder generator to be used in expressions 
Returns
string_buildInsertPart() ¶ protected
_buildInsertPart(array $parts, Cake\Database\Query $query, Cake\Database\ValueBinder $generator): stringBuilds the SQL fragment for INSERT INTO.
Parameters
- 
                array$parts
- The insert parts. 
- 
                Cake\Database\Query$query
- The query that is being compiled 
- 
                Cake\Database\ValueBinder$generator
- the placeholder generator to be used in expressions 
Returns
string_buildJoinPart() ¶ protected
_buildJoinPart(array $parts, Cake\Database\Query $query, Cake\Database\ValueBinder $generator): stringHelper function used to build the string representation of multiple JOIN clauses, it constructs the joins list taking care of aliasing and converting expression objects to string in both the table to be joined and the conditions to be used.
Parameters
- 
                array$parts
- list of joins to be transformed to string 
- 
                Cake\Database\Query$query
- The query that is being compiled 
- 
                Cake\Database\ValueBinder$generator
- the placeholder generator to be used in expressions 
Returns
string_buildSelectPart() ¶ protected
_buildSelectPart(array $parts, Cake\Database\Query $query, Cake\Database\ValueBinder $generator): stringHelper function used to build the string representation of a SELECT clause, it constructs the field list taking care of aliasing and converting expression objects to string. This function also constructs the DISTINCT clause for the query.
Parameters
- 
                array$parts
- list of fields to be transformed to string 
- 
                Cake\Database\Query$query
- The query that is being compiled 
- 
                Cake\Database\ValueBinder$generator
- the placeholder generator to be used in expressions 
Returns
string_buildSetPart() ¶ protected
_buildSetPart(array $parts, Cake\Database\Query $query, Cake\Database\ValueBinder $generator): stringHelper function to generate SQL for SET expressions.
Parameters
- 
                array$parts
- List of keys & values to set. 
- 
                Cake\Database\Query$query
- The query that is being compiled 
- 
                Cake\Database\ValueBinder$generator
- the placeholder generator to be used in expressions 
Returns
string_buildUnionPart() ¶ protected
_buildUnionPart(array $parts, Cake\Database\Query $query, Cake\Database\ValueBinder $generator): stringBuilds the SQL string for all the UNION clauses in this query, when dealing with query objects it will also transform them using their configured SQL dialect.
Parameters
- 
                array$parts
- list of queries to be operated with UNION 
- 
                Cake\Database\Query$query
- The query that is being compiled 
- 
                Cake\Database\ValueBinder$generator
- the placeholder generator to be used in expressions 
Returns
string_buildValuesPart() ¶ protected
_buildValuesPart(array $parts, Cake\Database\Query $query, Cake\Database\ValueBinder $generator): stringBuilds the SQL fragment for INSERT INTO.
Parameters
- 
                array$parts
- The values parts. 
- 
                Cake\Database\Query$query
- The query that is being compiled 
- 
                Cake\Database\ValueBinder$generator
- the placeholder generator to be used in expressions 
Returns
string_sqlCompiler() ¶ protected
_sqlCompiler(string $sql, Cake\Database\Query $query, Cake\Database\ValueBinder $generator): ClosureReturns a callable object that can be used to compile a SQL string representation of this query.
Parameters
- 
                string$sql
- initial sql string to append to 
- 
                Cake\Database\Query$query
- The query that is being compiled 
- 
                Cake\Database\ValueBinder$generator
- The placeholder and value binder object 
Returns
Closure_stringifyExpressions() ¶ protected
_stringifyExpressions(array $expressions, Cake\Database\ValueBinder $generator): arrayHelper function used to covert ExpressionInterface objects inside an array into their string representation.
Parameters
- 
                array$expressions
- list of strings and ExpressionInterface objects 
- 
                Cake\Database\ValueBinder$generator
- the placeholder generator to be used in expressions 
Returns
arraycompile() ¶ public
compile(Cake\Database\Query $query, Cake\Database\ValueBinder $generator): ClosureReturns the SQL representation of the provided query after generating the placeholders for the bound values using the provided generator
Parameters
- 
                Cake\Database\Query$query
- The query that is being compiled 
- 
                Cake\Database\ValueBinder$generator
- the placeholder generator to be used in expressions 
Returns
ClosureProperty Detail
$_deleteParts ¶ protected
The list of query clauses to traverse for generating a DELETE statement
Type
array$_insertParts ¶ protected
The list of query clauses to traverse for generating an INSERT statement
Type
array$_orderedUnion ¶ protected
Indicate whether or not this query dialect supports ordered unions.
Overridden in subclasses.
Type
bool$_selectParts ¶ protected
The list of query clauses to traverse for generating a SELECT statement
Type
array$_templates ¶ protected
List of sprintf templates that will be used for compiling the SQL for this query. There are some clauses that can be built as just as the direct concatenation of the internal parts, those are listed here.
Type
array$_updateParts ¶ protected
The list of query clauses to traverse for generating an UPDATE statement
Type
array