4.3.80 ctdbFilterRecord
Set the filtering logic for the table.
Declaration
CTDBRET ctdbFilterRecord(CTHANDLE Handle, pTEXT expr)Description
ctdbFilterRecord sets the filtering for a table. When set, all records retrieved from the table are filtered against the expression and only records matching this criteria will be returned. This feature is temporary and the effect is limited to the user who sets the filter. The filter is turned off when the table is closed, or when ctdbFilterRecord is called with the record or table handle and NULL in the parameter expr. If a new expression is set to a table with a current filter, the old filter is replaced with the new one. Just one filter may be active per table per user.
When used in the client/server model, this feature has the potential to increase the performance since only records matching the criteria will be returned, reducing the network traffic.
ctdbGetFilter may be used to retrieve the filter and ctdbIsFilteredRecord to verify if there is a filter in the table.
- Handle [in] the table or record handle.
- expr [in] the filtering expression. The valid expressions are given in the table below.
If none of the above expressions is enough for the filtering logic the user would like to implement, there is yet a possibility of a user defined expression to be used. This so called "callback routine" is passed to the filter with an "at" sign (@) in the beginning of the expression. If this is done, what follows the @ is going to be the identifier to the user to handle in the routine ctfiltercb (located in ctclbk.c). Notice, though, that this is considered an advanced feature since it will require the editing of one of c-tree Plus source files to insert the call to the user defined routine(s).
Returns
ctdbFilterRecord returns CTDBRET_OK on success, or the c-tree Plus error code on failure.
See also
ctdbGetFilter, ctdbIsFilteredRecord, ctdbRecordSetOn
|
FairCom Corporation www.faircom.com |