Merge pull request #888 from ctu-developers/DS-2418

DS-2418: Incompatible oracle sql method on collection.java
This commit is contained in:
helix84
2015-04-20 10:42:35 +02:00

View File

@@ -494,13 +494,20 @@ public class Collection extends DSpaceObject
*/ */
public ItemIterator getItems(Integer limit, Integer offset) throws SQLException public ItemIterator getItems(Integer limit, Integer offset) throws SQLException
{ {
String myQuery = "SELECT item.* FROM item, collection2item WHERE " List<Serializable> params = new ArrayList<Serializable>();
+ "item.item_id=collection2item.item_id AND " StringBuffer myQuery = new StringBuffer(
+ "collection2item.collection_id= ? " "SELECT item.* " +
+ "AND item.in_archive='1' limit ? offset ?"; "FROM item, collection2item " +
"WHERE item.item_id = collection2item.item_id " +
"AND collection2item.collection_id = ? " +
"AND item.in_archive = '1'"
);
TableRowIterator rows = DatabaseManager.queryTable(ourContext, "item", params.add(getID());
myQuery,getID(), limit, offset); DatabaseManager.applyOffsetAndLimit(myQuery, params, offset, limit);
TableRowIterator rows = DatabaseManager.query(ourContext,
myQuery.toString(), params.toArray());
return new ItemIterator(ourContext, rows); return new ItemIterator(ourContext, rows);
} }