Table of Contents
The signature feature of polymorphically mapped types is that application
code doesn't know what their concrete mapper classes are. E.g. code that
stores and retrieves
knows that they're mapped by some class that implements the interface
but it doesn't know which class; and so far, we haven't had much to say
Each backend library has default concrete mapper classes for all of the polymorphically mapped types (see the tables here and here). When we don't say otherwise, quince consults the backend library (whichever one is in charge of the database we are using), and uses its default mapper classes. But we can say otherwise, and sometimes we should say otherwise, because the defaults don't suit every purpose.
For any polymorphically mapped type
T, we can
specify a concrete mapper class to map all instances of
in a particular database, or all instances of
in a particular table.
So there are two steps. First get hold of a concrete mapper class, then deploy it to a database or table.
For the first step, you can define a new concrete mapper class, i.e. your
own subclass of
> that implements all its pure virtuals.
But I'm not going to document that process here, because (a) the most wanted
customizations don't require it, and (b) it would involve a detour into
quince's lower layers that you don't need to see for any other purpose.
The most wanted customizations are for numeric types that the DBMS doesn't
represent directly. E.g. PostgreSQL doesn't have a built-in column type
supplies a default
mapper that uses a 32-bit signed integer, because to me that seemed like
a good idea at the time, but for you it might be no good at all. In that
case you probably want to represent
in a signed 16-bit integer, and there are a few ways to do that, with different
pros and cons.
Quince defines an assortment of concrete mapper classes that are ready to use in cases like this. You just need to understand what they do, make your choice, and deploy it.
On the other hand, if you want to explore and experiment, don't let me
discourage you. Take a look in the quince source code and you will find
many concrete subclasses of
that you can use as examples. And afterwards, when you have your own
mapper, the deployment process is the
same as for predefined mappers.