FairCom.CtreeDb
Class CTTable

java.lang.Object
  extended by FairCom.CtreeDb.CTBase
      extended by FairCom.CtreeDb.CTTable

public class CTTable
extends CTBase

Objects of the CTTable class are used to manage tables. One table may belong to several databases, and a database may have multiple tables. The table may have any number of fields. It uses CTBase as the base class, and implements the constructor/destructor allocating/freeing memory to the table operations.

See Also:
CTBase, CTSession, CTDatabase, CTRecord

Field Summary
 
Fields inherited from class FairCom.CtreeDb.CTBase
m_handle
 
Constructor Summary
CTTable(CTDatabase Handle)
          Creates a new CTTable object
CTTable(CTSession Handle)
          Creates a new CTTable object
 
Method Summary
 CTField AddField(java.lang.String Name, int Type, int Length)
          Adds a new field to table
 CTIndex AddIndex(java.lang.String Name, int KeyType, boolean AllowDuplicates, boolean NullFlag)
          Add a new index to the table
 CTSegment AddSegment(CTIndex Index, CTField Field, int SegMode)
          Add a new segment to an index
 CTSegment AddSegment(CTIndex Index, int FieldNumber, int SegMode)
          Add a new segment to an index
 CTSegment AddSegment(CTIndex Index, int offset, int length, int SegMode)
          Add a new segment to an index
 CTSegment AddSegment(CTIndex pIndex, java.lang.String FieldName, int SegMode)
          Add a new segment to an index
 CTSegment AddSegment(int IndexNbr, CTField Field, int SegMode)
          Add index segment
 CTSegment AddSegment(int IndexNbr, int FieldNbr, int SegMode)
          Add a new segment to an index
 CTSegment AddSegment(int IndexNbr, java.lang.String FieldName, int SegMode)
          Add a new segment to an index
 CTSegment AddSegment(java.lang.String IndexName, CTField Field, int SegMode)
          Add index segment
 CTSegment AddSegment(java.lang.String IndexName, int FieldNumber, int SegMode)
          Add index segment
 CTSegment AddSegment(java.lang.String IndexName, java.lang.String FieldName, int SegMode)
          Add index segment
 void Alter(int Action)
          Perform alter table functions
 void ClearAllFieldDefaultValue()
          Clear the default value associated with all fields in a table.
 void Close()
          Closes a table
 void Create(java.lang.String Name, int CreateMode)
          Creates a new table
 void DeleteField(int FieldNumber)
          Deletes a field from the table
 void DeleteField(java.lang.String FieldName)
          Deletes a field from the table
 void DelIndex(int IndexNumber)
          Delete an index from a table
 void DelIndex(java.lang.String IndexName)
          Delete an index from a table
 void DelSegment(int IndexNumber, int SegNumber)
          Delete an existing segment
 void DelSegment(java.lang.String IndexName, int SegNumber)
          Delete index segment
 void FilterRecord(java.lang.String cndexpr)
          Set or clear record filter condition.
 void finalize()
          Destroy an allocated CTTable object
 java.lang.String GetCndxIndex(int Indexnbr)
          Retrieve the conditional index String
 java.lang.String GetCndxIndex(java.lang.String indexname)
          Retrieve the conditional index String
 int GetCreateMode()
          Retrieves the table create mode
 int GetDataDefaultExtentSize()
          Retrieves the c-tree data file default extent size
 java.lang.String GetDataExtension()
          Gets the data file name extension.
 int GetDatno()
          Retrieve the table datno.
 char GetDlmChar()
          Retrieve the table field delimiter characters.
 CTField GetField(int FieldNumber)
          Retrieves a field by its number
 CTField GetField(java.lang.String FieldName)
          Retrieves a field by its name
 int GetFieldCount()
          Retrieves the number of fields in the table
 int GetFieldNumber(java.lang.String FieldName)
          Retrieves the field number from a table, given its field name.
 java.lang.String GetFilter()
          retrieves the current filter expression for the table
 java.lang.String GetGroupid()
          Retrieves the table group id
 int GetIdxno(int Index)
          Retrieve the index file number given the index c-treeDB number.
 int GetIdxno(java.lang.String IndexName)
          Retrieve the index file number given the index name.
 CTIndex GetIndex(int IndexNumber)
          Retrieve an index handle
 CTIndex GetIndex(java.lang.String name)
          Retrieve the index given its name
 CTIndex GetIndexByUID(int uid)
          Retrieve an index object given its UID
 int GetIndexCount()
          Retrieves the number of table indices
 int GetIndexDefaultExtentSize()
          Retrieves the c-tree index file default extent size
 java.lang.String GetIndexExtension()
          Gets the index file name extension.
 java.lang.String GetIndexFilename(int IndexNumber)
          Retrieve the index name
 java.lang.String GetIndexFilename(java.lang.String IndexName)
          Retrieve the index file name
 java.lang.String GetName()
          Gets the table name, without the name extension
 int GetOpenMode()
          Retrieves the table open mode
 java.lang.String GetOwner()
          Retrieve the table owner.
 char GetPadChar()
          Retrieve the table pad character.
 java.lang.String GetPassword()
          Retrieves the table password
 java.lang.String GetPath()
          Gets the table path
 int GetPermission()
          Retrieves the table permission mask.
 CTSegment GetSegment(CTIndex Index, int SegNumber)
          Get an index segment handle
 int GetStatus()
          Retrieve table status.
 boolean HasDelField()
          Indicate if a table has the $DELFLD$ internal field.
 boolean HasNullFieldSupport()
          Indicates if a table has null field support
 boolean HasRecbyt()
          Indicate if a table was created with recbyt index
 boolean HasRowid()
          Indicate if a table was created with rowid index
 CTField InsertField(int BeforeField, java.lang.String Name, int Type, int Length)
          Inserts a new field into the table, in the specified position
 CTField InsertField(java.lang.String BeforeField, java.lang.String Name, int Type, int Length)
          Inserts a new field into the table, in the specified position
 CTSegment InsertSegment(CTIndex Index, int BeforeSegment, CTField Field, int SegMode)
          Insert a new segment
 CTSegment InsertSegment(CTIndex Index, int BeforeSegment, int FieldNumber, int SegMode)
          Insert a new segment
 CTSegment InsertSegment(CTIndex Index, int BeforeSegment, int offset, int length, int SegMode)
          Insert a new segment
 CTSegment InsertSegment(CTIndex Index, int BeforeSegment, java.lang.String FieldName, int SegMode)
          Insert a new segment
 CTSegment InsertSegment(int IndexNbr, int BeforeSegment, CTField Field, int SegMode)
          Insert a new segment
 CTSegment InsertSegment(int IndexNbr, int BeforeSegment, int FieldNumber, int SegMode)
          Insert a new segment
 CTSegment InsertSegment(int IndexNbr, int BeforeSegment, java.lang.String FieldName, int SegMode)
          Insert a new segment
 CTSegment InsertSegment(java.lang.String IndexName, int BeforeSegment, CTField Field, int SegMode)
          Insert a new segment
 CTSegment InsertSegment(java.lang.String IndexName, int BeforeSegment, int FieldNumber, int SegMode)
          Insert a new segment
 CTSegment InsertSegment(java.lang.String IndexName, int BeforeSegment, java.lang.String FieldName, int SegMode)
          Insert a new segment
 boolean IsActive()
          Check if a table is active.
 boolean IsFilteredRecord()
          Check if a table has a record filter active.
 void MoveField(int FieldNumber, int newNumber)
          Moves the field from one position to another position in the same table
 void MoveField(java.lang.String FieldName, int newNumber)
          Moves the field from one position to another position in the same table
 void MoveSegment(CTIndex hIndex, int segNumber, int newIndex)
          Move a segment to another location.
 void MoveSegment(int indexNumber, int segNumber, int newIndex)
          Move a segment to another location.
 void MoveSegment(java.lang.String indexName, int segNumber, int newIndex)
          Move a segment to another location.
 long NumberOfKeyEntries(int index)
          Retrieve the number of key entries in a index file.
 long NumberOfKeyEntries(java.lang.String indexName)
          Retrieve the number of key entries in a index file.
 void Open(java.lang.String Name, int OpenMode)
          Opens an existing table
 int PartAdminByName(java.lang.String PartName, int PartMode)
          Perform a partition operation on the partition specified by name
 int PartAdminByNumber(int Prawno, int PartMode)
          Perform a partition operation on the partition specified by raw partition number
 void Rebuild(int Mode)
          Build data and index files.
 void Remove()
          Delete a table.
 void ResetAll()
          Reset all active record buffers associated with table
 void SetDataDefaultExtentSize(int size)
          Sets the c-tree data file default extent size
 void SetDataExtension(java.lang.String Ext)
          Sets the table data extesion
 void SetGroupid(java.lang.String Groupid)
          Sets the table group id
 void SetIdentityField(java.lang.String FieldName, long Seed, long Increment)
          Sets the identity field
 void SetIndexDefaultExtentSize(int size)
          Sets the c-tree index file default extent size
 void SetIndexExtension(java.lang.String Ext)
          Sets the table index extesion
 void SetIndexFilename(int IndexNumber, java.lang.String Path, java.lang.String Filename)
          Set the index filename.
 void SetIndexFilename(java.lang.String IndexName, java.lang.String Path, java.lang.String Filename)
          Set the index file name
 void SetOwner(java.lang.String owner)
          Set the table owner.
 void SetPadChar(char Padchar, char Dlmchar)
          Set the table pad and field delimiter characters in the table handle.
 void SetPassword(java.lang.String Password)
          Sets the table password
 void SetPath(java.lang.String Path)
          Sets the table path
 void SetPermission(int Permmask)
          Sets the table permission mask
 void UnlockTable()
          Release all record locks, obtained with LockRecord(), associated with the table.
 void UpdateCndxIndex(int indexnbr, java.lang.String cndexpr)
          Add, modify or delete conditional index.
 void UpdateCndxIndex(java.lang.String Indexname, java.lang.String Cndexpr)
          Add, modify or delete conditional index.
 void UpdateCreateMode(int mode)
          Update the table create mode
 void UpdatePadChar(char Padchar, char Dmlchar, boolean Rebuild)
          Update the table pad and delimiter character resource.
 
Methods inherited from class FairCom.CtreeDb.CTBase
Abort, Begin, Commit, GetAutoCommit, GetHandle, GetKeepLock, GetLockMode, GetOperation, GetTransactionMode, IsLockActive, IsTransActive, IsUnicodeLib, Lock, RestoreSavePoint, SetAutoCommit, SetHandle, SetKeepLock, SetOperation, SetSavePoint, SetTransactionMode, Unlock
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CTTable

public CTTable(CTDatabase Handle)
        throws CTException
Creates a new CTTable object

This is the constructor for the CTTable class

Parameters:
Handle - Database handle for wich the CTTable is created
Throws:
CTException
See Also:
finalize()

CTTable

public CTTable(CTSession Handle)
        throws CTException
Creates a new CTTable object

This is the constructor for the CTTable class

Parameters:
Handle - Database handle for wich the CTTable is created
Throws:
CTException
See Also:
finalize()
Method Detail

finalize

public void finalize()
Destroy an allocated CTTable object

This method should be called in order to avoid memory leaks. Release all resources associated with a table

Overrides:
finalize in class java.lang.Object

Open

public void Open(java.lang.String Name,
                 int OpenMode)
          throws CTException
Opens an existing table

Parameters:
Name - Table name
OpenMode - Open table mode. Valid values: OPEN_MODE.NORMAL OPEN_MODE.EXCLUSIVE OPEN_MODE.PERMANENT OPEN_MODE.CORRUPT OPEN_MODE.CHECKLOCK OPEN_MODE.CHECKREAD OPEN_MODE.READONLY OPEN_MODE.DATAONLY
Throws:
CTException
See Also:
GetOpenMode(), Create(java.lang.String, int), Close()

Close

public void Close()
           throws CTException
Closes a table

Throws:
CTException
See Also:
Open(java.lang.String, int)

IsActive

public boolean IsActive()
Check if a table is active. A table is active is it is open

Returns:
Returns true if the table is active
See Also:
Open(java.lang.String, int)

GetName

public java.lang.String GetName()
                         throws CTException
Gets the table name, without the name extension

Returns:
Returns the table name
Throws:
CTException
See Also:
GetPath(), GetOpenMode(), GetPassword(), GetPermission()

GetPath

public java.lang.String GetPath()
Gets the table path

Returns:
Returns the table path
See Also:
SetPath(java.lang.String)

GetDataExtension

public java.lang.String GetDataExtension()
                                  throws CTException
Gets the data file name extension. If not changed by SetDataExtension(), the data extension is "dat"

Returns:
Returns the data file name extension
Throws:
CTException
See Also:
SetDataExtension(java.lang.String), GetIndexExtension()

GetIndexExtension

public java.lang.String GetIndexExtension()
                                   throws CTException
Gets the index file name extension. If not changed by SetIndexExtension(), the index extension is "idx"

Returns:
Returns the index file name extension
Throws:
CTException
See Also:
SetIndexExtension(java.lang.String), GetDataExtension()

GetOpenMode

public int GetOpenMode()
Retrieves the table open mode

Returns:
Returns the table open mode. Possible values: OPEN_MODE.NORMAL OPEN_MODE.EXCLUSIVE OPEN_MODE.PERMANENT OPEN_MODE.CORRUPT OPEN_MODE.CHECKLOCK OPEN_MODE.CHECKREAD OPEN_MODE.READONLY OPEN_MODE.DATAONLY Mapped in the static members of OPEN_MODE class.
See Also:
Open(java.lang.String, int), GetOpenMode(), Create(java.lang.String, int)

GetCreateMode

public int GetCreateMode()
Retrieves the table create mode

Returns:
Returns the table create mode. Possible values: CREATE_MODE.NORMAL CREATE_MODE.PREIMG CREATE_MODE.TRNLOG CREATE_MODE.WRITETHRU CREATE_MODE.CHECKLOCK CREATE_MODE.VRLEN CREATE_MODE.NORECBYT CREATE_MODE.NOROWID CREATE_MODE.CHECKREAD CREATE_MODE.HUGEFILE CREATE_MODE.NODELFLD CREATE_MODE.NONULFLD Mapped in the static members of CREATE_MODE class.
See Also:
Create(java.lang.String, int), Open(java.lang.String, int)

GetDataDefaultExtentSize

public int GetDataDefaultExtentSize()
Retrieves the c-tree data file default extent size

Returns:
Returns the default data file extent size. The default value, 8192 bytes, may be changed by calling SetDataDefaultExtentSize()
See Also:
SetIndexDefaultExtentSize(int), GetDataDefaultExtentSize()

GetIndexDefaultExtentSize

public int GetIndexDefaultExtentSize()
Retrieves the c-tree index file default extent size

Returns:
Returns the default index file extent size. The default value, 8192 bytes, may be changed by calling SetIndexDefaultExtentSize()
See Also:
SetIndexDefaultExtentSize(int), GetDataDefaultExtentSize()

GetPassword

public java.lang.String GetPassword()
Retrieves the table password

Returns:
Returns the table password
See Also:
SetPassword(java.lang.String), GetName(), GetPath(), GetGroupid(), GetPermission()

GetGroupid

public java.lang.String GetGroupid()
Retrieves the table group id

Returns:
Returns the table group id
See Also:
SetPassword(java.lang.String), GetName(), GetPath(), GetGroupid(), GetPermission()

GetPermission

public int GetPermission()
Retrieves the table permission mask.

Returns:
Returns the table permission mask
See Also:
SetPassword(java.lang.String), GetName(), GetPath(), GetGroupid(), GetPassword()

SetPath

public void SetPath(java.lang.String Path)
             throws CTException
Sets the table path

Parameters:
Path - New table path value
Throws:
CTException
See Also:
GetPath(), SetDataExtension(java.lang.String), SetIndexExtension(java.lang.String)

SetDataExtension

public void SetDataExtension(java.lang.String Ext)
                      throws CTException
Sets the table data extesion

Parameters:
Ext - New table data extesion
Throws:
CTException
See Also:
GetDataExtension(), SetIndexExtension(java.lang.String), GetPath()

SetIndexExtension

public void SetIndexExtension(java.lang.String Ext)
                       throws CTException
Sets the table index extesion

Parameters:
Ext - New index data extesion
Throws:
CTException
See Also:
GetIndexExtension(), SetPath(java.lang.String), SetDataExtension(java.lang.String)

SetDataDefaultExtentSize

public void SetDataDefaultExtentSize(int size)
                              throws CTException
Sets the c-tree data file default extent size

Each time the data file needs to be extended, it will use this value to extent the file. If not changed by SetDataDefaultExtentSize(), this value is 8192 bytes

Parameters:
size - New default data extent size
Throws:
CTException
See Also:
GetDataDefaultExtentSize(), SetIndexDefaultExtentSize(int)

SetIndexDefaultExtentSize

public void SetIndexDefaultExtentSize(int size)
                               throws CTException
Sets the c-tree index file default extent size

Each time the index file needs to be extended, it will use this value to extent the file. If not changed by SetDataDefaultExtentSize(), this value is 8192 bytes

Parameters:
size - New default index extent size
Throws:
CTException
See Also:
GetIndexDefaultExtentSize(), SetDataDefaultExtentSize(int)

SetPassword

public void SetPassword(java.lang.String Password)
                 throws CTException
Sets the table password

Parameters:
Password - New table password
Throws:
CTException
See Also:
GetPassword(), SetGroupid(java.lang.String), SetPermission(int)

SetGroupid

public void SetGroupid(java.lang.String Groupid)
                throws CTException
Sets the table group id

Parameters:
Groupid - New table group id
Throws:
CTException
See Also:
GetGroupid(), SetPassword(java.lang.String), SetPermission(int)

SetPermission

public void SetPermission(int Permmask)
                   throws CTException
Sets the table permission mask

Parameters:
Permmask - New table permission mask
Throws:
CTException
See Also:
GetPermission(), SetPassword(java.lang.String), SetGroupid(java.lang.String)

Create

public void Create(java.lang.String Name,
                   int CreateMode)
            throws CTException
Creates a new table

Before the table creation, it must be defined with AddField(), and optionally with AddIndex() and AddSegment()

Parameters:
Name - Table name
CreateMode - Create table mode. Valid values: CREATE_MODE.NORMAL CREATE_MODE.PREIMG CREATE_MODE.TRNLOG CREATE_MODE.WRITETHRU CREATE_MODE.CHECKLOCK CREATE_MODE.VRLEN CREATE_MODE.NORECBYT CREATE_MODE.NOROWID CREATE_MODE.CHECKREAD CREATE_MODE.HUGEFILE CREATE_MODE.NODELFLD CREATE_MODE.NONULFLD Use the static members of CREATE_MODE to pass the values
Throws:
CTException
See Also:
AddField(java.lang.String, int, int), GetCreateMode(), Open(java.lang.String, int)

GetFieldCount

public int GetFieldCount()
Retrieves the number of fields in the table

Returns:
Returns the number of fields
See Also:
AddField(java.lang.String, int, int), DeleteField(java.lang.String), InsertField(java.lang.String, java.lang.String, int, int), GetFieldNumber(java.lang.String), GetIndexCount()

AddField

public CTField AddField(java.lang.String Name,
                        int Type,
                        int Length)
                 throws CTException
Adds a new field to table

Parameters:
Name - New field name
Type - New field type
Length - New field length
Returns:
Returns a field object on success or NULL on failure
Throws:
CTException
See Also:
InsertField(java.lang.String, java.lang.String, int, int), DeleteField(java.lang.String), GetField(java.lang.String), AddIndex(java.lang.String, int, boolean, boolean)

InsertField

public CTField InsertField(int BeforeField,
                           java.lang.String Name,
                           int Type,
                           int Length)
                    throws CTException
Inserts a new field into the table, in the specified position

Parameters:
BeforeField - Insert the new field before this field number
Name - New field name
Type - New field type use the static members of FIELD_TYPE class
Length - New field length
Returns:
Returns a field object on success or NULL on failure
Throws:
CTException
See Also:
AddField(java.lang.String, int, int), DeleteField(java.lang.String), GetField(java.lang.String), GetFieldNumber(java.lang.String)

InsertField

public CTField InsertField(java.lang.String BeforeField,
                           java.lang.String Name,
                           int Type,
                           int Length)
                    throws CTException
Inserts a new field into the table, in the specified position

Parameters:
BeforeField - Insert the new field before this field name
Name - New field name
Type - New field type use the static members of FIELD_TYPE class
Length - New field length
Returns:
Returns a field object on success or NULL on failure
Throws:
CTException
See Also:
AddField(java.lang.String, int, int), DeleteField(java.lang.String), GetField(java.lang.String), GetFieldNumber(java.lang.String)

DeleteField

public void DeleteField(int FieldNumber)
                 throws CTException
Deletes a field from the table

Parameters:
FieldNumber - Field number to be deleted
Throws:
CTException
See Also:
AddField(java.lang.String, int, int), InsertField(java.lang.String, java.lang.String, int, int), GetField(java.lang.String), GetFieldNumber(java.lang.String)

DeleteField

public void DeleteField(java.lang.String FieldName)
                 throws CTException
Deletes a field from the table

Parameters:
FieldName - Field name to be deleted
Throws:
CTException
See Also:
AddField(java.lang.String, int, int), InsertField(java.lang.String, java.lang.String, int, int), GetField(java.lang.String), GetFieldNumber(java.lang.String)

MoveField

public void MoveField(int FieldNumber,
                      int newNumber)
               throws CTException
Moves the field from one position to another position in the same table

Parameters:
FieldNumber - Field number to be moved
newNumber - New field number in the table
Throws:
CTException
See Also:
AddField(java.lang.String, int, int), InsertField(java.lang.String, java.lang.String, int, int), GetField(java.lang.String), DeleteField(java.lang.String)

MoveField

public void MoveField(java.lang.String FieldName,
                      int newNumber)
               throws CTException
Moves the field from one position to another position in the same table

Parameters:
FieldName - Field name to be moved
newNumber - New field number in the table
Throws:
CTException
See Also:
AddField(java.lang.String, int, int), InsertField(java.lang.String, java.lang.String, int, int), GetField(java.lang.String), DeleteField(java.lang.String)

GetField

public CTField GetField(int FieldNumber)
                 throws CTException
Retrieves a field by its number

Parameters:
FieldNumber - Field number to be retrieved
Throws:
CTException
See Also:
AddField(java.lang.String, int, int), InsertField(java.lang.String, java.lang.String, int, int), GetFieldNumber(java.lang.String), DeleteField(java.lang.String)

GetField

public CTField GetField(java.lang.String FieldName)
                 throws CTException
Retrieves a field by its name

Parameters:
FieldName - Field name to be retrieved
Returns:
Returns a field object on success or NULL on failure
Throws:
CTException
See Also:
AddField(java.lang.String, int, int), InsertField(java.lang.String, java.lang.String, int, int), GetFieldNumber(java.lang.String), DeleteField(java.lang.String)

GetFieldNumber

public int GetFieldNumber(java.lang.String FieldName)
                   throws CTException
Retrieves the field number from a table, given its field name.

Parameters:
FieldName - Field name to be retrieved
Returns:
Returns a field number on success or -1 on failure
Throws:
CTException
See Also:
AddField(java.lang.String, int, int), InsertField(java.lang.String, java.lang.String, int, int), GetFieldNumber(java.lang.String), DeleteField(java.lang.String)

GetIndexCount

public int GetIndexCount()
Retrieves the number of table indices

Returns:
Returns the number of indices
See Also:
AddIndex(java.lang.String, int, boolean, boolean), GetFieldCount()

AddIndex

public CTIndex AddIndex(java.lang.String Name,
                        int KeyType,
                        boolean AllowDuplicates,
                        boolean NullFlag)
                 throws CTException
Add a new index to the table

Parameters:
KeyType - the key type, sue the static mebers of KEY_TYPE class
AllowDuplicates - boolean indicating if index allow duplicate keys
NullFlag - boolean indicating if index allow null keys
Returns:
Return an index object
Throws:
CTException

DelIndex

public void DelIndex(int IndexNumber)
              throws CTException
Delete an index from a table

Parameters:
IndexNumber - The number of the index to delete
Throws:
CTException

DelIndex

public void DelIndex(java.lang.String IndexName)
              throws CTException
Delete an index from a table

Parameters:
IndexName - The name of the index to delete
Throws:
CTException

GetIndex

public CTIndex GetIndex(int IndexNumber)
                 throws CTException
Retrieve an index handle

Parameters:
IndexNumber - the number of the index in the table
Returns:
Return an index object
Throws:
CTException

GetIndex

public CTIndex GetIndex(java.lang.String name)
                 throws CTException
Retrieve the index given its name

Parameters:
name - Index name
Returns:
Return an index object
Throws:
CTException

AddSegment

public CTSegment AddSegment(CTIndex Index,
                            CTField Field,
                            int SegMode)
                     throws CTException
Add a new segment to an index

Parameters:
Index - Index class pointer
Field - Field to compose the index segment
SegMode - Segment mode
Returns:
Return a segment object represeting the added segment.
Throws:
CTException

AddSegment

public CTSegment AddSegment(CTIndex pIndex,
                            java.lang.String FieldName,
                            int SegMode)
                     throws CTException
Add a new segment to an index

Parameters:
pIndex - Index class pointer
FieldName - Name of field to compose the index segment
SegMode - Segment mode
Returns:
Return a segment object represeting the added segment.
Throws:
CTException

AddSegment

public CTSegment AddSegment(CTIndex Index,
                            int FieldNumber,
                            int SegMode)
                     throws CTException
Add a new segment to an index

Parameters:
Index - Index class pointer
FieldNumber - Number of field to compose the index segment
SegMode - Segment mode
Returns:
Return a segment object.
Throws:
CTException

AddSegment

public CTSegment AddSegment(CTIndex Index,
                            int offset,
                            int length,
                            int SegMode)
                     throws CTException
Add a new segment to an index

Parameters:
Index - Index class pointer
offset - Absolute byte offset
length - Segment length in bytes
SegMode - Segment mode
Returns:
Return a segment object.
Throws:
CTException

AddSegment

public CTSegment AddSegment(int IndexNbr,
                            int FieldNbr,
                            int SegMode)
                     throws CTException
Add a new segment to an index

Parameters:
IndexNbr - Index number
FieldNbr - Field number
SegMode - Segment mode
Returns:
Return a segment object.
Throws:
CTException

AddSegment

public CTSegment AddSegment(int IndexNbr,
                            java.lang.String FieldName,
                            int SegMode)
                     throws CTException
Add a new segment to an index

Parameters:
IndexNbr - Index number
FieldName - Field name
SegMode - Segment mode
Returns:
Return a segment object.
Throws:
CTException

InsertSegment

public CTSegment InsertSegment(CTIndex Index,
                               int BeforeSegment,
                               CTField Field,
                               int SegMode)
                        throws CTException
Insert a new segment

Parameters:
Index - Index handle returned by AddIndex.
BeforeSegment - Insert the segment before this segment
Field - Field class
SegMode - Segment mode
Returns:
Return a segment object
Throws:
CTException

InsertSegment

public CTSegment InsertSegment(CTIndex Index,
                               int BeforeSegment,
                               java.lang.String FieldName,
                               int SegMode)
                        throws CTException
Insert a new segment

Parameters:
Index - Index handle returned by AddIndex.
BeforeSegment - Insert the segment before this segment
FieldName - Field name
SegMode - Segment mode
Returns:
Return a segment object
Throws:
CTException

InsertSegment

public CTSegment InsertSegment(CTIndex Index,
                               int BeforeSegment,
                               int FieldNumber,
                               int SegMode)
                        throws CTException
Insert a new segment

Parameters:
Index - Index handle returned by AddIndex.
BeforeSegment - Insert the segment before this segment
FieldNumber - Field number
SegMode - Segment mode
Returns:
Return a segment object
Throws:
CTException

InsertSegment

public CTSegment InsertSegment(CTIndex Index,
                               int BeforeSegment,
                               int offset,
                               int length,
                               int SegMode)
                        throws CTException
Insert a new segment

Parameters:
Index - Index handle returned by AddIndex.
BeforeSegment - Insert the segment before this segment
offset - Segment absolute offset
length - Segment length in bytes
SegMode - Segment mode
Returns:
Return a segment object
Throws:
CTException

InsertSegment

public CTSegment InsertSegment(int IndexNbr,
                               int BeforeSegment,
                               int FieldNumber,
                               int SegMode)
                        throws CTException
Insert a new segment

Parameters:
IndexNbr - Index number
BeforeSegment - Insert the segment before this segment
FieldNumber - Field number
SegMode - Segment mode
Returns:
Return a segment object
Throws:
CTException

InsertSegment

public CTSegment InsertSegment(int IndexNbr,
                               int BeforeSegment,
                               java.lang.String FieldName,
                               int SegMode)
                        throws CTException
Insert a new segment

Parameters:
IndexNbr - Index number
BeforeSegment - Insert the segment before this segment
FieldName - Field name
SegMode - Segment mode
Returns:
Return a segment object
Throws:
CTException

DelSegment

public void DelSegment(int IndexNumber,
                       int SegNumber)
                throws CTException
Delete an existing segment

Parameters:
IndexNumber - The number of the index to change
SegNumber - The number of the segment to delete Returns: none
Throws:
CTException

GetSegment

public CTSegment GetSegment(CTIndex Index,
                            int SegNumber)
                     throws CTException
Get an index segment handle

Parameters:
Index - Index handle pointer
SegNumber - Segment number
Returns:
the segment object
Throws:
CTException

Alter

public void Alter(int Action)
           throws CTException
Perform alter table functions

Parameters:
Action - The alter table action to take, use the ALTER_TABLE static members
Throws:
CTException

ResetAll

public void ResetAll()
              throws CTException
Reset all active record buffers associated with table

Throws:
CTException

HasNullFieldSupport

public boolean HasNullFieldSupport()
Indicates if a table has null field support

Returns:
Return True if the table has null field support

GetIndexByUID

public CTIndex GetIndexByUID(int uid)
                      throws CTException
Retrieve an index object given its UID

Parameters:
uid - Index uid
Returns:
Return the index object
Throws:
CTException

AddSegment

public CTSegment AddSegment(int IndexNbr,
                            CTField Field,
                            int SegMode)
                     throws CTException
Add index segment

Parameters:
IndexNbr - Index number
Field - Field object
SegMode - Segment mode
Returns:
Return the segment object
Throws:
CTException

AddSegment

public CTSegment AddSegment(java.lang.String IndexName,
                            java.lang.String FieldName,
                            int SegMode)
                     throws CTException
Add index segment

Parameters:
IndexName - Index name
FieldName - Field name
SegMode - Segment mode
Returns:
Return the index object
Throws:
CTException

AddSegment

public CTSegment AddSegment(java.lang.String IndexName,
                            int FieldNumber,
                            int SegMode)
                     throws CTException
Add index segment

Parameters:
IndexName - Index Name
FieldNumber - Field Name
SegMode - Segment Mode
Returns:
Return the index object
Throws:
CTException

AddSegment

public CTSegment AddSegment(java.lang.String IndexName,
                            CTField Field,
                            int SegMode)
                     throws CTException
Add index segment

Parameters:
IndexName - Index name
Field - The field object
SegMode - Segment Mode
Returns:
Return the index object
Throws:
CTException

InsertSegment

public CTSegment InsertSegment(java.lang.String IndexName,
                               int BeforeSegment,
                               java.lang.String FieldName,
                               int SegMode)
                        throws CTException
Insert a new segment

Parameters:
IndexName - The name of the index.
BeforeSegment - Insert the segment before this segment
FieldName - Field name
SegMode - Segment mode
Returns:
Return a segment object
Throws:
CTException

InsertSegment

public CTSegment InsertSegment(java.lang.String IndexName,
                               int BeforeSegment,
                               int FieldNumber,
                               int SegMode)
                        throws CTException
Insert a new segment

Parameters:
IndexName - The name of the index.
BeforeSegment - Insert the segment before this segment
FieldNumber - Field number
SegMode - Segment mode
Returns:
Return a segment object
Throws:
CTException

InsertSegment

public CTSegment InsertSegment(java.lang.String IndexName,
                               int BeforeSegment,
                               CTField Field,
                               int SegMode)
                        throws CTException
Insert a new segment

Parameters:
IndexName - The name of the index.
BeforeSegment - Insert the segment before this segment
Field - Field class
SegMode - Segment mode
Returns:
Return a segment object
Throws:
CTException

InsertSegment

public CTSegment InsertSegment(int IndexNbr,
                               int BeforeSegment,
                               CTField Field,
                               int SegMode)
                        throws CTException
Insert a new segment

Parameters:
IndexNbr - Index number
BeforeSegment - Insert the segment before this segment
Field - Field class
SegMode - Segment mode
Returns:
Return a segment object
Throws:
CTException

DelSegment

public void DelSegment(java.lang.String IndexName,
                       int SegNumber)
                throws CTException
Delete index segment

Parameters:
IndexName - The name of the index
SegNumber - Segment number
Throws:
CTException

HasRecbyt

public boolean HasRecbyt()
Indicate if a table was created with recbyt index

: none

Returns:
Return True if table has recbyt index.

HasRowid

public boolean HasRowid()
Indicate if a table was created with rowid index

Returns:
Return True if table has rowid index.

UnlockTable

public void UnlockTable()
                 throws CTException
Release all record locks, obtained with LockRecord(), associated with the table.

Throws:
CTException

UpdateCndxIndex

public void UpdateCndxIndex(int indexnbr,
                            java.lang.String cndexpr)
                     throws CTException
Add, modify or delete conditional index.

Parameters:
indexnbr - The number of the index
cndexpr - index conditional expression
Throws:
CTException

UpdateCndxIndex

public void UpdateCndxIndex(java.lang.String Indexname,
                            java.lang.String Cndexpr)
                     throws CTException
Add, modify or delete conditional index.

Parameters:
Indexname - The name of the index
Cndexpr - index conditional expression
Throws:
CTException

GetCndxIndex

public java.lang.String GetCndxIndex(int Indexnbr)
                              throws CTException
Retrieve the conditional index String

Parameters:
Indexnbr - index number
Returns:
conditional index expression
Throws:
CTException

GetCndxIndex

public java.lang.String GetCndxIndex(java.lang.String indexname)
                              throws CTException
Retrieve the conditional index String

Parameters:
indexname - index name
Returns:
conditional index expression
Throws:
CTException

FilterRecord

public void FilterRecord(java.lang.String cndexpr)
                  throws CTException
Set or clear record filter condition. If a filter is set, all record reads will evaluate the conditional expression against the record data. If the result is false the record is skipped. The filter condition remains in place until the table is closed or replaced by another conditional expression. Pass an empty String to switch off the current filter state.

Parameters:
cndexpr - Conditional expression used to filter the records. Pass an empty String to switch off the filter state.
Throws:
CTException

IsFilteredRecord

public boolean IsFilteredRecord()
                         throws CTException
Check if a table has a record filter active.

Returns:
Returns true if a filter is active
Throws:
CTException
See Also:
FilterRecord(java.lang.String)

GetFilter

public java.lang.String GetFilter()
                           throws CTException
retrieves the current filter expression for the table

Returns:
filter expression
Throws:
CTException

UpdateCreateMode

public void UpdateCreateMode(int mode)
                      throws CTException
Update the table create mode

Parameters:
mode - New table create mode CREATE_MODE.NORMAL CREATE_MODE.PREIMG CREATE_MODE.TRNLOG CREATE_MODE.WRITETHRU CREATE_MODE.CHECKLOCK CREATE_MODE.VRLEN CREATE_MODE.NORECBYT CREATE_MODE.NOROWID CREATE_MODE.CHECKREAD CREATE_MODE.HUGEFILE CREATE_MODE.NODELFLD CREATE_MODE.NONULFLD Mapped in the static members of CREATE_MODE class.
Throws:
CTException
See Also:
Create(java.lang.String, int), GetOpenMode()

GetPadChar

public char GetPadChar()
                throws CTException
Retrieve the table pad character. This characters is used to pad fixed String fields (CT_FSTRING) to allow proper target key formation.

Returns:
The pad character
Throws:
CTException

GetDlmChar

public char GetDlmChar()
                throws CTException
Retrieve the table field delimiter characters. This characters is used to pad fixed String fields (CT_FSTRING) to allow proper target key formation.

Returns:
The field delimiter character
Throws:
CTException

SetPadChar

public void SetPadChar(char Padchar,
                       char Dlmchar)
                throws CTException
Set the table pad and field delimiter characters in the table handle. These characters are used to pad fixed String fields (CT_FSTRING) to allow proper target key formation.

Parameters:
Padchar - Pad character
Dlmchar - Field delimiter character
Throws:
CTException

UpdatePadChar

public void UpdatePadChar(char Padchar,
                          char Dmlchar,
                          boolean Rebuild)
                   throws CTException
Update the table pad and delimiter character resource. The table must be opened exclusive to allow update of the resource.

Parameters:
Padchar - New pad character
Dmlchar - New field delimiter character
Rebuild - Indicate if the table should be rebuild. If rebuild is set to true, every record is read and the fixed String fields (CT_FSTRING) are padded according to new padding strategy.
Throws:
CTException

HasDelField

public boolean HasDelField()
Indicate if a table has the $DELFLD$ internal field.

Returns:
return true if the table has $DELFLD$ field or false if the table has no $DELFLD$ field or if the handle is invalid (not allocated, the table is not opened, is not a table handle, etc).

SetIndexFilename

public void SetIndexFilename(int IndexNumber,
                             java.lang.String Path,
                             java.lang.String Filename)
                      throws CTException
Set the index filename.

Parameters:
IndexNumber - Number of index to set the name
Path - Index path. If NULL use the table path.
Filename - index file name. If NULL use the table name.
Throws:
CTException

SetIndexFilename

public void SetIndexFilename(java.lang.String IndexName,
                             java.lang.String Path,
                             java.lang.String Filename)
                      throws CTException
Set the index file name

Parameters:
IndexName - Name of index
Path - Index path. If NULL use the table path.
Filename - index file name. If NULL use the table name.
Throws:
CTException

GetIndexFilename

public java.lang.String GetIndexFilename(int IndexNumber)
                                  throws CTException
Retrieve the index name

Parameters:
IndexNumber - Index number
Returns:
Return the name of the index file. If Index name is NULL the returned String will be cleared.
Throws:
CTException

GetIndexFilename

public java.lang.String GetIndexFilename(java.lang.String IndexName)
                                  throws CTException
Retrieve the index file name

Parameters:
IndexName - Index Name
Returns:
Return the name of the index file. If index file name is NULL the returned String will be cleared.
Throws:
CTException

GetDatno

public int GetDatno()
             throws CTException
Retrieve the table datno.

Returns:
Return the table datno.
Throws:
CTException

GetIdxno

public int GetIdxno(int Index)
             throws CTException
Retrieve the index file number given the index c-treeDB number.

Parameters:
Index - c-treeDB index number. The first index number is zero.
Returns:
Return the index file number
Throws:
CTException

GetIdxno

public int GetIdxno(java.lang.String IndexName)
             throws CTException
Retrieve the index file number given the index name.

Parameters:
IndexName - Index name.
Returns:
Return the index file number
Throws:
CTException

Remove

public void Remove()
            throws CTException
Delete a table. If the table was open under a database, the table is first droped from the database and then deleted. This method is the equivalent of C function ctdbRemoveTable.

Throws:
CTException

ClearAllFieldDefaultValue

public void ClearAllFieldDefaultValue()
                               throws CTException
Clear the default value associated with all fields in a table. The default date and time types for each field are also reset to the default values of CTDATE_MDCY and CTIME_HMS respectively.

Throws:
CTException

GetStatus

public int GetStatus()
Retrieve table status. The table status indicate which rebuild action will be taken by an alter table operation. The possible rebuild status are: CTDB_REBUILD_NONE (0) Nothing to be done, no changes to table CTDB_REBUILD_DODA (1) Update the table doda CTDB_REBUILD_RESOURCE (2) Update table FC!DFLD resource CTDB_REBUILD_INDEX (4) Add new indices to table CTDB_REBUILD_ALL (8) Rebuild all indices CTDB_REBUILD_FULL (16) Full table rebuild. A temporary table is created and all data is moved to new table and the indexes are built on the fly. For example, to check if a table needs to rebuild all indexes or perform a full rebuild, the following code can be used: int status = hTable.GetStatus(); if ((status & TABLE_STATUS.CTDB_REBUILD_ALL)!=0) || ((status & TABLE_STATUS.CTDB_REBUILD_FULL)!=0) hTable.Alter(CTDB_ALTER_FULL) else if (status) hTable.Alter(CTDB_ALTER_NORMAL); Parameters: none

Returns:
Reurn CTDB_REBUILD_NONE if table is not changed or a bit mask of the values above describing the table status. The static members of TABLE_STATUS class can be used to compare the bitmask.

GetOwner

public java.lang.String GetOwner()
Retrieve the table owner. If the table owner was not previously set by SetOwner, GetOwner return an empty string.

Returns:
Return the table owner or empty string if no table owner is set.

SetOwner

public void SetOwner(java.lang.String owner)
              throws CTException
Set the table owner. You should set the table owner before the table is created to allow the proper c-tree security setting to table place.

Parameters:
owner - table owner. If owner is an empty string the table owner will be cleared. Returns: none
Throws:
CTException

Rebuild

public void Rebuild(int Mode)
             throws CTException
Build data and index files. You must open the table before ctdbRebuildTable is executed. If the table is corrupt, open the table with CTOPEN_CORRUPT mode and then call ctdbRebuildTable to rebuild the data and index files. If there are missing index files, open the table with CTOPEN_DATAONLY mode and ctdbRebuildTable will reconstruct the missing index files. The following steps are performed during the table rebuild process: 1. If a tranasaction is active, and the table being rebuild was created with CTCREATE_TRNLOG or CTCREATE_PREIMG, the transaction is committed before the table is rebuild, and the transaction is restarted after the table rebuild process is terminated. 2. The update corrupt flag 'updflg' of the header of the data file is cleared. 3. The internal delete stack chain of fixed-length data files or the internal delete management index of variable length data files are rebuilt. 4. The existing index files are removed and new index files are rebuild over the existing files, optimized for both size and speed.

Parameters:
Mode - Use one of the static members of REBUILD_MODE class to indicate the rebuild mode.
Throws:
CTException

MoveSegment

public void MoveSegment(CTIndex hIndex,
                        int segNumber,
                        int newIndex)
                 throws CTException
Move a segment to another location.

Parameters:
hIndex - Index object representing whose segment is being moved.
segNumber - Number of segment being moved
newIndex - New index position where the segment is to be moved to. .
Throws:
CTException

MoveSegment

public void MoveSegment(int indexNumber,
                        int segNumber,
                        int newIndex)
                 throws CTException
Move a segment to another location.

Parameters:
indexNumber - Number of index whose segment is being moved.
segNumber - Number of segment being moved
newIndex - New index position where the segment is to be moved to. .
Throws:
CTException

MoveSegment

public void MoveSegment(java.lang.String indexName,
                        int segNumber,
                        int newIndex)
                 throws CTException
Move a segment to another location.

Parameters:
indexName - Name of index whose segment is being moved.
segNumber - Number of segment being moved
newIndex - New index position where the segment is to be moved to. .
Throws:
CTException

PartAdminByName

public int PartAdminByName(java.lang.String PartName,
                           int PartMode)
                    throws CTException
Perform a partition operation on the partition specified by name

Parameters:
PartName - the name of the partition
PartMode - the partition mode indicating the operation to perform
Returns:
If CTPART_MODE_E.STATUS is passed returns the partition status otherwhise 0 (CTDBRET.OK).
Throws:
CTException

PartAdminByNumber

public int PartAdminByNumber(int Prawno,
                             int PartMode)
                      throws CTException
Perform a partition operation on the partition specified by raw partition number

Parameters:
Prawno - the raw number of the partition
PartMode - the partition mode indicating the operation to perform
Returns:
If CTPART_MODE_E.STATUS is passed returns the partition status otherwhise 0 (CTDBRET.OK)
Throws:
CTException

SetIdentityField

public void SetIdentityField(java.lang.String FieldName,
                             long Seed,
                             long Increment)
                      throws CTException
Sets the identity field

Parameters:
FieldName - Field name to be changed to identity
Seed - Identity seed value
Increment - Identity increment value
Throws:
CTException

NumberOfKeyEntries

public long NumberOfKeyEntries(int index)
                        throws CTException
Retrieve the number of key entries in a index file.

Parameters:
index - the index number. The first index number is zero.
Returns:
Return the number of index entries. Throws CTException on error.
Throws:
CTException

NumberOfKeyEntries

public long NumberOfKeyEntries(java.lang.String indexName)
                        throws CTException
Retrieve the number of key entries in a index file.

Parameters:
indexName - the index name that will be used to retrieve the number of key entries.
Returns:
Return the number of index entries. Throws CTException on error.
Throws:
CTException