PHP Class Solar_Sql_Adapter_Mysql, php-framework-benchmarks

Author: Paul M. Jones ([email protected])
Inheritance: extends Solar_Sql_Adapter
Exibir arquivo Open project: pmjones/php-framework-benchmarks Class Usage Examples

Protected Properties

Property Type Description
$_ident_quote_prefix string The quote character before an entity name (table, index, etc).
$_ident_quote_suffix string The quote character after an entity name (table, index, etc).
$_native_solar array Note that fetchTableCols() will programmatically convert TINYINT(1) to 'bool' independent of this map.
$_pdo_type string The PDO adapter type.
$_solar_native array Map of Solar generic types to RDBMS native types used when creating portable tables.

Protected Methods

Method Description
_buildDsn ( array $info ) : string Creates a PDO-style DSN.
_createSequence ( string $name, integer $start = 1 ) : void Creates a sequence, optionally starting at a certain number.
_dropIndex ( string $table, string $name ) : void Drops an index.
_dropSequence ( string $name ) : void Drops a sequence.
_fetchIndexInfo ( string $table, string $schema ) : array Returns an array of index information for a table.
_fetchTableCols ( string $table, string $schema ) : array Returns an array describing the columns in a table.
_fetchTableList ( string $schema ) : array Returns a list of all tables in the database.
_getDefault ( string $default ) : scalar Given a native column SQL default value, finds a PHP literal value.
_modAutoincPrimary ( &$coldef, boolean $autoinc, boolean $primary ) : void Given a column definition, modifies the auto-increment and primary-key clauses in place.
_modSequenceName ( string $name ) : string Modifies the sequence name.
_nextSequence ( string $name ) : integer Gets a sequence number; creates the sequence if it does not exist.
_selectSingleFrom ( array $from ) : string Builds the FROM clause for a SELECT command; wraps it in parentheses to force precedence for MySQL.
_sqlCreateTable ( string $name, string $cols ) : string Builds a CREATE TABLE command string.

Method Details

_buildDsn() protected method

For example, "mysql:host=127.0.0.1;dbname=test"
protected _buildDsn ( array $info ) : string
$info array An array with host, post, name, etc. keys.
return string A PDO-style DSN.

_createSequence() protected method

Creates a sequence, optionally starting at a certain number.
protected _createSequence ( string $name, integer $start = 1 ) : void
$name string The sequence name to create.
$start integer The first sequence number to return.
return void

_dropIndex() protected method

Drops an index.
protected _dropIndex ( string $table, string $name ) : void
$table string The table of the index.
$name string The full index name.
return void

_dropSequence() protected method

Drops a sequence.
protected _dropSequence ( string $name ) : void
$name string The sequence name to drop.
return void

_fetchIndexInfo() protected method

Returns an array of index information for a table.
protected _fetchIndexInfo ( string $table, string $schema ) : array
$table string The table name to fetch indexes for.
$schema string The database in which the table resides.
return array An array of table indexes.

_fetchTableCols() protected method

Returns an array describing the columns in a table.
protected _fetchTableCols ( string $table, string $schema ) : array
$table string The table name to fetch columns for.
$schema string The database in which the table resides.
return array An array of table column information.

_fetchTableList() protected method

Returns a list of all tables in the database.
protected _fetchTableList ( string $schema ) : array
$schema string Fetch tbe list of tables in this database; when empty, uses the current database.
return array All table names in the database.

_getDefault() protected method

SQL NULLs are converted to PHP nulls. Non-literal values (such as keywords and functions) are also returned as null.
protected _getDefault ( string $default ) : scalar
$default string The column default SQL value.
return scalar A literal PHP value.

_modAutoincPrimary() protected method

Given a column definition, modifies the auto-increment and primary-key clauses in place.
protected _modAutoincPrimary ( &$coldef, boolean $autoinc, boolean $primary ) : void
$autoinc boolean Whether or not this is an auto-increment column.
$primary boolean Whether or not this is a primary-key column.
return void

_modSequenceName() protected method

MySQL doesn't have sequences, so this adapter uses a table instead. This means we have to deconflict between "real" tables and tables being used for sequences, so this method appends "__s" to the sequnce name.
protected _modSequenceName ( string $name ) : string
$name string The requested sequence name.
return string The modified sequence name.

_nextSequence() protected method

Gets a sequence number; creates the sequence if it does not exist.
protected _nextSequence ( string $name ) : integer
$name string The sequence name.
return integer The next sequence number.

_selectSingleFrom() protected method

Builds the FROM clause for a SELECT command; wraps it in parentheses to force precedence for MySQL.
protected _selectSingleFrom ( array $from ) : string
$from array The array of FROM clause elements.
return string The FROM clause.

_sqlCreateTable() protected method

Builds a CREATE TABLE command string.
protected _sqlCreateTable ( string $name, string $cols ) : string
$name string The table name to create.
$cols string The column definitions.
return string A CREATE TABLE command string.

Property Details

$_ident_quote_prefix protected_oe property

The quote character before an entity name (table, index, etc).
protected string $_ident_quote_prefix
return string

$_ident_quote_suffix protected_oe property

The quote character after an entity name (table, index, etc).
protected string $_ident_quote_suffix
return string

$_native_solar protected_oe property

Note that fetchTableCols() will programmatically convert TINYINT(1) to 'bool' independent of this map.
See also: fetchTableCols()
protected array $_native_solar
return array

$_pdo_type protected_oe property

The PDO adapter type.
protected string $_pdo_type
return string

$_solar_native protected_oe property

Map of Solar generic types to RDBMS native types used when creating portable tables.
protected array $_solar_native
return array