Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP5.0 doesn't ignore deleted files
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00241343
Message ID:
00241356
Views:
12
I think the feature is "by design" since the deleted records can be recalled (undeleted) they still must be unique. Here is a unique key generator (I think from the Tastrade sample on the cd). You have a table will the table names and the next free primary key.
FUNCTION NewID(tcAlias)
  LOCAL lcAlias, ;
        lcID, ;
        lnOldArea

  lcAlias = UPPER(tcAlias)
        
  lcID = 0
  lcOldReprocess = SET('REPROCESS')
  
  *-- Lock until user presses Esc
  SET REPROCESS TO AUTOMATIC
  
  IF !USED("TABLES")
    USE data\tables IN 0
  ENDIF
  SELECT tables 
  set order to tablename
      
  IF SEEK(lcAlias)
    IF RLOCK()
      lcID = tables.nextid
      REPLACE tables.nextid WITH lcID + 1
      UNLOCK
    ENDIF
  ENDIF
    
  SET REPROCESS TO lcOldReprocess
  
  RETURN lcID
ENDFUNC

******************     
>I used pack within the code but i get an error that the table must be opened exclusively. This is a multi-user system and many users will be using it. I don't believe I will be able to open the table exclusively since it is a main table that is used in several places - or can I? Are there any options left? Do you know why VFP doesn't ignore the deleted files and why this command has no affect?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform