|
|
| |
Rose::DB::MariaDB(3) |
User Contributed Perl Documentation |
Rose::DB::MariaDB(3) |
Rose::DB::MariaDB - MariaDB driver class for Rose::DB.
use Rose::DB;
Rose::DB->register_db(
domain => 'development',
type => 'main',
driver => 'mariadb',
database => 'dev_db',
host => 'localhost',
username => 'devuser',
password => 'mysecret',
);
Rose::DB->default_domain('development');
Rose::DB->default_type('main');
...
# Set max length of varchar columns used to emulate the array data type
Rose::DB::MariaDB->max_array_characters(128);
$db = Rose::DB->new; # $db is really a Rose::DB::MariaDB-derived object
...
Rose::DB blesses objects into a class derived from Rose::DB::MariaDB when the
driver is "mariadb". This mapping of driver names to class names is
configurable. See the documentation for Rose::DB's new() and
driver_class() methods for more information.
This class cannot be used directly. You must use Rose::DB and let
its new() method return an object blessed into the appropriate class
for you, according to its driver_class() mappings.
Only the methods that are new or have different behaviors than
those in Rose::DB are documented here. See the Rose::DB documentation for
the full list of methods.
- coerce_autoincrement_to_serial [BOOL]
- Get or set a boolean value that indicates whether or not
"auto-increment" columns will be considered to have the column
type "serial." If true, "integer" columns are coerced
to the "serial" column type, and "bigint" columns use
the "bigserial" column type. The default value is true.
This setting comes into play when Rose::DB::Object::Loader is
used to auto-create column metadata based on an existing database
schema.
- max_array_characters [INT]
- Get or set the maximum length of varchar columns used to emulate the array
data type. The default value is 255.
MariaDB does not have a native "ARRAY" data type,
but this data type can be emulated using a "VARCHAR" column
and a specially formatted string. The formatting and parsing of this
string is handled by the format_array and parse_array object methods.
The maximum length limit is honored by the format_array object
method.
- max_interval_characters [INT]
- Get or set the maximum length of varchar columns used to emulate the
interval data type. The default value is 255.
MariaDB does not have a native "interval" data type,
but this data type can be emulated using a "VARCHAR" column
and a specially formatted string. The formatting and parsing of this
string is handled by the format_interval and parse_interval object
methods. The maximum length limit is honored by the format_interval
object method.
- mariadb_auto_reconnect [BOOL]
- Get or set the mariadb_auto_reconnect database handle attribute. This is
set directly on the dbh, if one exists. Otherwise, it will be set when the
dbh is created. If no value for this attribute is defined (the default)
then it will not be set when the dbh is created, deferring instead to
whatever default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- mariadb_bind_type_guessing [BOOL]
- Get or set the mariadb_bind_type_guessing database handle attribute. This
is set directly on the dbh, if one exists. Otherwise, it will be set when
the dbh is created. If no value for this attribute is defined (the
default) then it will not be set when the dbh is created, deferring
instead to whatever default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- mariadb_client_found_rows [BOOL]
- Get or set the mariadb_client_found_rows database handle attribute. This
is set directly on the dbh, if one exists. Otherwise, it will be set when
the dbh is created. If no value for this attribute is defined (the
default) then it will not be set when the dbh is created, deferring
instead to whatever default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- mariadb_compression [BOOL]
- Get or set the mariadb_compression database handle attribute. This is set
directly on the dbh, if one exists. Otherwise, it will be set when the dbh
is created. If no value for this attribute is defined (the default) then
it will not be set when the dbh is created, deferring instead to whatever
default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- mariadb_connect_timeout [BOOL]
- Get or set the mariadb_connect_timeout database handle attribute. This is
set directly on the dbh, if one exists. Otherwise, it will be set when the
dbh is created. If no value for this attribute is defined (the default)
then it will not be set when the dbh is created, deferring instead to
whatever default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- mariadb_embedded_groups [STRING]
- Get or set the mariadb_embedded_groups database handle attribute. This is
set directly on the dbh, if one exists. Otherwise, it will be set when the
dbh is created. If no value for this attribute is defined (the default)
then it will not be set when the dbh is created, deferring instead to
whatever default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- mariadb_embedded_options [STRING]
- Get or set the mariadb_embedded_options database handle attribute. This is
set directly on the dbh, if one exists. Otherwise, it will be set when the
dbh is created. If no value for this attribute is defined (the default)
then it will not be set when the dbh is created, deferring instead to
whatever default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- mariadb_enable_utf8 [BOOL]
- Get or set the mariadb_enable_utf8 database handle attribute. This is set
directly on the dbh, if one exists, by executing the SQL
"SET NAMES utf8". Otherwise, it will be
set when the dbh is created. If no value for this attribute is defined
(the default) then it will not be set when the dbh is created, deferring
instead to whatever default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- mariadb_enable_utf8mb4 [BOOL]
- Get or set the mariadb_enable_utf8mb4 database handle attribute. This is
set directly on the dbh, if one exists, by executing the SQL
"SET NAMES utf8mb4". Otherwise, it will
be set when the dbh is created. If no value for this attribute is defined
(the default) then it will not be set when the dbh is created, deferring
instead to whatever default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- mariadb_local_infile [STRING]
- Get or set the mariadb_local_infile database handle attribute. This is set
directly on the dbh, if one exists. Otherwise, it will be set when the dbh
is created. If no value for this attribute is defined (the default) then
it will not be set when the dbh is created, deferring instead to whatever
default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- mariadb_multi_statements [BOOL]
- Get or set the mariadb_multi_statements database handle attribute. This is
set directly on the dbh, if one exists. Otherwise, it will be set when the
dbh is created. If no value for this attribute is defined (the default)
then it will not be set when the dbh is created, deferring instead to
whatever default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- mariadb_read_default_file [STRING]
- Get or set the mariadb_read_default_file database handle attribute. This
is set directly on the dbh, if one exists. Otherwise, it will be set when
the dbh is created. If no value for this attribute is defined (the
default) then it will not be set when the dbh is created, deferring
instead to whatever default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- mariadb_read_default_group [STRING]
- Get or set the mariadb_read_default_group database handle attribute. This
is set directly on the dbh, if one exists. Otherwise, it will be set when
the dbh is created. If no value for this attribute is defined (the
default) then it will not be set when the dbh is created, deferring
instead to whatever default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- mariadb_socket [STRING]
- Get or set the mariadb_socket database handle attribute. This is set
directly on the dbh, if one exists. Otherwise, it will be set when the dbh
is created. If no value for this attribute is defined (the default) then
it will not be set when the dbh is created, deferring instead to whatever
default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- mariadb_ssl [BOOL]
- Get or set the mariadb_ssl database handle attribute. This is set directly
on the dbh, if one exists. Otherwise, it will be set when the dbh is
created. If no value for this attribute is defined (the default) then it
will not be set when the dbh is created, deferring instead to whatever
default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- mariadb_ssl_ca_file [STRING]
- Get or set the mariadb_ssl_ca_file database handle attribute. This is set
directly on the dbh, if one exists. Otherwise, it will be set when the dbh
is created. If no value for this attribute is defined (the default) then
it will not be set when the dbh is created, deferring instead to whatever
default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- mariadb_ssl_ca_path [STRING]
- Get or set the mariadb_ssl_ca_path database handle attribute. This is set
directly on the dbh, if one exists. Otherwise, it will be set when the dbh
is created. If no value for this attribute is defined (the default) then
it will not be set when the dbh is created, deferring instead to whatever
default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- mariadb_ssl_cipher [STRING]
- Get or set the mariadb_ssl_cipher database handle attribute. This is set
directly on the dbh, if one exists. Otherwise, it will be set when the dbh
is created. If no value for this attribute is defined (the default) then
it will not be set when the dbh is created, deferring instead to whatever
default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- mariadb_ssl_client_cert [STRING]
- Get or set the mariadb_ssl_client_cert database handle attribute. This is
set directly on the dbh, if one exists. Otherwise, it will be set when the
dbh is created. If no value for this attribute is defined (the default)
then it will not be set when the dbh is created, deferring instead to
whatever default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- mariadb_ssl_client_key [STRING]
- Get or set the mariadb_ssl_client_key database handle attribute. This is
set directly on the dbh, if one exists. Otherwise, it will be set when the
dbh is created. If no value for this attribute is defined (the default)
then it will not be set when the dbh is created, deferring instead to
whatever default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- mariadb_use_result [BOOL]
- Get or set the mariadb_use_result database handle attribute. This is set
directly on the dbh, if one exists. Otherwise, it will be set when the dbh
is created. If no value for this attribute is defined (the default) then
it will not be set when the dbh is created, deferring instead to whatever
default value DBD::MariaDB chooses.
Returns the value of this attribute in the dbh, if one exists,
or the value that will be set when the dbh is next created.
See the DBD::MariaDB documentation to learn more about this
attribute.
- format_array ARRAYREF | LIST
- Given a reference to an array or a list of values, return a specially
formatted string. Undef is returned if ARRAYREF points to an empty array
or if LIST is not passed. The array or list must not contain undefined
values.
If the resulting string is longer than max_array_characters, a
fatal error will occur.
- format_interval DURATION
- Given a DateTime::Duration object, return a string formatted according to
the rules of PostgreSQL's "INTERVAL" column type. If DURATION is
undefined, a DateTime::Duration object, a valid interval keyword
(according to validate_interval_keyword), or if it looks like a function
call (matches "/^\w+\(.*\)$/") and
keyword_function_calls is true, then it is returned unmodified.
If the resulting string is longer than
max_interval_characters, a fatal error will occur.
- format_set ARRAYREF | LIST
- Given a reference to an array or a list of values, return a string
formatted according to the rules of MariaDB's "SET" data type.
Undef is returned if ARRAYREF points to an empty array or if LIST is not
passed. If the array or list contains undefined values, a fatal error will
occur.
- parse_array STRING | LIST | ARRAYREF
- Parse STRING and return a reference to an array. STRING should be
formatted according to the MariaDB array data type emulation format
returned by format_array(). Undef is returned if STRING is
undefined.
If a LIST of more than one item is passed, a reference to an
array containing the values in LIST is returned.
If a an ARRAYREF is passed, it is returned as-is.
- parse_interval STRING
- Parse STRING and return a DateTime::Duration object. STRING should be
formatted according to the PostgreSQL native "interval" (years,
months, days, hours, minutes, seconds) data type.
If STRING is a DateTime::Duration object, a valid interval
keyword (according to validate_interval_keyword), or if it looks like a
function call (matches
"/^\w+\(.*\)$/") and
keyword_function_calls is true, then it is returned unmodified.
Otherwise, undef is returned if STRING could not be parsed as a valid
"interval" value.
- parse_set STRING | LIST | ARRAYREF
- Parse STRING and return a reference to an array. STRING should be
formatted according to MariaDB's "SET" data type. Undef is
returned if STRING is undefined.
If a LIST of more than one item is passed, a reference to an
array containing the values in LIST is returned.
If a an ARRAYREF is passed, it is returned as-is.
- validate_date_keyword STRING
- Returns true if STRING is a valid keyword for the MariaDB "date"
data type. Valid (case-insensitive) date keywords are:
curdate()
current_date
current_date()
now()
sysdate()
00000-00-00
Any string that looks like a function call (matches
/^\w+\(.*\)$/) is also considered a valid date keyword if
keyword_function_calls is true.
- validate_datetime_keyword STRING
- Returns true if STRING is a valid keyword for the MariaDB
"datetime" data type, false otherwise. Valid (case-insensitive)
datetime keywords are:
curdate()
current_date
current_date()
current_time
current_time()
current_timestamp
current_timestamp()
curtime()
now()
sysdate()
0000-00-00 00:00:00
Any string that looks like a function call (matches
/^\w+\(.*\)$/) is also considered a valid datetime keyword if
keyword_function_calls is true.
- validate_timestamp_keyword STRING
- Returns true if STRING is a valid keyword for the MariaDB
"timestamp" data type, false otherwise. Valid (case-insensitive)
timestamp keywords are:
curdate()
current_date
current_date()
current_time
current_time()
current_timestamp
current_timestamp()
curtime()
now()
sysdate()
0000-00-00 00:00:00
00000000000000
Any string that looks like a function call (matches
/^\w+\(.*\)$/) is also considered a valid timestamp keyword if
keyword_function_calls is true.
John C. Siracusa (siracusa@gmail.com)
Copyright (c) 2020 by John C. Siracusa. All rights reserved. This program is
free software; you can redistribute it and/or modify it under the same terms
as Perl itself.
Visit the GSP FreeBSD Man Page Interface. Output converted with ManDoc. |