001    /**
002     * Implements the CFML Function quotedvaluelist
003     */
004    package railo.runtime.functions.other;
005    
006    import railo.runtime.PageContext;
007    import railo.runtime.exp.PageException;
008    import railo.runtime.functions.query.ValueList;
009    import railo.runtime.op.Caster;
010    import railo.runtime.type.QueryColumn;
011    
012    public final class QuotedValueList extends ValueList {
013    
014            private static final long serialVersionUID = -6617432857065704955L;
015    
016            public static String call(PageContext pc , String strQueryColumn) throws PageException {
017                    return call(pc, toColumn(pc,strQueryColumn), ",");
018            }
019            public static String call(PageContext pc , String strQueryColumn, String delimiter) throws PageException {
020                    return call(pc, toColumn(pc,strQueryColumn), delimiter);
021            }
022    
023            public static String call(PageContext pc , QueryColumn column) throws PageException {
024                    return call(pc, column, ",");
025            }
026    
027            public static String call(PageContext pc , QueryColumn column, String delimiter) throws PageException {
028                    int size=column.size();
029                    StringBuilder sb=new StringBuilder();
030                    
031                    for(int i=1;i<=size;i++) {
032                            if(i>1)sb.append(delimiter);
033                            sb.append("'"+Caster.toString(column.get(i,null))+"'");
034                    }
035                    return sb.toString();
036            }
037    }