解析包含分号的SQL(在PHP中)

I coded a SQL parser that load data from a MySQL dump. The problem is that some SQL statements contain semicolon themselves so my parser take it as EOL as I use

$sqlRows = explode(';', $sqlFile);

to parse the dump file.

Any suggestion on how to manage this? I'm stuck :S

edit:

Sorry I forgot to say that the problem is that when PHP writes data to DB from the dump file, it returns me an error when it read the sentence that contain the semicolon.

I know it's not a full parser, it just read line by line. I'm new to this. I just need to "clone" the same DB (via dump file) to many, changing few data.

try this

$sqlRows=explode(";
",$sqlFile);

So you will only get the ; that are at the end of lines. However it'll only work if your file is formatted with each statement finishing by a ; and each new statement beginning on a new line.