NAME

Rose::DB::Registry::Entry - Data source registry entry.

SYNOPSIS

use Rose::DB::Registry::Entry;

$entry = Rose::DB::Registry::Entry->new(
  domain   => 'production',
  type     => 'main',
  driver   => 'Pg',
  database => 'big_db',
  host     => 'dbserver.acme.com',
  username => 'dbadmin',
  password => 'prodsecret',
  server_time_zone => 'UTC');

Rose::DB->register_db($entry);

# ...or...

Rose::DB->registry->add_entry($entry);

...

DESCRIPTION

Rose::DB::Registry::Entry objects store information about a single Rose::DB data source. See the Rose::DB documentation for more information on data sources, and the Rose::DB::Registry documentation to learn how Rose::DB::Registry::Entry objects are managed.

Rose::DB::Registry::Entry inherits from, and follows the conventions of, Rose::Object. See the Rose::Object documentation for more information.

CONSTRUCTOR

new PARAMS

Constructs a Rose::DB::Registry::Entry object based on PARAMS, where PARAMS are name/value pairs. Any object method is a valid parameter name.

OBJECT METHODS

GENERAL

autocommit [VALUE]

Get or set the value of the "AutoCommit" connect option.

catalog [CATALOG]

Get or set the database catalog name. This setting is only relevant to databases that support the concept of catalogs.

clone

Returns a clone (i.e., deep copy) of the current object.

connect_option NAME [, VALUE]

Get or set the connect option named NAME. Returns the current value of the connect option.

connect_options [HASHREF | PAIRS]

Get or set the options passed in a hash reference as the fourth argument to the call to DBI->connect(). See the DBI documentation for descriptions of the various options.

If a reference to a hash is passed, it replaces the connect options hash. If a series of name/value pairs are passed, they are added to the connect options hash.

Returns a reference to the hash of options in scalar context, or a list of name/value pairs in list context.

database [NAME]

Get or set the database name.

description [TEXT]

A description of the data source.

domain [DOMAIN]

Get or set the data source domain. Note that changing the domain after a registry entry has been added to the registry has no affect on where the entry appears in the registry.

driver [DRIVER]

Get or set the driver name. The DRIVER argument is converted to lowercase before being set.

dsn [DSN]

Get or set the DBI DSN (Data Source Name). Note that an explicitly set DSN may render some other attributes inaccurate. For example, the DSN may contain a host name that is different than the object's current host() value. I recommend not setting the DSN value explicitly unless you are also willing to manually synchronize (or ignore) the corresponding object attributes.

dump

Returns a reference to a hash of the entry's attributes. Only those attributes with defined values are included in the hash keys. All values are deep copies.

handle_error [VALUE]

Get or set the value of the "HandleError" connect option.

host [NAME]

Get or set the database server host name.

password [PASS]

Get or set the database password.

port [NUM]

Get or set the database server port number.

pre_disconnect_sql [STATEMENTS]

Get or set the SQL statements that will be run immediately before disconnecting from the database. STATEMENTS should be a list or reference to an array of SQL statements. Returns a reference to the array of SQL statements in scalar context, or a list of SQL statements in list context.

post_connect_sql [STATEMENTS]

Get or set the SQL statements that will be run immediately after connecting to the database. STATEMENTS should be a list or reference to an array of SQL statements. Returns a reference to the array of SQL statements in scalar context, or a list of SQL statements in list context.

Get or set the value of the "PrintError" connect option.

raise_error [VALUE]

Get or set the value of the "RaiseError" connect option.

schema [SCHEMA]

Get or set the database schema name. This setting is only useful to databases that support the concept of schemas (e.g., PostgreSQL).

server_time_zone [TZ]

Get or set the time zone used by the database server software. TZ should be a time zone name that is understood by DateTime::TimeZone. See the DateTime::TimeZone documentation for acceptable values of TZ.

type [TYPE]

Get or set the data source type. Note that changing the type after a registry entry has been added to the registry has no affect on where the entry appears in the registry.

username [NAME]

Get or set the database username.

DRIVER-SPECIFIC ATTRIBUTES

MySQL

These attributes should only be used with registry entries where the driver is mysql.

mysql_auto_reconnect [BOOL]

Get or set the mysql_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::mysql 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::mysql documentation to learn more about this attribute.

mysql_client_found_rows [BOOL]

Get or set the mysql_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::mysql 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::mysql documentation to learn more about this attribute.

mysql_compression [BOOL]

Get or set the mysql_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::mysql 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::mysql documentation to learn more about this attribute.

mysql_connect_timeout [BOOL]

Get or set the mysql_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::mysql 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::mysql documentation to learn more about this attribute.

mysql_embedded_groups [STRING]

Get or set the mysql_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::mysql 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::mysql documentation to learn more about this attribute.

mysql_embedded_options [STRING]

Get or set the mysql_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::mysql 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::mysql documentation to learn more about this attribute.

mysql_enable_utf8 [BOOL]

Get or set the mysql_enable_utf8 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::mysql 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::mysql documentation to learn more about this attribute.

mysql_enable_utf8mb4 [BOOL]

Get or set the mysql_enable_utf8mb4 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::mysql 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::mysql documentation to learn more about this attribute.

mysql_local_infile [STRING]

Get or set the mysql_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::mysql 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::mysql documentation to learn more about this attribute.

mysql_multi_statements [BOOL]

Get or set the mysql_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::mysql 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::mysql documentation to learn more about this attribute.

mysql_read_default_file [STRING]

Get or set the mysql_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::mysql 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::mysql documentation to learn more about this attribute.

mysql_read_default_group [STRING]

Get or set the mysql_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::mysql 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::mysql documentation to learn more about this attribute.

mysql_socket [STRING]

Get or set the mysql_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::mysql 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::mysql documentation to learn more about this attribute.

mysql_ssl [BOOL]

Get or set the mysql_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::mysql 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::mysql documentation to learn more about this attribute.

mysql_ssl_ca_file [STRING]

Get or set the mysql_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::mysql 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::mysql documentation to learn more about this attribute.

mysql_ssl_ca_path [STRING]

Get or set the mysql_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::mysql 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::mysql documentation to learn more about this attribute.

mysql_ssl_cipher [STRING]

Get or set the mysql_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::mysql 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::mysql documentation to learn more about this attribute.

mysql_ssl_client_cert [STRING]

Get or set the mysql_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::mysql 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::mysql documentation to learn more about this attribute.

mysql_ssl_client_key [STRING]

Get or set the mysql_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::mysql 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::mysql documentation to learn more about this attribute.

mysql_use_result [BOOL]

Get or set the mysql_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::mysql 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::mysql documentation to learn more about this attribute.

PostgreSQL

These attributes should only be used with registry entries where the driver is pg.

european_dates [BOOL]

Get or set the boolean value that determines whether or not dates are assumed to be in european dd/mm/yyyy format. The default is to assume US mm/dd/yyyy format (because this is the default for PostgreSQL).

This value will be passed to DateTime::Format::Pg as the value of the european parameter in the call to the constructor new(). This DateTime::Format::Pg object is used by Rose::DB::Pg to parse and format date-related column values in methods like parse_date, format_date, etc.

pg_enable_utf8 [BOOL]

Get or set the pg_enable_utf8 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::Pg 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::Pg documentation to learn more about this attribute.

sslmode [MODE]

Get or set the SSL mode of the connection. Valid values for MODE are disable, allow, prefer, and require. See the DBD::Pg documentation to learn more about this attribute.

SQLite

These attributes should only be used with registry entries where the driver is sqlite.

auto_create [BOOL]

Get or set a boolean value indicating whether or not a new SQLite database should be created if it does not already exist. Defaults to true.

If false, and if the specified database does not exist, then a fatal error will occur when an attempt is made to connect to the database.

AUTHOR

John C. Siracusa (siracusa@gmail.com)

LICENSE

Copyright (c) 2010 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.