Boost logo

Boost :

Subject: Re: [boost] [rdb] 0.04
From: Joshua Pedrick (joshua.pedrick_at_[hidden])
Date: 2009-09-21 11:13:34


I also happened to start casually working on this problem about a month ago
without knowing anyone else was working on a similar solution. :) Curses!
For the most part, I like Jean-Louis's solution better than my own, except
that I think columns need to support column-constraints i.e. primary key,
not null, unique, etc. Also, I'm thinking there will be a need for foreign
keys to be defined.

Maybe defining a table would look something like the following:

Where the column macro is as such:
#define BOOST_RDB_COLUMN(NAME, sql_type, constraint_list)

And two new classes are defined: constraint and constraint_list and the
comma operator is overloaded to allow constraints to be chained into a
constraint list.

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)
  }

Regards,
     -Joshua Pedrick

On Sun, Sep 20, 2009 at 7:46 PM, Jean-Louis Leroy <jl_at_[hidden]> wrote:

> I have uploaded a new version of my relational database library to the
> vault. It implements the ideas I described in another thread. This time it
> even puts things in a real (odbc) database and retrieves them.
>
> I see that 12 have downloaded the previous versions. If you have time
> please send me feedback. Have you been able to compile it ? Has anybody
> tried on Unix or with other compilers ?
>
> Please note:
> * It's a work in progress ; for the curious only.
> * I develop on Windows with Visual Studio Express 2008. There is a solution
> file in the msvc dir. Nothing bjam works yet.
> * Currently the doc is the test suite
>
> Jean-Louis Leroy
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>

-- 
-- יהושע

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