The c-treeDB and c-treeDB .NET interface layers have been enhanced with added functions and methods for administering and managing FairCom DB partitioned files.
c-treeDB C API
The following functions have been added to c-treeDB for partitioned file administration:
c-treeDB C++ API
Three methods have been added to the CTTable class for partitioned file administration:
c-treeDB .NET
Three methods have been added to the CTTable class for partitioned file administration:
Descriptions for the .NET methods are in the Function Reference appendix in Partitioned File Management API.
The c-treeDB .NET CTTable.PartAdminByKey() method initially had only a parameter requiring a IntPtr type and required marshaling of data into this type, which can be somewhat cumbersome. A new overloaded method has been added to allow a CTRecord type and an integer key length to be passed. PartAdminByKey() now internally calls CTRecord.BuildTargetKey() and passes the proper target key value to the partition administration method for ease of use.
COUNT PartAdminByKey(CTRecord Record, int KeyLen, CTPART_MODE_E PartMode)
Example
// allocate objects
MySession = new CTSession(SESSION_TYPE.SQL_SESSION);
MyDatabase = new CTDatabase(MySession);
MyTable = new CTTable(MyDatabase);
Console.WriteLine("\tLogon to server...");
MySession.Logon("FAIRCOMS", "ADMIN", "ADMIN");
MyDatabase.Connect("ctreeSQL");
Console.WriteLine("\tOpen table...");
MyTable.Open("custmast", OPEN_MODE.EXCLUSIVE_OPEN);
// Duplicate keys allow for 8 extra bytes
dupLen = 8;
Int64 ts = 121140092800000000;
int keyLen = 8 + dupLen;
CTRecord rec = new CTRecord(MyTable);
rec.Clear();
rec.SetDefaultIndex("custmast_idx_partition");
rec.SetFieldValue("entry_date", ts);
MyTable.PartAdminByKey(rec, keyLen, CTPART_MODE_E.PURGE);