List:MySQL++« Previous MessageNext Message »
From:Brad Hubbard Date:December 6 2008 12:14pm
Subject:Re: Problem with Null string type
View as plain text  

Warren Young wrote:
> The NullIsBlank and NullIsZero behaviors cause MySQL++ to pretend SQL 
> NULL isn't a unique value, causing it to silently convert to either a 
> blank string or integer 0, respectively.  These behaviors are useful 
> in cases where you can't get rid of the NULL attribute on the column, 
> or NULL just doesn't have meaning in a certain context but does have 
> meaning in others.  If your application has no special use for NULL 
> and you can change the DB, change the DB.

Thank you for the excellent explanation and sage advice, i understand 
the situation much better now.

>
>>> something_that_requires_a_c_string = 
>>> sql_char(it->mobileNumber).c_str();
>>>
>>> You need the explicit conversion in there because C++ won't 
>>> implicitly do two casts in a row.
>> Understand, would I be better off using 
>> static_cast<sql_char>(it->mobileNumber).c_str() ?
>
> Only substitute static_cast for (this_type)of_cast, never for 
> this_type(of_conversion).  The latter isn't actually a cast at all. 

Of course it isn't I'm afraid I misread this.

Many thanks Warren.

Kind regards,
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