![]() |
|
![]() |
| ClosedRepairAllRelations | ClosedRepairRelation | OpenedRepairAllRelations | |
| OpenedRepairRelation | ReFormat | ReStructure | SetVariableBlocking |
type FixProcType is access
procedure;
pragma Convention
(WIN32,
FixProcType);
procedure ReFormat
(relName : in string;
oldDFL : in string;
ShowStatus : in boolean;
Error : in out ModSys.S_Natural);
--*
-- ReFormat - Restructure the data base relation.
--
--
-- This procedure restructures the data base relation from the
-- old definition to the new one. A new data file is made, the
-- old one deleted and the new one renamed to the old. The new data
-- file will then assume the version identifier of the new
-- DFL. The index file associated with the requested relation
-- will be deleted and must be rebuilt using the "ReBuildIndex"
-- procedure from Sage. The following sequence of procedures
-- is an example of a restructure and rebuild.
--
-- ReFormat ("MyRel", "SAMPLE.DFL", TRUE, error);
-- OpenRelation ("MyRel", TRUE);
-- ReBuildIndex ("MyRel", TRUE, DummyDupProc, NumDups);
--
-- Any new fields which appear will be cleared to nul.
--
-- CALLING SEQUENCE -
--
-- ReFormat (relName, oldDFL, ShowStatus, error);
--
-- ENTRY -
--
-- relName : string
-- Name of relation to restructure.
--
-- oldDFL : string
-- Name (including possible drive and directory) of old
-- DFL file which has the same version number for the
-- relation being restructured. If a null string is
-- used, the name of the currently opened DFL will
-- be used.
--
-- ShowStatus : boolean
-- TRUE - Show status messages as the work is performed.
-- FALSE - Do NOT show messages as the work is performed.
--
-- EXIT -
--
-- error : ModSys.S_Natural
-- Error status return.
--
procedure ReStructure
(relName : in string;
oldDFL : in string;
recordProc : in FixProcType;
ShowStatus : in boolean;
Error : in out ModSys.S_Natural);
--*
-- ReStructure - Restructure the data base relation.
--
--
-- This procedure restructures the data base relation from the
-- old definition to the new one. A new data file is made, the
-- old one deleted and the new one renamed to the old. The new data
-- file will then assume the version identifier of the new
-- DFL. The index file associated with the requested relation
-- will be deleted and must be rebuilt using Sage.ReBuildIndex.
-- Since the ReStructure process deletes the index file, fatal SageErrors
-- are returned for procedures like Sage.OpenRelation. To avoid the
-- flashing message, set and reset the DisplayFatalErrors flag.
--
-- This procedure provides the capability of executing
-- another procedure before each restructured record is written
-- out. This procedure (shown as "recordProc") has access to
-- records through the normal Sage Get and Put routines (GetFieldA,
-- PutFieldA, etc.). A default "recordProc" is provided during
-- instantiation if recordProc is not specified. The default procedure
-- will provide a do-nothing capability.
--
-- CALLING SEQUENCE -
--
-- FixLib.Restructure (relName, oldDFL, ShowStatus, RecProc, error);
--
-- ENTRY -
--
-- relName : string
-- Name of relation to restructure.
--
-- oldDFL : string
-- Name (including possible drive and directory) of old
-- DFL file which has the same version number for the
-- relation being restructured. If this argument is
-- a null string, then the old DFL name is assumed to
-- be the same as the currently opened DFL.
--
-- ShowStatus : boolean
-- True - Show status messages as the work is performed.
-- False - Do NOT show messages as the work is performed.
--
-- EXIT -
--
-- error : ModSys.S_natural
-- Error status return.
--
-- EXAMPLE -
--
-- with FixLib;
-- with ModSys;
-- with Sage;
--
-- procedure Test1 is
--
-- error : Modsys.S_Natural := 0;
-- dupCount : ModSys.S_Natural := 0;
--
-- procedure NewRecord is
--
-- pragma Convention (Win32,
-- NewRecord);
--
-- begin
-- Sage.PutFieldA ("MyRel","NewField","ABC"); --load new field
-- end NewRecord;
--
-- begin
-- Sage.OpenSystem ("SAMPLE.DFL",3,3,5000);
-- FixLib.ReStructure ("MyRel", "SAMPLE.OLD", True, NewRecord'access, error);
-- Sage.DisplayFatalErrors (FALSE);
-- Sage.OpenRelation ("MyRel",TRUE);
-- Sage.ReBuildIndex ("MyRel",TRUE,dupCount);
-- Sage.DisplayFatalErrors (TRUE);
-- Sage.CloseSystem;
-- end Test1;
--
procedure SetVariableBlocking
(blocking : in ModSys.S_Natural);
--*
-- SetVariableBlocking - Set block factor for variable length data.
--
--
-- This procedure change the blocking factor for the variable length
-- data file used by the relation to be rebuilt. If this is to
-- be done, then this procedure must be called prior to each execution
-- of ReFormat or ReStructure. Otherwise, the blocking factor
-- will remain the same as it was for the original block data file.
--
-- CALLING SEQUENCE -
--
-- SetVariableBlocking (blocking)
--
-- ENTRY -
--
-- blocking : ModSys.S_Natural
-- New blocking factor (30..n). If you wish to reset to the original
-- blocking factor, set this variable to zero (0). After each ReFormat or
-- ReStructure, the blocking factor is automatically set to 0 to signal
-- any subsequent ReFormat operation to use the original blocking factor.
-- If a relation's variable length file (block data file) was created
-- using the standard default, it will have a blocking factor of 128.
--
procedure OpenedRepairRelation
(RelationName : in string;
MultiUser : in boolean;
OldDflName : in string;
ShowStatus : in boolean;
Repaired : in out boolean;
TotalDups : in out ModSys.S_Natural;
Success : in out boolean);
--*
-- OpenedRepairRelation - Check and rebuild single relation while Dfl is opened.
--
--
-- While the DFL is already opened and the requested relation is closed this
-- routine checks the relation to see if either a .DAT file restructure or a
-- .IDX file reindex is needed. If it is then the routine will try to perform
-- the needed action. If a restructure is needed the routine will use the name
-- of the old dfl file that is passed in. If that file does not match the version
-- the routine will look for all possible matches first using the new method of
-- naming old files (i.e. MyDfl.OLD, MyDfl.D02, MyDfl.D03, etc). If it does not
-- find a match during that search it tries the old method of naming just in case
-- that file is still around (i.e. MyDfl.Old, MyDfl.OL2, MyDfl.OL3, etc).
--
-- CALLING SEQUENCE -
--
-- OpenedRepairRelation (RelationName, MultiUser, OldDflName, ShowStatus,
-- Repaired, TotalDups, Success)
--
-- ENTRY -
--
-- RelationName : string
-- The name of the relation to check and rebuild if necessary.
--
-- MultiUser : boolean
-- TRUE - Use MultSage calls when working with the relation.
-- FALSE - Use Sage calls when working with the relation.
--
-- OldDflName : string
-- The name of the .OLD dfl file.
--
-- ShowStatus : boolean
-- TRUE - Show messages during any rebuilding or reindexing.
-- FALSE - Don't show message during any rebuilding or reindexing.
--
-- EXIT -
--
-- Repaired : boolean
-- TRUE - The relation required a rebuild or reindex and was fixed.
-- FALSE - No rebuilding or reindexing needed for this relation.
--
-- TotalDups : Modsys.S_Natural
-- The number of duplicate entries found while rebuilding a primary key
-- in this relation.
--
-- Success : boolean
-- TRUE - The routine processed successfully. If Repaired is also TRUE then
-- this flag indicates if that operation was successful. If Repaired
-- is FALSE then this flag simply shows tha the routine ran and
-- exited successfully.
--
-- FALSE - An error occured. This could be that the file needed for a
-- rebuild could not be located or some other error prevented the
-- routine from completing the operation.
--
procedure OpenedRepairAllRelations
(MultiUser : in boolean;
OldDflName : in string;
ShowStatus : in boolean;
Repaired : in out boolean;
Success : in out boolean);
--*
-- OpenedRepairAllRelations - Check and rebuild all relations while Dfl is opened.
--
--
-- While the DFL is opened this routine checks cycles through all the relations
-- and checks to see if either a .DAT file restructure or a .IDX file reindex is
-- needed. If it is then the routine will try to perform the needed action. If
-- a restructure is needed the routine will use the name of the old dfl file that
-- is passed in. If that file does not match the version the routine will look
-- for all possible matches first using the new method of naming old files
-- (i.e. MyDfl.OLD, MyDfl.D02, MyDfl.D03, etc). If it does not find a match during
-- that search it tries the old method of naming just in case that file is still
-- around (i.e. MyDfl.Old, MyDfl.OL2, MyDfl.OL3, etc).
--
-- CALLING SEQUENCE -
--
-- OpenedRepairAllRelations (MultiUser, OldDflName, ShowStatus,
-- Repaired, Success)
--
-- ENTRY -
--
-- MultiUser : boolean
-- TRUE - Use MultSage calls when working with the relation.
-- FALSE - Use Sage calls when working with the relation.
--
-- OldDflName : string
-- The name of the .OLD dfl file.
--
-- ShowStatus : boolean
-- TRUE - Show messages during any rebuilding or reindexing.
-- FALSE - Don't show message during any rebuilding or reindexing.
--
-- EXIT -
--
-- Repaired : boolean
-- TRUE - The relation required a rebuild or reindex and was fixed.
-- FALSE - No rebuilding or reindexing needed for this relation.
--
-- Success : boolean
-- TRUE - The routine processed successfully. If Repaired is also TRUE then
-- this flag indicates if that operation was successful. If Repaired
-- is FALSE then this flag simply shows tha the routine ran and
-- exited successfully.
-- FALSE - An error occured. This could be that the file needed for a
-- rebuild could not be located or some other error prevented the
-- routine from completing the operation.
--
procedure ClosedRepairRelation
(DflName : in string;
RelationName : in string;
MultiUser : in boolean;
OldDflName : in string;
ShowStatus : in boolean;
Repaired : in out boolean;
TotalDups : in out ModSys.S_Natural;
Success : in out boolean);
--*
-- ClosedRepairRelation - Check and rebuild single relation while Dfl is closed.
--
--
-- While the DFL is closed this routine checks a single relation to see if either
-- a .DAT file restructure or a .IDX file reindex is needed. If it is then the
-- routine will try to perform the needed action. If a restructure is needed the
-- routine will use the name of the old dfl file that is passed in. If that file
-- does not match the version the routine will look for all possible matches first
-- using the new method of naming old files (i.e. MyDfl.OLD, MyDfl.D02, MyDfl.D03,
-- etc). If it does not find a match during that search it tries the old method
-- of naming just in case that file is still around (i.e. MyDfl.Old, MyDfl.OL2,
-- MyDfl.OL3, etc).
--
-- CALLING SEQUENCE -
--
-- ClosedRepairRelation (DflName, RelationName, MultiUser, OldDflName, ShowStatus,
-- Repaired, TotalDups, Success)
--
-- ENTRY -
--
-- DflName : string
-- The name of the Dfl file whose relations are to be checked.
--
-- RelationName : string
-- The name of the relation to check and rebuild if necessary.
--
-- MultiUser : boolean
-- TRUE - Use MultSage calls when working with the relation.
-- FALSE - Use Sage calls when working with the relation.
--
-- OldDflName : string
-- The name of the .OLD dfl file.
--
-- ShowStatus : boolean
-- TRUE - Show messages during any rebuilding or reindexing.
-- FALSE - Don't show message during any rebuilding or reindexing.
--
-- EXIT -
--
-- Repaired : boolean
-- TRUE - The relation required a rebuild or reindex and was fixed.
-- FALSE - No rebuilding or reindexing needed for this relation.
--
-- TotalDups : Modsys.S_Natural
-- The number of duplicate entries found while rebuilding a primary key
-- in this relation.
--
-- Success : boolean
-- TRUE - The routine processed successfully. If Repaired is also TRUE then
-- this flag indicates if that operation was successful. If Repaired
-- is FALSE then this flag simply shows tha the routine ran and
-- exited successfully.
--
-- FALSE - An error occured. This could be that the file needed for a
-- rebuild could not be located or some other error prevented the
-- routine from completing the operation.
--
procedure ClosedRepairAllRelations
(DflName : in string;
MultiUser : in boolean;
OldDflName : in string;
ShowStatus : in boolean;
Repaired : in out boolean;
Success : in out boolean);
--*
-- ClosedRepairAllRelations - Check and rebuild all relations while Dfl is closed.
--
--
-- While the DFL is closed this routine checks cycles through all the relations
-- and checks to see if either a .DAT file restructure or a .IDX file reindex is
-- needed. If it is then the routine will try to perform the needed action. If
-- a restructure is needed the routine will use the name of the old dfl file that
-- is passed in. If that file does not match the version the routine will look
-- for all possible matches first using the new method of naming old files
-- (i.e. MyDfl.OLD, MyDfl.D02, MyDfl.D03, etc). If it does not find a match during
-- that search it tries the old method of naming just in case that file is still
-- around (i.e. MyDfl.Old, MyDfl.OL2, MyDfl.OL3, etc).
--
-- CALLING SEQUENCE -
--
-- ClosedRepairAllRelations (DflName, MultiUser, OldDflName, ShowStatus,
-- Repaired, Success)
--
-- ENTRY -
--
-- DflName : string
-- The name of the Dfl file whose relations are to be checked.
--
-- MultiUser : boolean
-- TRUE - Use MultSage calls when working with the relation.
-- FALSE - Use Sage calls when working with the relation.
--
-- OldDflName : string
-- The name of the .OLD dfl file.
--
-- ShowStatus : boolean
-- TRUE - Show messages during any rebuilding or reindexing.
-- FALSE - Don't show message during any rebuilding or reindexing.
--
-- EXIT -
--
-- Repaired : boolean
-- TRUE - The relation required a rebuild or reindex and was fixed.
-- FALSE - No rebuilding or reindexing needed for this relation.
--
-- Success : boolean
-- TRUE - The routine processed successfully. If Repaired is also TRUE then
-- this flag indicates if that operation was successful. If Repaired
-- is FALSE then this flag simply shows tha the routine ran and
-- exited successfully.
--
-- FALSE - An error occured. This could be that the file needed for a
-- rebuild could not be located or some other error prevented the
-- routine from completing the operation.
--
Send mail to
warren.merrill@inl.gov
with questions or comments about this web site.
Copyright © 1989-2006 Battelle Energy Alliance