You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tasks/astrid/common-src/com/todoroo/andlib/sql/Functions.java

17 lines
478 B
Java

package com.todoroo.andlib.sql;
@SuppressWarnings("nls")
public final class Functions {
public static String caseStatement(Criterion when, Object ifTrue, Object ifFalse) {
return new StringBuilder("CASE WHEN ").
append(when.toString()).append(" THEN ").append(value(ifTrue)).
append(" ELSE ").append(value(ifFalse)).append(" END").toString();
}
private static String value(Object value) {
return value.toString();
}
}