void GetNumericFieldValue(CRecordset &rs, int nIndex, CString &strValue)
{
// Special GetFieldValue function for Microsoft Oracle driver to handle UNIONs.
nIndex++;
#ifndef _UNICODE
CString& strData = strValue;
#else
CString strProxy;
CString& strData = strProxy;
#endif
// Specify max length for buffer - add 3 for null, sign, and decimal.
const int nLen = 38+3;
void* pvData = strData.GetBufferSetLength(nLen);
// Now can actually get the data.
long nActualSize = rs.GetData(rs.m_pDatabase, rs.m_hstmt, nIndex,
SQL_C_CHAR, pvData, nLen,
rs.m_rgODBCFieldInfos[nIndex - 1].m_nSQLType);
// Handle NULL data separately.
if (nActualSize == SQL_NULL_DATA)
{
// Clear value.
strValue.Empty();
}
else
{
// May need to clean up and call SQLGetData again if necessary.
rs.GetLongCharDataAndCleanup(rs.m_pDatabase, rs.m_hstmt, nIndex,
nActualSize, &pvData, nLen, strData,
rs.m_rgODBCFieldInfos[nIndex - 1].m_nSQLType);
#ifdef _UNICODE
// Now must convert string to Unicode.
strValue = (LPCSTR)strData.GetBuffer(0);
#endif // _UNIOCDE
}
}