mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-11 20:13:17 +00:00
DS-2350 Using Oracle rownum way to limit results
This commit is contained in:
@@ -304,9 +304,14 @@ public class Item extends DSpaceObject
|
|||||||
|
|
||||||
TableRowIterator rows;
|
TableRowIterator rows;
|
||||||
|
|
||||||
//TODO Oracle doesn't have concept of limit
|
if(limit != null && limit > 0) {
|
||||||
if(limit != null && limit > 0 && !DatabaseManager.isOracle()) {
|
if(DatabaseManager.isOracle()) {
|
||||||
querySorted += " limit ?";
|
//Oracle syntax for limit
|
||||||
|
// select * from ( SUBQUERY ) where ROWNUM <= 5;
|
||||||
|
querySorted = "SELECT * FROM (" + querySorted + ") WHERE ROWNUM <= ?";
|
||||||
|
} else {
|
||||||
|
querySorted += " limit ?";
|
||||||
|
}
|
||||||
rows = DatabaseManager.query(context, querySorted, Constants.ITEM, eperson.getID(), limit);
|
rows = DatabaseManager.query(context, querySorted, Constants.ITEM, eperson.getID(), limit);
|
||||||
} else {
|
} else {
|
||||||
rows = DatabaseManager.query(context, querySorted, Constants.ITEM, eperson.getID());
|
rows = DatabaseManager.query(context, querySorted, Constants.ITEM, eperson.getID());
|
||||||
|
Reference in New Issue
Block a user