Class DibiConnection
dibi connection.
DibiObject | --DibiConnection
| Constructor Summary | |
|---|---|
| public |
__construct
(array|string|ArrayObject $config, [string $name =
NULL])
Creates object and (optionally) connects to a database.
|
| Destructor Summary | |
|---|---|
| public |
__destruct
()
Automatically frees the resources allocated for this result set.
|
| Method Summary | |
|---|---|
| int |
affectedRows
()
Gets the number of affected rows. Alias for getAffectedRows().
|
| static void |
alias
(array &$config, string $key, [string $alias =
NULL])
Apply configuration alias or default values.
|
| 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).
|
| DibiFluent |
command
()
|
| void |
commit
([string $savepoint =
NULL])
Commits statements in a transaction.
|
| protected void |
connect
()
Connects to a database.
|
| DibiDataSource |
dataSource
(array|mixed $args)
Generates (translates) and returns SQL query as DibiDataSource.
|
| DibiFluent |
delete
(string $table)
|
| string |
delimite
(string $value)
Delimites identifier (table's or column's name, etc.).
|
| void |
disconnect
()
Disconnects from a database.
|
| string |
escape
(string $value, [string $type =
dibi::TEXT])
Encodes data for use in a SQL statement.
|
| DibiRow |
fetch
(array|mixed $args)
Executes SQL query and fetch result - shortcut for query() & fetch().
|
| array |
fetchAll
(array|mixed $args)
Executes SQL query and fetch results - shortcut for query() & fetchAll().
|
| string |
fetchPairs
(array|mixed $args)
Executes SQL query and fetch pairs - shortcut for query() & fetchPairs().
|
| string |
fetchSingle
(array|mixed $args)
Executes SQL query and fetch first column - shortcut for query() & fetchSingle().
|
| int |
Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.
|
| mixed |
Returns configuration variable. If no $key is passed, returns the entire array.
|
| DibiDatabaseInfo |
Gets a information about the current database.
|
| IDibiDriver |
getDriver
()
Returns the connection resource.
|
| int |
getInsertId
([string $sequence =
NULL])
Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
|
| IDibiProfiler |
getProfiler
()
|
| resource |
getResource
()
Returns the connection resource.
|
| DibiFluent |
insert
(string $table, array $args)
|
| int |
insertId
([string $sequence =
NULL])
Retrieves the ID generated for an AUTO_INCREMENT column. Alias for getInsertId().
|
| bool |
Is in transaction?
|
| bool |
isConnected
()
Returns TRUE when connection was established.
|
| int |
loadFile
(string $file)
Import SQL dump from file - extreme fast!
|
| DibiResult|int |
nativeQuery
(string $sql)
Executes the SQL query.
|
| DibiResult|int |
query
(array|mixed $args)
Generates (translates) and executes SQL query.
|
| void |
rollback
([string $savepoint =
NULL])
Rollback changes in a transaction.
|
| DibiFluent |
select
(string $args)
|
| DibiConnection |
|
| string |
sql
(array|mixed $args)
Generates and returns SQL query.
|
| bool |
test
(array|mixed $args)
Generates and prints SQL query.
|
| string |
unescape
(string $value, [string $type =
dibi::BINARY])
Decodes data from result set.
|
| DibiFluent |
update
(string $table, array $args)
|
| void |
__sleep
()
Prevents serialization.
|
| void |
__wakeup
()
Prevents unserialization.
|
| Constructor Details | |||||||||
|---|---|---|---|---|---|---|---|---|---|
|
line 43 __constructpublic __construct (array|string|ArrayObject $config, [string $name = Creates object and (optionally) connects to a database.
|
|||||||||
| Destructor details | ||
|---|---|---|
|
line 110 __destructpublic void __destruct () Automatically frees the resources allocated for this result set. |
||
| Method Details | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
line 364 affectedRowspublic int affectedRows () Gets the number of affected rows. Alias for getAffectedRows().
|
||||||||||||||||||||||||
|
line 192 aliaspublic static void alias (array &$config, string $key, [string $alias = Apply configuration alias or default values.
|
||||||||||||||||||||||||
|
line 519 applyLimitpublic void applyLimit (string &$sql, int $limit, int $offset) Injects LIMIT/OFFSET to the SQL query.
|
||||||||||||||||||||||||
|
line 404 beginpublic void begin ([string $savepoint = Begins a transaction (if supported).
|
||||||||||||||||||||||||
|
line 534 commandpublic DibiFluent command ()
|
||||||||||||||||||||||||
|
line 423 commitpublic void commit ([string $savepoint = Commits statements in a transaction.
|
||||||||||||||||||||||||
|
line 122 connectprotected void connect () Connects to a database.
|
||||||||||||||||||||||||
|
line 290 dataSourcepublic DibiDataSource dataSource (array|mixed $args) Generates (translates) and returns SQL query as DibiDataSource.
|
||||||||||||||||||||||||
|
line 590 deletepublic DibiFluent delete (string $table)
|
||||||||||||||||||||||||
|
line 503 delimitepublic string delimite (string $value) Delimites identifier (table's or column's name, etc.).
|
||||||||||||||||||||||||
|
line 142 disconnectpublic void disconnect () Disconnects from a database.
|
||||||||||||||||||||||||
|
line 473 escapepublic string escape (string $value, [string $type = Encodes data for use in a SQL statement.
|
||||||||||||||||||||||||
|
line 633 fetchpublic DibiRow fetch (array|mixed $args) Executes SQL query and fetch result - shortcut for query() & fetch().
|
||||||||||||||||||||||||
|
line 647 fetchAllpublic array fetchAll (array|mixed $args) Executes SQL query and fetch results - shortcut for query() & fetchAll().
|
||||||||||||||||||||||||
|
line 675 fetchPairspublic string fetchPairs (array|mixed $args) Executes SQL query and fetch pairs - shortcut for query() & fetchPairs().
|
||||||||||||||||||||||||
|
line 661 fetchSinglepublic string fetchSingle (array|mixed $args) Executes SQL query and fetch first column - shortcut for query() & fetchSingle().
|
||||||||||||||||||||||||
|
line 350 getAffectedRowspublic int getAffectedRows () Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.
|
||||||||||||||||||||||||
|
line 170 getConfigpublic mixed getConfig ([string $key = Returns configuration variable. If no $key is passed, returns the entire array.
|
||||||||||||||||||||||||
|
line 724 getDatabaseInfopublic DibiDatabaseInfo getDatabaseInfo () Gets a information about the current database.
|
||||||||||||||||||||||||
|
line 210 getDriverpublic IDibiDriver getDriver () Returns the connection resource.
|
||||||||||||||||||||||||
|
line 377 getInsertIdpublic int getInsertId ([string $sequence = Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
|
||||||||||||||||||||||||
|
line 616 getProfilerpublic IDibiProfiler getProfiler ()
|
||||||||||||||||||||||||
|
line 222 getResourcepublic resource getResource () Returns the connection resource.
|
||||||||||||||||||||||||
|
line 573 insertpublic DibiFluent insert (string $table, array $args)
|
||||||||||||||||||||||||
|
line 392 insertIdpublic int insertId ([string $sequence = Retrieves the ID generated for an AUTO_INCREMENT column. Alias for getInsertId().
|
||||||||||||||||||||||||
|
line 458 inTransactionpublic bool inTransaction () Is in transaction?
|
||||||||||||||||||||||||
|
line 156 isConnectedpublic bool isConnected () Returns TRUE when connection was established.
|
||||||||||||||||||||||||
|
line 692 loadFilepublic int loadFile (string $file) Import SQL dump from file - extreme fast!
|
||||||||||||||||||||||||
|
line 306 nativeQuerypublic DibiResult|int nativeQuery (string $sql) Executes the SQL query.
|
||||||||||||||||||||||||
|
line 236 querypublic DibiResult|int query (array|mixed $args) Generates (translates) and executes SQL query.
|
||||||||||||||||||||||||
|
line 441 rollbackpublic void rollback ([string $savepoint = Rollback changes in a transaction.
|
||||||||||||||||||||||||
|
line 545 selectpublic DibiFluent select (string $args)
|
||||||||||||||||||||||||
|
line 605 setProfilerpublic DibiConnection setProfiler ([IDibiProfiler $profiler =
|
||||||||||||||||||||||||
|
line 252 sqlpublic string sql (array|mixed $args) Generates and returns SQL query.
|
||||||||||||||||||||||||
|
line 267 testpublic bool test (array|mixed $args) Generates and prints SQL query.
|
||||||||||||||||||||||||
|
line 489 unescapepublic string unescape (string $value, [string $type = Decodes data from result set.
|
||||||||||||||||||||||||
|
line 558 updatepublic DibiFluent update (string $table, array $args)
|
||||||||||||||||||||||||
|
line 745 __sleeppublic void __sleep () Prevents serialization.
|
||||||||||||||||||||||||
|
line 735 __wakeuppublic void __wakeup () Prevents unserialization.
|
||||||||||||||||||||||||