Reset statement. Fixes #150

systemlib
mattn 2014-11-16 23:51:46 +09:00
parent d9881e4de3
commit d10e2c8f62
1 changed files with 2 additions and 0 deletions

View File

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