Qt World Summit: Register Today!

SQLQuery works on SQLite browser but not Qt5.11.2

  • QString const command = QStringLiteral("with ab as ("
                                                   "select a.* from %1 a union all "
                                                   "select b.* from %2 b "
                                                   "SELECT ID, FaceID, Image "
                                                   "FROM (SELECT ab.*,"
                                                   "ROW_NUMBER() OVER (PARTITION BY FaceID ORDER BY DATE DESC, TIME DESC) "
                                                   "as seqnum FROM ab) ab "
                                                   "WHERE seqnum = 1 "
                                                   "ORDER BY Date DESC, Time DESC "
                                                   "LIMIT 5").
           //do not call prepare since this print better error message

    Error messages:

    QSqlError("1", "Unable to execute statement", "near "(": syntax error")

    This command works for the sqlite browser, not sure why it fail with Qt5.11.2

    Edit : I copy the command print by the QLOG_DEBUG to the sqlite browser, it works. The command do not has any special characters, so I should not need any "", weird.

  • Find out the reason, sqlite version of Qt.511.2 is too old

Log in to reply