diff options
Diffstat (limited to 'src/com/iciql/SQLDialectMySQL.java')
-rw-r--r-- | src/com/iciql/SQLDialectMySQL.java | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/src/com/iciql/SQLDialectMySQL.java b/src/com/iciql/SQLDialectMySQL.java index 837d77b..2593e0a 100644 --- a/src/com/iciql/SQLDialectMySQL.java +++ b/src/com/iciql/SQLDialectMySQL.java @@ -16,7 +16,6 @@ package com.iciql;
-import com.iciql.TableDefinition.FieldDefinition;
import com.iciql.TableDefinition.IndexDefinition;
import com.iciql.util.StatementBuilder;
@@ -26,13 +25,16 @@ import com.iciql.util.StatementBuilder; public class SQLDialectMySQL extends SQLDialectDefault {
@Override
- public boolean supportsMemoryTables() {
- return false;
+ protected String convertSqlType(String sqlType) {
+ if (sqlType.equals("CLOB")) {
+ return "TEXT";
+ }
+ return sqlType;
}
-
+
@Override
- public boolean supportsMerge() {
- return true;
+ public boolean supportsMemoryTables() {
+ return false;
}
@Override
@@ -41,7 +43,15 @@ public class SQLDialectMySQL extends SQLDialectDefault { }
@Override
- public String prepareCreateIndex(String schema, String table, IndexDefinition index) {
+ protected boolean prepareColumnDefinition(StatementBuilder buff, boolean isAutoIncrement, boolean isPrimaryKey) {
+ if (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) {
@@ -74,26 +84,6 @@ public class SQLDialectMySQL extends SQLDialectDefault { buff.append("USING HASH");
break;
}
- return buff.toString().trim();
- }
-
- @Override
- public <T> void prepareMerge(SQLStatement stat, String schemaName, String tableName, TableDefinition<T> def, Object obj) {
- StatementBuilder buff = new StatementBuilder("REPLACE INTO ");
- buff.append(prepareTableName(schemaName, tableName)).append('(');
- for (FieldDefinition field : def.fields) {
- buff.appendExceptFirst(", ");
- buff.append(prepareColumnName(field.columnName));
- }
- buff.append(") VALUES(");
- buff.resetCount();
- for (FieldDefinition field : def.fields) {
- buff.appendExceptFirst(", ");
- buff.append('?');
- Object value = def.getValue(obj, field);
- stat.addParameter(value);
- }
- buff.append(')');
- stat.setSQL(buff.toString());
+ stat.setSQL(buff.toString().trim());
}
}
\ No newline at end of file |