Boost logo

Boost :

Subject: Re: [boost] [rdb] 0.04
From: Stefan Strasser (strasser_at_[hidden])
Date: 2009-09-21 13:18:06


Am Monday 21 September 2009 17:13:34 schrieb Joshua Pedrick:

> namespace springfield {
> BOOST_RDB_BEGIN_TABLE(person)
> BOOST_RDB_COLUMN(id, integer, (constraint::primary_key))
> BOOST_RDB_COLUMN(name, varchar<20>, (constraint::not_null))
> BOOST_RDB_COLUMN(first_name, varchar<30>, (constraint::none))
> BOOST_RDB_COLUMN(age, integer, (constraint::none))
> BOOST_RDB_COLUMN(married, boolean, (constraint::not_null,
> constraint::default(false)))
> BOOST_RDB_END_TABLE(person)
>
> BOOST_RDB_BEGIN_TABLE(partner)
> BOOST_RDB_COLUMN(husband, integer, (constraint::not_null))
> BOOST_RDB_COLUMN(wife, integer, (constraint::not_null))
> BOOST_RDB_FOREIGN_KEY(husband, person::id)
> BOOST_RDB_FOREIGN_KEY(wife, person::id)
> BOOST_RDB_END_TABLE(partner)
> }

I only had a short look at your rdb code so far, as most of it is SQL syntax
sugar and although that looks good that's not the most interesting part of a
boost db layer for me.

if you plan to develop this until a boost review please also consider an
interface that allows you to dynamically define tables.
your table definitions seem to rely on the static c++ type system right now,
using mpl and fusion. an object relational mapper based on
boost.serialization needs to be able to create tables on demand and also
insert columns on demand, as a serialize() function can omit fields.
I was planning to include a proof-of-concept object-relational-mapper in my
object persistence library, using SQLite.
eventually this should be based upon a boost database layer like rdb, but it
seems a little early on to use it already. but please keep me updated on any
progress, as I don't know yet when I get around to implementing the
relational-mapper. some other internal stuff that is hardcoded to an own
storage engine right now has to be made generic first.

do you know dtemplatelib?
http://dtemplatelib.sourceforge.net/

it may not be applicable in all cases but the idea of representing a db table
as a STL container seems interesting.


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