$VERSION = 1.00;
@ISA = qw(Exporter);
@EXPORT = qw(&db_setocean &db_writer &db_connect $dbh
- &db_filename &db_doall &db_onconflict);
+ &db_filename &db_doall &db_onconflict &db_setdatadir);
%EXPORT_TAGS = ( );
@EXPORT_OK = qw();
our $dbfn;
our $dbh;
+our $datadir= '.';
+sub db_setdatadir ($) {
+ $datadir= $_[0];
+}
sub db_setocean ($) {
my ($oceanname) = @_;
- $dbfn= "OCEAN-$oceanname.db";
+ $dbfn= "$datadir/OCEAN-$oceanname.db";
}
sub db_filename () {
return $dbfn;
}
sub db_connect () {
+ return if $dbh;
$dbh= DBI->connect("dbi:SQLite:$dbfn",'','',
{ AutoCommit=>0,
RaiseError=>1, ShowErrorStatement=>1,