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

📄 tableholder.cpp

📁 Data Replication Prototype Using ADO
💻 CPP
字号:
// TableHolder.cpp: implementation of the CTableHolder class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ETLLib.h"
#include "TableHolder.h"


#include <algorithm>
#include "BellsMacrosX.h"
#include "DBTable.h"


#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CTableHolder::CTableHolder()
{
	m_bReadOnly = false;
}

CTableHolder::~CTableHolder()
{
	std::for_each(m_mapDBTables.begin(), m_mapDBTables.end(), DeleteSecond());
}

bool CTableHolder::HasSameDatabase(const CTableHolder& other) const
{
	ASSERT(GetDBManager() != NULL);
	ASSERT(other.GetDBManager() != NULL);
	return GetDBManager()->ConnectionString == other.GetDBManager()->ConnectionString;
}

bool CTableHolder::Lookup(LPCWSTR pszTableName, CDBTable*& rpDBTable) const
{
	CMapLPCWSTR2PDBTable::const_iterator iter = m_mapDBTables.find(pszTableName);
	if (iter != m_mapDBTables.end())
	{
		rpDBTable = iter->second;
		return true;
	}
	return false;
}

void CTableHolder::SetDBTable(LPCWSTR pszTableName, CDBTable* pDBTable)
{
	m_mapDBTables[pszTableName] = pDBTable;
}


struct DoFreeStatements
{
	template<typename T> void operator ()(const T& r) const
	{
		r.second->FreeStatements();
	}
};


void CTableHolder::FreeStatements()
{
	std::for_each(m_mapDBTables.begin(), m_mapDBTables.end(), DoFreeStatements());
}

Identity CTableHolder::GetIdentity(LPCWSTR pszValue)
{
	Identity id;
	id.Set(pszValue, m_IdentityShared);
	return id;
}

⌨️ 快捷键说明

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