Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QVariant and COM (ADODB) types conversion
Forum Updated to NodeBB v4.3 + New Features

QVariant and COM (ADODB) types conversion

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    taedium
    wrote on 21 Jul 2017, 08:08 last edited by taedium
    #1

    Hello!
    I am developing an application that reads data from database (namely Oracle and MS Access) and splits it into a set of .xslx files.
    Currently I am working with Access using ADODB (connection string: "DRIVER={Microsoft Access Driver (*.mdb, *.accdb)}; FIL={MS Access}; DBQ=%1", .cpp and .h generated by dumpcpp) and I am having hard times reading Decimal column data. Problem is when I try to get its value by recordset->Fields()->Item(i)->Value() it's a runtime error because Q_ASSERT(qax_result.isValid()) inside Field::Value() fails (the same goes when i try to read a NULL field regardless of its type). When I try to get it by recordset->Collect(i) or by recordset->GetRows() it gives me an invalid QVariant. At the same time Double fields don't expose this behaviour.
    I noticed there is the same problem with NUMBER(10) column when querying Oracle DB using OraOLEDB.Oracle provider.
    So seems like no conversion from Decimal type to QVariant exists. Why is that and how can i fix/circumvent this?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 21 Jul 2017, 08:18 last edited by
      #2

      @taedium said in QVariant and COM (ADODB) types conversion:

      QVariant

      Hi
      Is the actual type (in db ) one of these ?
      http://doc.qt.io/qt-5/sql-types.html

      1 Reply Last reply
      0
      • T Offline
        T Offline
        taedium
        wrote on 21 Jul 2017, 08:38 last edited by
        #3

        Well, here we can see that

        Decimal Use for numeric values that range from -9.999... x 1027 to 9.999... x 1027. Storage requirement is 12 bytes.

        i don't see anything like that listed among Qt ODBC data types. There is NUMBER for Oracle though.
        But i don't think this is relevant. Doesn't this consideration apply when you work with DB using built-in Qt classes (QtSql module)? While i'm utilizing OLE/ADO approach.

        M 1 Reply Last reply 21 Jul 2017, 08:48
        0
        • T taedium
          21 Jul 2017, 08:38

          Well, here we can see that

          Decimal Use for numeric values that range from -9.999... x 1027 to 9.999... x 1027. Storage requirement is 12 bytes.

          i don't see anything like that listed among Qt ODBC data types. There is NUMBER for Oracle though.
          But i don't think this is relevant. Doesn't this consideration apply when you work with DB using built-in Qt classes (QtSql module)? While i'm utilizing OLE/ADO approach.

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 21 Jul 2017, 08:48 last edited by
          #4

          @taedium
          Yes should only apply when using the SQL classes like
          query etc.

          You are using "raw" calls via ole?
          (via the dumpcpp tool)

          Sorry its out of my zone.

          I wonder if you could modify the dumpcpp output to work but not
          not really sure where the convert really fails.

          Hopefully others have some ideas :)

          1 Reply Last reply
          0
          • T Offline
            T Offline
            taedium
            wrote on 21 Jul 2017, 12:13 last edited by
            #5

            @mrjj said in QVariant and COM (ADODB) types conversion:

            You are using "raw" calls via ole?
            (via the dumpcpp tool)

            Yes, exactly. There is a possibility to omit dumpcpp wrapper classes and to work with COM in "Win-32" style, but i do not feel like delving into that at the moment :)

            @mrjj said in QVariant and COM (ADODB) types conversion:

            I wonder if you could modify the dumpcpp output to work but not
            not really sure where the convert really fails.

            I tried looking into \Src\qtactiveqt\src\activeqt\shared\qaxtypes.cpp but there are obviously no functions which cover ADO internal types, only QVariant VARIANTToQVariant(). May be it is inside adodb.cpp generated by dumpcpp, but i am not familiar enough with moc internals.

            1 Reply Last reply
            0

            1/5

            21 Jul 2017, 08:08

            • Login

            • Login or register to search.
            1 out of 5
            • First post
              1/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved