Class DefaultDialect
- java.lang.Object
-
- org.dashbuilder.dataprovider.sql.dialect.DefaultDialect
-
- All Implemented Interfaces:
Dialect
- Direct Known Subclasses:
DB2Dialect,H2Dialect,MonetDBDialect,MySQLDialect,OracleDialect,PostgresDialect,SQLServerDialect,SybaseASEDialect
public class DefaultDialect extends Object implements Dialect
-
-
Constructor Summary
Constructors Constructor Description DefaultDialect()
-
Method Summary
-
-
-
Method Detail
-
getExcludedColumns
public String[] getExcludedColumns()
- Specified by:
getExcludedColumnsin interfaceDialect
-
getColumnSQL
public String getColumnSQL(Column column)
- Specified by:
getColumnSQLin interfaceDialect
-
getColumnTypeSQL
public String getColumnTypeSQL(Column column)
- Specified by:
getColumnTypeSQLin interfaceDialect
-
convertToString
public String convertToString(Object value)
- Specified by:
convertToStringin interfaceDialect
-
convertToDouble
public Double convertToDouble(Object value)
- Specified by:
convertToDoublein interfaceDialect
-
convertToDate
public Date convertToDate(Object value)
- Specified by:
convertToDatein interfaceDialect
-
getTableSQL
public String getTableSQL(SQLStatement<?> stmt)
- Specified by:
getTableSQLin interfaceDialect
-
getTableNameSQL
public String getTableNameSQL(String name)
- Specified by:
getTableNameSQLin interfaceDialect
-
getSchemaNameSQL
public String getSchemaNameSQL(String name)
- Specified by:
getSchemaNameSQLin interfaceDialect
-
getSimpleColumnSQL
public String getSimpleColumnSQL(SimpleColumn column)
- Specified by:
getSimpleColumnSQLin interfaceDialect
-
getFunctionColumnSQL
public String getFunctionColumnSQL(FunctionColumn column)
- Specified by:
getFunctionColumnSQLin interfaceDialect
-
getLowerFunctionSQL
public String getLowerFunctionSQL(Column column)
- Specified by:
getLowerFunctionSQLin interfaceDialect
-
getConcatFunctionSQL
public String getConcatFunctionSQL(Column[] columns)
- Specified by:
getConcatFunctionSQLin interfaceDialect
-
getConcatFunctionSQL
public String getConcatFunctionSQL(Column[] columns, String begin, String end, String separator)
-
getDatePartFunctionSQL
public String getDatePartFunctionSQL(String part, Column column)
- Specified by:
getDatePartFunctionSQLin interfaceDialect
-
getSortColumnSQL
public String getSortColumnSQL(SortColumn sortColumn)
- Specified by:
getSortColumnSQLin interfaceDialect
-
getSortOrderSQL
public String getSortOrderSQL(org.dashbuilder.dataset.sort.SortOrder order)
- Specified by:
getSortOrderSQLin interfaceDialect
-
getDynamicDateColumnSQL
public String getDynamicDateColumnSQL(DynamicDateColumn column)
The text conversion of a date column is very DB specific. A mechanism combining concat and extract functions is used by default. Depending on the DB dialect a more polished approach can be used. For instance,- In Oracle and Postgres the 'to_char' function is used.
- In Mysql, 'date_format'
- In H2, the 'to_char' function is not used as it's only available since version 1.3.175 and we do need to support older versions.
- Specified by:
getDynamicDateColumnSQLin interfaceDialect
-
toChar
public Column toChar(DynamicDateColumn column)
-
getFixedDateColumnSQL
public String getFixedDateColumnSQL(FixedDateColumn column)
- Specified by:
getFixedDateColumnSQLin interfaceDialect
-
getColumnNameSQL
public String getColumnNameSQL(String name)
- Specified by:
getColumnNameSQLin interfaceDialect
-
getColumnNameQuotedSQL
public String getColumnNameQuotedSQL(String name)
- Specified by:
getColumnNameQuotedSQLin interfaceDialect
-
getAliasForColumnSQL
public String getAliasForColumnSQL(String alias)
- Specified by:
getAliasForColumnSQLin interfaceDialect
-
getAliasForStatementSQL
public String getAliasForStatementSQL(String alias)
- Specified by:
getAliasForStatementSQLin interfaceDialect
-
getConditionSQL
public String getConditionSQL(Condition condition)
- Specified by:
getConditionSQLin interfaceDialect
-
getCoreConditionSQL
public String getCoreConditionSQL(CoreCondition condition)
- Specified by:
getCoreConditionSQLin interfaceDialect
-
getNotNullConditionSQL
public String getNotNullConditionSQL(String column)
- Specified by:
getNotNullConditionSQLin interfaceDialect
-
getIsNullConditionSQL
public String getIsNullConditionSQL(String column)
- Specified by:
getIsNullConditionSQLin interfaceDialect
-
getIsEqualsToConditionSQL
public String getIsEqualsToConditionSQL(String column, Object param)
- Specified by:
getIsEqualsToConditionSQLin interfaceDialect
-
getNotEqualsToConditionSQL
public String getNotEqualsToConditionSQL(String column, Object param)
- Specified by:
getNotEqualsToConditionSQLin interfaceDialect
-
getLikeToConditionSQL
public String getLikeToConditionSQL(String column, Object param)
- Specified by:
getLikeToConditionSQLin interfaceDialect
-
getGreaterThanConditionSQL
public String getGreaterThanConditionSQL(String column, Object param)
- Specified by:
getGreaterThanConditionSQLin interfaceDialect
-
getGreaterOrEqualsConditionSQL
public String getGreaterOrEqualsConditionSQL(String column, Object param)
- Specified by:
getGreaterOrEqualsConditionSQLin interfaceDialect
-
getLowerThanConditionSQL
public String getLowerThanConditionSQL(String column, Object param)
- Specified by:
getLowerThanConditionSQLin interfaceDialect
-
getLowerOrEqualsConditionSQL
public String getLowerOrEqualsConditionSQL(String column, Object param)
- Specified by:
getLowerOrEqualsConditionSQLin interfaceDialect
-
getBetweenConditionSQL
public String getBetweenConditionSQL(String column, Object from, Object to)
- Specified by:
getBetweenConditionSQLin interfaceDialect
-
getInConditionSQL
public String getInConditionSQL(String column, Object param)
- Specified by:
getInConditionSQLin interfaceDialect
-
getNotInConditionSQL
public String getNotInConditionSQL(String column, Object param)
- Specified by:
getNotInConditionSQLin interfaceDialect
-
getParameterSQL
public String getParameterSQL(Object param)
- Specified by:
getParameterSQLin interfaceDialect
-
getNumberParameterSQL
public String getNumberParameterSQL(Number param)
- Specified by:
getNumberParameterSQLin interfaceDialect
-
getDateParameterSQL
public String getDateParameterSQL(Date param)
- Specified by:
getDateParameterSQLin interfaceDialect
-
getStringParameterSQL
public String getStringParameterSQL(String param)
- Specified by:
getStringParameterSQLin interfaceDialect
-
getLogicalConditionSQL
public String getLogicalConditionSQL(LogicalCondition condition)
- Specified by:
getLogicalConditionSQLin interfaceDialect
-
getNotExprConditionSQL
public String getNotExprConditionSQL(Condition condition)
- Specified by:
getNotExprConditionSQLin interfaceDialect
-
getAndExprConditionSQL
public String getAndExprConditionSQL(Condition[] conditions)
- Specified by:
getAndExprConditionSQLin interfaceDialect
-
getOrExprConditionSQL
public String getOrExprConditionSQL(Condition[] conditions)
- Specified by:
getOrExprConditionSQLin interfaceDialect
-
_getLogicalExprConditionSQL
protected String _getLogicalExprConditionSQL(Condition[] conditions, String op)
-
getColumnFunctionSQL
public String getColumnFunctionSQL(String column, org.dashbuilder.dataset.group.AggregateFunctionType function)
- Specified by:
getColumnFunctionSQLin interfaceDialect
-
getCountQuerySQL
public String getCountQuerySQL(Select select)
- Specified by:
getCountQuerySQLin interfaceDialect
-
getSQL
public String getSQL(CreateTable create)
-
getSelectSQL
public String getSelectSQL(Select select)
- Specified by:
getSelectSQLin interfaceDialect
-
getFromSQL
public String getFromSQL(Select select)
- Specified by:
getFromSQLin interfaceDialect
-
getWhereSQL
public String getWhereSQL(Select select)
- Specified by:
getWhereSQLin interfaceDialect
-
getWhereSQL
public String getWhereSQL(Delete delete)
- Specified by:
getWhereSQLin interfaceDialect
-
getGroupBySQL
public String getGroupBySQL(Select select)
- Specified by:
getGroupBySQLin interfaceDialect
-
getOrderBySQL
public String getOrderBySQL(Select select)
- Specified by:
getOrderBySQLin interfaceDialect
-
getOffsetLimitSQL
public String getOffsetLimitSQL(Select select)
- Specified by:
getOffsetLimitSQLin interfaceDialect
-
getSelectStatement
public String getSelectStatement(Select select)
- Specified by:
getSelectStatementin interfaceDialect
-
getInsertStatement
public String getInsertStatement(Insert insert)
- Specified by:
getInsertStatementin interfaceDialect
-
getDeleteStatement
public String getDeleteStatement(Delete delete)
- Specified by:
getDeleteStatementin interfaceDialect
-
getFromStatement
public String getFromStatement(Select select)
- Specified by:
getFromStatementin interfaceDialect
-
getWhereStatement
public String getWhereStatement(Select select)
- Specified by:
getWhereStatementin interfaceDialect
-
getWhereStatement
public String getWhereStatement(Delete delete)
- Specified by:
getWhereStatementin interfaceDialect
-
getGroupByStatement
public String getGroupByStatement(Select select)
- Specified by:
getGroupByStatementin interfaceDialect
-
getOrderByStatement
public String getOrderByStatement(Select select)
- Specified by:
getOrderByStatementin interfaceDialect
-
allowAliasInStatements
public boolean allowAliasInStatements()
-
-