Chris Frey wrote:
> On Sun, May 29, 2005 at 07:28:16PM +0200, Byrial Jensen wrote:
>
>>Hi,
>>
>>When a Row object is constructed, it will copy all data of the fetched
>>row of type MYSQL_ROW to a vector of std::string. That seems to me as
>>unnecessary use of time and memory. The row data is only accessed
>>through pointers to const char:
>
>
> Something to remember is that Row objects are stored in containers
> when using SSQLS, as far as I can tell, so this would create a hidden
> dependency on the Result object: all Row object data would disappear if
> their lifetimes exceeded the lifetime of the corresponding Result.
>
> i.e. The Result destructor calls mysql_free_result() via Result::purge().
You have a good point. However the functions Row::parent(), Row::size(),
Row::operator bool(), Row::operator[]() and Row::lookup_by_name() are
already now dependent on the parent Result object - it gives undefined
behavour to use these functions after the destruction of the Result.
The only useful member function left which now can be used without the
parent is Row::raw_data().
If the lifetime of a Row object really is expected to be able to extend
the lifetime of the parent Result object, I would suggest a rewrite to
remove the current dependencies.
Best regards,
Byrial