summaryrefslogtreecommitdiffstats
path: root/src/com/iciql/SQLDialectMySQL.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/iciql/SQLDialectMySQL.java')
-rw-r--r--src/com/iciql/SQLDialectMySQL.java39
1 files changed, 4 insertions, 35 deletions
diff --git a/src/com/iciql/SQLDialectMySQL.java b/src/com/iciql/SQLDialectMySQL.java
index 1c1674a..0b2acf4 100644
--- a/src/com/iciql/SQLDialectMySQL.java
+++ b/src/com/iciql/SQLDialectMySQL.java
@@ -17,7 +17,6 @@
package com.iciql;
import com.iciql.TableDefinition.FieldDefinition;
-import com.iciql.TableDefinition.IndexDefinition;
import com.iciql.util.StatementBuilder;
/**
@@ -34,52 +33,22 @@ public class SQLDialectMySQL extends SQLDialectDefault {
}
@Override
- public boolean supportsMemoryTables() {
- return false;
- }
-
- @Override
public String prepareColumnName(String name) {
return "`" + name + "`";
}
@Override
- protected boolean prepareColumnDefinition(StatementBuilder buff, boolean isAutoIncrement,
+ protected boolean prepareColumnDefinition(StatementBuilder buff, String dataType, boolean isAutoIncrement,
boolean isPrimaryKey) {
- if (isAutoIncrement) {
+ String convertedType = convertSqlType(dataType);
+ buff.append(convertedType);
+ if (isIntegerType(dataType) && isAutoIncrement) {
buff.append(" AUTO_INCREMENT");
}
return false;
}
@Override
- public void prepareCreateIndex(SQLStatement stat, String schema, String table, IndexDefinition index) {
- StatementBuilder buff = new StatementBuilder();
- buff.append("CREATE ");
- switch (index.type) {
- case STANDARD:
- break;
- case UNIQUE:
- buff.append("UNIQUE ");
- break;
- case UNIQUE_HASH:
- buff.append("UNIQUE ");
- break;
- }
- buff.append("INDEX ");
- buff.append(index.indexName);
- buff.append(" ON ");
- buff.append(table);
- buff.append("(");
- for (String col : index.columnNames) {
- buff.appendExceptFirst(", ");
- buff.append(prepareColumnName(col));
- }
- buff.append(") ");
- stat.setSQL(buff.toString().trim());
- }
-
- @Override
public <T> void prepareMerge(SQLStatement stat, String schemaName, String tableName,
TableDefinition<T> def, Object obj) {
StatementBuilder buff = new StatementBuilder("INSERT INTO ");