]> git.donarmstrong.com Git - infobot.git/commitdiff
- minor updates
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Mon, 27 Oct 2003 10:22:09 +0000 (10:22 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Mon, 27 Oct 2003 10:22:09 +0000 (10:22 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@859 c11ca15a-4712-0410-83d8-924469b57eb5

blootbot/src/dbi.pl

index 62021144dd82da4beb07d714cb96d6abfb4f36be..75464a164f0690a17ab29fe4f5350dce06bd3d0a 100644 (file)
@@ -88,12 +88,11 @@ sub sqlSelectMany {
        return;
     }
 
-    $query .= " WHERE" if (($where_href) || ($other));
     if ($where_href) {
        my $where = &hashref2where($where_href);
-       $query .= " $where" if ($where);
+       $query .= " WHERE $where" if ($where);
     }
-    $query .= " $other"                if $other;
+    $query .= " $other"        if ($other);
 
     if (!($sth = $dbh->prepare($query))) {
        &ERROR("sqlSelectMany: prepare: $DBI::errstr");
@@ -101,10 +100,8 @@ sub sqlSelectMany {
     }
 
     &SQLDebug($query);
-    if (!$sth->execute) {
-       &ERROR("sqlSelectMany: execute: '$query'");
-       return;
-    }
+
+    return if (!$sth->execute);
 
     return $sth;
 }
@@ -265,7 +262,7 @@ sub sqlUpdate {
 
     if (!defined $data_href or ref($data_href) ne "HASH") {
        &WARN("sqlSet: data_href == NULL.");
-       return;
+       return 0;
     }
 
     my $where  = &hashref2where($where_href) if ($where_href);
@@ -644,10 +641,16 @@ sub checkTables {
        }
     }
 
-    foreach ( qw(factoids rootwarn seen stats botmail) ) {
-       next if (exists $db{$_});
+    foreach ( qw(factoids factoidsmisc rootwarn seen stats botmail) ) {
+       if (exists $db{$_}) {
+           $cache{has_table}{$_} = 1;
+           next;
+       }
+
        &status("checkTables: creating new table $_...");
 
+       $cache{create_table}{$_} = 1;
+
        &sqlCreateTable($_);
     }
 }