本文整理汇总了C++中CField::IsNull方法的典型用法代码示例。如果您正苦于以下问题:C++ CField::IsNull方法的具体用法?C++ CField::IsNull怎么用?C++ CField::IsNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CField
的用法示例。
在下文中一共展示了CField::IsNull方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildFieldValueList
/**
* Metodo para montar a lista de labels=valores para uso no
* no update, note bAllFields, permite levar os null's na query
*/
CString CTableBase::BuildFieldValueList(BOOL bAllFields, BOOL bNoKeyInSet)
{
CString s;
POSITION pos = m_mapFields.GetStartPosition();
CString sKey;
CField *pClass;
int counter = 0;
BOOL usefull = FALSE;
///Ll## STLOG_WRITE("Inicio CTableBase::BuildFieldValueList()");
while(pos != NULL)
{
m_mapFields.GetNextAssoc( pos, sKey, pClass );
// Naoadicionar as chaves no set xxxx='xxxx'
if(pClass->IsKey() && bNoKeyInSet)
continue;
if(!bAllFields) // Skipar os nulos !
{
if(!pClass->IsNull())
{
if(counter++ > 0)
s += _T(",\r\n");
usefull = TRUE;
//if(sKey.Find(' ') > 0)
s += _T("[") + sKey + _T("]=");
//else
// s += sKey + _T("=");
s += pClass->GetQueryFormatValue();
}
}
else // fazer assign mesmo dos nulos / nao preenchidos !!!
{
usefull = TRUE;
if(counter++ > 0)
s += _T(",\r\n");
//if(sKey.Find(' ') > 0)
s += _T("[") + sKey + _T("]=");
//else
// s += sKey + _T("=");
if(!pClass->IsNull())
s += pClass->GetQueryFormatValue();
else
s += _T("NULL");
}
}
//STLOG_WRITE(L"CTableBase::BuildFieldValueList: CAMPOS/VALORES: %s", s);
return s;
}
示例2: GetValueList
CString CTableBase::GetValueList(BOOL bUseNULL, BOOL bExport)
{
CString s = _T("");
// Recuperar a lista de campos pela ordenacao de
// importacao/Exportacao
POSITION p = m_fieldOrdered.GetHeadPosition();
CField *pField = NULL;
int counter = 0;
while(p != NULL)
{
CString sKey = m_fieldOrdered.GetNext(p);
VERIFY(m_mapFields.Lookup(sKey, pField));
if(counter++ > 0)
s += _T(",");
if(!pField->IsNull())
s += pField->GetQueryFormatValue();
else
{
// Se puder usar NULL ...
if(bUseNULL)
s += _T("NULL");
else
{
if(bExport)
{
if(pField->GetType() == CField::FIELD_TYPE_CURRENCY)
s += _T("");
else if(pField->GetType() == CField::FIELD_TYPE_NUMBER)
s += _T("");
else
s += _T("\"\"");
}
else
{
// Caso contrario, mandamos Zero para os numericos ...
if(pField->GetType() == CField::FIELD_TYPE_CURRENCY ||
pField->GetType() == CField::FIELD_TYPE_NUMBER)
{
s += _T("");
}
else // e vazio para os outros ...
s += _T("");
}
}
}
}
s += _T("\r\n");
return s;
}
示例3: PasteCol
/*
PasteCol 表名 源列名称 目标列名称
*/
bool TCManager::PasteCol(TCPacket &inP,AnaWord &aw, TCPacket &outP)
{
if (aw.GetWordCount() !=4)
return SetResultState(false,outP,GetLanguage(FormatIsError));
int nUserID = GetUserID(inP);
if (nUserID==0)
return SetResultState(false,outP,GetLanguage(UserIDIsNotFound));
string sTableName = aw.GetAt(1);
string sSrcName = aw.GetAt(2);
string sDstName = aw.GetAt(3);
CDataInterface *pDI = g_system.GetCurData(nUserID,aw.GetAt(1));
if (pDI == NULL)
return SetResultState(false,outP,GetLanguage(UserTableIsNotFound));
CField *pSrcField = pDI->FieldByName(sSrcName.c_str());
if (pSrcField == NULL)
return SetResultState(false,outP,GetLanguage(FieldNameNotFind));
CFieldType ft = pSrcField->GetFieldType();
CField *pDstField = pDI->FieldByName(sDstName.c_str());
if (pDstField == NULL)
{
pDstField = pDI->m_DataAccess.m_pFieldList->CreateField(ft);
pDstField->SetFieldName(sDstName);
pDstField->SetWidth(pSrcField->GetWidth());
pDI->m_DataAccess.m_pFieldList->Add(pDstField);
}
pDI->m_DataAccess.First();
while (!pDI->m_DataAccess.Eof())
{
pDI->m_DataAccess.Edit();
if (pSrcField->IsNull())
{
pDstField->SetNull();
}
else
{
if (ft == fDouble)
pDstField->SetAsDouble(pSrcField->GetAsDouble());
else if (ft == fInt)
pDstField->SetAsInteger(pSrcField->GetAsInteger());
else if (ft == fBoolean)
pDstField->SetAsBool(pSrcField->GetAsBool());
else if (ft == fString)
pDstField->SetAsString(pSrcField->GetAsString());
else
pDstField->SetAsDateTime(&pSrcField->GetAsDateTime());
}
pDI->m_DataAccess.Next();
}
return SetResultState(true,outP);
}
示例4: BuildValueList
/**
* Metodo para montar a lista de valores separados por
* virgula, tipico nos valores de uma query de insert
*/
CString CTableBase::BuildValueList()
{
CString s;
POSITION pos = m_mapFields.GetStartPosition();
CString sKey;
CField *pClass;
int counter = 0;
while(pos != NULL)
{
m_mapFields.GetNextAssoc( pos, sKey, pClass );
if(counter++ > 0)
s += _T(",\r\n");
if(!pClass->IsNull())
s += pClass->GetQueryFormatValue();
else
s += _T("NULL");
}
return s;
}
示例5: BuildWhereList
/**
* Metodo para montar a lista de label=valor para uso no
* where clause da query
*/
CString CTableBase::BuildWhereList(BOOL bOnlyKeys, BOOL bIgnoreNULL)
{
CString s(_T("WHERE "));
POSITION pos = m_mapFields.GetStartPosition();
CString sKey;
CField *pClass;
int counter = 0;
BOOL usefull = FALSE;
while(pos != NULL)
{
m_mapFields.GetNextAssoc( pos, sKey, pClass );
// Se o campo estiver na lista de ignore... nao usar ...
if(m_ignoreFields.Find(sKey) != NULL)
continue;
// Se nao for chave ...
if(bOnlyKeys && !pClass->IsKey())
continue;
if(!pClass->IsNull())
{
usefull = TRUE;
CString s1 = pClass->GetQueryFormatValue();
if(s1.CompareNoCase(_T("NULL")) == 0 ||
s1.CompareNoCase(_T("\"NULL\"")) == 0 )
{
if(!bIgnoreNULL)
{
if(counter++ > 0)
s += _T("\r\n AND ");
s += _T("[") + sKey + _T("] IS NULL");
}
}
else
{
if(counter++ > 0)
s += _T("\r\n AND ");
//if(sKey.Find(' ') > 0)
s += _T("[") + sKey + _T("]=");
//else
// s += sKey + _T("=");
s += s1;
}
}
else
{
if(!bIgnoreNULL)
{
if(counter++ > 0)
s += _T("\r\n AND ");
s += _T("[") + sKey + _T("] IS NULL");
}
}
}
if(!usefull)
return _T("");
return s;
}