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.

153 lines
6.0 KiB

  1. //---------------------------------------------------------------------------
  2. // RowsetColumn.h : CVDRowsetColumn header file
  3. //
  4. // Copyright (c) 1996 Microsoft Corporation, All Rights Reserved
  5. // Developed by Sheridan Software Systems, Inc.
  6. //---------------------------------------------------------------------------
  7. #ifndef __CVDROWSETCOLUMN__
  8. #define __CVDROWSETCOLUMN__
  9. #define VD_COLUMNSROWSET_MAX_OPT_COLUMNS 8
  10. class CVDRowsetColumn
  11. {
  12. public:
  13. // Construction/Destruction
  14. CVDRowsetColumn();
  15. virtual ~CVDRowsetColumn();
  16. // Initialization
  17. BOOL Initialize(ULONG ulOrdinal,
  18. ULONG ulCursorOrdinal,
  19. DBCOLUMNINFO * pColumnInfo,
  20. ULONG cbMaxBookmark,
  21. CURSOR_DBCOLUMNID * pBookmarkColumnID = NULL);
  22. // Initialization of metadata metadata columns
  23. BOOL Initialize(const CURSOR_DBCOLUMNID * pCursorColumnID,
  24. BOOL fDataColumn,
  25. ULONG cbMaxLength,
  26. CHAR * pszName,
  27. DWORD dwCursorType,
  28. DWORD dwNumber);
  29. // Position
  30. ULONG GetOrdinal() const {return m_ulOrdinal;}
  31. // IRowset metadata
  32. DBID GetColumnID() const {return m_columnID;}
  33. DBTYPE GetType() const {return (DBTYPE)m_wType;}
  34. // ICursor metadata
  35. BOOL GetAutoIncrement() const {return m_bool.fAutoIncrement;}
  36. void SetAutoIncrement(VARIANT_BOOL fAutoIncrement) {m_bool.fAutoIncrement = fAutoIncrement;}
  37. WCHAR * GetBaseColumnName() const {return m_pwszBaseColumnName;}
  38. void SetBaseColumnName(WCHAR * pBaseColumnName, ULONG ulLength)
  39. { SetStringProperty(&m_pwszBaseColumnName, pBaseColumnName, ulLength); }
  40. WCHAR * GetBaseName() const {return m_pwszBaseName;}
  41. void SetBaseName(WCHAR * pBaseName, ULONG ulLength)
  42. { SetStringProperty(&m_pwszBaseName, pBaseName, ulLength); }
  43. DWORD GetBindType() const {return m_dwBindType;}
  44. BOOL GetCaseSensitive() const {return m_bool.fCaseSensitive;}
  45. void SetCaseSensitive(VARIANT_BOOL fCaseSensitive) {m_bool.fCaseSensitive = fCaseSensitive;}
  46. LCID GetCollatingOrder() const {return m_lcidCollatingOrder;}
  47. void SetCollatingOrder(LCID lcidCollatingOrder) {m_lcidCollatingOrder = lcidCollatingOrder;}
  48. CURSOR_DBCOLUMNID GetCursorColumnID() const {return m_cursorColumnID;}
  49. BOOL GetDataColumn() const {return m_bool.fDataColumn;}
  50. WCHAR * GetDefaultValue() const {return m_pwszDefaultValue;}
  51. void SetDefaultValue(WCHAR * pDefaultValue, ULONG ulLength)
  52. { SetStringProperty(&m_pwszDefaultValue, pDefaultValue, ulLength); }
  53. ULONG GetEntryIDMaxLength() const {return m_cbEntryIDMaxLength;}
  54. BOOL GetFixed() const {return m_bool.fFixed;}
  55. BOOL GetHasDefault() const {return m_bool.fHasDefault;}
  56. void SetHasDefault(VARIANT_BOOL fHasDefault) {m_bool.fHasDefault = fHasDefault;}
  57. ULONG GetMaxLength() const {return m_cbMaxLength;}
  58. BOOL GetMultiValued() const {return m_bool.fMultiValued;}
  59. WCHAR * GetName() const {return m_pwszName;}
  60. BOOL GetNullable() const {return m_bool.fNullable;}
  61. DWORD GetNumber() const {return m_dwNumber;}
  62. DWORD GetScale() const {return m_dwScale;}
  63. BOOL GetSearchable() const {return m_bool.fSearchable;}
  64. DWORD GetCursorType() const {return m_dwCursorType;}
  65. BOOL GetUnique() const {return m_bool.fUnique;}
  66. void SetUnique(VARIANT_BOOL fUnique) {m_bool.fUnique = fUnique;}
  67. DWORD GetUpdatable() const {return m_dwUpdatable;}
  68. DWORD GetVersion() const {return m_dwVersion;}
  69. DWORD GetStatus() const {return m_dwStatus;}
  70. // Fetching
  71. DWORD GetMaxStrLen() const {return m_ulMaxStrLen;}
  72. public:
  73. // Conversions
  74. static CURSOR_DBCOLUMNID ColumnIDToCursorColumnID(const DBID& columnID, ULONG ulCursorOrdinal);
  75. static CURSOR_DBVARENUM TypeToCursorType(DBTYPE wType);
  76. static DBTYPE CursorTypeToType(CURSOR_DBVARENUM dwCursorType);
  77. // Fetching
  78. static ULONG GetCursorTypeMaxStrLen(DWORD dwCursorType, ULONG cbMaxLength);
  79. protected:
  80. void SetStringProperty(WCHAR ** ppStringProp,
  81. WCHAR * pNewString,
  82. ULONG ulLength);
  83. // Position
  84. ULONG m_ulOrdinal; // IRowset ordinal position
  85. // IRowset metadata
  86. DBID m_columnID; // column identifier
  87. DWORD m_wType; // datatype
  88. // ICursor metadata
  89. WCHAR * m_pwszBaseColumnName; // base column name
  90. WCHAR * m_pwszBaseName; // base name
  91. DWORD m_dwBindType; // bind type
  92. LCID m_lcidCollatingOrder; // collating order
  93. CURSOR_DBCOLUMNID m_cursorColumnID; // column identifier
  94. WCHAR * m_pwszDefaultValue; // default value
  95. ULONG m_cbEntryIDMaxLength; // entryID maximum length
  96. ULONG m_cbMaxLength; // data maximum length
  97. WCHAR * m_pwszName; // name
  98. DWORD m_dwNumber; // number
  99. DWORD m_dwScale; // scale
  100. DWORD m_dwCursorType; // datatype
  101. DWORD m_dwUpdatable; // updateablity
  102. DWORD m_dwVersion; // version
  103. DWORD m_dwStatus; // status
  104. // Booleans
  105. struct
  106. {
  107. WORD fInitialized : 1; // is column initialized?
  108. WORD fAutoIncrement : 1; // auto increment?
  109. WORD fCaseSensitive : 1; // case sensitive?
  110. WORD fDataColumn : 1; // data column?
  111. WORD fFixed : 1; // fixed length?
  112. WORD fHasDefault : 1; // has default value?
  113. WORD fMultiValued : 1; // multivalued?
  114. WORD fNullable : 1; // accepts NULLs?
  115. WORD fSearchable : 1; // searchable?
  116. WORD fUnique : 1; // unique?
  117. } m_bool;
  118. // Fetching
  119. DWORD m_ulMaxStrLen; // maximum string length for fixed data types
  120. };
  121. #endif //__CVDROWSETCOLUMN__