From 61bf624c6dd5a999dc9dd1f900bffc6c4feb9fa1 Mon Sep 17 00:00:00 2001 From: jbonofre Date: Thu, 27 Feb 2020 20:34:56 +0100 Subject: [PATCH] [AMQ-7368] Add limitQuery in HSQL, MySQL and PostgreSQL JDBC adapters --- .../activemq/store/jdbc/adapter/HsqldbJDBCAdapter.java | 5 +++++ .../activemq/store/jdbc/adapter/MySqlJDBCAdapter.java | 6 ++++++ .../activemq/store/jdbc/adapter/OracleJDBCAdapter.java | 1 + .../activemq/store/jdbc/adapter/PostgresqlJDBCAdapter.java | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/HsqldbJDBCAdapter.java b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/HsqldbJDBCAdapter.java index 12d480fa07..eaebf8bd71 100644 --- a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/HsqldbJDBCAdapter.java +++ b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/HsqldbJDBCAdapter.java @@ -30,4 +30,9 @@ public class HsqldbJDBCAdapter extends BytesJDBCAdapter { super.setStatements(statements); } + @Override + public String limitQuery(String query) { + return query + " LIMIT " + getMaxRows(); + } + } diff --git a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java index dd93846ad4..8fb3d24551 100644 --- a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java +++ b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java @@ -96,4 +96,10 @@ public class MySqlJDBCAdapter extends DefaultJDBCAdapter { public void setTypeStatement(String typeStatement) { this.typeStatement = typeStatement; } + + @Override + public String limitQuery(String query) { + return query + " LIMIT " + getMaxRows(); + } + } 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 373ba584b0..c1fdac1250 100644 --- 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 @@ -48,4 +48,5 @@ public class OracleJDBCAdapter extends DefaultJDBCAdapter { public String limitQuery(String query) { return "SELECT * FROM (" + query + ") WHERE ROWNUM <= " + getMaxRows(); } + } diff --git a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/PostgresqlJDBCAdapter.java b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/PostgresqlJDBCAdapter.java index 733405998d..40fe9d37f4 100644 --- a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/PostgresqlJDBCAdapter.java +++ b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/adapter/PostgresqlJDBCAdapter.java @@ -54,4 +54,10 @@ public class PostgresqlJDBCAdapter extends BytesJDBCAdapter { public void setAcksPkName(String acksPkName) { this.acksPkName = acksPkName; } + + @Override + public String limitQuery(String query) { + return query + " LIMIT " + getMaxRows(); + } + }