I am trying to run a .sql script produced with mysql-dump from a php script but
failed to find a rudimentary robust solution yet.
mysql_query() can only run one query at a time. Thus its necessary to somehow
parse the input file and separate the queries... which is difficult since the
syntax can be quite complex.
So far I managed to run most CREATE TABLE and INSERT queries just by
dropping newlines (\n) and explode()ing the input by ';'. Now I am stuck with a
CREATE TRIGGER statement because mysql-dump does this:
CREATE TRIGGER ... ON ...
FOR EACH ROW BEGIN ...
exploding that string by ';' results in 4 (or more) queries which are invalid
syntax then. And I have no glue on what else mysql-dump may come up with on
does anyone know how to do that properly?
I dont favor importing the dumps via shell command like 'cat some.dump | mysql'
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php