mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-6049 - limit query results
This commit is contained in:
parent
caa6b8e253
commit
78c959a5c4
|
@ -110,4 +110,6 @@ public interface JDBCAdapter {
|
||||||
void doClearLastAck(TransactionContext c, ActiveMQDestination destination, byte priority, String subId, String subName) throws SQLException, IOException;
|
void doClearLastAck(TransactionContext c, ActiveMQDestination destination, byte priority, String subId, String subName) throws SQLException, IOException;
|
||||||
|
|
||||||
void doUpdateMessage(TransactionContext c, ActiveMQDestination destination, MessageId id, byte[] data) throws SQLException, IOException;
|
void doUpdateMessage(TransactionContext c, ActiveMQDestination destination, MessageId id, byte[] data) throws SQLException, IOException;
|
||||||
|
|
||||||
|
String limitQuery(String query);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1126,9 +1126,9 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
|
||||||
cleanupExclusiveLock.readLock().lock();
|
cleanupExclusiveLock.readLock().lock();
|
||||||
try {
|
try {
|
||||||
if (isPrioritizedMessages) {
|
if (isPrioritizedMessages) {
|
||||||
s = c.getConnection().prepareStatement(this.statements.getFindNextMessagesByPriorityStatement());
|
s = c.getConnection().prepareStatement(limitQuery(this.statements.getFindNextMessagesByPriorityStatement()));
|
||||||
} else {
|
} else {
|
||||||
s = c.getConnection().prepareStatement(this.statements.getFindNextMessagesStatement());
|
s = c.getConnection().prepareStatement(limitQuery(this.statements.getFindNextMessagesStatement()));
|
||||||
}
|
}
|
||||||
s.setMaxRows(Math.min(maxReturned, maxRows));
|
s.setMaxRows(Math.min(maxReturned, maxRows));
|
||||||
s.setString(1, destination.getQualifiedName());
|
s.setString(1, destination.getQualifiedName());
|
||||||
|
@ -1252,4 +1252,8 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String limitQuery(String query) {
|
||||||
|
return query;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,4 +43,9 @@ public class OracleJDBCAdapter extends DefaultJDBCAdapter {
|
||||||
statements.setSequenceDataType("NUMBER");
|
statements.setSequenceDataType("NUMBER");
|
||||||
super.setStatements(statements);
|
super.setStatements(statements);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String limitQuery(String query) {
|
||||||
|
return "SELECT * FROM (" + query + ") WHERE ROWNUM <= " + getMaxRows();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue