Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. SQLQuery works on SQLite browser but not Qt5.11.2
Forum Updated to NodeBB v4.3 + New Features

SQLQuery works on SQLite browser but not Qt5.11.2

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 167 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • thamT Offline
    thamT Offline
    tham
    wrote on last edited by tham
    #1
    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").
                    arg(get_table_name(table_name::recorded_face_whitelist_log),
                        get_table_name(table_name::recorded_face_log));        
           //do not call prepare since this print better error message
            query.exec(command);
    
            if(!query.lastError().isValid()){
                update_latest_face_impl(query);
            }else{
                QLOG_DEBUG()<<__func__<<query.lastError()<<"\ncommand:"<<command;
            }
    

    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.

    1 Reply Last reply
    0
    • thamT Offline
      thamT Offline
      tham
      wrote on last edited by
      #2

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

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved