home *** CD-ROM | disk | FTP | other *** search
- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-
- This modification to the Turbo Access routines has not been tested
- extensively. Use it at your own risk, on worthless data please!
-
- WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-
- This file describes how to modify the Turbo Access routines from the Turbo
- Toolbox to allow more than 64K records in the data file. This is done by
- using real numbers for date references, and using LongSeek instead of Seek on
- the data files. This is for MS-DOS/PC-DOS only!
-
- These modifications have been tested only in the most minimal way: modifying
- BTREE to use them. PLEASE don't use them on important data without first
- testing thoroughly! If you find any problems, OR if you feel you have done
- extensive testing and found no problems, please notify me through the Borland
- SIG on CompuServe (GO BOR).
-
- When you make changes, be careful to make them exactly: don't forget any
- semicolons or parentheses!
-
- This is the second revision of the file ACCESS.BIG, fixing a nasty bug
- pointed out to me by David J. Lewis 70105,1242. One effect of the bug was
- that if an index file was opened with a key length other than the constant
- MaxKeyLen, everything would go up in smoke...
-
- The second effect should have caused the modifications to fail entirely, and
- since this was not the case, I remain somewhat puzzled. Let me repeat that
- this modification is STILL LIKELY TO CONTAIN BUGS!! If you are looking for
- adventure, or you like beta-testing things, or if you're absolutely desperate
- for more that 65535 records in your files, this is for you.
-
- - Bela Lubkin
- Borland International Technical Support
-
- In ACCESS.BOX:
-
- Right before the Type definition section, add
- Const
- X65536 = 65536.0; { For integer version, change to 1 (NOT 1.0) }
- RefTypeSize = 6; { MUST be 2 for integer version, 6 for real version, or
- 8 for 8087 real version (or 1 for byte version!) }
-
- At the beginning of the Type section, add
- RefType = Real; { Change to Integer for standard, 64K record limit
- version }
-
- In procedure GetRec, change
- Seek(DatF.F,R);
- to
- LongSeek(DatF.F,R);
-
- In procedure PutRec, change
- Seek(DatF.F,R);
- to
- LongSeek(DatF.F,R);
-
- In procedure MakeFile, change
- Move(DatF.FirstFree,TaRecBuf,8);
- to
- Move(DatF.FirstFree,TaRecBuf,4 * RefTypeSize);
-
- In procedure OpenFile, change
- Move(TaRecBuf,DatF.FirstFree,8);
- DatF.NewRec := DatF.Int2;
- to
- Move(TaRecBuf,DatF.FirstFree,4 * RefTypeSize);
- DatF.NewRecMSW := Trunc(DatF.Int2 / X65536);
- DatF.NewRec := Trunc(DatF.Int2 - X65536 * DatF.NewRecMSW);
-
- In procedure CloseFile, change
- DatF.Int2 := DatF.NewRec;
- Move(DatF.FirstFree,TaRecBuf,8);
- to
- DatF.Int2 := DatF.NewRec + X65536 * DatF.NewRecMSW;
- Move(DatF.FirstFree,TaRecBuf,4 * RefTypeSize);
-
- In procedure AddRec, change
- Move(TaRecBuf,DatF.FirstFree,2);
- to
- Move(TaRecBuf,DatF.FirstFree,RefTypeSize);
-
- In procedure DeleteRec, change
- Move(DatF.FirstFree,TaRecBuf,2);
- to
- Move(DatF.FirstFree,TaRecBuf,RefTypeSize);
-
- In function FileLen, change
- FileLen := DatF.NewRec;
- to
- FileLen := DatF.NewRec + X65536*DatF.NewRecMSW;
-
- In procedure TaPack, change
- Move(Page.ItemArray[I],P[(I - 1) * (KeyL + 5) + 3],KeyL + 5);
- to
- Move(Page.ItemArray[I],P[(I - 1) * (KeyL + 2*RefTypeSize + 1) +
- RefTypeSize + 1],KeyL + 2*RefTypeSize + 1);
-
- In procedure TaUnPack, change
- Move(Page.ItemArray[I],P[(I - 1) * (KeyL + 5) + 3],KeyL + 5);
- to
- Move(P[(I - 1) * (KeyL + 2*RefTypeSize + 1) + RefTypeSize + 1],
- Page.ItemArray[I],KeyL + 2*RefTypeSize + 1);
-
- In procedure MakeIndex, change
- K := (KeyLen + 5)*PageSize + 3;
- to
- K := (KeyLen + 2*RefTypeSize + 1)*PageSize + RefTypeSize + 1);
-
- In procedure OpenIndex, change
- K := (KeyLen + 5)*PageSize + 3;
- to
- K := (KeyLen + 2*RefTypeSize + 1)*PageSize + RefTypeSize + 1);
-
- In function TaCompKeys, change
- TaCompKeys := DR1 - DR2
- to
- if DR1 > DR2 then TaCompKeys := 1
- else if DR1 < DR2 then TaCompKeys := -1
- else TaCompKeys := 0
-
-
- Now you must change the types of a large number of items from Integer to
- RefType. The items are listed in order of appearance and according to file.
-
- Fields of a record are represented by RecordName.Field1, Field2, ...
- Procedure or function parameters are represented by ProcedureName(Parameter)
- Function types are represented by Function FunctionName
- Local variables are listed below the name of the procedure they belong to.
- In each case, change only the named fields, parameters or functions, or
- local variables to RefType.
-
- In ACCESS.BOX:
- DataFile.FirstFree, NumberFree, Int1, Int2
- TaItem.DataRef, PageRef
- TaPage.BckwPageRef
- TaSearchStop.PageRef
- IndexFile.RR
- TaStackRef.PageRef
- TaIOCheck(R)
- GetRec(R)
- PutRec(R)
- AddRec(R)
- DeleteRec(R)
- Function FileLen
- Function UsedRecs
- TaGetPage(R)
- TaNewPage(R)
- TaCompKeys(DR1,DR2)
-
- In GETKEY.BOX:
- NextKey(ProcDataRef)
- R
- PrevKey(ProcDataRef)
- R
- TaFindKey(ProcDataRef)
- PrPgRef
- FindKey(ProcDataRef)
- SearchKey(ProcDataRef)
-
- In ADDKEY.BOX:
- AddKey(ProcDataRef)
- PrPgRef1, PrPgRef2
- Search(PrPgRef1)
-
- In DELKEY.BOX:
- DeleteKey(ProcDataRef)
- DelB(PrPgRef)
- XPageRef
- UnderFlow(PrPgRef, PrPgRef2)
- LPageRef
- DelA(PrPgRef2)
- XPageRef
-
- In BTREE.INC (if you want to test BTREE):
- Add:
- DataF
- Find:
- D,I
- List:
- D,LD
-
-
- NOTES:
- When these modifications have been made, you can switch between integer
- data references, allowing 64K records, and real data references, allowing
- either 4,294,967,296 records or whatever DOS limits you to (probably the
- latter)! To change the data reference type, just change type RefType to
- integer or real. (You could even use Byte, but that's not very practical).
- Note that data files created with one kind of data references are NOT
- compatible with those made differently. Keep this in mind; it will take
- interesting contortions to convert files from one type to the other. Even
- more subtle is the fact that data files created with normal Turbo Pascal and
- those created with Turbo-87 are not compatible!
-
- Also note that the minimum data record size depends on the type of the data
- references. With integers, it is 8. With non-8087 reals, it is 24, and with
- 8087 reals, it is 32. If you use less than the minimum, everything will go
- haywire!
-
- Please report any bugs or interesting facts to me or Sysop Larry Kraft of
- the Borland SIG on CompuServe.
- - Bela Lubkin