Skip to content

Commit ab9a790

Browse files
committed
[ga-format-pr] Run ./format_repo.sh to fix formatting
1 parent 80d2221 commit ab9a790

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

enginetest/queries/charset_validation_queries.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type QueryErrorTest struct {
5252
ExpectedErrStr string
5353
}
5454

55-
// CharsetValidationScriptTest represents comprehensive charset validation scenarios
55+
// CharsetValidationScriptTest represents comprehensive charset validation scenarios
5656
var CharsetValidationScriptTest = ScriptTest{
5757
Name: "Charset validation behavior for issue #8893",
5858
SetUpScript: []string{
@@ -88,4 +88,4 @@ var CharsetValidationScriptTest = ScriptTest{
8888
Expected: []sql.Row{{1, []byte{0x44, 0x6F, 0x6C, 0x74, 0x4C, 0x61, 0x62, 0xC2, 0xAE}}},
8989
},
9090
},
91-
}
91+
}

sql/rowexec/insert.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ func toInt64(x interface{}) int64 {
484484
}
485485

486486
// extractInvalidByteFromError extracts the invalid byte sequence from a charset error message
487-
// Error format: "Incorrect string value: '\xAE' for column '' at row 1"
487+
// Error format: "Incorrect string value: '\xAE' for column at row 1"
488488
func extractInvalidByteFromError(errMsg string) string {
489489
start := strings.Index(errMsg, "'")
490490
if start == -1 {

sql/types/strings_charset_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,22 @@ func TestCharsetValidationInsertion(t *testing.T) {
3838
})
3939

4040
t.Run("Invalid UTF-8 insertion should fail with MySQL-compatible error", func(t *testing.T) {
41-
// Invalid UTF-8 byte sequence: [68 111 108 116 76 97 98 174]
41+
// Invalid UTF-8 byte sequence: [68 111 108 116 76 97 98 174]
4242
// This represents "DoltLab" followed by 0xAE (latin1 ® character)
4343
invalidUTF8 := []byte{0x44, 0x6F, 0x6C, 0x74, 0x4C, 0x61, 0x62, 0xAE}
44-
44+
4545
_, _, err := stringType.Convert(ctx, invalidUTF8)
4646
require.Error(t, err)
4747
require.True(t, ErrBadCharsetString.Is(err))
48-
48+
4949
// Check error message format matches MySQL: "Incorrect string value: '\xAE' for column '' at row 1"
5050
expectedErrorSubstring := "Incorrect string value: '\\xAE'"
5151
require.Contains(t, err.Error(), expectedErrorSubstring)
5252
})
5353

5454
t.Run("Empty invalid UTF-8 should fail gracefully", func(t *testing.T) {
5555
invalidUTF8 := []byte{0xFF, 0xFE} // Invalid UTF-8 start bytes
56-
56+
5757
_, _, err := stringType.Convert(ctx, invalidUTF8)
5858
require.Error(t, err)
5959
require.True(t, ErrBadCharsetString.Is(err))
@@ -70,7 +70,7 @@ func TestCharsetValidationQuerying(t *testing.T) {
7070
// This simulates data that was already stored with invalid UTF-8
7171
// MySQL allows querying such data, even if it contains invalid bytes
7272
validUTF8 := "DoltLab®" // This is valid UTF-8
73-
73+
7474
// Test SQL() method (used during query results)
7575
result, err := stringType.SQL(ctx, nil, validUTF8)
7676
require.NoError(t, err)
@@ -81,7 +81,7 @@ func TestCharsetValidationQuerying(t *testing.T) {
8181
// Test that the SQL() method no longer validates charset
8282
// This allows querying existing invalid data for cleanup
8383
validData := "TestData"
84-
84+
8585
result, err := stringType.SQL(ctx, nil, validData)
8686
require.NoError(t, err)
8787
require.Equal(t, validData, string(result.Raw()))
@@ -92,7 +92,7 @@ func TestCharsetErrorMessageFormat(t *testing.T) {
9292
// Test that our error message format matches MySQL exactly
9393
// MySQL: "Incorrect string value: '\xAE' for column 'name' at row 1"
9494
// Our format: "Incorrect string value: '%v' for column '%s' at row %d"
95-
95+
9696
testCases := []struct {
9797
name string
9898
invalidByte string
@@ -129,4 +129,4 @@ func TestCharsetErrorMessageFormat(t *testing.T) {
129129
require.Equal(t, tc.expectedFormat, err.Error())
130130
})
131131
}
132-
}
132+
}

0 commit comments

Comments
 (0)