|
Boost : |
Subject: Re: [boost] Request for Interest in several Modules
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2012-01-12 04:20:33
Den 12-01-2012 08:43, Roland Bock skrev:
> On 01/11/2012 07:31 PM, Thorsten Ottosen wrote:
>> Maybe we can get 90% of it by something as simple as
>>
>> class Users
>> {
>> BOOST_DECLARE_SQL_CLASS( "USERS" );
>>
>> BOOST_SQL_VAR( int, "column_age", age );
>> BOOST_SQL_VAR( std::string, "column_role", role );
>> ...
>> };
>>
>>
>> -Thorsten
>
> Probably yes, but based on our current code generator I'd say it would
> be quite a lot of macro code, which I find hard to debug.
Well, I don't see why it has to be that way. We can maybe avoid macros a
little by doing
class Users
{
BOOST_DECLARE_SQL_CLASS( "USERS" );
BOOST_DECLARE_SQL_COLUMNS( "column_age", age, "column_role", role );
boost::sql::variable<int> age;
boost::sql::nullable_variable<std::string> role;
...
};
AFAICT, the only thing you have to debug is mismatch in the column/table
names. But that should be easy to detect at run-time, thus
easy to catch in unit-tests.
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk