/** * Adds a logical index which this data is backing. */ void addIndex(Index index) { // we keep foreign key indexes at the back of the list. this way the // primary index will be a non-foreign key index (if any) if(index.isForeignKey()) { _indexes.add(index); } else { int pos = _indexes.size(); while(pos > 0) { if(!_indexes.get(pos - 1).isForeignKey()) { break; } --pos; } _indexes.add(pos, index); // also, keep track of whether or not this is a primary key index _primaryKey |= index.isPrimaryKey(); } // force name to be regenerated _name = null; }
//broken, 'cos we don't generate these with names in SchemaExport subIter = table.getIndexIterator(); while ( subIter.hasNext() ) { Index index = (Index) subIter.next(); if ( !index.isForeignKey() || !dialect.hasImplicitIndexForForeignKey() ) { if ( tableInfo==null || tableInfo.getIndexMetadata( index.getFilterName() ) == null ) { script.add( index.sqlCreateString(dialect, mapping) ); } } } //broken, 'cos we don't generate these with names in SchemaExport subIter = table.getUniqueKeyIterator(); while ( subIter.hasNext() ) { UniqueKey uk = (UniqueKey) subIter.next(); if ( tableInfo==null || tableInfo.getIndexMetadata( uk.getFilterName() ) == null ) { script.add( uk.sqlCreateString(dialect, mapping) ); } }
private void loadTableIndexesNotUK(String tn) throws IOException, SQLException { Table t = dbIO.getTable(tn); UcanaccessTable table = new UcanaccessTable(t, tn); if (!skipIndexes && t != null) { for (Index idx : table.getIndexes()) { if (!idx.isForeignKey() && !idx.isPrimaryKey() && !idx.isUnique()) { loadIndex(idx, tn); } } } }
private void loadTableIndexesUK(String tn) throws IOException, SQLException { Table t = dbIO.getTable(tn); UcanaccessTable table = new UcanaccessTable(t, tn); if (t != null) { for (Index idx : table.getIndexes()) { if (!idx.isForeignKey() && (idx.isPrimaryKey() || idx.isUnique())) { loadIndex(idx, tn); } } } }