Leaked source code of windows server 2003
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.

77 lines
3.6 KiB

  1. // Flags for IDB
  2. #define fidbUnique (1<<0) // Duplicate keys not allowed
  3. #define fidbAllowAllNulls (1<<2) // Make entries for NULL keys (all segments are null)
  4. #define fidbAllowSomeNulls (1<<3) // Make entries for keys with some null segments
  5. #define fidbNoNullSeg (1<<4) // Don't allow a NULL key segment
  6. #define fidbPrimary (1<<5) // Index is the primary index
  7. #define fidbLangid (1<<6) // Index langid
  8. #define fidbHasMultivalue (1<<7) // Has a multivalued segment
  9. #define fidbAllowFirstNull (1<<8) // First index column NULL allowed in index
  10. #define fidbClustered (1<<9) // Clustered index
  11. #define IDBSetUnique( pidb ) ( (pidb)->fidb |= fidbUnique )
  12. #define IDBResetUnique( pidb ) ( (pidb)->fidb &= ~fidbUnique )
  13. #define FIDBUnique( pidb ) ( (pidb)->fidb & fidbUnique )
  14. #define IDBSetAllowAllNulls( pidb ) ( (pidb)->fidb |= fidbAllowAllNulls )
  15. #define IDBResetAllowAllNulls( pidb ) ( (pidb)->fidb &= ~fidbAllowAllNulls )
  16. #define FIDBAllowAllNulls( pidb ) ( (pidb)->fidb & fidbAllowAllNulls )
  17. #define IDBSetAllowSomeNulls( pidb ) ( (pidb)->fidb |= fidbAllowSomeNulls )
  18. #define IDBResetAllowSomeNulls( pidb ) ( (pidb)->fidb &= ~fidbAllowSomeNulls )
  19. #define FIDBAllowSomeNulls( pidb ) ( (pidb)->fidb & fidbAllowSomeNulls )
  20. #define IDBSetNoNullSeg( pidb ) ( (pidb)->fidb |= fidbNoNullSeg )
  21. #define IDBResetNoNullSeg( pidb ) ( (pidb)->fidb &= ~fidbNoNullSeg )
  22. #define FIDBNoNullSeg( pidb ) ( (pidb)->fidb & fidbNoNullSeg )
  23. #define IDBSetPrimary( pidb ) ( (pidb)->fidb |= fidbPrimary )
  24. #define IDBResetPrimary( pidb ) ( (pidb)->fidb &= ~fidbPrimary )
  25. #define FIDBPrimary( pidb ) ( (pidb)->fidb & fidbPrimary )
  26. #define IDBSetLangid( pidb ) ( (pidb)->fidb |= fidbLangid )
  27. #define IDBResetLangid( pidb ) ( (pidb)->fidb &= ~fidbLangid )
  28. #define FIDBLangid( pidb ) ( (pidb)->fidb & fidbLangid )
  29. #define IDBSetMultivalued( pidb ) ( (pidb)->fidb |= fidbMultivalued )
  30. #define IDBResetMultivalued( pidb ) ( (pidb)->fidb &= ~fidbMultivalued )
  31. #define FIDBMultivalued( pidb ) ( (pidb)->fidb & fidbMultivalued )
  32. #define IDBSetAllowFirstNull( pidb ) ( (pidb)->fidb |= fidbAllowFirstNull )
  33. #define IDBResetAllowFirstNull( pidb ) ( (pidb)->fidb &= ~fidbAllowFirstNull )
  34. #define FIDBAllowFirstNull( pidb ) ( (pidb)->fidb & fidbAllowFirstNull )
  35. #define IDBSetClustered( pidb ) ( (pidb)->fidb |= fidbClustered )
  36. #define IDBResetClustered( pidb ) ( (pidb)->fidb &= ~fidbClustered )
  37. #define FIDBClustered( pidb ) ( (pidb)->fidb & fidbClustered )
  38. /* Index Descriptor Block: information about index key
  39. /**/
  40. struct _idb
  41. {
  42. BYTE rgbitIdx[32]; // bit array for index columns
  43. CHAR szName[JET_cbNameMost + 1]; // index name
  44. BYTE cbVarSegMac; // maximum variable segment size
  45. SHORT fidb; // index flags
  46. IDXSEG rgidxseg[JET_ccolKeyMost]; // array of columnid for index
  47. LANGID langid; // language of index
  48. SHORT iidxsegMac; // number of columns in index
  49. };
  50. STATIC INLINE VOID IDBSetColumnIndex( IDB * pidb, FID fid )
  51. {
  52. pidb->rgbitIdx[IbFromFid( fid )] |= IbitFromFid( fid );
  53. }
  54. STATIC INLINE BOOL FIDBColumnIndex( const IDB * pidb, FID fid )
  55. {
  56. return (pidb->rgbitIdx[IbFromFid( fid )] & IbitFromFid( fid ) );
  57. }
  58. #define PidbMEMAlloc() (IDB*)PbMEMAlloc(iresIDB)
  59. #ifdef DEBUG /* Debug check for illegal use of freed idb */
  60. #define MEMReleasePidb( pidb ) { MEMRelease( iresIDB, (BYTE*)(pidb) ); pidb = pidbNil; }
  61. #else
  62. #define MEMReleasePidb( pidb ) { MEMRelease( iresIDB, (BYTE*)(pidb) ); }
  63. #endif