List:MySQL++« Previous MessageNext Message »
From:Brad Hubbard Date:December 3 2008 9:05pm
Subject:Re: Problem with Null string type
View as plain text  
Hi Warren,

Warren Young wrote:
> Brad Hubbard wrote:
>>    mysqlpp::Null<mysqlpp::sql_char>, mobileNumber,
>
> ...snip...
>
>>                mysqlpp::String &mob = it->mobileNumber;
>
> You mean either:
>
>     mysqlpp::Null<mysqlpp::String> &mob = it->mobileNumber;
>
> or:
>
>     mysqlpp::String &mob = it->mobileNumber.data;

But I thought this;

        operator Type&()
        {
                if (is_null)
                        return data = Behavior::null_is();
                else
                        return data;
        }
in null.h must be how you "safely" get the data member. You'll notice in 
my original post I have a line where I access data directly and I 
realise it is public but I thought there must be some type of "accessor" 
method.

>
> Actually, you don't have to use references if you don't want to. 
> mysqlpp::String has reference-counted copies, so they're cheap.
>
> Also, I would use mysqlpp::sql_char here instead of String, just to 
> avoid confusion.
>

So would you mind showing me the recommended way to access the 
underlying string "safely" please?

Thanks for your input,
Brad
Thread
Problem with Null string typeBrad Hubbard3 Dec
  • Re: Problem with Null string typeWarren Young3 Dec
    • Re: Problem with Null string typeBrad Hubbard3 Dec
      • Re: Problem with Null string typeWarren Young3 Dec
        • Re: Problem with Null string typeBrad Hubbard4 Dec
          • Re: Problem with Null string typeBrad Hubbard4 Dec
          • Re: Problem with Null string typeWarren Young4 Dec
            • Re: Problem with Null string typeBrad Hubbard5 Dec
              • Re: Problem with Null string typeWarren Young5 Dec
                • Re: Problem with Null string typeBrad Hubbard6 Dec
Re: Problem with Null string typeWarren Young6 Dec
  • Re: Problem with Null string typeBrad Hubbard6 Dec
    • execute failedbsingh8 Dec
      • Re: execute failedWarren Young8 Dec