Class IndexType
java.lang.Object
org.h2.index.IndexType
Represents information about the properties of an index
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic IndexTypecreateNonUnique(boolean persistent) Create a non-unique index.static IndexTypecreateNonUnique(boolean persistent, boolean hash, boolean spatial) Create a non-unique index.static IndexTypecreatePrimaryKey(boolean persistent, boolean hash) Create a primary key index.static IndexTypecreateScan(boolean persistent) Create a scan pseudo-index.static IndexTypecreateUnique(boolean persistent, boolean hash) Create a unique index.booleanIf the index is created because of a constraint.getSQL()Get the SQL snippet to create such an index.booleanisHash()Is this a hash index?booleanIs this index persistent?booleanDoes this index belong to a primary key constraint?booleanisScan()Is this a table scan pseudo-index?booleanIs this a spatial index?booleanisUnique()Is this a unique index?voidsetBelongsToConstraint(boolean belongsToConstraint) Sets if this index belongs to a constraint.
-
Constructor Details
-
IndexType
public IndexType()
-
-
Method Details
-
createPrimaryKey
Create a primary key index.- Parameters:
persistent- if the index is persistenthash- if a hash index should be used- Returns:
- the index type
-
createUnique
Create a unique index.- Parameters:
persistent- if the index is persistenthash- if a hash index should be used- Returns:
- the index type
-
createNonUnique
Create a non-unique index.- Parameters:
persistent- if the index is persistent- Returns:
- the index type
-
createNonUnique
Create a non-unique index.- Parameters:
persistent- if the index is persistenthash- if a hash index should be usedspatial- if a spatial index should be used- Returns:
- the index type
-
createScan
Create a scan pseudo-index.- Parameters:
persistent- if the index is persistent- Returns:
- the index type
-
setBelongsToConstraint
public void setBelongsToConstraint(boolean belongsToConstraint) Sets if this index belongs to a constraint.- Parameters:
belongsToConstraint- if the index belongs to a constraint
-
getBelongsToConstraint
public boolean getBelongsToConstraint()If the index is created because of a constraint. Such indexes are to be dropped once the constraint is dropped.- Returns:
- if the index belongs to a constraint
-
isHash
public boolean isHash()Is this a hash index?- Returns:
- true if it is a hash index
-
isSpatial
public boolean isSpatial()Is this a spatial index?- Returns:
- true if it is a spatial index
-
isPersistent
public boolean isPersistent()Is this index persistent?- Returns:
- true if it is persistent
-
isPrimaryKey
public boolean isPrimaryKey()Does this index belong to a primary key constraint?- Returns:
- true if it references a primary key constraint
-
isUnique
public boolean isUnique()Is this a unique index?- Returns:
- true if it is
-
getSQL
-
isScan
public boolean isScan()Is this a table scan pseudo-index?- Returns:
- true if it is
-