So the only "tricky" part is to be able to say, for each operation within a template file, whether it needs to be handled via "do", or via "fetch" -- which might not be all that tricky, really, because the latter type will generally start with "select" (or "describe", or "show") as the first word of the statement.
In general, you just need to split the template on semicolons (though there is the obvious -- though perhaps unlikely -- risk that a semicolon might appear as data within one of the operations, meaning you have to be careful about how you do the split.
If the files are consistently formatted as you showed in this brief example (each distinct operation / statement is on a separate line, so that statements are separated by ";\n"), then splitting is much simpler -- you could even set your input record separator like this: $/ = ";\n"; so that you read one statement at a time from the template, check what sort of statement it is, and pass it to the appropriate DBI method. | [reply] [d/l] |
Well I ended up just coding in a seperate prepare/execute statement for each one. It turns out it was less work to just copy and paste than to read the template with special code... Maybe :-(
Thanks for the help.
| [reply] |