Skip to content

Touch up the driver code in a couple of places #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func BenchmarkQuery(b *testing.B) {
var wg sync.WaitGroup
wg.Add(concurrencyLevel)
defer wg.Wait()
b.ResetTimer()
b.StartTimer()

for i := 0; i < concurrencyLevel; i++ {
Expand Down Expand Up @@ -117,6 +118,7 @@ func BenchmarkExec(b *testing.B) {
var wg sync.WaitGroup
wg.Add(concurrencyLevel)
defer wg.Wait()
b.ResetTimer()
b.StartTimer()

for i := 0; i < concurrencyLevel; i++ {
Expand Down Expand Up @@ -232,8 +234,9 @@ func BenchmarkInterpolation(b *testing.B) {
time.Unix(1423411542, 807015000),
[]byte("bytes containing special chars ' \" \a \x00"),
"string containing special chars ' \" \a \x00",
uint64(math.MaxUint64),
}
q := "SELECT ?, ?, ?, ?, ?, ?"
q := "SELECT ?, ?, ?, ?, ?, ?, ?"

b.ReportAllocs()
b.ResetTimer()
Expand Down
2 changes: 2 additions & 0 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ func (mc *mysqlConn) interpolateParams(query string, args []driver.Value) (strin
buf = escapeStringQuotes(buf, v)
}
buf = append(buf, '\'')
case uint64:
buf = strconv.AppendUint(buf, v, 10)
default:
return "", driver.ErrSkip
}
Expand Down
3 changes: 2 additions & 1 deletion statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"database/sql/driver"
"fmt"
"reflect"
"strconv"
)

type mysqlStmt struct {
Expand Down Expand Up @@ -139,7 +140,7 @@ func (converter) ConvertValue(v interface{}) (driver.Value, error) {
case reflect.Uint64:
u64 := rv.Uint()
if u64 >= 1<<63 {
return fmt.Sprintf("%d", u64), nil
return strconv.FormatUint(u64, 10), nil
}
return int64(u64), nil
case reflect.Float32, reflect.Float64:
Expand Down