Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Index does not match the table
Message
De
26/01/2001 19:50:01
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00464255
Message ID:
00469313
Vues:
12
>After I updated my sdt to to ver sdt51i, I get the following error Index does not match the table. Delete the index file and re-create the index (Error 114). Is there a way I can us stonefield utility to correct this error or how do I fix this error correctly without harming my tables any further. Help appreciated.
>
>
>Nick Patel

Nick

I created a small exe using the stonfied functions. I ship it with all my databases. Every time I make a change or updates I copy the three database files
dbc
dbx
dct

and I copy the stonfield tables

CoreMeta.dbf,cdx,fpt
DBCXReg.dbf,cdx,fpt
SDTMeta.dbf,cdx,fpt
SDTUser.dbf

I then run the utility DataDictionaryUpdate.exe that I made.

This allows me to pick the location of my DBC & my DBF tables. It then at my choice will auto update or force an update. Then again at my choice it auto/forced reindexes. The reindex will run Stonfield's repair utility automatically if it is needed.

Here is the basic code of the exe (prg)

********************************************************************************
****** ******
****** Update.prg ******
****** ******
****** Main update control program. Uses Stonefield database ******
****** needupdate() method and if necessary that will call the Update() ******
****** method. ******
****** ******
****** ******
****** ******
****** ******
****** ******
****** ******
********************************************************************************
LOCAL lcOldDefault, lcOldPath, lcOldExact
lcOldDefault = ADDBS( ALLTRIM(SYS(5) + SYS(2003)) )
lcOldPath = SET('PATH')
lcOldExact = SET('EXACT')

Private oMeta
* Establish the stonefield object
oMeta = Newobject('DBCXMgr', 'DBCXMGR.VCX')
IF TYPE('oMeta') <> 'O' .OR. ISNULL(oMeta)
* Errored out
= MESSAGEBOX( ;
"SORRY! Could not setup the master object. Cannot proceed.",0+16+0)
QUIT
ENDIF oMeta


********************************************************************************
*** Get the database to update. Set the default directory to the directory
*** of that database.
********************************************************************************
LOCAL lcDefault, lcDatabase, lcTables
STORE "" TO lcDefault, lcDatabase, lcTables
lcDatabase = GETFILE('DBC',"Open Database")
IF EMPTY(lcDatabase)
= MESSAGEBOX( ;
"SORRY! No database was opened.", 0+16+0)
QUIT
ENDIF

lcTables = GETFILE('DBF',"Open a Table")
IF EMPTY(lcTables)
= MESSAGEBOX( ;
"SORRY! No Table was opened.", 0+16+0)
QUIT
ENDIF
lcTables = ADDBS( JUSTPATH(lcTables) )


* Make the default directory the same as the database
* and if necessary the path to the table directory
lcDefault = ADDBS( JUSTPATH(lcDatabase) )
SET DEFAULT TO &lcDefault
SET EXACT ON
IF lcTables <> lcDefault
SET PATH TO &lcTables
ENDIF <>


* Open the database
OPEN DATABASE &lcDatabase
oMeta.SetDatabase(lcDatabase)


LOCAL lnChoice
lnChoice = 7
lnChoice = MESSAGEBOX( ;
"Would you like to FORCE an update?",4+32+256)
IF lnChoice <> 6
* No - run automatic mode - only if needed
IF oMeta.oSDTMgr.NeedUpdate()
oMeta.oSDTMgr.Update()
ENDIF needupdate
ELSE
* Yes - force an update
oMeta.oSDTMgr.Update()
ENDIF


lnChoice = 7
lnChoice = MESSAGEBOX( ;
"Force a ReIndex?", 4+32+256)
IF lnChoice = 6 .AND. !oMeta.oSDTMgr.Reindex('ALL',.T.)
* Reindex/Pack failed - ask about repair
lnChoice = 7
lnChoice = MESSAGEBOX( ;
"The reindex process failed. This could be to a corrupt " + ;
"file. Would you like to repair the system?", 4+32+0)
IF lnChoice = 6
* Yes repair
IF !oMeta.oSDTMgr.Repair('ALL')
ENDIF
ENDIF 6
ENDIF !ometa...reindex


WAIT WINDOW " All Done " TIMEOUT 3
SET EXACT &lcOldExact
SET PATH TO &lcOldPath
SET DEFAULT TO &lcOldDefault

CLOSE ALL
CLEAR ALL
*********************************************************************************************************


To make the exe follow the steps below:

Create a new project
on classes tab add paths to Stonefield dbcxmgr.vcx & sdt.vcx both in the Stonefield\sdt\source directory
create a prg with the code above in the program tab
build an exe

where ever you load the exe you will have to have the runtime files available but you probably know that.

When you run the utility make sure you run it from the directory where the coremeta ... tables are.


The utility has saved me many hours.

Hope this helps

Terry
It is impossible to make programs idiot proof. Idiots are too cleaver.

MCP( Tcp/Ip )
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform