Browse Source

Update pgsql

pull/10/MERGE
sunkaixuna 3 years ago
parent
commit
e16032ef19
  1. 2
      Src/Asp.Net/SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs
  2. 12
      Src/Asp.Net/SqlSugar/Realization/PostgreSQL/DbMaintenance/PostgreSQLDbMaintenance.cs
  3. 6
      Src/Asp.Net/SqlSugar/Realization/PostgreSQL/SqlBuilder/PostgreSQLExpressionContext.cs

2
Src/Asp.Net/SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs

@ -441,7 +441,7 @@ namespace SqlSugar
#endregion
#region Private
private List<T> GetListOrCache<T>(string cacheKey, string sql)
protected List<T> GetListOrCache<T>(string cacheKey, string sql)
{
return this.Context.Utilities.GetReflectionInoCacheInstance().GetOrCreate(cacheKey,
() =>

12
Src/Asp.Net/SqlSugar/Realization/PostgreSQL/DbMaintenance/PostgreSQLDbMaintenance.cs

@ -406,8 +406,16 @@ namespace SqlSugar
and kcu.constraint_name = tco.constraint_name
where tco.constraint_type = 'PRIMARY KEY'
and kcu.table_schema='public' and
upper(kcu.table_name)=upper('{tableName}')";
var pkList = this.Context.Ado.SqlQuery<string>(sql);
upper(kcu.table_name)=upper('{tableName.TrimEnd('"').TrimStart('"')}')";
List<string> pkList = new List<string>();
if (isCache)
{
pkList=GetListOrCache<string>("GetColumnInfosByTableName_N_Pk"+tableName, sql);
}
else
{
pkList = this.Context.Ado.SqlQuery<string>(sql);
}
if (pkList.Count >1)
{
foreach (var item in result)

6
Src/Asp.Net/SqlSugar/Realization/PostgreSQL/SqlBuilder/PostgreSQLExpressionContext.cs

@ -210,6 +210,12 @@ namespace SqlSugar
return string.Format(" ( to_char({0},'yyyy-MM-dd')=to_char({1},'yyyy-MM-dd') ) ", parameter.MemberName, parameter2.MemberName); ;
}
public override string HasValue(MethodCallExpressionModel model)
{
var parameter = model.Args[0];
return string.Format("( {0} IS NOT NULL )", parameter.MemberName);
}
public override string DateIsSameByType(MethodCallExpressionModel model)
{
var parameter = model.Args[0];

Loading…
Cancel
Save