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 TConstant sizeLimit;
083
084    public void setSizeLimit(TConstant sizeLimit) {
085        this.sizeLimit = sizeLimit;
086    }
087
088    /**
089     *
090     * @return The name that you give to the collection type that you are defining.
091     */
092    public TObjectName getTypeName() {
093        return typeName;
094    }
095
096    public boolean isNotNull() {
097        return NotNull;
098    }
099
100    /**
101     *
102     * @return For a varray, a positive integer literal that specifies the maximum number of elements it can contain.
103     */
104    public TConstant getSizeLimit() {
105
106        return sizeLimit;
107
108    }
109
110    public void accept(TParseTreeVisitor v){
111        v.preVisit(this);
112        v.postVisit(this);
113    }
114    public void acceptChildren(TParseTreeVisitor v){
115        v.preVisit(this);
116        v.postVisit(this);
117    }
118
119    public void setTypeName(TObjectName typeName) {
120        this.typeName = typeName;
121    }
122
123    public void setElementDataType(TTypeName elementDataType) {
124        this.elementDataType = elementDataType;
125    }
126}