Byrial Jensen wrote:
> Well, I think that it could made to work without changing the return
> type of Row::operator[]().
>
> The temporary ColData object returned by that function is constructed
> with a pointer to const char. That pointer could be saved by the
> constructor and later returned by ColData_Tmpl::operator cchar*().
>
> It might even be possible to delay the initialization of
> ColData_Tmpl::buf until it is known if it really is needed. That could
> pontially save memory and time for copying when working with large
> column types like MEDIUMBOB and LONGBLOB.
Possible, but it may be tricky to make it work exactly right. There's a
potential here for misunderstandings of who owns the memory, and how
long it lasts. For instance, is Row::operator[] the only way people get
ColData objects? If not, these semantics will have to work for those
alternate paths as well.
I've put it on the Wishlist. I won't be getting to it any time soon;
you're welcome to tackle it.
>> MySQL++ behaves reaonably in this regard. The question is how we make
>> people understand what the reasonable behavior is. :)
>
> By writing it in the manual ...
Of course. But where, and how? If it's placed in some obscure
location, or not worded clearly, it still doesn't prevent this from
happening in the future. I was hoping to elicit some ideas.