use vars qw(%factoids %param);
{
+ # FIXME we don't handle multiply indexes tables
+ # perhaps we should combine the keys with a ':' or something?
+ # the spaces below separate the keys from the rest
+ # of the fields.
+ # Tim Riker thinks that freshmeat below should be a single index
my %formats = (
'factoids', [
'factoid_key',
- 'factoid_value',
+
+ 'requested_by',
+ 'requested_time',
+ 'requested_count',
'created_by',
'created_time',
'modified_by',
'modified_time',
- 'requested_by',
- 'requested_time',
- 'requested_count',
'locked_by',
- 'locked_time'
+ 'locked_time',
+ 'factoid_value'
],
'freshmeat', [
'projectname_short',
'latest_version',
+
'license',
'url_homepage',
'desc_short'
],
'rootwarn', [
'nick',
+
'attempt',
'time',
'host',
],
'seen', [
'nick',
+
'time',
'channel',
'host',
- 'messagecount',
- 'hehcount',
- 'karma',
'message'
],
'stats', [
'nick',
'type',
- 'counter',
- 'time'
+ 'channel',
+
+ 'time',
+ 'counter'
+ ],
+ 'botmail', [
+ 'srcwho',
+ 'dstwho',
+
+ 'srcuh',
+ 'time',
+ 'msg'
]
);
return(@retval);
}
+ # FIXME this should be in $select order
+ # and it's now in field order
&DEBUG("dbGet: select=>'$select'.");
my @array = split "$;", ${"$table"}{lc $val};
unshift(@array,$val);
}
#####
-# Usage: &dbDel($table, $primkey, $primval, [$key]);
+# Usage: &dbDel($table, $primhash_ref);
+# Note: dbDel does dbQuote
sub dbDel {
- my ($table, $primkey, $primval, $key) = @_;
- &DEBUG("dbDel($table, $primkey, $primval);");
+ my ($table, $phref) = @_;
+ # FIXME does not really handle more than one key!
+ my $primval = join(':', values %{$phref});
if (!defined ${$table}{lc $primval}) {
&DEBUG("dbDel: lc $primval does not exist in $table.");
my ($table, $key, %hash) = @_;
&DEBUG("dbReplace($table, $key, %hash);");
- &dbDel($table, $key, $hash{$key}, %hash);
+ &dbDel($table, {$key=>$hash{$key}});
&dbInsert($table, $hash{$key}, %hash);
return 1;
}