dbf_struct.inc 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. const
  2. //====================================================================
  3. FieldPropType_Required = $01;
  4. FieldPropType_Min = $02;
  5. FieldPropType_Max = $03;
  6. FieldPropType_Default = $04;
  7. FieldPropType_Constraint = $06;
  8. FieldDescVII_AutoIncOffset = 42;
  9. //====================================================================
  10. // File structures
  11. //====================================================================
  12. type
  13. PDbfHdr = ^rDbfHdr;
  14. rDbfHdr = packed record
  15. VerDBF : Byte; // 0
  16. Year : Byte; // 1
  17. Month : Byte; // 2
  18. Day : Byte; // 3
  19. RecordCount : Integer; // 4-7
  20. FullHdrSize : Word; // 8-9
  21. RecordSize : Word; // 10-11
  22. Dummy1 : Word; // 12-13
  23. IncTrans : Byte; // 14
  24. Encrypt : Byte; // 15
  25. MultiUse : Integer; // 16-19
  26. LastUserID : Integer; // 20-23
  27. Dummy2 : array[24..27] of Byte;
  28. MDXFlag : Byte; // 28
  29. Language : Byte; // 29
  30. Dummy3 : Word; // 30-31
  31. end;
  32. //====================================================================
  33. PAfterHdrIII = ^rAfterHdrIII;
  34. rAfterHdrIII = packed record // Empty
  35. end;
  36. //====================================================================
  37. PAfterHdrVII = ^rAfterHdrVII;
  38. rAfterHdrVII = packed record
  39. LanguageDriverName : array[32..63] of Char;
  40. Dummy : array[64..67] of Byte;
  41. end;
  42. //====================================================================
  43. PFieldDescIII = ^rFieldDescIII;
  44. rFieldDescIII = packed record
  45. FieldName : array[0..10] of Char;
  46. FieldType : Char; // 11
  47. FieldOffset : Integer; // 12..15 only applicable to foxpro databases
  48. FieldSize : Byte; // 16
  49. FieldPrecision : Byte; // 17
  50. FoxProFlags : Byte; // 18
  51. Dummy2 : array[19..31] of Byte;
  52. end;
  53. //====================================================================
  54. // OH 2000-11-15 dBase7 support. Header Update (add fields like Next AutoInc Value)
  55. rFieldDescVII = packed record
  56. FieldName : array [0..31] of Char;
  57. FieldType : Char; // 32
  58. FieldSize : Byte; // 33
  59. FieldPrecision : Byte; // 34
  60. Reserved1 : Word; // 35-36
  61. MDXFlag : Byte; // 37
  62. // NOTE: the docs say Reserved2 is 2 bytes, and Reserved3 is 4 bytes
  63. // but testing shows BDE has them the other way around
  64. // be BDE compatible :S
  65. Reserved2 : Cardinal; // 38-41
  66. NextAutoInc : Cardinal; // 42-45
  67. Reserved3 : Word; // 46-47
  68. end;
  69. //====================================================================
  70. PFieldPropsHdr = ^rFieldPropsHdr;
  71. rFieldPropsHdr = packed record
  72. NumStdProps : Word; // 0..1
  73. StartStdProps : Word; // 2..3
  74. NumCustomProps : Word; // 4..5
  75. StartCustomProps : Word; // 6..7
  76. NumRIProps : Word; // 8..9
  77. StartRIProps : Word; // 10..11
  78. StartData : Word; // 12..13 ; this points past the Descriptor arrays to data used by the arrays - for example Custom property names are stored here.
  79. Size : Word; // 14..15 ; Actual size of structure, including data
  80. end;
  81. //====================================================================
  82. PStdPropEntry = ^rStdPropEntry;
  83. rStdPropEntry = packed record
  84. GenNumber : Word; // 0..1 ; Generational number. More than one value may exist for a property. The current value is the value with the highest generational number.
  85. FieldOffset : Word; // 2..3 ; Table field offset - base one. 01 for the first field in the table, 02 for the second field, etc. Note: this will be 0 in the case of a constraint.
  86. PropType : Byte; // 4 ; Which property is described in this record:
  87. // 01 Required
  88. // 02 Min
  89. // 03 Max
  90. // 04 Default
  91. // 06 Database constraint
  92. FieldType : Byte; // 5 ; Field Type:
  93. // 00 No type - constraint
  94. // 01 Char
  95. // 02 Numeric
  96. // 03 Memo
  97. // 04 Logical
  98. // 05 Date
  99. // 06 Float
  100. // 08 OLE
  101. // 09 Binary
  102. // 11 Long
  103. // 12 Timestamp
  104. // 13 Double
  105. // 14 AutoIncrement (not settable from the Inspector)
  106. IsConstraint : Byte; // 6 ; 0x00 if the array element is a constraint, 0x02 otherwise.
  107. Reserved : array[7..10] of Char;
  108. DataOffset : Word; // 11..12 ; Offset from the start of this structure to the data for the property. The Required property has no data associated with it, so it is always 0.
  109. DataSize : Word; // 13..14 ; Width of database field associated with the property, and hence size of the data (includes 0 terminator in the case of a constraint).
  110. end;
  111. //====================================================================
  112. PCustomPropEntry = ^rCustomPropEntry;
  113. rCustomPropEntry = packed record
  114. GenNumber : Word; // 0..1 ; same as standard
  115. FieldOffset : Word; // 2..3 ; same as standard
  116. FieldType : Byte; // 4 ; same as standard
  117. Reserved : Byte; // 5
  118. NameOffset : Word; // 6..7 ; Offset from the start of this structure to the Custom property name.
  119. NameLength : Word; // 8..9 ; Length of the Custom property name.
  120. DataOffset : Word; // 10..11 ; Offset from the start of this structure to the Custom property data.
  121. DataLength : Word; // 12..13 ; Length of the Custom property data (does not include null terminator).
  122. end;
  123. //====================================================================
  124. PRIPropEntry = ^rRIPropEntry;
  125. rRIPropEntry = packed record
  126. RelationType : Byte; // 0 ; 0x07 if Master (parent), 0x08 if Dependent (child).
  127. Number : Word; // 1..2 ; Sequential number, 1 based counting. If this number is 0, this RI rule has been dropped.
  128. NameOffset : Word; // 3..4 ; Offset of the RI rule name - 0 terminated.
  129. NameSize : Word; // 5..6 ; Size of ...
  130. ForeignOffset : Word; // 7..8 ; Offset of the name of the Foreign Table - 0 terminated.
  131. ForeignSize : Word; // 9..10 ; Size of ...
  132. UpdateType : Byte; // 11 ; Update & delete behaviour: Update Cascade=0x10, Delete Cascade=0x01
  133. NumFieldsKey : Word; // 12..13 ; Number of fields in the linking key.
  134. LocalTagOffset : Word; // 14..15 ; Offset of the Local Table tag name - 0 terminated.
  135. LocalTagSize : Word; // 16..17 ; Size of ...
  136. ForeignTagOffset: Word; // 18..19 ; Offset of the Foreign Table tag name - 0 terminated.
  137. ForeignTagSize : Word; // 20..21 ; Size of ...
  138. end;