Skip to content

Commit 72971b3

Browse files
aviksquinnj
authored andcommitted
remove zero arg errmsg function. Fix errorhandling on DB loading. Fix #158. Fix #146 (#159)
1 parent bb72611 commit 72971b3

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/SQLite.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ include("api.jl")
1818
# Normal constructor from filename
1919
sqliteopen(file, handle) = sqlite3_open(file, handle)
2020
sqliteopen(file::UTF16String, handle) = sqlite3_open16(file, handle)
21-
sqliteerror() = throw(SQLiteException(unsafe_string(sqlite3_errmsg())))
21+
#sqliteerror() = throw(SQLiteException(unsafe_string(sqlite3_errmsg())))
2222
sqliteerror(db) = throw(SQLiteException(unsafe_string(sqlite3_errmsg(db.handle))))
2323

2424
"""
@@ -42,8 +42,9 @@ mutable struct DB
4242
finalizer(_close, db)
4343
return db
4444
else # error
45-
sqlite3_close(handle[])
46-
sqliteerror()
45+
db = new(f, handle[], 0)
46+
finalizer(_close, db)
47+
sqliteerror(db)
4748
end
4849
end
4950
end

test/runtests.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,7 @@ end
262262
@test r[2][4] == p2
263263
############################################
264264

265-
include("deprecated.jl")
265+
#test for #158
266+
@test_throws SQLite.SQLiteException SQLite.DB("nonexistentdir/not_there.db")
267+
268+
include("deprecated.jl")

0 commit comments

Comments
 (0)