Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbSetSessionParams

Set the session parameter based on the parameter type.

Declaration

CTDBRET ctdbSetSessionParams(CTHANDLE Handle, CTSESSION_PARAM

ParamType, NINT value)

Description

ctdbSetSessionParams() sets the session parameter based on the parameter type. It is necessary to set parameters before logging on to the server with ctdbLogon().

  • Handle [in] the session handle.
  • ParamType [in] the parameter type. Allowed values are:
    • CT_BUFS: the number of index file buffers, minimum 3
    • CT_FILS: initial block of file structures.
    • CT_SECT: the number of node sectors. Minimum of one required. sect multiplied by 128 equals the index node size.
    • CT_DBUFS: the number of buffers for data files I/O
    • CT_USERPROF: is the user profile mask, and accepts the following values:
      • USERPRF_CLRCHK - instructs single-user TRANPROC applications to remove S*.FCS and L*.FCS files upon a successful application shutdown. The c-tree Plus checkpoint code determines at the time of a final checkpoint if there are no pending transactions or file opens, and if this user profile bit has been turned on. If so, the S*.FCS and L*.FCS files are deleted. However, if the application is causing log files to be saved (very unusual for a single-user application), then the files are not cleared. The USERPRF_CLRCHK option is off by default.
      • USERPRF_LOCLIB - specifies this instance of c-tree Plus is to be directed to a local database. Applicable only to client/server when using "Local Library Support".
      • USERPRF_NDATA - enable the manual mode of UNIFRMAT support. Enabling the manual record transformation mode would only be desirable when performing custom record level byte flipping or the record structures contain no numeric data (i.e., LONG, FLOAT, . . .). A side benefit of enabling this manual mode is the virtual elimination of Server DODA requests, thereby reducing network traffic by one function call per file open.
      • USERPRF_NTKEY - disables the automatic TransformKey() feature. See the Trans function description for more information.
      • USERPRF_PTHTMP - changes GetCtTempFileName() from its default operation of returning a temporary file name to specifying a directory name where temporary files are to reside.
      • USERPRF_SAVENV - enable the automatic SAVENV feature. See the Begin() function description for more information.

To use more than one value, OR the values together. Leave CT_USERPROF set to zero to accept the defaults.

  • value is the numeric value to be attributed to the parameter specified by ParamType.

Returns

ctdbSetSessionParams() returns c-tree error code on failure, or CTDBRET_OK on success.

Example


CTSESSION_TYPE ctdbsess=CTSESSION_CTDB;

CTHANDLE hSession = ctdbAllocSession(ctdbsess);

CTDBRET err;

NINT ret, newbuf;

err = ctdbLogon(hSession, "FAIRCOMS", "ADMIN", "ADMIN");

ret = ctdbGetSessionParams(hSession, CT_BUFS);

newbuf = ret + 2;

err = ctdbSetSessionParams(hSession, CT_BUFS, newbuf);


See also

ctdbGetSessionParams(), ctdbAllocSession()

TOCIndex