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

QSqlError::text() never returns a string

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P2: Important
    • None
    • 6.2.4
    • SQL Support
    • None
    • Linux AMD PC
    • Linux/X11

    Description

      Whenever I get a QSqlQuery error the QSqlError text() function returns an empty string and the error code is always 0; eg,

      Code snippet example QSql error:
      ...
      QSqlQuery query(*db_conn);
      query.prepare("INSERT INTO misc_data SET internat=:internet;"); //typo
      query.bindValue(":internet",internet->status());
      if(!query.exec())

      { fprintf(stderr ,"MySQL: (%p) error '%s', code %d\n",&query,query.lastError().text().toLatin1().data(),query.lastError().type()); return -1; }

      return 0;
      ...

      Prints:

      MySQL (0x7ffe805e5348) error '', code 0

      I have found that at Line 208 in file:

      qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp

      static QSqlError qMakeError(const QString& err, QSqlError::ErrorType type,
      const QMYSQLDriverPrivate* p) ...

      Appears to provide the information but does not seem to be called.

      What am I doing wrong any suggestion will be great.

      Thanks

      Attachments

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

        Activity

          People

            chehrlic Christian Ehrlicher
            stuart Stuart Foster
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes