You can use a QMutex. Just make is static to your file ei

static QMutext mutex;

Then lock it before calling exec and unlock it once it is done.

If it's early eough in the cycle of the project to change your table, you can make the field a LARGEBLOB and then suck the file into a QByteArray and just insert/update the data like you would an int or a varchar value. This has the advantage of using standard SQL statements and can be used across a couple of differenttypes of databases.