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.

167 lines
6.7 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Copyright (C) Microsoft Corporation, 1996 - 2000.
  4. //
  5. // File: strrest.hxx
  6. //
  7. // Contents: Builds a restriction object from a string
  8. //
  9. // History: 96/Jan/3 DwightKr Created
  10. // 97/Jul/22 KrishnaN Extended to take a restriction
  11. // and build a full query tree.
  12. //
  13. //----------------------------------------------------------------------------
  14. #pragma once
  15. class PVariableSet;
  16. class CVariable;
  17. CDbRestriction * GetStringDbRestriction( const WCHAR * wcsRestriction,
  18. ULONG ulDialect,
  19. IColumnMapper * pList,
  20. LCID locale );
  21. CDbCmdTreeNode * FormDbQueryTree( XPtr<CDbCmdTreeNode> & xDbCmdTreeNode,
  22. XPtr<CDbSortNode> & xDbSortNode,
  23. XPtr<CDbProjectListAnchor> & pDbCols,
  24. XPtr<CDbNestingNode> & pDbGroupNode,
  25. ULONG ulMaxRecords,
  26. ULONG ulFirstRows );
  27. CDbColumns * ParseStringColumns( WCHAR const * wcsColumns,
  28. IColumnMapper * pList,
  29. LCID lcid = GetSystemDefaultLCID(),
  30. PVariableSet * pVarSet = 0,
  31. CDynArray<WCHAR> * pawcsColumns = 0 );
  32. CDbProjectListAnchor * ParseColumnsWithFriendlyNames( WCHAR const * wcsColumns,
  33. IColumnMapper * pList,
  34. PVariableSet * pVarSet = 0 );
  35. //+---------------------------------------------------------------------------
  36. //
  37. // Class: CTextToTree
  38. //
  39. // Purpose: An object to convert the textual restriction, columns and
  40. // sort specification to a DBCOMMANDTREE.
  41. //
  42. // History: 3-04-97 srikants Created
  43. //
  44. //----------------------------------------------------------------------------
  45. class CTextToTree
  46. {
  47. public:
  48. CTextToTree( WCHAR const * wcsRestriction,
  49. ULONG ulDialect,
  50. WCHAR const * wcsColumns,
  51. IColumnMapper * pPropList,
  52. LCID locale,
  53. WCHAR const * wcsSort = 0,
  54. WCHAR const * wcsGroup = 0,
  55. PVariableSet * pVariableSet = 0,
  56. ULONG maxRecs = 0,
  57. ULONG cFirstRows = 0,
  58. BOOL fKeepFriendlyNames = FALSE )
  59. : _wcsRestriction(wcsRestriction),
  60. _ulDialect( ulDialect ),
  61. _wcsColumns(wcsColumns),
  62. _wcsSort(wcsSort),
  63. _wcsGroup(wcsGroup),
  64. _locale(locale),
  65. _pVariableSet(pVariableSet),
  66. _pDbColumns(0),
  67. _xPropList(pPropList),
  68. _maxRecs(maxRecs),
  69. _cFirstRows(cFirstRows),
  70. _fKeepFriendlyNames( fKeepFriendlyNames ),
  71. _pDbCmdTree( 0 )
  72. {
  73. Win4Assert( 0 != wcsRestriction && 0 != wcsRestriction[0] );
  74. Win4Assert( 0 != _wcsColumns && 0 != _wcsColumns[0] );
  75. _xPropList->AddRef();
  76. }
  77. CTextToTree( DBCOMMANDTREE const *pDbCmdTree,
  78. WCHAR const * wcsColumns,
  79. IColumnMapper *pPropList,
  80. LCID locale,
  81. WCHAR const * wcsSort = 0,
  82. WCHAR const * wcsGroup = 0,
  83. PVariableSet * pVariableSet = 0,
  84. ULONG maxRecs = 0,
  85. ULONG cFirstRows = 0,
  86. BOOL fKeepFriendlyNames = FALSE )
  87. : _wcsRestriction( 0 ),
  88. _ulDialect( ISQLANG_V1 ),
  89. _wcsColumns(wcsColumns),
  90. _wcsSort(wcsSort),
  91. _wcsGroup(wcsGroup),
  92. _locale(locale),
  93. _pVariableSet(pVariableSet),
  94. _pDbColumns(0),
  95. _xPropList(pPropList),
  96. _maxRecs(maxRecs),
  97. _cFirstRows(cFirstRows),
  98. _fKeepFriendlyNames( fKeepFriendlyNames ),
  99. _pDbCmdTree( pDbCmdTree )
  100. {
  101. Win4Assert( 0 != _pDbCmdTree );
  102. Win4Assert( 0 != _wcsColumns && 0 != _wcsColumns[0] );
  103. _xPropList->AddRef();
  104. }
  105. CTextToTree( WCHAR const * wcsRestriction,
  106. ULONG ulDialect,
  107. CDbColumns * pDbColumns,
  108. IColumnMapper *pPropList,
  109. LCID locale,
  110. WCHAR const * wcsSort = 0,
  111. WCHAR const * wcsGroup = 0,
  112. PVariableSet * pVariableSet = 0,
  113. ULONG maxRecs = 0,
  114. ULONG cFirstRows = 0 )
  115. : _wcsRestriction(wcsRestriction),
  116. _ulDialect( ulDialect ),
  117. _wcsColumns(0),
  118. _wcsSort(wcsSort),
  119. _wcsGroup(wcsGroup),
  120. _locale(locale),
  121. _pVariableSet(pVariableSet),
  122. _pDbColumns(pDbColumns),
  123. _xPropList(pPropList),
  124. _maxRecs(maxRecs),
  125. _cFirstRows(cFirstRows),
  126. _fKeepFriendlyNames(FALSE),
  127. _pDbCmdTree( 0 )
  128. {
  129. Win4Assert( 0 != wcsRestriction && 0 != wcsRestriction[0] );
  130. Win4Assert( 0 != pDbColumns );
  131. _xPropList->AddRef();
  132. }
  133. DBCOMMANDTREE * FormFullTree();
  134. private:
  135. WCHAR const * _wcsRestriction; // Restriction in "Tripolish"
  136. ULONG _ulDialect; // tripolish dialict
  137. DBCOMMANDTREE const * _pDbCmdTree; // Restriction tree
  138. WCHAR const * _wcsColumns; // Comma separated column list
  139. WCHAR const * _wcsSort; // Sort specification
  140. WCHAR const * _wcsGroup; // Grouping specification
  141. CDbColumns * _pDbColumns; // Parsed db columns
  142. XInterface<IColumnMapper> _xPropList; // Property List
  143. LCID _locale; // Locale for parsing the strings
  144. PVariableSet * _pVariableSet; // Variable Set
  145. ULONG _maxRecs; // Maximum number of output records
  146. ULONG _cFirstRows;
  147. BOOL _fKeepFriendlyNames; // Flag indicating if friendly names
  148. // from columns should be retained
  149. };