Interface IDibiDriver


dibi driver interface.


Copyright: Copyright (c) 2005, 2010 David Grudl
Located: in /libs/interfaces.php (line 86)
Method Summary
void
applyLimit (string &$sql, int $limit, int $offset)
Injects LIMIT/OFFSET to the SQL query.
void
begin ([string $savepoint = NULL])
Begins a transaction (if supported).
void
commit ([string $savepoint = NULL])
Commits statements in a transaction.
void
connect (&$config)
Connects to a database.
void
Disconnects from a database.
string
escape (string $value, string $type)
Encodes data for use in a SQL statement.
array
fetch (bool $type)
Fetches the row at current position and moves the internal cursor to the next position.
void
free (resource 0)
Frees the resources allocated for this result set.
int|FALSE
Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.
array
getColumns (string $table)
Returns metadata for all columns in a table.
array
Returns metadata for all columns in a result set.
array
getForeignKeys (string $table)
Returns metadata for all foreign keys in a table.
array
getIndexes (string $table)
Returns metadata for all indexes in a table.
int|FALSE
getInsertId ($sequence)
Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
mixed
Returns the connection resource.
mixed
Returns the result set resource.
int
Returns the number of rows in a result set.
array
Returns list of tables.
bool
Is in transaction?
IDibiDriver|NULL
query (string $sql)
Internal: Executes the SQL query.
void
rollback ([string $savepoint = NULL])
Rollback changes in a transaction.
boolean
seek (int $row)
Moves cursor position without fetching row.
string
unescape (string $value, string $type)
Decodes data from result set.

Method Details

line 191

applyLimit

public void applyLimit (string &$sql, int $limit, int $offset)

Injects LIMIT/OFFSET to the SQL query.

Input
string &$sql The SQL query that will be modified.
int $limit
int $offset

line 130

begin

public void begin ([string $savepoint = NULL])

Begins a transaction (if supported).

Input
string $savepoint optional savepoint name
Output
void  
Throws
throws DibiDriverException

line 138

commit

public void commit ([string $savepoint = NULL])

Commits statements in a transaction.

Input
string $savepoint optional savepoint name
Output
void  
Throws
throws DibiDriverException

line 95

connect

public void connect (&$config)

Connects to a database.

Input
&$config
Output
void  
Throws
throws DibiException

line 102

disconnect

public void disconnect ()

Disconnects from a database.

Output
void  
Throws
throws DibiException

line 173

escape

public string escape (string $value, string $type)

Encodes data for use in a SQL statement.

Input
string $value value
string $type type (dibi::TEXT, dibi::BOOL, ...)
Output
string encoded value
Throws
throws InvalidArgumentException

line 219

fetch

public array fetch (bool $type)

Fetches the row at current position and moves the internal cursor to the next position.

Input
bool $type TRUE for associative array, FALSE for numeric
Output
array array on success, nonarray if no next record

line 226

free

public void free (resource 0)

Frees the resources allocated for this result set.

Input
resource 0 result set resource

line 116

getAffectedRows

public int|FALSE getAffectedRows ()

Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.

Output
int|FALSE number of rows or FALSE on error

line 258

getColumns

public array getColumns (string $table)

Returns metadata for all columns in a table.

Input
string $table

line 233

getColumnsMeta

public array getColumnsMeta ()

Returns metadata for all columns in a result set.

Output
array  
Throws
throws DibiException

line 272

getForeignKeys

public array getForeignKeys (string $table)

Returns metadata for all foreign keys in a table.

Input
string $table

line 265

getIndexes

public array getIndexes (string $table)

Returns metadata for all indexes in a table.

Input
string $table

line 122

getInsertId

public int|FALSE getInsertId ($sequence)

Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.

Input
$sequence
Output
int|FALSE int on success or FALSE on failure

line 158

getResource

public mixed getResource ()

Returns the connection resource.

line 239

getResultResource

public mixed getResultResource ()

Returns the result set resource.

line 203

getRowCount

public int getRowCount ()

Returns the number of rows in a result set.

line 251

getTables

public array getTables ()

Returns list of tables.

line 152

inTransaction

public bool inTransaction ()

Is in transaction?

line 110

query

public IDibiDriver|NULL query (string $sql)

Internal: Executes the SQL query.

Input
string $sql SQL statement.
Output
IDibiDriver|NULL  
Throws
throws DibiDriverException

line 146

rollback

public void rollback ([string $savepoint = NULL])

Rollback changes in a transaction.

Input
string $savepoint optional savepoint name
Output
void  
Throws
throws DibiDriverException

line 211

seek

public boolean seek (int $row)

Moves cursor position without fetching row.

Input
int $row the 0-based cursor pos to seek to
Output
boolean TRUE on success, FALSE if unable to seek to specified record
Throws
throws DibiException

line 182

unescape

public string unescape (string $value, string $type)

Decodes data from result set.

Input
string $value value
string $type type (dibi::BINARY)
Output
string decoded value
Throws
throws InvalidArgumentException