NAME
Rose::Planter::DB -- base db class for Rose-Planter planted objects.
DESCRIPTION
This is derived from Rose::DB, but adds a few class methods as described below. Also, it allows database to be registered based on configuration files.
METHODS
- DateTime::Duration::TO_JSON
-
This is defined here to serialize durations as postgres intervals.
- dbi_connect
-
Connect and retain the db handle. Also, set the time zone to UTC.
- release_dbh
-
Overridden to hold onto dbh's.
- register_databases
-
Register all the rose databases for this class.
Arguments :
module_name: The name of the perl module for which we are registering databases. This will be used to check for an environment variable named (uc $module_name)."_LIVE" to see if the live database configuration should be used. Also, if a unit test suite is running, the current Module::Build object will indicate that this module is being tested and hence a test database should be used.
register_params: A hash of parameters to be sent verbatim to Rose::DB::register_db.
conf: a configuration object which will be queried as follows :
$conf->db : parameters for the database.
This should return a hash with keys such as "database", "schema", and "host" which correspond to the parameters sent to Rose::DB::register_db.
If Module::Build::Database is being used, the "test" database will be determined using information stored in the _build directory. This allows the same database to be re-used during an entire './Build test'.
When HARNESS_ACTIVE is true, conf should not be passed.
- registered_by
-
Given a module name, return the name of the Rose::DB-derived class which called register_databases.
- load_golden
-
Load a golden dataset into the database.
- has_primary_key [ TABLE | PARAMS ]
-
Just like the overridden method in Rose::DB.pm except that it ignores database objects that begin with 'v_'. This provides a naming convention to avoid warnings for missing keys when loading views.
- do_sql
-
Do some sql and return the result as an arrayref of hashrefs.