PHP Class PdoDataSource, recess

Author: Kris Jordan ([email protected])
Inheritance: extends PDO
Datei anzeigen Open project: KrisJordan/recess Class Usage Examples

Protected Properties

Property Type Description
$cachePrefix
$provider

Public Methods

Method Description
__construct ( mixed $dsn, string $username = '', string $password = '', array $driver_options = [] ) Creates a data source instance to represent a connection to the database.
cascadeTableDescriptor ( string $table, RecessTableDescriptor $descriptor ) Take a table descriptor and apply it / verify it on top of the table descriptor returned from a database. This is used to ensure a model's marked up fields are in congruence with the table. Also checks to ensure the number of columns in the cascaded descriptor do not outnumber the actual number of columns. Finally with a database like sqlite which largely ignores column typing it enables the model to inform the actual Recess type of the column.
createTableSql ( $tableDescriptor )
dropTable ( string $table ) Drop a table from the database.
emptyTable ( string $table ) Empty a table in the database.
executeSqlBuilder ( SqlBuilder $builder, string $action ) : boolean Execute the query from a SqlBuilder instance.
executeStatement ( $statement, $arguments )
explainStatement ( $statement, $arguments )
getColumns ( string $table ) : array(string) List the column names of a table alphabetically.
getTableDescriptor ( string $table ) : RecessTableDescriptor Retrieve the a table's RecessTableDescriptor.
getTables ( ) : array(string) List the tables in a data source alphabetically.
prepareStatement ( $statement, $arguments )
queryForClass ( SqlBuilder $builder, string $className ) : array($className) Takes the SQL and arguments (array of Criterion) and returns an array of objects of type $className.
select ( string $table = '' ) : PdoDataSet Begin a select operation by returning a new, unrealized PdoDataSet

Protected Methods

Method Description
instantiateProvider ( ) : IPdoDataSourceProvider Locate the pdo driver specific data source provider, instantiate, and return.

Method Details

__construct() public method

The first argument can either be a string DSN or an array which contains the construction arguments.
public __construct ( mixed $dsn, string $username = '', string $password = '', array $driver_options = [] )
$dsn mixed String DSN or array of arguments (dsn, username, password)
$username string
$password string
$driver_options array

cascadeTableDescriptor() public method

Take a table descriptor and apply it / verify it on top of the table descriptor returned from a database. This is used to ensure a model's marked up fields are in congruence with the table. Also checks to ensure the number of columns in the cascaded descriptor do not outnumber the actual number of columns. Finally with a database like sqlite which largely ignores column typing it enables the model to inform the actual Recess type of the column.
public cascadeTableDescriptor ( string $table, RecessTableDescriptor $descriptor )
$table string
$descriptor RecessTableDescriptor

createTableSql() public method

public createTableSql ( $tableDescriptor )

dropTable() public method

Drop a table from the database.
public dropTable ( string $table )
$table string

emptyTable() public method

Empty a table in the database.
public emptyTable ( string $table )
$table string

executeSqlBuilder() public method

Execute the query from a SqlBuilder instance.
public executeSqlBuilder ( SqlBuilder $builder, string $action ) : boolean
$builder SqlBuilder
$action string
return boolean

executeStatement() public method

public executeStatement ( $statement, $arguments )

explainStatement() public method

public explainStatement ( $statement, $arguments )

getColumns() public method

List the column names of a table alphabetically.
public getColumns ( string $table ) : array(string)
$table string Table whose columns to list.
return array(string)

getTableDescriptor() public method

Retrieve the a table's RecessTableDescriptor.
public getTableDescriptor ( string $table ) : RecessTableDescriptor
$table string
return RecessTableDescriptor

getTables() public method

List the tables in a data source alphabetically.
public getTables ( ) : array(string)
return array(string)

instantiateProvider() protected method

Throws ProviderDoesNotExistException for a pdo driver without a Recess provider.
protected instantiateProvider ( ) : IPdoDataSourceProvider
return IPdoDataSourceProvider

prepareStatement() public method

public prepareStatement ( $statement, $arguments )

queryForClass() public method

Takes the SQL and arguments (array of Criterion) and returns an array of objects of type $className.
public queryForClass ( SqlBuilder $builder, string $className ) : array($className)
$builder SqlBuilder
$className string the type to fill from query results.
return array($className)

select() public method

Begin a select operation by returning a new, unrealized PdoDataSet
public select ( string $table = '' ) : PdoDataSet
$table string Optional parameter that sets the from clause of the select to a table.
return PdoDataSet

Property Details

$cachePrefix protected_oe property

protected $cachePrefix

$provider protected_oe property

protected $provider