Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Followup on executing multiple mysql commands in one call

by Neighbour (Friar)
on May 31, 2012 at 07:46 UTC ( [id://973452]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    open(INPUT, '<', 'Path/file_with_updates.sql') or die ("Error opening 
    +file with updates: " . $!);
    while (<INPUT>) {
        $dbh->do($_) or die("Error executing query [$_]: " . $dbh->errstr)
    +;
    }
    close(INPUT);
    
  2. or download this
    my $sth = $dbh->prepare('UPDATE Games SET Away_Team_ID=(SELECT Team_ID
    + FROM Teams WHERE Name = ?) WHERE Date = ?') or die("Error preparing 
    +statement: " . $dbh->errstr);
    open(INPUT, '<', 'Path/file_with_data') or die ("Error opening file wi
    +th updates: " . $!);
    ...
        $sth->execute($teamname, $gamedate) or die("Error executing update
    +: " . $dbh->errstr);
    }
    close(INPUT);
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-20 04:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found