CTBase::GetSystemConfig
Retrieve c-tree Plus system configuration values.
Syntax
LONG CTBase::GetSystemConfig(NINT index);
Description
GetSystemConfig() retrieves c-tree Plus system configuration values, as well as some of the important dynamic aspects of the system, such as the memory usage and the number of files in use. To determine if a particular system configuration option is active, call GetSystemConfig(), passing the corresponding pre-define constant for that option, and check if the value returned is non-zero.
The following pre-defined constant should be passed to GetSystemConfig():
Constant |
Description |
---|---|
cfgMEMORY_USAGE |
Current system memory usage. |
cfgMEMORY_HIGH |
Highest system memory use. |
cfgNET_ALLOCS |
Current system net allocations. (Number of memory allocations minus the number of free calls.) |
cfgOPEN_FILES |
FairCom DB files opened by system. |
cfgPHYSICAL_FILES |
Physical FairCom DB files open. Includes c-tree Superfile members omitted from cfgOPEN_FILES count. |
cfgOPEN_FCBS |
FairCom DB file control blocks in use by system. |
cfgLOGIDX |
Is file mode ctLOGIDX supported? |
The following constants only apply to client-server implementations:
Constant |
Description |
---|---|
cfgDNODE_QLENGTH |
Messages in delete node queue. |
cfgCHKPNT_QLENGTH |
Messages in checkpoint queue. |
cfgSYSMON_QLENGTH |
Messages in system monitor queue. |
cfgLOGONS |
Current number of logons. |
cfgNET_LOCKS |
Current number of pending locks (system wide). |
cfgUSERS |
Maximum number of logons. |
cfgMAX_CONNECT |
The limit for the maximum number of logons. |
cfgUSER_FILES |
Number of FairCom DB files opened by calling user. |
cfgUSER_MEMORY |
Current user memory usage. |
cfgPATH_SEPARATOR |
ASCII value for the file name path separator. |
The following constants are static compile time values:
Constant |
Description |
---|---|
cfgFILES |
Maximum number of c-tree Plus file control blocks available system wide. |
cfgMAX_DAT_KEY |
Maximum number of indices per data file. |
cfgMAX_KEY_SEG |
Maximum number of key segments per index. |
The constants above and the pre-initialization resources section below have client and c-tree Server versions, except for the following three subscripts:
Constant |
Description |
---|---|
cfgINIT_CTREEapp |
Determine whether FairCom DB has been initialized. |
cfgSERIALNBR |
The c-tree Server serial number. |
cfgTHREADapp |
Indicates if threading has been enabled. |
Constants ending with ‘app’ are specific to the client side of a client/server application. To check the same system setting for the c-tree Server, use the same subscript without the app extension. For example, to determine if Conditional Index support is active on the c-tree Server, use cfgCONDIDX as the subscript and cfgCONDIDXapp for the client side.
Constant |
Description |
---|---|
cfgBOUNDapp |
Indicates if the application is bound to a database library. See the discussion on the different FairCom I/O models in these notes. |
cfgDISKIO_MODELapp |
A non-zero value indicates a stand-alone multi-user I/O model i.e. FPUTFGET. |
cfgLOCLIBapp |
A non-zero value indicates Local Library support. |
cfgNOGLOBALSapp |
A non-zero value indicates no globals are supported, that is, indicating all globals are stored in an allocated structure. This is the default setting. |
cfgUNIFRMATapp |
A non-zero value indicates FairCom's automatic byte flipping (UNIFRMAT) is active. |
The pre-initialization resource constants below may be specified prior to a c-treeDB initialization call, i.e ctdbLogon(), CTSession::Logon(), or CTSession.Logon(), in addition to having both a client and c-tree Server version, as discussed above.
Constant |
Description |
---|---|
cfgANSIapp |
Specifies whether to use ANSI. A non-zero value indicates ANSI. |
cfgCONDIDXapp |
A non-zero value indicates the application supports. FairCom's Conditional Index Logic. |
cfgCTBATCHapp |
A non-zero value indicates the application supports. Batch Operations. |
cfgCTSUPERapp |
A non-zero value indicates the application supports c-tree Superfiles. |
cfgCTS_ISAMapp |
A non-zero value indicates the application supports FairCom's ISAM API. |
cfgHISTORYapp |
A non-zero value indicates the application supports FairCom's History Logic. |
cfgINIT_CTREEapp |
A non-zero value indicates FairCom DB has been initialized. |
cfgLOGIDXapp |
A non-zero value indicates the application supports the ctLOGIDX Logic. |
cfgPARMFILEapp |
A non-zero value indicates parameter files are supported. |
cfgPASCAL24app1 |
A non-zero value indicates 2-byte/4-byte length delimited strings are using the traditional pascal length convention. |
cfgPASCALstapp1 |
A non-zero value indicates byte length delimited strings are using the traditional pascal length convention. |
cfgPATH_SEPARATORapp |
Return the ASCII value for the file name path separator. |
cfgPROTOTYPEapp |
A non-zero value indicates the application supports Prototypes. |
cfgRESOURCEapp |
A non-zero value indicates the application supports Resource Records. |
cfgRTREEapp |
A non-zero value indicates the application supports the r-tree report engine. |
cfgSERIALNBR |
Return c-tree Server serial number. |
cfgTHREADapp |
A non-zero value indicates the application supports FairCom's threading API. |
cfgTRANPROCapp |
A non-zero value indicates the application supports Transaction Processing. |
cfgVARLDATAapp |
A non-zero value indicates the application supports Variable Length Records. |
cfgVARLKEYSapp |
A non-zero value indicates the application supports Variable Length Keys i.e. Key compression. |
cfgWORD_ORDERapp |
Indicates the client data order: Low_High or High_Low. A non-zero value indicates Low_High. |
1Pascal length byte
FairCom DB supports two different methods for specifying the length byte in a pascal data type. The original and non-traditional approach does not include the length byte in the byte count. For example, with a 1-byte data type, CT_FPSTRING, the smallest valid length byte would be 0. The new method follows the more traditional pascal convention of including the length byte in the byte count. For example, with the traditional approach, the smallest valid length for a 1-byte data type would be 1. Therefore, if cfgPASCALstapp or cfgPASCAL24app return a non-zero value, the new traditional approach is active.
To receive a valid return value from cfgPATH_SEPARATOR, ctPATH_SEP must be defined. The default definition found in ctopt2.h is:
#define ctPATH_SEP '?'
This definition specifies that the system default path separator will be used. To use the same separator for all platforms, you might want to choose one of the following:
#define ctPATH_SEP '\\'
/* define for Windows */
#define ctPATH_SEP '/'
/* define for most Unix systems */
#define ctPATH_SEP ':'
/* define for Mac OSX */
/* where the Uninitialized value is NINT_ERR for a client or FINT_ERR for a bound application */
The following constants can be used to capture system-wide cache and buffer statistics, (cache pages hold data record images and buffers hold index nodes), allowing an application to track the use of these resources.
Constant |
Description |
---|---|
cfgCACHE_PAGES |
Available cache pages |
cfgCACHE_PAGES_INUSE |
Cache pages in use |
cfgCACHE_PAGES_MXUSE |
Maximum cache pages used |
cfgCACHE_PAGES_DED |
Available dedicated cache pages |
cfgCACHE_PAGES_DEDINUSE |
Dedicated cache pages in use |
cfgCACHE_PAGES_DEDMXUSE |
Maximum dedicated cache pages used |
cfgBUFFER_PAGES |
Available index buffers |
cfgBUFFER_PAGES_INUSE |
Index buffers in use |
cfgBUFFER_PAGES_MXUSE |
Maximum index buffers used |
Return
Returns a value that depends on the configuration constant passed to GetSystemConfig().
Example
// check if TRANPROC was turned
if (hSession.GetSystemConfig(ctTRANPROC))
printf("TRANPROC was turned on during compilation\n");
else
printf("TRANPROC was turned off during compilation\n");
See Also
none