Ejemplo n.º 1
0
 @Override
 public String export() {
   if (expression == null) {
     return "ON " + fullKeyspace;
   } else {
     if (additionalExpressions == null || additionalExpressions.length == 0) {
       return "ON " + fullKeyspace + "(" + expression.toString() + ")";
     } else {
       StringBuilder on = new StringBuilder("ON ");
       on.append(fullKeyspace).append('(').append(expression);
       for (Expression additionalExpression : additionalExpressions) {
         on.append(", ").append(additionalExpression.toString());
       }
       on.append(')');
       return on.toString();
     }
   }
 }
Ejemplo n.º 2
0
 @Override
 public Expression end() {
   StringBuilder result = new StringBuilder("CASE ");
   if (caseExpression != null) {
     result.append(caseExpression.toString()).append(' ');
   }
   for (int i = 0; i < count; i++) {
     result
         .append("WHEN ")
         .append(whens.get(i))
         .append(" THEN ")
         .append(thens.get(i))
         .append(", ");
   }
   result.delete(result.length() - 2, result.length());
   if (elseResult != null) {
     result.append(" ELSE ").append(elseResult.toString());
   }
   result.append(" END");
   return x(result.toString());
 }
Ejemplo n.º 3
0
 @Override
 public ThenClause when(Expression conditionOrExpression) {
   whens.add(conditionOrExpression);
   thens.add(Expression.NULL());
   return this;
 }