Warren Young wrote:
> Byrial Jensen wrote:
>
>> I don't know if it is considered a bug that you cannot write
>>
>> const char *text = row[1];
>
>
> The bug is in the construct, not in MySQL++. To make that work in
> MySQL++, we'd have to return a pointer (or reference) to a static
> object, and that opens up a whole new class of risks.
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.
> 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 ...
Best regards
Byrial