001package gudusoft.gsqlparser.nodes.snowflake; 002 003 004import gudusoft.gsqlparser.EDbObjectType; 005import gudusoft.gsqlparser.dlineage.dataflow.model.xml.procedure; 006import gudusoft.gsqlparser.nodes.*; 007import gudusoft.gsqlparser.stmt.snowflake.TSnowflakeCopyIntoStmt; 008 009 010import java.util.ArrayList; 011 012public class TCopyIntoNode extends TParseTreeNode { 013 014 public ArrayList<TCreateTableOption> tableOptions; 015 016 private TObjectNameList tableColumnList; 017 018 public void setTableColumnList(TObjectNameList tableColumnList) { 019 this.tableColumnList = tableColumnList; 020 } 021 022 public TObjectNameList getTableColumnList() { 023 return tableColumnList; 024 } 025 026 public TStageLocation getStageLocation() { 027 return stageLocation; 028 } 029 030 private TStageLocation stageLocation; 031 032 private int copyIntoType; 033 034 public void setCopyIntoType(int copyIntoType) { 035 this.copyIntoType = copyIntoType; 036 } 037 038 public int getCopyIntoType() { 039 return copyIntoType; 040 } 041 042 private TObjectName tableName; 043 private TSelectSqlNode subquery; 044 045 private TObjectName fromSourceLocation; 046 public TObjectName getFromSourceLocation() { 047 return fromSourceLocation; 048 } 049 050 public void setTableName(TObjectName tableName) { 051 this.tableName = tableName; 052 } 053 054 public void setSubquery(TSelectSqlNode subquery) { 055 this.subquery = subquery; 056 } 057 058 public TObjectName getTableName() { 059 060 return tableName; 061 } 062 063 public TSelectSqlNode getSubquery() { 064 return subquery; 065 } 066 067// public void init(Object arg1){ 068// if (arg1 instanceof TObjectName){ 069// tableName = (TObjectName)arg1; 070// }else if (arg1 instanceof TSelectSqlNode){ 071// subquery = (TSelectSqlNode)arg1; 072// } 073// } 074// 075// public void init(Object arg1,Object arg2){ 076// this.copyIntoType = (int)arg1; 077// } 078 079 public void init(Object arg1,Object arg2){ 080 this.copyIntoType = (int)arg1; 081 if (this.copyIntoType == TSnowflakeCopyIntoStmt.COPY_INTO_TABLE){ 082 this.tableName = (TObjectName)arg2; 083 this.tableName.setDbObjectType(EDbObjectType.table); 084 }else if (this.copyIntoType == TSnowflakeCopyIntoStmt.COPY_INTO_LOCATION){ 085 this.stageLocation = (TStageLocation)arg2; 086 } 087 } 088 089 public void init(Object arg1,Object arg2,Object arg3){ 090 init(arg1,arg2); 091 if (this.copyIntoType == TSnowflakeCopyIntoStmt.COPY_INTO_TABLE){ 092 if (arg3 instanceof TStageLocation){ 093 this.stageLocation = (TStageLocation)arg3; 094 }else if (arg3 instanceof TSelectSqlNode){ 095 this.subquery = (TSelectSqlNode)arg3; 096 }else if (arg3 instanceof TObjectName){ 097 this.fromSourceLocation = (TObjectName)arg3; 098 } 099 }else if (this.copyIntoType == TSnowflakeCopyIntoStmt.COPY_INTO_LOCATION){ 100 if (arg3 instanceof TSelectSqlNode){ 101 this.subquery = (TSelectSqlNode)arg3; 102 }else if (arg3 instanceof TObjectName){ 103 this.tableName = (TObjectName)arg3; 104 } 105 } 106 } 107}