From db3dd58302a5ec40d32bbcf8829510bc1067ffe0 Mon Sep 17 00:00:00 2001 From: Kenton Date: Fri, 14 Mar 2025 17:34:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DDB2=E6=8F=92=E5=85=A5?= =?UTF-8?q?=E6=97=B6=E6=97=A5=E6=9C=9F=E8=BD=AC=E6=8D=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Src/Asp.NetCore2/SqlSugar.Db2Core/DB2/DbBind/DB2DbBind.cs | 2 +- .../DB2/SqlBuilder/DB2ExpressionContext.cs | 2 +- .../SqlSugar.Db2Core/DB2/SqlBuilder/DB2InsertBuilder.cs | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Src/Asp.NetCore2/SqlSugar.Db2Core/DB2/DbBind/DB2DbBind.cs b/Src/Asp.NetCore2/SqlSugar.Db2Core/DB2/DbBind/DB2DbBind.cs index 81f3a3eb0..937af60ab 100644 --- a/Src/Asp.NetCore2/SqlSugar.Db2Core/DB2/DbBind/DB2DbBind.cs +++ b/Src/Asp.NetCore2/SqlSugar.Db2Core/DB2/DbBind/DB2DbBind.cs @@ -90,9 +90,9 @@ namespace SqlSugar.DB2 new KeyValuePair("char",CSharpDataType.@string), new KeyValuePair("clob",CSharpDataType.@string), + new KeyValuePair("timestamp",CSharpDataType.@DateTime), new KeyValuePair("date",CSharpDataType.@DateTime), new KeyValuePair("time",CSharpDataType.@DateTime), - new KeyValuePair("timestamp",CSharpDataType.@DateTime), new KeyValuePair("integer",CSharpDataType.@int), new KeyValuePair("smallint",CSharpDataType.@short), diff --git a/Src/Asp.NetCore2/SqlSugar.Db2Core/DB2/SqlBuilder/DB2ExpressionContext.cs b/Src/Asp.NetCore2/SqlSugar.Db2Core/DB2/SqlBuilder/DB2ExpressionContext.cs index aee5a209c..66ff0389d 100644 --- a/Src/Asp.NetCore2/SqlSugar.Db2Core/DB2/SqlBuilder/DB2ExpressionContext.cs +++ b/Src/Asp.NetCore2/SqlSugar.Db2Core/DB2/SqlBuilder/DB2ExpressionContext.cs @@ -238,7 +238,7 @@ namespace SqlSugar.DB2 { var parameter = model.Args[0]; var parameter2 = model.Args[1]; - return string.Format(" ({0} like concat('%',{1},'%')) ", parameter.MemberName, parameter2.MemberName ); + return string.Format(" ({0} like concat('%',concat({1},'%'))) ", parameter.MemberName, parameter2.MemberName ); } public override string StartsWith(MethodCallExpressionModel model) diff --git a/Src/Asp.NetCore2/SqlSugar.Db2Core/DB2/SqlBuilder/DB2InsertBuilder.cs b/Src/Asp.NetCore2/SqlSugar.Db2Core/DB2/SqlBuilder/DB2InsertBuilder.cs index 4cd7e080f..5282b0965 100644 --- a/Src/Asp.NetCore2/SqlSugar.Db2Core/DB2/SqlBuilder/DB2InsertBuilder.cs +++ b/Src/Asp.NetCore2/SqlSugar.Db2Core/DB2/SqlBuilder/DB2InsertBuilder.cs @@ -90,7 +90,11 @@ namespace SqlSugar.DB2 object value = null; if (it.Value is DateTime) { - value = ((DateTime)it.Value).ToString("O"); + value = ((DateTime)it.Value).ToString("yyyy-MM-dd HH:mm:ss.fff"); + } + else if (it.Value is Boolean) + { + value = ((Boolean)it.Value) ? 1 : 0; } else if (it.Value is DateTimeOffset) { @@ -179,7 +183,7 @@ namespace SqlSugar.DB2 } public override string FormatDateTimeOffset(object value) { - return "'" + ((DateTimeOffset)value).ToString("o") + "'"; + return "'" + ((DateTimeOffset)value).ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"; } }