From d10e2c8f62100097910367dee90a9bd89d426a44 Mon Sep 17 00:00:00 2001 From: mattn Date: Sun, 16 Nov 2014 23:51:46 +0900 Subject: [PATCH] Reset statement. Fixes #150 --- sqlite3.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sqlite3.go b/sqlite3.go index de1cc16..d446fb6 100644 --- a/sqlite3.go +++ b/sqlite3.go @@ -430,10 +430,12 @@ func (r *SQLiteResult) RowsAffected() (int64, error) { // Execute the statement with arguments. Return result object. func (s *SQLiteStmt) Exec(args []driver.Value) (driver.Result, error) { if err := s.bind(args); err != nil { + C.sqlite3_reset(s.s) return nil, err } rv := C.sqlite3_step(s.s) if rv != C.SQLITE_ROW && rv != C.SQLITE_OK && rv != C.SQLITE_DONE { + C.sqlite3_reset(s.s) return nil, s.c.lastError() }