PerlDoc

See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview


Parent package: Foswiki
Child packages:

    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

    Loads a database schema and returns the db. The $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

    Topic revision: r1 - 06 Aug 2023, UnknownUser
    This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
    Ideas, requests, problems regarding Foswiki? Send feedback