Polymorphically mapped types are C++ types that can have different concrete
mapper clases --and hence different column representations-- to suit different
circumstances. E.g. a C++ bool
has one mapper class that represents it as an SQL boolean
for PostgreSQL, and another that represents it as an SQL integer
for sqlite; and an application can give it still more mapper classes, to
represent it in customized ways on a per-database
or per-table basis.
All bool's concrete mapper
classes are supplied by the backend libraries and (possibly) by application
code; not by quince itself. That is the case for:
bool
float and double
std::string
std::vector<uint8_t>
boost::posix_time::ptime
Quince does, however, provide a concrete mapper class for serial. Future backends might provide
their own, but quince_postgresql and quince_sqlite have no need to do so.
The backend-supplied concrete mapper classes will be detailed in later sections, as will the means for application code to supply concrete mapper classes.
In general, if PM is a polymorphically mapped
type, then application code does not have access to its concrete mapper
classes. It treats PM's mapper objects polymorphically,
via the interface abstract_mapper<PM>. Examples:
query<PM>::operator->() is const
abstract_mapper<PM> *.
C is some class with a member C::pm of type
PM, then the type of class_mapper<C>::pm
is const abstract_mapper<PM> &.