Skip to content

Commit 376e53c

Browse files
committed
[ga-format-pr] Run ./format_repo.sh to fix formatting
1 parent 9a292fc commit 376e53c

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

sql/expression/convert.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ func convertValue(ctx *sql.Context, val interface{}, castTo string, originType s
340340
return d, nil
341341
case ConvertToDecimal:
342342
dt := createConvertedDecimalType(typeLength, typeScale, false)
343-
343+
344344
// Handle string-to-decimal conversion for mysql_string_to_number mode
345345
if strVal, ok := val.(string); ok && sql.ValidateStringToNumberMode(ctx) {
346346
if convertedVal, _, err := types.Float64.Convert(ctx, strVal); err == nil {
@@ -351,12 +351,12 @@ func convertValue(ctx *sql.Context, val interface{}, castTo string, originType s
351351
return d, nil
352352
}
353353
}
354-
354+
355355
value, err := convertHexBlobToDecimalForNumericContext(val, originType)
356356
if err != nil {
357357
return nil, err
358358
}
359-
359+
360360
d, _, err := dt.Convert(ctx, value)
361361
if err != nil {
362362
return dt.Zero(), nil

sql/types/number.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ const (
100100
numericCutSet = " \t\n\r"
101101
)
102102

103-
104103
type NumberTypeImpl_ struct {
105104
baseType query.Type
106105
displayWidth int
@@ -1008,8 +1007,8 @@ func convertToInt64(ctx context.Context, t NumberTypeImpl_, v interface{}) (int6
10081007
if err == nil {
10091008
return i, sql.InRange, nil
10101009
}
1011-
1012-
// Check if MySQL string-to-number mode is enabled before trying full float parsing
1010+
1011+
// Check if MySQL string-to-number mode is enabled before trying full float parsing
10131012
if sqlCtx, ok := ctx.(*sql.Context); ok && sql.ValidateStringToNumberMode(sqlCtx) {
10141013
// Use MySQL-compatible integer parsing (no scientific notation)
10151014
s := mysqlIntNumre.FindString(originalV)
@@ -1021,7 +1020,7 @@ func convertToInt64(ctx context.Context, t NumberTypeImpl_, v interface{}) (int6
10211020
}
10221021
return 0, sql.InRange, nil
10231022
}
1024-
1023+
10251024
// If that fails, try as a float and truncate it to integral (original behavior)
10261025
f, err := strconv.ParseFloat(v, 64)
10271026
if err != nil {
@@ -1565,13 +1564,13 @@ func convertToFloat64(ctx context.Context, t NumberTypeImpl_, v interface{}) (fl
15651564
// Extract numeric prefix using appropriate regex
15661565
var extractedFloat float64
15671566
var s string
1568-
1567+
15691568
if sqlCtx, ok := ctx.(*sql.Context); ok && sql.ValidateStringToNumberMode(sqlCtx) {
15701569
s = mysqlFloatNumre.FindString(originalV)
15711570
} else {
15721571
s = numre.FindString(originalV)
15731572
}
1574-
1573+
15751574
if s != "" {
15761575
if f, parseErr := strconv.ParseFloat(strings.TrimSpace(s), 64); parseErr == nil {
15771576
extractedFloat = f

0 commit comments

Comments
 (0)