mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 04:35:29 +08:00
修复DB2字段类型语法转换问题
This commit is contained in:
parent
501deb47cf
commit
9cff765f8b
File diff suppressed because one or more lines are too long
@ -30,7 +30,7 @@ public class DbHelper
|
||||
/// Database connection string
|
||||
/// 数据库连接字符串
|
||||
/// </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>
|
||||
/// Get a new SqlSugarClient instance with specific configurations
|
||||
|
@ -342,7 +342,8 @@ namespace SqlSugar.DB2
|
||||
public override string ToString(MethodCallExpressionModel model)
|
||||
{
|
||||
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)
|
||||
|
@ -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)
|
||||
{
|
||||
@ -153,7 +134,7 @@ namespace SqlSugar.DB2
|
||||
{
|
||||
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();
|
||||
if (!parameterItems.Any()) return p;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user