当前位置: 首页>>代码示例>>C++>>正文


C++ CEntityProperty::GetDbFlag方法代码示例

本文整理汇总了C++中CEntityProperty::GetDbFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ CEntityProperty::GetDbFlag方法的具体用法?C++ CEntityProperty::GetDbFlag怎么用?C++ CEntityProperty::GetDbFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CEntityProperty的用法示例。


在下文中一共展示了CEntityProperty::GetDbFlag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SaveDupRgn

//! 保存个人房屋信息
void CRsDupRgn::SaveDupRgn(CDBDupRgn* dupRgn, _ConnectionPtr& cn)
{	
	if(cn == NULL)
	{
		AddLogText(CStringReading::LoadString(IDS_DBS_RSDUPRGN,STR_DBS_DUPRGN_FINDDUPRGNPROPERTYERR));
		return;
	}

	_RecordsetPtr rs;
	char sql[1024] = "";
	try
	{
		TESTHR(CreateRs(rs));

		char szGUID[128];
		dupRgn->GetExID().tostring(szGUID);
		
		sprintf(sql, "select * from dbo.CSL_DUPRGN_PROPERTY where guid='%s'", szGUID);
		TESTHR(OpenRs(sql, rs, cn, adOpenDynamic, adLockOptimistic));
	
		bool isNewCreated = false;
		if(rs->GetadoEOF()) // 没有记录,创建一个
		{
			rs->AddNew();
			isNewCreated = true;
		}

		set<string>::iterator epItr = dupRgn->GetDirtyAttrDataMap().begin();
		for(; epItr != dupRgn->GetDirtyAttrDataMap().end(); epItr++)
		{
			CEntityProperty* ep = dupRgn->GetDataEntityManager().GetEntityProperty(*epItr);
			if(ep)
			{
				if(ep->GetDBTableName() == "CSL_DUPRGN_PROPERTY")
				{
					switch(ep->GetDataType())
					{
					case DATA_OBJECT_TIME:
						{
							char szTimeValue[2048];
							DWORD timeValue[6] = {0};
							ep->GetBufAttr(0, (void*)timeValue, 6*sizeof(DWORD));
							if(szTimeValue[0] != 0 && szTimeValue[1] != 0 && szTimeValue[2] != 0
								&& szTimeValue[3] != 0 && szTimeValue[4] != 0 && szTimeValue[5] != 0)
							{
								sprintf(szTimeValue, "%d-%d-%d %d:%d:%d", timeValue[0], timeValue[1], timeValue[2],
									timeValue[3], timeValue[4], timeValue[5]);
								rs->PutCollect((*epItr).c_str(), szTimeValue);
							}
						}
						break;
					case  DATA_OBJECT_STRING:
						{
							const char* pStr = ep->GetStringAttr(0);
							if(pStr)
								rs->PutCollect((*epItr).c_str(), pStr);
						}
						break;
					case DATA_OBJECT_BUFFER:
						{
							SaveBufferField((CBaseDBEntity*)dupRgn, (*epItr).c_str(), rs);
						}
						break;
					case DATA_OBJECT_GUID:
						{
							CGUID tGUID;
							ep->GetGuidAttr(0, tGUID);
							char szGUID[128];
							tGUID.tostring(szGUID);
							if( (ep->GetDbFlag() == 0) ) // 0:非主键,1:主键
								rs->PutCollect((*epItr).c_str(), szGUID);
							else if(isNewCreated) // 是主键但是是刚创建对象
								rs->PutCollect((*epItr).c_str(), szGUID);
						}
						break;
					case DATA_OBJECT_BOOL:
					case DATA_OBJECT_CHAR:
					case DATA_OBJECT_BYTE:
						{
							rs->PutCollect((*epItr).c_str(), (BYTE)ep->GetLongAttr(0));
						}
						break;
					case DATA_OBJECT_SHORT:
					case DATA_OBJECT_WORD:
					case DATA_OBJECT_USHORT:
						{
							rs->PutCollect((*epItr).c_str(), (WORD)ep->GetLongAttr(0));
						}
						break;
					case DATA_OBJECT_FLOAT:
					case DATA_OBJECT_LONG:
					case DATA_OBJECT_ULONG:
					case DATA_OBJECT_DWORD:
						{
							rs->PutCollect((*epItr).c_str(), (DWORD)ep->GetLongAttr(0));
						}
						break;
					}
				}
//.........这里部分代码省略.........
开发者ID:xiongshaogang,项目名称:mmo-resourse,代码行数:101,代码来源:RsDupRgn.cpp

示例2: SaveMail

//! 保存个人房屋信息
void CRsMail::SaveMail(CDBMail* mail, _ConnectionPtr& cn)
{	
	if(cn == NULL)
	{
		AddLogText(CStringReading::LoadString(IDS_DBS_RSDUPRGN,STR_DBS_DUPRGN_FINDDUPRGNPROPERTYERR));
		return;
	}

	if(!mail) return;

	_RecordsetPtr rs;
	char sql[500] = "";
	try
	{
		TESTHR(CreateRs(rs));

		char szGUID[128];
		mail->GetExID().tostring(szGUID);
		
		TESTHR(OpenRs("CSL_MAIL", rs, cn, adOpenForwardOnly, adLockOptimistic));
	
		if(!rs->GetadoEOF()) // 没有记录,创建一个
		{
			ReleaseRs(rs);
			AddLogText("Create mail[%s] Err,RS is NULL!", szGUID);
		}

		bool isNewCreated = false;
		BYTE phNum = rs->GetRecordCount();
		if(phNum == 0xff) // 没有记录,创建一个
		{
			rs->AddNew();
			isNewCreated = true;
		}

		set<string>::iterator epItr = mail->GetDirtyAttrDataMap().begin();
		for(; epItr != mail->GetDirtyAttrDataMap().end(); epItr++)
		{
			CEntityProperty* ep = mail->GetDataEntityManager().GetEntityProperty(*epItr);
			if(ep)
			{
				if(ep->GetDBTableName() == "CSL_MAIL")
				{
					switch(ep->GetDataType())
					{
					case DATA_OBJECT_TIME:
						{
							char szTimeValue[2048];
							DWORD timeValue[6] = {0};
							ep->GetBufAttr(0, (void*)timeValue, 6*sizeof(DWORD));
							if(szTimeValue[0] != 0 && szTimeValue[1] != 0 && szTimeValue[2] != 0
								&& szTimeValue[3] != 0 && szTimeValue[4] != 0 && szTimeValue[5] != 0)
							{
								sprintf(szTimeValue, "%d-%d-%d %d:%d:%d", timeValue[0], timeValue[1], timeValue[2],
									timeValue[3], timeValue[4], timeValue[5]);
								rs->PutCollect((*epItr).c_str(), szTimeValue);
							}
						}
						break;
					case  DATA_OBJECT_STRING:
						{
							rs->PutCollect((*epItr).c_str(), ep->GetStringAttr(0));
						}
						break;
					case DATA_OBJECT_BUFFER:
						{
							SaveBufferField((CBaseDBEntity*)mail, (*epItr).c_str(), rs);
						}
						break;
					case DATA_OBJECT_GUID:
						{
							CGUID tGUID;
							ep->GetGuidAttr(0, tGUID);
							char szGUID[128];
							tGUID.tostring(szGUID);
							if( (ep->GetDbFlag() == 0) ) // 0:非主键,1:主键
								rs->PutCollect((*epItr).c_str(), szGUID);
							else if(isNewCreated) // 是主键但是是刚创建对象
								rs->PutCollect((*epItr).c_str(), szGUID);
						}
						break;
					case DATA_OBJECT_BOOL:
					case DATA_OBJECT_CHAR:
					case DATA_OBJECT_BYTE:
						{
							rs->PutCollect((*epItr).c_str(), (BYTE)ep->GetLongAttr(0));
						}
						break;
					case DATA_OBJECT_SHORT:
					case DATA_OBJECT_WORD:
					case DATA_OBJECT_USHORT:
						{
							rs->PutCollect((*epItr).c_str(), (WORD)ep->GetLongAttr(0));
						}
						break;
					case DATA_OBJECT_FLOAT:
					case DATA_OBJECT_LONG:
					case DATA_OBJECT_ULONG:
					case DATA_OBJECT_DWORD:
//.........这里部分代码省略.........
开发者ID:xiongshaogang,项目名称:mmo-resourse,代码行数:101,代码来源:RsMail.cpp


注:本文中的CEntityProperty::GetDbFlag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。