PHP Class lithium\data\source\database\adapter\Sqlite3

Inheritance: extends lithium\data\source\Database
Afficher le fichier Open project: unionofrad/lithium Class Usage Examples

Protected Properties

Свойство Type Description
$_columns array Sqlite3 column type definitions.
$_constraints array Column contraints
$_metas array Column specific metas used on table creating By default 'quote' is false and 'join' is ' '
$_quotes array Pair of opening and closing quote characters used for quoting identifiers in queries.
$_regex array Holds commonly regular expressions used in this class.

Méthodes publiques

Méthode Description
__construct ( array $config = [] ) : void Constructor.
connect ( ) : boolean Connects to the database by constructing DSN string and creating a PDO intance using the parent class. Will set specific options on the connection as provided.
describe ( mixed $entity, array $fields = [], array $meta = [] ) : array Gets the column schema for a given Sqlite3 table.
disconnect ( ) : boolean Disconnects the adapter from the database.
enabled ( string $feature = null ) : boolean Check for required PHP extension, or supported database feature.
encoding ( string $encoding = null ) : mixed Gets or sets the encoding for the connection.
error ( ) : array Retrieves database error message and error code.
sources ( string $model = null ) : array Returns the list of tables in the currently-connected database.

Méthodes protégées

Méthode Description
_buildColumn ( array $field ) : string Helper for Database::column().
_column ( string $real ) : string Converts database-layer column types to basic types.
_execute ( string $sql, array $options = [] ) : Result Execute a given query.
_insertId ( object $query ) : mixed Gets the last auto-generated ID from the query that inserted a new record.

Method Details

__construct() public méthode

Constructor.
See also: lithium\data\source\Database::__construct()
See also: lithium\data\Source::__construct()
See also: lithium\data\Connections::add()
public __construct ( array $config = [] ) : void
$config array The available configuration options are the following. Further options are inherited from the parent classes. Typically, these parameters are set in `Connections::add()`, when adding the adapter to the list of active connections. - `'database'` _string_: Defaults to in-memory database `':memory:'`.
Résultat void

_buildColumn() protected méthode

Helper for Database::column().
See also: lithium\data\Database::column()
protected _buildColumn ( array $field ) : string
$field array A field array.
Résultat string SQL column string.

_column() protected méthode

Converts database-layer column types to basic types.
protected _column ( string $real ) : string
$real string Real database-layer column type (i.e. "varchar(255)")
Résultat string Abstract column type (i.e. "string")

_execute() protected méthode

Execute a given query.
See also: lithium\data\source\Database::renderCommand()
protected _execute ( string $sql, array $options = [] ) : Result
$sql string The sql string to execute
$options array No available options.
Résultat lithium\data\source\Result Returns a result object if the query was successful.

_insertId() protected méthode

Gets the last auto-generated ID from the query that inserted a new record.
protected _insertId ( object $query ) : mixed
$query object The `Query` object associated with the query which generated
Résultat mixed Returns the last inserted ID key for an auto-increment column or a column bound to a sequence.

connect() public méthode

Connects to the database by constructing DSN string and creating a PDO intance using the parent class. Will set specific options on the connection as provided.
public connect ( ) : boolean
Résultat boolean Returns `true` if a database connection could be established, otherwise `false`.

describe() public méthode

A column type may not always be available, i.e. when during creation of the column no type was declared. Those columns are internally treated by SQLite3 as having a NONE affinity. The final schema will contain no information about type and length of such columns (both values will be null).
public describe ( mixed $entity, array $fields = [], array $meta = [] ) : array
$entity mixed Specifies the table name for which the schema should be returned, or the class name of the model object requesting the schema, in which case the model class will be queried for the correct table name.
$fields array Any schema data pre-defined by the model.
$meta array
Résultat array Returns an associative array describing the given table's schema, where the array keys are the available fields, and the values are arrays describing each field, containing the following keys: - `'type'`: The field type name

disconnect() public méthode

Disconnects the adapter from the database.
public disconnect ( ) : boolean
Résultat boolean True on success, else false.

enabled() public static méthode

Check for required PHP extension, or supported database feature.
public static enabled ( string $feature = null ) : boolean
$feature string Test for support for a specific feature, i.e. `'transactions'`.
Résultat boolean Returns `true` if the particular feature (or if Sqlite) support is enabled, otherwise `false`.

encoding() public méthode

Gets or sets the encoding for the connection.
public encoding ( string $encoding = null ) : mixed
$encoding string If setting the encoding, this is the name of the encoding to set, i.e. `'utf8'` or `'UTF-8'` (both formats are valid).
Résultat mixed If setting the encoding; returns `true` on success, or `false` on failure. When getting, returns the encoding as a string.

error() public méthode

Retrieves database error message and error code.
public error ( ) : array
Résultat array

sources() public méthode

Returns the list of tables in the currently-connected database.
public sources ( string $model = null ) : array
$model string The fully-name-spaced class name of the model object making the request.
Résultat array Returns an array of objects to which models can connect.

Property Details

$_columns protected_oe property

Sqlite3 column type definitions.
protected array $_columns
Résultat array

$_constraints protected_oe property

Column contraints
protected array $_constraints
Résultat array

$_metas protected_oe property

Column specific metas used on table creating By default 'quote' is false and 'join' is ' '
protected array $_metas
Résultat array

$_quotes protected_oe property

Pair of opening and closing quote characters used for quoting identifiers in queries.
protected array $_quotes
Résultat array

$_regex protected_oe property

Holds commonly regular expressions used in this class.
See also: lithium\data\source\database\adapter\Sqlite3::describe()
See also: lithium\data\source\database\adapter\Sqlite3::_column()
protected array $_regex
Résultat array