[odb-users] Feature request
Marcel Nehring
mne at qosmotec.com
Thu Apr 14 05:43:40 EDT 2016
Hi Boris,
this time I have a feature request.
I saw that there are already variables defined holding the name of database tables
odb::access::object_traits_impl< ::MyClass, id_oracle >::table_name
Would it be possible to make them accessible to the user of ODB? In our code I need to lock a database table in some situations. While I can do so by using native SQL queries I currently have to manually provide the table name. If one day the name of the table changes and I forget to change my string I will only discover this at runtime. If I could delegate this work to the ODB compiler that would increase maintainability.
A similar problem arises if I need to manually specify to load only a specific level of a polymorphic object. Currently I use a query condition on the typeid_ member of ODBs query class. But I have to provide the class name manually as string, which is error prone and does not include any compile time checks. If I could write something like
db.query<MyClass>(odb::query<MyClass>::typeid_ == MyClass);
or similar this would avoid possible runtime errors as well.
What do you think?
Regards,
Marcel
More information about the odb-users
mailing list