Current Path : /proc/2/root/usr/local/share/man/man3/ |
|
Current File : //proc/2/root/usr/local/share/man/man3/Locale::MakePhrase::BackingStore::Database.3pm |
.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.13)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\" ========================================================================
.\"
.IX Title "Locale::MakePhrase::BackingStore::Database 3"
.TH Locale::MakePhrase::BackingStore::Database 3 "2006-03-20" "perl v5.10.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Locale::MakePhrase::BackingStore::Database \- Base\-class for a
database driven backing store.
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This backing store is capable of loading language rules from a
database table, which conforms to the structure defined below.
.PP
It assumes that the database is configured to use unicode as the
text storage mechanism.
.PP
Unlike the file-based implementations, this module will hit the
database looking for language translations, every time the language
rules are requested. This allows you to update the database (say
via a web interface), so that new translations are available
immediately.
.SH "TABLE STRUCTURE"
.IX Header "TABLE STRUCTURE"
The table structure can be created with the following \s-1SQL\s0 statement:
.PP
.Vb 7
\& CREATE TABLE some_table (
\& key VARCHAR,
\& language VARCHAR,
\& expression VARCHAR,
\& priority INTEGER,
\& translation VARCHAR
\& );
.Ve
.PP
As you can see, there is not much to it.
.PP
Upon construction, this module will try to connect to the database
to confirm that the table exists and has a suitable structure. If
it hasn't, this module will die.
.SH "API"
.IX Header "API"
The following methods are implemented:
.ie n .SS "$self new([...])"
.el .SS "\f(CW$self\fP new([...])"
.IX Subsection "$self new([...])"
You will need to specify some of these options:
.ie n .IP """table""" 2
.el .IP "\f(CWtable\fR" 2
.IX Item "table"
The name of the table that implements the table structure shown
above. Note you can add more database fields if necessary; then by
overloading either \f(CW\*(C`get_query\*(C'\fR or \f(CW\*(C`get_where\*(C'\fR. you can make use of
the extra fields.
.ie n .IP """dbh""" 2
.el .IP "\f(CWdbh\fR" 2
.IX Item "dbh"
You can supply a pre-connected \s-1DBI\s0 handle, rather than supply the
connection parameters.
.ie n .IP """owned""" 2
.el .IP "\f(CWowned\fR" 2
.IX Item "owned"
If you supply a database handle, you should specify whether you want
this module to take ownership of the handle. If so, it will disconnect
the database handle on destruction.
.ie n .IP """driver""" 2
.el .IP "\f(CWdriver\fR" 2
.IX Item "driver"
The name of the \s-1DBI\s0 driver to use.
.ie n .IP """database""" 2
.el .IP "\f(CWdatabase\fR" 2
.IX Item "database"
The name of the database that we will connect to.
.ie n .IP """host""" 2
.el .IP "\f(CWhost\fR" 2
.IX Item "host"
.PD 0
.ie n .IP """port""" 2
.el .IP "\f(CWport\fR" 2
.IX Item "port"
.ie n .IP """user""" 2
.el .IP "\f(CWuser\fR" 2
.IX Item "user"
.ie n .IP """password""" 2
.el .IP "\f(CWpassword\fR" 2
.IX Item "password"
.PD
By specifying these four options (rather than the \f(CW\*(C`dbh\*(C'\fR), this module
will connect to the database using these options. Note that \f(CW\*(C`host\*(C'\fR
and \f(CW\*(C`port\*(C'\fR defaults to whatever the underlying driver uses, \f(CW\*(C`user\*(C'\fR
and \f(CW\*(C`password\*(C'\fR defaults to empty.
.Sp
The defaults are used when you dont supply any connection parameters.
.ie n .IP """connect_options""" 2
.el .IP "\f(CWconnect_options\fR" 2
.IX Item "connect_options"
This option is simply a placeholder \- it is up to the driver-specific
implementation to use this option.
.PP
Notes: you must specify either the \f(CW\*(C`dbh\*(C'\fR option, or suitable connection
options.
.ie n .SS "$dbh \fIdbh()\fP"
.el .SS "\f(CW$dbh\fP \fIdbh()\fP"
.IX Subsection "$dbh dbh()"
Returns the database connection handle
.SS "void owned(boolean)"
.IX Subsection "void owned(boolean)"
Set/get ownership of the database handle.
.SS "\e@rule_objs get_rules($contect,$key,\e@languages)"
.IX Subsection "@rule_objs get_rules($contect,$key,@languages)"
Retrieve the translations from the database, using the selected languages.
The implementation will fetch the language rule properties each time
this is called, so that if the database gets updated, the next call will
use the new properties.
.ie n .SS "$string get_query($table,$context,\e@languages)"
.el .SS "\f(CW$string\fP get_query($table,$context,\e@languages)"
.IX Subsection "$string get_query($table,$context,@languages)"
Under normal circumstances the generic \s-1SQL\s0 statement used by this module,
is suitable to be used to query the database. However, in some cases you
may want to do something unusual... By sub-classing this module, you can
create your own specific \s-1SQL\s0 statement.
.ie n .SS "$string \fIget_where()\fP"
.el .SS "\f(CW$string\fP \fIget_where()\fP"
.IX Subsection "$string get_where()"
Under some circumstances the generic \f(CW\*(C`get_query()\*(C'\fR command will generate
an \s-1SQL\s0 statement that is mostly correct, but needs minor adjustment. By
overloading this method, you can _add to_ the existing \s-1SQL\s0 statement.
.PP
If you want to know what this does, you should probably read the source
code for this module.
.SH "POD ERRORS"
.IX Header "POD ERRORS"
Hey! \fBThe above document had some coding errors, which are explained below:\fR
.IP "Around line 410:" 4
.IX Item "Around line 410:"
=cut found outside a pod block. Skipping to next block.
Copyright 2K16 - 2K18 Indonesian Hacker Rulez