[odb-users] Support more then one database vendor in a single application?

Oded Arbel oded at geek.co.il
Tue Aug 28 02:47:31 EDT 2012


On Thu, Aug 23, 2012 at 1:20 PM, Boris Kolpackov
<boris at codesynthesis.com> wrote:
>
> Oded Arbel <oded at geek.co.il> writes:
>
> > I was thinking of writing database agnostic model (with some #ifdefs in
> > the
> > more hairy parts, though for most cases ODB vendor agnostic pragmas are
> > enough), then run the ODB compiler twice to generate two code sets - one
> > for each database vendor, then build two DLLs out of the whole shebang
> > and
> > load either one in the application depending on the runtime
> > configuration.
>
> That will probably work if you don't use queries. The problem with
> queries is that they are a very, very thin layer over the native
> SQL queries (and this is done for good reasons, specifically to
> minimize code bloat and maintain good performance).

The way I'm doing this is to have the model implementation hide all
the queries and expose a business logic API to the rest of the system
(as it is done in MVC). While I expect most queries to be quite
generic (I don't really see how "SELECT * FROM table" is much
different from vendor to vendor), if there is some queries that happen
to be vendor specific I can #ifdef it appropriately. The model
implementation will be packaged with the ODB vendor-specific generated
code into the vendor-specific DLL.

> That's something that we can fix.

I've noticed that ODB code has a lot of LIBODB_EXPORT symbols all over
the place - is thins something I can use to allow VC++ to compile ODB
code into a DLL?

--
Oded



More information about the odb-users mailing list