Koha::Database
use Koha::Database; my $schema = Koha::Database->schema();
$schema = Koha::Database->new->schema; FIXME: It is useless to have a Koha::Database object since all methods below act as class methods Koha::Database->new->schema is exactly the same as Koha::Database->schema We should use Koha::Database->schema everywhere and remove the `new` method
Returns a database handler without loading the DBIx::Class schema.
$schema = Koha::Database->schema; $schema = Koha::Database->schema({ new => 1 });
Returns a database handle connected to the Koha database for the current context. If no connection has yet been made, this method creates one, and connects to the database.
This database handle is cached for future use: if you call $database->schema
twice, you will get the same handle both times.
my $dbd_driver_name = Koha::Database::db_scheme2dbi($scheme);
This routines translates a database type to part of the name of the appropriate DBD driver to use when establishing a new database connection. It recognizes 'mysql' and 'Pg'; if any other scheme is supplied it defaults to 'mysql'.
my $dsn = Koha::Database::generate_dsn($config);
Returns a data source name (DSN) for a database connection from the config instance.
None by default.
Chris Cormack, <chrisc@catalyst.net.nz>