Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: How to execute sql scripts via perl

by samtregar (Abbot)
on Mar 04, 2009 at 05:55 UTC ( [id://747995]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      # read foo.sql into memory
      open my $fh, "<", "foo.sql" or die $!;
    ...
    
      # run each command
      $dbh->do($_) for @commands;
    
  2. or download this
      system("mysql -hhost -uname -ppass db < foo.sql") == 0
        or die "Failed: $?";
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://747995]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2025-03-22 16:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (63 votes). Check out past polls.