From: "Paul Fontenot" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: quotes, quotes, quotes...
Date sent: Wed, 30 May 2001 23:58:49 -0700
Paul,
use placeholders as follows (and add error checking yourself):
> ============================================================================
> =========
> #!/usr/bin/perl -wT
> #
> use DBI;
>
> $dsn = "DBI:mysql:servers:localhost";
> $user_name = "user";
> $passwd = "password";
>
> $log = "/var/log/messages";
>
> $dbh = DBI->connect ($dsn, $user_name, $passwd, {RaiseError => 1});
>
# prepare $sth *now*
$sth = $dbh->prepare( "INSERT INTO status values (?, ?, ?, ?, ?,
?)" );
> open(LOG, $log) || die "Can't open $log: $!\n";
>
> while (<LOG>) {
> ($month, $day, $time, $logged_host, $service, $description) = split
> / /, $_, 6;
> print "$month $day $time $logged_host $service $description\n";
> sleep 1;
> $sth->execute ($month, $day, $time, $logged_host, $service, $description);
> }
>
> $dbh->disconnect ();
> close(LOG);
>
Dr. med. Bodo Eing
Institut fuer Medizinische Mikrobiologie
Klinische Virologie
v.-Stauffenbergstr. 36
48151 Muenster
Germany
Phone: ++49 251 7793 111 Fax: ++49 251 7793-104