This commit is contained in:
sunkaixuan 2025-05-30 17:00:54 +08:00
commit 6312496d0e
4 changed files with 33 additions and 24 deletions

File diff suppressed because one or more lines are too long

View File

@ -30,7 +30,7 @@ public class DbHelper
/// Database connection string /// Database connection string
/// 数据库连接字符串 /// 数据库连接字符串
/// </summary> /// </summary>
public readonly static string Connection = "server=127.0.0.1:50000;database=Test;uid=db2inst1;pwd=123456;currentSchema=db2inst1;"; public readonly static string Connection = "server=127.0.0.1:50000;database=Test;uid=db2inst1;pwd=123456;currentSchema=db2inst1;";
/// <summary> /// <summary>
/// Get a new SqlSugarClient instance with specific configurations /// Get a new SqlSugarClient instance with specific configurations

View File

@ -342,7 +342,8 @@ namespace SqlSugar.DB2
public override string ToString(MethodCallExpressionModel model) public override string ToString(MethodCallExpressionModel model)
{ {
var parameter = model.Args[0]; var parameter = model.Args[0];
return string.Format(" CAST({0} AS VARCHAR)", parameter.MemberName); var valueLength = parameter.MemberValue.IsNullOrEmpty() ? 1 : parameter.MemberValue?.ToString().Length;
return string.Format($" CAST({{0}} AS VARCHAR({valueLength}))", parameter.MemberName);
} }
public override string ToGuid(MethodCallExpressionModel model) public override string ToGuid(MethodCallExpressionModel model)

View File

@ -47,25 +47,6 @@ namespace SqlSugar.DB2
} }
} }
//public override string GetWhereValueString
//{
// get
// {
// return base.GetWhereValueString.Replace("\"", "".ToUpper()); ;
// }
//}
//public override string GetJoinValueString
//{
// get
// {
// if (this.JoinQueryInfos.IsNullOrEmpty()) return null;
// else
// {
// return string.Join(UtilConstants.Space, this.JoinQueryInfos.Select(it => this.ToJoinString(it).Replace("\"", "").ToUpper()));
// }
// }
//}
public override bool IsComplexModel(string sql) public override bool IsComplexModel(string sql)
{ {
@ -153,7 +134,7 @@ namespace SqlSugar.DB2
{ {
var selectParams = selectSql.Split(",").Select(p => var selectParams = selectSql.Split(",").Select(p =>
{ {
if (!Regex.IsMatch(p, constRegex)) return p; if (!Regex.IsMatch(p.ToLower(), constRegex)) return p;
var parameterItems = this.Parameters.Where(t => p.Contains(t.ParameterName)).ToList(); var parameterItems = this.Parameters.Where(t => p.Contains(t.ParameterName)).ToList();
if (!parameterItems.Any()) return p; if (!parameterItems.Any()) return p;