mirror of
https://github.com/perlbot/perlbuut
synced 2025-06-07 10:45:40 -04:00
Remove old import scripts that are no longer needed.
This commit is contained in:
parent
077473e3b1
commit
278405473d
2 changed files with 0 additions and 118 deletions
|
@ -1,65 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use Data::Dumper;
|
||||
use DBI;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Text::Soundex qw/soundex/; #didn't know buu did this!
|
||||
|
||||
sub _clean_subject {
|
||||
my( $subject ) = @_;
|
||||
|
||||
$subject =~ s/^\s+//;
|
||||
$subject =~ s/\s+$//;
|
||||
$subject =~ s/\s+/ /g;
|
||||
# $subject =~ s/[^\w\s]//g; #comment out to fix punct in factoids
|
||||
$subject = lc $subject;
|
||||
|
||||
return $subject;
|
||||
}
|
||||
|
||||
my $dbhnew = DBI->connect(
|
||||
"dbi:SQLite:dbname=factoids.db",
|
||||
"",
|
||||
"",
|
||||
{ RaiseError => 1, PrintError => 0 }
|
||||
);
|
||||
|
||||
my $dbhold = DBI->connect("dbi:SQLite:dbname=../perlbotstuff/data/facts.db","","", { RaiseError => 1, PrintError => 0 });
|
||||
|
||||
my @facts;
|
||||
|
||||
my $sth = $dbhold->prepare("SELECT * FROM facts;");
|
||||
|
||||
$sth->execute();
|
||||
|
||||
while (my $row =$sth->fetchrow_arrayref())
|
||||
{
|
||||
print Dumper($row);
|
||||
push @facts, {subject => $row->[0], predicate => $row->[1], copula => 'is', author => 'perlbot', original_subject => _clean_subject($row->[0]), modified_time => time, soundex => soundex($row->[0])}
|
||||
}
|
||||
|
||||
for (@facts)
|
||||
{
|
||||
$dbhnew->do( "INSERT INTO factoid
|
||||
(original_subject,subject,copula,predicate,author,modified_time,soundex,compose_macro)
|
||||
VALUES (?,?,?,?,?,?,?,?)",
|
||||
undef,
|
||||
@$_{qw(original_subject subject copula predicate author modified_time soundex)},
|
||||
0,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
#CREATE TABLE factoid (
|
||||
# factoid_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
# original_subject VARCHAR(100),
|
||||
# subject VARCHAR(100),
|
||||
# copula VARCHAR(25),
|
||||
# predicate TEXT,
|
||||
# author VARCHAR(100),
|
||||
# modified_time INTEGER,
|
||||
# soundex VARCHAR(4),
|
||||
# compose_macro CHAR(1) DEFAULT '0'
|
|
@ -1,53 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use Data::Dumper;
|
||||
use DBI;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Text::Soundex qw/soundex/; #didn't know buu did this!
|
||||
use POE::Component::IRC::Common qw(l_irc);
|
||||
|
||||
my $dbhnew = DBI->connect(
|
||||
"dbi:SQLite:dbname=karma.db",
|
||||
"",
|
||||
"",
|
||||
{ RaiseError => 1, PrintError => 0 }
|
||||
);
|
||||
|
||||
my $dbhold = DBI->connect("dbi:SQLite:dbname=../perlbotstuff/data/karma.db","","", { RaiseError => 1, PrintError => 0 });
|
||||
|
||||
my @facts;
|
||||
|
||||
my $sth = $dbhold->prepare("SELECT * FROM karma;");
|
||||
|
||||
$sth->execute();
|
||||
|
||||
while (my $row =$sth->fetchrow_arrayref())
|
||||
{
|
||||
print Dumper($row);
|
||||
push @facts, {subject => $row->[0], operation=>$row->[1], author=>'perlbot', modified_time=>time}
|
||||
}
|
||||
|
||||
#CREATE TABLE karma (
|
||||
# karma_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
# subject VARCHAR(250),
|
||||
# operation TINYINT,
|
||||
# author VARCHAR(32),
|
||||
# modified_time INTEGER
|
||||
# )"; # Stupid lack of timestamp fields
|
||||
|
||||
|
||||
for (@facts)
|
||||
{
|
||||
my $lirc = l_irc($_->{subject}) || lc $_->{subject};
|
||||
$dbhnew->do( "INSERT INTO karma
|
||||
(subject,operation,author,modified_time)
|
||||
VALUES (?,?,?,?)",
|
||||
undef,
|
||||
$lirc, @$_{qw(operation author modified_time)},
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Add table
Reference in a new issue