我在 INT8 类型的 IBM Informix 数据库中有一个字段来保存 20 位数字。MSVC++(RFX 等效数据类型)中的等效数据类型应该是什么?我正在使用 Visual C++,我的 IDE 是 Visual Studio 6.0。
字段 initial_amount 将像这样声明:
RFX_Int64(pFX, _T("[initial_amount]"), m_initial_amount);
我已经为此编写了以下自定义 RFX 定义代码。但似乎有同样的问题。
void AFXAPI RFX_Int64(CFieldExchange* pFX, LPCTSTR szName, __int64& value)
{
ASSERT(AfxIsValidAddress(pFX, sizeof(CFieldExchange)));
ASSERT(AfxIsValidString(szName));
UINT nField;
if (!pFX->IsFieldType(&nField))
return;
LONG* plLength = pFX->m_prs->GetFieldLengthBuffer(nField - 1, pFX->m_nFieldType);
switch (pFX->m_nOperation)
{
case CFieldExchange::BindFieldToColumn:
{
#ifdef _DEBUG
// Assumes all bound fields BEFORE unbound fields
CODBCFieldInfo* pODBCInfo =
&pFX->m_prs->m_rgODBCFieldInfos[nField - 1];
if (pODBCInfo->m_nSQLType != SQL_C_DOUBLE &&
pODBCInfo->m_nSQLType != SQL_FLOAT)
{
// Warn of possible field schema mismatch
if (afxTraceFlags & traceDatabase)
TRACE1("Warning: double converted from SQL type %ld.\n",
pODBCInfo->m_nSQLType);
}
#endif
}
// fall through
default:
LDefault:
pFX->Default(szName, &value, plLength, SQL_BIGINT ,
sizeof(value), 22);
return;
case CFieldExchange::Fixup:
if (*plLength == SQL_NULL_DATA)
{
pFX->m_prs->SetNullFieldStatus(nField - 1);
value = afxDoublePseudoNull;
}
return;
case CFieldExchange::SetFieldNull:
if ((pFX->m_pvField == NULL &&
pFX->m_nFieldType == CFieldExchange::outputColumn) ||
pFX->m_pvField == &value)
{
if (pFX->m_bField)
{
pFX->m_prs->SetNullFieldStatus(nField - 1);
value = afxDoublePseudoNull;
*plLength = SQL_NULL_DATA;
}
else
{
pFX->m_prs->ClearNullFieldStatus(nField - 1);
*plLength = sizeof(value);
}
#ifdef _DEBUG
pFX->m_nFieldFound = nField;
#endif
}
return;
case CFieldExchange::MarkForAddNew:
// can force writing of psuedo-null value (as a non-null) by setting field dirty
if (value != afxDoublePseudoNull)
{
pFX->m_prs->SetDirtyFieldStatus(nField - 1);
pFX->m_prs->ClearNullFieldStatus(nField - 1);
}
return;
case CFieldExchange::MarkForUpdate:
if (value != afxDoublePseudoNull)
pFX->m_prs->ClearNullFieldStatus(nField - 1);
goto LDefault;
case CFieldExchange::AllocCache:
{
CFieldInfo* pInfo = &pFX->m_prs->m_rgFieldInfos[nField - 1];
pInfo->m_pvDataCache = new __int64;
pInfo->m_nDataType = AFX_RFX_DOUBLE;
}
return;
#ifdef _DEBUG
// case CFieldExchange::DumpField:
// {
// *pFX->m_pdcDump << "\n" << szName << " = " << value;
// }
return;
#endif //_DEBUG
}
}
此代码适用于 Visual C++ 6.0 吗?如果没有,那我该怎么办?