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

QSQLiteResult::exec() & SQLITE_VERSION_NUMBER >= 3003011

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 5.10.0
    • SQL Support
    • None

    Description

      In qsql_sqlite.cpp in  "bool QSQLiteResult::exec()"...

       

      int paramCount = sqlite3_bind_parameter_count(d->stmt);
      bool paramCountIsValid = paramCount == values.count();
      
      #if (SQLITE_VERSION_NUMBER >= 3003011)
      // In the case of the reuse of a named placeholder
      if (!paramCountIsValid) {
          const auto countIndexes = [](int counter, const QList<int>& indexList)     
              { return counter + indexList.length(); };
      
          const int bindParamCount = std::accumulate(d->indexes.cbegin(),
                                                     d->indexes.cend(),
                                                     0,
                                                     countIndexes);
      
          paramCountIsValid = bindParamCount == values.count();
      }
      #endif
      
      if (paramCountIsValid) {
          for (int i = 0; i < paramCount; ++i) {
              res = SQLITE_OK;
              const QVariant value = values.at(i);
      

       

      Simple QSqlQuery c_tor crashes...

       

      QSqlQuery insert( QLatin1String(
          "INSERT INTO eventLog ( level, dateTime, msg ) "
          "VALUES ( ?, ?, ? )" ) );
      

       

      on line 487 in qsql_sqlite.cpp. paramCount and paramCountIsValid calculates first time correctly. But then execution goes into 

      #if (SQLITE_VERSION_NUMBER >= 3003011)

      And there paramCountIsValid becomes "true" whereas values.size() == 0 and paramCount == 3...

      Attachments

        Issue Links

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

          Activity

            People

              sgaist Samuel Gaist
              igor.mironchik Igor Mironchik
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes