Language Reference Guide : System Classes : QueryObject Class : CommitToCache Method
 
Share this page          
CommitToCache Method
The CommitToCache method keeps data in the cache consistent with data in the database when insert, update or delete operations are performed on cached data.
This method has the following syntax:
integer = QueryObject.CommitToCache()
This method updates the cache to reflect the last DBInsert, DBUpdate, or DBDelete operation performed when the query object is opened in QY_CACHE mode.
To modify the values in the cache, the CommitToCache method uses the row in the cache that was last affected by a DBUpdate, DBInsert, or DBDelete method. For this to work properly, the target mappings for DB methods on the QueryObject must be defined in such a way as to affect only one row of data, and the index for this row should be passed as an argument to these methods. Also, a DB operation must be committed to the cache before another operation is performed.
This method reads the variables and fields that have been defined as select targets for a query to construct the appropriate row to be inserted or updated in the cache. If more than one target has been defined for a given column or expression, the first applicable target in the list is the one used to construct the row.
If the CommitToCache method is successful, it returns ER_OK. If it is not successful, it returns a non-zero value. Descriptions of system constant values and their numeric equivalents are listed in Error Codes).