List:MySQL++« Previous MessageNext Message »
From:Byrial Jensen Date:May 26 2005 4:53am
Subject:Re: Can you have more than one active mysqlpp::Connection object?
View as plain text  
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
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