001package gudusoft.gsqlparser.stmt.redshift;
002
003import gudusoft.gsqlparser.EDbVendor;
004import gudusoft.gsqlparser.ESqlStatementType;
005import gudusoft.gsqlparser.TCustomSqlStatement;
006import gudusoft.gsqlparser.nodes.*;
007
008
009public class TRedshiftCopy extends TCustomSqlStatement {
010
011    private TObjectName tableName;
012    private TObjectNameList columnList;
013    private String fromSource;
014    private TAuthorizationClause authorizationClause;
015
016    public TAuthorizationClause getAuthorizationClause() {
017        return authorizationClause;
018    }
019
020    public TObjectName getTableName() {
021        return tableName;
022    }
023
024    public TObjectNameList getColumnList() {
025        return columnList;
026    }
027
028    public String getFromSource() {
029        return fromSource;
030    }
031
032
033    public TRedshiftCopy(EDbVendor dbvendor) {
034        super(dbvendor);
035        sqlstatementtype = ESqlStatementType.sstredshiftCopy;
036    }
037
038    public int doParseStatement(TCustomSqlStatement psql) {
039        if (rootNode == null) return -1;
040        super.doParseStatement(psql);
041        TCopySqlNode copySqlNode = (TCopySqlNode)rootNode;
042        tableName  = copySqlNode.getTablename();
043        columnList = copySqlNode.getColumnList();
044        fromSource = copySqlNode.getFilename().toString();
045        authorizationClause = copySqlNode.getAuthorizationClause();
046        //credentials = copySqlNode.st2.toString();
047
048        return 0;
049    }
050
051    public void accept(TParseTreeVisitor v){
052        v.preVisit(this);
053        v.postVisit(this);
054    }
055    public void acceptChildren(TParseTreeVisitor v){
056        v.preVisit(this);
057        v.postVisit(this);
058    }
059
060    public void setTableName(TObjectName tableName) {
061        this.tableName = tableName;
062    }
063
064    public void setColumnList(TObjectNameList columnList) {
065        this.columnList = columnList;
066    }
067
068    public void setFromSource(String fromSource) {
069        this.fromSource = fromSource;
070    }
071
072
073}