From 95b34d5f2b7cf1c5d3a784b2fb32654637f55dca Mon Sep 17 00:00:00 2001 From: James Strachan Date: Wed, 7 Mar 2007 15:29:01 +0000 Subject: [PATCH] fix for AMQ-1191 and AMQ-1109 git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@515606 13f79535-47bb-0310-9956-ffa450edef68 --- .../jdbc/adapter/TransactJDBCAdapter.java | 39 +++++++++++++++++++ .../activemq/store/jdbc/i-net_sprinta_2000 | 2 +- .../store/jdbc/jconnect__tm__for_jdbc__tm_ | 2 +- ...4_jdbc_driver_for_ms_sql_server_and_sybase | 2 +- .../org/apache/activemq/store/jdbc/sqlserver | 2 +- 5 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/TransactJDBCAdapter.java diff --git a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/TransactJDBCAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/TransactJDBCAdapter.java new file mode 100644 index 0000000000..279e88bc6c --- /dev/null +++ b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/TransactJDBCAdapter.java @@ -0,0 +1,39 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.store.jdbc.adapter; + +import org.apache.activemq.store.jdbc.Statements; + +/** + * A JDBC Adapter for Transact-SQL based databases such as SQL Server or Sybase + * + * @version $Revision$ + */ +public class TransactJDBCAdapter extends ImageBasedJDBCAdaptor { + public void setStatements(Statements statements) { + String lockCreateStatement = "SELECT * FROM " + statements.getFullLockTableName(); + + if (statements.isUseLockCreateWhereClause()) { + lockCreateStatement += " WHERE ID = 1"; + } + lockCreateStatement += " WITH XLOCK"; + statements.setLockCreateStatement(lockCreateStatement); + + super.setStatements(statements); + } +} diff --git a/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/i-net_sprinta_2000 b/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/i-net_sprinta_2000 index 4feace8c4b..fb484bfa15 100644 --- a/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/i-net_sprinta_2000 +++ b/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/i-net_sprinta_2000 @@ -1 +1 @@ -class=org.apache.activemq.store.jdbc.adapter.ImageBasedJDBCAdaptor \ No newline at end of file +class=org.apache.activemq.store.jdbc.adapter.TransactJDBCAdapter \ No newline at end of file diff --git a/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/jconnect__tm__for_jdbc__tm_ b/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/jconnect__tm__for_jdbc__tm_ index 4feace8c4b..fb484bfa15 100644 --- a/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/jconnect__tm__for_jdbc__tm_ +++ b/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/jconnect__tm__for_jdbc__tm_ @@ -1 +1 @@ -class=org.apache.activemq.store.jdbc.adapter.ImageBasedJDBCAdaptor \ No newline at end of file +class=org.apache.activemq.store.jdbc.adapter.TransactJDBCAdapter \ No newline at end of file diff --git a/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/jtds_type_4_jdbc_driver_for_ms_sql_server_and_sybase b/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/jtds_type_4_jdbc_driver_for_ms_sql_server_and_sybase index 4feace8c4b..fb484bfa15 100644 --- a/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/jtds_type_4_jdbc_driver_for_ms_sql_server_and_sybase +++ b/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/jtds_type_4_jdbc_driver_for_ms_sql_server_and_sybase @@ -1 +1 @@ -class=org.apache.activemq.store.jdbc.adapter.ImageBasedJDBCAdaptor \ No newline at end of file +class=org.apache.activemq.store.jdbc.adapter.TransactJDBCAdapter \ No newline at end of file diff --git a/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/sqlserver b/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/sqlserver index 4feace8c4b..fb484bfa15 100644 --- a/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/sqlserver +++ b/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/sqlserver @@ -1 +1 @@ -class=org.apache.activemq.store.jdbc.adapter.ImageBasedJDBCAdaptor \ No newline at end of file +class=org.apache.activemq.store.jdbc.adapter.TransactJDBCAdapter \ No newline at end of file