Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Rebuilding structural index problem
Message
De
03/10/2007 16:43:22
Vernon Chambers
New York City Transit
New York, États-Unis
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Rebuilding structural index problem
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Novell 6.x
Database:
Visual FoxPro
Divers
Thread ID:
01258346
Message ID:
01258346
Vues:
57
Hello All!

I've problem running my routine that rebuilds corrupt .cdx files. I've a table that contains the tag names as well as the associated index expression. The function is listed below. The problem occurs whenever I remove the .cdx. Error msg states "Structual CDX file not found". I'd like to circumvent this error and allow the recreation process to continue. Any help would be greatly appreciated.

here is the code:
FUNCTION mkecdx
* -------------------------------------------------------*
PARAMETERS p_tabname	&& tabname is the name of the dbf to indexed

LOCAL l_retval, cOrigArea, x, nCount, n_totkeys, cKey, cCDXFile, cExpr, cTagname

SET SAFETY OFF
l_retval = .F.
x = 1
cKey = SUBSTR(UPPER(p_tabname),1,5)

IF !USED('cdxtable')
      USE cdxtable INDEX cdxtable ALIAS cdxtable EXCLUSIVE IN 0
ENDIF

SELECT cdxtable    && table contains tag names and expressions
SET ORDER TO 1
IF SEEK(cKey)

	cCDXFile = p_tabname+'.CDX'
	IF FILE( cCDXFile )
		USE ( p_tabname) INDEX (p_tabname) ALIAS Prime IN 0 EXCLUSIVE
		SELECT Prime
		DELETE TAG ALL OF (p_tabname)
		IF FILE(cCDXFile)	&& check to see if file has been erased
			MESSAGEBOX('Error erasing '+p_tabname+'.CDX',0+16,'System Error',50)
			RETURN l_retval
		ENDIF
	ELSE
		USE ( p_tabname) ALIAS Prime IN 0 EXCLUSIVE
		SELECT Prime

	ENDIF

	DO WHILE cdxtable.dbfkey = cKey .AND. !EOF()
		cExpr = TRIM(cdxtable.EXPR)
		cTagname = cdxtable.DESC
		INDEX ON &cExpr TAG &cTagname
		SKIP IN cdxtable
	ENDDO
	SELECT Prime
	USE
	l_retval = .T.
	
ENDIF

RETURN l_retval
ENDFUNC
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform