001/**
002 *
003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved.
004 *
005 * This library is free software; you can redistribute it and/or
006 * modify it under the terms of the GNU Lesser General Public
007 * License as published by the Free Software Foundation; either 
008 * version 2.1 of the License, or (at your option) any later version.
009 * 
010 * This library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013 * Lesser General Public License for more details.
014 * 
015 * You should have received a copy of the GNU Lesser General Public 
016 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
017 * 
018 **/
019package lucee.runtime.type;
020
021import lucee.runtime.exp.PageException;
022import lucee.runtime.op.Castable;
023import lucee.runtime.type.ref.Reference;
024
025/**
026 * represent a Single column of a query object
027 */
028public interface QueryColumn extends Collection,Reference,Castable {
029    
030    /**
031     * removes the value but dont the index
032     * @param row
033     * @return removed Object
034     * @throws PageException
035     */
036    public Object remove(int row)throws PageException;
037    
038    /**
039     * remove a row from query
040     * @param row
041     * @return removed value
042     * @throws PageException
043     */
044    public Object removeRow(int row)throws PageException;
045    
046    /**
047     * removes method with int as key
048     * @param row
049     * @return removed Object
050     */
051    public Object removeEL(int row);
052    
053        /**
054         * get method with a int as key, return empty default value for invalid row
055         * @param row row to get value
056         * @return row value
057         * @throws PageException
058         * @deprecated use instead <code>get(int row, Object defaultValue)</code>
059         */
060        public Object get(int row) throws PageException;
061
062        /**
063         * return the value in this row (can be null), when row number is invalid the default value is returned
064         * 
065         * @param row row to get value
066         * @param emptyValue value returned when row does not exists or the rows value is null
067         * @return row value
068         */
069        public Object get(int row, Object emptyValue);
070
071        /**
072         * set method with a int as key
073         * @param row row to set
074         * @param value value to set
075         * @return setted value
076         * @throws PageException
077         */
078        public Object set(int row, Object value) throws PageException;
079
080        /**
081         * adds a value to the column
082         * @param value value to add
083         */
084        public void add(Object value);
085        
086
087        /**
088         * setExpressionLess method with a int as key
089         * @param row row to set
090         * @param value value to set
091         * @return setted value
092         */
093        public Object setEL(int row, Object value);
094
095
096        /**
097         * @param count adds count row to the column
098         */
099        public void addRow(int count);
100
101        /**
102         * @return returns the type of the Column (java.sql.Types.XYZ)
103         */
104        public int getType();
105        
106        /**
107         * @return returns the type of the Column as String
108         */
109        public String getTypeAsString();
110
111    /**
112     * cuts row to defined size
113     * @param maxrows
114     */
115    public void cutRowsTo(int maxrows);
116        
117}