Skip to content
Open
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
2 changes: 2 additions & 0 deletions bulkcopy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func TestBulkcopy(t *testing.T) {
{"test_date_2", "2015-06-07", time.Date(2015, 6, 7, 0, 0, 0, 0, time.UTC)},
{"test_time", time.Date(2010, 11, 12, 13, 14, 15, 123000000, time.UTC), time.Date(1, 1, 1, 13, 14, 15, 123000000, time.UTC)},
{"test_time_2", "13:14:15.1230000", time.Date(1, 1, 1, 13, 14, 15, 123000000, time.UTC)},
{"test_time_0", "13:14:15", time.Date(1, 1, 1, 13, 14, 15, 0, time.UTC)},
{"test_tinyint", 255, nil},
{"test_smallint", 32767, nil},
{"test_smallintn", nil, nil},
Expand Down Expand Up @@ -256,6 +257,7 @@ func setupTable(ctx context.Context, t *testing.T, conn *sql.Conn, tableName str
[test_date_2] [date] NULL,
[test_time] [time](7) NULL,
[test_time_2] [time](7) NULL,
[test_time_0] [time](0) NULL,
[test_smallmoney] [smallmoney] NULL,
[test_money] [money] NULL,
[test_tinyint] [tinyint] NULL,
Expand Down
4 changes: 3 additions & 1 deletion types.go
Original file line number Diff line number Diff line change
Expand Up @@ -915,8 +915,10 @@ func decodeTime(scale uint8, buf []byte) time.Time {

func encodeTime(hour, minute, second, ns, scale int) (buf []byte) {
seconds := hour*3600 + minute*60 + second
buf = make([]byte, calcTimeSize(scale))
timeSize := calcTimeSize(scale)
buf = make([]byte, timeSize+2)
encodeTimeInt(seconds, ns, scale, buf)
buf = buf[:timeSize]
return
}

Expand Down