use vars qw(%factoids %freshmeat %seen %rootwarn); # db hash.
-
{
my %formats = (
'factoids', [
'locked_time'
],
'freshmeat', [
- 'name',
- 'stable',
- 'devel',
- 'section',
+ 'projectname_short',
+ 'latest_version',
'license',
- 'homepage',
- 'download',
- 'changelog',
- 'deb',
- 'rpm',
- 'link',
- 'oneliner'
+ 'url_homepage',
+ 'desc_short'
],
'rootwarn', [
'nick',
return(@retval);
}
- &DEBUG("dbGet: select => '$select'.");
+ &DEBUG("dbGet: select=>'$select'.");
my @array = split "$;", ${"$table"}{lc $val};
- unshift(@array,$key);
+ unshift(@array,$val);
for (0 .. $#format) {
my $str = $format[$_];
next unless (grep /^$str$/, split(/\,/, $select));
$array[$_] ||= '';
- &DEBUG("dG: pushing '$array[$_]'.");
+ &DEBUG("dG: '$format[$_]'=>'$array[$_]'.");
push(@retval, $array[$_]);
}
$array[$i - 1]=$hash{$col};
$array[$i - 1]='' unless $array[$i - 1];
delete $hash{$col};
- &DEBUG("dbI: setting $table->$primkey\{$col\} => '$array[$i - 1]'.");
+ &DEBUG("dbI: '$col'=>'$array[$i - 1]'");
}
if (scalar keys %hash) {
&ERROR("dbI: not added...");
foreach (keys %hash) {
- &ERROR("dbI: '$_' => '$hash{$_}'");
+ &ERROR("dbI: '$_'=>'$hash{$_}'");
}
return 0;
}
}
sub dbUpdate {
- &FIXME("STUB: &dbUpdate(@_); => somehow use dbInsert!");
+ &FIXME("STUB: &dbUpdate(@_);=>somehow use dbInsert!");
}
#####
&DEBUG("dbDel($table, $primkey, $primval);");
if (!defined ${$table}{lc $primval}) {
- &WARN("dbDel: lc $primval does not exist in $table.");
+ &DEBUG("dbDel: lc $primval does not exist in $table.");
} else {
delete ${$table}{lc $primval};
}
my $where = $key . "=" . $phref->{$key};
my %hash = &dbGetColNiceHash($table, "*", $where);
+ $hash{$key}=$phref->{$key};
foreach (keys %{$href}) {
&DEBUG("dbSet: setting $_=${$href}{$_}");
$hash{$_} = ${$href}{$_};
}
sub randKey {
- &FIXME("STUB: &randKey(@_);");
+ &DEBUG("STUB: &randKey(@_);");
+ my @format = &dbGetColInfo($table);
+ if (!scalar @format) {
+ return;
+ }
+
+ my $rand = int(rand(&countKeys($table) - 1));
+ my @keys = keys %{$table};
+ &dbGet($table, '*', "@format[0]=@keys[$rand]");
+}
+
+#####
+# Usage: &deleteTable($table);
+sub deleteTable {
+ my ($table) = @_;
+ &FIXME("STUB: deleteTable($table)");
}
##### $select is misleading???
# Usage: &searchTable($table, $returnkey, $primkey, $str);
sub searchTable {
+ my ($table, $primkey, $key, $str) = @_;
&FIXME("STUB: searchTable($table, $primkey, $key, $str)");
return;
- my ($table, $primkey, $key, $str) = @_;
&DEBUG("searchTable($table, $primkey, $key, $str)");
if (!scalar &dbGetColInfo($table)) {