From: Warren Young Date: October 29 2008 3:08am Subject: Re: Patch for ssqls null blob deficiency List-Archive: http://lists.mysql.com/plusplus/8098 Message-Id: <548C2C11-01A0-4AEF-9BD4-15F8719B0515@etr-usa.com> MIME-Version: 1.0 (Apple Message framework v929.2) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On Oct 27, 2008, at 10:53 PM, Russell Robinson wrote: > I guess you (and/or others) need to tell me whether the changes to > type_info > are correct, but given my reasoning is correct together with the > stepwise > resolution of this problem I think they must be. I still worry that it might overreach, but dtest doesn't complain, soo... > The original patch was flawed in stadapter.cpp. True. > I've found the right way to do this is to convert it using > "stream2string". This is a rather heavy-handed fix. It makes an extra copy of the BLOB, unnecessarily. The real problem is that you were constructing the SQLBuffer with a pointer-to-char, which calls the ctor taking std::string. If you construct a std::string from char*, it only copies up to the first null character; bad ju-ju with BLOBs. There must have been a null character at the fifth byte in your test data. You can fix the bug without the extra buffer copy by using SQLBuffer's other ctor, which takes char* and a length value. svn diff - r2386:2387 to see the fix. I applied your type_info.cpp patch as-is. No problems there, other than my vague worries. Thanks for doing the legwork on this!