activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject activemq git commit: https://issues.apache.org/jira/browse/AMQ-6049 - limit query results
Date Wed, 18 Nov 2015 12:05:40 GMT
Repository: activemq
Updated Branches:
  refs/heads/master caa6b8e25 -> 78c959a5c


https://issues.apache.org/jira/browse/AMQ-6049 - limit query results


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/78c959a5
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/78c959a5
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/78c959a5

Branch: refs/heads/master
Commit: 78c959a5c44e51d3591987962897e04fc81b06f0
Parents: caa6b8e
Author: Dejan Bosanac <dejan@nighttale.net>
Authored: Wed Nov 18 13:02:42 2015 +0100
Committer: Dejan Bosanac <dejan@nighttale.net>
Committed: Wed Nov 18 13:03:24 2015 +0100

----------------------------------------------------------------------
 .../java/org/apache/activemq/store/jdbc/JDBCAdapter.java     | 2 ++
 .../activemq/store/jdbc/adapter/DefaultJDBCAdapter.java      | 8 ++++++--
 .../activemq/store/jdbc/adapter/OracleJDBCAdapter.java       | 5 +++++
 3 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/78c959a5/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/JDBCAdapter.java
----------------------------------------------------------------------
diff --git a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/JDBCAdapter.java
b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/JDBCAdapter.java
index e611a01..dc57b24 100755
--- a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/JDBCAdapter.java
+++ b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/JDBCAdapter.java
@@ -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);
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/78c959a5/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java
----------------------------------------------------------------------
diff --git a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java
b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java
index 9530815..facf969 100755
--- a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java
+++ b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java
@@ -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;
+    }
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/78c959a5/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/OracleJDBCAdapter.java
----------------------------------------------------------------------
diff --git a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/OracleJDBCAdapter.java
b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/OracleJDBCAdapter.java
index 7b90ee6..373ba58 100755
--- a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/OracleJDBCAdapter.java
+++ b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/OracleJDBCAdapter.java
@@ -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();
+    }
 }


Mime
View raw message