going to redo the db

This commit is contained in:
Ryan Voots 2011-12-04 14:24:43 -05:00
parent 5290f63a15
commit 2173ceebed

32
redodb.pl Normal file
View file

@ -0,0 +1,32 @@
#!/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;