Update for Go 1.

This commit is contained in:
Mikkel Krautz 2012-02-06 22:16:16 +01:00
parent 4114a83d64
commit e46a65109f
31 changed files with 901 additions and 202 deletions

View file

@ -256,7 +256,7 @@ func (c *Conn) Prepare(cmd string) (*Stmt, error) {
if rv != 0 {
return nil, c.error(rv)
}
return &Stmt{c: c, stmt: stmt, sql: cmd, t0: time.Nanoseconds()}, nil
return &Stmt{c: c, stmt: stmt, sql: cmd, t0: time.Now()}, nil
}
func (s *Stmt) Exec(args ...interface{}) error {
@ -356,13 +356,13 @@ func (s *Stmt) Scan(args ...interface{}) error {
}
*v = x
case *int64:
x, err := strconv.Atoi64(string(data))
x, err := strconv.ParseInt(string(data), 10, 64)
if err != nil {
return errors.New("arg " + strconv.Itoa(i) + " as int64: " + err.Error())
}
*v = x
case *float64:
x, err := strconv.Atof64(string(data))
x, err := strconv.ParseFloat(string(data), 64)
if err != nil {
return errors.New("arg " + strconv.Itoa(i) + " as float64: " + err.Error())
}
@ -379,7 +379,7 @@ func (s *Stmt) SQL() string {
}
func (s *Stmt) Nanoseconds() int64 {
return time.Nanoseconds() - s.t0
return time.Now().Sub(s.t0)
}
func (s *Stmt) Finalize() error {