Commit 59e91180 authored by gwenn's avatar gwenn

Misc.

parent ba549b89
...@@ -461,10 +461,13 @@ func (s *Stmt) ExecUpdate(args ...interface{}) (int, error) { ...@@ -461,10 +461,13 @@ func (s *Stmt) ExecUpdate(args ...interface{}) (int, error) {
// Like Exec but returns the autoincremented rowid. // Like Exec but returns the autoincremented rowid.
// Don't use it with SELECT or anything that returns data. // Don't use it with SELECT or anything that returns data.
func (s *Stmt) ExecInsert(args ...interface{}) (int64, error) { func (s *Stmt) ExecInsert(args ...interface{}) (int64, error) {
err := s.Exec(args...) n, err := s.ExecUpdate(args...)
if err != nil { if err != nil {
return -1, err return -1, err
} }
if n == 0 { // No change => no insert...
return -1, nil
}
return s.c.LastInsertRowid(), nil return s.c.LastInsertRowid(), nil
} }
......
...@@ -14,6 +14,7 @@ func open(t *testing.T) *Conn { ...@@ -14,6 +14,7 @@ func open(t *testing.T) *Conn {
if db == nil { if db == nil {
t.Fatal("opened database is nil") t.Fatal("opened database is nil")
} }
//db.Profile(profile, "PROFILE")
return db return db
} }
......
...@@ -20,7 +20,7 @@ func authorizer(d interface{}, action Action, arg1, arg2, dbName, triggerName st ...@@ -20,7 +20,7 @@ func authorizer(d interface{}, action Action, arg1, arg2, dbName, triggerName st
} }
func profile(d interface{}, sql string, nanoseconds uint64) { func profile(d interface{}, sql string, nanoseconds uint64) {
//fmt.Printf("%s: %s = %d\n", d, sql, nanoseconds/1000) //fmt.Printf("%s: %s = %d µs\n", d, sql, nanoseconds/10e3)
} }
func progressHandler(d interface{}) bool { func progressHandler(d interface{}) bool {
......
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