Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Deleting records in a buffered view.
Message
De
18/12/2001 10:52:10
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00578650
Message ID:
00595619
Vues:
28
Still, I don't think you should PACK every time you delete a record. This is extremly slow, especially for large tables.

Just issue SET DELETED ON, and deleted records will be hidden automatically (note: this is scoped to the current datasession).

PACK all your tables once a month, or more frequently if the percentage of deleted records grows too large.

Hilmar.

>I just found out what worked.
>
>CURSORSETPROP()
>1 – Sets row and table buffering off.
>
>I set the buffering to 1 prior to PACKing the table, which turns off table and row buffering, then PACKed the table, then returned it to Row Buffering mode (2). It worked!
>
>Cecil
>
>Here's the code in my form's cmdPackTable.Click procedure.
>
>* Pack table now. Only security level 3 may pack this table.
>Local llGood
>WITH ThisForm
> IF .IsChanged()
> .SaveIt()
> ENDIF
> IF .nSecLevel > 2
> IF USED('Address')
> USE && Close the file.
> ENDIF
> USE address EXCLUSIVE
> SELECT Address
> WAIT WINDOW NOWAIT "Packing table..."
> llGood = CursorSetProp('Buffering', 1, 'Address') && Turns off buffering.
> PACK
> USE
> USE Address ORDER lfName SHARED && Re-open table in SHARED mode.
> llGood = CursorSetProp('Buffering', 2, 'Address') && Pessimistic row buffering.
> .cmdDelete.Enabled = .T.
> .cmdRecall.Enabled = .F.
> .IsDeleted()
> .CountRecs()
> ENDIF
> *.Refresh() && Don't need this command since it is in .CountRecs().
>ENDWITH
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform