From 23dfae65aad26667010a57e71fd6a67889dfad11 Mon Sep 17 00:00:00 2001 From: dms Date: Mon, 27 Oct 2003 10:22:09 +0000 Subject: [PATCH] - minor updates git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@859 c11ca15a-4712-0410-83d8-924469b57eb5 --- src/dbi.pl | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/dbi.pl b/src/dbi.pl index 6202114..75464a1 100644 --- a/src/dbi.pl +++ b/src/dbi.pl @@ -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($_); } } -- 2.39.2