From bfae0c6cef19c219e482ddc935c9d684cf6a6a94 Mon Sep 17 00:00:00 2001 From: mattn Date: Wed, 13 Feb 2013 10:32:40 +0900 Subject: [PATCH] Fixed #37 --- sqlite3.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sqlite3.go b/sqlite3.go index 32ca0495..4d197f1a 100644 --- a/sqlite3.go +++ b/sqlite3.go @@ -179,7 +179,7 @@ func (c *SQLiteConn) Close() error { } rv := C.sqlite3_close(c.db) if rv != C.SQLITE_OK { - return errors.New("sqlite succeeded without returning a database") + return errors.New("error while closing sqlite database connection") } c.db = nil return nil @@ -208,6 +208,9 @@ func (s *SQLiteStmt) Close() error { return nil } s.closed = true + if s.c == nil || s.c.db == nil { + return errors.New("sqlite statement with already closed database connection") + } rv := C.sqlite3_finalize(s.s) if rv != C.SQLITE_OK { return errors.New(C.GoString(C.sqlite3_errmsg(s.c.db)))