On Mon, 3 Dec 2001, Tyler Longren wrote:
> I have a HUGE document full of very simple SQL queries. Each query only
> takes up one line in the file. How could I get every individual line of SQL
> and execute it? I know how to query MySQL in perl, so that's fine...I just
> don't know how to get the individual lines to execute.
Assuming you already have a database handle called $dbh, and using DBI:
open SQLFILE, "$sqlfile" or die "Can't open file :$1\n";
while(<SQLFILE>) {
chomp;
my $sth = $dbh->prepare($_);
$sth->execute;
}
-- Brett
http://www.chapelperilous.net/
------------------------------------------------------------------------
You're already carrying the sphere!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]