going to redo the db
This commit is contained in:
parent
5290f63a15
commit
2173ceebed
1 changed files with 32 additions and 0 deletions
32
redodb.pl
Normal file
32
redodb.pl
Normal 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;
|
Loading…
Add table
Reference in a new issue