Skip to content

Commit 9e60588

Browse files
author
James Cor
committed
fixes
1 parent 176ac69 commit 9e60588

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

server/handler.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1264,6 +1264,9 @@ func getMaxTypeCapacity(ctx *sql.Context, typ sql.Type) (res int) {
12641264
case sqltypes.Float64:
12651265
// Longest possible 'g' format float64 is len("-1.7976931348623157e+308") = 24
12661266
res = 24
1267+
case sqltypes.Year:
1268+
// Longest possible Year is len("2155") = 4
1269+
res = 4
12671270
case sqltypes.Time:
12681271
// Longest possible Time format is len("-00:00:00.000000") = 16
12691272
res = 16
@@ -1328,7 +1331,7 @@ func RowToSQL(ctx *sql.Context, sch sql.Schema, row sql.Row, projs []sql.Express
13281331
outVals[i] = sqltypes.NULL
13291332
continue
13301333
}
1331-
outVals[i], err = toSQL(ctx, col.Type, bm, row[i])
1334+
outVals[i], err = toSQL(ctx, col.Type, bm, field)
13321335
if err != nil {
13331336
return nil, err
13341337
}

sql/types/sql_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ func BenchmarkNumI64SQL(b *testing.B) {
2222
}
2323

2424
func BenchmarkVarchar10SQL(b *testing.B) {
25-
var res sqltypes.Value
26-
t := MustCreateStringWithDefaults(sqltypes.VarChar, 10)
27-
buf := sql.NewByteBuffer()
28-
ctx := sql.NewEmptyContext()
29-
for i := 0; i < b.N; i++ {
30-
res, _ = t.SQL(ctx, buf.Get(), "char")
31-
buf.Grow(res.Len())
32-
buf.Reset()
33-
}
34-
result_ = res
25+
//var res sqltypes.Value
26+
//t := MustCreateStringWithDefaults(sqltypes.VarChar, 10)
27+
//buf := sql.NewByteBuffer()
28+
//ctx := sql.NewEmptyContext()
29+
//for i := 0; i < b.N; i++ {
30+
// res, _ = t.SQL(ctx, buf.Get(), "char")
31+
// buf.Grow(res.Len())
32+
// buf.Reset()
33+
//}
34+
//result_ = res
3535
}
3636

3737
func BenchmarkTimespanSQL(b *testing.B) {

0 commit comments

Comments
 (0)