Product Documentation

V11.5 Update Guide

Previous Topic

Next Topic

Index Range Support for Virtual Segment Groups

This new range operator can retrieve key ranges defined over a group of contiguous key segments.

The c-treeACE range retrieval function (e.g., AllocateRange) previously operated at the key segment level. In V11.5 and later, it has been enhanced to support a range operator that can be used to perform retrievals on key ranges that are defined over a set of contiguous key segments (referred to here as a “virtual segment group”).

This feature allows you to search for all entries at the key level between two targets: from a low-key to a high-key and from a lower-bound to an upper-bound. By introducing support for grouping two or more contiguous segments into one virtual segment group, it is now possible to perform a new type of range retrieval.

As an example, consider a database that contains two fields of one character each:

"First", CT_FSTRING, 1
"Second", CT_FSTRING, 1

The index would consist of two segments, one for each field.

For this example, assume the data in these fields is as follows:

(A, 1)
(A, 7)
(A, 9)
(A, 11)
(B, 1)
(B, 2)
(B, 5)
(C, 1)
(C, 2)
(C, 5)

It has always been possible to specify a key range that would get us all of the records where the first field is A or an even more complex range where the first field is between A and B and the second field is between 1 and 3. That would get us the following records:

(A, 1)
(B, 1)
(B, 2)
(C, 1)
(C, 2)

A sequential range of records between (A, 7) and (C, 2) is a more challenging case. It would require maintaining a second index of a single segment that includes the first field and the second field. This solution was not possible unless the two fields were adjacent to each other and in the correct order in the database.

With virtual segment group support, we can specify a key range involving two or more index segments, which are adjacent in the index, and treat them as a single segment. The fields need not be adjacent in the database. In our example, that would allow us to specify a key range from (A, 7) to (C, 2), which would get us the following records:

(A, 7)
(A, 9)
(A, 11)
(B, 1)
(B, 2)
(B, 5)
(C, 1)
(C, 2)

New Range Operator Modifiers

This revision introduces two range operator modifiers to be OR-ed in to the operator parameter values passed to AllocateRange():

  • CTIX_SSG marks the beginning of a segment group
  • CTIX_ESG marks the end of a segment group

Example:

NINT oper[2],rc;


oper[1] = CTIX_BET | CTIX_SSG; /* first segment: start segment group */

oper[2] = CTIX_BET | CTIX_ESG; /* second segment: end segment group */

rc = AllocateRange(keyno, 2, ""A4"", ""C6"", &oper);

Previous Topic

Next Topic

Temporary Index RVHD_ERR (123)

Note: This is a Compatibility Change.

c-treeACE temporary indexes are created on a per-user basis. This means that, if user A creates a temporary index over a shared data file and the shared data file is updated by user B, user A’s temporary index will not see user B’s update.

In this situation, it’s possible for ITIM_ERR (160) and RVHD_ERR (123) to occur. The c-treeACE logic has always internally dealt properly with the ITIM_ERR (160), by ignoring the ITIM_ERR (160) for temporary indexes and setting and sysiocod to ITMP_COD (-832).

RVHD_ERR (123) is ignored for temporary indexes and sysiocod is set to ITMP_COD (-832).

It is possible to disable this new behavior for RVHD_ERR (123) by adding COMPATIBILITY TEMP_INDEX_ERROR to ctsrvr.cfg.

TOCIndex