Identifies one or more records matching the search criteria in a file on the host. No data is transferred from the host.
BOOL |
LceRequestSelectWhere |
(int |
iSession, |
|
|
char * |
strFieldList, |
|
|
char * |
strFileName, |
|
|
char * |
strKeyList, |
|
|
char * |
strConditions, |
|
|
BOOL |
fGeneric) |
Parameters
iSession |
The session identifier. |
strFieldList |
A list of field names. All fields must have been declared using an LceUseField function. Field (i.e. column) names may be specified in upper or lower case. Field names do NOT begin with "#" (hash/pound) signs. This list may refer to any fields from the specified file. Fields may be real or virtual. |
strFileName |
The name of the file. This file must have been declared using an LceUseFile function |
strKeyList |
A list of key field names. These key fields must have been declared using the LceUseField function. The values for the keys are set using the LceSetFieldValue/ LceSetFieldValueU function. Key fields must not be specified if the *BLOCKBYKEY option was used in the preceding LceSetSelectOptions. Refer to the notes before using these key fields. |
strConditions |
The 'Where' clause used for the select. Refer to the notes for more information, including how to correctly use DateTime field values. |
fGeneric |
Refer to the notes for more information. True = apply a generic search. False = do not apply a generic search. |
Return Values
TRUE is returned if the session can select records.
FALSE is returned if an error occurs.
Notes
The Where clause, specified in strConditions, must conform to the rules defined for Expression format and definition in Specifying Conditions and Expressions in the LANSA Technical Reference Guide.
(SALARY *LT 30000) *AND (DEPTMENT *EQ 'ADM')
SALARY *LT 30000
Key and Generic search considerations:
The LceRequestSelectWhere function is used with a number of other select processing functions. If the *RECEIVEIMMED option is not used with LceSetSelectOptions, the general pattern of these functions is as follows :
If the *RECEIVEIMMED option is used, then the functions will be as follows:
Tip
Performance Considerations
For better performance, whenever possible use an LceRequestSelect instead of this LceRequestSelectWhere function.
If your host is an IBM i and when LceRequestSelectWhere must be used, consider using the *BLOCKBYRRN and *RECEIVEIMMED select options in the preceding LceSetSelectOptions for best performance and lowest impact on the IBM i server. Review the LceSetSelectOptions for more details.
For example:
LceSetFieldValue(iSessionId, "DEPTMENT", "ADM");
LceRequestSelectWhere(iSessionId,
"EMPNO,SURNAME,SALARY"
"PSLMST",
"DEPTMENT",
"SALARY *GT 30000",
FALSE);
will normally be more efficient than:
LceRequestSelectWhere(iSessionId,
"EMPNO,SURNAME,SALARY"
"PSLMST",
"",
"(SALARY *GT 30000) AND (DEPTMENT = 'ADM')",
FALSE);
Constantly consider the viability of what you are doing.
For example, a select operation reading 10,000 rows to select 100, frequently used from multiple PC clients, is not a viable operation on any host system. Consider setting up a key/logical view to better support this type of operation.
The concept of what is viable varies according to
Remember that the LANSA Open functions are primarily designed to act as high performance "back ends" to programmer designed and implemented applications, not to be generic end user query tools by themselves.
Related Functions