Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Validate Database return code
Message
De
01/10/2004 16:17:33
 
 
À
01/10/2004 08:17:47
Neil Mc Donald
Cencom Systems P/L
The Sun, Australie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00947890
Message ID:
00948074
Vues:
21
>Hi,
>Is there a way to get a return code from Validate Database, or is writing the output to disk with the "output to filename and seaching for "Database container is valid" the only way.

I use the following function. You need exclusive access to the database.
function DBCValidate(tcDBase)
local lcDummyDB, ;
	  lcSafety, ;
	  lcOutFile, lcStrOutFile, ;
	  lcOutFileDummy, lcStrOutFileDummy
	  
lcSafety = set('safety')
set safety off

*-- Text fiels that will hold validation output messages
lcOutFile      = addbs(sys(2023)) + sys(2015) + '.txt'
lcOutFileDummy = addbs(sys(2023)) + sys(2015) + '.txt'

*-- Creates a dummy database to generate the validation file. This file
*-- is the compared to the file generated by tcDBase.
*-- The dummy database is created with the same name as the original one
*-- to create the same message.
lcDummyDB = addbs(sys(2023)) + justFName(tcDBase)
create database (lcDummyDB)
validate database to file (lcOutFileDummy) noConsole
close database
delete database (lcDummyDB)

if not DBUsed(tcDBase)
	open database (tcDBase) exclusive
endif
set database to (tcDBase)
close tables

validate database to file (lcOutFile) noConsole

*-- Compares the two messages generated
lcStrOutFile      = fileToStr(lcOutFile)
lcStrOutFileDummy = fileToStr(lcOutFileDummy)
llValid = (lcStrOutFile == lcStrOutFileDummy)

*-- Cleanup
set safety &lcSafety
delete file (lcOutFile)
delete file (lcOutFileDummy)
return llValid
HTH,
Javier.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform