Boost logo

Boost :

From: Steve Hutton (shutton_at_[hidden])
Date: 2006-10-07 14:10:32


On 2006-10-06, Nicola Musatti <Nicola.Musatti_at_[hidden]> wrote:
> Steve Hutton <shutton <at> featurecomplete.com> writes:
> [...]
>> I think it would be good practice to keep both queries and their related
>> TypeConversions in the same header file. But of course even this isn't
>> enough to ensure queries don't break - the database itself can always
>> change But using select * is another precaution that gives some
>> added protection from database changes.
>
> This is the reason why it's important that libraries such as SOCI provide a
> dynamic interface to query composition and navigable, explicitly
> meta-represented result sets.

Indeed, SOCI supports dynamic querying, i.e. where column names are
unknown at compile time:
http://soci.sourceforge.net/doc/exchange.html#dynamic

> Those who want (or, rather, can afford) type safety should build it above the
> dynamic interface.

Well SOCI lets you do that if you really want to, but it supports static
binding directly...

> For them code generation is an effective solution, especially
> considering that parsing SQL DDL (as opposed to C++ class definitions) is rather
> easy.

Parsing DDL shouldn't be necessary for end users.
SOCI::ColumnProperties provides basic access to column meta data,
and (most?) db backends allow (db-specific) retrival of more detailed
meta data via sql itself.

Steve


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk