#!/usr/bin/perl -w
#
# load.pl 
# 
# J. Uckelman (uckelman@iastate.edu)
# 30 September 2000
#

require 5.005;
use DBI;

my $version = 0.1;
my $config = '/home/g1/bin/mysql.conf';

eval { require $config; } ; die "$0: $config: $@\n" if $@;

my $dbh = DBI->connect("DBI:mysql:database=$database;host=$host;port=$port", $user, $password);

open FILE, '/home/g1/bin/t';
my $data = join '', <FILE>;
close FILE;

$i = 0;
while (($id, $date, $event) = $data =~ m/(\d+) \| (.*?) \| (.*?)\n/s) {
	$data = $';
	$event = quotemeta($event);
	$dbh->do("insert into event (id, date, event) values ($id, '$date', '$event')");
}

$dbh->disconnect;
