return nil when last error is SQLITE_OK

notify
Yasuhiro Matsumoto 2017-03-20 23:23:24 +09:00
parent eac1dfa2a6
commit 53900fb4f0
1 changed files with 5 additions and 1 deletions

View File

@ -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)),
}