Skip to content

Conversation

Sean1708
Copy link
Contributor

Fixes #50.

The idea's fairly simply; Vector{UInt8}s get stored directly into BLOBS, any other object gets wrapped in a Serialization object, serialized then stored as a BLOB. When they're deserialized the Array gets returned unchanged unless the deserialized value is a Serialization in which case the object which the Serialization holds gets returned.

Obviously the array could happen to match a Serialization even when if hasn't been serialized but I think this is such an unlikely corner case that it shouldn't matter too much.

Any object that is serialized is now put in a Serialization type then
serialized.

When sqldeserialize is called on a bytearray, it checks whether the
deserialized array is a Serialization and if so returns the object it holds,
otherwise returning the array.
sqlreturn(::Any, ::Vector{UInt8}) was serializing values so any values passed to
sqlreturn(::Any, ::Any) were being serialized twice. The net result of this
being that they were returned as bytearrays.
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling f5b4876 on iss50 into * on master*.

quinnj added a commit that referenced this pull request Nov 18, 2014
Allow bytearrays to be stored as BLOBs
@quinnj quinnj merged commit ebc7ac7 into master Nov 18, 2014
@quinnj
Copy link
Member

quinnj commented Nov 18, 2014

This looks great. I'm merging now so I can play with it locally.

@quinnj
Copy link
Member

quinnj commented Nov 18, 2014

Ok, check out my latest commit 42e6598 and see what you think. I think the performance hit of a try-catch would be pretty bad inside of the sqldeserialize function. I mention a potential mess of doing memcmp for Serialization objects, but I think we should be pretty safe and can add the checks I mentioned. This method should be almost as fast as it was before.

I also added some commits to help things pass on 0.3 release, though I didn't actually do any testing.

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.

Don't serialize values by default.
3 participants