XrefParser DatabaseParser
Included librariesPackage variablesGeneral documentationMethods
Toolbar
WebCvsRaw content
Package variables
Privates (from "my" definitions)
$db;
Included modules
DBI
Inherit
XrefParser::BaseParser
Synopsis
No synopsis!
Description
No description!
Methods
connect
No description
Code
db
No description
Code
parse_dsn
No description
Code
Methods description
None available.
Methods code
connectdescriptionprevnextTop
sub connect {
  my ($self, $dsn) = @_;

  my %dsn = $self->parse_dsn($dsn);

  $db = DBI->connect( "DBI:mysql:host=" . $dsn{'host'} . ":port=" . $dsn{'port'} . ";database=" . $dsn{'database'}, $dsn{'user'}, $dsn{'pass'},
		      {'RaiseError' => 1}) || die "Can't connect to database\n";

  return $db;
}
dbdescriptionprevnextTop
sub db {
  return $db;

}

1;
}
parse_dsndescriptionprevnextTop
sub parse_dsn {
  my ($self,$dsn) = @_;

  my %hash;

  my @bits = split /:/, $dsn;

  $hash{'host'} = $bits[1];
  $hash{'port'} = $bits[2];
  $hash{'database'} = $bits[3];
  $hash{'user'} = $bits[4];
  $hash{'pass'} = $bits[5];

  return %hash;

}

# Connect to a database. Return DB connection.
}
General documentation
No general documentation available.