Discussion:
Nulls in Recordsets
(too old to reply)
x***@gmail.com
2015-04-08 16:44:03 UTC
Permalink
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);
}
}
Cholo Lennon
2015-04-08 17:19:19 UTC
Permalink
Post by x***@gmail.com
How did u solve the problem?
The post is 16 years old (VC++5!, Access 97!). Maybe the author is
retired...
Post by x***@gmail.com
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);
}
}
--
Cholo Lennon
Bs.As.
ARG
R.Wieser
2015-04-08 17:30:43 UTC
Permalink
xiongqr (?),

Thats one mighty necro-bump you did there. :-)

Look at the date of the post you responding to. Thats about 15 *years* ago.
Not much chance that Lachlan is still visiting these newsgroups, much less
that he even remembers what it was about.

And most likely the software the question was about and the computer it was
running on where discarded at least a decade ago.

Regards,
Rudy Wieser
Post by x***@gmail.com
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 :-
[Snip]

Continue reading on narkive:
Loading...