dirkobot/redodb.pl
2011-12-04 14:24:43 -05:00

32 lines
749 B
Perl

#!/usr/bin/perl
use DBI;
my $dbh = DBI->connect("dbi:SQLite:dbname=bot-basicbot.sqlite","","");
#CREATE TABLE "basicbot" (
# id INT PRIMARY KEY,
# namespace TEXT,
# store_key TEXT,
# store_value LONGBLOB );
my $readsth = $dbh->prepare("SELECT id, namespace, store_key, store_value FROM basicbot");
my $updatesth = $dbh->prepare("UPDATE basicbot SET store_key = ? WHERE id = ?");
$readsth->execute();
$dbh->begin_work;
while(my @row = $readsth->fetchrow_array) {
if ($row[1] eq "Infobot") {
print $row[2], "\n";
my $newkey = $row[2];
$newkey =~ s/!/?/g;
$updatesth->execute($newkey, $row[0]);
}
}
$dbh->commit;