x***@gmail.com
2015-04-08 16:44:03 UTC
How did u solve the problem?
Hi there,
I have a problem with Recordset Bulk Fetching and if anyone can help it
would be greatly appreciated. The problem is that if I create a recordset
and read from it, if the field is null it seems to take the value from the
previous not_null row for that field. I am using :-
Visual C++ V5.0
A Microsoft Access 97 ODBC connection to an Access 97 table.
(I have also tried exporting the table to csv and using the Microsoft Text
Driver)
Here's part of my Code :-
CString CDynamicBulkSet::GetFieldValue(UINT nRow, UINT nCol)
{
LPSTR rgData = (LPSTR)m_ppvData[nCol];
CString str = (LPSTR)&rgData[nRow * MAX_TEXT_LEN];
str.TrimLeft(); str.TrimRight();
return str;
}
CDynamicBulkSet::CDynamicBulkSet(CDatabase* pdb)
: CBulkRecordsetMod(pdb)
{
m_nDefaultType = dynaset;
m_nAllocatedFields = 0;
m_ppvData = NULL;
m_ppvLengths = NULL;
}
void CDynamicBulkSet::DoBulkFieldExchange(CFieldExchange* pFX)
{
// Allocate the buffer
if (pFX->m_nOperation == CFieldExchange::AllocMultiRowBuffer &&
m_nAllocatedFields == 0)
{
m_nAllocatedFields = GetODBCFieldCount();
m_nFields = m_nAllocatedFields;
// Allocate buffers for data and field lengths
m_ppvData = new void*[m_nFields];
memset(m_ppvData, 0, sizeof(void*) * m_nFields);
m_ppvLengths = new void*[m_nFields];
memset(m_ppvLengths, 0, sizeof(void*) * m_nFields);
}
// Should never get to here without field buffer allocation
ASSERT(m_nAllocatedFields != 0);
pFX->SetFieldType(CFieldExchange::outputColumn);
for (int nNum = 0; nNum < (int)m_nFields; nNum++)
{
RFX_Text_Bulk(pFX, _T("Dummy"), (LPSTR*)&m_ppvData[nNum],
(long**)&m_ppvLengths[nNum], MAX_TEXT_LEN);
}
}
I have a problem with Recordset Bulk Fetching and if anyone can help it
would be greatly appreciated. The problem is that if I create a recordset
and read from it, if the field is null it seems to take the value from the
previous not_null row for that field. I am using :-
Visual C++ V5.0
A Microsoft Access 97 ODBC connection to an Access 97 table.
(I have also tried exporting the table to csv and using the Microsoft Text
Driver)
Here's part of my Code :-
CString CDynamicBulkSet::GetFieldValue(UINT nRow, UINT nCol)
{
LPSTR rgData = (LPSTR)m_ppvData[nCol];
CString str = (LPSTR)&rgData[nRow * MAX_TEXT_LEN];
str.TrimLeft(); str.TrimRight();
return str;
}
CDynamicBulkSet::CDynamicBulkSet(CDatabase* pdb)
: CBulkRecordsetMod(pdb)
{
m_nDefaultType = dynaset;
m_nAllocatedFields = 0;
m_ppvData = NULL;
m_ppvLengths = NULL;
}
void CDynamicBulkSet::DoBulkFieldExchange(CFieldExchange* pFX)
{
// Allocate the buffer
if (pFX->m_nOperation == CFieldExchange::AllocMultiRowBuffer &&
m_nAllocatedFields == 0)
{
m_nAllocatedFields = GetODBCFieldCount();
m_nFields = m_nAllocatedFields;
// Allocate buffers for data and field lengths
m_ppvData = new void*[m_nFields];
memset(m_ppvData, 0, sizeof(void*) * m_nFields);
m_ppvLengths = new void*[m_nFields];
memset(m_ppvLengths, 0, sizeof(void*) * m_nFields);
}
// Should never get to here without field buffer allocation
ASSERT(m_nAllocatedFields != 0);
pFX->SetFieldType(CFieldExchange::outputColumn);
for (int nNum = 0; nNum < (int)m_nFields; nNum++)
{
RFX_Text_Bulk(pFX, _T("Dummy"), (LPSTR*)&m_ppvData[nNum],
(long**)&m_ppvLengths[nNum], MAX_TEXT_LEN);
}
}