Skip to content

Commit ed7d907

Browse files
committed
This commit attempts to fix #139 by
using an empty string ("") instead of the 0 byte []byte('0') when formatting positive TIME fields.
1 parent 90025ed commit ed7d907

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
@@ -1137,16 +1137,15 @@ func (rows *mysqlRows) readBinaryRow(dest []driver.Value) error {
11371137
}
11381138
}
11391139

1140-
var sign byte
1140+
var sign string
11411141
if data[pos] == 1 {
1142-
sign = byte('-')
1142+
sign = "-"
11431143
}
11441144

11451145
switch num {
11461146
case 8:
11471147
dest[i] = []byte(fmt.Sprintf(
1148-
"%c%02d:%02d:%02d",
1149-
sign,
1148+
sign+"%02d:%02d:%02d",
11501149
uint16(data[pos+1])*24+uint16(data[pos+5]),
11511150
data[pos+6],
11521151
data[pos+7],
@@ -1155,8 +1154,7 @@ func (rows *mysqlRows) readBinaryRow(dest []driver.Value) error {
11551154
continue
11561155
case 12:
11571156
dest[i] = []byte(fmt.Sprintf(
1158-
"%c%02d:%02d:%02d.%06d",
1159-
sign,
1157+
sign+"%02d:%02d:%02d.%06d",
11601158
uint16(data[pos+1])*24+uint16(data[pos+5]),
11611159
data[pos+6],
11621160
data[pos+7],

0 commit comments

Comments
 (0)