Skip to content

Commit f553f33

Browse files
xiamjulienschmidt
authored andcommitted
Fix sign byte for positive TIME fields.
1 parent 3bb13db commit f553f33

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

packets.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,16 +1014,15 @@ func (rows *mysqlRows) readBinaryRow(dest []driver.Value) (err error) {
10141014
}
10151015
}
10161016

1017-
var sign byte
1017+
var sign string
10181018
if data[pos] == 1 {
1019-
sign = byte('-')
1019+
sign = "-"
10201020
}
10211021

10221022
switch num {
10231023
case 8:
10241024
dest[i] = []byte(fmt.Sprintf(
1025-
"%c%02d:%02d:%02d",
1026-
sign,
1025+
sign+"%02d:%02d:%02d",
10271026
uint16(data[pos+1])*24+uint16(data[pos+5]),
10281027
data[pos+6],
10291028
data[pos+7],
@@ -1032,8 +1031,7 @@ func (rows *mysqlRows) readBinaryRow(dest []driver.Value) (err error) {
10321031
continue
10331032
case 12:
10341033
dest[i] = []byte(fmt.Sprintf(
1035-
"%c%02d:%02d:%02d.%06d",
1036-
sign,
1034+
sign+"%02d:%02d:%02d.%06d",
10371035
uint16(data[pos+1])*24+uint16(data[pos+5]),
10381036
data[pos+6],
10391037
data[pos+7],

0 commit comments

Comments
 (0)