Subject: Re: [boost] sqlpp11, 3rd iteration
From: Roland Bock (rbock_at_[hidden])
Date: 2014-08-18 14:23:28
On 2014-08-18 19:58, Adam Wulkiewicz wrote:
> Hi Roland,
> Roland Bock wrote:
>> _NULL handling:_
>> Enabled by the restructured code and spurred by the library quince by
>> Michael Shepanski, sqlpp11 can now calculate which result fields can or
>> cannot be NULL.
>> Speaking of which, handling NULL for result values has been discussed a
>> lot. The library now has compile-time configurable behavior, you can
>> choose between an std::optional-like interface and mapping NULL to the
>> trivial value of the result type, e.g. 0 for numbers or "" for strings,
>> see also https://github.com/rbock/sqlpp11/wiki/NULL
> You wrote in the docs:
> One often discussed alternative would be boost::optional or (in the
> future) std::optional. There is one drawbacks (correct me if I am
> wrong, please):|
> optional| cannot be used for binding result values because it is
> unclear whether there already is a value to bind to.
> What do you mean by that?
> If I understand correctly, you have in mind returning
> boost::optional<> from a function. It's ok to do it, the value is
> stored in optional and deep copies are done if needed.
I was referring to what some sql libraries do, e.g. Mysql's C interface:
They take pointers to some memory and then write result fields to those
memory blocks, see for instance
I don't know if that would be legal to do with the value in optional.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk