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.

62 lines
1.3 KiB

  1. #include <windows.h>
  2. #include <msdasc.h>
  3. class CSimpleDBResults
  4. {
  5. public:
  6. CSimpleDBResults( IMultipleResults *pResults );
  7. ~CSimpleDBResults();
  8. HRESULT NextResultSet();
  9. HRESULT GetFieldValue( LPCTSTR szField, LPTSTR szValue, DWORD dwMaxChars );
  10. HRESULT NextRow();
  11. private:
  12. void FreeRowset();
  13. void FreeRow();
  14. struct _BindResult
  15. {
  16. DWORD status;
  17. DBLENGTH length;
  18. PVOID value;
  19. };
  20. IMultipleResults *m_pResults;
  21. IRowset *m_pCurRowset;
  22. DBCOLUMNINFO *m_rgColumnInfo;
  23. HROW *m_phRow;
  24. LPWSTR m_pColumnBuf;
  25. DBORDINAL m_numColumns;
  26. struct ColInfo
  27. {
  28. HACCESSOR hAccessor;
  29. #ifndef UNICODE
  30. char *szColumnName;
  31. #endif
  32. } *m_colInfo;
  33. };
  34. class CSimpleDatabase
  35. {
  36. public:
  37. CSimpleDatabase();
  38. ~CSimpleDatabase();
  39. HRESULT Connect( LPCTSTR szServer,
  40. LPCTSTR szDatabase,
  41. LPCTSTR szUserName,
  42. LPCTSTR szPassword );
  43. HRESULT Execute( LPCTSTR szCommand,
  44. CSimpleDBResults **ppOutResults );
  45. private:
  46. HRESULT EstablishSession( IDBInitialize *pDBInitialize );
  47. IDataInitialize *m_pDataInit;
  48. IDBCreateCommand *m_pSession;
  49. BOOL m_bCreated;
  50. BOOL m_bSession;
  51. };