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

Oracle - DATE in db with a year greater or equal to 2800 returns an invalid date

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.7.0
    • 4.6.1
    • SQL Support
    • 3a51462bfb3cca8c90e1c690cf045b371d2ab393

    Description

      Dates in oracle databases are available until 31-12-9999.

      Currenlty dates with a year equal or greater than 2800 are returned as invalid from Qt.

      Bug investigation:

      In the driver code qsql_oci.cpp, method qMakeDate(const char* oraDate)

      QDateTime qMakeDate(const char* oraDate)
      {
      int century = oraDate[0];
      if(century >= 100){
      ...
      }
      return QDateTime();
      }

      Getting the century from a char causes an overflow for years greater or equal to 2800.
      Example:
      year 2700: century = 127
      year 2800: century = -128

      From the OraFieldInf private classin class QOCICols, we can notice that the data is already retrived as a char*:

      class OraFieldInf
      {
      public:
      OraFieldInf(): data(0), len(0), ind(0), typ(QVariant::Invalid), oraType(0), def(0), lob(0)
      {}
      ~OraFieldInf();
      char *data;
      int len;
      sb2 ind;
      QVariant::Type typ;
      ub4 oraType;
      OCIDefine *def;
      OCILobLocator *lob;
      };

      keyworks: oci, date, QOCI, QSQLOCi

      Attachments

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

        Activity

          People

            charles Charles Yin (closed Nokia identity) (Inactive)
            sanonymous Nokia Qt Support (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes