.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
.\"
.\" 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" ''
. ds C`
. ds C'
'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 >0, 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.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.if !\nF .nr F 0
.if \nF>0 \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
.\}
.\" ========================================================================
.\"
.IX Title "DBIx::Class::Storage::DBI 3pm"
.TH DBIx::Class::Storage::DBI 3pm "2018-04-19" "perl v5.26.2" "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"
DBIx::Class::Storage::DBI \- DBI storage handler
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\& my $schema = MySchema\->connect(\*(Aqdbi:SQLite:my.db\*(Aq);
\&
\& $schema\->storage\->debug(1);
\&
\& my @stuff = $schema\->storage\->dbh_do(
\& sub {
\& my ($storage, $dbh, @args) = @_;
\& $dbh\->do("DROP TABLE authors");
\& },
\& @column_list
\& );
\&
\& $schema\->resultset(\*(AqBook\*(Aq)\->search({
\& written_on => $schema\->storage\->datetime_parser\->format_datetime(DateTime\->now)
\& });
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This class represents the connection to an \s-1RDBMS\s0 via \s-1DBI\s0. See
DBIx::Class::Storage for general information. This pod only
documents DBI-specific methods and behaviors.
.SH "METHODS"
.IX Header "METHODS"
.SS "connect_info"
.IX Subsection "connect_info"
This method is normally called by \*(L"connection\*(R" in DBIx::Class::Schema, which
encapsulates its argument list in an arrayref before passing them here.
.PP
The argument list may contain:
.IP "\(bu" 4
The same 4\-element argument set one would normally pass to
\&\*(L"connect\*(R" in \s-1DBI\s0, optionally followed by
extra attributes
recognized by DBIx::Class:
.Sp
.Vb 1
\& $connect_info_args = [ $dsn, $user, $password, \e%dbi_attributes?, \e%extra_attributes? ];
.Ve
.IP "\(bu" 4
A single code reference which returns a connected
\&\s-1DBI\s0 database handle optionally followed by
extra attributes recognized
by DBIx::Class:
.Sp
.Vb 1
\& $connect_info_args = [ sub { DBI\->connect (...) }, \e%extra_attributes? ];
.Ve
.IP "\(bu" 4
A single hashref with all the attributes and the dsn/user/password
mixed together:
.Sp
.Vb 7
\& $connect_info_args = [{
\& dsn => $dsn,
\& user => $user,
\& password => $pass,
\& %dbi_attributes,
\& %extra_attributes,
\& }];
\&
\& $connect_info_args = [{
\& dbh_maker => sub { DBI\->connect (...) },
\& %dbi_attributes,
\& %extra_attributes,
\& }];
.Ve
.Sp
This is particularly useful for Catalyst based applications, allowing the
following config (Config::General style):
.Sp
.Vb 9
\&
\& schema_class App::DB
\&
\& dsn dbi:mysql:database=test
\& user testuser
\& password TestPass
\& AutoCommit 1
\&
\&
.Ve
.Sp
The \f(CW\*(C`dsn\*(C'\fR/\f(CW\*(C`user\*(C'\fR/\f(CW\*(C`password\*(C'\fR combination can be substituted by the
\&\f(CW\*(C`dbh_maker\*(C'\fR key whose value is a coderef that returns a connected
\&\s-1DBI\s0 database handle
.PP
Please note that the \s-1DBI\s0 docs recommend that you always explicitly
set \f(CW\*(C`AutoCommit\*(C'\fR to either \fI0\fR or \fI1\fR. DBIx::Class further
recommends that it be set to \fI1\fR, and that you perform transactions
via our \*(L"txn_do\*(R" in DBIx::Class::Schema method. DBIx::Class will set it
to \fI1\fR if you do not do explicitly set it to zero. This is the default
for most DBDs. See \*(L"DBIx::Class and AutoCommit\*(R" for details.
.PP
\fIDBIx::Class specific connection attributes\fR
.IX Subsection "DBIx::Class specific connection attributes"
.PP
In addition to the standard \s-1DBI\s0
connection attributes, DBIx::Class recognizes
the following connection options. These options can be mixed in with your other
\&\s-1DBI\s0 connection attributes, or placed in a separate hashref
(\f(CW\*(C`\e%extra_attributes\*(C'\fR) as shown above.
.PP
Every time \f(CW\*(C`connect_info\*(C'\fR is invoked, any previous settings for
these options will be cleared before setting the new ones, regardless of
whether any options are specified in the new \f(CW\*(C`connect_info\*(C'\fR.
.IP "on_connect_do" 4
.IX Item "on_connect_do"
Specifies things to do immediately after connecting or re-connecting to
the database. Its value may contain:
.RS 4
.IP "a scalar" 4
.IX Item "a scalar"
This contains one \s-1SQL\s0 statement to execute.
.IP "an array reference" 4
.IX Item "an array reference"
This contains \s-1SQL\s0 statements to execute in order. Each element contains
a string or a code reference that returns a string.
.IP "a code reference" 4
.IX Item "a code reference"
This contains some code to execute. Unlike code references within an
array reference, its return value is ignored.
.RE
.RS 4
.RE
.IP "on_disconnect_do" 4
.IX Item "on_disconnect_do"
Takes arguments in the same form as \*(L"on_connect_do\*(R" and executes them
immediately before disconnecting from the database.
.Sp
Note, this only runs if you explicitly call \*(L"disconnect\*(R" on the
storage object.
.IP "on_connect_call" 4
.IX Item "on_connect_call"
A more generalized form of \*(L"on_connect_do\*(R" that calls the specified
\&\f(CW\*(C`connect_call_METHOD\*(C'\fR methods in your storage driver.
.Sp
.Vb 1
\& on_connect_do => \*(Aqselect 1\*(Aq
.Ve
.Sp
is equivalent to:
.Sp
.Vb 1
\& on_connect_call => [ [ do_sql => \*(Aqselect 1\*(Aq ] ]
.Ve
.Sp
Its values may contain:
.RS 4
.IP "a scalar" 4
.IX Item "a scalar"
Will call the \f(CW\*(C`connect_call_METHOD\*(C'\fR method.
.IP "a code reference" 4
.IX Item "a code reference"
Will execute \f(CW\*(C`$code\->($storage)\*(C'\fR
.IP "an array reference" 4
.IX Item "an array reference"
Each value can be a method name or code reference.
.IP "an array of arrays" 4
.IX Item "an array of arrays"
For each array, the first item is taken to be the \f(CW\*(C`connect_call_\*(C'\fR method name
or code reference, and the rest are parameters to it.
.RE
.RS 4
.Sp
Some predefined storage methods you may use:
.IP "do_sql" 4
.IX Item "do_sql"
Executes a \s-1SQL\s0 string or a code reference that returns a \s-1SQL\s0 string. This is
what \*(L"on_connect_do\*(R" and \*(L"on_disconnect_do\*(R" use.
.Sp
It can take:
.RS 4
.IP "a scalar" 4
.IX Item "a scalar"
Will execute the scalar as \s-1SQL.\s0
.IP "an arrayref" 4
.IX Item "an arrayref"
Taken to be arguments to \*(L"do\*(R" in \s-1DBI\s0, the \s-1SQL\s0 string optionally followed by the
attributes hashref and bind values.
.IP "a code reference" 4
.IX Item "a code reference"
Will execute \f(CW\*(C`$code\->($storage)\*(C'\fR and execute the return array refs as
above.
.RE
.RS 4
.RE
.IP "datetime_setup" 4
.IX Item "datetime_setup"
Execute any statements necessary to initialize the database session to return
and accept datetime/timestamp values used with
DBIx::Class::InflateColumn::DateTime.
.Sp
Only necessary for some databases, see your specific storage driver for
implementation details.
.RE
.RS 4
.RE
.IP "on_disconnect_call" 4
.IX Item "on_disconnect_call"
Takes arguments in the same form as \*(L"on_connect_call\*(R" and executes them
immediately before disconnecting from the database.
.Sp
Calls the \f(CW\*(C`disconnect_call_METHOD\*(C'\fR methods as opposed to the
\&\f(CW\*(C`connect_call_METHOD\*(C'\fR methods called by \*(L"on_connect_call\*(R".
.Sp
Note, this only runs if you explicitly call \*(L"disconnect\*(R" on the
storage object.
.IP "disable_sth_caching" 4
.IX Item "disable_sth_caching"
If set to a true value, this option will disable the caching of
statement handles via \*(L"prepare_cached\*(R" in \s-1DBI\s0.
.IP "limit_dialect" 4
.IX Item "limit_dialect"
Sets a specific SQL::Abstract::Limit\-style limit dialect, overriding the
default \*(L"sql_limit_dialect\*(R" setting of the storage (if any). For a list
of available limit dialects see DBIx::Class::SQLMaker::LimitDialects.
.IP "quote_names" 4
.IX Item "quote_names"
When true automatically sets \*(L"quote_char\*(R" and \*(L"name_sep\*(R" to the characters
appropriate for your particular \s-1RDBMS.\s0 This option is preferred over specifying
\&\*(L"quote_char\*(R" directly.
.IP "quote_char" 4
.IX Item "quote_char"
Specifies what characters to use to quote table and column names.
.Sp
\&\f(CW\*(C`quote_char\*(C'\fR expects either a single character, in which case is it
is placed on either side of the table/column name, or an arrayref of length
2 in which case the table/column name is placed between the elements.
.Sp
For example under MySQL you should use \f(CW\*(C`quote_char => \*(Aq\`\*(Aq\*(C'\fR, and for
\&\s-1SQL\s0 Server you should use \f(CW\*(C`quote_char => [qw/[ ]/]\*(C'\fR.
.IP "name_sep" 4
.IX Item "name_sep"
This parameter is only useful in conjunction with \f(CW\*(C`quote_char\*(C'\fR, and is used to
specify the character that separates elements (schemas, tables, columns) from
each other. If unspecified it defaults to the most commonly used \f(CW\*(C`.\*(C'\fR.
.IP "unsafe" 4
.IX Item "unsafe"
This Storage driver normally installs its own \f(CW\*(C`HandleError\*(C'\fR, sets
\&\f(CW\*(C`RaiseError\*(C'\fR and \f(CW\*(C`ShowErrorStatement\*(C'\fR on, and sets \f(CW\*(C`PrintError\*(C'\fR off on
all database handles, including those supplied by a coderef. It does this
so that it can have consistent and useful error behavior.
.Sp
If you set this option to a true value, Storage will not do its usual
modifications to the database handle's attributes, and instead relies on
the settings in your connect_info \s-1DBI\s0 options (or the values you set in
your connection coderef, in the case that you are connecting via coderef).
.Sp
Note that your custom settings can cause Storage to malfunction,
especially if you set a \f(CW\*(C`HandleError\*(C'\fR handler that suppresses exceptions
and/or disable \f(CW\*(C`RaiseError\*(C'\fR.
.IP "auto_savepoint" 4
.IX Item "auto_savepoint"
If this option is true, DBIx::Class will use savepoints when nesting
transactions, making it possible to recover from failure in the inner
transaction without having to abort all outer transactions.
.IP "cursor_class" 4
.IX Item "cursor_class"
Use this argument to supply a cursor class other than the default
DBIx::Class::Storage::DBI::Cursor.
.PP
Some real-life examples of arguments to \*(L"connect_info\*(R" and
\&\*(L"connect\*(R" in DBIx::Class::Schema
.PP
.Vb 2
\& # Simple SQLite connection
\& \->connect_info([ \*(Aqdbi:SQLite:./foo.db\*(Aq ]);
\&
\& # Connect via subref
\& \->connect_info([ sub { DBI\->connect(...) } ]);
\&
\& # Connect via subref in hashref
\& \->connect_info([{
\& dbh_maker => sub { DBI\->connect(...) },
\& on_connect_do => \*(Aqalter session ...\*(Aq,
\& }]);
\&
\& # A bit more complicated
\& \->connect_info(
\& [
\& \*(Aqdbi:Pg:dbname=foo\*(Aq,
\& \*(Aqpostgres\*(Aq,
\& \*(Aqmy_pg_password\*(Aq,
\& { AutoCommit => 1 },
\& { quote_char => q{"} },
\& ]
\& );
\&
\& # Equivalent to the previous example
\& \->connect_info(
\& [
\& \*(Aqdbi:Pg:dbname=foo\*(Aq,
\& \*(Aqpostgres\*(Aq,
\& \*(Aqmy_pg_password\*(Aq,
\& { AutoCommit => 1, quote_char => q{"}, name_sep => q{.} },
\& ]
\& );
\&
\& # Same, but with hashref as argument
\& # See parse_connect_info for explanation
\& \->connect_info(
\& [{
\& dsn => \*(Aqdbi:Pg:dbname=foo\*(Aq,
\& user => \*(Aqpostgres\*(Aq,
\& password => \*(Aqmy_pg_password\*(Aq,
\& AutoCommit => 1,
\& quote_char => q{"},
\& name_sep => q{.},
\& }]
\& );
\&
\& # Subref + DBIx::Class\-specific connection options
\& \->connect_info(
\& [
\& sub { DBI\->connect(...) },
\& {
\& quote_char => q{\`},
\& name_sep => q{@},
\& on_connect_do => [\*(AqSET search_path TO myschema,otherschema,public\*(Aq],
\& disable_sth_caching => 1,
\& },
\& ]
\& );
.Ve
.SS "on_connect_do"
.IX Subsection "on_connect_do"
This method is deprecated in favour of setting via \*(L"connect_info\*(R".
.SS "on_disconnect_do"
.IX Subsection "on_disconnect_do"
This method is deprecated in favour of setting via \*(L"connect_info\*(R".
.SS "dbh_do"
.IX Subsection "dbh_do"
Arguments: ($subref | \f(CW$method_name\fR), \f(CW@extra_coderef_args\fR?
.PP
Execute the given \f(CW$subref\fR or \f(CW$method_name\fR using the new exception-based
connection management.
.PP
The first two arguments will be the storage object that \f(CW\*(C`dbh_do\*(C'\fR was called
on and a database handle to use. Any additional arguments will be passed
verbatim to the called subref as arguments 2 and onwards.
.PP
Using this (instead of \f(CW$self\fR\->_dbh or \f(CW$self\fR\->dbh) ensures correct
exception handling and reconnection (or failover in future subclasses).
.PP
Your subref should have no side-effects outside of the database, as
there is the potential for your subref to be partially double-executed
if the database connection was stale/dysfunctional.
.PP
Example:
.PP
.Vb 8
\& my @stuff = $schema\->storage\->dbh_do(
\& sub {
\& my ($storage, $dbh, @cols) = @_;
\& my $cols = join(q{, }, @cols);
\& $dbh\->selectrow_array("SELECT $cols FROM foo");
\& },
\& @column_list
\& );
.Ve
.SS "disconnect"
.IX Subsection "disconnect"
Our \f(CW\*(C`disconnect\*(C'\fR method also performs a rollback first if the
database is not in \f(CW\*(C`AutoCommit\*(C'\fR mode.
.SS "with_deferred_fk_checks"
.IX Subsection "with_deferred_fk_checks"
.ie n .IP "Arguments: $coderef" 4
.el .IP "Arguments: \f(CW$coderef\fR" 4
.IX Item "Arguments: $coderef"
.PD 0
.ie n .IP "Return Value: The return value of $coderef" 4
.el .IP "Return Value: The return value of \f(CW$coderef\fR" 4
.IX Item "Return Value: The return value of $coderef"
.PD
.PP
Storage specific method to run the code ref with \s-1FK\s0 checks deferred or
in MySQL's case disabled entirely.
.SS "connected"
.IX Subsection "connected"
.IP "Arguments: none" 4
.IX Item "Arguments: none"
.PD 0
.IP "Return Value: 1|0" 4
.IX Item "Return Value: 1|0"
.PD
.PP
Verifies that the current database handle is active and ready to execute
an \s-1SQL\s0 statement (e.g. the connection did not get stale, server is still
answering, etc.) This method is used internally by \*(L"dbh\*(R".
.SS "dbh"
.IX Subsection "dbh"
Returns a \f(CW$dbh\fR \- a data base handle of class \s-1DBI\s0. The returned handle
is guaranteed to be healthy by implicitly calling \*(L"connected\*(R", and if
necessary performing a reconnection before returning. Keep in mind that this
is very \fBexpensive\fR on some database engines. Consider using \*(L"dbh_do\*(R"
instead.
.SS "connect_call_datetime_setup"
.IX Subsection "connect_call_datetime_setup"
A no-op stub method, provided so that one can always safely supply the
connection option
.PP
.Vb 1
\& on_connect_call => \*(Aqdatetime_setup\*(Aq
.Ve
.PP
This way one does not need to know in advance whether the underlying
storage requires any sort of hand-holding when dealing with calendar
data.
.SS "select"
.IX Subsection "select"
.ie n .IP "Arguments: $ident, $select, $condition, $attrs" 4
.el .IP "Arguments: \f(CW$ident\fR, \f(CW$select\fR, \f(CW$condition\fR, \f(CW$attrs\fR" 4
.IX Item "Arguments: $ident, $select, $condition, $attrs"
.PP
Handle a \s-1SQL\s0 select statement.
.SS "sql_limit_dialect"
.IX Subsection "sql_limit_dialect"
This is an accessor for the default \s-1SQL\s0 limit dialect used by a particular
storage driver. Can be overridden by supplying an explicit \*(L"limit_dialect\*(R"
to \*(L"connect\*(R" in DBIx::Class::Schema. For a list of available limit dialects
see DBIx::Class::SQLMaker::LimitDialects.
.SS "last_insert_id"
.IX Subsection "last_insert_id"
Return the row id of the last insert.
.SS "_native_data_type"
.IX Subsection "_native_data_type"
.ie n .IP "Arguments: $type_name" 4
.el .IP "Arguments: \f(CW$type_name\fR" 4
.IX Item "Arguments: $type_name"
.PP
This \s-1API\s0 is \fB\s-1EXPERIMENTAL\s0\fR, will almost definitely change in the future, and
currently only used by ::AutoCast and
::Sybase::ASE.
.PP
The default implementation returns \f(CW\*(C`undef\*(C'\fR, implement in your Storage driver if
you need this functionality.
.PP
Should map types from other databases to the native \s-1RDBMS\s0 type, for example
\&\f(CW\*(C`VARCHAR2\*(C'\fR to \f(CW\*(C`VARCHAR\*(C'\fR.
.PP
Types with modifiers should map to the underlying data type. For example,
\&\f(CW\*(C`INTEGER AUTO_INCREMENT\*(C'\fR should become \f(CW\*(C`INTEGER\*(C'\fR.
.PP
Composite types should map to the container type, for example
\&\f(CW\*(C`ENUM(foo,bar,baz)\*(C'\fR becomes \f(CW\*(C`ENUM\*(C'\fR.
.SS "sqlt_type"
.IX Subsection "sqlt_type"
Returns the database driver name.
.SS "bind_attribute_by_data_type"
.IX Subsection "bind_attribute_by_data_type"
Given a datatype from column info, returns a database specific bind
attribute for \f(CW\*(C`$dbh\->bind_param($val,$attribute)\*(C'\fR or nothing if we will
let the database planner just handle it.
.PP
This method is always called after the driver has been determined and a \s-1DBI\s0
connection has been established. Therefore you can refer to \f(CW\*(C`DBI::$constant\*(C'\fR
and/or \f(CW\*(C`DBD::$driver::$constant\*(C'\fR directly, without worrying about loading
the correct modules.
.SS "is_datatype_numeric"
.IX Subsection "is_datatype_numeric"
Given a datatype from column_info, returns a boolean value indicating if
the current \s-1RDBMS\s0 considers it a numeric value. This controls how
\&\*(L"set_column\*(R" in DBIx::Class::Row decides whether to mark the column as
dirty \- when the datatype is deemed numeric a \f(CW\*(C`!=\*(C'\fR comparison will
be performed instead of the usual \f(CW\*(C`eq\*(C'\fR.
.SS "create_ddl_dir"
.IX Subsection "create_ddl_dir"
.ie n .IP "Arguments: $schema, \e@databases, $version, $directory, $preversion, \e%sqlt_args" 4
.el .IP "Arguments: \f(CW$schema\fR, \e@databases, \f(CW$version\fR, \f(CW$directory\fR, \f(CW$preversion\fR, \e%sqlt_args" 4
.IX Item "Arguments: $schema, @databases, $version, $directory, $preversion, %sqlt_args"
.PP
Creates a \s-1SQL\s0 file based on the Schema, for each of the specified
database engines in \f(CW\*(C`\e@databases\*(C'\fR in the given directory.
(note: specify SQL::Translator names, not \s-1DBI\s0 driver names).
.PP
Given a previous version number, this will also create a file containing
the \s-1ALTER TABLE\s0 statements to transform the previous schema into the
current one. Note that these statements may contain \f(CW\*(C`DROP TABLE\*(C'\fR or
\&\f(CW\*(C`DROP COLUMN\*(C'\fR statements that can potentially destroy data.
.PP
The file names are created using the \f(CW\*(C`ddl_filename\*(C'\fR method below, please
override this method in your schema if you would like a different file
name format. For the \s-1ALTER\s0 file, the same format is used, replacing
\&\f(CW$version\fR in the name with \*(L"$preversion\-$version\*(R".
.PP
See \*(L"\s-1METHODS\*(R"\s0 in SQL::Translator for a list of values for \f(CW\*(C`\e%sqlt_args\*(C'\fR.
The most common value for this would be \f(CW\*(C`{ add_drop_table => 1 }\*(C'\fR
to have the \s-1SQL\s0 produced include a \f(CW\*(C`DROP TABLE\*(C'\fR statement for each table
created. For quoting purposes supply \f(CW\*(C`quote_identifiers\*(C'\fR.
.PP
If no arguments are passed, then the following default values are assumed:
.IP "databases \- ['MySQL', 'SQLite', 'PostgreSQL']" 4
.IX Item "databases - ['MySQL', 'SQLite', 'PostgreSQL']"
.PD 0
.ie n .IP "version \- $schema\->schema_version" 4
.el .IP "version \- \f(CW$schema\fR\->schema_version" 4
.IX Item "version - $schema->schema_version"
.IP "directory \- './'" 4
.IX Item "directory - './'"
.IP "preversion \- " 4
.IX Item "preversion - "
.PD
.PP
By default, \f(CW\*(C`\e%sqlt_args\*(C'\fR will have
.PP
.Vb 1
\& { add_drop_table => 1, ignore_constraint_names => 1, ignore_index_names => 1 }
.Ve
.PP
merged with the hash passed in. To disable any of those features, pass in a
hashref like the following
.PP
.Vb 1
\& { ignore_constraint_names => 0, # ... other options }
.Ve
.PP
\&\s-1WARNING:\s0 You are strongly advised to check all \s-1SQL\s0 files created, before applying
them.
.SS "deployment_statements"
.IX Subsection "deployment_statements"
.ie n .IP "Arguments: $schema, $type, $version, $directory, $sqlt_args" 4
.el .IP "Arguments: \f(CW$schema\fR, \f(CW$type\fR, \f(CW$version\fR, \f(CW$directory\fR, \f(CW$sqlt_args\fR" 4
.IX Item "Arguments: $schema, $type, $version, $directory, $sqlt_args"
.PP
Returns the statements used by \*(L"deploy\*(R" in DBIx::Class::Storage
and \*(L"deploy\*(R" in DBIx::Class::Schema.
.PP
The SQL::Translator (not \s-1DBI\s0) database driver name can be explicitly
provided in \f(CW$type\fR, otherwise the result of \*(L"sqlt_type\*(R" is used as default.
.PP
\&\f(CW$directory\fR is used to return statements from files in a previously created
\&\*(L"create_ddl_dir\*(R" directory and is optional. The filenames are constructed
from \*(L"ddl_filename\*(R" in DBIx::Class::Schema, the schema name and the \f(CW$version\fR.
.PP
If no \f(CW$directory\fR is specified then the statements are constructed on the
fly using SQL::Translator and \f(CW$version\fR is ignored.
.PP
See \*(L"\s-1METHODS\*(R"\s0 in SQL::Translator for a list of values for \f(CW$sqlt_args\fR.
.SS "datetime_parser"
.IX Subsection "datetime_parser"
Returns the datetime parser class
.SS "datetime_parser_type"
.IX Subsection "datetime_parser_type"
Defines the datetime parser class \- currently defaults to DateTime::Format::MySQL
.SS "build_datetime_parser"
.IX Subsection "build_datetime_parser"
See \*(L"datetime_parser\*(R"
.SS "is_replicating"
.IX Subsection "is_replicating"
A boolean that reports if a particular DBIx::Class::Storage::DBI is set to
replicate from a master database. Default is undef, which is the result
returned by databases that don't support replication.
.SS "lag_behind_master"
.IX Subsection "lag_behind_master"
Returns a number that represents a certain amount of lag behind a master db
when a given storage is replicating. The number is database dependent, but
starts at zero and increases with the amount of lag. Default in undef
.SS "relname_to_table_alias"
.IX Subsection "relname_to_table_alias"
.ie n .IP "Arguments: $relname, $join_count" 4
.el .IP "Arguments: \f(CW$relname\fR, \f(CW$join_count\fR" 4
.IX Item "Arguments: $relname, $join_count"
.PD 0
.ie n .IP "Return Value: $alias" 4
.el .IP "Return Value: \f(CW$alias\fR" 4
.IX Item "Return Value: $alias"
.PD
.PP
DBIx::Class uses DBIx::Class::Relationship names as table aliases in
queries.
.PP
This hook is to allow specific DBIx::Class::Storage drivers to change the
way these aliases are named.
.PP
The default behavior is \f(CW\*(C`"$relname_$join_count" if $join_count > 1\*(C'\fR,
otherwise \f(CW"$relname"\fR.
.SH "USAGE NOTES"
.IX Header "USAGE NOTES"
.SS "DBIx::Class and AutoCommit"
.IX Subsection "DBIx::Class and AutoCommit"
DBIx::Class can do some wonderful magic with handling exceptions,
disconnections, and transactions when you use \f(CW\*(C`AutoCommit => 1\*(C'\fR
(the default) combined with txn_do for
transaction support.
.PP
If you set \f(CW\*(C`AutoCommit => 0\*(C'\fR in your connect info, then you are always
in an assumed transaction between commits, and you're telling us you'd
like to manage that manually. A lot of the magic protections offered by
this module will go away. We can't protect you from exceptions due to database
disconnects because we don't know anything about how to restart your
transactions. You're on your own for handling all sorts of exceptional
cases if you choose the \f(CW\*(C`AutoCommit => 0\*(C'\fR path, just as you would
be with raw \s-1DBI.\s0
.SH "FURTHER QUESTIONS?"
.IX Header "FURTHER QUESTIONS?"
Check the list of additional \s-1DBIC\s0 resources.
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
This module is free software copyright
by the DBIx::Class (\s-1DBIC\s0) authors. You can
redistribute it and/or modify it under the same terms as the
DBIx::Class library.