Boost logo

Boost :

From: Klemens Morgenstern (klemensdavidmorgenstern_at_[hidden])
Date: 2024-11-16 10:51:57


On Sat, Nov 16, 2024 at 5:18 PM Ruben Perez <rubenperez038_at_[hidden]> wrote:
>
> I have some questions for the author:
>
> 1. Many functions are overloaded to accept an error_code and
> error_info, effectively having throwing and non-throwing overloads.
> Have you considered unifying these by using system::result?

I have. error_info contains a string, which allows you to minimizing
reallocation by passing it in by reference.
A result containing an error_info can't do that.

> 2. What compilers and C++ standards are supported by the library? It
> looks like C++14, but docs don't say it.

Yes, 14. Sorry for not mentioning this.

> 3. What's the rationale behind BOOST_SQLITE_NO_VIRTUAL? Wouldn't
> setting it cause trouble, being a compiled library?

It would. The idea is that you can use that for constrained (i.e.
embedded environments) to avoid the unnecessary vtable and to enforce
devirtualization if your compiler misses this.

> 4. I'm interested in the use case of exposing an in-memory data
> structure through a virtual table. I'm looking at multi_index.cpp, the
> Doxygen comments and the official sqlite docs on virtual tables. Is
> there any additional docs on the topic that can help me?

The only effective way I found is to read examples or try the API out,
which is why I provided 5 examples of how to use it.
The sqlite docs themselves are pretty good, it's just a bit
overwhelming at first.

> 5. Docs for field::get_text() state "Returns the value as text, i.e. a
> string_view. Note that this value may be invalidated" - what does this
> mean?

It means the string_view points into the database or the state of a query.
If it's the former it may get invalidated when the DB changes, in case
of the latter it might get invalidated by moving the query to the next
row.

So it means: use it now, before you do anything else.

>
> Thanks,
> Ruben.


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