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