File tree 3 files changed +39
-1
lines changed
3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -1084,7 +1084,7 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
1084
1084
if v .IsZero () {
1085
1085
b = append (b , "0000-00-00" ... )
1086
1086
} else {
1087
- b = v .In (mc .cfg .Loc ). AppendFormat ( b , timeFormat )
1087
+ b = appendTimeFormat ( b , v .In (mc .cfg .Loc ), timeFormat )
1088
1088
}
1089
1089
1090
1090
paramValues = appendLengthEncodedInteger (paramValues ,
Original file line number Diff line number Diff line change
1
+ // Go MySQL Driver - A MySQL-Driver for Go's database/sql package
2
+ //
3
+ // Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved.
4
+ //
5
+ // This Source Code Form is subject to the terms of the Mozilla Public
6
+ // License, v. 2.0. If a copy of the MPL was not distributed with this file,
7
+ // You can obtain one at http://mozilla.org/MPL/2.0/.
8
+
9
+ // +build go1.5
10
+
11
+ package mysql
12
+
13
+ import "time"
14
+
15
+ // appendTimeFormat is used as an optimization on Go 1.5+ to avoid the dynamic
16
+ // memory allocation that happens for the string returned by time.Format.
17
+ func appendTimeFormat (b []byte , t time.Time , format string ) []byte {
18
+ return t .AppendFormat (b , format )
19
+ }
Original file line number Diff line number Diff line change
1
+ // Go MySQL Driver - A MySQL-Driver for Go's database/sql package
2
+ //
3
+ // Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved.
4
+ //
5
+ // This Source Code Form is subject to the terms of the Mozilla Public
6
+ // License, v. 2.0. If a copy of the MPL was not distributed with this file,
7
+ // You can obtain one at http://mozilla.org/MPL/2.0/.
8
+
9
+ // +build !go1.5
10
+
11
+ package mysql
12
+
13
+ import "time"
14
+
15
+ // appendTimeFormat is used as an optimization on Go 1.5+ to avoid the dynamic
16
+ // memory allocation that happens for the string returned by time.Format.
17
+ func appendTimeFormat (b []byte , t time.Time , format string ) []byte {
18
+ return append (b , time .Format (format )... )
19
+ }
You can’t perform that action at this time.
0 commit comments