aboutsummaryrefslogtreecommitdiff
path: root/sqlite3.go
diff options
context:
space:
mode:
authorYasuhiro Matsumoto <mattn.jp@gmail.com>2017-03-20 23:23:24 +0900
committerYasuhiro Matsumoto <mattn.jp@gmail.com>2017-03-20 23:23:24 +0900
commit53900fb4f0eb34195dad7e0c70315a9cf81dacb8 (patch)
tree0cb912113331f7042abe740695fab6e4892fac22 /sqlite3.go
parentfix test (diff)
downloadgolite-53900fb4f0eb34195dad7e0c70315a9cf81dacb8.tar.gz
golite-53900fb4f0eb34195dad7e0c70315a9cf81dacb8.tar.xz
return nil when last error is SQLITE_OK
Diffstat (limited to 'sqlite3.go')
-rw-r--r--sqlite3.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/sqlite3.go b/sqlite3.go
index f363549..5df6c8b 100644
--- a/sqlite3.go
+++ b/sqlite3.go
@@ -400,8 +400,12 @@ func (c *SQLiteConn) AutoCommit() bool {
}
func (c *SQLiteConn) lastError() Error {
+ rv := C.sqlite3_errcode(c.db)
+ if rv == C.SQLITE_OK {
+ return nil
+ }
return Error{
- Code: ErrNo(C.sqlite3_errcode(c.db)),
+ Code: ErrNo(rv),
ExtendedCode: ErrNoExtended(C.sqlite3_extended_errcode(c.db)),
err: C.GoString(C.sqlite3_errmsg(c.db)),
}