List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:June 15 2009 4:34pm
Subject:Re: Confused about Blobs and SSQLS ...
View as plain text  
Dan Cook wrote:
> Note the BINARY(8) field can be NULL.

What happens if you ignore that detail for now?  KISS.

>    testDB.binary_data.data.assign(data_str.c_str(), data_str.length());
>    testDB.binary_data.is_null = false;

This is more elegantly -- and perhaps correctly -- expressed:

	testDB.binary_data = sql_blob(dataChar, sizeof(dataChar));

The intermediate std::string isn't of any use.  Further, assigning a 
value to Null<T> always resets the is_null flag, because of course it no 
longer is null.

Notice that this will work whether binary_data is Null<>-wrapped or not. 
  Null<> tries to be fairly transparent.  It doesn't really succeed, but 
where possible...
Thread
Confused about Blobs and SSQLS ...Dan Cook13 Jun
  • Re: Confused about Blobs and SSQLS ...Warren Young16 Jun