Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 60146 invoked from network); 29 Sep 2009 17:06:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 29 Sep 2009 17:06:39 -0000 Received: (qmail 49313 invoked by uid 500); 29 Sep 2009 17:06:39 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 49279 invoked by uid 500); 29 Sep 2009 17:06:39 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 49270 invoked by uid 99); 29 Sep 2009 17:06:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Sep 2009 17:06:39 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Sep 2009 17:06:37 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 84479238887A; Tue, 29 Sep 2009 17:06:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r820031 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java Date: Tue, 29 Sep 2009 17:06:17 -0000 To: commits@activemq.apache.org From: chirino@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090929170617.84479238887A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: chirino Date: Tue Sep 29 17:06:17 2009 New Revision: 820031 URL: http://svn.apache.org/viewvc?rev=820031&view=rev Log: Still working on AMQ-2414.. hopefullly this resolves the auto creation of MySQL Cluster tables. Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java?rev=820031&r1=820030&r2=820031&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/MySqlJDBCAdapter.java Tue Sep 29 17:06:17 2009 @@ -16,6 +16,9 @@ */ package org.apache.activemq.store.jdbc.adapter; +import java.util.ArrayList; +import java.util.Arrays; + import org.apache.activemq.store.jdbc.Statements; /** @@ -47,13 +50,32 @@ statements.setBinaryDataType("LONGBLOB"); + + String typeClause = " TYPE="+type; + if( type.equals(NDBCLUSTER) ) { + // in the NDBCLUSTER case we will create as INNODB and then alter to NDBCLUSTER + typeClause = " TYPE="+INNODB; + } + // Update the create statements so they use the right type of engine String[] s = statements.getCreateSchemaStatements(); for (int i = 0; i < s.length; i++) { if( s[i].startsWith("CREATE TABLE")) { - s[i] = s[i]+" TYPE="+type; + s[i] = s[i]+typeClause; } } + + if( type.equals(NDBCLUSTER) ) { + // Add the alter statements. + ArrayList l = new ArrayList(Arrays.asList(s)); + l.add("ALTER TABLE "+statements.getFullMessageTableName()+" ENGINE="+NDBCLUSTER); + l.add("ALTER TABLE "+statements.getFullAckTableName()+" ENGINE="+NDBCLUSTER); + l.add("ALTER TABLE "+statements.getFullLockTableName()+" ENGINE="+NDBCLUSTER); + l.add("FLUSH TABLES"); + s = l.toArray(new String[l.size()]); + statements.setCreateSchemaStatements(s); + } + super.setStatements(statements); }