Package org.datanucleus.store.rdbms.schema

Examples of org.datanucleus.store.rdbms.schema.IndexInfo


                new Object[] {this});
            IdentifierFactory idFactory = storeMgr.getIdentifierFactory();
            Iterator indexIter = tableIndexInfo.getChildren().iterator();
            while (indexIter.hasNext())
            {
                IndexInfo indexInfo = (IndexInfo)indexIter.next();
                boolean isUnique = !((Boolean)indexInfo.getProperty("non_unique")).booleanValue();
                if (isUnique)
                {
                    // Only utilise unique indexes
                    short idxType = ((Short)indexInfo.getProperty("type")).shortValue();
                    if (idxType == DatabaseMetaData.tableIndexStatistic)
                    {
                        // Ignore
                        continue;
                    }
   
                    String keyName = (String)indexInfo.getProperty("index_name");
                    DatastoreIdentifier idxName = idFactory.newIdentifier(IdentifierType.CANDIDATE_KEY, keyName);
                    CandidateKey key = (CandidateKey) candidateKeysByName.get(idxName);
                    if (key == null)
                    {
                        key = new CandidateKey(this);
                        key.setName(keyName);
                        candidateKeysByName.put(idxName, key);
                    }
   
                    // Set the column
                    int colSeq = ((Short)indexInfo.getProperty("ordinal_position")).shortValue() - 1;
                    DatastoreIdentifier colName = idFactory.newIdentifier(IdentifierType.COLUMN,
                        (String)indexInfo.getProperty("column_name"));
                    Column col = columnsByName.get(colName);
                    if (col != null)
                    {
                        key.setDatastoreField(colSeq, col);
                    }
View Full Code Here


                new Object[] {this});
            IdentifierFactory idFactory = storeMgr.getIdentifierFactory();
            Iterator indexIter = tableIndexInfo.getChildren().iterator();
            while (indexIter.hasNext())
            {
                IndexInfo indexInfo = (IndexInfo)indexIter.next();
                short idxType = ((Short)indexInfo.getProperty("type")).shortValue();
                if (idxType == DatabaseMetaData.tableIndexStatistic)
                {
                    // Ignore
                    continue;
                }
   
                String indexName = (String)indexInfo.getProperty("index_name");
                DatastoreIdentifier indexIdentifier = idFactory.newIdentifier(IdentifierType.CANDIDATE_KEY,
                    indexName);
                Index idx = (Index) indicesByName.get(indexIdentifier);
                if (idx == null)
                {
                    boolean isUnique = !((Boolean)indexInfo.getProperty("non_unique")).booleanValue();
                    idx = new Index(this, isUnique, null);
                    idx.setName(indexName);
                    indicesByName.put(indexIdentifier, idx);
                }
   
                // Set the column
                int colSeq = ((Short)indexInfo.getProperty("ordinal_position")).shortValue() - 1;
                DatastoreIdentifier colName = idFactory.newIdentifier(IdentifierType.COLUMN,
                    (String)indexInfo.getProperty("column_name"));
                Column col = columnsByName.get(colName);
                if (col != null)
                {
                    idx.setColumn(colSeq, col);
                }
View Full Code Here

TOP

Related Classes of org.datanucleus.store.rdbms.schema.IndexInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.