CacheSetLocks

  Previous topic Next topic  

CacheSetLocks ( acLockString, hConnection ) -> lSuccess

The function returns SUCCESS or FAILURE all the locks in <acLockString> have been obtained for [hConnection].

<acLockString> A character string or a one-dimensional array of strings representing locks to be obtained. The failure and success depends upon the completness of locks, i.e., either all locks requested be obtained or none. Even if one lock request fails the functions returns failure.

The locks so obtained are local to the application. External processes never knows about these locks. Any operations done under this construct will respect the application commands only.

This function is useful in situations when you are absolutely sure that no external process is about to interfere with tables

Please note that external process is termed as a process which is not initiated by your application; like ODBC driven access to your tables, etc. Multiple instances of your application via multiple terminals are treated as same process for this locking mechanism as the same way as RLock() or FLock(). You can think of this lock mechanism in terms of non-workarea locks. These locks are STRINGID centered rather than RECNO or FILE oriented. I found a lot of situations where I can control business logic with this mechanism. For example, I obtain SEMAPHORES through this mechanism while I am about to update a lot of tables which require proper serialization. A real-time example would be out of the scope this documentation but still I will try to prove my point.

If the locks could not been released due to some error or otherwise, these are automatically released by the server once application instance goes out of scope, i.e., if application is done with or terminated in any situation.