internal package
Foswiki::DBI Interface for Foswiki DBI developers
StaticMethod
getDB() → $database Creates a database connection to the configured implementation, connects to it and loads the base schema.
StaticMethod
loadSchema($schemaBase) → $database $schemaBase
is the
base perl class of the caller. The real database schema being loaded
resides in a sub class of the $schemaBase
according to the database
implementation of the system.
For example a MyPlugin
must provide the following classes to support
SQLite and MariaDB:
Foswiki::Plugins::MyPlugin::Schema Foswiki::Plugins::MyPlugin::Schema::MariaDB Foswiki::Plugins::MyPlugin::Schema::SQLite
The schema is then called using:
my $db = Foswiki::DBI::loadSchema("Foswiki::Plugins::MyPlugin::Schema");Given
MariaDB
is the current database implementation, it actually loads the
schema Foswiki::Plugins::MyPlugin::Schema::MariaDB
and returns a singleton
database object of type Foswiki::DBI::Database::MariaDB
.
This singleton object is shared among all subsystems connecting to the
database.
StaticMethod
finish() Close any database connection being made during the session