1.ExpressionContextCase增加Num属性,用于传递跳过的数据数量。

2.OcaenBaseForOracle 重写 GetLimit,使其支持子查询。
3.TDSQLForPGODBC 重写 GetLimit,使其支持子查询。
4.getMyInt和getMyIntNull,获取数据方式改成GetDecimal,只有OcaenBaseForOracle 使用这两个方法,这是为了支持OcaenBaseForOracle 驱动2.0.9以上,请更新驱动到2.0.9以上
This commit is contained in:
guoshun.du
2025-09-09 19:24:19 +08:00
parent 96a670465c
commit 81eb7a5a3f
6 changed files with 32 additions and 3 deletions

View File

@@ -72,6 +72,16 @@ namespace SqlSugar.OceanBaseForOracle
}
}
}
public override string GetLimit()
{
int num = 1;
if (this.Case?.Num != 1)
{
num = this.Case.Num;
}
return (this.Case?.HasWhere == true ? "AND" : "WHERE") + " ROWNUM=" + num;
}
}
public partial class OceanBaseForOracleMethod : DefaultDbMethod, IDbMethods
{

View File

@@ -130,6 +130,16 @@ namespace SqlSugar.TDSQLForPGODBC
});
}
}
public override string GetLimit()
{
int num = 1;
if (this.Case.Num != 1)
{
num = this.Case.Num;
}
return "limit " + num;
}
}
public class TDSQLForPGODBCMethod : DefaultDbMethod, IDbMethods
{

View File

@@ -151,7 +151,7 @@ namespace SqlSugar
}
if (dr.GetDataTypeName(i) == "NUMBER")
{
return Convert.ToInt32(dr.GetDouble(i));
return Convert.ToInt32(dr.GetDecimal(i));
}
var result = dr.GetInt32(i);
return result;
@@ -160,7 +160,7 @@ namespace SqlSugar
{
if (dr.GetDataTypeName(i) == "NUMBER")
{
return Convert.ToInt32(dr.GetDouble(i));
return Convert.ToInt32(dr.GetDecimal(i));
}
var result = dr.GetInt32(i);
return result;

View File

@@ -4,11 +4,12 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SqlSugar
namespace SqlSugar
{
public class ExpressionContextCase
{
public bool IsDateString { get; set; }
public bool HasWhere { get; set; }
public int Num { get; set; } = 1;
}
}

View File

@@ -86,6 +86,10 @@ namespace SqlSugar
{
this.Context.Case.HasWhere = this.HasWhere;
}
if (this?.Context?.Case?.Num != 1)
{
this.Context.Case.Num = num;
}
return this.Context.GetLimit();
}
else

View File

@@ -67,6 +67,10 @@ namespace SqlSugar
}
else if (this.Context.GetLimit()!=null)
{
if (this?.Context?.Case?.HasWhere == true)
{
this.Context.Case.HasWhere = this.HasWhere;
}
return this.Context.GetLimit();
}
else