⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 storeprocess.h

📁 扩展mfc的ODBC类
💻 H
字号:
#if !defined(AFX_SOREPROCESS_H__5A4545B3_BB44_48E6_9144_58479B21AB3F__INCLUDED_)
#define AFX_SOREPROCESS_H__5A4545B3_BB44_48E6_9144_58479B21AB3F__INCLUDED_

#include <Afxtempl.h>

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// StoreProcess.h : header file
//

enum SP_Datatype
{
	DT_onType = 0,
	DT_Text,
	DT_Bool,
	DT_Long,
	DT_Int,
	DT_Single,
	DT_Double,
	DT_Date,
	DT_Byte,
	DT_Binary,
	DT_LongBinary
};
/*
typedef class CSqlParamValue
{
public:
	CString		AsText;
	BOOL		AsBool;
	long		AsLong;
	int			AsInt;
	float		AsSingle;;
	double		AsDouble;
	CTime		AsDate;
	BYTE		AsByte;
	CByteArray	AsBinary;
	CLongBinary	AsLongBinary;

	CSqlParamValue()
	{
		AsText = _T("");
		AsBool = FALSE;
		AsDouble = 0.0;
		AsInt = 0;
		AsLong = 0;
		AsSingle = 0.0;
	}
	~CSqlParamValue()
	{
	}

	CSqlParamValue & operator = (const CSqlParamValue & value)
	{
		AsText = value.AsText;
		AsBool = value.AsBool;
		AsLong = value.AsLong;
		AsInt = value.AsInt;
		AsSingle = value.AsSingle;
		AsDouble = value.AsDouble;
		AsDate = value.AsDate;
		AsByte = AsByte;
		AsBinary.RemoveAll();
		AsBinary.Copy(value.AsBinary);
		AsLongBinary.m_hData = value.AsLongBinary.m_hData;
		AsLongBinary.m_dwDataLength = value.AsLongBinary.m_dwDataLength;

		return *this;
	}
}SQL_PARAM_VALUE;
*/
typedef class CSqlParamValue
{
public:
	CString		AsText;
	BOOL		AsBool;
	long		AsLong;
	int			AsInt;
	float		AsSingle;
	double		AsDouble;
	CTime		AsDate;
	BYTE		AsByte;
	CByteArray	AsBinary;
	CLongBinary	AsLongBinary;
//	void *		pValue;

	CSqlParamValue()
	{
//		pValue = NULL;
		AsText = _T("");
		AsBool = FALSE;
		AsDouble = 0.0;
		AsInt = 0;
		AsLong = 0;
		AsSingle = 0.0;
	}
	~CSqlParamValue()
	{
	}

	CSqlParamValue & operator = (const CSqlParamValue & value)
	{
		AsText = value.AsText;
		AsBool = value.AsBool;
		AsLong = value.AsLong;
		AsInt = value.AsInt;
		AsSingle = value.AsSingle;
		AsDouble = value.AsDouble;
		AsDate = value.AsDate;
		AsByte = AsByte;
		AsBinary.RemoveAll();
		AsBinary.Copy(value.AsBinary);
		AsLongBinary.m_hData = value.AsLongBinary.m_hData;
		AsLongBinary.m_dwDataLength = value.AsLongBinary.m_dwDataLength;
//		pValue = value.pValue;

		return *this;
	}
}SQL_PARAM_VALUE;

class CSpParam
{
protected:
public:
	CFieldExchange::FieldType	ParamType;
	SP_Datatype					Datatype;
	CString						ParamName;
	int							Length;
	//SQL_PARAM_VALUE				interValue;
	void *						pExtValue;

	CSpParam();
	CSpParam(CFieldExchange::FieldType ftype, SP_Datatype dtype, CString pname, void* pValue, int length=0);
	~CSpParam();
	void Set(CFieldExchange::FieldType ftype, SP_Datatype dtype, CString pname, void* pValue, int length=0);
};

/////////////////////////////////////////////////////////////////////////////
// CStoreProcess recordset

class CStoreProcess : public CRecordset
{
public:
	CStoreProcess(CDatabase* pDatabase = NULL);
	~CStoreProcess();
	DECLARE_DYNAMIC(CStoreProcess)

// Field/Param Data
	//{{AFX_FIELD(CStoreProcess, CRecordset)
//	long	m_ParamId;
//	CString	m_ParamName;
//	CString	m_ParamValue;
	//}}AFX_FIELD


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CStoreProcess)
	public:
	virtual CString GetDefaultConnect();    // Default connection string
	virtual CString GetDefaultSQL();    // Default SQL for Recordset
	virtual void DoFieldExchange(CFieldExchange* pFX);  // RFX support
	virtual BOOL Open(UINT nOpenType = snapshot, LPCTSTR lpszSQL = NULL, DWORD dwOptions = none);
	//}}AFX_VIRTUAL

// Implementation
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

private:
	// store process's paramter list
	CArray<CSpParam*, CSpParam*> m_Params;
	CString m_Sql;
	void SetSql(CString sql);
public:
	long m_retSp;
	// Add paramter
	int AddParam(CSpParam* Param);
	int Reset(void);
	int Execute(void);
	// set store process's name, only name
	int SetStoreProc(CString procname);
	int SetDatabase(CDatabase * pDb);
	int ClearParams(void);
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SOREPROCESS_H__5A4545B3_BB44_48E6_9144_58479B21AB3F__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -