1 22 23 package org.xquark.extractor.mysql.sql; 24 25 import org.xquark.extractor.sql.Context; 26 import org.xquark.extractor.sql.SqlExpression; 27 28 public class SqlIfThenElse extends org.xquark.extractor.sql.SqlIfThenElse 29 { 30 31 private static final String RCSRevision = "$Revision: 1.3 $"; 32 private static final String RCSName = "$Name: $"; 33 34 35 public SqlIfThenElse() { 36 } 37 38 public SqlIfThenElse(SqlExpression iif, SqlExpression tthen, SqlExpression eslse) { 39 super(iif, tthen, eslse); 40 } 41 42 43 public String toSql (Context context) 44 { 45 47 StringBuffer retVal = new StringBuffer (); 48 retVal.append("CASE WHEN ( "); 49 retVal.append(_if.toSql(context)); 50 retVal.append(") THEN ("); 51 retVal.append(_then.toSql(context)); 52 53 retVal.append(") ELSE ("); 54 retVal.append(_else.toSql(context)); 55 retVal.append(") END"); 56 57 return retVal.toString(); 59 } 60 } 61 | Popular Tags |