resolve https://issues.apache.org/activemq/browse/AMQ-2857 apply variant of patch to support mysql 5.5 -introduce typeStatement default to ENGING can be set to TYPE, thanks

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@985151 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2010-08-13 10:21:15 +00:00
parent 784b93df4d
commit 72278d5e0f
1 changed files with 12 additions and 3 deletions

View File

@ -40,6 +40,7 @@ public class MySqlJDBCAdapter extends DefaultJDBCAdapter {
public static final String HEAP = "HEAP"; public static final String HEAP = "HEAP";
String engineType = INNODB; String engineType = INNODB;
String typeStatement = "ENGINE";
public void setStatements(Statements statements) { public void setStatements(Statements statements) {
String type = engineType.toUpperCase(); String type = engineType.toUpperCase();
@ -51,17 +52,17 @@ public class MySqlJDBCAdapter extends DefaultJDBCAdapter {
statements.setBinaryDataType("LONGBLOB"); statements.setBinaryDataType("LONGBLOB");
String typeClause = " TYPE="+type; String typeClause = typeStatement + "=" + type;
if( type.equals(NDBCLUSTER) ) { if( type.equals(NDBCLUSTER) ) {
// in the NDBCLUSTER case we will create as INNODB and then alter to NDBCLUSTER // in the NDBCLUSTER case we will create as INNODB and then alter to NDBCLUSTER
typeClause = " TYPE="+INNODB; typeClause = typeStatement + "=" + INNODB;
} }
// Update the create statements so they use the right type of engine // Update the create statements so they use the right type of engine
String[] s = statements.getCreateSchemaStatements(); String[] s = statements.getCreateSchemaStatements();
for (int i = 0; i < s.length; i++) { for (int i = 0; i < s.length; i++) {
if( s[i].startsWith("CREATE TABLE")) { if( s[i].startsWith("CREATE TABLE")) {
s[i] = s[i]+typeClause; s[i] = s[i]+ " " + typeClause;
} }
} }
@ -86,4 +87,12 @@ public class MySqlJDBCAdapter extends DefaultJDBCAdapter {
public void setEngineType(String engineType) { public void setEngineType(String engineType) {
this.engineType = engineType; this.engineType = engineType;
} }
public String getTypeStatement() {
return typeStatement;
}
public void setTypeStatement(String typeStatement) {
this.typeStatement = typeStatement;
}
} }