Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Rename Database
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Database:
Visual FoxPro
Divers
Thread ID:
00974109
Message ID:
00975146
Vues:
37
I am using SDT 6.1d. In the help, I searched on rename dbc and found my answers in the "Frequently Asked Questions" section under "How can I rename a DBC?". This is where I started.
How can I rename a DBC?

It's a bit of work, but not difficult to do.

First, rename the DBC, DCX, and DCT files using the Windows
Explorer.

Then, open the DBC exclusively in VFP and type VALIDATE
DATABASE RECOVER in the Command window (you can't do this in
a program in VFP 6 or earlier). You'll be notified that, for
each table, the backlink in the table header is incorrect.
Accept the option to replace the backlink with the correct
one.

Next, open SDTMETA.DBF and type 
REPLACE DBCNAME WITH '<new DBC name>' FOR DBCNAME = '<old DBC name>', 
where <new DBC name> and <old DBC name> are the new and old DBC names,
respectively, in lower case, without an extension or path.

Find the record for the database (RECTYPE = "D" and
OBJECTNAME is the former DBC name) and REPLACE OBJECTNAME
WITH '<new DBC name>'.

Open COREMETA.DBF and type REPLACE CDBCNAME WITH '<new DBC
name>' FOR CDBCNAME = '<old DBC name>'. Find the record for
the database (CRECTYPE = "D" and COBJECTNAM is the former
DBC name) and REPLACE COBJECTNAM WITH '<new DBC name>' and
REPLACE MPATH WITH '<new DBC filename>'; in this case, <new
DBC filename> includes a ".DBC" extension. Also, REPLACE
CCAPTION WITH '<new DBC filename>', where <new DBC filename>
is a PROPER(JUSTSTEM()) version of the DBC name.

Views may need to be redefined, since they may have
"database!" in the Tables and SQL properties.  (I had to use
GENDBC to get the code to recreate all of my views and
replace "olddbcname!" with "newdbcname!"  Make sure that the
"olddbcname" does NOT exist in your data folder then open
SDT and validate metadata to make sure all is ok.)

Finally, ship the new DBC and meta data tables to your
client site and use SDTMgr's Update method to update their
copy of the tables.

Here are the files you will need: 
The updated database container (DBC, DCT, and DCX files). 

The meta data tables:
DBCXREG.DBF, FPT and CDX; SDTMETA.DBF and CDX; and
COREMETA.DBF, FPT, and CDX. 

If you've created new extended properties and you wish to refer to 
these properties by their long property names (as opposed to 
meta data field names), you'll also need to send SDTUSER.DBF and CDX.

I created a small VFP exe that runs at the client site. 
Here is the code I used:

open database iePoint excl  && new dbc
oMeta = newobject('DBCXMgr', 'DBCXMGR.VCX')

oMeta.SetDatabase(dbc())

IF oMeta.oSDTMgr.NeedUpdate('ALL')   
   oMeta.oSDTMgr.Update('ALL') 
ENDIF

IF oMeta.oSDTMgr.NeedUpdate('!ALL')   
   oMeta.oSDTMgr.Update('!ALL') 
ENDIF

oMeta.oSDTMgr.Reindex('ALL',.T.,.t.)
oMeta.oSDTMgr.Reindex('!ALL', .T.,.t.)

set database to iePoint 
pack database 
close database all
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform