Skip to content

Commit eddc82f

Browse files
committed
Cap current SQLite code for 0.5-0.6 due to serialize changes in Base julia in 0.6. If the package is somehow used in julia 0.6, it will throw an informative SerializeError explaining how to migrate database values to a new julia version
1 parent 5fff174 commit eddc82f

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ os:
88

99
julia:
1010
- 0.5
11-
- nightly
1211

1312
notifications:
1413
email: false

REQUIRE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
julia 0.5
1+
julia 0.5 0.6
22
BinDeps
33
@osx Homebrew
44
@windows WinRPM

appveyor.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ environment:
22
matrix:
33
- JULIAVERSION: "julialang/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
44
- JULIAVERSION: "julialang/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
5-
- JULIAVERSION: "julianightlies/bin/winnt/x86/julia-latest-win32.exe"
6-
- JULIAVERSION: "julianightlies/bin/winnt/x64/julia-latest-win64.exe"
75

86
branches:
97
only:

src/SQLite.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,21 @@ end
163163
# fallback method to bind arbitrary julia `val` to the parameter at index `i` (object is serialized)
164164
bind!(stmt::Stmt,i::Int,val) = bind!(stmt,i,sqlserialize(val))
165165

166+
immutable SerializeError <: Exception
167+
msg::String
168+
end
169+
166170
# magic bytes that indicate that a value is in fact a serialized julia value, instead of just a byte vector
167171
const SERIALIZATION = UInt8[0x11,0x01,0x02,0x0d,0x53,0x65,0x72,0x69,0x61,0x6c,0x69,0x7a,0x61,0x74,0x69,0x6f,0x6e,0x23]
168172
function sqldeserialize(r)
169173
ret = ccall(:memcmp, Int32, (Ptr{UInt8},Ptr{UInt8}, UInt),
170174
SERIALIZATION, r, min(18,length(r)))
171175
if ret == 0
172-
v = deserialize(IOBuffer(r))
176+
try
177+
v = deserialize(IOBuffer(r))
178+
catch e
179+
throw(SerializeError("Error deserializing non-primitive value out of database; this is probably due to using SQLite.jl with a different Julia version than was used to originally serialize the database values. The same Julia version that was used to serialize should be used to extract the database values into a different format (csv file, feather file, etc.) and then loaded back into the sqlite database with the current Julia version."))
180+
end
173181
return v.object
174182
else
175183
return r

0 commit comments

Comments
 (0)