Skip to content

Conversation

@elliotfiske
Copy link

No description provided.

@ccgus
Copy link
Owner

ccgus commented Aug 29, 2016

Hello @elliotfiske - can you make a unit test that shows the crash in action?

@elliotfiske
Copy link
Author

elliotfiske commented Aug 30, 2016

updated! Let me know if you have any questions/I need to adjust something.

@ccgus
Copy link
Owner

ccgus commented Aug 30, 2016

In your first patch, you have it setting the value to null, and then in another one you have it set to [NSString stringWithCString:values[i] encoding:NSASCIIStringEncoding].

Falling back on NSASCIIStringEncoding is a bad idea in my opinion, because we don't do that anywhere else, and UTF-8 is the way to go anyway.

Any reason why you changed it from NSNull?

@elliotfiske
Copy link
Author

I changed it from NSNull because there is actually data there, it's just not encodable to a UTF-8 string.

I'm actually thinking it might make more sense to return NSData now, do you think that would make more sense?

@ccgus
Copy link
Owner

ccgus commented Aug 30, 2016

I think putting anything other than NSString at this point would be a bad idea, because that could break applications today. However, for 3.0 it would make sense to look at the sqlite type being returned, and then massage the data to that.

So for now, it should probably be NSNull (which is what FMDB does elsewhere, so it's consistent at least)

@elliotfiske
Copy link
Author

I think for now we should keep the noisy crash instead of silently returning Null for BLOB data, and push off the problem off to 3.0, especially since I realize now we might return bad data – if the binary data has a 0-byte, it'll truncate it because it's a C-style string.

@ccgus ccgus added this to the 3.0 milestone Sep 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants