001package gudusoft.gsqlparser.nodes;
002
003import gudusoft.gsqlparser.EDbObjectType;
004
005/**
006 * Represents db2,oracle comment on statement.
007 */
008public class TCommentSqlNode extends TParseTreeNode {
009    private TObjectName objectName = null;
010    private TConstant message = null;
011    private int dbObjType = TObjectName.ttobjUnknown;
012    private EDbObjectType dbObjectType = EDbObjectType.unknown;
013
014    public void setDbObjectType(EDbObjectType dbObjectType) {
015        this.dbObjectType = dbObjectType;
016    }
017
018    public EDbObjectType getDbObjectType() {
019
020        return dbObjectType;
021    }
022
023    public void setDbObjType(int dbObjType) {
024        this.dbObjType = dbObjType;
025        if (objectName != null){
026            objectName.setObjectType(dbObjType);
027        }
028    }
029
030    public int getDbObjType() {
031
032        return dbObjType;
033    }
034
035    public void init(Object arg1){
036        this.objectName = (TObjectName)arg1;
037    }
038
039    public void init(Object arg1, Object arg2){
040        if (arg1 instanceof EDbObjectType){
041            dbObjectType = (EDbObjectType)arg1;
042            switch (dbObjectType){
043                case column:
044                    this.objectName = (TObjectName)arg2;
045                    break;
046                case operator:
047                    this.message = (TConstant)arg2;
048                    break;
049            }
050        }else{
051            this.objectName = (TObjectName)arg1;
052            this.message = (TConstant)arg2;
053        }
054
055        if (this.objectName != null){
056            this.objectName.setDbObjectType(this.dbObjectType);
057        }
058    }
059
060    public void init(Object arg1, Object arg2,Object arg3){
061        if (arg3 instanceof EDbObjectType){
062            dbObjectType = (EDbObjectType)arg3;
063            init(arg1,arg2);
064        }else{
065            this.dbObjectType = (EDbObjectType) arg1;
066            init(arg2,arg3);
067        }
068    }
069
070    public TConstant getMessage() {
071        return message;
072    }
073
074    public TObjectName getObjectName() {
075        return objectName;
076    }
077}