diff options
Diffstat (limited to 'src/main/java/com/iciql/SQLDialectDerby.java')
-rw-r--r-- | src/main/java/com/iciql/SQLDialectDerby.java | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/src/main/java/com/iciql/SQLDialectDerby.java b/src/main/java/com/iciql/SQLDialectDerby.java index 99405b7..77fc73e 100644 --- a/src/main/java/com/iciql/SQLDialectDerby.java +++ b/src/main/java/com/iciql/SQLDialectDerby.java @@ -23,49 +23,49 @@ import com.iciql.util.StatementBuilder; */
public class SQLDialectDerby extends SQLDialectDefault {
- @Override
- public Class<? extends java.util.Date> getDateTimeClass() {
- return java.sql.Timestamp.class;
- }
+ @Override
+ public Class<? extends java.util.Date> getDateTimeClass() {
+ return java.sql.Timestamp.class;
+ }
- @Override
- public String convertSqlType(String sqlType) {
- if ("TINYINT".equals(sqlType)) {
- // Derby does not have a TINYINT/BYTE type
- return "SMALLINT";
- }
- return sqlType;
- }
+ @Override
+ public String convertSqlType(String sqlType) {
+ if ("TINYINT".equals(sqlType)) {
+ // Derby does not have a TINYINT/BYTE type
+ return "SMALLINT";
+ }
+ return sqlType;
+ }
- @Override
- public void appendLimitOffset(SQLStatement stat, long limit, long offset) {
- // FETCH/OFFSET added in 10.5
- if (databaseMajorVersion >= 10 && databaseMinorVersion >= 5) {
- if (offset > 0) {
- stat.appendSQL(" OFFSET " + offset + (offset == 1 ? " ROW" : " ROWS"));
- }
- if (limit > 0) {
- stat.appendSQL(" FETCH NEXT " + limit + (limit == 1 ? " ROW" : " ROWS") + " ONLY");
- }
- }
- }
+ @Override
+ public void appendLimitOffset(SQLStatement stat, long limit, long offset) {
+ // FETCH/OFFSET added in 10.5
+ if (databaseMajorVersion >= 10 && databaseMinorVersion >= 5) {
+ if (offset > 0) {
+ stat.appendSQL(" OFFSET " + offset + (offset == 1 ? " ROW" : " ROWS"));
+ }
+ if (limit > 0) {
+ stat.appendSQL(" FETCH NEXT " + limit + (limit == 1 ? " ROW" : " ROWS") + " ONLY");
+ }
+ }
+ }
- @Override
- protected boolean prepareColumnDefinition(StatementBuilder buff, String dataType,
- boolean isAutoIncrement, boolean isPrimaryKey) {
- String convertedType = convertSqlType(dataType);
- buff.append(convertedType);
- if (isIntegerType(dataType) && isAutoIncrement) {
- buff.append(" GENERATED BY DEFAULT AS IDENTITY");
- }
- return false;
- }
+ @Override
+ protected boolean prepareColumnDefinition(StatementBuilder buff, String dataType,
+ boolean isAutoIncrement, boolean isPrimaryKey) {
+ String convertedType = convertSqlType(dataType);
+ buff.append(convertedType);
+ if (isIntegerType(dataType) && isAutoIncrement) {
+ buff.append(" GENERATED BY DEFAULT AS IDENTITY");
+ }
+ return false;
+ }
- @Override
- public <T> void prepareDropTable(SQLStatement stat, TableDefinition<T> def) {
- StatementBuilder buff = new StatementBuilder("DROP TABLE "
- + prepareTableName(def.schemaName, def.tableName));
- stat.setSQL(buff.toString());
- return;
- }
+ @Override
+ public <T> void prepareDropTable(SQLStatement stat, TableDefinition<T> def) {
+ StatementBuilder buff = new StatementBuilder("DROP TABLE "
+ + prepareTableName(def.schemaName, def.tableName));
+ stat.setSQL(buff.toString());
+ return;
+ }
}
\ No newline at end of file |