Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-123107

QSQLITE claims named placeholders are not supported, but sqlite statements with them nonetheless work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.9.7
    • SQL Support
    • None
    • All

      A QSQLITE-driven database claims it doesn't support named placeholders, which makes sense since this is on Qt 5.9.7 on CentOS 7, given that they were seemingly introduced in Qt 5.11, based on [QTBUG-4088|QTBUG-4088 QSQLITE: support named placeholders - Qt Bug Tracker] .

       

      That database was created with the following:

       

      auto db = QSqlDatabase::addDatabase("QSQLITE", "defaultDb");

      And 

      bool ret = db.driver()->hasFeature(QSqlDriver::NamedPlaceholders) 

      returns false.

       

      However, queries with named placeholders work fine with this driver, for example:

       

       

          QString selStmt = "SELECT zip, zoopID, zapID, zup FROM params "
                            "WHERE zepID = :zepID;";
          QSqlQuery query(QSqlDatabase::database("defaultDb"));
          query.prepare(selStmt);
          query.bindValue(":zepID", zepId);
          bool retVal = query.exec();
      

      Was this feature backported into this version in some way? Or perhaps the sqlite driver is configured in a haphazard way? This a package-managed version of Qt, so I don't think there was any custom configuration there, but perhaps worth a look into.

       

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            chehrlic Christian Ehrlicher
            andresalvino Andres Salas
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes