diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/iciql/Constants.java | 2 | ||||
-rw-r--r-- | src/main/java/com/iciql/SQLDialectDefault.java | 20 | ||||
-rw-r--r-- | src/main/java/com/iciql/SQLDialectDerby.java | 2 |
3 files changed, 14 insertions, 10 deletions
diff --git a/src/main/java/com/iciql/Constants.java b/src/main/java/com/iciql/Constants.java index 8b54493..a680dc5 100644 --- a/src/main/java/com/iciql/Constants.java +++ b/src/main/java/com/iciql/Constants.java @@ -25,7 +25,7 @@ public class Constants { // The build script extracts this exact line so be careful editing it
// and only use A-Z a-z 0-9 .-_ in the string.
- public static final String VERSION = "1.2.0-SNAPSHOT";
+ public static final String VERSION = "1.3.0-SNAPSHOT";
// The build script extracts this exact line so be careful editing it
// and only use A-Z a-z 0-9 .-_ in the string.
diff --git a/src/main/java/com/iciql/SQLDialectDefault.java b/src/main/java/com/iciql/SQLDialectDefault.java index 364db7b..e29d7b8 100644 --- a/src/main/java/com/iciql/SQLDialectDefault.java +++ b/src/main/java/com/iciql/SQLDialectDefault.java @@ -37,10 +37,12 @@ import com.iciql.util.StringUtils; * Default implementation of an SQL dialect.
*/
public class SQLDialectDefault implements SQLDialect {
-
+
final String LITERAL = "'";
float databaseVersion;
+ int databaseMajorVersion;
+ int databaseMinorVersion;
String databaseName;
String productVersion;
@@ -53,8 +55,10 @@ public class SQLDialectDefault implements SQLDialect { public void configureDialect(String databaseName, DatabaseMetaData data) {
this.databaseName = databaseName;
try {
- databaseVersion = Float.parseFloat(data.getDatabaseMajorVersion() + "."
- + data.getDatabaseMinorVersion());
+ databaseMajorVersion = data.getDatabaseMajorVersion();
+ databaseMinorVersion = data.getDatabaseMinorVersion();
+ databaseVersion = Float.parseFloat(databaseMajorVersion + "."
+ + databaseMinorVersion);
productVersion = data.getDatabaseProductVersion();
} catch (SQLException e) {
throw new IciqlException(e);
@@ -63,7 +67,7 @@ public class SQLDialectDefault implements SQLDialect { /**
* Allows subclasses to change the type of a column for a CREATE statement.
- *
+ *
* @param sqlType
* @return the SQL type or a preferred alternative
*/
@@ -202,10 +206,10 @@ public class SQLDialectDefault implements SQLDialect { buff.append(" WHERE ");
buff.append(where.toString());
}
-
+
prepareCreateView(stat, def, buff.toString());
}
-
+
@Override
public <T> void prepareCreateView(SQLStatement stat, TableDefinition<T> def, String fromWhere) {
StatementBuilder buff = new StatementBuilder();
@@ -221,7 +225,7 @@ public class SQLDialectDefault implements SQLDialect { buff.append(fromWhere);
stat.setSQL(buff.toString());
}
-
+
protected boolean isIntegerType(String dataType) {
if ("INT".equals(dataType)) {
return true;
@@ -328,7 +332,7 @@ public class SQLDialectDefault implements SQLDialect { stat.appendSQL(" OFFSET " + offset);
}
}
-
+
@Override
public String prepareParameter(Object o) {
if (o instanceof String) {
diff --git a/src/main/java/com/iciql/SQLDialectDerby.java b/src/main/java/com/iciql/SQLDialectDerby.java index f954a7c..99405b7 100644 --- a/src/main/java/com/iciql/SQLDialectDerby.java +++ b/src/main/java/com/iciql/SQLDialectDerby.java @@ -40,7 +40,7 @@ public class SQLDialectDerby extends SQLDialectDefault { @Override
public void appendLimitOffset(SQLStatement stat, long limit, long offset) {
// FETCH/OFFSET added in 10.5
- if (databaseVersion >= 10.5f) {
+ if (databaseMajorVersion >= 10 && databaseMinorVersion >= 5) {
if (offset > 0) {
stat.appendSQL(" OFFSET " + offset + (offset == 1 ? " ROW" : " ROWS"));
}
|