Boost logo

Boost :

Subject: Re: [boost] sqlpp11: SQL for C++
From: Rob Stewart (robertstewart_at_[hidden])
Date: 2013-11-12 06:33:40

On Nov 11, 2013, at 10:01 AM, Roland Bock <rbock_at_[hidden]> wrote:

> On 2013-11-11 15:36, Edward Diener wrote:
>> On 11/11/2013 7:53 AM, Roland Bock wrote:
>>> Result rows are currently to be returned from the connector's result object as const char**, see database_api/api.h.
>> You are kidding ? Is std::vector<std::string> too advanced ? Why C++
>> programmers are still using C null-terminated strings I will never understand.
> No kidding. The database client libraries I've used so far are C
> libraries yielding char**. That is why the current connector interface also uses const char**. BTW: These are typically not null-terminated but are delivered with a size_t* or similar to inform about the length...
> But:
> 1. As a user of the library you don't get in touch with those. The members of a row are NOT char*, of course. You get integers as integers, floats as floats and of course you get text as std::string. I wouldn't dare to use char* there ;-)

If the underlying buffer lifetime permits, consider returning boost::string_ref to avoid free store allocations and copying until the user decides they're necessary. (Of course, optimizing at that point may be moot considering the speed of the database layer.)


(Sent from my portable computation engine)

Boost list run by bdawes at, gregod at, cpdaniel at, john at