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

#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;
};