Product Documentation

c-treeACE V10.0 Update Guide

Previous Topic

Next Topic

c-treeDB .NET Interface Support for Partition File Management

The c-treeDB and c-treeDB .NET interface layers have been enhanced with added functions and methods for administering and managing c-treeACE partitioned files.

c-treeDB C API

The following functions have been added to c-treeDB for partitioned file administration:

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

c-treeDB C++ API

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

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

c-treeDB .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 c-treeDB .NET CTTable.PartAdminByKey() Method

Previous Topic

Next Topic

Additional c-treeDB .NET CTTable.PartAdminByKey() Method

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

TOCIndex