The FairCom DB API and FairCom DB API .NET interface layers have been enhanced with added functions and methods for administering and managing c-treeACE partitioned files.
FairCom DB API C API
The following functions have been added to FairCom DB API for partitioned file administration:
FairCom DB API C++ API
Three methods have been added to the CTTable class for partitioned file administration:
FairCom DB API .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 FairCom DB API .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);