How to reuse an Accessor to prevent a copy???
Scott Prugh <[email protected]> Thu, 8 Aug 2002 15:33:42 -0500
| Newsgroups | gmane.comp.windows.devel.oledb.devel |
|---|---|
| Message-ID | <2BBF7645639105478C9392FB5F34046EAECC4E@tlnchi-intmail1.telution.net> |
I have an accessor:
class CMyAccessor
{
public:
LONG m_data;
BEGIN_COLUMN_MAP(CMyAccessor)
COLUMN_ENTRY(1, m_data)
END_COLUMN_MAP()
};
class CMyLoader : public CTable<CAccessor<CMyAccessor>, CRowsetFastLoad
>=09
{
public:
HRESULT Open(const char* server,const char* database,const char*
user,const char* pwd)
{
}
...
};
NOTE: CRowsetFastLoad enables bulk insert and is at the bottom.
So, what I am trying to is simple. I would like to process incoming
data on one thread. Copy it into a CMyAccessor and post it to another
thread which uses CMyLoader to insert the data....
How do I do this without copying the data from the raw CMyAccessor to
the CMyLoader? Is there a "placement" insert? In other words, can I
call insert giving it a new accessor so I can prevent the copy???
Thanks,
Scott
class CRowsetFastLoad :
public CRowset
{
...
HRESULT Insert(int nAccessor =3D 0, bool bGetHRow =3D false)
{
ATLASSERT(m_pAccessor !=3D NULL);
HRESULT hr;
if (m_spRowsetFast !=3D NULL)
{
HROW* pHRow;
if (bGetHRow)
{
ReleaseRows();
pHRow =3D &m_hRow;
}
else
pHRow =3D NULL;
hr =3D
m_spRowsetFast->InsertRow(m_pAccessor->GetHAccessor(nAccessor),m_pAccess
or->GetBuffer());
}
else
hr =3D E_NOINTERFACE;
return hr;
}
HRESULT Commit(BOOL done)
{
return m_spRowsetFast->Commit(done);
}
CComPtr<IRowsetFastLoad> m_spRowsetFast;
};=20
You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.