本文整理汇总了C++中CField::SetFromField方法的典型用法代码示例。如果您正苦于以下问题:C++ CField::SetFromField方法的具体用法?C++ CField::SetFromField怎么用?C++ CField::SetFromField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CField
的用法示例。
在下文中一共展示了CField::SetFromField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
uint32 CRdbTable::Update(CDataTable::CIterator& oIt, CRecord* pRecord, CSqlParameter* pSetAttr,
CRecordSet* pRollBack, uint32* pModifiedCount,
bool bNeedDetach, CSqlFilter& oFilter)
{
if(pRollBack && pModifiedCount[0] >= pRollBack->GetRecordCount())
return 1;//Roll back lack;
CKernelIndexItem& oKernelItem = *oIt.GetValue();
CRdbRecord oDbRecord(m_pTableSpace, m_pTabDef, &oKernelItem);
CRecord& oSetRecord = pSetAttr->m_oRecord;
uint32 nSetCount = pSetAttr->m_nParaCount;
CRecord* pRollRecord = NULL;
if(pRollBack)
{
pRollRecord = pRollBack->GetRecord(pModifiedCount[0]);
pRollRecord->SetRowId(oKernelItem.nRowId);
}
if(bNeedDetach)
{
for(uint32 i=0; i<m_nIndexCount; ++i)
{
CAbstractIndex* pIndex = m_pIndexTable[i];
if(!pIndex)
continue;
CIndexDefine* pIndexDefine = pIndex->m_pIdxDef;
uint32 nQualifier = pIndexDefine->m_pBaseAttr->nQualifier;
uint32 j, nFieldCount = pIndexDefine->m_nFieldCount;
CSqlParameterSet* pCond = NULL;
CSqlParameter* pCondPara = NULL;
CRecord* pCondRecord = NULL;
if(nQualifier == RDB_UNIQUE_INDEX)
{
pCond = new CSqlParameterSet(m_pTabDef);
pCondPara = (CSqlParameter*)pCond->AddPara();
pCondRecord = &pCondPara->m_oRecord;
}
pIndex->DetachRecord(pRecord);
for(j=0; j<nFieldCount; ++j)
{
uint32 nFieldNo = pIndexDefine->m_pFields[j];
CField* pOrigValue = pRecord->GetField(nFieldNo);
if(pRollRecord)
pRollRecord->GetField(nFieldNo)->SetFromField(pOrigValue);
if(IS_SET_FIELD(pSetAttr, nFieldNo))
{
CField* pSetValue = oSetRecord.GetField(nFieldNo);
if(pCond)
{
pCondPara->SetField(nFieldNo, RDB_SQLPARA_OPERATOR_EQUAL);
pCondRecord->GetField(nFieldNo)->SetFromField(pSetValue);
}
pOrigValue->SetFromField(pSetValue);
}
else if(pCond)
{
pCondPara->SetField(nFieldNo, RDB_SQLPARA_OPERATOR_EQUAL);
pCondRecord->GetField(nFieldNo)->SetFromField(pOrigValue);
}
}
if(pCond)
{
uint32 bExist = 0;
pIndex->Exist(pCond, bExist);
if(bExist)
{
pIndex->AttachRecord(pRollRecord);
RollBack(oDbRecord, pRollBack, pModifiedCount[0], i, oFilter, pSetAttr);
return 1;
}
}
pIndex->AttachRecord(pRecord);
}
}
for(uint32 i=0; i<nSetCount; ++i)
{
uint32 nOperator, nFieldNo;
pSetAttr->GetPara(i, &nOperator, &nFieldNo);
CRdbField* pRdbField = oDbRecord.GetField(nFieldNo);
if(pRollRecord && !IS_SET_FIELD0(oFilter, nFieldNo))
pRdbField->GetField(pRollRecord->GetField(nFieldNo));
pRdbField->SetField(oSetRecord.GetField(nFieldNo));
}
return 0;
}