email grabber
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 3 Sep 2006 03:22:31 +0000 (03:22 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 3 Sep 2006 03:22:31 +0000 (03:22 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5879 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/src/extras/import/drain-batgirl-email.pl [new file with mode: 0755]

diff --git a/Evergreen/src/extras/import/drain-batgirl-email.pl b/Evergreen/src/extras/import/drain-batgirl-email.pl
new file mode 100755 (executable)
index 0000000..f83375b
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+
+use strict;
+use DBI;
+
+my $dbh = DBI->connect('DBI:mysql:database=reports;host=batgirl.gsu.edu','miker','poopie');
+
+print <<SQL;
+
+DROP TABLE legacy_bill;
+CREATE TABLE legacy_email (user_key int, email text);
+COPY legacy_email (user_key, email) FROM STDIN;
+SQL
+
+warn "going for the data...";
+
+my $sth = $dbh->prepare('select USER_KEY, EMAIL from USER');
+$sth->execute;
+
+warn "got it, writing file...";
+
+while (my $cn = $sth->fetchrow_hashref) {
+       my @data = map { $$cn{uc($_)} } qw/user_key email/;
+       print join("\t", @data) . "\n";
+}
+
+print "\\.\n";
+
+