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

qsql_oci discards the fractions of a second stored in Oracle 9i and 10g TIMESTAMP datatypes

    XMLWordPrintable

Details

    • 0900cf3581be3ff2b2e924ce0d845566c5df841e

    Description

      qMakeData() in src/sql/drivers/oci creates a QDateTime using only the year, month, day, hour, minute, and second returned from Oracle. However, TIMESTAMP datatypes can contain fractions of a second, and thus we discard this value. We should attempt to store this in QDateTime's milliseconds field, if we can.

      This bug is in both Qt 3.3.4 and Qt 4.0.0.

      --------------------------------------

      QOCI driver binds TIMESTAMP fields to SQLT_DAT which doesn't return fractions of a second.
      Workaround could be to select TIMESTAMP field as char.

      For example :
      SELECT to_char(tsfield,'FF3') AS millisec FROM table;

      Originally closed as Won't Fix with the view that implementing this using TIMESTAMP would break support for Oracle 8.

      Subsequently this task was reopened.

      See attached attached oci.tgz, a little app that uses the same OCI calls the OCI driver uses. This app can successfully insert a QDateTime into the database while the OCI driver cannot.

      I suspect some kind of memory corruption in the OCI driver. The database ends up holding an invalid TIMESTAMP value that causes OCI to return 'null' and SQLPlus to give an error. There is also code in there that attempts to send down a string instead of an OCIDateTime object but it is not working reliably either (mostly because the coercion stuff cannot be used in a bound string).

      Attachments

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

        Activity

          People

            andysh Andy Shaw
            admin Administrator
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes