001package gudusoft.gsqlparser.stmt.oracle;
002
003import gudusoft.gsqlparser.*;
004import gudusoft.gsqlparser.nodes.TObjectName;
005import gudusoft.gsqlparser.nodes.TTypeName;
006import gudusoft.gsqlparser.nodes.TParseTreeVisitor;
007
008/**
009 * 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.
010 *<p>PL/SQL has three kinds of collections:
011 *<ul>
012 *<li>Associative arrays (formerly called "PL/SQL tables" or "index-by tables"), represents by {@link TPlsqlTableTypeDefStmt}</li>
013 *<li>Nested tables, represents by {@link TPlsqlTableTypeDefStmt}</li>
014 *<li>Variable-size arrays (varrays), represents by {@link TPlsqlVarrayTypeDefStmt}</li>
015 *</ul>
016 *<p>Associative arrays can be indexed by either integers or strings. Nested tables and varrays are indexed by integers.
017 */
018
019public class TPlsqlTableTypeDefStmt extends TCustomSqlStatement {
020    public TPlsqlTableTypeDefStmt(){
021        this(EDbVendor.dbvoracle);
022    }
023
024     public TPlsqlTableTypeDefStmt(EDbVendor dbvendor){
025        super(dbvendor);
026        sqlstatementtype = ESqlStatementType.sstplsql_tabletypedef ;
027        }
028
029    void buildsql() {
030    }
031
032    void clear() {
033    }
034
035    String getasprettytext() {
036        return "";
037    }
038
039    void iterate(TVisitorAbs pvisitor) {
040    }
041
042    public int doParseStatement(TCustomSqlStatement psql) {
043        super.doParseStatement(psql);
044        return 0;
045    }
046
047    private TObjectName typeName = null;
048    private TTypeName elementDataType = null;
049    private Boolean notNull = false;
050    private TTypeName indexByDataType = null;
051
052    /**
053     * For an associative array, the data type of its indexes PLS_INTEGER, BINARY_INTGER, or VARCHAR2.
054     * @return
055     */
056    public TTypeName getIndexByDataType() {
057        return indexByDataType;
058    }
059
060    /**
061     * Specifies that no element of the collection can have the value NULL.
062     * @return
063     */
064    public Boolean getNotNull() {
065        return notNull;
066    }
067
068    public void setIndexByDataType(TTypeName indexByDataType) {
069
070        this.indexByDataType = indexByDataType;
071    }
072
073    public void setNotNull(Boolean notNull) {
074        this.notNull = notNull;
075    }
076
077    /**
078     * The data type of the collection element.
079     * @return
080     */
081    public TTypeName getElementDataType() {
082        return elementDataType;
083    }
084
085    /**
086     * The name that you give to the collection type that you are defining.
087     * @return
088     */
089    public TObjectName getTypeName() {
090        return typeName;
091    }
092
093    public void init(Object arg1,Object arg2)
094    {
095        typeName = (TObjectName)arg1;
096        //typeName.setObjectType(TObjectName.ttobjTypeName);
097        typeName.setDbObjectType(EDbObjectType.user_defined_type);
098        elementDataType = (TTypeName)arg2;
099    }
100
101    public void accept(TParseTreeVisitor v){
102        v.preVisit(this);
103        v.postVisit(this);
104    }
105
106    public void acceptChildren(TParseTreeVisitor v){
107        v.preVisit(this);
108        v.postVisit(this);
109    }
110
111    public void setTypeName(TObjectName typeName) {
112        this.typeName = typeName;
113    }
114
115    public void setElementDataType(TTypeName elementDataType) {
116        this.elementDataType = elementDataType;
117    }
118}