summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-10-22 12:52:33 -0400
committerJames Moger <james.moger@gitblit.com>2014-10-22 22:29:00 -0400
commitcd036aa20930859fef51ed2fc4abc3d8cada5e3d (patch)
tree4c0cd3085ac371e9fc1a570d913ed063b1752055 /src
parent40ad76e1db008923cd089b0dde80590156fa0596 (diff)
downloadiciql-cd036aa20930859fef51ed2fc4abc3d8cada5e3d.tar.gz
iciql-cd036aa20930859fef51ed2fc4abc3d8cada5e3d.zip
Update dependencies
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/iciql/Constants.java2
-rw-r--r--src/main/java/com/iciql/SQLDialectDefault.java20
-rw-r--r--src/main/java/com/iciql/SQLDialectDerby.java2
-rw-r--r--src/test/java/com/iciql/test/IciqlSuite.java5
4 files changed, 17 insertions, 12 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"));
}
diff --git a/src/test/java/com/iciql/test/IciqlSuite.java b/src/test/java/com/iciql/test/IciqlSuite.java
index a26bf08..0273399 100644
--- a/src/test/java/com/iciql/test/IciqlSuite.java
+++ b/src/test/java/com/iciql/test/IciqlSuite.java
@@ -98,7 +98,8 @@ public class IciqlSuite {
private static final TestDb[] TEST_DBS = {
new TestDb("H2", true, true, "jdbc:h2:mem:iciql"),
- new TestDb("H2", true, false, "jdbc:h2:file:testdbs/h2/iciql"),
+ new TestDb("H2", true, false, "jdbc:h2:file:"
+ + new File(System.getProperty("user.dir")).getAbsolutePath() + "testdbs/h2/iciql"),
new TestDb("H2", false, false, "jdbc:h2:tcp://localhost/"
+ new File(System.getProperty("user.dir")).getAbsolutePath() + "/testdbs/h2tcp/iciql"),
new TestDb("HSQL", true, true, "jdbc:hsqldb:mem:iciql"),
@@ -106,7 +107,7 @@ public class IciqlSuite {
new TestDb("HSQL", false, false, "jdbc:hsqldb:hsql://localhost/iciql"),
new TestDb("Derby", true, true, "jdbc:derby:memory:iciql;create=true"),
new TestDb("Derby", true, false, "jdbc:derby:directory:testdbs/derby/iciql;create=true"),
- new TestDb("MySQL", false, false, "jdbc:mysql://localhost:7000/iciql", "sa", "sa"),
+ new TestDb("MySQL", false, false, "jdbc:mysql://localhost:3306/iciql", "sa", "sa"),
new TestDb("PostgreSQL", false, false, "jdbc:postgresql://localhost:5432/iciql", "sa", "sa") };
private static final TestDb DEFAULT_TEST_DB = TEST_DBS[0];