From: Marcus Ramberg Date: Tue, 21 Dec 2004 12:12:26 +0000 (+0000) Subject: Support DBD::SQLite2 X-Git-Tag: 2.10~47 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=24259799350483f32219fd3755e0bed54f909c54;p=maypole.git Support DBD::SQLite2 git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@317 48953598-375a-da11-a14b-00016c27c3ee --- diff --git a/Changes b/Changes index a17a4c5..2fee5bc 100644 --- a/Changes +++ b/Changes @@ -25,6 +25,7 @@ Revision history for Perl extension Maypole mod_perl) - classmetadata template variables can now be overriden individually - Template toolkit objects are configured with Maypole::Config->view_options + - Make test suite work with DBD::SQLite2 2.04 Tue Oct 27 14:00:00 2004 diff --git a/Makefile.PL b/Makefile.PL index 345bf6b..ad8fcdb 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -47,10 +47,16 @@ sub has_module { if ( !-e "t/beerdb.db" ) { print "Making SQLite DB\n"; eval { require DBD::SQLite }; - die "No, wait, we don't have SQLite installed. Never mind\n" if $@; - require DBI; - my $dbh = DBI->connect("dbi:SQLite:dbname=t/beerdb.db"); - + my $dbh; + if ($@) { + eval { require DBD::SQLite2 }; + die "No, wait, we don't have SQLite installed. Never mind\n" if $@; + require DBI; + $dbh = DBI->connect("dbi:SQLite2:dbname=t/beerdb.db"); + } else { + require DBI; + $dbh = DBI->connect("dbi:SQLite:dbname=t/beerdb.db"); + } my $sql = join( '', () ); for my $statement ( split /;/, $sql ) { diff --git a/ex/BeerDB.pm b/ex/BeerDB.pm index 1e84b36..6df0491 100644 --- a/ex/BeerDB.pm +++ b/ex/BeerDB.pm @@ -7,7 +7,12 @@ sub debug { $ENV{BEERDB_DEBUG} } BEGIN { # This is the sample application. Change this to the path to your # database. (or use mysql or something) -BeerDB->setup("dbi:SQLite:t/beerdb.db"); +eval { require DBD::SQLite }; +if ($@) { + BeerDB->setup("dbi:SQLite2:t/beerdb.db"); +} else { + BeerDB->setup("dbi:SQLite:t/beerdb.db"); +} } # Give it a name.