For unit testing, I needed to read ForceProof project database into an in-memory SQLite database, from a .sql text file.
Turns out, Sqlite (at least in Qt) is unable to execute multiple statements in one string. As our SQL is not one statement per line, the SQL in the text file has to be split into separate statements, to execute them one at a time.
Qt does not have that functionality, so I wrote a primitive function (we use it as a method though) that works for our purposes and the SQL format we use. It removes comments, drop statements and empty lines, and assumes each file is a separate transaction, the last line containing COMMIT;.
Hope this helps someone. If you develop it further, feel free to fork the github gist, or drop us a line.