3.2.4 Data Access
The majority of your applications will consist of data related functions.
Once your application has opened a communications session, it can access the data on the host. Using LANSA Open, you can get, add, change and delete information on the host. You may also execute LANSA and other host programs.
There are a wide range of data access functions. These functions have been grouped into the following functional areas:
These functions are used to fetch, add, change or delete a single record from the host. |
|
These functions are used to retrieve one or more records from the host. |
|
These functions are used if you have commitment control invoked for your host database. |
|
These functions are used to retrieve information, such as descriptions, labels and column headings, which are stored in the host Repository. |
|
These functions are used to use or prepare the current value for a field. |
|
These functions are used to execute LANSA and iSeries programs or OS/400 functions. |
|
LANSA Open has its own automated error management facility, or alternatively, your application can perform its own error handling using the functions provided. |
File Processing - Single Record
The LceInsert, LceUpdate and LceDelete functions have a validate parameter which allows a check to be made without performing the actual operation.
LceCheckFor |
Checks for the existence of a record in the specified file. The validate parameter of the insert, update or delete function can be used instead of this function. |
LceSetSelectOptions |
Specifies the select or fetch options. |
LceFetch |
Fetches the values of the specified fields from the specified file. |
LceInsert |
Inserts the values of the specified fields into a record. |
LceUpdate |
Updates the record with the values in the fields specified. |
LceDelete |
Deletes a record from the specified file. |
Note: When multiple users are accessing a database, eventually two or more users will want to update the same record at the same time.
What should you do about this?
Refer to the LceUpdate or LceDelete function details to find out.
File Processing - Multiple Record
LceRequestSelect |
Selects records on the host. |
LceRequestSelectWhere |
Provides a 'where' condition to be used when selecting records on the host. |
LceReceiveSelect |
Transfers records from the host to the PC. |
LceGetRecordCount |
Determines how many records were transferred from the host. |
LceGetSelect |
Retrieves the next record from the records transferred to the PC. |
LceSelect |
Selects and retrieves specified fields from file. |
LceReceiveNextX |
Gets the next record transferred from the host. |
LceDeleteSelect |
Deletes the temporary file used to hold the host records transferred to the PC. |
These functions are only effective if the LceSetCommitmentOn function has been executed and Commitment Control definitions have been configured correctly on the host files.
LceCommitWork |
Commits the current transaction. |
LceRollBackWork |
Rolls back the current transaction. |
These functions are used to retrieve information from the Repository for your PC application:
LceGetFieldDesc |
Retrieves the field description. |
LceGetFieldHeading |
Obtains the three line field heading. |
LceGetFieldIndicator |
Returns the DBCS field indicator. |
LceGetFieldLabel |
Returns the field label. |
LceGetFieldType |
Returns the field type. |
LceGetFieldValueH |
Sets the window text field value. |
LceGetFileDesc |
Returns the file description. |
LceGetFileType |
Returns the file type. |
LceGetVariable |
Retrieves the system or multilingual variable. |
LceGetFieldEdit |
Fetches the edit code or word. |
LceGetDefaultValueX |
Returns the field's default value. |
LceGetFieldHelpText |
Returns the field's help text to a buffer or displays it in a window. |
LceGetFieldAttributes |
Returns the field's attributes. |
LceGetFieldValueX |
Retrieves the field's current value. |
LceSetFieldValue |
Sets the field value in the field information area. |
LceLocalDateTimeToServer |
Converts the DateTime from the client's local timezone into UTC (Universal Coordinated Time). This function is for use in creating Where clauses which contain DateTime values. |
LceGetFieldDataLength |
Retrieve the length of the field's current value. |
These functions allow you to execute processes on the host.
By re-using existing host processes and functions, significant savings can be made in development time. Consistency between client and host processes is also maintained.
For tasks requiring access to multiple files, perform them on the host, to allow your client applications to benefit from the host's fast file processing.
LceLansaCall |
Executes a LANSA process/function or an iSeries program with an immediate response. |
LceExecute400 |
Executes the specified function on the iSeries. |
LceSubmit |
Submits a LANSA process/function or an iSeries program in batch mode. |
Lce3GLDefineParameter |
Defines the attributes and optionally sets the values of the parameter used in the Lce3GLCall function. |
Lce3GLCall |
Executes the specified 3GL program on the iSeries. |
Lce3GLGetValue |
Fetches the parameter value returned by the Lce3GLCall function. |
There are two ways to manage your error messages.
You can:
- let LANSA Open perform all the error message handling automatically
or
- do your own error message handling.
LceDisplayErrors |
Displays error messages automatically. |
LceGetStatus |
Returns the error status and message, if any. |
LceGetMessageCount |
Counts the number of messages sent by the Host System. |
LceGetMessage |
Returns the specified error message. |