Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- NetLib for Clipper, Version 6.0 - n_setmulti( [ <lsetting> ] ) http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
N_SETMULTI( [ <lSetting> ] )


Parameters

<lSetting>
Logical true causes files to be opened with multiple record locking On.

Logical false causes files to be opened with multiple record locking 
Off.


Returns

Current setting, as a logical.


Description

Allows multiple record locks with RLOCK() instead of, or in addition 
to, using N_MLOCK(). If you set multiple record locking On in the 
current work area and then USE a database, each RLOCK() you apply will 
be incremental. That is, calling RLOCK() will lock the current record 
without releasing any previously locked record. N_MLOCK() will also 
function as an incremental lock when multiple record locking is On. In 
either case you must explicitly UNLOCK records in order to release the 
locks.

Note  It is not necessary to call N_SETMULTI(.T.) in order to use 
N_MLOCK(). However, if you do not set multiple record locking On, 
N_MLOCK() will not be incremental.

Currently open files are not affected by calls to N_SETMULTI().  The 
setting applies only to a file opened after the function is called, and 
will continue to apply until the file is closed. In other words, 
multiple record locking has the same life span in a file as SET 
EXCLUSIVE.

Turn multiple record locking On by calling N_SETMULTI(.T.) just before 
opening the files where the feature is needed. Once the files are open, 
call N_SETMULTI(.F.) so that multiple record locking will not be 
inadvertently set On for any additional files that your program opens.

Multiple record locks are released by the following commands and 
functions:

UNLOCK
FLOCK()
CLOSE
APPEND BLANK

It is your application's responsibility to recognize a potential 
deadlock situation and release all previously locked records. 

Note  Multiple record locking can also be enabled with the MULTI 
clause of N_USE().


Example

* Lock records 1-10 for the Customer database
N_SETMULTI(.T.)
USE Customer SHARED NEW
/* Multiple record locking is engaged for the Customer
   file. We don't want to be on with the next USE
   command, so we'll turn it off now. */
N_SETMULTI(.F.)

RLOCK()                     // Lock record 1
SKIP
RLOCK()                     // Also lock record 2
N_MLOCK('3,4,5,6,7,8,9,10') // Lock the rest
.
.
.
USE Orders SHARED NEW
RLOCK()                     // Lock record 1
SKIP
RLOCK()                     // Unlock 1 and lock 2
N_MLOCK('3,4,5,6,7,8,9,10') // Unlock 2 and lock 3-10



See Also: N_CHECKR() N_MLOCK() N_TIMEOUT() N_USE()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson