Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

192 lines
5.0 KiB

  1. typedef struct _cdesc /* Column Description */
  2. {
  3. char *szColName; /* Column Name */
  4. JET_COLTYP coltyp; /* Column Type */
  5. JET_GRBIT grbit; /* Flag bits */
  6. ULONG ulMaxLen; /* Max Length of Column */
  7. } CDESC;
  8. typedef struct _idesc /* Index Description */
  9. {
  10. char *szIdxName; /* Index Name */
  11. char *szIdxKeys; /* Key String */
  12. JET_GRBIT grbit; /* Flag bits */
  13. } IDESC;
  14. typedef struct {
  15. const char *szName;
  16. CODECONST(CDESC) *pcdesc;
  17. CODECONST(IDESC) *pidesc;
  18. BYTE ccolumn;
  19. BYTE cindex;
  20. CPG cpg;
  21. JET_COLUMNID *rgcolumnid;
  22. PGNO pgnoTableFDP;
  23. } SYSTABLEDEF;
  24. // UNDONE: change #defines to enumerated types?
  25. #define itableSo 0 /* MSysObjects */
  26. #define itableSc 1 /* MSysColumns */
  27. #define itableSi 2 /* MSysIndexes */
  28. #define itableSa 3 /* MSysACEs */
  29. #define itableSq 4 /* MSysQueries */
  30. #define itableSr 5 /* MSysRelationShips */
  31. #define iMSO_Id 0
  32. #define iMSO_ParentId 1
  33. #define iMSO_Name 2
  34. #define iMSO_Type 3
  35. #define iMSO_DateCreate 4
  36. #define iMSO_DateUpdate 5
  37. #define iMSO_Owner 6
  38. #define iMSO_Flags 7
  39. #define iMSO_Pages 8
  40. #define iMSO_Density 9
  41. #define iMSO_Stats 10
  42. #define iMSC_ObjectId 0
  43. #define iMSC_Name 1
  44. #define iMSC_ColumnId 2
  45. #define iMSC_Coltyp 3
  46. #define iMSC_Length 4
  47. #define iMSC_CodePage 5
  48. #define iMSC_Flags 6
  49. #define iMSC_RecordOffset 7
  50. #define iMSC_Default 8
  51. #define iMSC_POrder 9
  52. #define iMSI_ObjectId 0
  53. #define iMSI_Name 1
  54. #define iMSI_IndexId 2
  55. #define iMSI_Density 3
  56. #define iMSI_LanguageId 4
  57. #define iMSI_Flags 5
  58. #define iMSI_KeyFldIDs 6
  59. #define iMSI_Stats 7
  60. #define iMSI_VarSegMac 8
  61. /* max number of columns
  62. /**/
  63. #define ilineSxMax 11
  64. #if 0
  65. #define CheckTableObject( szTable ) \
  66. { \
  67. ERR err; \
  68. OBJID objid; \
  69. JET_OBJTYP objtyp; \
  70. \
  71. err = ErrFindObjidFromIdName( ppib, \
  72. dbid, \
  73. objidTblContainer, \
  74. szTable, \
  75. &objid, \
  76. &objtyp ); \
  77. if ( err >= JET_errSuccess ) \
  78. { \
  79. if ( objtyp == JET_objtypQuery ) \
  80. return ErrERRCheck( JET_errQueryNotSupported ); \
  81. if ( objtyp == JET_objtypLink ) \
  82. return ErrERRCheck( JET_errLinkNotSupported ); \
  83. if ( objtyp == JET_objtypSQLLink ) \
  84. return ErrERRCheck( JET_errSQLLinkNotSupported ); \
  85. } \
  86. else \
  87. return err; \
  88. }
  89. #endif
  90. /* prototypes
  91. /**/
  92. ERR ErrCATCreate( PIB *ppib, DBID dbid );
  93. ERR ErrCATInsert( PIB *ppib, DBID dbid, INT itable, LINE rgline[], OBJID objid );
  94. ERR ErrCATBatchInsert(
  95. PIB *ppib,
  96. DBID dbid,
  97. JET_COLUMNCREATE *pcolcreate,
  98. ULONG cColumns,
  99. OBJID objidTable,
  100. BOOL fCompacting );
  101. ERR ErrCATDelete( PIB *ppib, DBID dbid, INT itable, CHAR *szName, OBJID objid );
  102. ERR ErrCATReplace(
  103. PIB *ppib,
  104. DBID dbid,
  105. INT itable,
  106. OBJID objidTable,
  107. CHAR *szName,
  108. INT iReplaceField,
  109. BYTE *rgbReplaceValue,
  110. INT cbReplaceValue);
  111. ERR ErrCATRename(
  112. PIB *ppib,
  113. DBID dbid,
  114. CHAR *szNew,
  115. CHAR *szName,
  116. OBJID objid,
  117. INT itable );
  118. ERR ErrCATTimestamp( PIB *ppib, DBID dbid, OBJID objid );
  119. ERR ErrCATFindObjidFromIdName(
  120. PIB *ppib,
  121. DBID dbid,
  122. OBJID objidParentId,
  123. const CHAR *lszName,
  124. OBJID *pobjid,
  125. JET_OBJTYP *pobjtyp );
  126. ERR ErrCATFindNameFromObjid( PIB *ppib, DBID dbid, OBJID objid, VOID *pv, unsigned long cbMax, unsigned long *pcbActual );
  127. ERR ErrCATGetIndexLangid(
  128. PIB *ppib,
  129. DBID dbid,
  130. PGNO pgnoTable,
  131. CHAR *szIndexName,
  132. USHORT *pusLanguageid );
  133. ERR ErrCATConstructCATFDB( FDB **ppfdbNew, CHAR *szFileName);
  134. ERR ErrCATTableColumnInfo( PIB *ppib, DBID dbid, OBJID objidTable, TCIB *ptcib, BOOL fSetValue);
  135. ERR ErrCATConstructFDB( PIB *ppib, DBID dbid, PGNO pgnoTableFDP, FDB **ppfdbNew);
  136. ULONG UlCATColumnSize( JET_COLTYP coltyp, INT cbMax, BOOL *pfMaxTruncated);
  137. ERR ErrCATGetTableAllocInfo( PIB *ppib, DBID dbid, PGNO pgnoTable,
  138. ULONG *pulPages, ULONG *pulDensity );
  139. ERR ErrCATGetIndexAllocInfo( PIB *ppib, DBID dbid, PGNO pgnoTable,
  140. CHAR *szIndexName, ULONG *pulDensity );
  141. JET_COLUMNID ColumnidCATGetColumnid( INT iTable, INT iField );
  142. PGNO PgnoCATTableFDP( CHAR *szTable );
  143. ERR ErrCATGetCATIndexInfo(
  144. PIB *ppib,
  145. DBID dbid,
  146. FCB **ppfcb,
  147. FDB *pfdb,
  148. PGNO pgnoTableFDP,
  149. CHAR *szTableName,
  150. BOOL fCreatingSys );
  151. ERR ErrCATGetIndexInfo(
  152. PIB *ppib,
  153. DBID dbid,
  154. FCB **ppfcb,
  155. FDB *pfdb,
  156. PGNO pgnoTableFDP );
  157. #define szSysRoot "MSys"
  158. #define cbSysRoot strlen(szSysRoot)
  159. INLINE LOCAL BOOL FCATSystemTable( const CHAR *szTableName )
  160. {
  161. const CHAR *szRestOfName;
  162. LONG lResult;
  163. /* determine if we are openning a system table
  164. /**/
  165. UtilStringCompare( szTableName, cbSysRoot, szSysRoot, cbSysRoot, 0, &lResult );
  166. if ( lResult == 0 )
  167. {
  168. szRestOfName = szTableName + cbSysRoot;
  169. return UtilCmpName( szRestOfName, szSoTable+cbSysRoot ) == 0 ||
  170. UtilCmpName( szRestOfName, szScTable+cbSysRoot ) == 0 ||
  171. UtilCmpName( szRestOfName, szSiTable+cbSysRoot ) == 0;
  172. }
  173. return fFalse;
  174. }