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

📄 cmdinfofactory.h

📁 Vc.Net入门与提高源码
💻 H
字号:
// File: CmdInfoFactory.h
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Classes Reference and related electronic
// documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft C++ Libraries products.

#pragma once
#include "stdafx.h"

typedef CAtlArray<DWORD> DWordVector;

// CmdInfo stores the parameters as well as the SQL call string for a given stored procedure
struct CmdInfo
{
	DWordVector paramTypes;
	CStringA	cmdCallString;
};

// CmdInfoFactory abstracts the creation of CmdInfo.  Creating a CmdInfo is quite expensive and 
// relatively complicated.  We use this class to hide the creation details of CmdInfo, and we use
// it to hide the fact that we might cache CmdInfo objects.  If CmdInfoFactory is created with a 
// IMemoryCache (see constructor), then we will cache CmdInfo objects in ATL Server's per thread
// cache.
class CmdInfoFactory
{
public:
	CmdInfoFactory(IMemoryCache	*cmdInfoCache = NULL);
	virtual ~CmdInfoFactory(void);

	HRESULT GetCmdInfo(	CStringA&		cmdName,
						CStringA&		connectionString, 						
						const CSession	&datasource, 
						CmdInfo			**cmdInfo, 
						bool&			infoFromCache);
private:
	HRESULT CreateAndStoreCmdInfo(const CSession&		session,								  
								  CString&				cmdName,
								  CString&				connectionString,
								  CmdInfo**				cmdInfo,
								  bool&					infoFromCache);

	HRESULT BuildCmdStringAndParams(CProcedureParameters&	procInfo,
									CString&				cmdName,
									CmdInfo*				cmdInfo);
private:
	IMemoryCache *m_cmdInfoCache;
};

⌨️ 快捷键说明

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