Skip to content

Commit 75edd97

Browse files
author
taojin
committed
修改Firebird 批量插入异常问题(BLOB SUB_TYPE TEXT需要参数化命令)。
1 parent 351e33d commit 75edd97

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Providers/FreeSql.Provider.Firebird/FirebirdUtils.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,18 @@ public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams,
8989
if (value == null) return "NULL";
9090
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
9191
if (type == typeof(byte[])) return $"x'{CommonUtils.BytesSqlRaw(value as byte[])}'";
92-
if (type == typeof(string) && col != null && (specialParamFlag == "c" || specialParamFlag == "cu"))
93-
return $"cast('{value.ToString().Replace("'", "''")}' as {col.Attribute.DbType.Replace("NOT NULL", "").Replace("NULL", "")})"; //#1923
92+
if (type == typeof(string))
93+
{
94+
if (col.Attribute.StringLength < 0)
95+
{
96+
var pam = AppendParamter(specialParams, $"p_{specialParams?.Count}{specialParamFlag}", null, type, value);
97+
return pam.ParameterName;
98+
}
99+
else if (col != null && (specialParamFlag == "c" || specialParamFlag == "cu"))
100+
{
101+
return $"cast('{value.ToString().Replace("'", "''")}' as {col.Attribute.DbType.Replace("NOT NULL", "").Replace("NULL", "")})"; //#1923
102+
}
103+
}
94104
return FormatSql("{0}", value, 1);
95105
}
96106
}

0 commit comments

Comments
 (0)