Skip to content

Commit 04866ee

Browse files
committed
Fix nits pointed in pull request.
1 parent 6c8484b commit 04866ee

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Diff for: connection.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func (mc *mysqlConn) escapeBytes(v []byte) string {
176176
return "'" + string(escape(v)) + "'"
177177
}
178178

179-
func (mc *mysqlConn) buildQuery(query string, args []driver.Value) (string, error) {
179+
func (mc *mysqlConn) interpolateParams(query string, args []driver.Value) (string, error) {
180180
chunks := strings.Split(query, "?")
181181
if len(chunks) != len(args)+1 {
182182
return "", driver.ErrSkip
@@ -196,7 +196,7 @@ func (mc *mysqlConn) buildQuery(query string, args []driver.Value) (string, erro
196196
case int64:
197197
parts[pos] = strconv.FormatInt(v, 10)
198198
case float64:
199-
parts[pos] = strconv.FormatFloat(v, 'f', -1, 64)
199+
parts[pos] = strconv.FormatFloat(v, 'g', -1, 64)
200200
case bool:
201201
if v {
202202
parts[pos] = "1"
@@ -242,7 +242,7 @@ func (mc *mysqlConn) Exec(query string, args []driver.Value) (driver.Result, err
242242
return nil, driver.ErrSkip
243243
}
244244
// try client-side prepare to reduce roundtrip
245-
prepared, err := mc.buildQuery(query, args)
245+
prepared, err := mc.interpolateParams(query, args)
246246
if err != nil {
247247
return nil, err
248248
}
@@ -293,7 +293,7 @@ func (mc *mysqlConn) Query(query string, args []driver.Value) (driver.Rows, erro
293293
return nil, driver.ErrSkip
294294
}
295295
// try client-side prepare to reduce roundtrip
296-
prepared, err := mc.buildQuery(query, args)
296+
prepared, err := mc.interpolateParams(query, args)
297297
if err != nil {
298298
return nil, err
299299
}

Diff for: const.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ type statusFlag uint16
138138
const (
139139
statusInTrans statusFlag = 1 << iota
140140
statusInAutocommit
141-
statusUnknown1
141+
statusReserved // Not in documentation
142142
statusMoreResultsExists
143143
statusNoGoodIndexUsed
144144
statusNoIndexUsed

0 commit comments

Comments
 (0)