Product Documentation

c-treeDB API for C++ - Developers Guide

Previous Topic

Next Topic

CTTable::SystemFilterOn

Establishes a permanent system wide data record filter.

Declaration

void CTTable::SystemFilterOn(CTSYSFILTER mode);

Description

Establishes a permanent system wide, i.e. the filter applies to all users, read and/or write record filter. Depending on server file security setting, the table must be opened exclusive and the user must have file definition permission for the table. Once a read or a write filter is established, it can only be deleted by calling method CTTable::SystemFilterOff().

A table may have at most one read and one write system wide filter. A write filter will be called when data records are added, updated or deleted.

mode specifies one of the following:

  • CTSYSFILTER_READ - Indicates you are deleting only a system wide read record filter.
  • CTSYSFILTER_WRITE - Indicates you are deleting only a system wide write record filter
  • CTSYSFILTER_READ | CTSYSFILTER_WRITE - Indicates you are deleting both a system wide read record filter and a system wide write record filter.

System wide filters must be callback filters. The actual callback evaluation takes place in a new callback function ctfiltercb_rowl() located in module ctclbk.c.

There different levels of security settings when users modify data file definition resources such as IFIL and DODA. The c-tree Server can be configured for three different levels of data file resource security:

FILEDEF_SECURITY_LEVEL LOW:
Lowest security setting. There is no protection as any user may add or delete data file definition resources. This setting may be used to keep the c-tree Server data compatible with legacy applications.

FILEDEF_SECURITY_LEVEL MEDIUM:
Default security setting. Any user may add or delete data file definition resources, but the file must be opened exclusive. This default setting may be enough to keep the c-tree Server data compatible with most legacy applications.

FILEDEF_SECURITY_LEVEL HIGH:
Highest security setting. A user must have file definition permission before a definition resource is added or deleted. The file must be opened exclusive. This setting is appropriate for applications that require the highest level of security and may cause compatibility problems with existing legacy applications.

Return

On error CTTable::SystemFilterOn() throws a CTException exception object.

Example


try

{

// open an existing table

hTable.Open("table_name", CTOPEN_EXCLUSIVE);

// establish a new system wide read-write filter

hTable.SystemFilterOn(CTSYSFILTER_READ | CTSYSFILTER_WRITE);

// close the table

hTable.Close();

}

catch (CTException &err)

{

printf("Setting system filter failed with error %d\n", err.GetErrorCode());

}

See Also

CTTable::SystemFilterOff()

TOCIndex