Description
Compresses overflow in a table; fixes Group Format Errors (GFEs); increments, decrements, resizes the sizelock for a table; defines a new threshold for a linear hash (OpenInsight) table.
Syntax
Fix_LH (tablename, fixtype, lockflag[, fourthparam])
Parameters
The first three parameters, defined in the "Subfunctions" section, are identical regardless of fixtype. The fourth parameter varies according to subfunction. Refer to the "Sizelock" section following the next two tables for more information about the Sizelock parameter.
A table must be attached to run the Fix_LH stored procedure against it.
Parameter | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tablename | The name of the table on which to perform an operation. The operation performed is specified in fixtype. | ||||||||||||
Fixtype | Four operations can be performed against a table. The list below describes the code to assign to fixtype and the operation that is performed.
| ||||||||||||
Lockflag | If true (1), the table is locked before it is fixed. |
Subfunctions
There are five Fix_LH subfunctions which are listed in the following table.
Purpose of Subfunction | Syntax | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Compress overflow | Fix_LH (tablename, fixtype, lockflag) The compression operation removes empty frames in the .OV portion of a file. If empty frames exist, the size of the .OV file will be smaller when this operation completes. | ||||||||||
Fix GFE's | Fix_LH(... grouprangelist)
| ||||||||||
Change sizelock | Fix_LH(... modifierflag)
If the original sizelock of the table is less than 2, the sizelock is incremented or decremented by 1 instead of 2. | ||||||||||
Set sizelock | Fix_LH(... newsizelock)
| ||||||||||
Set threshold | Fix_LH(... newthreshold)
|
Sizelock
The sizelock parameter is used to control the automatic resizing of the primary address space. A sizelock of "0" indicates that a table should be allowed to expand as more rows are entered, and become smaller as rows are deleted. A sizelock of "1" indicates that a table should be allowed to expand, but should not become smaller. This is useful in cases of a presized table, when a preliminary expectation is for the table to hold 1000 rows, but more rows may be added. If a sizelock is set to "2" or more, the table is not allowed to expand or contract. A sizelock of "2" is very important during a select operation executed on a network, when one user is searching a table for information while another user is entering new data.
OpenInsight increments the sizelock by 2 for the duration of the select operation. If another user is adding information, it is possible that the system could determine that a table needs to be resized. If this were to occur during a select operation, the process might yield unpredictable results: rows that have not yet been evaluated might be skipped, or rows might be processed more than once. Because the sizelock is "2," no resizing takes place. Once the process is finished, the sizelock is decremented by 2, restoring it to the table's original sizelock value. While the table might now be slightly out of size, the addition or deletion of another row will result in correct resizing.
Remark
Not all methods of the Fix_LH routine can be used on a table controlled by the LH Service.
See also
Example
The following examples illustrate operations on linear hash files, using Fix_LH.
/* Locks the CAR_PARTS table and compresses the overflow portion of the table. */ Fix_LH("CAR_PARTS" "1", "1") If Get_Status(ErrCodes) Then GoSub ErrorHandling End * Locks CAR_PARTS and fixes groups 1 and 4 through 7. Fix_LH("CAR_PARTS", "2", "1"', ["1", ["4", "7"] ]) If Get_Status(ErrCodes) Then GoSub ErrorHandling End * Locks CAR_PARTS table and decrements the sizelock by 2. Fix_LH("CAR_PARTS", "3", "1", "0") If Get_Status(ErrCodes) Then GoSub ErrorHandling End * Locks CAR_PARTS, and changes the threshold to 90%. Fix_LH("CAR_PARTS","4", "1", "90") If Get_Status(ErrCodes) Then GoSub ErrorHandling End