001package gudusoft.gsqlparser.stmt.oracle; 002 003import gudusoft.gsqlparser.*; 004import gudusoft.gsqlparser.nodes.TObjectName; 005import gudusoft.gsqlparser.nodes.TTypeName; 006import gudusoft.gsqlparser.nodes.TConstant; 007import gudusoft.gsqlparser.nodes.TParseTreeVisitor; 008 009 010/** 011 * A collection groups elements of the same type in a specified order. Each element has a unique subscript that determines its position in the collection. 012 *<p>PL/SQL has three kinds of collections: 013 *<ul> 014 *<li>Associative arrays (formerly called "PL/SQL tables" or "index-by tables"), represents by {@link TPlsqlTableTypeDefStmt}</li> 015 *<li>Nested tables, represents by {@link TPlsqlTableTypeDefStmt}</li> 016 *<li>Variable-size arrays (varrays), represents by {@link TPlsqlVarrayTypeDefStmt}</li> 017 *</ul> 018 *<p>Associative arrays can be indexed by either integers or strings. Nested tables and varrays are indexed by integers. 019 */ 020 021public class TPlsqlVarrayTypeDefStmt extends TCustomSqlStatement { 022 public TPlsqlVarrayTypeDefStmt(){ 023 this(EDbVendor.dbvoracle); 024 } 025 026 public TPlsqlVarrayTypeDefStmt(EDbVendor dbvendor){ 027 super(dbvendor); 028 sqlstatementtype = ESqlStatementType.sstplsql_varraytypedef ; 029 } 030 031 void buildsql() { 032 } 033 034 void clear() { 035 } 036 037 String getasprettytext() { 038 return ""; 039 } 040 041 void iterate(TVisitorAbs pvisitor) { 042 } 043 044 public int doParseStatement(TCustomSqlStatement psql) { 045 super.doParseStatement(psql); 046 return 0; 047 } 048 049 private TObjectName typeName = null; 050 public void init(Object arg1,Object arg2) 051 { 052 typeName = (TObjectName)arg1; 053 //typeName.setObjectType(TObjectName.ttobjTypeName); 054 typeName.setDbObjectType(EDbObjectType.user_defined_type); 055 elementDataType = (TTypeName)arg2; 056 } 057 058 private TTypeName elementDataType = null; 059 060 /** 061 * The data type of the collection element. 062 * @return 063 */ 064 public TTypeName getElementDataType() { 065 return elementDataType; 066 } 067 068 private boolean NotNull = false; 069 070 public void setNotNull(boolean notNull) { 071 NotNull = notNull; 072 } 073 074 /** 075 * 076 * @return Specifies that no element can have the value NULL. 077 */ 078 public boolean getNotNull() { 079 return NotNull; 080 } 081 082 private boolean ifNotExists = false; 083 084 public void setIfNotExists(boolean ifNotExists) { 085 this.ifNotExists = ifNotExists; 086 } 087 088 /** 089 * 090 * @return True if IF NOT EXISTS clause was specified. 091 */ 092 public boolean isIfNotExists() { 093 return ifNotExists; 094 } 095 096 private boolean notPersistable = false; 097 098 public void setNotPersistable(boolean notPersistable) { 099 this.notPersistable = notPersistable; 100 } 101 102 /** 103 * 104 * @return True if NOT PERSISTABLE clause was specified (Oracle 26 PL/SQL feature). 105 */ 106 public boolean isNotPersistable() { 107 return notPersistable; 108 } 109 110 private TConstant sizeLimit; 111 112 public void setSizeLimit(TConstant sizeLimit) { 113 this.sizeLimit = sizeLimit; 114 } 115 116 /** 117 * 118 * @return The name that you give to the collection type that you are defining. 119 */ 120 public TObjectName getTypeName() { 121 return typeName; 122 } 123 124 public boolean isNotNull() { 125 return NotNull; 126 } 127 128 /** 129 * 130 * @return For a varray, a positive integer literal that specifies the maximum number of elements it can contain. 131 */ 132 public TConstant getSizeLimit() { 133 134 return sizeLimit; 135 136 } 137 138 public void accept(TParseTreeVisitor v){ 139 v.preVisit(this); 140 v.postVisit(this); 141 } 142 public void acceptChildren(TParseTreeVisitor v){ 143 v.preVisit(this); 144 v.postVisit(this); 145 } 146 147 public void setTypeName(TObjectName typeName) { 148 this.typeName = typeName; 149 } 150 151 public void setElementDataType(TTypeName elementDataType) { 152 this.elementDataType = elementDataType; 153 } 154}