001package gudusoft.gsqlparser.nodes;
002
003import gudusoft.gsqlparser.ESqlClause;
004import gudusoft.gsqlparser.TCustomSqlStatement;
005
006
007public class TReturningClause extends TParseTreeNode {
008
009    private TResultColumnList resultExprList;//couchbase
010
011    public TResultColumnList getResultExprList() {
012        return resultExprList;
013    }
014
015    private boolean bulkCollect = false;
016
017    public void setBulkCollect(boolean bulkCollect) {
018        this.bulkCollect = bulkCollect;
019    }
020
021    public boolean isBulkCollect() {
022
023        return bulkCollect;
024    }
025
026    private TExpressionList columnValueList = null;
027    private TExpressionList variableList = null;
028
029    public void init(Object arg1)
030    {
031        resultExprList = (TResultColumnList)arg1;
032    }
033
034    public void init(Object arg1, Object arg2)
035    {
036        columnValueList = (TExpressionList)arg1;
037        variableList = (TExpressionList)arg2;
038    }
039
040    public void doParse(TCustomSqlStatement psql, ESqlClause plocation){
041        if (columnValueList != null){
042            columnValueList.doParse(psql,plocation);
043        }
044        if (variableList != null){
045            variableList.doParse(psql,plocation);
046        }
047        if (resultExprList != null){
048            for(int i=0;i<resultExprList.size();i++){
049                resultExprList.getResultColumn(i).doParse(psql,plocation);
050            }
051        }
052    }
053
054    public TExpressionList getColumnValueList() {
055        return columnValueList;
056    }
057
058    public TExpressionList getVariableList() {
059        return variableList;
060    }
061
062    public void accept(TParseTreeVisitor v){
063        v.preVisit(this);
064        v.postVisit(this);
065    }
066
067    public void acceptChildren(TParseTreeVisitor v){
068        v.preVisit(this);
069        // resultExprList: PG/Oracle standard RETURNING col1, col2, …
070        if (resultExprList != null) resultExprList.acceptChildren(v);
071        // columnValueList: Oracle INTO form — RETURNING col INTO :v
072        // (column expressions only; variableList host-variable sinks are intentionally
073        // not visited — they are bind targets, not SQL column references)
074        if (columnValueList != null) columnValueList.acceptChildren(v);
075        v.postVisit(this);
076    }
077
078    public void setColumnValueList(TExpressionList columnValueList) {
079        this.columnValueList = columnValueList;
080    }
081
082    public void setVariableList(TExpressionList variableList) {
083        this.variableList = variableList;
084    }
085}