Update of /cvsroot/fink/scripts/buildfink/lib/FinkFDB
In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv19869/lib/FinkFDB

Modified Files:
        DBI.pm 
Log Message:
a little bounds-checking; would be nice if it auto-initted the sqlite database, 
but have not gotten that far yet

Index: DBI.pm
===================================================================
RCS file: /cvsroot/fink/scripts/buildfink/lib/FinkFDB/DBI.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- DBI.pm      2 Apr 2007 04:35:45 -0000       1.3
+++ DBI.pm      4 Apr 2007 18:41:59 -0000       1.4
@@ -1,6 +1,7 @@
 package FinkFDB::DBI;
 use strict;
 use warnings;
+use Carp;
 use DBI;
 our @ISA = qw(FinkFDB);
 
@@ -72,7 +73,7 @@
   $self->{dbh} = DBI->connect($self->{dbstr},
                              $self->{dbuser},
                              $self->{dbpass},
-                             $self->{dbattrs});
+                             $self->{dbattrs}) or die "unable to connect to 
$self->{dbstr}: " . DBI->errstr;
   $self->{queries} = {};
 }
 
@@ -225,6 +226,9 @@
 
 sub prepare {
   my($self, $qname) = @_;
+  croak "\$self was not provided" if (not defined $self);
+  $self->connect if (not exists $self->{dbh} or not defined $self->{dbh});
+  croak "\%dbqueries does not contain $qname" if (not exists 
$dbqueries{$qname} or not defined $dbqueries{$qname});
   return $self->{dbh}->prepare($dbqueries{$qname});
 }
 


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Fink-commits mailing list
Fink-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fink-commits

Reply via email to