Search in sources :

Example 1 with DB2DbmsLanguage

use of org.talend.dq.dbms.DB2DbmsLanguage in project tdq-studio-se by Talend.

the class FunctionFrequencyStatExplorer method getInstantiatedClause.

@Override
protected String getInstantiatedClause() {
    // get function which convert data into a pattern
    String colName = columnName;
    String function = null;
    TdColumn column = (TdColumn) indicator.getAnalyzedElement();
    int javaType = column.getSqlDataType().getJavaDataType();
    if (!Java2SqlType.isNumbericInSQL(javaType)) {
        function = getFunction();
    } else {
        colName = columnNameConvert();
    }
    // MOD mzhao bug 9681 2009-11-09
    Object value = null;
    if (Java2SqlType.isNumbericInSQL(javaType) && dbmsLanguage instanceof DB2DbmsLanguage) {
        value = entity.getKey();
    } else {
        // $NON-NLS-1$//$NON-NLS-2$
        value = "'" + entity.getKey() + "'";
    }
    String clause = entity.isLabelNull() ? columnName + dbmsLanguage.isNull() : ((function == null ? colName : function) + dbmsLanguage.equal() + value);
    // ADD xqliu 2011-06-03 bug 20600's note 86482
    if (dbmsLanguage instanceof InfomixDbmsLanguage) {
        clause = clause.replaceAll(InfomixDbmsLanguage.AS_REPLACE_COLUMN, PluginConstant.EMPTY_STRING);
    }
    // ~ 20600
    return clause;
}
Also used : TdColumn(org.talend.cwm.relational.TdColumn) InfomixDbmsLanguage(org.talend.dq.dbms.InfomixDbmsLanguage) DB2DbmsLanguage(org.talend.dq.dbms.DB2DbmsLanguage)

Example 2 with DB2DbmsLanguage

use of org.talend.dq.dbms.DB2DbmsLanguage in project tdq-studio-se by Talend.

the class FrequencyStatisticsExplorer method getInstantiatedClause.

/**
 * Method "getInstantiatedClause".
 *
 * @return the where clause from the instantiated query
 */
protected String getInstantiatedClause() {
    // get function which convert data into a pattern
    TdColumn column = (TdColumn) indicator.getAnalyzedElement();
    int javaType = column.getSqlDataType().getJavaDataType();
    // MOD mzhao bug 9681 2009-11-09
    Object value = null;
    if (Java2SqlType.isNumbericInSQL(javaType) && dbmsLanguage instanceof DB2DbmsLanguage) {
        value = entity.getKey();
    } else if (Java2SqlType.isNumbericInSQL(javaType) && dbmsLanguage instanceof SybaseASEDbmsLanguage) {
        value = entity.getKey();
    } else if (Java2SqlType.isNumbericInSQL(javaType) && dbmsLanguage instanceof HiveDbmsLanguage) {
        value = entity.getKey();
    } else {
        // $NON-NLS-1$ //$NON-NLS-2$
        value = "'" + entity.getKey() + "'";
    }
    String clause = entity.isLabelNull() ? columnName + dbmsLanguage.isNull() : columnName + dbmsLanguage.equal() + value;
    return clause;
}
Also used : HiveDbmsLanguage(org.talend.dq.dbms.HiveDbmsLanguage) TdColumn(org.talend.cwm.relational.TdColumn) SybaseASEDbmsLanguage(org.talend.dq.dbms.SybaseASEDbmsLanguage) DB2DbmsLanguage(org.talend.dq.dbms.DB2DbmsLanguage)

Aggregations

TdColumn (org.talend.cwm.relational.TdColumn)2 DB2DbmsLanguage (org.talend.dq.dbms.DB2DbmsLanguage)2 HiveDbmsLanguage (org.talend.dq.dbms.HiveDbmsLanguage)1 InfomixDbmsLanguage (org.talend.dq.dbms.InfomixDbmsLanguage)1 SybaseASEDbmsLanguage (org.talend.dq.dbms.SybaseASEDbmsLanguage)1