001package gudusoft.gsqlparser.stmt;
002
003import gudusoft.gsqlparser.*;
004import gudusoft.gsqlparser.TCustomSqlStatement;
005import gudusoft.gsqlparser.nodes.TCommentSqlNode;
006import gudusoft.gsqlparser.nodes.TObjectName;
007import gudusoft.gsqlparser.nodes.TConstant;
008import gudusoft.gsqlparser.nodes.TParseTreeVisitor;
009import gudusoft.gsqlparser.stmt.oracle.TCustomOracleSqlStmt;
010
011/**
012 * Represents db2,oracle comment on statement.
013 */
014public class TCommentOnSqlStmt extends TCustomSqlStatement {
015    public TCommentOnSqlStmt(EDbVendor dbvendor) {
016        super(dbvendor);
017        sqlstatementtype = ESqlStatementType.sstCommentOn;
018    }
019
020    void buildsql() {
021    }
022
023    void clear() {
024    }
025
026    String getasprettytext() {
027        return "";
028    }
029
030    void iterate(TVisitorAbs pvisitor) {
031    }
032
033    public int doParseStatement(TCustomSqlStatement psql) {
034        if (rootNode == null) return -1;
035        super.doParseStatement(psql);
036        TCommentSqlNode commentSqlNode = (TCommentSqlNode)rootNode;
037
038        this.objectName = commentSqlNode.getObjectName();
039        this.message = commentSqlNode.getMessage();
040        this.dbObjType = commentSqlNode.getDbObjType();
041        dbObjectType = commentSqlNode.getDbObjectType();
042
043        return 0;
044    }
045
046    private TObjectName objectName = null;
047    private TConstant message = null;
048    private EDbObjectType dbObjectType = EDbObjectType.unknown;
049
050    public void setDbObjectType(EDbObjectType dbObjectType) {
051        this.dbObjectType = dbObjectType;
052    }
053
054    public EDbObjectType getDbObjectType() {
055
056        return dbObjectType;
057    }
058
059    public int getDbObjType() {
060        return dbObjType;
061    }
062
063    public TConstant getMessage() {
064        return message;
065    }
066
067    public TObjectName getObjectName() {
068        return objectName;
069    }
070
071    private int dbObjType = TObjectName.ttobjUnknown;
072
073    public void accept(TParseTreeVisitor v){
074        v.preVisit(this);
075        v.postVisit(this);
076    }
077
078    public void acceptChildren(TParseTreeVisitor v){
079        v.preVisit(this);
080        v.postVisit(this);
081    }
082
083    public void setObjectName(TObjectName objectName) {
084        this.objectName = objectName;
085    }
086
087    public void setMessage(TConstant message) {
088        this.message = message;
089    }
090
091    public void setDbObjType(int dbObjType) {
092        this.dbObjType = dbObjType;
093    }
094}