forked from dataease/dataease
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
1,175 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
backend/src/main/java/io/dataease/dto/datasource/Db2Configuration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package io.dataease.dto.datasource; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
@Getter | ||
@Setter | ||
public class Db2Configuration extends JdbcConfiguration { | ||
|
||
private String driver = "com.ibm.db2.jcc.DB2Driver"; | ||
private String extraParams = ""; | ||
|
||
public String getJdbc() { | ||
if(StringUtils.isEmpty(extraParams.trim())){ | ||
return "jdbc:db2://HOSTNAME:PORT/DATABASE" | ||
.replace("HOSTNAME", getHost().trim()) | ||
.replace("PORT", getPort().toString().trim()) | ||
.replace("DATABASE", getDataBase().trim()); | ||
}else { | ||
return "jdbc:hive2://HOSTNAME:PORT/DATABASE?EXTRA_PARAMS" | ||
.replace("HOSTNAME", getHost().trim()) | ||
.replace("PORT", getPort().toString().trim()) | ||
.replace("DATABASE", getDataBase().trim()) | ||
.replace("EXTRA_PARAMS", getExtraParams().trim()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
backend/src/main/java/io/dataease/provider/query/db2/Db2Constants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package io.dataease.provider.query.db2; | ||
|
||
import io.dataease.provider.query.SQLConstants; | ||
|
||
import static io.dataease.commons.constants.DatasourceTypes.db2; | ||
|
||
public class Db2Constants extends SQLConstants { | ||
public static final String KEYWORD_TABLE = db2.getKeywordPrefix() + "%s" + db2.getKeywordSuffix(); | ||
|
||
public static final String KEYWORD_FIX = "%s." + db2.getKeywordPrefix() + "%s" + db2.getKeywordSuffix(); | ||
|
||
public static final String UNIX_TIMESTAMP = "BIGINT(TIMESTAMPDIFF(2,CHAR(%s -TIMESTAMP('1970-01-01 08:00:00'))))"; | ||
|
||
public static final String DATE_FORMAT = "TO_CHAR(TIMESTAMP(%s),'%s')"; | ||
|
||
public static final String FROM_UNIXTIME = "TO_CHAR(TIMESTAMP('1970-01-01 08:00:00') +(%s)SECONDS, '%s')"; | ||
|
||
public static final String STR_TO_DATE = "timestamp(trim(char(%s)))"; | ||
|
||
public static final String CAST = "CAST(%s AS %s)"; | ||
|
||
public static final String DEFAULT_DATE_FORMAT = "YYYY-MM-DD HH24:MI:SS"; | ||
|
||
public static final String DEFAULT_INT_FORMAT = "BIGINT"; | ||
|
||
public static final String DEFAULT_FLOAT_FORMAT = "DECIMAL(20,2)"; | ||
|
||
public static final String WHERE_VALUE_NULL = "(NULL,'')"; | ||
|
||
public static final String WHERE_VALUE_VALUE = "'%s'"; | ||
|
||
public static final String AGG_COUNT = "COUNT(*)"; | ||
|
||
public static final String AGG_FIELD = "%s(%s)"; | ||
|
||
public static final String WHERE_BETWEEN = "'%s' AND '%s'"; | ||
|
||
public static final String BRACKETS = "(%s)"; | ||
} |
Oops, something went wrong.