001package gudusoft.gsqlparser.nodes.snowflake;
002
003import gudusoft.gsqlparser.EDbObjectType;
004import gudusoft.gsqlparser.TBaseType;
005import gudusoft.gsqlparser.nodes.TDummy;
006import gudusoft.gsqlparser.nodes.TObjectName;
007import gudusoft.gsqlparser.nodes.TParseTreeNode;
008import gudusoft.gsqlparser.stmt.snowflake.TCreateStreamStmt;
009
010public class TCreateStreamSqlNode extends TParseTreeNode {
011    private int insert_only = TBaseType.BOOL_VALUE_NOT_SET;
012    private int append_only = TBaseType.BOOL_VALUE_NOT_SET;
013
014    public void setInsert_only(TDummy dummy){
015        if (dummy == null) return;
016        insert_only = dummy.int1;
017    }
018    public void setAppend_only(TDummy dummy){
019        if (dummy == null) return;
020        append_only = dummy.int1;
021    }
022
023    public int getInsert_only() {
024        return insert_only;
025    }
026
027    public int getAppend_only() {
028        return append_only;
029    }
030
031    private TObjectName streamName;
032    private TObjectName tableName;
033
034    public TObjectName getTableName() {
035        return tableName;
036    }
037
038    public TObjectName getStreamName() {
039        return streamName;
040    }
041
042    private TCreateStreamStmt.ECreateOnObjectType createOnObjectType = TCreateStreamStmt.ECreateOnObjectType.table;
043
044    public TCreateStreamStmt.ECreateOnObjectType getCreateOnObjectType() {
045        return createOnObjectType;
046    }
047
048    public void init(Object arg1,Object arg2,Object arg3){
049        createOnObjectType =(TCreateStreamStmt.ECreateOnObjectType)arg1;
050
051        streamName = (TObjectName)arg2;
052        streamName.setDbObjectType(EDbObjectType.stream);
053
054        tableName = (TObjectName) arg3;
055        switch (createOnObjectType){
056            case table:
057            case externalTable:
058                tableName.setDbObjectType(EDbObjectType.table);
059                break;
060            case view:
061                tableName.setDbObjectType(EDbObjectType.view);
062                break;
063            case stage:
064                tableName.setDbObjectType(EDbObjectType.stage);
065                break;
066        }
067    }
068
069}