windows-nt/Source/XPSP1/NT/sdktools/infgen/simpledb.h

63 lines
1.3 KiB
C
Raw Normal View History

2020-09-26 03:20:57 -05:00
#include <windows.h>
#include <msdasc.h>
class CSimpleDBResults
{
public:
CSimpleDBResults( IMultipleResults *pResults );
~CSimpleDBResults();
HRESULT NextResultSet();
HRESULT GetFieldValue( LPCTSTR szField, LPTSTR szValue, DWORD dwMaxChars );
HRESULT NextRow();
private:
void FreeRowset();
void FreeRow();
struct _BindResult
{
DWORD status;
DBLENGTH length;
PVOID value;
};
IMultipleResults *m_pResults;
IRowset *m_pCurRowset;
DBCOLUMNINFO *m_rgColumnInfo;
HROW *m_phRow;
LPWSTR m_pColumnBuf;
DBORDINAL m_numColumns;
struct ColInfo
{
HACCESSOR hAccessor;
#ifndef UNICODE
char *szColumnName;
#endif
} *m_colInfo;
};
class CSimpleDatabase
{
public:
CSimpleDatabase();
~CSimpleDatabase();
HRESULT Connect( LPCTSTR szServer,
LPCTSTR szDatabase,
LPCTSTR szUserName,
LPCTSTR szPassword );
HRESULT Execute( LPCTSTR szCommand,
CSimpleDBResults **ppOutResults );
private:
HRESULT EstablishSession( IDBInitialize *pDBInitialize );
IDataInitialize *m_pDataInit;
IDBCreateCommand *m_pSession;
BOOL m_bCreated;
BOOL m_bSession;
};