Skip to content

Commit 6d7b158

Browse files
committed
Hack around lack of support for sqlite_close_v2
1 parent b058977 commit 6d7b158

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

src/SQLite_api.jl

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,20 +202,30 @@ end
202202
# SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
203203

204204
function sqlite3_close(handle::Ptr{Void})
205-
@windows_only return ccall( (:sqlite3_close, sqlite3_lib), stdcall,
205+
try
206+
@windows_only return ccall( (:sqlite3_close, sqlite3_lib), stdcall,
207+
Cint, (Ptr{Void},),
208+
handle)
209+
@unix_only return ccall( (:sqlite3_close, sqlite3_lib),
206210
Cint, (Ptr{Void},),
207211
handle)
208-
@unix_only return ccall( (:sqlite3_close, sqlite3_lib),
209-
Cint, (Ptr{Void},),
210-
handle)
212+
catch
213+
warn("sqlite3_close not available")
214+
end
211215
end
212216
function sqlite3_close_v2(handle::Ptr{Void})
213-
@windows_only return ccall( (:sqlite3_close_v2, sqlite3_lib), stdcall,
217+
try
218+
@windows_only return ccall( (:sqlite3_close_v2, sqlite3_lib), stdcall,
219+
Cint, (Ptr{Void},),
220+
handle)
221+
@unix_only return ccall( (:sqlite3_close_v2, sqlite3_lib),
214222
Cint, (Ptr{Void},),
215223
handle)
216-
@unix_only return ccall( (:sqlite3_close_v2, sqlite3_lib),
217-
Cint, (Ptr{Void},),
218-
handle)
224+
catch
225+
# Older versions of the library don't have this, abort to other close
226+
warn("sqlite3_close_v2 not available.")
227+
sqlite3_close(handle)
228+
end
219229
end
220230
function sqlite3_initialize()
221231
@windows_only return ccall( (:sqlite3_initialize, sqlite3_lib), stdcall,

0 commit comments

Comments
 (0)