🐛 fix(data-grid): 兼容 bit 十六进制值大小写

- 让 bit 十六进制字面量匹配不区分大小写
- 避免大写十六进制值回退为带引号字符串
- 增加 0X0F 复制 INSERT 回归验证
This commit is contained in:
Syngnat
2026-08-03 10:51:19 +08:00
parent 573df673b1
commit 3652756b2c
2 changed files with 3 additions and 3 deletions

View File

@@ -86,7 +86,7 @@ describe('buildCopyInsertSQL', () => {
record: {
disabled: 0,
enabled: 1,
mask: '0x05',
mask: '0X0F',
note: '1',
},
columnTypesByLowerName: {
@@ -97,7 +97,7 @@ describe('buildCopyInsertSQL', () => {
},
});
expect(sql).toBe("INSERT INTO `flags` (`disabled`, `enabled`, `mask`, `note`) VALUES (0, 1, 5, '1');");
expect(sql).toBe("INSERT INTO `flags` (`disabled`, `enabled`, `mask`, `note`) VALUES (0, 1, 15, '1');");
});
it('normalizes MySQL bit binary and decimal text values', () => {

View File

@@ -250,7 +250,7 @@ const formatMySQLBitLiteral = (value: any): string | null => {
if (/^0[bB][01]+$/.test(raw)) {
numericText = raw.slice(2);
radix = 2;
} else if (/^0[xX][0-9a-f]+$/.test(raw)) {
} else if (/^0x[0-9a-f]+$/i.test(raw)) {
numericText = raw.slice(2);
radix = 16;
} else if (!/^\d+$/.test(raw)) {