A simple factory that provides access to an application's database objects.
It should be dynamically initialized, and can hold mixed types of database adapter objects.
EXAMPLE RETRIEVAL:
EXAMPLE INITIALIZATION:
Assuming we have:
Option 1: Add one config at a time:
Option 2: Add all configs at once:
The config array supports other parameters as well, but you shouldn't have to use them. See $configs for all available options.
Located in /cough/CoughDatabaseFactory.class.php (line 62)
An array of database config info.
When a database is retrieved, if it is not already created, then it gets created using the configuration info specified in this array, if that info exists.
Format:
Format:
[alias] => [actual_db_name]
Format:
[alias] => [CoughDatabaseInterface]
Adds the database config for later use. Make sure to specified the 'aliases' or the 'db_name_hash' value.
Adds the database object for the specified alias name.
It's better to add configs b/c then a database object/connection won't be made unless one is needed.
returns the correct database adapter object
Get all the database configs CoughDatabaseFactory is currently aware of.
Could be useful for debugging purposes.
Get the database object for the specified alias
Get the actual database name for the specified alias.
If no mapping exists, it returns the original alias value.
Get all the currently constructed database objects.
Could be useful for debugging purposes.
Same as getDatabases(), except it rolls up all aliases using the same connection into one array entry.
Restore CoughDatabaseFactory to its initial state (no configs, no database objects).
Sets all the database configs at once.
Documentation generated on Tue, 23 Sep 2008 22:48:22 -0500 by phpDocumentor 1.4.0