package db;
require Exporter;
BEGIN {
@ISA = qw(Exporter AutoLoader);
}
@EXPORT = qw();
use strict;
use Data::Dumper qw/Dumper /;
sub getDBINFO
{
my %DBINFO=
(
default =>"xe",
xe =>{
ip =>"10.3.1.100",
port =>"1521",
dbname =>"palm",
user =>"user",
passwd =>"pwd",
dbtype =>"oracle",
},
mysql =>{
ip =>"172.16.1.100",
port =>"3307",
dbname =>"market",
user =>"pwd",
passwd =>"palm\@mkt",
dbtype =>"mysql",
},
);
return %DBINFO;
}
sub new
{
my $this={
};
bless $this;
my $dbinfo=$_[1];
my %DBINFO = $this->getDBINFO();
if ($dbinfo eq ''){
$dbinfo=$DBINFO{
'default'};
}
$this->set_dbinfo($dbinfo);
$this->setAutoCommitOn();
if (exists($DBINFO{
$dbinfo}))
{
my %HASH_TEMP = %