Anansi-Database-PostgreSQL
view release on metacpan or search on metacpan
lib/Anansi/Database/PostgreSQL.pm view on Meta::CPAN
=head3 validate
See L<Anansi::DatabaseComponent::validate|Anansi::DatabaseComponent/"validate"> for details. Overridden by L<Anansi::Database::PostgreSQL::validate|Anansi::Database::PostgreSQL/"validate">.
=cut
=head2 connect
if(Anansi::Database::PostgreSQL::connect(
$OBJECT,
undef,
DATABASE => 'someDatabase',
PASSWORD => 'somePassword',
USERNAME => 'someUser',
));
if($OBJECT->connect(
undef,
DATABASE => 'someDatabase',
PASSWORD => 'somePassword',
USERNAME => 'someUser',
));
=over 4
=item self I<(Blessed Hash, Required)>
An object of this namespace.
=item channel I<(String, Required)>
The abstract identifier of a subroutine.
=item parameters I<(Hash, Optional)>
Named parameters.
=over 4
=item AutoCommit I<(String, Optional)>
Defines whether the PostgreSQL driver automatically saves any changes made to the
B<DATABASE>. A value of B<1> I<(one)> means changes will be saved, a value of
B<0> I<(zero)> means changes will need to be manually saved. Changes are not
saved by default.
=item DATABASE I<(String, Optional)>
The name of the PostgreSQL database. The content of the I<PGDATABASE>
environment variable is used by default.
=item HOSTNAME I<(String, Optional)>
The IP address of the computer where the PostgreSQL B<DATABASE> is hosted.
Either the content of the I<PGHOST> environment variable or a value of
B<127.0.0.1> is used by default.
=item PASSWORD I<(String, Optional)>
The password of the B<USERNAME> that is accessing the PostgreSQL database. The
content of the I<PGPASSWORD> environment variable is used by default.
=item PORT I<(String, Optional)>
The IP address port number of the computer where the PostgreSQL B<DATABASE> is
hosted. Either the content of the I<PGPORT> environment variable or a value of
B<5432> I<(five four three two)> is used by default.
=item PrintError I<(String, Optional)>
Defines whether the PostgreSQL driver will use the B<warn> function. A value of B<1>
I<(one)> means errors will be output using B<warn>, a value of B<0> I<(zero)>
means errors will not be output in this way. Errors are output by default.
=item RaiseError I<(String, Optional)>
Defines whether the PostgreSQL driver will use the B<die> function. A value of B<1>
I<(one)> means errors will be output using B<die>, a value of B<0> I<(zero)>
means errors will not be output in this way. Errors are output by default.
=item USERNAME I<(String, Optional)>
The user that is accessing the PostgreSQL database. The content of the
I<PGUSER> environment variable is used by default.
=back
=back
Overrides L<Anansi::DatabaseComponent::connect|Anansi::DatabaseComponent/"connect">.
=cut
sub connect {
my ($self, $channel, %parameters) = @_;
return $self->SUPER::connect(
undef,
INPUT => [
{
INPUT => [
'dbi:Pg:dbname=', {
DEFAULT => $ENV{'PGDATABASE'} || '',
NAME => 'DATABASE',
REF => '',
},
';host=', {
DEFAULT => $ENV{'PGHOST'} || '127.0.0.1',
NAME => 'HOSTNAME',
REF => '',
},
';port=', {
DEFAULT => $ENV{'PGPORT'} || '5432',
NAME => 'PORT',
REF => '',
}
],
REF => '',
}, {
DEFAULT => $ENV{'PGUSER'} || undef,
( run in 1.827 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )