Product Documentation

c-treeACE V10.0 Update Guide

Previous Topic

Next Topic

FairCom DB API .NET Interface Support for Partition File Management

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:

  • ctdbPartAdminByName()
  • ctdbPartAdminByKey()
  • ctdbPartAdminByNumber()

FairCom DB API C++ API

Three methods have been added to the CTTable class for partitioned file administration:

  • PartAdminByName()
  • PartAdminByKey()
  • PartAdminByNumber()

FairCom DB API .NET

Three methods have been added to the CTTable class for partitioned file administration:

  • PartAdminByName()
  • PartAdminByKey()
  • PartAdminByNumber()

Descriptions for the .NET methods are in the Function Reference appendix in Partitioned File Management API.

 

In This Section

Additional FairCom DB API .NET CTTable.PartAdminByKey() Method

Previous Topic

Next Topic

Additional FairCom DB API .NET CTTable.PartAdminByKey() Method

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);

TOCIndex