Package FairCom.CtreeDb
Class CTIndex
Deals with the index concept.
The index is part of the table, and represent one field,
or parts of one field, or parts of several fields.
One single index may be composed of several segments.
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAddJSONSegment
(CTField Field, String Key, int Type, int Size) Adds a new JSON segment to indexAddSegment
(int offset, int length, int SegMode) Adds a new segment to indexAddSegment
(CTField Field, int SegMode) Adds a new segment to indexvoid
DelSegment
(int SegmentNumber) Deletes a index segmentvoid
finalize()
Destroys an allocated CTIndex object This method should be called in order to avoid memory leaks.boolean
Retrieves the "allow duplicated" flag for this indexchar
Retrieves the current "empty char" valueRetrieves the index file nameint
GetIdxno()
Retrieves the index file numberint
Retrieves the key length of the current indexint
Retrieves the key type of the current indexGetName()
Retrieves the index nameboolean
Retrieves the null flagint
Retrieves index position in table indices listGetSegment
(int SegmentNumber) Retrieves the index segment by its position numberint
Retrieves the segment count.int
Retrieves the status of the index handle.boolean
Retrives the temporary index flaglong
GetUID()
Retrieves the unique index identification from the databaseInsertSegment
(int BeforeSegment, int offset, int length, int SegMode) Inserts a new index segment before the segment number.InsertSegment
(int BeforeSegment, CTField Field, int SegMode) Inserts a new index segment before the segment number.void
MoveSegment
(int SegmentNumber, int NewIndex) Moves a key segment to a location indicated by newIndex.void
SetCndxExpression
(String Expression) Sets the conditional expression for the current indexvoid
SetDuplicateFlag
(boolean DupFlag) Sets the "allow duplicate key" flag for the current indexvoid
SetEmptyChar
(char EmptyChar) Sets the index "empty char" property for the current indexvoid
SetFilename
(String Path, String Name) Sets the index path and filename.void
SetKeyType
(int keytype) Sets the IndexKEY_TYPE
void
Sets the index name, before the table is created.void
SetNullFlag
(boolean NullFlag) Sets the "allow null key" flag for the current indexvoid
SetTemporaryFlag
(boolean TempFlag) Sets the temporary flag for the current indexMethods inherited from class CTBase
Abort, Begin, ClearSavePoint, Commit, GetAutoCommit, GetHandle, GetKeepLock, GetLockMode, GetOperation, GetTransactionMode, IsLockActive, IsTransActive, IsUnicodeLib, Lock, PrepareCommit, RestoreSavePoint, SetAutoCommit, SetHandle, SetKeepLock, SetOperation, SetSavePoint, SetTransactionMode, Unlock
-
Constructor Details
-
CTIndex
public CTIndex()Default constructor for the CTIndex class.- See Also:
-
CTIndex
Copy constructor for the CTIndex class.- Parameters:
Index
- CTIndex object to be copied- See Also:
-
-
Method Details
-
finalize
public void finalize()Destroys an allocated CTIndex object This method should be called in order to avoid memory leaks. Release all resources associated with a database -
GetKeyLength
public int GetKeyLength()Retrieves the key length of the current index- Returns:
- Key length
- See Also:
-
GetKeyType
Retrieves the key type of the current index- Returns:
- Current
KEY_TYPE
value - Throws:
CTException
- in case of error- See Also:
-
GetEmptyChar
public char GetEmptyChar()Retrieves the current "empty char" value- Returns:
- Current empry char value
- See Also:
-
GetDuplicateFlag
public boolean GetDuplicateFlag()Retrieves the "allow duplicated" flag for this index- Returns:
- true if index allows duplicate keys, otherwise false.
- See Also:
-
GetNullFlag
public boolean GetNullFlag()Retrieves the null flag- Returns:
- true if the null flag is set, otherwise false.
- See Also:
-
GetTemporaryFlag
public boolean GetTemporaryFlag()Retrives the temporary index flag- Returns:
- true if the index is temporary, otherwise false.
- See Also:
-
SetEmptyChar
Sets the index "empty char" property for the current index- Parameters:
EmptyChar
- New "empty character" to be set- Throws:
CTException
- in case of error- See Also:
-
SetDuplicateFlag
Sets the "allow duplicate key" flag for the current index- Parameters:
DupFlag
- true if the current index will allow duplicated, otherwise false- Throws:
CTException
- in case of error- See Also:
-
SetNullFlag
Sets the "allow null key" flag for the current index- Parameters:
NullFlag
- true if the current index will allow null key, otherwise false- Throws:
CTException
- in case of error- See Also:
-
SetTemporaryFlag
Sets the temporary flag for the current index- Parameters:
TempFlag
- true if the current index is temporary, otherwise false- Throws:
CTException
- in case of error- See Also:
-
GetSegmentCount
public int GetSegmentCount()Retrieves the segment count.- Returns:
- Current index segment count
- See Also:
-
AddSegment
Adds a new segment to index- Parameters:
Field
-CTField
object to be added as a keySegMode
- NewSEG_MODE
- Returns:
- New
CTSegment
- Throws:
CTException
- in case of error- See Also:
-
AddSegment
Adds a new segment to index- Parameters:
offset
- Segment offsetlength
- Segment length in bytesSegMode
- NewSEG_MODE
- Returns:
- New
CTSegment
- Throws:
CTException
- in case of error- See Also:
-
AddJSONSegment
Adds a new JSON segment to index- Parameters:
Field
-CTField
object to be added as a keyKey
- JSON key name that is being indexedType
- c-tree data type of key valueSize
- Key segment length- Returns:
- New
CTSegment
- Throws:
CTException
- in case of error- See Also:
-
InsertSegment
Inserts a new index segment before the segment number.- Parameters:
BeforeSegment
- Insert the new segment before this index segment positionField
-CTField
object to be added as a keySegMode
- NewSEG_MODE
- Returns:
- New
CTSegment
- Throws:
CTException
- in case of error- See Also:
-
InsertSegment
public CTSegment InsertSegment(int BeforeSegment, int offset, int length, int SegMode) throws CTException Inserts a new index segment before the segment number.- Parameters:
BeforeSegment
- Insert the new segment before this index segment positionoffset
- Segment offsetlength
- Segment length in bytesSegMode
- NewSEG_MODE
- Returns:
- New
CTSegment
- Throws:
CTException
- in case of error- See Also:
-
DelSegment
Deletes a index segment- Parameters:
SegmentNumber
- Segment number to be deleted- Throws:
CTException
- in case of error- See Also:
-
GetSegment
Retrieves the index segment by its position number- Parameters:
SegmentNumber
- Segment number to be retrieved- Returns:
CTSegment
object- Throws:
CTException
- in case of error- See Also:
-
GetNumber
Retrieves index position in table indices list- Returns:
- Index position in the
CTTable
owner - Throws:
CTException
- in case of error- See Also:
-
GetName
Retrieves the index name- Returns:
- Current index name
- See Also:
-
GetUID
Retrieves the unique index identification from the database- Returns:
- Current index UID (unique identification in the database)
- Throws:
CTException
- in case of error- See Also:
-
SetName
Sets the index name, before the table is created. Once the table is created, the index name can not be changed.- Parameters:
IndexName
- New index name.- Throws:
CTException
- in case of error- See Also:
-
SetKeyType
Sets the IndexKEY_TYPE
- Parameters:
keytype
-KEY_TYPE
value- Throws:
CTException
- in case of error- See Also:
-
SetFilename
Sets the index path and filename.- Parameters:
Path
- Specify the directory were the index file is located. If Null the directory is located in same directory of table.Name
- Specify the name of index file. If Null the index file will have the name of the table.- Throws:
CTException
- in case of error- See Also:
-
GetFilename
Retrieves the index file name- Returns:
- Index file name. If index file name is Null, the returned CTString object is cleared.
- See Also:
-
GetIdxno
Retrieves the index file number- Returns:
- Index file number
- Throws:
CTException
- in case of error- See Also:
-
GetStatus
public int GetStatus()Retrieves the status of the index handle. The status of the index handle is a bit map describing theINDEX_STATUS
value- Returns:
- Current
INDEX_STATUS
value - See Also:
-
MoveSegment
Moves a key segment to a location indicated by newIndex.- Parameters:
SegmentNumber
- Current segment number to be moved.NewIndex
- Index of the new location of the segment.- Throws:
CTException
- in case of error- See Also:
-
SetCndxExpression
Sets the conditional expression for the current index- Parameters:
Expression
- Conditional expression string- Throws:
CTException
- in case of error- See Also:
-