From 53900fb4f0eb34195dad7e0c70315a9cf81dacb8 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Mon, 20 Mar 2017 23:23:24 +0900 Subject: [PATCH] return nil when last error is SQLITE_OK --- sqlite3.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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)), }