Boost logo

Boost :

Subject: Re: [boost] sqlpp11, 3rd iteration
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2014-08-18 16:43:21


Roland Bock wrote:
> 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
> http://dev.mysql.com/doc/refman/5.7/en/mysql-stmt-bind-result.html
>
> I don't know if that would be legal to do with the value in optional.
If some object containing value (corresponding to the data stored in DB)
is created at some point, it may be stored in optional.

I'm guessing that the problem exists because select is lazily executed.
C++ objects corresponding to the data aren't created (e.g. std::string,
int, float, etc.). Instead some pointers to buffers are kept (in
sqlpp::result_field_t?). And C++ objects are created and returned later
from value() method or conversion operators each time one of them is
called. Is that right?

But AFAIU if the C++ objects were created along with the representation
of a row, the results could be stored as optionals. Or am I missing
something?

I saw that there are optional-like wrappers of values, e.g. sqlpp::text.
They're close to optionals since they're storing a value and some flag.
What are they used for?

Are you using tabs? The code doesn't seem to look right on GitHub.

Regards,
Adam


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