[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+-----------+##############################################################
#+-| A_FLOCK() |--------------------------------------------------+###########
#| +-----------+ Attempts to lock the alias passed as a parameter |###########
#+----------------------------------------------------------------+###########
##############################################################################
##############################################################################
#+--| Summary |------------------+############################################
#| #INCLUDE database.hdr |############################################
#+-------------------------------+############################################
##############################################################################
##############################################################################
#+--| Syntax |--------------------------------+###############################
#| FUNCTION LOGICAL a_flock PROTOTYPE |###############################
#| PARAMETERS ALIAS aliasname |###############################
#+--------------------------------------------+###############################
##############################################################################
##############################################################################
########+---| Description |-------------------------------------------+#######
########| a_flock() attempts to lock the alias passed as a parameter. |#######
########| If the database file is successfully locked, a_flock() |#######
########| returns TRUE. Any locks, record or file currently assigned |#######
########| to aliasname are released and, if a_flock() is unsuccessful |#######
########| the locks are not restored. |#######
########| ----------------------------------------------------------- |#######
########| All files associated with aliasname are locked, including |#######
########| index and memo files. |#######
########+-------------------------------------------------------------+#######
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Lock an alias prior to indexing the file. |#########
#########| |#########
#########| DBFDEF names |#########
#########| CHAR(20) name |#########
#########| CHAR(20) addr |#########
#########| ENDDEF |#########
#########| |#########
#########| INDEXDEF |#########
#########| CHAR(20) nind names->name |#########
#########| ENDDEF |#########
#########| |#########
#########| PROCEDURE force_main |#########
#########| VARDEF |#########
#########| CHAR(1) ans |#########
#########| ENDDEF |#########
#########| |#########
#########| OPEN "f:\data\names.dbf" ALIAS names SHARED |#########
#########| ACCEPT "Index database?" TO ans |#########
#########| IF "Yy" $ ans |#########
#########| IF .NOT. a_flock( names ) |#########
#########| INDEX nind |#########
#########| ELSE |#########
#########| ? "Unable to get database." |#########
#########| ? "Please try later..." |#########
#########| ENDIF |#########
#########| ENDIF |#########
#########| {...} |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * Lock a database prior to using COUNT or |#########
#########| * SUM to ensure a good report. |#########
#########| |#########
#########| IF .NOT. a_flock( number_data ) |#########
#########| RETURN .F. |#########
#########| ENDIF |#########
#########| |#########
#########| !number_data COUNT ALL TO count_total |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
a_rlock()
flock()
OPEN
rlock()
UNLOCK
USE
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson