This commit is contained in:
sunkaixuan
2018-12-03 00:42:17 +08:00
parent 8443581bac
commit 02e9568dda
5 changed files with 36 additions and 0 deletions

View File

@@ -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";

View File

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

View File

@@ -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();
}
}
}
}

View File

@@ -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" />

View File

@@ -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";