Browse Source

-

pull/12/MERGE
sunkaixuan 6 years ago
parent
commit
02e9568dda
  1. 4
      Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs
  2. 4
      Src/Asp.Net/SqlSugar/Infrastructure/Mapper.cs
  3. 23
      Src/Asp.Net/SqlSugar/OnlyNet/PostgreSQLExpressionContext.cs
  4. 1
      Src/Asp.Net/SqlSugar/SqlSugar.csproj
  5. 4
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs

4
Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs

@ -61,6 +61,10 @@ namespace SqlSugar
{
return (HasWhere?"AND":"WHERE")+ " ROWNUM=1";
}
else if (this.Context is PostgreSQLExpressionContext)
{
return "limit 1";
}
else
{
return "limit 0,1";

4
Src/Asp.Net/SqlSugar/Infrastructure/Mapper.cs

@ -103,6 +103,10 @@ namespace SqlSugar
}
}
result = queryBuilder.GetSelectByItems(selectItems);
if (_context.CurrentConnectionConfig.DbType == DbType.PostgreSQL)
{
result = result.ToLower();
}
return result;
}
}

23
Src/Asp.Net/SqlSugar/OnlyNet/PostgreSQLExpressionContext.cs

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SqlSugar
{
internal class PostgreSQLExpressionContext : ExpressionContext, ILambdaExpressions
{
public SqlSugarClient Context
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
}
}

1
Src/Asp.Net/SqlSugar/SqlSugar.csproj

@ -115,6 +115,7 @@
<Compile Include="ExternalServiceInterface\ISerializeService.cs" />
<Compile Include="Entities\DefaultServices.cs" />
<Compile Include="Infrastructure\Mapper.cs" />
<Compile Include="OnlyNet\PostgreSQLExpressionContext.cs" />
<Compile Include="Realization\Oracle\Deleteable\OracleDeleteable.cs" />
<Compile Include="Realization\Oracle\Insertable\OracleInsertable.cs" />
<Compile Include="Realization\Oracle\Updateable\OracleUpdateable.cs" />

4
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs

@ -61,6 +61,10 @@ namespace SqlSugar
{
return (HasWhere?"AND":"WHERE")+ " ROWNUM=1";
}
else if (this.Context is PostgreSQLExpressionContext)
{
return "limit 1";
}
else
{
return "limit 0,1";

Loading…
Cancel
Save