[odb-users] Persisting objects after ID change
Boris Kolpackov
boris at codesynthesis.com
Mon Jan 5 05:41:27 EST 2015
Hi Erez,
Erez Pics <picserez at gmail.com> writes:
> Is there a way to get from any ODB object it's table name
If you are generating query support (--generate-query/-q), then
the table name (as const char* string) can be obtained like this:
odb::object_traits_impl<T, odb::id_sqlite>::table_name
Where T is the object type.
> and it's id field ?
There is no way to get the name of the column corresponding to
the object id. So I suggest that you either use the same data
member name for all your object ids (e.g., id_) and then use
the column name that ODB derives. Or you can assign the column
name explicitly with the 'column' pragma.
Boris
More information about the odb-users
mailing list