001package gudusoft.gsqlparser.stmt; 002 003 004import gudusoft.gsqlparser.EDbObjectType; 005import gudusoft.gsqlparser.EDbVendor; 006import gudusoft.gsqlparser.ESqlStatementType; 007import gudusoft.gsqlparser.TCustomSqlStatement; 008import gudusoft.gsqlparser.nodes.TAlterFunctionSqlNode; 009import gudusoft.gsqlparser.nodes.TObjectName; 010import gudusoft.gsqlparser.nodes.TParameterDeclarationList; 011import gudusoft.gsqlparser.nodes.TParseTreeVisitor; 012 013/** 014 * SQL alter function statement. 015 * 016 * @custom.relatedDB Snowflake, Vertica 017 */ 018public class TAlterFunctionStmt extends TCustomSqlStatement { 019 020 private TObjectName ownerName; 021 022 public TObjectName getOwnerName() { 023 return ownerName; 024 } 025 026 public enum AlterType { unknown, ownerTo, setSchema,executeProtected, executeNotProtected,compile, compileOnly,renameTo,encryption,addDrop}; 027 028 private AlterType alterType; 029 030 public AlterType getAlterType() { 031 return alterType; 032 } 033 034 035 private TObjectName functionName; 036 private TParameterDeclarationList argTypeList; 037 038 /** 039 * function name 040 * 041 * @return function name 042 */ 043 public TObjectName getFunctionName() { 044 return functionName; 045 } 046 047 public TParameterDeclarationList getArgTypeList() { 048 return argTypeList; 049 } 050 051 public TAlterFunctionStmt(EDbVendor dbvendor) { 052 super(dbvendor); 053 sqlstatementtype = ESqlStatementType.sstalterfunction; 054 } 055 056 public TObjectName getNewFunctionName() { 057 return newFunctionName; 058 } 059 060 private TObjectName newFunctionName; 061 public int doParseStatement(TCustomSqlStatement psql) { 062 if (rootNode == null) return -1; 063 super.doParseStatement(psql); 064 TAlterFunctionSqlNode node = (TAlterFunctionSqlNode) rootNode; 065 alterType = node.getAlterType(); 066 functionName = node.getFunctionName(); 067 068 functionName.setDbObjectType(EDbObjectType.function); 069 argTypeList = node.getArgTypeList(); 070 ownerName = node.getOwnerName(); 071 newFunctionName = node.getNewFunctionName(); 072 073 return 0; 074 } 075 076 public void accept(TParseTreeVisitor v){ 077 v.preVisit(this); 078 079 v.postVisit(this); 080 } 081 082 public void acceptChildren(TParseTreeVisitor v){ 083 v.preVisit(this); 084 v.postVisit(this); 085 } 086 087 088}