aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-11-10 21:36:47 -0500
committerJames Moger <james.moger@gitblit.com>2014-11-10 21:46:37 -0500
commitcfb76669820f13cf52342988fbc5882c8077db7e (patch)
treee2114c01bf179aada815760a708cfb66ffaf4bc9 /src
parent3d833d8f7523fc1187b767cb2ab0602dcb5b67c8 (diff)
downloadiciql-cfb76669820f13cf52342988fbc5882c8077db7e.tar.gz
iciql-cfb76669820f13cf52342988fbc5882c8077db7e.zip
Fix SQLite INTEGER PRIMARY KEY AUTOINCREMENT mapping
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/iciql/SQLDialectDefault.java6
-rw-r--r--src/main/java/com/iciql/SQLDialectSQLite.java23
2 files changed, 28 insertions, 1 deletions
diff --git a/src/main/java/com/iciql/SQLDialectDefault.java b/src/main/java/com/iciql/SQLDialectDefault.java
index d8a9ebd..7c656bd 100644
--- a/src/main/java/com/iciql/SQLDialectDefault.java
+++ b/src/main/java/com/iciql/SQLDialectDefault.java
@@ -337,12 +337,16 @@ public class SQLDialectDefault implements SQLDialect {
protected boolean isIntegerType(String dataType) {
if ("INT".equals(dataType)) {
return true;
- } else if ("BIGINT".equals(dataType)) {
+ } else if ("INTEGER".equals(dataType)) {
return true;
} else if ("TINYINT".equals(dataType)) {
return true;
} else if ("SMALLINT".equals(dataType)) {
return true;
+ } else if ("MEDIUMINT".equals(dataType)) {
+ return true;
+ } else if ("BIGINT".equals(dataType)) {
+ return true;
}
return false;
}
diff --git a/src/main/java/com/iciql/SQLDialectSQLite.java b/src/main/java/com/iciql/SQLDialectSQLite.java
index c9bf8ec..4234e9f 100644
--- a/src/main/java/com/iciql/SQLDialectSQLite.java
+++ b/src/main/java/com/iciql/SQLDialectSQLite.java
@@ -50,6 +50,29 @@ public class SQLDialectSQLite extends SQLDialectDefault {
}
@Override
+ public String convertSqlType(String sqlType) {
+ if (isIntegerType(sqlType)) {
+ return "INTEGER";
+ }
+ return sqlType;
+ }
+
+ @Override
+ protected boolean prepareColumnDefinition(StatementBuilder buff, String dataType,
+ boolean isAutoIncrement, boolean isPrimaryKey) {
+ String convertedType = convertSqlType(dataType);
+ buff.append(convertedType);
+ if (isPrimaryKey) {
+ buff.append(" PRIMARY KEY");
+ if (isAutoIncrement) {
+ buff.append(" AUTOINCREMENT");
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @Override
public <T> void prepareDropView(SQLStatement stat, TableDefinition<T> def) {
StatementBuilder buff = new StatementBuilder("DROP VIEW IF EXISTS "
+ prepareTableName(def.schemaName, def.tableName));