Subject: Re: [boost] sqlpp11, 3rd iteration
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2014-08-18 13:58:59
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,
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.