mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-12 04:23:13 +00:00
Fix passing parameters LIMIT and OFFSET to sql query in the method getItems() for oracle
This commit is contained in:
@@ -28,6 +28,7 @@ import org.dspace.workflow.WorkflowItem;
|
|||||||
import org.dspace.xmlworkflow.storedcomponents.CollectionRole;
|
import org.dspace.xmlworkflow.storedcomponents.CollectionRole;
|
||||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@@ -450,13 +451,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);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user