activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
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 GMT
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<String> l = new ArrayList<String>(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);
     }
 



Mime
View raw message