Methods summary
public
|
|
public
|
#
__call( string $method, array $args )
Delegate unknown methods to the _write adapter.
Delegate unknown methods to the _write adapter.
Parameters
|
public
string
|
#
adapterName( )
Returns the human-readable name of the adapter. Use mixed case - one
can always use downcase if needed.
Returns the human-readable name of the adapter. Use mixed case - one
can always use downcase if needed.
Returns
string
Implementation of
|
public
boolean
|
#
supportsMigrations( )
Does this adapter support migrations?
Does this adapter support migrations?
Returns
boolean
Implementation of
|
public
boolean
|
#
supportsCountDistinct( )
Does this adapter support using DISTINCT within COUNT? This is +true+
for all adapters except sqlite.
Does this adapter support using DISTINCT within COUNT? This is +true+
for all adapters except sqlite.
Returns
boolean
Implementation of
|
public
boolean
|
#
prefetchPrimaryKey( mixed $tableName = null )
Should primary key values be selected from their corresponding
sequence before the insert statement? If true, next_sequence_value
is called before each insert to set the record's primary key.
This is false for all adapters but Firebird.
Should primary key values be selected from their corresponding
sequence before the insert statement? If true, next_sequence_value
is called before each insert to set the record's primary key.
This is false for all adapters but Firebird.
Returns
boolean
Implementation of
|
public
|
#
connect( )
Connect to the db.
Todo:
Lazy connect?
Implementation of
|
public
boolean
|
#
isActive( )
Is the connection active?
Is the connection active?
Returns
boolean
Implementation of
|
public
|
#
reconnect( )
Reconnect to the db.
Implementation of
|
public
|
|
public
resource
|
#
rawConnection( )
Provides access to the underlying database connection. Useful for when
you need to call a proprietary method such as postgresql's
lo_* methods.
Provides access to the underlying database connection. Useful for when
you need to call a proprietary method such as postgresql's
lo_* methods.
Returns
resource
Implementation of
|
public
string
|
#
quoteString( string $string )
Quotes a string, escaping any special characters.
Quotes a string, escaping any special characters.
Parameters
Returns
string
Implementation of
|
public
PDOStatement
|
#
select( string $sql, mixed $arg1 = null, string $arg2 = null )
Returns an array of records with the column names as keys, and
column values as values.
Returns an array of records with the column names as keys, and
column values as values.
Parameters
- $sql
- SQL statement.
- $arg1
- <p>Either an array of bound parameters or a query
name.</p>
- $arg2
- <p>If $arg1 contains bound parameters, the query
name.</p>
Returns
PDOStatement
Throws
Implementation of
|
public
array
|
#
selectAll( string $sql, mixed $arg1 = null, string $arg2 = null )
Returns an array of record hashes with the column names as keys and
column values as values.
Returns an array of record hashes with the column names as keys and
column values as values.
Parameters
- $sql
- SQL statement.
- $arg1
- <p>Either an array of bound parameters or a query
name.</p>
- $arg2
- <p>If $arg1 contains bound parameters, the query
name.</p>
Returns
array
Throws
Implementation of
|
public
array
|
#
selectOne( string $sql, mixed $arg1 = null, string $arg2 = null )
Returns a record hash with the column names as keys and column values
as values.
Returns a record hash with the column names as keys and column values
as values.
Parameters
- $sql
- SQL statement.
- $arg1
- <p>Either an array of bound parameters or a query
name.</p>
- $arg2
- <p>If $arg1 contains bound parameters, the query
name.</p>
Returns
array
Throws
Implementation of
|
public
string
|
#
selectValue( string $sql, mixed $arg1 = null, string $arg2 = null )
Returns a single value from a record
Returns a single value from a record
Parameters
- $sql
- SQL statement.
- $arg1
- <p>Either an array of bound parameters or a query
name.</p>
- $arg2
- <p>If $arg1 contains bound parameters, the query
name.</p>
Returns
string
Throws
Implementation of
|
public
array
|
#
selectValues( string $sql, mixed $arg1 = null, string $arg2 = null )
Returns an array of the values of the first column in a select:
selectValues("SELECT id FROM companies LIMIT 3") => [1,2,3]
Returns an array of the values of the first column in a select: selectValues("SELECT id FROM companies LIMIT 3") => [1,2,3]
Parameters
- $sql
- SQL statement.
- $arg1
- <p>Either an array of bound parameters or a query
name.</p>
- $arg2
- <p>If $arg1 contains bound parameters, the query
name.</p>
Returns
array
Throws
Implementation of
|
public
array
|
#
selectAssoc( string $sql, mixed $arg1 = null, string $arg2 = null )
Returns an array where the keys are the first column of a select, and the
values are the second column:
Returns an array where the keys are the first column of a select, and the
values are the second column:
selectAssoc("SELECT id, name FROM companies LIMIT 3") => [1 => 'Ford', 2 => 'GM', 3 => 'Chrysler']
Parameters
- $sql
- SQL statement.
- $arg1
- <p>Either an array of bound parameters or a query
name.</p>
- $arg2
- <p>If $arg1 contains bound parameters, the query
name.</p>
Returns
array
Throws
Implementation of
|
public
PDOStatement
|
#
execute( string $sql, mixed $arg1 = null, string $arg2 = null )
Executes the SQL statement in the context of this connection.
Executes the SQL statement in the context of this connection.
Parameters
- $sql
- SQL statement.
- $arg1
- <p>Either an array of bound parameters or a query
name.</p>
- $arg2
- <p>If $arg1 contains bound parameters, the query
name.</p>
Returns
PDOStatement
Throws
Implementation of
|
public
integer
|
#
insert( string $sql, mixed $arg1 = null, string $arg2 = null, string $pk = null, integer $idValue = null, string $sequenceName = null )
Returns the last auto-generated ID from the affected table.
Returns the last auto-generated ID from the affected table.
Parameters
- $sql
- SQL statement.
- $arg1
- <p>Either an array of bound parameters or a
query name.</p>
- $arg2
- <p>If $arg1 contains bound parameters, the
query name.</p>
- $pk
- TODO
- $idValue
- TODO
- $sequenceName
- TODO
Returns
integer Last inserted ID.
Throws
Implementation of
|
public
integer
|
#
update( string $sql, mixed $arg1 = null, string $arg2 = null )
Executes the update statement and returns the number of rows affected.
Executes the update statement and returns the number of rows affected.
Parameters
- $sql
- SQL statement.
- $arg1
- <p>Either an array of bound parameters or a query
name.</p>
- $arg2
- <p>If $arg1 contains bound parameters, the query
name.</p>
Returns
integer Number of rows affected.
Throws
Implementation of
|
public
integer
|
#
delete( string $sql, mixed $arg1 = null, string $arg2 = null )
Executes the delete statement and returns the number of rows affected.
Executes the delete statement and returns the number of rows affected.
Parameters
- $sql
- SQL statement.
- $arg1
- <p>Either an array of bound parameters or a query
name.</p>
- $arg2
- <p>If $arg1 contains bound parameters, the query
name.</p>
Returns
integer Number of rows affected.
Throws
Implementation of
|
public
boolean
|
#
transactionStarted( )
Check if a transaction has been started.
Check if a transaction has been started.
Returns
boolean True if transaction has been started.
Implementation of
|
public
|
#
beginDbTransaction( )
Begins the transaction (and turns off auto-committing).
Begins the transaction (and turns off auto-committing).
Implementation of
|
public
|
#
commitDbTransaction( )
Commits the transaction (and turns on auto-committing).
Commits the transaction (and turns on auto-committing).
Implementation of
|
public
|
#
rollbackDbTransaction( )
Rolls back the transaction (and turns on auto-committing). Must be
done if the transaction block raises an exception or returns false.
Rolls back the transaction (and turns on auto-committing). Must be
done if the transaction block raises an exception or returns false.
Implementation of
|
public
string
|
#
addLimitOffset( string $sql, array $options )
Appends +LIMIT+ and +OFFSET+ options to a SQL statement.
Appends +LIMIT+ and +OFFSET+ options to a SQL statement.
Parameters
- $sql
- SQL statement.
- $options
- TODO
Returns
string
Implementation of
|
public
|
#
addLock( string & $sql, array $options = array() )
Appends a locking clause to an SQL statement.
This method modifies the +sql+ parameter.
Appends a locking clause to an SQL statement.
This method modifies the +sql+ parameter.
SELECT * FROM suppliers FOR UPDATE add_lock! 'SELECT * FROM suppliers', :lock => true add_lock! 'SELECT * FROM suppliers', :lock => ' FOR UPDATE'
Parameters
- $sql
- $sql SQL statment.
- $options
- TODO.
Implementation of
|