List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:May 26 2005 5:13am
Subject:Re: Can you have more than one active mysqlpp::Connection object?
View as plain text  
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.
Thread
Can you have more than one active mysqlpp::Connection object?Byrial Jensen24 May
  • Re: Can you have more than one active mysqlpp::Connection object?Earl Miles24 May
  • Re: Can you have more than one active mysqlpp::Connection object?Warren Young24 May
    • Re: Can you have more than one active mysqlpp::Connection object?Byrial Jensen25 May
      • Re: Can you have more than one active mysqlpp::Connection object?Earl Miles25 May
        • Re: Can you have more than one active mysqlpp::Connection object?Chris Frey25 May
          • Re: Can you have more than one active mysqlpp::Connection object?Chris Frey25 May
            • Re: Can you have more than one active mysqlpp::Connection object?Earl Miles25 May
          • Re: Can you have more than one active mysqlpp::Connection object?Byrial Jensen25 May
            • Re: Can you have more than one active mysqlpp::Connection object?Warren Young26 May
              • Re: Can you have more than one active mysqlpp::Connection object?Byrial Jensen26 May
                • Re: Can you have more than one active mysqlpp::Connection object?Warren Young26 May