]> git.donarmstrong.com Git - infobot.git/commitdiff
- mysql/pg now unified. all that waits is for sqlite.
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Thu, 21 Nov 2002 13:18:33 +0000 (13:18 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Thu, 21 Nov 2002 13:18:33 +0000 (13:18 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@651 c11ca15a-4712-0410-83d8-924469b57eb5

blootbot/src/modules.pl

index e8e2e2b76ee86218a7eabc9069e04b1ad5ca291f..a199b4441149bd5a4f08e89b88dc744007c0ce14 100644 (file)
@@ -5,7 +5,8 @@
 #     Created: 20000624
 #
 
-#use strict;
+# use strict;  # TODO
+
 use vars qw($AUTOLOAD);
 
 ###
@@ -66,7 +67,7 @@ BEGIN {
 sub loadCoreModules {
     my @mods = &getPerlFiles($bot_src_dir);
 
-    &status("Loading ".scalar(@mods)." CORE modules...");
+    &status("Loading CORE modules...");
 
     foreach (sort @mods) {
        my $mod = "$bot_src_dir/$_";
@@ -84,8 +85,8 @@ sub loadCoreModules {
 }
 
 sub loadDBModules {
-    my $f = "$bot_src_dir/modules.pl";
-    $moduleAge{$f} = (stat $f)[9];
+    my $f;
+    # todo: use function to load module.
 
     if ($param{'DBType'} =~ /^mysql$/i) {
        eval "use DBI";
@@ -94,28 +95,49 @@ sub loadDBModules {
            exit 1;
        }
        &status("Loading MySQL support.");
-       $f = "$bot_src_dir/db_mysql.pl";
+       $f = "$bot_src_dir/dbi.pl";
        require $f;
        $moduleAge{$f} = (stat $f)[9];
-       &showProc(" (DBI // mysql)");
+
+       &showProc(" (DBI::mysql)");
+
     } elsif ($param{'DBType'} =~ /^pgsql$/i) {
-#      eval "use Pg";
        eval "use DBI";
        if ($@) {
            &ERROR("libpgperl is not installed!");
            exit 1;
        }
        &status("Loading pgsql support.");
-       require "$bot_src_dir/db_pgsql.pl";
-       &showProc(" (pgsql)");
-    } elsif ($param{'DBType'} =~ /^sqlite$|^dbm$/i) {
-       &status("Loading " . $param{'DBType'} . " support.");
-       $f="$bot_src_dir/db_" . $param{'DBType'} . ".pl";
+       $f = "$bot_src_dir/dbi.pl";
+       require $f;
        $moduleAge{$f} = (stat $f)[9];
+
+       &showProc(" (DBI::pgsql)");
+
+    } elsif ($param{'DBType'} =~ /^sqlite$/i) {
+       eval "use DBI";
+       if ($@) {
+           &ERROR("libdbd-sqlite-perl is not installed!");
+           exit 1;
+       }
+       &status("Loading SQLite support.");
+#      $f = "$bot_src_dir/dbi.pl";
+       $f = "$bot_src_dir/db_sqlite.pl";
+       require $f;
+       $moduleAge{$f} = (stat $f)[9];
+
+       &showProc(" (DBI::SQLite)");
+
+    } elsif ($param{'DBType'} =~ /^dbm$/i) {
+       &status("Loading dbm support.");
+       $f = "$bot_src_dir/dbm.pl";
        require $f;
-       &showProc(" $bot_src_dir/db_" . $param{'DBType'} . ".pl");
+       $moduleAge{$f} = (stat $f)[9];
+
+       &showProc(" (dbm.pl)");
+
     } else {
-       &status("DB support DISABLED.");
+       &WARN("DB support DISABLED.");
        return;
     }
 }