Comparison compCriteria ) throws TranslatorException {
Expression lExpr = compCriteria.getLeftExpression();
if (lExpr instanceof Function) {
parseFunction((Function)lExpr);
} else {
ColumnReference left = (ColumnReference)lExpr;
Column column = left.getMetadataObject();
String columnName = column.getNameInSource();
StringBuffer queryString = new StringBuffer();
queryString.append(column.getParent().getNameInSource());
queryString.append('.');
queryString.append(columnName).append(SPACE);
queryString.append(comparisonOperators.get(compCriteria.getOperator()));
queryString.append(' ');
Expression rExp = compCriteria.getRightExpression();
if(rExp instanceof Literal) {
Literal literal = (Literal)rExp;
if (column.getJavaType().equals(Boolean.class)) {
queryString.append(((Boolean)literal.getValue()).toString());
} else if (column.getJavaType().equals(java.sql.Timestamp.class)) {
Timestamp datetime = (java.sql.Timestamp)literal.getValue();
String value = Util.getSalesforceDateTimeFormat().format(datetime);
String zoneValue = Util.getTimeZoneOffsetFormat().format(datetime);
queryString.append(value).append(zoneValue.subSequence(0, 3)).append(':').append(zoneValue.subSequence(3, 5));
} else if (column.getJavaType().equals(java.sql.Time.class)) {
String value = Util.getSalesforceDateTimeFormat().format((java.sql.Time)literal.getValue());
queryString.append(value);
} else if (column.getJavaType().equals(java.sql.Date.class)) {
String value = Util.getSalesforceDateFormat().format((java.sql.Date)literal.getValue());
queryString.append(value);
} else {
queryString.append(compCriteria.getRightExpression().toString());
}
} else if(rExp instanceof ColumnReference) {
ColumnReference right = (ColumnReference)lExpr;
column = left.getMetadataObject();
columnName = column.getNameInSource();
queryString.append(columnName);
}