CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 4.0 Strawberry API

  • Overview
  • Version:
    • 4.0
      • 4.0
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Cake
    • Auth
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
      • Dialect
      • Driver
      • Exception
      • Expression
      • Log
      • Retry
      • Schema
      • Statement
      • Type
    • Datasource
    • Error
    • Event
    • Filesystem
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • Shell
    • TestSuite
    • Utility
    • Validation
    • View

Class SqliteCompiler

Responsible for compiling a Query object into its SQL representation for SQLite

Namespace: Cake\Database

Properties summary

  • $_deleteParts protected
    array

    The list of query clauses to traverse for generating a DELETE statement

  • $_insertParts protected
    array

    The list of query clauses to traverse for generating an INSERT statement

  • $_orderedUnion protected
    bool

    SQLite does not support ORDER BY in UNION queries.

  • $_quotedSelectAliases protected
    bool

    Indicate whether aliases in SELECT clause need to be always quoted.

  • $_selectParts protected
    array

    The list of query clauses to traverse for generating a SELECT statement

  • $_templates protected
    array

    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.

  • $_updateParts protected
    array

    The list of query clauses to traverse for generating an UPDATE statement

Method Summary

  • _buildFromPart() protected

    Helper 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() protected

    Builds the SQL fragment for INSERT INTO.

  • _buildJoinPart() protected

    Helper 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.

  • _buildModifierPart() protected

    Builds the SQL modifier fragment

  • _buildSelectPart() protected

    Helper 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() protected

    Helper function to generate SQL for SET expressions.

  • _buildUnionPart() protected

    Builds 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.

  • _buildUpdatePart() protected

    Builds the SQL fragment for UPDATE.

  • _buildValuesPart() protected

    Builds the SQL fragment for INSERT INTO.

  • _sqlCompiler() protected

    Returns a callable object that can be used to compile a SQL string representation of this query.

  • _stringifyExpressions() protected

    Helper function used to covert ExpressionInterface objects inside an array into their string representation.

  • compile() public

    Returns 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)

Helper 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)

Builds 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

SQL fragment.

_buildJoinPart() protected

¶

_buildJoinPart(array $parts, \Cake\Database\Query $query, \Cake\Database\ValueBinder $generator)

Helper 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

_buildModifierPart() protected

¶

_buildModifierPart(array $parts, \Cake\Database\Query $query, \Cake\Database\ValueBinder $generator)

Builds the SQL modifier fragment

Parameters
array $parts

The query modifier 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

SQL fragment.

_buildSelectPart() protected

¶

_buildSelectPart(array $parts, \Cake\Database\Query $query, \Cake\Database\ValueBinder $generator)

Helper 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)

Helper 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)

Builds 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

_buildUpdatePart() protected

¶

_buildUpdatePart(array $parts, \Cake\Database\Query $query, \Cake\Database\ValueBinder $generator)

Builds the SQL fragment for UPDATE.

Parameters
array $parts

The update 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

SQL fragment.

_buildValuesPart() protected

¶

_buildValuesPart(array $parts, \Cake\Database\Query $query, \Cake\Database\ValueBinder $generator)

Builds 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

SQL fragment.

_sqlCompiler() protected

¶

_sqlCompiler(string $sql, \Cake\Database\Query $query, \Cake\Database\ValueBinder $generator)

Returns 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, bool $wrap)

Helper 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

bool $wrap optional

Whether to wrap each expression object with parenthesis

Returns
array

compile() public

¶

compile(\Cake\Database\Query $query, \Cake\Database\ValueBinder $generator)

Returns 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
string

Property 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

SQLite does not support ORDER BY in UNION queries.

Type
bool

$_quotedSelectAliases ¶ protected

Indicate whether aliases in SELECT clause need to be always quoted.

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