From: Warren Young Date: June 30 2008 11:52am Subject: Re: Status of mysqlpp::Null in ssqls List-Archive: http://lists.mysql.com/plusplus/7719 Message-Id: MIME-Version: 1.0 (Apple Message framework v924) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On Jun 30, 2008, at 3:59 AM, Soul Boy wrote: > Should I be able to do this ?: > > mysqlpp::Null nullString; > > Test newRow (nullString, 1); No, you can't, on purpose. If it did compile, it wouldn't work sensibly, for a couple of reasons. If we take your code literally -- as the compiler will -- nullString isn't initialized. Therefore, nullString.data also has no value, so newRow.A will get an undefined value. If we instead assume that nullString *did* get initialized between your two lines of code, your declaration says it could be a SQL null, so you'd again get undefined in newRow.A. It's easy to make the code compile: Test newRow(nullString.data, 1); But this only makes sense if you know in advance that nullString is initialized with something other than SQL null. In that case, I wonder why you are wrapping that data member in template Null to begin with. You *can* do the inverse of what you asked: sql_create_2(Test2, 1, 2, mysqlpp::Null, A, mysqlpp::Null, B) Test2 newRow2(nullString, 1); Conversion this direction works because it never loses data. It's much the same thing as type promotion in C++: you can assign a char to an int and always get sensible results.