Paradox Community

Items in pnews.paradox-programming

Subject:Re: Chimney Sweep replacement
Date:Thu, 24 Dec 2020 16:11:16 +0100
From:=?UTF-8?B?Q8O0bWU=?= <come.dechristen@wanadoo.fr>
Newsgroups:pnews.paradox-programming
Le 29/11/2020 à 01:26, Kevin Zawicki a écrit :
[...]
> Anyone have an automated rebuild routine?
[...]

Hi

I've done in the past 2 kinds of verifications :

a) Verification at the very first user each day who logs in the application

With this kind of code :
TabSansVeriif is just used to bypass some tables in the verification 
process. I use mostly isTableCorrupt() (which need Pdox 8 or over I 
believe) and reindexAll()

method Tables_Verif_Et_ReconstruitIndex() Logical
Var
    TabNomTable array[] String
    sTable string
    vNbreErreur,I Smallint
    sLog string
    tcTable Table
    TabSansVerif DynArray[] String
EndVar

;// Récupéer les noms des tables de l'application
enumDataBaseTables(TabNomTable, "work", "*.db")

;// Vérifications pour chaque table sauf les tables suivantes

TabSansVerif["UTIL.DB"] = ""
TabSansVerif["CATUTIL.DB"] = ""
TabSansVerif["CODEPOSTAL.DB"] = ""

vNbreErreur = 0
sLog = ""

For I from 1 to TabNomTable.size()
    sTable = TabNomTable[I]
    if TabSansverif.contains(sTable.upper()) then loop endif
    message("Vérification de la table : " + sTable)
    ;// Table corrupt ?
    if isTableCorrupt(sTable) then
       vNbreErreur = vNbreErreur + 1
       sLog = sLog + "\nLa table : " + sTable + " est corrompue, 
veuillez la réparer."
    endif
    ;// Reconstruction des index
    tcTable.attach(sTable)
    if not tcTable.lock("Exclusive") then
       vNbreErreur = vNbreErreur + 1
       sLog = sLog + "\nLa table : " + sTable + " ne peut pas être 
ouverte en mode exclusif."
    else
       if not tcTable.ReIndexAll() then
          vNbreErreur = vNbreErreur + 1
          sLog = sLog + "\nLa table : " + sTable + " n'a pu avoir ses 
index reconstruits."
       endif
       tcTable.unlock("Exclusive")
    endif
    tcTable.unAttach()
EndFor

if vNbreErreur > 0 then
	msgStop("Attention","L'application rencontre un problème au niveau de 
la base de données :\n"
    	+ sLog + "\n\nMerci de contacter Clairinfo pour signaler l'incident.")
    message("")
    return false
else
	message("")
	return true
endif

endMethod

b) Verification in batch processing during the night

- reIndexAll on the original tables which throw often index problem
- batch copy of the tables in another diretory and use of isTableCorrupt 
(almost like in point a) on the copies of the table to detect problems. 
If so email sent with the alert.

Like others I prefer not to repair automatically.

Hth Côme
-


Copyright © 2004 thedbcommunity.com