From b1c2702269a48de185b81d71543fc63eb04fa154 Mon Sep 17 00:00:00 2001
From: d4ilys <963922242@qq.com>
Date: Mon, 18 Sep 2023 09:22:23 +0800
Subject: [PATCH 1/4] =?UTF-8?q?QuestDb=E5=86=99=E5=85=A5CSV=E6=96=87?=
=?UTF-8?q?=E4=BB=B6=E6=9B=B4=E6=94=B9=E4=B8=BA=E5=BC=82=E6=AD=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Providers/FreeSql.Provider.QuestDb/QuestDbGlobalExtensions.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Providers/FreeSql.Provider.QuestDb/QuestDbGlobalExtensions.cs b/Providers/FreeSql.Provider.QuestDb/QuestDbGlobalExtensions.cs
index e2e6191f..c0bc81b7 100644
--- a/Providers/FreeSql.Provider.QuestDb/QuestDbGlobalExtensions.cs
+++ b/Providers/FreeSql.Provider.QuestDb/QuestDbGlobalExtensions.cs
@@ -197,7 +197,7 @@ public static partial class QuestDbGlobalExtensions
using (var writer = new StreamWriter(filePath))
using (var csv = new CsvWriter(writer, CultureInfo.CurrentCulture))
{
- csv.WriteRecords(insert._source);
+ await csv.WriteRecordsAsync(insert._source);
}
var httpContent = new MultipartFormDataContent(boundary);
From e7e09f7ecefe9aa18ca0abe280a73f649dbca32a Mon Sep 17 00:00:00 2001
From: d4ilys <963922242@qq.com>
Date: Mon, 18 Sep 2023 09:25:01 +0800
Subject: [PATCH 2/4] =?UTF-8?q?QuestDbGlobalExtensions=E4=BC=98=E5=8C=96?=
=?UTF-8?q?=E5=91=BD=E5=90=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../QuestDbGlobalExtensions.cs | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/Providers/FreeSql.Provider.QuestDb/QuestDbGlobalExtensions.cs b/Providers/FreeSql.Provider.QuestDb/QuestDbGlobalExtensions.cs
index c0bc81b7..cf4bcfc3 100644
--- a/Providers/FreeSql.Provider.QuestDb/QuestDbGlobalExtensions.cs
+++ b/Providers/FreeSql.Provider.QuestDb/QuestDbGlobalExtensions.cs
@@ -213,7 +213,6 @@ public static partial class QuestDbGlobalExtensions
await client.PostAsync($"{RestAPIExtension.BaseUrl}/imp?name={name}", httpContent);
var readAsStringAsync = await httpResponseMessage.Content.ReadAsStringAsync();
var splitByLine = SplitByLine(readAsStringAsync);
- //Console.WriteLine(readAsStringAsync);
foreach (var s in splitByLine)
{
if (s.Contains("Rows"))
@@ -236,7 +235,10 @@ public static partial class QuestDbGlobalExtensions
{
File.Delete(filePath);
}
- catch { }
+ catch
+ {
+ // ignored
+ }
}
return result;
@@ -246,7 +248,7 @@ public static partial class QuestDbGlobalExtensions
/// 批量快速插入
///
///
- ///
+ ///
///
public static int ExecuteBulkCopy(this IInsert insert) where T : class
{
@@ -340,7 +342,7 @@ static class RestAPIExtension
var base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{username}:{password}"));
authorization = $"Basic {base64}";
}
- //RESTAPI需要无参数
+ //RestApi需要无参数
buider.UseNoneCommandParameter(true);
return buider;
}
From 6e8e2bd4469d8d5bb03f5cb16340ae5b821d7b81 Mon Sep 17 00:00:00 2001
From: d4ilys <963922242@qq.com>
Date: Mon, 18 Sep 2023 09:36:12 +0800
Subject: [PATCH 3/4] =?UTF-8?q?QuestDb=20BulkCopy=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?=E6=97=A5=E6=9C=9F=E6=A0=BC=E5=BC=8F=E5=8C=96=E9=85=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../QuestDbGlobalExtensions.cs | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/Providers/FreeSql.Provider.QuestDb/QuestDbGlobalExtensions.cs b/Providers/FreeSql.Provider.QuestDb/QuestDbGlobalExtensions.cs
index cf4bcfc3..d47197c9 100644
--- a/Providers/FreeSql.Provider.QuestDb/QuestDbGlobalExtensions.cs
+++ b/Providers/FreeSql.Provider.QuestDb/QuestDbGlobalExtensions.cs
@@ -154,8 +154,9 @@ public static partial class QuestDbGlobalExtensions
///
///
///
+ /// 导入时,时间格式 默认:yyyy/M/d H:mm:ss
///
- public static async Task ExecuteBulkCopyAsync(this IInsert that) where T : class
+ public static async Task ExecuteBulkCopyAsync(this IInsert that,string dateFormat = "yyyy/M/d H:mm:ss") where T : class
{
//思路:通过提供的RestAPI imp,实现快速复制
if (string.IsNullOrWhiteSpace(RestAPIExtension.BaseUrl))
@@ -180,7 +181,7 @@ public static partial class QuestDbGlobalExtensions
{
{ "name", d.Name },
{ "type", d.DbTypeText },
- { "pattern", "yyyy/M/d H:mm:ss" }
+ { "pattern", dateFormat}
});
}
else
@@ -249,10 +250,11 @@ public static partial class QuestDbGlobalExtensions
///
///
///
+ /// 导入时,时间格式 默认:yyyy/M/d H:mm:ss
///
- public static int ExecuteBulkCopy(this IInsert insert) where T : class
+ public static int ExecuteBulkCopy(this IInsert insert,string dateFormat = "yyyy/M/d H:mm:ss") where T : class
{
- return ExecuteBulkCopyAsync(insert).ConfigureAwait(false).GetAwaiter().GetResult();
+ return ExecuteBulkCopyAsync(insert,dateFormat).ConfigureAwait(false).GetAwaiter().GetResult();
}
}
From 5b0582483ce666b6b9262c5500aef894742faf3c Mon Sep 17 00:00:00 2001
From: d4ilys <963922242@qq.com>
Date: Fri, 27 Oct 2023 21:08:02 +0800
Subject: [PATCH 4/4] =?UTF-8?q?-=20=E4=BF=AE=E5=A4=8D=20UpdateJoin=20SetIf?=
=?UTF-8?q?=E9=80=BB=E8=BE=91=E5=88=A4=E6=96=AD=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
FreeSql/Internal/CommonProvider/UpdateJoinProvider.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/FreeSql/Internal/CommonProvider/UpdateJoinProvider.cs b/FreeSql/Internal/CommonProvider/UpdateJoinProvider.cs
index c4d51f3a..e7a39022 100644
--- a/FreeSql/Internal/CommonProvider/UpdateJoinProvider.cs
+++ b/FreeSql/Internal/CommonProvider/UpdateJoinProvider.cs
@@ -169,6 +169,7 @@ namespace FreeSql.Internal.CommonProvider
public IUpdateJoin Set(Expression> exp) => SetIf(true, exp);
public IUpdateJoin SetIf(bool condition, Expression> exp)
{
+ if (condition == false) return this;
var body = exp?.Body;
var nodeType = body?.NodeType;
if (nodeType == ExpressionType.Convert)