@@ -518,14 +518,14 @@ func ConvertToBytes(ctx context.Context, v interface{}, t sql.StringType, dest [
518518func getColumnContext (ctx context.Context ) (string , int64 ) {
519519 colName := "<unknown>"
520520 rowNum := int64 (0 )
521-
521+
522522 if name , ok := ctx .Value (ColumnNameKey ).(string ); ok {
523523 colName = name
524524 }
525525 if num , ok := ctx .Value (RowNumberKey ).(int64 ); ok {
526526 rowNum = num
527527 }
528-
528+
529529 return colName , rowNum
530530}
531531
@@ -546,7 +546,7 @@ func formatInvalidByteForError(bytesVal []byte) string {
546546 }
547547 }
548548
549- // If no invalid bytes found, but we're here due to invalid UTF-8,
549+ // If no invalid bytes found, but we're here due to invalid UTF-8,
550550 // show the first byte (this handles edge cases)
551551 if firstInvalidPos == - 1 {
552552 return fmt .Sprintf (invalidByteFormat , bytesVal [0 ])
@@ -556,13 +556,13 @@ func formatInvalidByteForError(bytesVal []byte) string {
556556 var result strings2.Builder
557557 maxBytesToShow := 6 // MySQL seems to show around 6 bytes before truncating
558558 remainingBytes := bytesVal [firstInvalidPos :]
559-
559+
560560 for i , b := range remainingBytes {
561561 if i >= maxBytesToShow {
562562 result .WriteString ("..." )
563563 break
564564 }
565-
565+
566566 // MySQL shows valid ASCII characters as their actual characters,
567567 // but invalid UTF-8 bytes (> 127) or control characters as hex
568568 if b >= 32 && b <= 126 {
@@ -577,7 +577,6 @@ func formatInvalidByteForError(bytesVal []byte) string {
577577 return result .String ()
578578}
579579
580-
581580// convertToLongTextString safely converts a value to string using LongText.Convert with nil checking
582581func convertToLongTextString (ctx context.Context , val interface {}) (string , error ) {
583582 converted , _ , err := LongText .Convert (ctx , val )
0 commit comments