From 145753bdb18d6dbfdec8e426be627accaca13fe0 Mon Sep 17 00:00:00 2001
From: sunkaixuan <610262374@qq.com>
Date: Thu, 21 Mar 2024 05:13:39 +0800
Subject: [PATCH] Update questdb
---
.../QuestDbRestAPI.cs | 28 +++++++++++++++----
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/Src/Asp.NetCore2/SqlSugar.QuestDb.RestApi/QuestDbRestAPI.cs b/Src/Asp.NetCore2/SqlSugar.QuestDb.RestApi/QuestDbRestAPI.cs
index 663ac3af2..328d92c9d 100644
--- a/Src/Asp.NetCore2/SqlSugar.QuestDb.RestApi/QuestDbRestAPI.cs
+++ b/Src/Asp.NetCore2/SqlSugar.QuestDb.RestApi/QuestDbRestAPI.cs
@@ -14,14 +14,14 @@ using System.Web;
using System.Xml.Linq;
namespace SqlSugar
-{
+{
///
/// QuestDb RestAPI
///
public class QuestDbRestAPI
{
- internal string url = string.Empty;
- internal string authorization = string.Empty;
+ internal string url = string.Empty;
+ internal string authorization = string.Empty;
internal static Random random = new Random();
ISqlSugarClient db;
public QuestDbRestAPI(ISqlSugarClient db)
@@ -41,7 +41,7 @@ namespace SqlSugar
///
///
///
- public async Task ExecuteCommandAsync(string sql)
+ public async Task ExecuteCommandAsync(string sql)
{
//HTTP GET 执行SQL
var result = string.Empty;
@@ -58,10 +58,26 @@ namespace SqlSugar
///
///
///
- public string ExecuteCommand(string sql)
+ public string ExecuteCommand(string sql)
{
return ExecuteCommandAsync(sql).GetAwaiter().GetResult();
}
+
+ public async Task InsertAsync(T insertData) where T:class,new()
+ {
+ if (db.CurrentConnectionConfig.MoreSettings == null)
+ db.CurrentConnectionConfig.MoreSettings = new ConnMoreSettings();
+ db.CurrentConnectionConfig.MoreSettings.DisableNvarchar = true;
+ var sql= db.Insertable(insertData).ToSqlString();
+ return await ExecuteCommandAsync(sql);
+ }
+
+ public string Insert(T insertData) where T : class, new()
+ {
+ return InsertAsync(insertData).GetAwaiter().GetResult();
+ }
+
+
///
/// 批量快速插入异步
///
@@ -69,7 +85,7 @@ namespace SqlSugar
///
/// 导入时,时间格式 默认:yyyy/M/d H:mm:ss
///
- public async Task BulkCopyAsync(List insertList, string dateFormat = "yyyy/M/d H:mm:ss") where T : class
+ public async Task BulkCopyAsync(List insertList, string dateFormat = "yyyy/M/d H:mm:ss") where T : class
{
if (string.IsNullOrWhiteSpace(url))