NAME
SysAdmin::DBD::Pg - Perl DBD class wrapper module.
SYNOPSIS
use SysAdmin::DBD::Pg;
my $db = "dbd_test";
my $username = "dbd_test";
my $password = "dbd_test";
my $host = "localhost";
my $port = '5432';
### Database Table
##
# create table status(
# id serial primary key,
# description varchar(25) not null);
##
###
my $dbd_object = new SysAdmin::DBD::Pg("DB" => "$db",
"DB_USERNAME" => "$username",
"DB_PASSWORD" => "$password",
"DB_HOST" => "$host",
"DB_PORT" => "$port");
## Select Table Data
## SQL select statement
my $select_table = qq(select id,description from status);
## Fetch table data with "fetchTable"
my $table_results = $dbd_object->fetchTable("$select_table");
## Extract table data from $table_results array reference
foreach my $row (@$table_results) {
my ($db_id,$db_description) = @$row;
## Print Results
print "DB_ID $db_id, DB_DESCRIPTION $db_description\n";
}
## Insert Data
## SQL Insert statement
my $insert_table = qq(insert into status (description) values (?));
## Insert Arguments, to subsitute "?"
my @insert_table_values = ("Seventh");
## Insert data with "insertData"
$dbd_object->insertData("$insert_table",\@insert_table_values);
## Select Table Row
## SQL Stament to fetch last insert
my $fetch_last_insert = qq(select description
from status
where description = 'Seventh');
## Fetch table row with "fetchRow"
my $row_results = $object->fetchRow("$fetch_last_insert");
## Print Results
print "Last Insert: $row_results\n";
DESCRIPTION
This is a sub class of SysAdmin. It was created to harness Perl Objects and keep code abstraction to a minimum. This class acts as a sub class for DBD objects.
SysAdmin::DBD::Pg uses DBI and DBD::Pg to interact with database.
EXPORT
SEE ALSO
DBI - Database independent interface for Perl DBD::Pg - PostgreSQL database driver for the DBI module DBD::MySQL - MySQL driver for the Perl5 Database Interface (DBI) DBD::SQLite - Self Contained RDBMS in a DBI Driver
SysAdmin::DBD::MySQL - OO interface to interact with MySQL Databases. SysAdmin::DBD::SQLite - OO interface to interact with SQLite Databases.
AUTHOR
Miguel A. Rivera
COPYRIGHT AND LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.