The dibi driver interacting with databases via ODBC connections.
Driver options: - dsn => driver specific DSN - username (or user) -
password (or pass) - persistent (bool) => try to find a persistent link? -
resource (resource) => existing connection resource - lazy, profiler, result,
substitutes, ... => see DibiConnection options
Methods summary
public
|
|
public
|
#
connect( array & $config )
Connects to a database.
Parameters
Throws
Implementation of
|
public
|
#
disconnect( )
Disconnects from a database.
Disconnects from a database.
Throws
Implementation of
|
public
IDibiResultDriver|null
|
#
query( string $sql )
Executes the SQL query.
Parameters
- $sql
string SQL statement.
Returns
Throws
Implementation of
|
public
integer|false
|
#
getAffectedRows( )
Gets the number of affected rows by the last INSERT, UPDATE or DELETE
query.
Gets the number of affected rows by the last INSERT, UPDATE or DELETE
query.
Returns
integer|false number of rows or FALSE on error
Implementation of
|
public
integer|false
|
#
getInsertId( $sequence )
Retrieves the ID generated for an AUTO_INCREMENT column by the previous
INSERT query.
Retrieves the ID generated for an AUTO_INCREMENT column by the previous
INSERT query.
Returns
integer|false int on success or FALSE on failure
Implementation of
|
public
|
#
begin( string $savepoint = NULL )
Begins a transaction (if supported).
Begins a transaction (if supported).
Parameters
- $savepoint
string optional savepoint name
Throws
Implementation of
|
public
|
#
commit( string $savepoint = NULL )
Commits statements in a transaction.
Commits statements in a transaction.
Parameters
- $savepoint
string optional savepoint name
Throws
Implementation of
|
public
|
#
rollback( string $savepoint = NULL )
Rollback changes in a transaction.
Rollback changes in a transaction.
Parameters
- $savepoint
string optional savepoint name
Throws
Implementation of
|
public
boolean
|
|
public
mixed
|
#
getResource( )
Returns the connection resource.
Returns the connection resource.
Returns
mixed
Implementation of
|
public
IDibiReflector
|
#
getReflector( )
Returns the connection reflector.
Returns the connection reflector.
Returns
Implementation of
|
public
IDibiResultDriver
|
#
createResultDriver( resource $resource )
Result set driver factory.
Result set driver factory.
Parameters
Returns
|
public
string
|
#
escape( mixed $value, string $type )
Encodes data for use in a SQL statement.
Encodes data for use in a SQL statement.
Parameters
- $value
mixed value
- $type
string type (dibi::TEXT, dibi::BOOL, ...)
Returns
string encoded value
Throws
Implementation of
|
public
string
|
#
escapeLike( string $value, integer $pos )
Encodes string for use in a LIKE statement.
Encodes string for use in a LIKE statement.
Parameters
- $value
string
- $pos
integer
Returns
string
Implementation of
|
public
string
|
#
unescape( string $value, string $type )
Decodes data from result set.
Decodes data from result set.
Parameters
- $value
string value
- $type
string type (dibi::BINARY)
Returns
string decoded value
Throws
Implementation of
|
public
|
#
applyLimit( string & $sql, integer $limit, integer $offset )
Injects LIMIT/OFFSET to the SQL query.
Injects LIMIT/OFFSET to the SQL query.
Parameters
- $sql
string &$sql The SQL query that will be modified.
- $limit
integer
- $offset
integer
Implementation of
|
public
|
#
__destruct( )
Automatically frees the resources allocated for this result set.
Automatically frees the resources allocated for this result set.
|
public
integer
|
#
getRowCount( )
Returns the number of rows in a result set.
Returns the number of rows in a result set.
Returns
integer
Implementation of
|
public
array
|
#
fetch( boolean $assoc )
Fetches the row at current position and moves the internal cursor to the next
position.
Fetches the row at current position and moves the internal cursor to the next
position.
Parameters
- $assoc
boolean TRUE for associative array, FALSE for numeric
Returns
array array on success, nonarray if no next record
|
public
boolean
|
#
seek( integer $row )
Moves cursor position without fetching row.
Moves cursor position without fetching row.
Parameters
- $row
integer the 0-based cursor pos to seek to
Returns
boolean TRUE on success, FALSE if unable to seek to specified record
Throws
Implementation of
|
public
|
#
free( )
Frees the resources allocated for this result set.
Frees the resources allocated for this result set.
Implementation of
|
public
array
|
#
getResultColumns( )
Returns metadata for all columns in a result set.
Returns metadata for all columns in a result set.
Returns
array
Implementation of
|
public
mixed
|
#
getResultResource( )
Returns the result set resource.
Returns the result set resource.
Returns
mixed
Implementation of
|
public
array
|
#
getTables( )
Returns list of tables.
Returns
array
Implementation of
|
public
array
|
#
getColumns( string $table )
Returns metadata for all columns in a table.
Returns metadata for all columns in a table.
Parameters
Returns
array
Implementation of
|
public
array
|
#
getIndexes( string $table )
Returns metadata for all indexes in a table.
Returns metadata for all indexes in a table.
Parameters
Returns
array
Implementation of
|
public
array
|
#
getForeignKeys( string $table )
Returns metadata for all foreign keys in a table.
Returns metadata for all foreign keys in a table.
Parameters
Returns
array
Implementation of
|