My vbscript is using Microsoft Commerce Server 2000 COM objects
I want to stop using Microsoft Commerce Server 2000 so I can update my database to SQL Server 2008
The current flow is like this
IContent -> IDatasource -> ISimpleList
ISimpleList Implementation is a CSimpleList
Code example:
simplelist = datasource.execute("SELECT * FROM Users")
userName = simplelist.username
The flow I want is
ADO Command -> ADO Recordset
I want to make this happen without changing the code that calls the execute and how the columns are referenced. I want to make a facade. I have a good idea of how to do that.
I understand I need to use a COM object to do this.
I'm not sure how to do late binding... object.rowName or object(columnNum).rowName Do I override the "." operator? How would that work?
Where is a better place to ask these questions?
Here is how the CSimpleList header looks:
/////////////////////////////////////////////////////////////////////////////
// CSimpleList (simple/small subset of CList)
class CSimpleList
{
public:
CSimpleList(int nNextOffset = 0);
void Construct(int nNextOffset);
// Operations
BOOL IsEmpty() const;
void AddHead(void* p);
void RemoveAll();
void* GetHead() const;
void* GetNext(void* p) const;
BOOL Remove(void* p);
// Implementation
void* m_pHead;
size_t m_nNextOffset;
void** GetNextPtr(void* p) const; // somewhat trusting...
};
AFX_INLINE CSimpleList::CSimpleList(int nNextOffset)
{ m_pHead = NULL; m_nNextOffset = nNextOffset; }
AFX_INLINE void CSimpleList::Construct(int nNextOffset)
{ ASSERT(m_pHead == NULL); m_nNextOffset = nNextOffset; }
AFX_INLINE BOOL CSimpleList::IsEmpty() const
{ return m_pHead == NULL; }
AFX_INLINE void** CSimpleList::GetNextPtr(void* p) const
{ ASSERT(p != NULL); return (void**)((BYTE*)p+m_nNextOffset); }
AFX_INLINE void CSimpleList::RemoveAll()
{ m_pHead = NULL; }
AFX_INLINE void* CSimpleList::GetHead() const
{ return m_pHead; }
AFX_INLINE void* CSimpleList::GetNext(void* prevElement) const
{ return *GetNextPtr(prevElement); }
template<class TYPE>
class CTypedSimpleList : public CSimpleList
{
public:
CTypedSimpleList(int nNextOffset = 0)
: CSimpleList(nNextOffset) { }
void AddHead(TYPE p)
{ CSimpleList::AddHead(p); }
TYPE GetHead()
{ return (TYPE)CSimpleList::GetHead(); }
TYPE GetNext(TYPE p)
{ return (TYPE)CSimpleList::GetNext(p); }
BOOL Remove(TYPE p)
{ return CSimpleList::Remove((TYPE)p); }
operator TYPE()
{ return (TYPE)CSimpleList::GetHead(); }
};
<message edited by education on Wednesday, July 15, 2009 7:20 AM>