use of org.jkiss.dbeaver.model.struct.rdb.DBSIndexType in project dbeaver by serge-rider.
the class IndexCache method fetchObject.
@Nullable
@Override
protected GenericTableIndex fetchObject(JDBCSession session, GenericStructContainer owner, GenericTable parent, String indexName, JDBCResultSet dbResult) throws SQLException, DBException {
boolean isNonUnique = GenericUtils.safeGetBoolean(indexObject, dbResult, JDBCConstants.NON_UNIQUE);
String indexQualifier = GenericUtils.safeGetStringTrimmed(indexObject, dbResult, JDBCConstants.INDEX_QUALIFIER);
long cardinality = GenericUtils.safeGetLong(indexObject, dbResult, JDBCConstants.INDEX_CARDINALITY);
int indexTypeNum = GenericUtils.safeGetInt(indexObject, dbResult, JDBCConstants.TYPE);
DBSIndexType indexType;
switch(indexTypeNum) {
case DatabaseMetaData.tableIndexStatistic:
// Table index statistic. Not a real index.
log.debug("Skip statistics index '" + indexName + "' in '" + DBUtils.getObjectFullName(parent, DBPEvaluationContext.DDL) + "'");
return null;
// indexType = DBSIndexType.STATISTIC; break;
case DatabaseMetaData.tableIndexClustered:
indexType = DBSIndexType.CLUSTERED;
break;
case DatabaseMetaData.tableIndexHashed:
indexType = DBSIndexType.HASHED;
break;
case DatabaseMetaData.tableIndexOther:
indexType = DBSIndexType.OTHER;
break;
default:
indexType = DBSIndexType.UNKNOWN;
break;
}
if (CommonUtils.isEmpty(indexName)) {
// [JDBC] Some drivers return empty index names
indexName = parent.getName().toUpperCase(Locale.ENGLISH) + "_INDEX";
}
return owner.getDataSource().getMetaModel().createIndexImpl(parent, isNonUnique, indexQualifier, cardinality, indexName, indexType, true);
}
Aggregations