Update Questdb

This commit is contained in:
sunkaixuan 2022-12-17 12:24:11 +08:00
parent 36190f63a6
commit 630b899d96
3 changed files with 71 additions and 1 deletions

View File

@ -0,0 +1,65 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
internal class UInsert3
{
public static void Init()
{
var db = new SqlSugarClient(new ConnectionConfig()
{
ConnectionString = "host=localhost;port=8812;username=admin;password=quest;database=qdb;ServerCompatibilityMode=NoTypeLoading;",
DbType = DbType.QuestDB,
LanguageType = LanguageType.Chinese,
IsAutoCloseConnection = true
});
db.Aop.OnLogExecuted = (s, p) => Console.WriteLine(s);
db.CodeFirst.InitTables<Order1>();
db.Insertable(new Order1() { Name = "a" }).ExecuteReturnSnowflakeId();
db.Insertable(new List<Order1>() {
new Order1() { Name = "a" },
new Order1() { Name = "a" }
}).ExecuteCommand();
db.Insertable(new ORDER1() { Name = "a" }).ExecuteReturnSnowflakeId();
}
public class Order1
{
[SugarColumn(IsPrimaryKey = true )]
public long Id { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string Name { get; set; }
public decimal Price { get; set; }
[SugarColumn(InsertServerTime =true)]
public DateTime CreateTime { get; set; }
[SugarColumn(IsNullable = true)]
public int CustomId { get; set; }
}
[SugarTable("Order1")]
public class ORDER1
{
[SugarColumn(IsPrimaryKey = true )]
public long Id { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string Name { get; set; }
public decimal Price { get; set; }
[SugarColumn(InsertSql = "now()")]
public DateTime CreateTime { get; set; }
[SugarColumn(IsNullable = true)]
public int CustomId { get; set; }
}
}
}

View File

@ -64,6 +64,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Config.cs" />
<Compile Include="Demo\UInsert3.cs" />
<Compile Include="Demo\Unit01.cs" />
<Compile Include="Demo\Demo0_SqlSugarClient.cs" />
<Compile Include="Demo\Demo1_Queryable.cs" />

View File

@ -50,7 +50,7 @@ namespace SqlSugar
//{
// return $"to_timestamp('{it.Value.ObjToString("yyyy-MM-ddTHH:mm:ss")}', 'yyyy-MM-ddTHH:mm:ss')";
//}
return spk;
return GetDbColumn(it,spk);
}
));
@ -77,6 +77,10 @@ namespace SqlSugar
}
batchInsetrSql.Append("\r\n ( " + string.Join(",", columns.Select(it =>
{
if (it.InsertServerTime || it.InsertSql.HasValue())
{
return GetDbColumn(it,null);
}
object value = null;
if (it.Value is DateTime)
{