From: timriker Date: Fri, 17 Dec 2004 16:23:33 +0000 (+0000) Subject: SQLite2 also supported X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=357aaec8f9832139171075138cf2293bbfc6be79;p=infobot.git SQLite2 also supported git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@1104 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/INSTALL b/INSTALL index 08d8a63..aed3621 100644 --- a/INSTALL +++ b/INSTALL @@ -20,6 +20,7 @@ Method of installation. - Choose your database: - MySQL, read INSTALL.mysql (supported) - SQLite, read INSTALL.sqlite (supported) + - SQLite2, read INSTALL.sqlite (supported) - PgSQL, read INSTALL.pgsql (unsupported, may work) - There are "bugs" in the perl modules. Read INSTALL.patches on how to fix. diff --git a/INSTALL.sqlite b/INSTALL.sqlite index c156712..35c6b7b 100644 --- a/INSTALL.sqlite +++ b/INSTALL.sqlite @@ -15,6 +15,8 @@ you if they do not already exist. other distros might need to build from sources. +You may use either DBD::SQLite or DBD::SQLite2 + SQLite sources: http://www.hwaci.com/sw/sqlite/ diff --git a/files/sample/blootbot.config b/files/sample/blootbot.config index c5fff9e..f8b072f 100644 --- a/files/sample/blootbot.config +++ b/files/sample/blootbot.config @@ -34,7 +34,8 @@ set tempDir /home/blootbot/Temp # [str] Ability to remember/tell factoids # none -- disable. # mysql -- ... -# SQLite -- SQLite (libdbd-sqlite-perl) +# SQLite -- SQLite (libdbd-sqlite-perl) (might be version 2 or 3) +# SQLite2 -- SQLite (libdbd-sqlite-perl) (force version 2) # pgsql -- postgresql (NOT SUPPORTED) ### REQUIRED by factoids,freshmeat,karma,seen,... set DBType mysql diff --git a/src/dbi.pl b/src/dbi.pl index f4c89d3..99d115e 100644 --- a/src/dbi.pl +++ b/src/dbi.pl @@ -19,7 +19,7 @@ package main; sub sqlOpenDB { my ($db, $type, $user, $pass, $no_fail) = @_; # this is a mess. someone fix it, please. - if ($type =~ /^SQLite$/i) { + if ($type =~ /^SQLite(2)?$/i) { $db = "dbname=$db.sqlite"; } elsif ($type =~ /^pg/i) { $db = "dbname=$db"; @@ -629,7 +629,7 @@ sub checkTables { &status("Tables: ".join(',',@tables)); @db{@tables} = (1) x @tables; - } elsif ($param{DBType} =~ /^SQLite$/i) { + } elsif ($param{DBType} =~ /^SQLite(2)?$/i) { # retrieve a list of db's from the server. foreach ( &sqlRawReturn("SELECT name FROM sqlite_master WHERE type='table'") ) { diff --git a/src/modules.pl b/src/modules.pl index a1cc28f..17bab22 100644 --- a/src/modules.pl +++ b/src/modules.pl @@ -52,7 +52,7 @@ sub loadDBModules { my $f; # TODO: use function to load module. - if ($param{'DBType'} =~ /^(mysql|SQLite|pgsql)$/i) { + if ($param{'DBType'} =~ /^(mysql|SQLite(2)?|pgsql)$/i) { eval "use DBI"; if ($@) { &ERROR("No support for DBI::" . $param{'DBType'} . ", exiting!");