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.

116 lines
2.4 KiB

  1. /*++
  2. Copyright (c) 2000-2001 Microsoft Corporation
  3. Module Name:
  4. sql_1ext.h
  5. Abstract:
  6. Extends the SQL_LEVEL_1_RPN_EXPRESSION
  7. Author:
  8. Mohit Srivastava 22-Mar-2001
  9. Revision History:
  10. --*/
  11. #ifndef _sql_1ext_h_
  12. #define _sql_1ext_h_
  13. #include <sql_1.h>
  14. struct SQL_LEVEL_1_RPN_EXPRESSION_EXT
  15. {
  16. SQL_LEVEL_1_RPN_EXPRESSION_EXT()
  17. {
  18. m_bContainsOrOrNot = false;
  19. m_pSqlExpr = NULL;
  20. }
  21. ~SQL_LEVEL_1_RPN_EXPRESSION_EXT()
  22. {
  23. if (m_pSqlExpr)
  24. {
  25. delete m_pSqlExpr;
  26. }
  27. }
  28. void SetContainsOrOrNot()
  29. {
  30. if (!m_pSqlExpr)
  31. {
  32. return;
  33. }
  34. SQL_LEVEL_1_TOKEN* pToken = m_pSqlExpr->pArrayOfTokens;
  35. m_bContainsOrOrNot = false;
  36. for(int i = 0; i < m_pSqlExpr->nNumTokens; i++, pToken++)
  37. {
  38. if( pToken->nTokenType == SQL_LEVEL_1_TOKEN::TOKEN_OR ||
  39. pToken->nTokenType == SQL_LEVEL_1_TOKEN::TOKEN_NOT )
  40. {
  41. m_bContainsOrOrNot = true;
  42. break;
  43. }
  44. }
  45. }
  46. bool GetContainsOrOrNot() const { return m_bContainsOrOrNot; }
  47. const SQL_LEVEL_1_TOKEN* GetFilter(LPCWSTR i_wszProp) const
  48. {
  49. if (!m_pSqlExpr)
  50. {
  51. return NULL;
  52. }
  53. SQL_LEVEL_1_TOKEN* pToken = m_pSqlExpr->pArrayOfTokens;
  54. for(int i = 0; i < m_pSqlExpr->nNumTokens; i++, pToken++)
  55. {
  56. if( pToken->nTokenType == SQL_LEVEL_1_TOKEN::OP_EXPRESSION &&
  57. _wcsicmp(pToken->pPropertyName, i_wszProp) == 0 )
  58. {
  59. return pToken;
  60. }
  61. }
  62. return NULL;
  63. }
  64. bool FindRequestedProperty(LPCWSTR i_wszProp) const
  65. {
  66. if (!m_pSqlExpr)
  67. {
  68. return false;
  69. }
  70. //
  71. // This means someone did a select *
  72. //
  73. if(m_pSqlExpr->nNumberOfProperties == 0)
  74. {
  75. return true;
  76. }
  77. for(int i = 0; i < m_pSqlExpr->nNumberOfProperties; i++)
  78. {
  79. if(_wcsicmp(m_pSqlExpr->pbsRequestedPropertyNames[i], i_wszProp) == 0)
  80. {
  81. return true;
  82. }
  83. }
  84. return false;
  85. }
  86. SQL_LEVEL_1_RPN_EXPRESSION* m_pSqlExpr;
  87. private:
  88. bool m_bContainsOrOrNot;
  89. };
  90. #endif // _sql_1ext_h_