I've a puzzling problem: I open (TRRuleRS->Open(1, Query) a recordset through the CRecordset open method inside a for cycle. I run it successfully lots of times with always same data, but sometimes, absolutely randomly and unpredictably, it throws an exception inside the following piece of MFC code:
.\VC98\MFC\SRC\DBRFX.CPP
void AFXAPI RFX_Long(CFieldExchange* pFX, LPCTSTR szName, long& value)
{
...
#ifdef _DEBUG
// Assumes all bound fields BEFORE unbound fields
CODBCFieldInfo* pODBCInfo = &pFX->m_prs->m_rgODBCFieldInfos[nField - 1];
/*line 1200*/if (pODBCInfo->m_nSQLType != SQL_C_LONG)
{
// Warn of possible field schema mismatch
if (afxTraceFlags & traceDatabase)
TRACE1("Warning: long converted from SQL type %ld.\n",
pODBCInfo->m_nSQLType);
}
#endif // _DEBUG
...
}
In the debug environment i find the cursor stuck at line 1200, where it throws an exception becouse pODBCInfo->m_nSQLType is unknown. In fact the local variables watch windows says pODBCInfo->m_nSQLType CXX0030: Error: expression cannot be evaluated.
pFX->m_prs has its regular value, it points to a class inherithed from the CRecordset base class, and here is pFX->m_prs->m_strSQL:
SELECT "IntStartStop".TypeID FROM "TarIntComb", "IntStartStop" WHERE "TarIntComb".pkID IN (SELECT IntCombID FROM "TarRuleItem" WHERE TarRuleID = 1 AND RuleElemID = 1 AND TariffID = 29) AND ("TarIntComb".IntStartID = "IntStartStop".PkID OR "TarIntComb".IntStopID = "IntStartStop".PkID) AND "IntStartStop".TypeID = 1
(Where double quotes are for Oracle compatibility).
Does anybody know of such strange happenings? Could it be due to the complex query form. Or is it simply a bug introduced by the debugger, that will be no more shown up compiling the application?
Thanks a lot.
Max.
.\VC98\MFC\SRC\DBRFX.CPP
void AFXAPI RFX_Long(CFieldExchange* pFX, LPCTSTR szName, long& value)
{
...
#ifdef _DEBUG
// Assumes all bound fields BEFORE unbound fields
CODBCFieldInfo* pODBCInfo = &pFX->m_prs->m_rgODBCFieldInfos[nField - 1];
/*line 1200*/if (pODBCInfo->m_nSQLType != SQL_C_LONG)
{
// Warn of possible field schema mismatch
if (afxTraceFlags & traceDatabase)
TRACE1("Warning: long converted from SQL type %ld.\n",
pODBCInfo->m_nSQLType);
}
#endif // _DEBUG
...
}
In the debug environment i find the cursor stuck at line 1200, where it throws an exception becouse pODBCInfo->m_nSQLType is unknown. In fact the local variables watch windows says pODBCInfo->m_nSQLType CXX0030: Error: expression cannot be evaluated.
pFX->m_prs has its regular value, it points to a class inherithed from the CRecordset base class, and here is pFX->m_prs->m_strSQL:
SELECT "IntStartStop".TypeID FROM "TarIntComb", "IntStartStop" WHERE "TarIntComb".pkID IN (SELECT IntCombID FROM "TarRuleItem" WHERE TarRuleID = 1 AND RuleElemID = 1 AND TariffID = 29) AND ("TarIntComb".IntStartID = "IntStartStop".PkID OR "TarIntComb".IntStopID = "IntStartStop".PkID) AND "IntStartStop".TypeID = 1
(Where double quotes are for Oracle compatibility).
Does anybody know of such strange happenings? Could it be due to the complex query form. Or is it simply a bug introduced by the debugger, that will be no more shown up compiling the application?
Thanks a lot.
Max.