diff --git a/Directory.Build.props b/Directory.Build.props index f0e011f27..827254a9e 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -11,7 +11,7 @@ diff --git a/Examples/base_entity/Program.cs b/Examples/base_entity/Program.cs index 2dee5906f..a76334431 100644 --- a/Examples/base_entity/Program.cs +++ b/Examples/base_entity/Program.cs @@ -544,13 +544,14 @@ static void Main(string[] args) #region 初始化 IFreeSql var fsql = new FreeSql.FreeSqlBuilder() - .UseAutoSyncStructure(true) + .UseAutoSyncStructure(false) .UseNoneCommandParameter(true) .UseNameConvert(NameConvertType.ToLower) //.UseMappingPriority(MappingPriorityType.Attribute, MappingPriorityType.FluentApi, MappingPriorityType.Aop) .UseAdoConnectionPool(true) + .UseConnectionFactory(DataType.Xugu, () => null) - .UseConnectionString(FreeSql.DataType.Sqlite, "data source=123.db") + //.UseConnectionString(FreeSql.DataType.Sqlite, "data source=123.db") //.UseConnectionString(DataType.Sqlite, "data source=db1.db;attachs=db2.db") //.UseSlave("data source=test1.db", "data source=test2.db", "data source=test3.db", "data source=test4.db") //.UseSlaveWeight(10, 1, 1, 5) @@ -559,10 +560,10 @@ static void Main(string[] args) //.UseConnectionString(FreeSql.DataType.Firebird, @"database=localhost:D:\fbdata\EXAMPLES.fdb;user=sysdba;password=123456;max pool size=5") //.UseQuoteSqlName(false) - .UseConnectionString(FreeSql.DataType.MySql, "Data Source=127.0.0.1;Port=3306;User ID=root;Password=root;Initial Catalog=cccddd;Charset=utf8;SslMode=none;min pool size=1;Max pool size=3;AllowLoadLocalInfile=true") + //.UseConnectionString(FreeSql.DataType.MySql, "Data Source=127.0.0.1;Port=3306;User ID=root;Password=root;Initial Catalog=cccddd;Charset=utf8;SslMode=none;min pool size=1;Max pool size=3;AllowLoadLocalInfile=true") - .UseConnectionString(FreeSql.DataType.SqlServer, "Data Source=.;Integrated Security=True;Initial Catalog=freesqlTest;Pooling=true;Max Pool Size=3;TrustServerCertificate=true") - .UseAdoConnectionPool(false) + //.UseConnectionString(FreeSql.DataType.SqlServer, "Data Source=.;Integrated Security=True;Initial Catalog=freesqlTest;Pooling=true;Max Pool Size=3;TrustServerCertificate=true") + //.UseAdoConnectionPool(false) //.UseConnectionString(FreeSql.DataType.PostgreSQL, "Host=192.168.164.10;Port=5432;Username=postgres;Password=123456;Database=tedb;Pooling=true;Maximum Pool Size=2") ////.UseConnectionString(FreeSql.DataType.PostgreSQL, "Host=192.168.164.10;Port=5432;Username=postgres;Password=123456;Database=toc;Pooling=true;Maximum Pool Size=2") //.UseNameConvert(FreeSql.Internal.NameConvertType.ToLower) @@ -600,7 +601,7 @@ static void Main(string[] args) BaseEntity.Initialization(fsql, () => _asyncUow.Value); #endregion - fsql.Select().Where(a => a.createtime > DateTime.Now && a.createtime < DateTime.Now.AddMonths(1)).ToList(); + //fsql.Select().Where(a => a.createtime > DateTime.Now && a.createtime < DateTime.Now.AddMonths(1)).ToList(); //var table = fsql.CodeFirst.GetTableByEntity(typeof(AsTableLog)); //table.SetAsTable(new ModAsTableImpl(fsql), table.ColumnsByCs[nameof(AsTableLog.click)]); @@ -621,6 +622,8 @@ static void Main(string[] args) new AsTableLog{ msg = "msg09", createtime = DateTime.Parse("2022-7-1 11:00:00"), click = 10}, new AsTableLog{ msg = "msg10", createtime = DateTime.Parse("2022-7-1 12:00:00"), click = 10} }; + + var xugusql01 = fsql.Insert(testitems).ToSql(); var sqlatb = fsql.Insert(testitems).NoneParameter(); var sqlat = sqlatb.ToSql(); var sqlatr = sqlatb.ExecuteAffrows(); diff --git a/Examples/base_entity/base_entity.csproj b/Examples/base_entity/base_entity.csproj index f1efc7911..ce19aa705 100644 --- a/Examples/base_entity/base_entity.csproj +++ b/Examples/base_entity/base_entity.csproj @@ -37,11 +37,15 @@ + ..\..\Providers\FreeSql.Provider.Dameng\lib\DmProvider\netstandard2.0\DmProvider.dll + + ..\..\Providers\FreeSql.Provider.Xugu\lib\XuguClient\netstandard2.0\XuguClient.dll + diff --git a/Extensions/FreeSql.Extensions.AggregateRoot/FreeSql.Extensions.AggregateRoot.csproj b/Extensions/FreeSql.Extensions.AggregateRoot/FreeSql.Extensions.AggregateRoot.csproj index ed5445587..b0748abdf 100644 --- a/Extensions/FreeSql.Extensions.AggregateRoot/FreeSql.Extensions.AggregateRoot.csproj +++ b/Extensions/FreeSql.Extensions.AggregateRoot/FreeSql.Extensions.AggregateRoot.csproj @@ -18,7 +18,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Extensions/FreeSql.Extensions.BaseEntity/FreeSql.Extensions.BaseEntity.csproj b/Extensions/FreeSql.Extensions.BaseEntity/FreeSql.Extensions.BaseEntity.csproj index 5cc2dc49e..ca79c6383 100644 --- a/Extensions/FreeSql.Extensions.BaseEntity/FreeSql.Extensions.BaseEntity.csproj +++ b/Extensions/FreeSql.Extensions.BaseEntity/FreeSql.Extensions.BaseEntity.csproj @@ -19,7 +19,7 @@ key.snk false latest - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Extensions/FreeSql.Extensions.JsonMap/FreeSql.Extensions.JsonMap.csproj b/Extensions/FreeSql.Extensions.JsonMap/FreeSql.Extensions.JsonMap.csproj index 75a52325e..945d13c55 100644 --- a/Extensions/FreeSql.Extensions.JsonMap/FreeSql.Extensions.JsonMap.csproj +++ b/Extensions/FreeSql.Extensions.JsonMap/FreeSql.Extensions.JsonMap.csproj @@ -18,7 +18,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Extensions/FreeSql.Extensions.LazyLoading/FreeSql.Extensions.LazyLoading.csproj b/Extensions/FreeSql.Extensions.LazyLoading/FreeSql.Extensions.LazyLoading.csproj index b34ea4c2f..34f0b043c 100644 --- a/Extensions/FreeSql.Extensions.LazyLoading/FreeSql.Extensions.LazyLoading.csproj +++ b/Extensions/FreeSql.Extensions.LazyLoading/FreeSql.Extensions.LazyLoading.csproj @@ -15,7 +15,7 @@ $(AssemblyName) true true - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Extensions/FreeSql.Extensions.Linq/FreeSql.Extensions.Linq.csproj b/Extensions/FreeSql.Extensions.Linq/FreeSql.Extensions.Linq.csproj index cdfb70fa4..3805f4321 100644 --- a/Extensions/FreeSql.Extensions.Linq/FreeSql.Extensions.Linq.csproj +++ b/Extensions/FreeSql.Extensions.Linq/FreeSql.Extensions.Linq.csproj @@ -18,7 +18,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Extensions/FreeSql.Generator/FreeSql.Generator.csproj b/Extensions/FreeSql.Generator/FreeSql.Generator.csproj index 38f48ea7b..897d0ae7e 100644 --- a/Extensions/FreeSql.Generator/FreeSql.Generator.csproj +++ b/Extensions/FreeSql.Generator/FreeSql.Generator.csproj @@ -13,7 +13,7 @@ https://github.com/2881099/FreeSql https://github.com/2881099/FreeSql FreeSql DbFirst 实体生成器 - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/FreeSql.All/FreeSql.All.csproj b/FreeSql.All/FreeSql.All.csproj index 53ee8f5cd..fbfdde240 100644 --- a/FreeSql.All/FreeSql.All.csproj +++ b/FreeSql.All/FreeSql.All.csproj @@ -17,7 +17,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/FreeSql.DbContext/FreeSql.DbContext.csproj b/FreeSql.DbContext/FreeSql.DbContext.csproj index 6f5fce215..da70a88ca 100644 --- a/FreeSql.DbContext/FreeSql.DbContext.csproj +++ b/FreeSql.DbContext/FreeSql.DbContext.csproj @@ -17,7 +17,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/FreeSql.DbContext/FreeSql.DbContext.xml b/FreeSql.DbContext/FreeSql.DbContext.xml index 26522f106..537315e21 100644 --- a/FreeSql.DbContext/FreeSql.DbContext.xml +++ b/FreeSql.DbContext/FreeSql.DbContext.xml @@ -800,14 +800,5 @@ - - - 批量注入 Repository,可以参考代码自行调整 - - - - - - diff --git a/FreeSql.Repository/FreeSql.Repository.csproj b/FreeSql.Repository/FreeSql.Repository.csproj index c0e1b82fa..45eef5141 100644 --- a/FreeSql.Repository/FreeSql.Repository.csproj +++ b/FreeSql.Repository/FreeSql.Repository.csproj @@ -17,7 +17,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/FreeSql/FreeSql.csproj b/FreeSql/FreeSql.csproj index 678e62cca..3c389ac92 100644 --- a/FreeSql/FreeSql.csproj +++ b/FreeSql/FreeSql.csproj @@ -17,7 +17,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.ClickHouse/FreeSql.Provider.ClickHouse.csproj b/Providers/FreeSql.Provider.ClickHouse/FreeSql.Provider.ClickHouse.csproj index 0b0f221bf..0ca3439ad 100644 --- a/Providers/FreeSql.Provider.ClickHouse/FreeSql.Provider.ClickHouse.csproj +++ b/Providers/FreeSql.Provider.ClickHouse/FreeSql.Provider.ClickHouse.csproj @@ -19,7 +19,7 @@ False key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.Custom/FreeSql.Provider.Custom.csproj b/Providers/FreeSql.Provider.Custom/FreeSql.Provider.Custom.csproj index 8912fc95b..7be1886c6 100644 --- a/Providers/FreeSql.Provider.Custom/FreeSql.Provider.Custom.csproj +++ b/Providers/FreeSql.Provider.Custom/FreeSql.Provider.Custom.csproj @@ -18,7 +18,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.Dameng/FreeSql.Provider.Dameng.csproj b/Providers/FreeSql.Provider.Dameng/FreeSql.Provider.Dameng.csproj index 46529a726..92788becc 100644 --- a/Providers/FreeSql.Provider.Dameng/FreeSql.Provider.Dameng.csproj +++ b/Providers/FreeSql.Provider.Dameng/FreeSql.Provider.Dameng.csproj @@ -15,7 +15,7 @@ $(AssemblyName) true true - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.Firebird/FreeSql.Provider.Firebird.csproj b/Providers/FreeSql.Provider.Firebird/FreeSql.Provider.Firebird.csproj index 7424eead9..837660882 100644 --- a/Providers/FreeSql.Provider.Firebird/FreeSql.Provider.Firebird.csproj +++ b/Providers/FreeSql.Provider.Firebird/FreeSql.Provider.Firebird.csproj @@ -18,7 +18,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.GBase/FreeSql.Provider.GBase.csproj b/Providers/FreeSql.Provider.GBase/FreeSql.Provider.GBase.csproj index 0dc9a1248..09c683d92 100644 --- a/Providers/FreeSql.Provider.GBase/FreeSql.Provider.GBase.csproj +++ b/Providers/FreeSql.Provider.GBase/FreeSql.Provider.GBase.csproj @@ -18,7 +18,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.KingbaseES/FreeSql.Provider.KingbaseES.csproj b/Providers/FreeSql.Provider.KingbaseES/FreeSql.Provider.KingbaseES.csproj index 6053cfa9c..ada4f25e1 100644 --- a/Providers/FreeSql.Provider.KingbaseES/FreeSql.Provider.KingbaseES.csproj +++ b/Providers/FreeSql.Provider.KingbaseES/FreeSql.Provider.KingbaseES.csproj @@ -15,7 +15,7 @@ $(AssemblyName) true true - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.MsAccess/FreeSql.Provider.MsAccess.csproj b/Providers/FreeSql.Provider.MsAccess/FreeSql.Provider.MsAccess.csproj index 5467fe206..b0a848a74 100644 --- a/Providers/FreeSql.Provider.MsAccess/FreeSql.Provider.MsAccess.csproj +++ b/Providers/FreeSql.Provider.MsAccess/FreeSql.Provider.MsAccess.csproj @@ -18,7 +18,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.MySql/FreeSql.Provider.MySql.csproj b/Providers/FreeSql.Provider.MySql/FreeSql.Provider.MySql.csproj index 877d00af1..5e67af9ff 100644 --- a/Providers/FreeSql.Provider.MySql/FreeSql.Provider.MySql.csproj +++ b/Providers/FreeSql.Provider.MySql/FreeSql.Provider.MySql.csproj @@ -18,7 +18,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.MySqlConnector/FreeSql.Provider.MySqlConnector.csproj b/Providers/FreeSql.Provider.MySqlConnector/FreeSql.Provider.MySqlConnector.csproj index 4b1b4dd10..af1c7dbdd 100644 --- a/Providers/FreeSql.Provider.MySqlConnector/FreeSql.Provider.MySqlConnector.csproj +++ b/Providers/FreeSql.Provider.MySqlConnector/FreeSql.Provider.MySqlConnector.csproj @@ -18,7 +18,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.Odbc/FreeSql.Provider.Odbc.csproj b/Providers/FreeSql.Provider.Odbc/FreeSql.Provider.Odbc.csproj index 449dc268f..2b3a8871d 100644 --- a/Providers/FreeSql.Provider.Odbc/FreeSql.Provider.Odbc.csproj +++ b/Providers/FreeSql.Provider.Odbc/FreeSql.Provider.Odbc.csproj @@ -18,7 +18,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.Oracle/FreeSql.Provider.Oracle.csproj b/Providers/FreeSql.Provider.Oracle/FreeSql.Provider.Oracle.csproj index 2212331fe..811d1709f 100644 --- a/Providers/FreeSql.Provider.Oracle/FreeSql.Provider.Oracle.csproj +++ b/Providers/FreeSql.Provider.Oracle/FreeSql.Provider.Oracle.csproj @@ -18,7 +18,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.OracleOledb/FreeSql.Provider.OracleOledb.csproj b/Providers/FreeSql.Provider.OracleOledb/FreeSql.Provider.OracleOledb.csproj index 4de627687..222c11a2a 100644 --- a/Providers/FreeSql.Provider.OracleOledb/FreeSql.Provider.OracleOledb.csproj +++ b/Providers/FreeSql.Provider.OracleOledb/FreeSql.Provider.OracleOledb.csproj @@ -18,7 +18,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.PostgreSQL/FreeSql.Provider.PostgreSQL.csproj b/Providers/FreeSql.Provider.PostgreSQL/FreeSql.Provider.PostgreSQL.csproj index c23e59108..8a806896f 100644 --- a/Providers/FreeSql.Provider.PostgreSQL/FreeSql.Provider.PostgreSQL.csproj +++ b/Providers/FreeSql.Provider.PostgreSQL/FreeSql.Provider.PostgreSQL.csproj @@ -18,7 +18,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.QuestDb/FreeSql.Provider.QuestDb.csproj b/Providers/FreeSql.Provider.QuestDb/FreeSql.Provider.QuestDb.csproj index d944a5429..fe35d62c7 100644 --- a/Providers/FreeSql.Provider.QuestDb/FreeSql.Provider.QuestDb.csproj +++ b/Providers/FreeSql.Provider.QuestDb/FreeSql.Provider.QuestDb.csproj @@ -18,7 +18,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.ShenTong/FreeSql.Provider.ShenTong.csproj b/Providers/FreeSql.Provider.ShenTong/FreeSql.Provider.ShenTong.csproj index dbe19b4b2..a9f7d48a8 100644 --- a/Providers/FreeSql.Provider.ShenTong/FreeSql.Provider.ShenTong.csproj +++ b/Providers/FreeSql.Provider.ShenTong/FreeSql.Provider.ShenTong.csproj @@ -15,7 +15,7 @@ $(AssemblyName) true true - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.SqlServer/FreeSql.Provider.SqlServer.csproj b/Providers/FreeSql.Provider.SqlServer/FreeSql.Provider.SqlServer.csproj index df16075c0..9427f3822 100644 --- a/Providers/FreeSql.Provider.SqlServer/FreeSql.Provider.SqlServer.csproj +++ b/Providers/FreeSql.Provider.SqlServer/FreeSql.Provider.SqlServer.csproj @@ -18,7 +18,7 @@ true false key.snk - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.SqlServerForSystem/FreeSql.Provider.SqlServerForSystem.csproj b/Providers/FreeSql.Provider.SqlServerForSystem/FreeSql.Provider.SqlServerForSystem.csproj index bd54431da..e0262be2c 100644 --- a/Providers/FreeSql.Provider.SqlServerForSystem/FreeSql.Provider.SqlServerForSystem.csproj +++ b/Providers/FreeSql.Provider.SqlServerForSystem/FreeSql.Provider.SqlServerForSystem.csproj @@ -18,7 +18,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.Sqlite/FreeSql.Provider.Sqlite.csproj b/Providers/FreeSql.Provider.Sqlite/FreeSql.Provider.Sqlite.csproj index 5dcc77936..abeaf9694 100644 --- a/Providers/FreeSql.Provider.Sqlite/FreeSql.Provider.Sqlite.csproj +++ b/Providers/FreeSql.Provider.Sqlite/FreeSql.Provider.Sqlite.csproj @@ -18,7 +18,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.SqliteCore/FreeSql.Provider.SqliteCore.csproj b/Providers/FreeSql.Provider.SqliteCore/FreeSql.Provider.SqliteCore.csproj index 505bfe7a0..4b6107a24 100644 --- a/Providers/FreeSql.Provider.SqliteCore/FreeSql.Provider.SqliteCore.csproj +++ b/Providers/FreeSql.Provider.SqliteCore/FreeSql.Provider.SqliteCore.csproj @@ -18,7 +18,7 @@ true key.snk false - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.Xugu/Curd/XuguInsert.cs b/Providers/FreeSql.Provider.Xugu/Curd/XuguInsert.cs index a3174a8a8..0e5ec5f75 100644 --- a/Providers/FreeSql.Provider.Xugu/Curd/XuguInsert.cs +++ b/Providers/FreeSql.Provider.Xugu/Curd/XuguInsert.cs @@ -35,7 +35,16 @@ public XuguInsert(IFreeSql orm, CommonUtils commonUtils, CommonExpression common public override long ExecuteIdentity() => base.SplitExecuteIdentity(_batchValuesLimit > 0 ? _batchValuesLimit : 5000, _batchParameterLimit > 0 ? _batchParameterLimit : 3000); public override List ExecuteInserted() => base.SplitExecuteInserted(_batchValuesLimit > 0 ? _batchValuesLimit : 5000, _batchParameterLimit > 0 ? _batchParameterLimit : 3000); - protected override long RawExecuteIdentity() + public override string ToSql() + { + return base.ToSqlValuesOrSelectUnionAllExtension102(true, (d, didx, sb) => + { + if (didx > 0) + sb.Remove(sb.Length - 3, 1); //批量无逗号 + }, null); + } + + protected override long RawExecuteIdentity() { var sql = this.ToSql(); if (string.IsNullOrEmpty(sql)) return 0; diff --git a/Providers/FreeSql.Provider.Xugu/Curd/XuguUpdate.cs b/Providers/FreeSql.Provider.Xugu/Curd/XuguUpdate.cs index 35ad0a2b9..1546efe61 100644 --- a/Providers/FreeSql.Provider.Xugu/Curd/XuguUpdate.cs +++ b/Providers/FreeSql.Provider.Xugu/Curd/XuguUpdate.cs @@ -93,7 +93,7 @@ protected override void ToSqlCase(StringBuilder caseWhen, ColumnInfo[] primarys) { if (pkidx > 0) caseWhen.Append(" || '+' || "); if (string.IsNullOrEmpty(InternalTableAlias) == false) caseWhen.Append(InternalTableAlias).Append("."); - caseWhen.Append(_commonUtils.RereadColumn(pk, _commonUtils.QuoteSqlName(pk.Attribute.Name))).Append("::text"); + caseWhen.Append(_commonUtils.RereadColumn(pk, _commonUtils.QuoteSqlName(pk.Attribute.Name))); ++pkidx; } caseWhen.Append(")"); @@ -111,26 +111,12 @@ protected override void ToSqlWhen(StringBuilder sb, ColumnInfo[] primarys, objec foreach (var pk in primarys) { if (pkidx > 0) sb.Append(" || '+' || "); - sb.Append(_commonUtils.FormatSql("{0}", pk.GetDbValue(d))).Append("::text"); + sb.Append(_commonUtils.FormatSql("{0}", pk.GetDbValue(d))); ++pkidx; } sb.Append(")"); } - protected override void ToSqlCaseWhenEnd(StringBuilder sb, ColumnInfo col) - { - if (_noneParameter == false) return; - if (col.Attribute.MapType == typeof(string)) - { - sb.Append("::text"); - return; - } - var dbtype = _commonUtils.CodeFirst.GetDbInfo(col.Attribute.MapType)?.dbtype; - if (dbtype == null) return; - - sb.Append("::").Append(dbtype); - } - #if net40 #else public override Task ExecuteAffrowsAsync(CancellationToken cancellationToken = default) => base.SplitExecuteAffrowsAsync(_batchRowsLimit > 0 ? _batchRowsLimit : 500, _batchParameterLimit > 0 ? _batchParameterLimit : 3000, cancellationToken); diff --git a/Providers/FreeSql.Provider.Xugu/FreeSql.Provider.Xugu.csproj b/Providers/FreeSql.Provider.Xugu/FreeSql.Provider.Xugu.csproj index 5882bf8cd..5ad23be9f 100644 --- a/Providers/FreeSql.Provider.Xugu/FreeSql.Provider.Xugu.csproj +++ b/Providers/FreeSql.Provider.Xugu/FreeSql.Provider.Xugu.csproj @@ -15,7 +15,7 @@ $(AssemblyName) true true - 3.2.806-preview20231124 + 3.2.806-preview20231128 readme.md diff --git a/Providers/FreeSql.Provider.Xugu/XuguAdo/XuguAdo.cs b/Providers/FreeSql.Provider.Xugu/XuguAdo/XuguAdo.cs index 8eaba42f2..81ea71444 100644 --- a/Providers/FreeSql.Provider.Xugu/XuguAdo/XuguAdo.cs +++ b/Providers/FreeSql.Provider.Xugu/XuguAdo/XuguAdo.cs @@ -75,31 +75,6 @@ public override object AddslashesProcessParam(object param, Type mapType, Column return ((TimeSpan)param).Ticks / 10; else if (param is byte[]) return $"'\\x{CommonUtils.BytesSqlRaw(param as byte[])}'"; - else if (param is JToken || param is JObject || param is JArray) - return string.Concat("'", param.ToString().Replace("'", "''"), "'::jsonb"); - else if ((isdic = param is Dictionary) || - param is IEnumerable>) - { - var pgdics = isdic ? param as Dictionary : - param as IEnumerable>; - - var pghstore = new StringBuilder("'"); - var pairs = pgdics.ToArray(); - - for (var i = 0; i < pairs.Length; i++) - { - if (i != 0) pghstore.Append(","); - - pghstore.AppendFormat("\"{0}\"=>", pairs[i].Key.Replace("'", "''")); - - if (pairs[i].Value == null) - pghstore.Append("NULL"); - else - pghstore.AppendFormat("\"{0}\"", pairs[i].Value.Replace("'", "''")); - } - - return pghstore.Append("'::hstore"); - } else if (param is IEnumerable) return AddslashesIEnumerable(param, mapType, mapColumn); diff --git a/Providers/FreeSql.Provider.Xugu/XuguCodeFirst.cs b/Providers/FreeSql.Provider.Xugu/XuguCodeFirst.cs index a47c62dce..1182b4933 100644 --- a/Providers/FreeSql.Provider.Xugu/XuguCodeFirst.cs +++ b/Providers/FreeSql.Provider.Xugu/XuguCodeFirst.cs @@ -504,22 +504,6 @@ select cons_name from all_constraints as a } - - //foreach (var seqcol in seqcols) - //{ - // var tbname = seqcol.Item2; - // var seqname = Utils.GetCsName($"{tbname[0]}.{tbname[1]}_{seqcol.Item1.Attribute.Name}_sequence_name").ToLower(); - // var tbname2 = _commonUtils.QuoteSqlName($"{tbname[0]}.{tbname[1]}"); - // var colname2 = _commonUtils.QuoteSqlName(seqcol.Item1.Attribute.Name); - // sb.Append("ALTER TABLE ").Append(tbname2).Append(" ALTER COLUMN ").Append(colname2).Append(" SET DEFAULT null;\r\n"); - // sb.Append("DROP SEQUENCE IF EXISTS ").Append(seqname).Append(";\r\n"); - // if (seqcol.Item3) - // { - // sb.Append("CREATE SEQUENCE ").Append(seqname).Append(";\r\n"); - // sb.Append("ALTER TABLE ").Append(tbname2).Append(" ALTER COLUMN ").Append(colname2).Append(" SET DEFAULT nextval('").Append(seqname).Append("'::regclass);\r\n"); - // sb.Append(" SELECT case when max(").Append(colname2).Append(") is null then 0 else setval('").Append(seqname).Append("', max(").Append(colname2).Append(")) end FROM ").Append(tbname2).Append(";\r\n"); - // } - //} Console.Write(sb.ToString()); //throw new Exception(sb.ToString()); return sb.Length == 0 ? null : sb.ToString(); diff --git a/Providers/FreeSql.Provider.Xugu/XuguUtils.cs b/Providers/FreeSql.Provider.Xugu/XuguUtils.cs index d73ef89f7..fc16dc158 100644 --- a/Providers/FreeSql.Provider.Xugu/XuguUtils.cs +++ b/Providers/FreeSql.Provider.Xugu/XuguUtils.cs @@ -154,27 +154,6 @@ public override string GetNoneParamaterSqlValue(List specialParams, var ts = (TimeSpan)value; return $"'{Math.Min(24, (int)Math.Floor(ts.TotalHours))}:{ts.Minutes}:{ts.Seconds}'"; } - else if (value is Array) - { - var valueArr = value as Array; - var eleType = type2.GetElementType(); - var len = valueArr.GetLength(0); - var sb = new StringBuilder().Append("ARRAY["); - for (var a = 0; a < len; a++) - { - var item = valueArr.GetValue(a); - if (a > 0) sb.Append(","); - sb.Append(GetNoneParamaterSqlValue(specialParams, specialParamFlag, col, eleType, item)); - } - sb.Append("]"); - var dbinfo = _orm.CodeFirst.GetDbInfo(type); - if (dbinfo != null) sb.Append("::").Append(dbinfo.dbtype); - return sb.ToString(); - } - else if (type2 == typeof(BitArray)) - { - return $"'{(value as BitArray).To1010()}'"; - } else if (dicGetParamterValue.ContainsKey(type2.FullName)) { value = string.Concat(value);