ISimpleList Creates an array of variants that supports enumeration

Author Message
education

  • Total Posts : 4
  • Scores: 0
  • Reward points : 0
  • Joined: 7/13/2009
  • Status: offline
ISimpleList Creates an array of variants that supports enumeration Wednesday, July 15, 2009 7:17 AM (permalink)
0
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>
 
#1

    Online Bookmarks Sharing: Share/Bookmark

    Jump to:

    Current active users

    There are 0 members and 1 guests.

    Icon Legend and Permission

    • New Messages
    • No New Messages
    • Hot Topic w/ New Messages
    • Hot Topic w/o New Messages
    • Locked w/ New Messages
    • Locked w/o New Messages
    • Read Message
    • Post New Thread
    • Reply to message
    • Post New Poll
    • Submit Vote
    • Post reward post
    • Delete my own posts
    • Delete my own threads
    • Rate post

    2000-2012 ASPPlayground.NET Forum Version 3.9