Fr3nch13/CakePHP Utilities

Sqlite extends Driver
in package
uses SqlDialectTrait, TupleComparisonTranslatorTrait

Class Sqlite

Table of Contents

Constants

MAX_ALIAS_LENGTH  = null
RETRY_ERROR_CODES  = []

Properties

$_autoQuoting  : bool
Indicates whether the driver is doing automatic identifier quoting for all queries
$_baseConfig  : array<string, mixed>
Base configuration settings for Sqlite driver
$_config  : array<string, mixed>
Configuration data.
$_connection  : PDO
Instance of PDO.
$_dateParts  : array<string, string>
Mapping of date parts.
$_endQuote  : string
String used to end a database identifier quoting to make it safe
$_schemaDialect  : SqliteSchemaDialect|null
The schema dialect class for this driver
$_startQuote  : string
String used to start a database identifier quoting to make it safe
$_supportsWindowFunctions  : bool|null
Whether the connected server supports window functions.
$_version  : string|null
The server version
$connectRetries  : int
The last number of connection retry attempts.
$featureVersions  : array<string, string>
Mapping of feature to db server version for feature availability checks.

Methods

__construct()  : mixed
Constructor
__debugInfo()  : array<string, mixed>
Returns an array that can be used to describe the internal state of this object.
__destruct()  : mixed
Destructor
beginTransaction()  : bool
Starts a transaction.
commitTransaction()  : bool
Commits a transaction.
compileQuery()  : array<string|int, mixed>
Transforms the passed query to this Driver's dialect and returns an instance of the transformed query and the full compiled SQL string.
connect()  : bool
Establishes a connection to the database server
disableAutoQuoting()  : $this
Disable auto quoting of identifiers in queries.
disableForeignKeySQL()  : string
Get the SQL for disabling foreign keys.
disconnect()  : void
Disconnects from database server.
enableAutoQuoting()  : $this
Sets whether this driver should automatically quote identifiers in queries.
enabled()  : bool
Returns whether php is able to use this driver for connecting to database
enableForeignKeySQL()  : string
Get the SQL for enabling foreign keys.
getConnection()  : PDO
Get the internal PDO connection instance.
getConnectRetries()  : int
Returns the number of connection retry attempts made.
getMaxAliasLength()  : int|null
Returns the maximum alias length allowed.
inTransaction()  : bool
Returns whether a transaction is active for connection.
isAutoQuotingEnabled()  : bool
Returns whether this driver should automatically quote identifiers in queries.
isConnected()  : bool
Checks whether the driver is connected.
lastInsertId()  : string|int
Returns last id generated for a table or sequence in database.
newCompiler()  : QueryCompiler
Returns an instance of a QueryCompiler.
newTableSchema()  : TableSchema
Constructs new TableSchema.
prepare()  : StatementInterface
Prepares a sql statement to be executed
queryTranslator()  : Closure
Returns a callable function that will be used to transform a passed Query object.
quote()  : string
Returns a value in a safe representation to be used in a query string
quoteIdentifier()  : string
Quotes a database identifier (a column name, table name, etc..) to be used safely in queries without the risk of using reserved words.
rollbackTransaction()  : bool
Rollbacks a transaction.
schema()  : string
Returns the schema name that's being used.
schemaDialect()  : SchemaDialect
Get the schema dialect.
schemaValue()  : string
Escapes values for use in schema definitions.
setConnection()  : $this
Set the internal PDO connection instance.
supports()  : bool
Returns whether the driver supports the feature.
supportsCTEs()  : bool
Returns true if the server supports common table expressions.
supportsDynamicConstraints()  : bool
Returns whether the driver supports adding or dropping constraints to already created tables.
supportsQuoting()  : bool
Checks if the driver supports quoting, as PDO_ODBC does not support it.
supportsSavePoints()  : bool
Returns whether this driver supports save points for nested transactions.
supportsWindowFunctions()  : bool
Returns true if the connected server supports window functions.
version()  : string
Returns connected server version.
_connect()  : bool
Establishes a connection to the database server
_expressionTranslators()  : array<string|int, mixed>
_transformFunctionExpression()  : void
Receives a FunctionExpression and changes it so that it conforms to this SQL dialect.

Constants

MAX_ALIAS_LENGTH

protected int|null MAX_ALIAS_LENGTH = null

Maximum alias length or null if no limit

RETRY_ERROR_CODES

protected array<string|int, int> RETRY_ERROR_CODES = []

DB-specific error codes that allow connect retry

Properties

$_autoQuoting

Indicates whether the driver is doing automatic identifier quoting for all queries

protected bool $_autoQuoting = false

$_baseConfig

Base configuration settings for Sqlite driver

protected array<string, mixed> $_baseConfig = ['persistent' => false, 'username' => null, 'password' => null, 'database' => ':memory:', 'encoding' => 'utf8', 'mask' => 0644, 'cache' => null, 'mode' => null, 'flags' => [], 'init' => []]
  • mask The mask used for created database

$_config

Configuration data.

protected array<string, mixed> $_config

$_connection

Instance of PDO.

protected PDO $_connection

$_dateParts

Mapping of date parts.

protected array<string, string> $_dateParts = ['day' => 'd', 'hour' => 'H', 'month' => 'm', 'minute' => 'M', 'second' => 'S', 'week' => 'W', 'year' => 'Y']

$_endQuote

String used to end a database identifier quoting to make it safe

protected string $_endQuote = '"'

$_schemaDialect

The schema dialect class for this driver

protected SqliteSchemaDialect|null $_schemaDialect

$_startQuote

String used to start a database identifier quoting to make it safe

protected string $_startQuote = '"'

$_supportsWindowFunctions

Whether the connected server supports window functions.

protected bool|null $_supportsWindowFunctions

$_version

The server version

protected string|null $_version

$connectRetries

The last number of connection retry attempts.

protected int $connectRetries = 0

$featureVersions

Mapping of feature to db server version for feature availability checks.

protected array<string, string> $featureVersions = ['cte' => '3.8.3', 'window' => '3.28.0']

Methods

__construct()

Constructor

public __construct([array<string, mixed> $config = [] ]) : mixed
Parameters
$config : array<string, mixed> = []

The configuration for the driver.

Tags
throws
InvalidArgumentException

__debugInfo()

Returns an array that can be used to describe the internal state of this object.

public __debugInfo() : array<string, mixed>
Return values
array<string, mixed>

__destruct()

Destructor

public __destruct() : mixed

beginTransaction()

Starts a transaction.

public beginTransaction() : bool
Tags
inheritDoc
Return values
bool

True on success, false otherwise.

commitTransaction()

Commits a transaction.

public commitTransaction() : bool
Tags
inheritDoc
Return values
bool

True on success, false otherwise.

compileQuery()

Transforms the passed query to this Driver's dialect and returns an instance of the transformed query and the full compiled SQL string.

public compileQuery(Query $query, ValueBinder $binder) : array<string|int, mixed>
Parameters
$query : Query

The query to compile.

$binder : ValueBinder

The value binder to use.

Tags
inheritDoc
Return values
array<string|int, mixed>

containing 2 entries. The first entity is the transformed query and the second one the compiled SQL.

connect()

Establishes a connection to the database server

public connect() : bool
Return values
bool

true on success

disableAutoQuoting()

Disable auto quoting of identifiers in queries.

public disableAutoQuoting() : $this
Tags
inheritDoc
Return values
$this

disableForeignKeySQL()

Get the SQL for disabling foreign keys.

public disableForeignKeySQL() : string
Tags
inheritDoc
Return values
string

disconnect()

Disconnects from database server.

public disconnect() : void
Tags
inheritDoc

enableAutoQuoting()

Sets whether this driver should automatically quote identifiers in queries.

public enableAutoQuoting([bool $enable = true ]) : $this
Parameters
$enable : bool = true

Whether to enable auto quoting

Tags
inheritDoc
Return values
$this

enabled()

Returns whether php is able to use this driver for connecting to database

public enabled() : bool
Return values
bool

true if it is valid to use this driver

enableForeignKeySQL()

Get the SQL for enabling foreign keys.

public enableForeignKeySQL() : string
Tags
inheritDoc
Return values
string

getConnection()

Get the internal PDO connection instance.

public getConnection() : PDO
Return values
PDO

getConnectRetries()

Returns the number of connection retry attempts made.

public getConnectRetries() : int
Return values
int

getMaxAliasLength()

Returns the maximum alias length allowed.

public getMaxAliasLength() : int|null

This can be different from the maximum identifier length for columns.

Return values
int|null

Maximum alias length or null if no limit

inTransaction()

Returns whether a transaction is active for connection.

public inTransaction() : bool
Return values
bool

isAutoQuotingEnabled()

Returns whether this driver should automatically quote identifiers in queries.

public isAutoQuotingEnabled() : bool
Tags
inheritDoc
Return values
bool

isConnected()

Checks whether the driver is connected.

public isConnected() : bool
Tags
inheritDoc
Return values
bool

lastInsertId()

Returns last id generated for a table or sequence in database.

public lastInsertId([string|null $table = null ][, string|null $column = null ]) : string|int
Parameters
$table : string|null = null

table name or sequence to get last insert value from.

$column : string|null = null

the name of the column representing the primary key.

Tags
inheritDoc
Return values
string|int

newCompiler()

Returns an instance of a QueryCompiler.

public newCompiler() : QueryCompiler
Tags
inheritDoc
Return values
QueryCompiler

newTableSchema()

Constructs new TableSchema.

public newTableSchema(string $table[, array<string|int, mixed> $columns = [] ]) : TableSchema
Parameters
$table : string

The table name.

$columns : array<string|int, mixed> = []

The list of columns for the schema.

Tags
inheritDoc
Return values
TableSchema

queryTranslator()

Returns a callable function that will be used to transform a passed Query object.

public abstract queryTranslator(string $type) : Closure
Parameters
$type : string

The type of query to be transformed (select, insert, update, delete).

Tags
inheritDoc
Return values
Closure

quote()

Returns a value in a safe representation to be used in a query string

public quote(mixed $value[, mixed $type = PDO::PARAM_STR ]) : string
Parameters
$value : mixed

The value to quote.

$type : mixed = PDO::PARAM_STR

Must be one of the \PDO::PARAM_* constants

Tags
inheritDoc
Return values
string

quoteIdentifier()

Quotes a database identifier (a column name, table name, etc..) to be used safely in queries without the risk of using reserved words.

public abstract quoteIdentifier(string $identifier) : string
Parameters
$identifier : string

The identifier expression to quote.

Tags
inheritDoc
Return values
string

rollbackTransaction()

Rollbacks a transaction.

public rollbackTransaction() : bool
Tags
inheritDoc
Return values
bool

True on success, false otherwise.

schema()

Returns the schema name that's being used.

public schema() : string
Tags
inheritDoc
Return values
string

schemaValue()

Escapes values for use in schema definitions.

public schemaValue(mixed $value) : string
Parameters
$value : mixed

The value to escape.

Tags
inheritDoc
Return values
string

String for use in schema definitions.

setConnection()

Set the internal PDO connection instance.

public setConnection(PDO $connection) : $this
Parameters
$connection : PDO

PDO instance.

Tags
psalm-suppress

MoreSpecificImplementedParamType

Return values
$this

supports()

Returns whether the driver supports the feature.

public supports(string $feature) : bool
Parameters
$feature : string

Driver feature name

Tags
inheritDoc
Return values
bool

supportsCTEs()

Returns true if the server supports common table expressions.

public supportsCTEs() : bool

Use supports(DriverInterface::FEATURE_CTE) instead

Return values
bool

supportsDynamicConstraints()

Returns whether the driver supports adding or dropping constraints to already created tables.

public supportsDynamicConstraints() : bool
Tags
inheritDoc
Return values
bool

True if driver supports dynamic constraints.

supportsQuoting()

Checks if the driver supports quoting, as PDO_ODBC does not support it.

public supportsQuoting() : bool

Use supports(DriverInterface::FEATURE_QUOTE) instead

Return values
bool

supportsSavePoints()

Returns whether this driver supports save points for nested transactions.

public supportsSavePoints() : bool
Tags
inheritDoc
Return values
bool

True if save points are supported, false otherwise.

supportsWindowFunctions()

Returns true if the connected server supports window functions.

public supportsWindowFunctions() : bool

Use supports(DriverInterface::FEATURE_WINDOW) instead

Return values
bool

version()

Returns connected server version.

public version() : string
Return values
string

_connect()

Establishes a connection to the database server

protected _connect(string $dsn, array<string, mixed> $config) : bool
Parameters
$dsn : string

A Driver-specific PDO-DSN

$config : array<string, mixed>

configuration to be used for creating connection

Return values
bool

true on success

_expressionTranslators()

protected _expressionTranslators() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

_transformFunctionExpression()

Receives a FunctionExpression and changes it so that it conforms to this SQL dialect.

protected _transformFunctionExpression(FunctionExpression $expression) : void
Parameters
$expression : FunctionExpression

The function expression to convert to TSQL.


        
On this page

Search results