mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-02-10 18:30:55 +08:00
fix:修复升级达梦数据库的表结构时由于select中字符串精读问题,而导致字符串截取的问题
This commit is contained in:
@@ -358,6 +358,17 @@ and not exists(select 1 from all_constraints where index_name = a.index_name and
|
||||
if (tbcol.Attribute.DbType.StartsWith(tbstructcol.sqlType, StringComparison.CurrentCultureIgnoreCase) == false)
|
||||
{
|
||||
var dbtypeNoneNotNull = Regex.Replace(tbcol.Attribute.DbType, @"(NOT\s+)?NULL", "");
|
||||
|
||||
var charMatch = Regex.Match(dbtypeNoneNotNull, "(N?)VARCHAR(2?)\\((?<precision>[0-9]+)\\)");
|
||||
|
||||
if(charMatch != null)
|
||||
{
|
||||
if (ushort.TryParse(charMatch.Groups["precision"]?.Value, out var precision))
|
||||
{
|
||||
dbtypeNoneNotNull = Regex.Replace(dbtypeNoneNotNull, $"\\(({precision})\\)", $"");
|
||||
}
|
||||
}
|
||||
|
||||
insertvalue = $"cast({insertvalue} as {dbtypeNoneNotNull})";
|
||||
}
|
||||
if (tbcol.Attribute.IsNullable != tbstructcol.is_nullable)
|
||||
|
||||
Reference in New Issue
Block a user