Boost logo

Boost :

From: Brock Peabody (brock.peabody_at_[hidden])
Date: 2006-04-17 12:54:37


> On Behalf Of Jeff Garland

> It's been awhile since I looked, but is there anything
> there
> that could be used to forward a combined proposal?

Sorry to reply to this message twice, but I finished looking through the
SOCI documentation. It looks really good. I thought I'd show a sample
of my serialization DSEL just for contrast:

  struct job { int type, double rate };

  struct employee {
   
    int id,
    string name
 
    vector<job> jobs;
  };

  serializer<employee> emp_serializer =
     
    table("employee")[
       
         //'*' means key field
       *field("id") = &employee::id,

       field("name") = &employee::name,

       table("job") [

            //'-' means dependent field
          -field("employee"),
          field("type") = &job::type,
          field("rate") = &job::rate
       ]
       = &employee::jobs
    ];

  vector<employee> emps
    = s.load<vector<employee> >(database, "SELECT * FROM employee");

  ....

  s.save(database, emps);

This small example shows how to serialize two simple structures where
one is contained by the other.

I don't know if that looks attractive to anyone but I thought it might
spark some discussion at least.


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