This plugin offers a middle layer for Foswiki extensions to ease connecting to SQL databases and manage schemes of table and index definitions. The idea is to keep things as lean as possible without imposing any additional structure. DBIPlugin will maintain a plugin's database scheme to make sure it is created and updated as required.
A plugin sub-classesFoswiki::DBI::Schema
which is then loaded before
connecting to a database. While connecting to the database the schema then is added to the database.
DBIPlugin supports any database for which a DBD perl driver is available. A plugin may support multiple databases where the schemes differ in parts. For example the schema for SQLite differs from the one for MariaDB, MySQL or PostgreSQL. The plugin will then implement:
Foswiki::DBISchema::SQLite
Foswiki::DBISchema::MariaDB
Foswiki::DBISchema::MySQL
Foswiki::DBISchema::PostgreSQL
The syntax of each of them are custom tailored towards the respective database vendor. Note however that from there on it is the plugin's responsibility to cope with further differences among databases beyond just schema definitions.
Have a look at DBIPluginPerlAPI for further information.LikePlugin_likes
.
Before configuring DBIPlugin you need to create a database and a user/password for this plugin (except for SQLite). For instance a shell script like this will do:
#!/bin/sh database_server=$1 database_name=$2 database_user=$3 database_password=$4 echo "creating database $database_name on $database_server" cat <<HERE | mysql -h $database_server CREATE USER IF NOT EXISTS $database_user@$database_server IDENTIFIED BY '$database_password'; CREATE DATABASE IF NOT EXISTS $database_name; GRANT ALL ON $database_name.* TO $database_user@$database_server; FLUSH PRIVILEGES; HERE
cd /path/to/foswiki perl tools/extension_installer <NameOfExtension> installIf you have any problems, or if the extension isn't available in
configure
, then you can still install manually from the command-line. See https://foswiki.org/Support/ManuallyInstallingExtensions for more help.
Name | Version | Description |
---|---|---|
DBI | >=1.0 | Required |
DBD::MariaDB | >=1.54 | Recommended |
DBD::SQLite | >=1.54 | Optional |
DBD::Pg | >=3 | Optional |
DBD::mysql | >=4 | Optional |
17 Jan 2024 | fixed mechanism upgrading database schemes; better default encoding of databases |
27 Apr 2022 | initial release |
Author | Michael Daum |
Version | 2.01 |
Release | 21 Jan 2024 |
Description | Database middle layer to manage connections and schemes |
Repository | https://github.com/foswiki/DBIPlugin |
Copyright | 2021-2024, Michael Daum, All Rights Reserved |
License | GPL (GNU General Public License) |
Home | https://foswiki.org/Extensions/DBIPlugin |
Support | https://foswiki.org/Support/DBIPlugin |