Skip to content

Commit 53900fb

Browse files
committed
return nil when last error is SQLITE_OK
1 parent eac1dfa commit 53900fb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sqlite3.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,12 @@ func (c *SQLiteConn) AutoCommit() bool {
400400
}
401401

402402
func (c *SQLiteConn) lastError() Error {
403+
rv := C.sqlite3_errcode(c.db)
404+
if rv == C.SQLITE_OK {
405+
return nil
406+
}
403407
return Error{
404-
Code: ErrNo(C.sqlite3_errcode(c.db)),
408+
Code: ErrNo(rv),
405409
ExtendedCode: ErrNoExtended(C.sqlite3_extended_errcode(c.db)),
406410
err: C.GoString(C.sqlite3_errmsg(c.db)),
407411
}

0 commit comments

Comments
 (0)