Unsolved QVariant and COM (ADODB) types conversion
-
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? -
@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 -
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. -
@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 :)
-
@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.