How to get the c++ type of a column?

Forum for posting problems using QxOrm library

How to get the c++ type of a column?

Postby she » Thu May 24, 2018 3:34 pm

Hello,
Is there a way to get the c++ type of a column? I can get the sql type via IxDataMember, but I'd like to get the c++ type, eg. QVariant, QDataTime, etc
Thanks
she
 
Posts: 1
Joined: Thu Jun 01, 2017 7:01 am

Re: How to get the c++ type of a column?

Postby qxorm » Fri May 25, 2018 3:42 pm

Hello,

There is this template function which can help to get the C++ type : qx::QxClassName<T>::get()
This is used for example by QxDump and QxSerialization.

But I think you would like get it by introspection through qx::IxDataMember interface, am I right ?
If yes, sorry it doesn't exist for now.
I will try to add it using qx::QxClassName<T>::get() in QxDataMember<T> class, it should not be complicated.
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am

Re: How to get the c++ type of a column?

Postby qxorm » Wed Jun 06, 2018 3:27 pm

Hello,

Here is a version which adds a getType() method in qx::IxDataMember interface (introspection engine) : https://www.qxorm.com/version/QxOrm_1.4.5_BETA_17.zip
So now you can get the C++ type dynamically for each property of a registered class.

Here is the changes log of this version :
- Fix an issue in qx::IxSqlQueryBuilder class when QxOrm library is used in a multi-thread environment
- Support latest version of boost (1.66)
- Update boost portable binary serialization classes to version 5.1 (provided by https://archive.codeplex.com/?p=epa)
- Fix an issue building SQL query for Oracle database (doesn't support AS keyword for table alias)
- Improve qx::QxClassX::registerAllClasses() function : possibility to initialize all relations (useful to work with introspection engine)
- Improve qx::IxPersistable interface : provide new methods toJson() / fromJson()
- Improve documentation/website : change http://www.qxorm.com by https://www.qxorm.com everywhere
- Fix fetching relations with soft delete putting SQL condition in the JOIN part instead of WHERE part
- Fix SQL generator for Oracle database : use new limit/pagination syntax (version Oracle > 12.1)
- Improve SQL generator interface : add 'onBeforeSqlPrepare()' method to modify/log SQL queries in custom classes
- Add an option in qx::QxSqlDatabase class to format SQL query (pretty-printing) before logging it (can be customized creating a qx::dao::detail::IxSqlGenerator sub-class)
- Fix an issue with boost/std::optional (to manage NULL database values) and some databases : if optional is empty, then create a NULL QVariant based on QVariant::Type
- Add an option in qx::QxSqlDatabase class to insert square brackets (or any other delimiters) in SQL queries for table name and/or column name (to support specific database keywords)
- Improve introspection engine : add getType() method in qx::IxDataMember interface to get C++ type of a property dynamically
qxorm
Site Admin
 
Posts: 481
Joined: Mon Apr 12, 2010 7:45 am


Return to QxOrm - Help

Who is online

Users browsing this forum: No registered users and 1 guest

cron