Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Indexing
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00829609
Message ID:
00829658
Vues:
22
This message has been marked as the solution to the initial question of the thread.
You could remove the DBF's backlink to the DBC, then recreate the indexes, then restore the backlink. I think Primary/candidate is stored in the DBC, not the CDX, so that setting won't be lost (though I'm not sure).

Restoring the backlink is similar...
*FUNCTION RemCDX( pcFile )
LPARAMETERS pcFile
LOCAL   lnHandle, laJnk[1], lcFlags, oErr, lnRes, lcType, lnHdrLen, lcHdrLen
PRIVATE nErr
nErr  = 0
lnRes = 0
if adir(laJnk,pcFile)=0
  RETURN -1
endif
lnFileSize = laJnk[2]
lnHandle = THIS.LLFF.FOPEN(pcFile,12)   && Open file, R/W, Unbuffered
IF lnHandle <= 0
  RETURN iif(lnHandle=0,-1,lnHandle)
ENDIF

oErr = On("ERROR")
ON ERROR nErr=Error()

lcType = THIS.LLFF.FREAD(1)
if ASC(lcType)<>0x30 && Visual Foxpro
  THIS.LLFF.FCLOSE
  ON ERROR &oErr
  RETURN 0
endif

* Find start of DBC name
THIS.LLFF.FSEEK(8,0) && First Record Pointer
lcHdrLen = THIS.LLFF.FREAD(2)
lnHdrLen = ASC(lcHdrLen) + ASC(SubStr(lcHdrLen,2))*256
  
* Clear out DBC name
THIS.LLFF.FSEEK(lnHdrLen-263,0)
THIS.LLFF.FWRITE( REPL(chr(0),263) )
  
THIS.LLFF.FCLOSE
ON ERROR &oErr

RETURN lnRes
>I want to drop and recreate tags some of which are Primary and Candidate. Does anybody know of code that can do this without losing things in the DBC?
>TIA
>Pete.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform