![]() |
|
Just another Perl shrine | |
PerlMonks |
Re: How to execute sql scripts via perlby samtregar (Abbot) |
on Mar 04, 2009 at 05:55 UTC ( [id://747995]=note: print w/replies, xml ) | Need Help?? |
It's possible, but not usually worth the effort. If you want to do it, what you need to do is read in the SQL file and split up each statement. Pass each statement to $dbh->do(). Something like (untested):
It's not perfect - it will break if you have a comment that ends in a ";" for example. Usually it's better to just shell out to the MySQL shell to load a whole SQL file:
-sam
In Section
Seekers of Perl Wisdom
|
|