From 5ffcaf40525d4ae00191ec891979ae6a6a101415 Mon Sep 17 00:00:00 2001 From: Bosanac Dejan Date: Mon, 21 Dec 2009 08:49:56 +0000 Subject: [PATCH] https://issues.apache.org/activemq/browse/AMQ-2473 - fix find all message ids statement git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@892729 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/activemq/store/jdbc/Statements.java | 9 +++++---- .../activemq/store/jdbc/adapter/DefaultJDBCAdapter.java | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/Statements.java b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/Statements.java index b05c613ceb..a82be3f014 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/Statements.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/Statements.java @@ -65,6 +65,7 @@ public class Statements { private String destinationMessageCountStatement; private String findNextMessagesStatement; private boolean useLockCreateWhereClause; + private String findAllMessageIdsStatement; public String[] getCreateSchemaStatements() { if (createSchemaStatements == null) { @@ -146,14 +147,14 @@ public class Statements { return findAllMessagesStatement; } - public String getFindAllMessageIds() { + public String getFindAllMessageIdsStatement() { // this needs to be limited maybe need to use getFindLastSequenceIdInMsgsStatement // and work back for X - if (findAllMessagesStatement == null) { - findAllMessagesStatement = "SELECT ID, MSGID_PROD, MSGID_SEQ FROM " + getFullMessageTableName() + if (findAllMessageIdsStatement == null) { + findAllMessageIdsStatement = "SELECT ID, MSGID_PROD, MSGID_SEQ FROM " + getFullMessageTableName() + " WHERE CONTAINER=? ORDER BY ID DESC"; } - return findAllMessagesStatement; + return findAllMessageIdsStatement; } public String getFindLastSequenceIdInMsgsStatement() { diff --git a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java index e08e970e6b..66449bcf3e 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapter.java @@ -332,7 +332,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter { PreparedStatement s = null; ResultSet rs = null; try { - s = c.getConnection().prepareStatement(this.statements.getFindAllMessageIds()); + s = c.getConnection().prepareStatement(this.statements.getFindAllMessageIdsStatement()); s.setString(1, destination.getQualifiedName()); // limit the query. just need the the last few messages that could be replayed // on recovery. send or commit reply lost so it gets replayed.