List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:October 29 2008 3:08am
Subject:Re: Patch for ssqls null blob deficiency
View as plain text  
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!
Thread
Patch for ssqls null blob deficiencyRussell Robinson27 Oct
  • Re: Patch for ssqls null blob deficiencyRussell Robinson27 Oct
  • Re: Patch for ssqls null blob deficiencyWarren Young27 Oct
    • Re: Patch for ssqls null blob deficiencyRussell Robinson27 Oct
      • Re: Patch for ssqls null blob deficiencyWarren Young28 Oct
        • Re: Patch for ssqls null blob deficiencyRussell Robinson28 Oct
        • Re: Patch for ssqls null blob deficiencyRussell Robinson28 Oct
          • Re: Patch for ssqls null blob deficiencyRussell Robinson28 Oct
            • Re: Patch for ssqls null blob deficiencyRussell Robinson28 Oct
              • Re: Patch for ssqls null blob deficiencyWarren Young28 Oct
                • Re: Patch for ssqls null blob deficiencyRussell Robinson28 Oct
                  • Re: Patch for ssqls null blob deficiencyRussell Robinson28 Oct
                    • Re: Patch for ssqls null blob deficiencyWarren Young29 Oct
                      • Re: Patch for ssqls null blob deficiencyRussell Robinson29 Oct
                        • Re: Patch for ssqls null blob deficiencyWarren Young29 Oct
                          • Re: Patch for ssqls null blob deficiencyRussell Robinson29 Oct