diff options
author | James Moger <james.moger@gmail.com> | 2011-08-17 08:02:23 -0400 |
---|---|---|
committer | James Moger <james.moger@gmail.com> | 2011-08-17 08:02:23 -0400 |
commit | 1734dc44d70391aeef26cacdf4d9f07c289e476e (patch) | |
tree | 6dedc021df14d8498c1166946f1ff760db37ceed /src/com/iciql/SQLDialectMySQL.java | |
parent | 265bb2eebd995af0445ce7bc37f066e43d7da287 (diff) | |
download | iciql-1734dc44d70391aeef26cacdf4d9f07c289e476e.tar.gz iciql-1734dc44d70391aeef26cacdf4d9f07c289e476e.zip |
Added support for PostgreSQL. Passes all but the boolean-as-int tests.
Diffstat (limited to 'src/com/iciql/SQLDialectMySQL.java')
-rw-r--r-- | src/com/iciql/SQLDialectMySQL.java | 39 |
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 ");
|