in reply to checking to do a insert or update
Then, use the "prepare" method in DBI to create two SQL statement handles -- one for update, and one for insert.
Now, as you go through the "weekly_file", check each "round,playername" value to see if it exists as a hash key from that initial query -- if it's there, use the update statement handle, otherwise, use the insert.
I wrote a wrapper for DBI that makes this sort of thing fairly simple to code in Perl (the pod even gives an example a bit like this) -- I'm not claiming it's the "best" or "optimal" solution, but it works for me, and saves me a lot of time when writing Perl code for SQL operations like this.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: checking to do a inser or update
by dsheroh (Monsignor) on Jun 07, 2002 at 15:44 UTC |