Boost logo

Boost :

Subject: Re: [boost] SQL: next iteration of sqlpp11
From: Roland Bock (rbock_at_[hidden])
Date: 2014-02-04 14:26:08


On 2014-02-03 17:54, Dominique Devienne wrote:
> On Mon, Feb 3, 2014 at 5:32 PM, Roland Bock <rbock_at_[hidden]> wrote:
>
>> On 2014-02-03 17:21, Alexander Lamaison wrote:
>>> Roland Bock <rbock_at_[hidden]> writes:
>>>> // Then you run the insert
>>>> db.run(i);
>>> Just a thought: why not `operator()` instead of `run`, making the db a
>>> callable?
>
>> In addition to .run() there is also .prepare() which prepares a
>> statement for later and possibly repeated execution possibly with
>> parameters. The arguments for .run() and .prepare() are the same.
>>
>> Tim Keitt suggested .execute() instead of run(), which would certainly
>> be an option, but is much longer than .run() :-)
>>
> Execute or exec for short is more idiomatic in the DB world, I concur.
.exec() is nice, but I think that Alexander has a point with operator()
being idiomatic in the C++ world :-)
>
> When iterating the result set, SQLite uses step() while OCI uses fetch().
sqlpp11 is using .front() and .pop() if you want to go through a result
set step by step. Otherwise there is the wonderful for-loop, of course:

for (const auto& row : result) {...}

C++ developers should feel right at home with that, I guess.

Regards,

Roland


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