- 修复 Oracle CodeFirst nclob cast 转换问题;

This commit is contained in:
2881099
2025-02-17 12:01:00 +08:00
parent 7353bbf96f
commit 8385197bc4
4 changed files with 4 additions and 4 deletions

View File

@@ -354,7 +354,7 @@ and not exists(select 1 from all_constraints where constraint_name = a.index_nam
if (tbcol.Attribute.DbType.StartsWith(tbstructcol.sqlType, StringComparison.CurrentCultureIgnoreCase) == false)
{
var dbtypeNoneNotNull = Regex.Replace(tbcol.Attribute.DbType, @"(NOT\s+)?NULL", "").Trim();
if (dbtypeNoneNotNull != "CLOB" && dbtypeNoneNotNull != "BLOB")
if (dbtypeNoneNotNull != "CLOB" && dbtypeNoneNotNull != "NCLOB" && dbtypeNoneNotNull != "BLOB")
insertvalue = $"cast({insertvalue} as {dbtypeNoneNotNull})";
}
if (tbcol.Attribute.IsNullable != tbstructcol.is_nullable)

View File

@@ -362,7 +362,7 @@ and not exists(select 1 from all_constraints where index_name = a.index_name and
var charMatch = Regex.Match(dbtypeNoneNotNull, "(N?)VARCHAR(2?)\\((?<precision>[0-9]+)\\)");
if (charMatch != null && ushort.TryParse(charMatch.Groups["precision"]?.Value, out var precision))
dbtypeNoneNotNull = Regex.Replace(dbtypeNoneNotNull, $"\\(({precision})\\)", $"");
if (dbtypeNoneNotNull != "CLOB" && dbtypeNoneNotNull != "BLOB")
if (dbtypeNoneNotNull != "CLOB" && dbtypeNoneNotNull != "NCLOB" && dbtypeNoneNotNull != "BLOB")
insertvalue = $"cast({insertvalue} as {dbtypeNoneNotNull})";
}
if (tbcol.Attribute.IsNullable != tbstructcol.is_nullable)

View File

@@ -356,7 +356,7 @@ and not exists(select 1 from all_constraints where constraint_name = a.index_nam
if (tbcol.Attribute.DbType.StartsWith(tbstructcol.sqlType, StringComparison.CurrentCultureIgnoreCase) == false)
{
var dbtypeNoneNotNull = Regex.Replace(tbcol.Attribute.DbType, @"(NOT\s+)?NULL", "").Trim();
if (dbtypeNoneNotNull != "CLOB" && dbtypeNoneNotNull != "BLOB")
if (dbtypeNoneNotNull != "CLOB" && dbtypeNoneNotNull != "NCLOB" && dbtypeNoneNotNull != "BLOB")
insertvalue = $"cast({insertvalue} as {dbtypeNoneNotNull})";
}
if (tbcol.Attribute.IsNullable != tbstructcol.is_nullable)

View File

@@ -391,7 +391,7 @@ and not exists(select 1 from all_constraints where constraint_name = a.index_nam
if (tbcol.Attribute.DbType.StartsWith(tbstructcol.sqlType, StringComparison.CurrentCultureIgnoreCase) == false)
{
var dbtypeNoneNotNull = Regex.Replace(tbcol.Attribute.DbType, @"(NOT\s+)?NULL", "").Trim();
if (dbtypeNoneNotNull != "CLOB" && dbtypeNoneNotNull != "BLOB")
if (dbtypeNoneNotNull != "CLOB" && dbtypeNoneNotNull != "NCLOB" && dbtypeNoneNotNull != "BLOB")
insertvalue = $"cast({insertvalue} as {dbtypeNoneNotNull})";
}
if (tbcol.Attribute.IsNullable != tbstructcol.is_nullable)