Package org.apache.empire.db
Class DBIndex
java.lang.Object
org.apache.empire.db.DBObject
org.apache.empire.db.DBIndex
- Direct Known Subclasses:
DBExpressionIndex
This class handles the primary key for the tables.
The primary key contains one or more columns.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionDBIndex(String name, DBIndex.DBIndexType type, DBColumn[] columns) Constructs a DBIndex object set the specified parameters to this object. -
Method Summary
Modifier and TypeMethodDescriptionbooleancompareColumns(DBColumn[] columns) checks whether the columns of this index match the supplied columnsbooleanChecks if this index contains the column colgetColumn(int index) Returns the columns belonging to this index.intReturns the number of columns belonging to this index.intgetColumnPos(DBColumn col) Gets the position of a specified DBColumn object.DBColumn[]Returns the columns belonging to this index.Returns the database object to which this object belongs to.Returns the columnExpressions belonging to this index.Returns the full qualified table name.getName()Returns the primary key name.Returns additional database specific index optionsgetTable()returns the table this index belongs to.getType()Returns the index type.setOptions(String options) Sets additional database specific index optionsMethods inherited from class org.apache.empire.db.DBObject
checkParamNull
-
Constructor Details
-
DBIndex
Constructs a DBIndex object set the specified parameters to this object.- Parameters:
name- the primary key nametype- the primary key type (only PRIMARYKEY)columns- an array of one or more columns of the primary key
-
-
Method Details
-
getTable
returns the table this index belongs to. Valid only if the index has been added to a table (DBTable.addIndex)- Returns:
- the corresponding table
-
getDatabase
Description copied from class:DBObjectReturns the database object to which this object belongs to. For the database object itself this function will return the this pointer.- Specified by:
getDatabasein classDBObject- Returns:
- the database object
-
getName
Returns the primary key name.- Returns:
- the primary key name
-
getColumns
Returns the columns belonging to this index.- Returns:
- the columns belonging to this index
-
getColumn
Returns the columns belonging to this index.- Parameters:
index- the index of the desired column- Returns:
- the columns belonging to this index
-
getColumnCount
public int getColumnCount()Returns the number of columns belonging to this index.- Returns:
- the number of columns belonging to this index
-
compareColumns
checks whether the columns of this index match the supplied columns- Parameters:
columns- the columns- Returns:
- true if columns match or false otherwise
-
getExpressions
Returns the columnExpressions belonging to this index.- Returns:
- the columnExpressions belonging to this index
-
getFullName
Returns the full qualified table name.- Returns:
- the full qualified table name
-
getType
Returns the index type.- Returns:
- the type of this index
-
getOptions
Returns additional database specific index options- Returns:
- the index type options
-
setOptions
Sets additional database specific index options- Parameters:
options- the index type options- Returns:
- the index itself (this)
-
contains
Checks if this index contains the column col- Parameters:
col- the column- Returns:
- true if this index contains this column
-
getColumnPos
Gets the position of a specified DBColumn object.- Parameters:
col- the column- Returns:
- the position or -1 if the column was not found
-