Add support for parsing MySQL unsigned Decimal types. (#2513)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2513
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: dianbanjiu <dianbanjiu@gmail.com>
Co-committed-by: dianbanjiu <dianbanjiu@gmail.com>
This commit is contained in:
dianbanjiu
2026-02-08 01:09:46 +00:00
committed by Lunny Xiao
co-authored by Lunny Xiao
parent e23a7b279a
commit b1ac70c257
2 changed files with 28 additions and 12 deletions
+14 -12
View File
@@ -135,10 +135,11 @@ var (
TimeStampz = "TIMESTAMPZ"
Year = "YEAR"
Decimal = "DECIMAL"
Numeric = "NUMERIC"
Money = "MONEY"
SmallMoney = "SMALLMONEY"
Decimal = "DECIMAL"
UnsignedDecimal = "UNSIGNED DECIMAL"
Numeric = "NUMERIC"
Money = "MONEY"
SmallMoney = "SMALLMONEY"
Real = "REAL"
Float = "FLOAT"
@@ -210,14 +211,15 @@ var (
SmallDateTime: TIME_TYPE,
Year: TIME_TYPE,
Decimal: NUMERIC_TYPE,
Numeric: NUMERIC_TYPE,
Real: NUMERIC_TYPE,
Float: NUMERIC_TYPE,
UnsignedFloat: NUMERIC_TYPE,
Double: NUMERIC_TYPE,
Money: NUMERIC_TYPE,
SmallMoney: NUMERIC_TYPE,
Decimal: NUMERIC_TYPE,
UnsignedDecimal: NUMERIC_TYPE,
Numeric: NUMERIC_TYPE,
Real: NUMERIC_TYPE,
Float: NUMERIC_TYPE,
UnsignedFloat: NUMERIC_TYPE,
Double: NUMERIC_TYPE,
Money: NUMERIC_TYPE,
SmallMoney: NUMERIC_TYPE,
Binary: BLOB_TYPE,
VarBinary: BLOB_TYPE,
+14
View File
@@ -0,0 +1,14 @@
// Copyright 2026 The Xorm Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package schemas
import "testing"
func TestUnsignedDecimalIsNumeric(t *testing.T) {
st := SQLType{Name: UnsignedDecimal}
if !st.IsNumeric() {
t.Fatalf("expected %s to be numeric", UnsignedDecimal)
}
}