001package gudusoft.gsqlparser.nodes;
002/*
003 * Date: 2010-12-15
004 * Time: 9:47:46
005 */
006
007import gudusoft.gsqlparser.ESqlClause;
008import gudusoft.gsqlparser.TCustomSqlStatement;
009
010public class TLimitClause extends TParseTreeNode {
011
012    private TExpression offset = null;
013    private TExpression row_count = null;
014
015    //private  TExpression selectLimitValue;
016    private  TExpression selectFetchFirstValue;   //postgresql
017
018    private TWindowDef windowDef; // for vertica
019
020    public void setWindowDef(TWindowDef windowDef) {
021        this.windowDef = windowDef;
022    }
023
024    public TWindowDef getWindowDef() {
025        return windowDef;
026    }
027
028    public void setOffsetClause(TOffsetClause offsetClause){
029        offset = offsetClause.getSelectOffsetValue();
030    }
031    public void setSelectFetchFirstValue(TExpression selectFetchFirstValue) {
032        this.selectFetchFirstValue = selectFetchFirstValue;
033    }
034
035//    public void setSelectLimitValue(TExpression selectLimitValue) {
036//        this.selectLimitValue = selectLimitValue;
037//    }
038
039    /**
040     * postgresql select fetch first value, informix first value
041     * @return
042     */
043    public TExpression getSelectFetchFirstValue() {
044
045        return selectFetchFirstValue;
046    }
047
048
049
050    public void init(Object arg1){
051        this.offset = (TExpression)arg1;
052    }
053
054    public void init(Object arg1,Object arg2){
055       init(arg1);
056       this.row_count = (TExpression)arg2;
057    }
058
059    /**
060     * informix skip value
061     * @return
062     */
063    public TExpression getOffset() {
064        return offset;
065    }
066
067    /**
068     * informix limit value
069     * @return
070     */
071    public TExpression getRow_count() {
072        return row_count;
073    }
074
075    public void doParse(TCustomSqlStatement psql, ESqlClause plocation){
076    }
077    
078    public void accept(TParseTreeVisitor v){
079        v.preVisit(this);
080        v.postVisit(this);
081    }
082
083    public void acceptChildren(TParseTreeVisitor v){
084        v.preVisit(this);
085        v.postVisit(this);
086    }
087
088    public void setOffset(TExpression offset) {
089        this.offset = offset;
090    }
091
092    public void setRow_count(TExpression row_count) {
093        this.row_count = row_count;
094    }
095}