1 package org.hibernate.sql; 3 4 import java.util.Iterator ; 5 import java.util.Map ; 6 7 14 public class ANSICaseFragment extends CaseFragment { 15 16 public String toFragmentString() { 17 18 StringBuffer buf = new StringBuffer ( cases.size() * 15 + 10 ) 19 .append("case"); 20 21 Iterator iter = cases.entrySet().iterator(); 22 while ( iter.hasNext() ) { 23 Map.Entry me = (Map.Entry ) iter.next(); 24 buf.append(" when ") 25 .append( me.getKey() ) 26 .append(" is not null then ") 27 .append( me.getValue() ); 28 } 29 30 buf.append(" end"); 31 32 if (returnColumnName!=null) { 33 buf.append(" as ") 34 .append(returnColumnName); 35 } 36 37 return buf.toString(); 38 } 39 40 } | Popular Tags |