Skip to content

Commit d975b7b

Browse files
committed
Tidying up
1 parent bc70daf commit d975b7b

File tree

2 files changed

+9
-19
lines changed

2 files changed

+9
-19
lines changed

sql/types/strings.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ func (t StringType) MaxTextResponseByteLength(ctx *sql.Context) uint32 {
227227
// since the max bytes field in a column definition response over the wire is a uint32 and multiplying
228228
// longTextBlobMax by anything over 1 would cause it to overflow.
229229
if t.baseType == sqltypes.Text && t.maxByteLength != LongTextBlobMax {
230-
// TODO: What happens if character_set_results is set to NULL?
231230
characterSetResults := ctx.GetCharacterSetResults()
232231
charsetMaxLength := uint32(characterSetResults.MaxLength())
233232
return uint32(t.maxByteLength) * charsetMaxLength

sql/types/strings_test.go

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -216,28 +216,19 @@ func TestStringCreateString(t *testing.T) {
216216
10, false},
217217

218218
// Out of bounds error cases
219-
{sqltypes.Binary, charBinaryMax + 1, sql.Collation_binary, StringType{},
220-
0, true},
221-
{sqltypes.Blob, LongTextBlobMax + 1, sql.Collation_binary, StringType{},
222-
0, true},
223-
{sqltypes.Char, charBinaryMax + 1, sql.Collation_Default, StringType{},
224-
0, true},
225-
{sqltypes.Text, LongTextBlobMax + 1, sql.Collation_Default, StringType{},
226-
0, true},
219+
{sqltypes.Binary, charBinaryMax + 1, sql.Collation_binary, StringType{}, 0, true},
220+
{sqltypes.Blob, LongTextBlobMax + 1, sql.Collation_binary, StringType{}, 0, true},
221+
{sqltypes.Char, charBinaryMax + 1, sql.Collation_Default, StringType{}, 0, true},
222+
{sqltypes.Text, LongTextBlobMax + 1, sql.Collation_Default, StringType{}, 0, true},
227223

228224
// JSON strings can also come in over the wire as VARBINARY types, and JSON allows a much larger length limit (1GB).
229-
{sqltypes.VarBinary, MaxJsonFieldByteLength + 1, sql.Collation_binary, StringType{},
230-
0, true},
231-
{sqltypes.VarChar, varcharVarbinaryMax + 1, sql.Collation_Default, StringType{},
232-
0, true},
225+
{sqltypes.VarBinary, MaxJsonFieldByteLength + 1, sql.Collation_binary, StringType{}, 0, true},
226+
{sqltypes.VarChar, varcharVarbinaryMax + 1, sql.Collation_Default, StringType{}, 0, true},
233227

234228
// Default collation is not valid for these types
235-
{sqltypes.Binary, 10, sql.Collation_Default, StringType{},
236-
0, true},
237-
{sqltypes.Blob, 10, sql.Collation_Default, StringType{},
238-
0, true},
239-
{sqltypes.VarBinary, 10, sql.Collation_Default, StringType{},
240-
0, true},
229+
{sqltypes.Binary, 10, sql.Collation_Default, StringType{}, 0, true},
230+
{sqltypes.Blob, 10, sql.Collation_Default, StringType{}, 0, true},
231+
{sqltypes.VarBinary, 10, sql.Collation_Default, StringType{}, 0, true},
241232
}
242233

243234
ctx := sql.NewContext(

0 commit comments

Comments
 (0)