Mathew Robertson > Locale-MakePhrase > Locale::MakePhrase::BackingStore::Database::PostgreSQL

Download:
Locale-MakePhrase-0.5.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.2   Source  

NAME ^

Locale::MakePhrase::BackingStore::Database::PostgreSQL - Retrieve translations from a table within a PostgreSQL database.

DESCRIPTION ^

This backing store is capable of loading language rules from a PostgreSQL table. See Locale::MakePhrase::BackingStore::Database for more information.

The PostgreSQL database instanc should be setup to use UNICODE as the text storage mechanism (ie: 'psql -l' should show you how the database instance was created).

TABLE STRUCTURE ^

The table structure can be created with the following PostgreSQL SQL statement:

  CREATE TABLE some_table (
    key TEXT,
    language TEXT,
    expression TEXT,
    priority INTEGER,
    translation TEXT
  );

This only differs from the generic database driver, in that TEXT is being used as a replacement for VARCHAR (both statements do the same thing).

API ^

The following methods are implemented:

$self new([...])

[ Inherited from Locale::MakePhrase::BackingStore::Database. ]

Any options defined for in the base class, can be set here. ie: you could specify some of these options:

table

You must set this value.

dbh
owned
host

This module defaults to localhost unless it is defined.

port

This module defaults to 5432 unless it is defined.

user

This module defaults to an empty string.

password

This module defaults to an empty string.

connect_options

The default PostgreSQL connections options are:

  RaiseError => 1
  AutoCommit => 1
  ChopBlanks => 1
  pg_enable_utf8 => 1

If you set this value, you must supply a hash_ref supplying the appropriate PostgreSQL connection options.

Note that we set the AutoCommit simply because we only ever do SELECT's from the table, thus we never need to concern ourselves with aborted transations.

Notes: you must specify either the dbh option, or suitable connection options.

syntax highlighting: