Skip to content

Commit deff40b

Browse files
committed
feat: add thousands separator settings
1 parent f56f659 commit deff40b

1 file changed

Lines changed: 11 additions & 19 deletions

File tree

backend/apps/db/db.py

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -881,25 +881,17 @@ def build_fields_info_from_cursor(cursor, origin_column, db_type='postgresql'):
881881
1700, # numeric
882882
)
883883
elif db_type == 'dm':
884-
try:
885-
print(col_info)
886-
SQLBotLogUtil.info('dm:' + str(col_info))
887-
except Exception as ex:
888-
pass
889-
# 达梦数据库类型码
890-
is_numeric = col_info[1] in (
891-
2, # NUMBER
892-
3, # DECIMAL
893-
4, # INTEGER
894-
5, # INT
895-
6, # BIGINT
896-
7, # TINYINT
897-
8, # BYTE
898-
9, # FLOAT
899-
10, # DOUBLE
900-
11, # REAL
901-
12, # BOOLEAN
902-
)
884+
# 达梦数据库类型码 <class 'dmPython.DECIMAL'>
885+
# 获取类型类名
886+
type_name = col_info[1].__name__.upper() if hasattr(col_info[1], '__name__') else str(col_info[1]).upper()
887+
888+
is_numeric = type_name in {
889+
'INT', 'INTEGER',
890+
'BIGINT', 'SMALLINT', 'TINYINT',
891+
'NUMBER', 'NUMERIC', 'DECIMAL',
892+
'FLOAT', 'DOUBLE', 'REAL',
893+
'BIT', 'BOOLEAN',
894+
}
903895
elif db_type == 'hive':
904896
# Hive 类型对象转字符串判断
905897
type_str = str(col_info[1]).lower()

0 commit comments

Comments
 (0)