This commit is contained in:
Dejan Bosanac 2015-11-18 13:02:42 +01:00
parent caa6b8e253
commit 78c959a5c4
3 changed files with 13 additions and 2 deletions

View File

@ -110,4 +110,6 @@ public interface JDBCAdapter {
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;
String limitQuery(String query);
}

View File

@ -1126,9 +1126,9 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
cleanupExclusiveLock.readLock().lock();
try {
if (isPrioritizedMessages) {
s = c.getConnection().prepareStatement(this.statements.getFindNextMessagesByPriorityStatement());
s = c.getConnection().prepareStatement(limitQuery(this.statements.getFindNextMessagesByPriorityStatement()));
} else {
s = c.getConnection().prepareStatement(this.statements.getFindNextMessagesStatement());
s = c.getConnection().prepareStatement(limitQuery(this.statements.getFindNextMessagesStatement()));
}
s.setMaxRows(Math.min(maxReturned, maxRows));
s.setString(1, destination.getQualifiedName());
@ -1252,4 +1252,8 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
}
}
@Override
public String limitQuery(String query) {
return query;
}
}

View File

@ -43,4 +43,9 @@ public class OracleJDBCAdapter extends DefaultJDBCAdapter {
statements.setSequenceDataType("NUMBER");
super.setStatements(statements);
}
@Override
public String limitQuery(String query) {
return "SELECT * FROM (" + query + ") WHERE ROWNUM <= " + getMaxRows();
}
}