aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattn <mattn.jp@gmail.com>2013-02-13 10:32:40 +0900
committermattn <mattn.jp@gmail.com>2013-02-13 10:32:40 +0900
commitbfae0c6cef19c219e482ddc935c9d684cf6a6a94 (patch)
tree50de427b37016f9c392e6b0bb1b44b2a432e3e58
parentSome older version of sqlite3 does not have SQLITE_OPEN_URI. (diff)
downloadgolite-bfae0c6cef19c219e482ddc935c9d684cf6a6a94.tar.gz
golite-bfae0c6cef19c219e482ddc935c9d684cf6a6a94.tar.xz
Fixed #37
-rw-r--r--sqlite3.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/sqlite3.go b/sqlite3.go
index 32ca049..4d197f1 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)))