Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- db_VISTA III - d_keylock http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   D_KEYLOCK

SUMMARY
   d_keylock(FIELD,type[,dbn])
   long FIELD;
   int dbn;

ARGUMENTS
   FIELD       The field type of the key field for which is to be locked.

   type        Pointer to a string containing the type of lock to be applied.

   dbn         (optional) The number of the database containing the record.

DESCRIPTION
   Function d_keylock places a lock on the key file which contains
   occurrences of key field FIELD.The type of lock to be applied is specified
   by types as follows:
              Type          Description
               "r"           Read lock.
               "w"           Write lock.
               "x"           Exclusive lock.
               "k"           Keep lock.
  Read lock allow other programs to read but not update the locked files.
  Write locks prevent all other programs from accesing the locked files and
  can only be issued from whithin transaction.Exckusive locks also prevent
  all other programs from accesing the locked files but not be issued
  independent of transactions.Keep locks can only be issued from within a
  transaction and will keep read- and write-locked files read-locked after a
  trasaction ends(d_trend normally frees all read- and write-locked files).
  The record type must be locked in order to apply a keep lock; otherwise
  status S_NOTLOCKED is returned.

  Whithin a trasaction, a read-locked file can be upgraded to a write or
  exclusive lock by calling d_reclock with a write or exclusive lock where a
  read lock already exists.If the upgrate lock request is denied, the read
  lock will remain in effect.

  This function is present in the single-user version of db_VISTA, but
  perfoms no action.This allows multi-user application to link whith the
  single user version for operation on stand-alone computer.

CURRENCY CHANGES
   None.

RETURN CODES

   5    S_UNAVAIL       The requested key file is not available(i.e. you
                        weer on the queue waiting for the file longer
                        than your current time out value).
  -5    S_INVFLD        Invalid field type.
  -11   S_BADTYPE       An invalid lock type was specified.You may have
                        passed a character (e.g.'r') instead of a string
                        (e.g."r")
  -17   S_NOTKEY        FIELD is not defined as a key.
  -23   S_NOTFREE       Key type alread locked by yuor application.
  -31   S_NOTRANS       Requested a write lock outside of a transaction.

EXAMPLE
    /*display all info records in id_code order*/
    while (d_keylock(ID_CODE,"r")==S_UNAVAIL)
    for(d_keylfrst(ID_CODE);db_status == S_OKAY;
            d_keypnext(ID_CODE)){
       d_recread(&irec);
       .. /*print info record contens*/
    }

See Also: d_freeall d_keylstat d_lock d_recfree

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