At least on Qt5, the QSqlQuery.lastQuery() function, when used with
prepared queries, returns the EXECUTE statement and not the actual
query. Qt then attempts to PREPARE this statement, which causes
a syntax error, aborting the transaction and dropping the message that
was to be inserted. A better idea would be to execute the named
prepared query directly, which avoids the problem.