[odb-users] Retrieving Results from Native Queries without Compile-time Fixed Classes

ATSDB atsdb at gmx.at
Mon Feb 3 03:11:19 EST 2020


Dear All,

   I am the main developer of an open-source project (https://github.com/hpuhr/ATSDB/) and I am considering switching to ODB in my database backend.

The short question is: I would like to use native queries to obtain partial data (some columns of many) from existing (unmapped) tables without having
to have compile-time fixed classes to hold the results. Is this possible? Would you recommend using ODB in such a manner?


 From my understanding this is somewhat supported using Views (as stated in the odb manual), but only if I write result classes that store the
selected columns - which is then compile-time fixed. Is my understanding correct?


Background: My applications stores large amounts of data in a database (gigabytes). I wrote a (simplistic) system which allows data abstraction from
the actual database schema based on configuration. During loading, the current schema is used to dynamically create the select queries with not-fixed
number/names of columns, and the result is stored in custom container (basically a dynamic templated aggregations of std::vectors - think array of
structs with dynamic amount of members). To load the complete dataset into RAM is not feasible.

But: In addition to this partial load I would value the use of mapped classes for other (smaller) data.


Would it be possible/reasonable to use mapped classes and additionally directly use the native database connections to retrieve the results to fill my
custom containers?


References I found:

https://www.codesynthesis.com/products/odb/doc/manual.xhtml#3.12

https://www.codesynthesis.com/pipermail/odb-users/2011-September/000306.html


I hope I explained the issue in an understandable manner. Thank you in advance, best regards,

   Helmut Puhr




More information about the odb-users mailing list