home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TURBOPAS / ACCESS.ZIP / ACCESS.BIG next >
Encoding:
Text File  |  1985-03-02  |  6.6 KB  |  204 lines

  1. WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
  2.  
  3.   This modification to the Turbo Access routines has not been tested
  4.   extensively.  Use it at your own risk, on worthless data please!
  5.  
  6. WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
  7.  
  8.   This file describes how to modify the Turbo Access routines from the Turbo
  9. Toolbox to allow more than 64K records in the data file.  This is done by
  10. using real numbers for date references, and using LongSeek instead of Seek on
  11. the data files.  This is for MS-DOS/PC-DOS only!
  12.  
  13.   These modifications have been tested only in the most minimal way: modifying
  14. BTREE to use them.  PLEASE don't use them on important data without first
  15. testing thoroughly!  If you find any problems, OR if you feel you have done
  16. extensive testing and found no problems, please notify me through the Borland
  17. SIG on CompuServe (GO BOR).
  18.  
  19.   When you make changes, be careful to make them exactly: don't forget any
  20. semicolons or parentheses!
  21.  
  22.   This is the second revision of the file ACCESS.BIG, fixing a nasty bug
  23. pointed out to me by David J. Lewis 70105,1242.  One effect of the bug was
  24. that if an index file was opened with a key length other than the constant
  25. MaxKeyLen, everything would go up in smoke...
  26.  
  27.   The second effect should have caused the modifications to fail entirely, and
  28. since this was not the case, I remain somewhat puzzled.  Let me repeat that
  29. this modification is STILL LIKELY TO CONTAIN BUGS!!  If you are looking for
  30. adventure, or you like beta-testing things, or if you're absolutely desperate
  31. for more that 65535 records in your files, this is for you.
  32.  
  33.   -  Bela Lubkin
  34.      Borland International Technical Support
  35.  
  36. In ACCESS.BOX:
  37.  
  38. Right before the Type definition section, add
  39. Const
  40.   X65536 = 65536.0;  { For integer version, change to 1 (NOT 1.0) }
  41.   RefTypeSize = 6;   { MUST be 2 for integer version, 6 for real version, or
  42.                        8 for 8087 real version (or 1 for byte version!) }
  43.  
  44. At the beginning of the Type section, add
  45.   RefType = Real;    { Change to Integer for standard, 64K record limit
  46.                        version }
  47.  
  48. In procedure GetRec, change
  49.   Seek(DatF.F,R);
  50. to
  51.   LongSeek(DatF.F,R);
  52.  
  53. In procedure PutRec, change
  54.   Seek(DatF.F,R);
  55. to
  56.   LongSeek(DatF.F,R);
  57.  
  58. In procedure MakeFile, change
  59.     Move(DatF.FirstFree,TaRecBuf,8);
  60. to
  61.     Move(DatF.FirstFree,TaRecBuf,4 * RefTypeSize);
  62.  
  63. In procedure OpenFile, change
  64.     Move(TaRecBuf,DatF.FirstFree,8);
  65.     DatF.NewRec :=  DatF.Int2;
  66. to
  67.     Move(TaRecBuf,DatF.FirstFree,4 * RefTypeSize);
  68.     DatF.NewRecMSW := Trunc(DatF.Int2 / X65536);
  69.     DatF.NewRec := Trunc(DatF.Int2 - X65536 * DatF.NewRecMSW);
  70.  
  71. In procedure CloseFile, change
  72.   DatF.Int2 := DatF.NewRec;
  73.   Move(DatF.FirstFree,TaRecBuf,8);
  74. to
  75.   DatF.Int2 := DatF.NewRec + X65536 * DatF.NewRecMSW;
  76.   Move(DatF.FirstFree,TaRecBuf,4 * RefTypeSize);
  77.  
  78. In procedure AddRec, change
  79.     Move(TaRecBuf,DatF.FirstFree,2);
  80. to
  81.     Move(TaRecBuf,DatF.FirstFree,RefTypeSize);
  82.  
  83. In procedure DeleteRec, change
  84.   Move(DatF.FirstFree,TaRecBuf,2);
  85. to
  86.   Move(DatF.FirstFree,TaRecBuf,RefTypeSize);
  87.  
  88. In function FileLen, change
  89.   FileLen := DatF.NewRec;
  90. to
  91.   FileLen := DatF.NewRec + X65536*DatF.NewRecMSW;
  92.  
  93. In procedure TaPack, change
  94.       Move(Page.ItemArray[I],P[(I - 1) * (KeyL + 5) + 3],KeyL + 5);
  95. to
  96.       Move(Page.ItemArray[I],P[(I - 1) * (KeyL + 2*RefTypeSize + 1) +
  97.            RefTypeSize + 1],KeyL + 2*RefTypeSize + 1);
  98.  
  99. In procedure TaUnPack, change
  100.       Move(Page.ItemArray[I],P[(I - 1) * (KeyL + 5) + 3],KeyL + 5);
  101. to
  102.       Move(P[(I - 1) * (KeyL + 2*RefTypeSize + 1) + RefTypeSize + 1],
  103.            Page.ItemArray[I],KeyL + 2*RefTypeSize + 1);
  104.  
  105. In procedure MakeIndex, change
  106.   K := (KeyLen + 5)*PageSize + 3;
  107. to
  108.   K := (KeyLen + 2*RefTypeSize + 1)*PageSize + RefTypeSize + 1);
  109.  
  110. In procedure OpenIndex, change
  111.   K := (KeyLen + 5)*PageSize + 3;
  112. to
  113.   K := (KeyLen + 2*RefTypeSize + 1)*PageSize + RefTypeSize + 1);
  114.  
  115. In function TaCompKeys, change
  116.       TaCompKeys := DR1 - DR2
  117. to
  118.       if DR1 > DR2 then TaCompKeys := 1
  119.       else if DR1 < DR2 then TaCompKeys := -1
  120.       else TaCompKeys := 0
  121.  
  122.  
  123.   Now you must change the types of a large number of items from Integer to
  124. RefType.  The items are listed in order of appearance and according to file.
  125.  
  126.   Fields of a record are represented by RecordName.Field1, Field2, ...
  127.   Procedure or function parameters are represented by ProcedureName(Parameter)
  128.   Function types are represented by Function FunctionName
  129.   Local variables are listed below the name of the procedure they belong to.
  130.   In each case, change only the named fields, parameters or functions, or
  131. local variables to RefType.
  132.  
  133. In ACCESS.BOX:
  134.   DataFile.FirstFree, NumberFree, Int1, Int2
  135.   TaItem.DataRef, PageRef
  136.   TaPage.BckwPageRef
  137.   TaSearchStop.PageRef
  138.   IndexFile.RR
  139.   TaStackRef.PageRef
  140.   TaIOCheck(R)
  141.   GetRec(R)
  142.   PutRec(R)
  143.   AddRec(R)
  144.   DeleteRec(R)
  145.   Function FileLen
  146.   Function UsedRecs
  147.   TaGetPage(R)
  148.   TaNewPage(R)
  149.   TaCompKeys(DR1,DR2)
  150.  
  151. In GETKEY.BOX:
  152.   NextKey(ProcDataRef)
  153.     R
  154.   PrevKey(ProcDataRef)
  155.     R
  156.   TaFindKey(ProcDataRef)
  157.     PrPgRef
  158.   FindKey(ProcDataRef)
  159.   SearchKey(ProcDataRef)
  160.  
  161. In ADDKEY.BOX:
  162.   AddKey(ProcDataRef)
  163.     PrPgRef1, PrPgRef2
  164.   Search(PrPgRef1)
  165.  
  166. In DELKEY.BOX:
  167.   DeleteKey(ProcDataRef)
  168.   DelB(PrPgRef)
  169.     XPageRef
  170.   UnderFlow(PrPgRef, PrPgRef2)
  171.     LPageRef
  172.   DelA(PrPgRef2)
  173.     XPageRef
  174.  
  175. In BTREE.INC (if you want to test BTREE):
  176.   Add:
  177.     DataF
  178.   Find:
  179.     D,I
  180.   List:
  181.     D,LD
  182.  
  183.  
  184. NOTES:
  185.   When these modifications have been made, you can switch between integer
  186. data references, allowing 64K records, and real data references, allowing
  187. either 4,294,967,296 records or whatever DOS limits you to (probably the
  188. latter)!  To change the data reference type, just change type RefType to
  189. integer or real.  (You could even use Byte, but that's not very practical).
  190. Note that data files created with one kind of data references are NOT
  191. compatible with those made differently.  Keep this in mind; it will take
  192. interesting contortions to convert files from one type to the other.  Even
  193. more subtle is the fact that data files created with normal Turbo Pascal and
  194. those created with Turbo-87 are not compatible!
  195.  
  196.   Also note that the minimum data record size depends on the type of the data
  197. references.  With integers, it is 8.  With non-8087 reals, it is 24, and with
  198. 8087 reals, it is 32.  If you use less than the minimum, everything will go
  199. haywire!
  200.  
  201.   Please report any bugs or interesting facts to me or Sysop Larry Kraft of
  202. the Borland SIG on CompuServe.
  203.   -  Bela Lubkin
  204.