📄 dbdao.h
字号:
/************************************************************************
** D B D A O . H *
** *
*************************************************************************
** Copyright (C) 1996 - 1999 Microsoft Corporation *
** All Rights Reserved *
************************************************************************/
/*
DBDAO.H
Class definitions for ddao SDK.
This is a part of the Microsoft Data Access Objects SDK library.
See the DAO SDK help information for detailed information regarding the
Microsoft Data Access Objects SDK product.
*/
#ifndef _DBDAO_H_
#pragma option push -b -a8 -pc -A- /*P_O_Push*/
#define _DBDAO_H_
// Ignore warning "non dll-interface class 'X' used as base for dll-interface class 'Y'
#pragma warning( disable : 4275 )
//DAO must be built with an MFC version >= 4.2 (or you'll get memory problems with CStrings)
#if _MFC_VER < 0x0420
#error The DAOSDK 3.5 libraries will not operate correctly if built with MFC older than 4.2
#endif
#ifndef DAO35
#define DAO35
#endif
#include <dbdaoint.h>
#include <daogetrw.h>
#include <dbdaoid.h>
// Decorations
#define CONSTRUCTOR
#define DESTRUCTOR
//Disable export
#ifndef DLLEXPORT
#define DLLEXPORT __declspec( dllexport )
#endif
//Macro to convert HRESULT to IDA
#define DBERR(x) SCODE_CODE(GetScode(x))
// Include internal DAO definitions
#include <_dbdao.h>
// DAO Recordset::GetRowsEx() binding definitions
#define dbBindIndexINT 1
#define dbBindIndexSTR 2
#define dbBindI2 DAO_I2 // long
#define dbBindI4 DAO_I4 // short
#define dbBindR4 DAO_R4 // float
#define dbBindR8 DAO_R8 // double
#define dbBindCY DAO_CURRENCY // Currency
#define dbBindDATE DAO_DATE // DATE
#define dbBindBOOL DAO_BOOL // VARIANT_BOOL
#define dbBindUI1 DAO_CHAR // unsigned char
#define dbBindVARIANT DAO_ANYVARIANT // VARIANT
#define dbBindWCHAR DAO_WCHAR // wchar_t[] (inline)
#define dbBindBookmark DAO_BOOKMARK // bookmark psuedo field
#define dbBindLPSTR DAO_LPSTR // \0 string in pvVarBuffer
#define dbBindLPWSTR DAO_LPWSTR // wide string in pvVarBuffer
#define dbBindBlob DAO_BLOB //
#ifdef _UNICODE
#define dbBindSTRING dbBindWCHAR
#define dbBindLPSTRING dbBindLPWSTR
#else
#define dbBindSTRING dbBindUI1
#define dbBindLPSTRING dbBindLPSTR
#endif
// Binding structure (Used with GetRowsEX)
typedef struct
{
DWORD dwBindIndexType;
union
{
LONG i;
LPCTSTR pstr;
};
DWORD dwType;
DWORD dwOffset;
DWORD cb;
} DAORSETBINDING, *LPDAORSETBINDING;
/*****************************************************************************
* Forwards
*/
class COleVariant;
class CdbBookmark;
class CdbException;
class CdbOleObject;
class CdbObject;
class CdbError;
class CdbProperty;
class CdbDBEngine;
class CdbWorkspace;
class CdbDatabase;
class CdbConnection;
class CdbRecordset;
class CdbGetRowsEx;
class CdbQueryDef;
class CdbTableDef;
class CdbField;
class CdbRelation;
class CdbIndex;
class CdbUser;
class CdbGroup;
class CdbDocument;
class CdbContainer;
class CdbParameter;
class CdbCollection;
class CdbErrors;
class CdbProperties;
class CdbWorkspaces;
class CdbDatabases;
class CdbConnections;
class CdbRecordsets;
class CdbQueryDefs;
class CdbTableDefs;
class CdbFields;
class CdbRelations;
class CdbIndexes;
class CdbUsers;
class CdbGroups;
class CdbDocuments;
class CdbContainers;
class CdbParameters;
/*****************************************************************************
* CdbException
*/
class DLLEXPORT CdbException
{
public:
CONSTRUCTOR CdbException (HRESULT hr);
HRESULT m_hr;
};
/*****************************************************************************
* CdbBookmark
*/
class DLLEXPORT CdbBookmark : public COleVariant
{
public:
CONSTRUCTOR CdbBookmark (LPSAFEARRAY psa);
CONSTRUCTOR CdbBookmark ();
CONSTRUCTOR CdbBookmark (const CdbBookmark &);
CdbBookmark & operator = (const CdbBookmark &);
operator LPSAFEARRAY (VOID);
};
/*****************************************************************************
* CdbIndexFields (special case for index fields)
*/
class DLLEXPORT CdbIndexFields : public CdbFields
{
public:
CdbField Item (LPCTSTR pstr);
CdbField Item (LONG i);
CdbObject ObItem (LPCTSTR pstr);
CdbObject ObItem (LONG i);
};
/*****************************************************************************
* CdbLastOLEError
*/
class DLLEXPORT CdbLastOLEError : public CdbOleObject
{
public:
CONSTRUCTOR CdbLastOLEError (VOID);
CString GetSource (VOID);
CString GetDescription (VOID);
CString GetHelpFile (VOID);
DWORD GetHelpContext (VOID);
};
/*****************************************************************************
* CdbDBEngine
*/
class DLLEXPORT CdbDBEngine : public CdbObject
{
public:
// Administration
CONSTRUCTOR CdbDBEngine (DAODBEngine *peng, BOOL bAddRef=FALSE);
CONSTRUCTOR CdbDBEngine (BOOL bPrivate=FALSE, BOOL bStart=TRUE, LPCTSTR pstrIniPath=NULL, LPCTSTR pstrDefUser=NULL, LPCTSTR pstrDefPW=NULL, LONG lType=dbUseJet);
CONSTRUCTOR CdbDBEngine (const CdbDBEngine &);
CdbDBEngine & operator = (const CdbDBEngine &);
inline CdbWorkspace operator [] (LONG lIndex);
inline CdbWorkspace operator [] (LPCTSTR pstrIndex);
VOID OnInterfaceChange (VOID);
// Properties
VOID SetDefaultPassword (LPCTSTR pstr);
VOID SetDefaultUser (LPCTSTR pstr);
VOID SetIniPath (LPCTSTR pstr);
CString GetIniPath (VOID);
VOID SetDefaultType (LONG l);
LONG GetDefaultType (VOID);
VOID SetLoginTimeout (SHORT s);
SHORT GetLoginTimeout (VOID);
CString GetVersion (VOID);
CString GetSystemDB (VOID);
VOID SetSystemDB (LPCTSTR pstr);
// Methods
CdbWorkspace CreateWorkspace (LPCTSTR pstrName, LPCTSTR pstrUser, LPCTSTR pstrPassword, LONG lType=-1);
CdbDatabase OpenDatabase (LPCTSTR pstrName, BOOL bExclusive, BOOL bReadOnly=FALSE, LPCTSTR pstrConnect=NULL);
CdbDatabase OpenDatabase (LPCTSTR pstrName, LONG lOption=0L, BOOL bReadOnly=FALSE, LPCTSTR pstrConnect=NULL);
CdbConnection OpenConnection (LPCTSTR pstrName, LONG lOption=-1L, BOOL bReadOnly=FALSE, LPCTSTR pstrConnect=NULL);
VOID CompactDatabase (LPCTSTR pstrOldDatabase, LPCTSTR pstrNewDatabase, LPCTSTR pstrDstConnect = NULL, LONG lOptions=-1, LPCTSTR pstrSrcConnect = NULL);
VOID RepairDatabase (LPCTSTR pstrDatabase);
VOID RegisterDatabase (LPCTSTR pstrDatabase, LPCTSTR pstrDriver, BOOL bSilent, LPCTSTR pstrAttributes);
VOID Idle (LONG lOptions=-1);
VOID Start (VOID);
VOID SetOption (long lOption, LPVARIANT pvValue);
// Collections
CdbWorkspaces Workspaces;
CdbErrors Errors;
private:
BOOL m_bStarted;
};
/*****************************************************************************
* CdbWorkspace
*/
class DLLEXPORT CdbWorkspace : public CdbObject
{
public:
// Administration
CONSTRUCTOR CdbWorkspace (VOID);
CONSTRUCTOR CdbWorkspace (DAOWorkspace *pwrk, BOOL bAddRef=FALSE);
CONSTRUCTOR CdbWorkspace (const CdbWorkspace &);
CdbWorkspace & operator = (const CdbWorkspace &);
inline CdbDatabase operator [] (LONG lIndex);
inline CdbDatabase operator [] (LPCTSTR pstrIndex);
VOID OnInterfaceChange (VOID);
// Properties
CString GetName (VOID);
VOID SetName (LPCTSTR pstr);
CString GetUserName (VOID);
BOOL GetIsolateODBCTrans (VOID);
VOID SetIsolateODBCTrans (BOOL b);
LONG GetType (VOID);
LONG GetDefaultCursorDriver (VOID);
VOID SetDefaultCursorDriver (LONG l);
LONG GetLoginTimeout (VOID);
VOID SetLoginTimeout (LONG l);
// Methods
VOID BeginTrans (VOID);
VOID CommitTrans (LONG lOptions=-1);
VOID Close (VOID);
VOID Rollback (VOID);
CdbDatabase OpenDatabase (LPCTSTR pstrName, BOOL bExclusive, BOOL bReadOnly=FALSE, LPCTSTR pstrConnect=NULL);
CdbDatabase OpenDatabase (LPCTSTR pstrName, LONG lOption=0L, BOOL bReadOnly=FALSE, LPCTSTR pstrConnect=NULL);
CdbConnection OpenConnection (LPCTSTR pstrName, LONG lOption=-1L, BOOL bReadOnly=FALSE, LPCTSTR pstrConnect=NULL);
CdbDatabase CreateDatabase (LPCTSTR pstrName, LPCTSTR pstrConnect, LONG lOption=-1);
CdbUser CreateUser (LPCTSTR pstrName=NULL, LPCTSTR pstrPID=NULL, LPCTSTR pstrPassword=NULL);
CdbGroup CreateGroup (LPCTSTR pstrName=NULL, LPCTSTR pstrPID=NULL);
// Collections
CdbDatabases Databases;
CdbConnections Connections;
CdbUsers Users;
CdbGroups Groups;
};
/*****************************************************************************
* CdbDatabase
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -