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.

67 lines
2.6 KiB

  1. //***************************************************************************
  2. //
  3. // (c) 1999-2001 by Microsoft Corp. All Rights Reserved.
  4. //
  5. // wqltosql.h
  6. //
  7. // cvadai 19-Mar-99 Created as prototype for Quasar.
  8. //
  9. //***************************************************************************
  10. #ifndef _WQLTOSQL_H_
  11. #define _WQLTOSQL_H_
  12. typedef __int64 SQL_ID;
  13. struct C_wchar_LessCase
  14. {
  15. bool operator()(const wchar_t * _X, const wchar_t * _Y) const
  16. {
  17. return (_wcsicmp( _X,_Y ) < 0);
  18. }
  19. };
  20. class CWmiDbHandle;
  21. class CSchemaCache;
  22. // WQL - SQL converter
  23. class CSQLBuilder
  24. {
  25. public:
  26. // Generic SQL
  27. HRESULT FormatSQL (SQL_ID dScopeId, SQL_ID dScopeClassId, SQL_ID dSuperScope,
  28. IWbemQuery *pQuery, _bstr_t &sSQL, DWORD dwFlags,
  29. DWORD dwHandleType, SQL_ID *dClassId=0,
  30. BOOL *bHierarchyQuery=0, BOOL bTmpTblOK=TRUE, BOOL *bDelete=NULL,
  31. BOOL *bDefault=NULL);
  32. HRESULT FormatSQL (SQL_ID dScopeId, SQL_ID dScopeClassId, SQL_ID dSuperScope,
  33. SQL_ID dTargetObjID, LPWSTR pResultClass,
  34. LPWSTR pAssocClass, LPWSTR pRole, LPWSTR pResultRole, LPWSTR pRequiredQualifier,
  35. LPWSTR pRequiredAssocQualifier, DWORD dwQueryType, _bstr_t &sSQL, DWORD dwFlags,
  36. DWORD dwHandleType, SQL_ID *dAssocClass=0, SQL_ID *dResultClass=0, BOOL bIsClass=FALSE);
  37. CSQLBuilder(CSchemaCache *pSchema) {m_pSchema = pSchema;};
  38. ~CSQLBuilder(){};
  39. private:
  40. HRESULT FormatWhereClause (SWQLNode_RelExpr *pNode, _bstr_t &sSQL, LPCWSTR lpJoinAlias, bool &bSysPropsUsed);
  41. HRESULT GetStorageTable(DWORD dwStorage, DWORD dwKey, _bstr_t &sTable);
  42. HRESULT GetPropertyID (SQL_ID dClassID, SWQLQualifiedName *pQN, LPCWSTR pColRef, DWORD &PropID, DWORD &Storage, DWORD &Flags);
  43. HRESULT FunctionalizeProperty (LPCWSTR lpAlias, DWORD dwType, LPWSTR lpFuncName, SWQLNode *pFunction, LPWSTR lpColName, _bstr_t &sProp);
  44. HRESULT FunctionalizeValue(SWQLTypedConst *pValue, DWORD dwType, LPWSTR lpFuncName, _bstr_t &sValue);
  45. HRESULT FormatSimpleSelect (LPCWSTR lpUseAlias, LPCWSTR lpColName,SWQLNode *pTop, _bstr_t &sSQL);
  46. HRESULT FormatPositionQuery (SWQLQualifiedNameField *pQNF, int iPos, LPCWSTR lpAlias, _bstr_t &sQuery);
  47. HRESULT GetClassFromNode (SWQLNode *pNode, BOOL *bDefaultStorage=NULL);
  48. SQL_ID m_dClassID;
  49. DWORD m_dwTableCount;
  50. bool m_bClassSpecified;
  51. SQL_ID m_dNamespace;
  52. CSchemaCache *m_pSchema;
  53. };
  54. #endif