Boost logo

Boost :

Subject: Re: [boost] [rdb] 0.04
From: Jean-Louis Leroy (jl_at_[hidden])
Date: 2009-09-21 19:03:19


> struct A{
> bool have_value;
> B b;
>
> void serialize(Ar &ar){
> ar & have_value;
> if(have_value) ar & b;
> }
> };
>
> that's valid serialization code and introduces a new table column at runtime
> if the object is mapped to a rdb and only objects with !have_value have been
> serialized so far.

True, fully static approaches will create the column even if it's never
used.

> how did you plan to represent views generated by a SELECT query? because the
> query results can contain columns from different tables so you'd have to have
> a "dynamic" row type anyway. (unless you tried to deduce the row type from
> the query type?)

Exactly. My `select' construct remembers all the types that were
presented to it. Constructs like views and subselects will be statically
  checked. Errors like using in the `values' clause a column from
another table in an insert statement, or a column from the same table
but of the wrong type are also caught at compile-time. I guess that one
could also make a compile-time assertion that validates an entire schema.

J-L


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