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

Oded Arbel oded at geek.co.il
Wed Aug 29 11:17:59 EDT 2012


Hi Boris.

On Tue, Aug 28, 2012 at 3:22 PM, Boris Kolpackov
<boris at codesynthesis.com> wrote:
>
> Oded Arbel <oded at geek.co.il> writes:
>> 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 [...]
>
> Yes, that will work. In other words, your "model implementation" will
> wrap the ODB functionality which will not be exposed from the DLL.

It will not expose any ODB functionality through the business logic API, but...

> Note that if you use the above approach, you don't need to export any
> ODB-generated code from the DLL. The only thing that you should export
> is the business logic API.

I still want to expose the model classes themselves, so that the
application can say things like:
vector<Employee> employees = Employee::getAll();
for (vector<Employee>::iterator it = employees.begin(); it !=
employees.end(); ++it)
  it->employer->processSalary(*it);

Where Employee and Employer are the model classes used in ODB, and
getAll() and processSalary() are business logic methods on these
classes.

I don't want to have the application compile against ODB headers
because that causes VC++ to freak out. It should work fine - unless I
use ODB datatypes like odb::nullable, which I need to represent my
model correctly, and at which point application code start seeing
libodb headers and I get export warnings.
-- 
Oded



More information about the odb-users mailing list