Note that no column names will be stored. They are fixed. Thus all other information including column type (INTEGER or CHAR(x), for example), column attributes (NOT NULL, PRIMARY KEY, ...) will silently be discarded.

Table names cannot be arbitrary, due to restrictions of the SQL syntax. I recommend that table names are valid SQL identifiers: The first character is alphabetic, followed by an arbitrary number of alphanumeric characters. If you want to use other files, the file names must start with '/', './' or '../' and they must not contain white space.

For conditional execution use CREATE TABLE IF EXISTS statement.

Columns:

msgid

The text to translate (emty string for header).

The 'msgid' can contain Locale::Maketext placeholders. They have to be stored in gettext format. To change the format, use the database handle function 'maketext_to_gettext'.

msgstr

The translation.

The 'msgid' can contain Locale::Maketext placeholder. They have to be stored in gettext format. To change the format, use the database handle function 'maketext_to_gettext'.

use Socket qw($CRLF);
my $separator = $CRLF; # But it is more easy
# to use the po_separator default \n
# and than the join is obsolete
# because the strings typical including \n.
my $header_comment = join(
$separator,
'This is a translator comment for the header.',
'And this is line 2 of.',
);
$dbh->do(<<'EOT', undef, $header_comment, $header_msgstr);
INSERT INTO table.po (
comment,
msgstr
) VALUES (?, ?)
EOT

The DBD::PO module is yet another driver for the DBI (Database independent interface for Perl). This one is based on the SQL 'engine' SQL::Statement and the abstract DBI driver DBD::File and implements access to so-called PO files (GNU gettext). Such files are readable by Locale::Maketext.

See DBI for details on DBI, SQL::Statement for details on SQL::Statement and DBD::File for details on the base class DBD::File.

The only system dependent feature that DBD::File uses, is the flock() function. Thus the module should run (in theory) on any system with a working flock(), in particular on all Unix machines and on Windows NT. Under Windows 95 and MacOS the use of flock() is disabled, thus the module should still be usable,

Unlike other DBI drivers, you don't need an external SQL engine or a running server. All you need are the following Perl modules, available from any CPAN mirror.

The level of SQL support available depends on the version of SQL::Statement installed. Any version will support *basic* CREATE, INSERT, DELETE, UPDATE, and SELECT statements. Only versions of SQL::Statement 1.0 and above support additional features such as table joins, string functions, etc. See the documentation of the latest version of SQL::Statement for details.

The module is using flock() internally. However, this function is not available on platforms. Using flock() is disabled on MacOS and Windows 95: There's no locking at all (perhaps not so important on these operating systems, as they are for single users anyways).