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.sql.old; 020 021 022// Referenced classes of package Zql: 023// ZAliasedName, ZConstant, ZUtils, ZExp 024 025public final class ZSelectItem extends ZAliasedName 026{ 027 028 public ZSelectItem() 029 { 030 expression_ = null; 031 aggregate_ = null; 032 } 033 034 public ZSelectItem(String s) 035 { 036 super(s, ZAliasedName.FORM_COLUMN); 037 expression_ = null; 038 aggregate_ = null; 039 setAggregate(ZUtils.getAggregateCall(s)); 040 } 041 042 public ZExp getExpression() 043 { 044 if(isExpression()) 045 return expression_; 046 if(isWildcard()) 047 return null; 048 return new ZConstant(getColumn(), 0); 049 } 050 051 public void setExpression(ZExp zexp) 052 { 053 expression_ = zexp; 054 strform_ = expression_.toString(); 055 } 056 057 public boolean isExpression() 058 { 059 return expression_ != null; 060 } 061 062 public void setAggregate(String s) 063 { 064 aggregate_ = s; 065 } 066 067 public String getAggregate() 068 { 069 return aggregate_; 070 } 071 072 ZExp expression_; 073 String aggregate_; 074}