diff --git a/Src/Asp.NetCore2/SqlSugar.TDSQLForPGODBC/TDSQLForPG/SqlBuilder/TDSQLForPGODBCExpressionContext.cs b/Src/Asp.NetCore2/SqlSugar.TDSQLForPGODBC/TDSQLForPG/SqlBuilder/TDSQLForPGODBCExpressionContext.cs index a2a0df214f68e4932991bf80e2a6b54a5458a21e..7e2eb995cc837f463da513766afa7279b714cbf7 100644 --- a/Src/Asp.NetCore2/SqlSugar.TDSQLForPGODBC/TDSQLForPG/SqlBuilder/TDSQLForPGODBCExpressionContext.cs +++ b/Src/Asp.NetCore2/SqlSugar.TDSQLForPGODBC/TDSQLForPG/SqlBuilder/TDSQLForPGODBCExpressionContext.cs @@ -130,6 +130,8 @@ namespace SqlSugar.TDSQLForPGODBC }); } } + + public override string GetLimit() { return "limit 1"; } } public class TDSQLForPGODBCMethod : DefaultDbMethod, IDbMethods { diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs index 959758c3c0637b70280c93ce6af0682bd9f4c699..47eea50fce96a92ba19389218a5027a07f8f0f16 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs @@ -151,7 +151,7 @@ namespace SqlSugar } if (dr.GetDataTypeName(i) == "NUMBER") { - return Convert.ToInt32(dr.GetDouble(i)); + return Convert.ToInt32(dr.GetValue(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.GetValue(i)); } var result = dr.GetInt32(i); return result; diff --git a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTake.cs b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTake.cs index 2fe4755a85b4e531a0cce995f19a471c3eaadf5c..12a7b53163f3ba8122c7a87ee5eec47fdbee0d79 100644 --- a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTake.cs +++ b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTake.cs @@ -72,7 +72,7 @@ namespace SqlSugar { return "TOP " + num; } - else if (this.Context is OracleExpressionContext) + else if (this.Context is OracleExpressionContext || this.Context.SugarContext.Context.CurrentConnectionConfig.DbType == DbType.OceanBaseForOracle) { return (HasWhere ? "AND" : "WHERE") + " ROWNUM<=" + num; } diff --git a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs index e0d810a38e9effa7b8b96155e9412ef810e1ece2..adcc3ef774aaf9bac48dda354e4f15ade5c60811 100644 --- a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs +++ b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs @@ -57,7 +57,7 @@ namespace SqlSugar { return "TOP 1"; } - else if (this.Context is OracleExpressionContext) + else if (this.Context is OracleExpressionContext || this.Context.SugarContext.Context.CurrentConnectionConfig.DbType == DbType.OceanBaseForOracle) { return (HasWhere?"AND":"WHERE")+ " ROWNUM=1"; }