Database: ezcDbInstance
[ ]
[ ]
[ ]
[ ]
[ ]
Class: ezcDbInstance
|
Holds database instances for global access throughout an application. [
source]
It is common for many application to use only one or very few database connections. This class holds a single database connection name or a list of datbases identified by a handle. The database connections can be retrieved from anywhere within your code through the static methods. This eliminates the need to pass the connection handle around.
Method Summary
|
public static void |
chooseDefault(
$identifier )
Sets the database $identifier as default database instance. |
|
public static ezcDbHandler |
get(
[$identifier = false] )
Returns the database instance $identifier. |
|
public static void |
reset(
)
Resets this object to its initial state. |
|
public static void |
resetDefault(
)
Resets the default instance holder. |
|
public static void |
set(
$db, [$identifier = false] )
Adds the database handler $db to the list of known instances. |
Methods
chooseDefault
void chooseDefault(
string
$identifier )
Sets the database $identifier as default database instance.
To retrieve the default database instance call get() with no parameters..
Parameters
| Name |
Type |
Description |
$identifier |
string |
|
See also:
ezcDbInstance::get()..
get
Returns the database instance $identifier.
If $identifier is ommited the default database instance specified by chooseDefault() is returned.
Parameters
| Name |
Type |
Description |
$identifier |
string |
|
Throws
| Class | Description |
ezcDbHandlerNotFoundException |
if the specified instance is not found. |
reset
void reset(
)
Resets this object to its initial state.
The list of instances will be emptied and
resetDefault() will be called.
resetDefault
void resetDefault(
)
Resets the default instance holder.
set
Adds the database handler $db to the list of known instances.
If $identifier is specified the database instance can be retrieved later using the same identifier.
Parameters
Last updated: Fri, 02 Nov 2007