Update 人大金仓 demo

This commit is contained in:
sunkaixuan 2024-07-10 21:15:51 +08:00
parent 3a805c7f39
commit 14d1e87ca9
38 changed files with 140 additions and 53 deletions

View File

@ -2,7 +2,7 @@
<package >
<metadata>
<id>SqlSugarCore.Kdbndp</id>
<version>9.3.6.412</version>
<version>9.3.6.618</version>
<authors>sunkaixuan</authors>
<owners>果糖大数据科技</owners>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>

View File

@ -6,7 +6,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SqlSugarCore.Kdbndp" Version="9.3.6.412" />
<PackageReference Include="SqlSugarCore.Kdbndp" Version="9.3.6.618" />
</ItemGroup>
<ItemGroup>

View File

@ -1,4 +1,6 @@
using SqlSugar;
using Kdbndp;
using KdbndpTypes;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data;

View File

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OrmTest;
namespace KdbndpTest.OracleDemo
{
internal class OracleDemo
{
public static void Init()
{
Demo0_SqlSugarClient.Init();
Demo1_Queryable.Init();
Demo2_Updateable.Init();
Demo3_Insertable.Init();
Demo4_Deleteable.Init();
Demo5_SqlQueryable.Init();
Demo6_Queue.Init();
Demo7_Ado.Init();
Demo8_Saveable.Init();
Demo9_EntityMain.Init();
DemoA_DbMain.Init();
DemoB_Aop.Init();
DemoC_GobalFilter.Init();
DemoD_DbFirst.Init(); ;
DemoE_CodeFirst.Init();
DemoF_Utilities.Init();
DemoG_SimpleClient.Init();
}
}
}

View File

@ -1,4 +1,5 @@
using SqlSugar;
using KdbndpTest.OracleDemo.UnitTest;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using KdbndpTest.OracleDemo.UnitTest;
namespace OrmTest
{

View File

@ -1,4 +1,5 @@
using SqlSugar;
using OrmTest;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
@ -7,7 +8,7 @@ using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
namespace KdbndpTest.OracleDemo.UnitTest
{
internal class UInsert3
{
@ -71,7 +72,7 @@ namespace OrmTest
/// </summary>
public string Name { get; set; }
public decimal Price { get; set; }
[SugarColumn(InsertServerTime =true,UpdateServerTime =true)]
[SugarColumn(InsertServerTime = true, UpdateServerTime = true)]
public DateTime CreateTime { get; set; }
[SugarColumn(IsNullable = true)]
public int CustomId { get; set; }
@ -86,7 +87,7 @@ namespace OrmTest
/// </summary>
public string Name { get; set; }
public decimal Price { get; set; }
[SugarColumn(InsertSql = "'2020-1-1'",UpdateSql = "'2022-1-1'")]
[SugarColumn(InsertSql = "'2020-1-1'", UpdateSql = "'2022-1-1'")]
public DateTime CreateTime { get; set; }
[SugarColumn(IsNullable = true)]
public int CustomId { get; set; }

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using KdbndpTest.OracleDemo.UnitTest;
namespace OrmTest
{

View File

@ -1,4 +1,5 @@
using SqlSugar;
using KdbndpTest.OracleDemo.UnitTest;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using KdbndpTest.OracleDemo.UnitTest;
using SqlSugar;
namespace OrmTest
{

View File

@ -4,13 +4,13 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
namespace KdbndpTest.OracleDemo.UnitTest
{
public class UValidate
{
public static void Check(object a, object b, object name)
{
if (a?.ToString()?.Replace(" ","").Trim().ToLower() != b?.ToString().Replace(" ", "")?.Trim().ToLower())
if (a?.ToString()?.Replace(" ", "").Trim().ToLower() != b?.ToString().Replace(" ", "")?.Trim().ToLower())
{
throw new Exception(name + " error");
}

View File

@ -1,11 +1,12 @@
using SqlSugar;
using OrmTest;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
namespace KdbndpTest.OracleDemo.UnitTest
{
internal class UnitDateTime
{
@ -20,8 +21,9 @@ namespace OrmTest
ConnectionString = Config.ConnectionString.Replace("59321", "59322"),
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
MoreSettings=new ConnMoreSettings() {
DatabaseModel=DbType.MySql
MoreSettings = new ConnMoreSettings()
{
DatabaseModel = DbType.MySql
},
AopEvents = new AopEvents
{
@ -33,10 +35,10 @@ namespace OrmTest
}
});
var dt=db.Ado.GetDataTable("show database_mode;");
var dt = db.Ado.GetDataTable("show database_mode;");
var now = DateTime.Now;
var insertObj = new UnitOrderDateTest() { Id = 1, Name = "0",CreateTime= now };
var insertObj = new UnitOrderDateTest() { Id = 1, Name = "0", CreateTime = now };
var insertObj2 = new List<UnitOrderDateTest>
{
new UnitOrderDateTest() { Id = 11, Name = "1ms",CreateTime=now.AddMilliseconds(1) },
@ -52,7 +54,7 @@ namespace OrmTest
var beginTime = now.AddMinutes(-2);
var endTime = now.AddHours(1).AddMinutes(2);
var list=db.Queryable<UnitOrderDateTest>().Where(it => it.CreateTime >= beginTime
var list = db.Queryable<UnitOrderDateTest>().Where(it => it.CreateTime >= beginTime
&& it.CreateTime <= endTime)
.ToList();
@ -60,7 +62,7 @@ namespace OrmTest
&& it.CreateTime <= endTime)
.ToSqlString();
var list2=db.Ado.SqlQuery<UnitOrderDateTest>(sql);
var list2 = db.Ado.SqlQuery<UnitOrderDateTest>(sql);
if (list.Count() != 5 || list2.Count() != 5)

View File

@ -1,14 +1,15 @@
using SqlSugar;
using OrmTest;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
namespace KdbndpTest.OracleDemo.UnitTest
{
internal class UnitSplitTask
{
public static void Init()
public static void Init()
{
var client = NewUnitTest.Db;
Console.WriteLine("Hello, World!");
@ -19,14 +20,15 @@ namespace OrmTest
CreateTask(client.CopyNew())
};
Task.WhenAll(tasks).GetAwaiter().GetResult();
Task.WhenAll(tasks).GetAwaiter().GetResult();
client.Deleteable(new SpitDemoModel()).SplitTable().ExecuteCommand();
}
private static Task CreateTask(ISqlSugarClient client)
{
return Task.Run(() => {
return Task.Run(() =>
{
client.Insertable(new SpitDemoModel()).SplitTable().ExecuteCommand();
});
}

View File

@ -1,4 +1,5 @@
using SqlSugar;
using KdbndpTest.OracleDemo.UnitTest;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -1,4 +1,6 @@
using System;
using KdbndpTest.OracleDemo;
using KdbndpTest.SqlServerDemo;
using System;
namespace OrmTest
{
@ -6,24 +8,12 @@ namespace OrmTest
{
static void Main(string[] args)
{
//Demo
Demo0_SqlSugarClient.Init();
Demo1_Queryable.Init();
Demo2_Updateable.Init();
Demo3_Insertable.Init();
Demo4_Deleteable.Init();
Demo5_SqlQueryable.Init();
Demo6_Queue.Init();
Demo7_Ado.Init();
Demo8_Saveable.Init();
Demo9_EntityMain.Init();
DemoA_DbMain.Init();
DemoB_Aop.Init();
DemoC_GobalFilter.Init();
DemoD_DbFirst.Init(); ;
DemoE_CodeFirst.Init();
DemoF_Utilities.Init();
DemoG_SimpleClient.Init();
//Oracle模式DEMO
OracleDemo.Init();
//SqlServer模式DEMO
SqlServer.Init();
//Unit test
//NewUnitTest.Init();

View File

@ -0,0 +1,51 @@
using OrmTest;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KdbndpTest.SqlServerDemo
{
internal class SqlServer
{
public static void Init()
{
SqlSugarClient Db = new SqlSugarClient(new ConnectionConfig()
{
DbType = DbType.Kdbndp,
ConnectionString = "Server=211.95.20.236 ;Port=35052;UID=system;PWD=abc123;database=test222",
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
MoreSettings=new ConnMoreSettings() {
DatabaseModel=DbType.SqlServer
}
}, db => {
db.Aop.OnLogExecuting = (sql, p) =>
{
Console.WriteLine(sql);
Console.WriteLine(string.Join(",", p?.Select(it => it.ParameterName + ":" + it.Value)));
};
});
Db.DbMaintenance.CreateDatabase();
foreach (var item in Db.DbMaintenance.GetColumnInfosByTableName("order",false))
{
Console.WriteLine($"{item.DbColumnName} DataType:{item.DataType} IsIdentity :{item.IsIdentity} IsPrimarykey :{item.IsPrimarykey} IsNullable: {item.IsNullable} Length:{item.Length} Scale:{item.Scale}");
}
var yyy = Db.Queryable<Order>().ToList();
var xxx=Db.Ado.GetDataTable("select * from information_schema.columns where pg_catalog.UPPER(table_name)=pg_catalog.UPPER('ORDER')\r\n");
Db.CodeFirst.InitTables<Order>();
Db.Insertable(new Order()
{
CreateTime=DateTime.Now,
CustomId=1,
Name="a",
Price=1
}).ExecuteCommand();
}
}
}