Re: MDB2 and SQL script
| From: | Tim Denby | Date: | Mon, 20 Nov 2006 06:38:21 +0000 |
| Subject: | Re: MDB2 and SQL script | ||
| References: | 1 2 | Groups: | php.pear.general php.pear.general |
| Request: | Send a blank email to pear-general+get-25880@lists.php.net to get a copy of this message | ||
Lukas Kahwe Smith wrote:
Tim Denby wrote:Righto, and thanks to Paul Scott for the suggestion too. Both of these suggestions would allow me to execute multiple queries, but the real problem is parsing the file - stripping out the comments, figuring out how many lines go into a single CREATE TABLE statement, etc. Not too hard with a regex, so I'll be all set, I just figured that this would be a common-enough problem that there'd be an existing function for doing it. Cheers, TimHello all, I'm writing a PHP script that will install my application. I have a SQL script as a file (for creating the DB) and I want to execute the whole thing from PHP. But I can't seem to find anything that will execute multiple SQL instructions at once. Do I need to parse the file into individual instructions on my own and loop through them, or is there something in MDB2 (or elsewhere) that would do this for me?Some drivers have support for the "multi_query" option (like mysqli and a few others). When you enable that you can pass it multiple queries in one string. regards, Lukas