Commit c7b3ac8f authored by gwenn's avatar gwenn

Add ExecUpdate like in JDBC API.

parent 041796b7
......@@ -384,6 +384,14 @@ func (s *Stmt) Exec(args ...interface{}) os.Error {
return nil
}
func (s *Stmt) ExecUpdate(args ...interface{}) (int, os.Error) {
err := s.Exec(args...)
if err != nil {
return -1, err
}
return s.c.Changes(), nil
}
// Calls http://sqlite.org/c3ref/bind_parameter_count.html
func (s *Stmt) BindParameterCount() int {
return int(C.sqlite3_bind_parameter_count(s.stmt))
......
......@@ -200,11 +200,10 @@ func TestInsertWithStatement(t *testing.T) {
db.Begin()
for i := 0; i < 1000; i++ {
ierr := s.Exec(float64(i)*float64(3.14), i, "hello")
c, ierr := s.ExecUpdate(float64(i)*float64(3.14), i, "hello")
if ierr != nil {
t.Fatalf("insert error: %s", ierr)
}
c := db.Changes()
if c != 1 {
t.Errorf("insert error: %d <> 1", c)
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment