3.1 Guidance

When creating a new database module to be used in Kiriwrite, the following is required:

When creating a new database module, at the top of the page the following should be inserted:

package Kiriwrite::Database::(modulename);

use strict;
use warnings;

our $VERSION = "(version)";
my ($options, %options);
my $database_handle;
my $string_handle;
my $error;
my $errorext;
my $database_filename;
my $second_database_filename;

Replace (modulename) with the name of the module like MySQL5 (which means MySQL database server version 5.x). When specifying the module name it should be the name of the format (MySQL) and version (5 as in 5.x).

'use strict' and 'use warnings' isn't required but it is generally accepted that Perl scripts and modules should have 'use strict' and 'use warnings' lines written.

Replace (version) with the internal version number of the module.

If you're writing a file-based database module, additional code will need to be added for handling a second database, template database and filter database. An example of this is in the SQLite.pm source code.

The file-based database module should end with the filename .db.(modulename) such as .db.sqlite when using the SQLite module.

Database modules are stored in the Modules/Database directory. For an example of a written database module look at the MySQL5.pm/SQLite.pm files.

If a database error occurs while preforming a database operation then the error string from the database handle scalar ($database_handle) should be placed in the $errorext scalar.