Important: Please read the Qt Code of Conduct -

QSql - save query / buffer when it fails - issue with placeholders

  • Dear all,
    I'm using QSql module to store measurement data in a distant database.
    I would like to handle network disconnection and buffer the queries when they fail.
    One of my ideas was to store the query in a text file and process it later when connection is restored.

    However I'm using a prepared statement and binding the values, so I need a way to get the whole query (prepared with the placeholders replaced by their bound values).

    QSqlQuery::lastQuery() and QSqlQuery::executedQuery() both give me the original prepared statement, with the placeholders. Is a way to get the sql command?

    If you have a better suggestion to buffer failed queries, let me know!
    Thank you

Log in to reply