001    /**
002     * Implements the Cold Fusion Function queryaddcolumn
003     */
004    package railo.runtime.functions.query;
005    
006    import railo.runtime.PageContext;
007    import railo.runtime.db.SQLCaster;
008    import railo.runtime.exp.PageException;
009    import railo.runtime.ext.function.Function;
010    import railo.runtime.op.Caster;
011    import railo.runtime.type.ArrayImpl;
012    import railo.runtime.type.Query;
013    
014    public final class QueryAddColumn implements Function {
015            
016            public static double call(PageContext pc , Query query, String string) throws PageException {
017                    return call(pc, query, string,new ArrayImpl());
018            }
019            
020            public static double call(PageContext pc , Query query, String string, Object array) throws PageException {
021                    query.addColumn(string,Caster.toArray(array));
022                    return query.size();
023            }
024            
025            public static double call(PageContext pc , Query query, String string, Object datatype, Object array) throws PageException {
026                    if(datatype==null) return call(pc, query, string, array);
027                    
028                    query.addColumn(string,Caster.toArray(array),SQLCaster.toIntType(Caster.toString(datatype)));
029                    return query.size();
030            }
031    }