Re: AW: [OLEDB_DEV] OLE DB Consumer Templates

Erik Valdes <[email protected]> Thu, 9 Jan 2003 14:35:22 -0700
Newsgroups gmane.comp.windows.devel.oledb.devel
Message-ID <[email protected]>
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C2B827.03777170
Content-Type: text/plain

Hi Peter,



The phrase "could serialize the DOM directly into the DB using OLE DB" is
where the mystery lies for me.



In my SP, I need to do a fairly standard thing (@WRXML is my ntext
parameter):



DECLARE @idoc int  -- XML Document handle

-- Prepare the XML

EXEC sp_xml_preparedocument @idoc OUTPUT, @WRXML



I'm using ATL/OLEDB because that's what I'm familiar with.  I'm well versed
in how to set up accessors that bind string variables to char, varchar, etc
parameters in SQL.  However, I've never had a variable/parameter before with
a length that is undetermined at compile time.   Yes, in the code that
creates the XML, I could use objects that expose streaming interfaces (Like
MSXML) .  However, what I don't understand is the missing piece in between
streaming something from MSXML (or .NET, etc) and receiving it as a
parameter in a SQL Stored Procedure.



Thanks,

Erik





-----Original Message-----
From: Peter Moss [mailto:[email protected]]
Sent: Thursday, January 09, 2003 2:14 PM
To: [email protected]
Subject: Re: [OLEDB_DEV] AW: [OLEDB_DEV] OLE DB Consumer Templates



Since we're talking about memory usage, can we back up 1 minute and ask Erik
what is the source of the XML data?  Is it from a DOM, say implemented using
MSXML (or for that matter any object that exposes IStream for
serialization)?  If so, you might also look into the fact that the DOM
exposes IStream* so you could serialize the DOM directly into the DB using
OLE DB.



If this is the case, I am sure that I and others have done this in the past
and could supply examples. If your XML source is just in a string somewhere,
then proceed along the lines you are proceeding now.



Peter

-----Original Message-----
From: OLEDB_DEV [mailto:[email protected]]On Behalf Of Erik
Valdes
Sent: Thursday, January 09, 2003 4:05 PM
To: [email protected]
Subject: Re: [OLEDB_DEV] AW: [OLEDB_DEV] OLE DB Consumer Templates

Hi Duncan,



You've gone one step further than I expected.  I'm not sure I understand the
relevance of who owns the memory.  However, I had not tried using
DBTYPE_BYREF at all so that is something I need to try.  Why is the memory
owner important for this issue?



Thanks,

Erik



-----Original Message-----
From: Duncan Smith [mailto:[email protected]]
Sent: Thursday, January 09, 2003 1:21 PM
To: [email protected]
Subject: Re: [OLEDB_DEV] AW: [OLEDB_DEV] OLE DB Consumer Templates



I encountered this exact issue. I wanted to pass a string buffer containing
XML data to the provider using client-owned memory. The OLE DB data type I
use is DBTYPE_STR | DBTYPE_BYREF. Using the standard OLE DB consumer
template macros will result in this being provider-owned memory (see
CAccessorBase::Bind in atldbcli.h). So I created my own CAccessorBase type
class (called CAccessorBaseEx below) with 2 static methods and created my
own bind macro as follows:



// This macro is to be used in place of _COLUMN_ENTRY_CODE (in atldbcli.h)
for a parameter or

// column whose type has the DBTYPE_BYREF bit set. CAccessorBase::Bind
always sets dwMemOwner

// to DBMEMOWNER_PROVIDEROWNED if the DBTYPE_BYREF bit set. This macro
changes that behavior by

// setting dwMemOwner to the value passed as the last macro parameter.

// Use COLUMN_ENTRY_EX_BYREF instead of COLUMN_ENTRY_EX (in atldbcli.h) for
DBTYPE_BYREF entries.

#define _COLUMN_ENTRY_CODE_BYREF(nOrdinal, wType, nLength, nPrecision,
nScale, dataOffset, lengthOffset, statusOffset, dwMemOwner) \

      if (pBuffer != NULL) \

      { \

            if (!bClearOnly) \

                  CAccessorBaseEx::FreeType(wType, pBuffer + dataOffset,
dwMemOwner); \

            memset(pBuffer + dataOffset, 0, nLength); \

      } \

      else if (pBinding != NULL) \

      { \

            ATLASSERT( pColumnNames != NULL ); \

            *pColumnNames = NULL; \

            CAccessorBaseEx::Bind(pBinding, nOrdinal, wType, nLength,
nPrecision, nScale, eParamIO, \

                  dataOffset, lengthOffset, statusOffset, NULL, dwMemOwner);
\

            pColumnNames++; \

            pBinding++; \

      } \

      nColumns++;



#define COLUMN_ENTRY_EX_BYREF(nOrdinal, wType, nLength, nPrecision, nScale,
data, length, status, dwMemOwner) \

      _COLUMN_ENTRY_CODE_BYREF(nOrdinal, wType, nLength, nPrecision, nScale,
offsetbuf(data), offsetbuf(length), offsetbuf(status), dwMemOwner)





class CAccessorBaseEx

{

public:

      static void Bind(DBBINDING* pBinding, ULONG nOrdinal, DBTYPE wType,

            ULONG nLength, BYTE nPrecision, BYTE nScale, DBPARAMIO eParamIO,

            ULONG nDataOffset, ULONG nLengthOffset = NULL, ULONG
nStatusOffset = NULL,

            DBOBJECT* pdbobject = NULL, DBMEMOWNER dwMemOwner =
DBMEMOWNER_CLIENTOWNED) throw()

      {

            ATL::CAccessorBase::Bind(

                  pBinding,

                  nOrdinal,

                  wType,

                  nLength,

                  nPrecision,

                  nScale,

                  eParamIO,

                  nDataOffset,

                  nLengthOffset,

                  nStatusOffset,

                  pdbobject);



            pBinding->dwMemOwner = dwMemOwner;

      }



      static inline void FreeType(DBTYPE wType, BYTE* pValue, DBMEMOWNER
dwMemOwner) throw()

      {

            if ((wType & DBTYPE_BYREF) && (dwMemOwner ==
DBMEMOWNER_CLIENTOWNED))

            {

                  void * pData = *(void **)pValue;



                  if (pData != NULL)

                        CoTaskMemFree(pData);

            }

            else

                  ATL::CAccessorBase::FreeType(wType, pValue);

      }

};



Then the accessor I used has the following (the SQL Server data type I am
using is text):



      char *      m_pszData;

      DBLENGTH    m_DataLength;

      DBSTATUS    m_DataStatus;

...

COLUMN_ENTRY_EX_BYREF(5, DBTYPE_STR | DBTYPE_BYREF, sizeof(char *), 0, 0,
m_pszData, m_DataLength, m_DataStatus, DBMEMOWNER_CLIENTOWNED)



Hope this helps.

Duncan Smith





-----Original Message-----
From: Erik Valdes [mailto:[email protected]]
Sent: Thursday, January 09, 2003 1:17 PM
To: [email protected]
Subject: Re: [OLEDB_DEV] AW: [OLEDB_DEV] OLE DB Consumer Templates



Hi,

I see what you mean about MS recommending the storage object way.  I've
found a lot of articles describing that.  However, I'm having trouble
finding anything that gives an example of how to do the in-memory way.
Perhaps someone could point me to an example or a how-to document?  I'd
really appreciate it.

Thanks,
Erik

-----Original Message-----
From: Yuancai Ye [mailto:[email protected] <mailto:[email protected]> ]
Sent: Thursday, January 09, 2003 9:57 AM
To: [email protected]
Subject: Re: [OLEDB_DEV] AW: [OLEDB_DEV] OLE DB Consumer Templates

Hi,
    MS recommends us to use storage object for sending
a BLOB into a data source. However, as I tested, this
way is bad in many cases since your code needs to
create a store object and database needs to recover
binnary data from the store object. You'd better use
in-memory way to send BLOB for faster speed. With use
of in-memory way, the previous two extra steps are
avoided. Therefore, in-memory way is faster. That is
my guess. Test it yourself.

Regards,

Yuancai (Charlie) Ye

--- Rudolf Wiener <[email protected]> wrote:
> Erik,
>
> For reading and writing blobs, which is what you're
> in fact using, I use the
> technologies recommended and stream the data with a
> storage object. The
> macro I use in the accessor is
> BLOB_ENTRY_LENGTH_STATUS. I'm not sure if
> this is the best way to do it because I have the
> impression it slows things
> down a bit. But I haven't had the time yet to look
> into faster alternatives.
>
> If you like I can send you excerpts from my app's
> code.
>
> Regards
> Rudi
>
>   -----Urspr&#40689;gliche Nachricht-----
>   Von: OLEDB_DEV
> [mailto:[email protected]
<mailto:[email protected]> ]Im Auftrag von
> Erik
> Valdes
>   Gesendet: Donnerstag, 09. J&#37592;ner 2003 17:22
>   An: [email protected]
>   Betreff: Re: [OLEDB_DEV] OLE DB Consumer Templates
>
>
>   The reason I can't allocate on the stack is that
> my variable can be any
> length.  It essentially boils down to the string
> representation of an xml
> file.  That file can be any size.  When I pass it to
> my SP, the sp's
> parameter is ntext (to allow for any size).   What
> do people do when they
> want to pass XML of unknown length to a SQL Server
> stored procedure?
>
>
>
>   -----Original Message-----
>   From: Peter Moss [mailto:[email protected] <mailto:[email protected]> ]
>   Sent: Thursday, January 09, 2003 7:58 AM
>   To: [email protected]
>   Subject: Re: [OLEDB_DEV] OLE DB Consumer Templates
>
>
>
>   If I remember right, you can't use the macros for
> heap-allocated
> variables.  If you dig into the macro definitions, I
> believe you will find
> that pointers offset from the beginning of 'this'
> are used.  Thus, a
> heap-allocated variable like m_WorkRequest will not
> work.
>
>
>
>   Why can't you just allocate a TCHAR on the stack
> frame of the object, ie,
>
>
>
>   TCHAR m_WorkRequest[257];     // Or 1 + the size
> of your SP parameter size
>
>
>
>   Then you can just use COLUMN_ENTRY.
>
>
>
>   HTH,
>
>   Peter
>
>     -----Original Message-----
>     From: OLEDB_DEV
> [mailto:[email protected]
<mailto:[email protected]> ]On Behalf Of
> Erik
> Valdes
>     Sent: Wednesday, January 08, 2003 5:22 PM
>     To: [email protected]
>     Subject: [OLEDB_DEV] OLE DB Consumer Templates
>
>     I'm having trouble implementing an accessor.
> I'm trying to use a
> variable (m_WorkRequest) that's dynamically
> allocated as the variable that's
> bound to a parameter in my accessor (commented line
> below).   The reason I
> need it to be dynamic is that it is XML and can be
> any length.  The stored
> proc's parameter is of ntext type to handle the
> variable length.  However, I
> don't know at compile time how big to make the
> buffer for my parameter in my
> accessor.  What's the proper way to do this?  I've
> tried COLUMN_ENTRY
> (access violation), COLUMN_ENTRY_LENGTH (different
> variations produce
> different errors, but basically I can't set the
> length),
> COLUMN_ENTRY_TYPE_SIZE (similar problems as the
> previous).  I'm running out
> of ideas now.  The code below is just one of many,
> many variations I've
> tried.
>
>
>
>
>
>     class CAddWorkRequest
>
>     {
>
>     public:
>
>        CAddWorkRequest() STD_INIT
>
>        ~CAddWorkRequest()
>
>        {
>
>           if (m_WorkRequest)
>
>              delete [] m_WorkRequest;
>
>        }
>
>        LONG m_RETURNVALUE;
>
>        LPTSTR m_WorkRequest;
>
>        LONG m_lLength;
>
>
>
>        void SetStringParam(LPCTSTR szString,int
> cBytes)
>
>        {
>
>           m_WorkRequest = (LPTSTR) new
> TCHAR[cBytes];
>
>           _tcsncpy(m_WorkRequest,szString,cBytes);
>
>           m_lLength = _tcslen(m_WorkRequest);
>
>        })
>
>
>
>     BEGIN_PARAM_MAP(CAddWorkRequest)
>
>        SET_PARAM_TYPE(DBPARAMIO_OUTPUT)
>
>        COLUMN_ENTRY(1, m_RETURNVALUE)
>
>        SET_PARAM_TYPE(DBPARAMIO_INPUT)
>
>     //
>
COLUMN_ENTRY_TYPE_SIZE(2,DBTYPE_STR,_tcslen(m_WorkRequest),
> m_WorkRequest)
>
>
>
>
>
>     END_PARAM_MAP()
>
>
>
>     DEFINE_COMMAND(CAddWorkRequest, _T("{ ? = CALL
> dbo.AddWorkRequest;1
> (?) }"))
>
>
>
>     };
>
>
>
>     class CAddWorkRequestCommand : public
> CBsDbCommand<CAddWorkRequest>
>
>     {
>
>     };
>
>
>
>     foo (LPTSTR szWor)
>
>     {
>
>
=== message truncated ===



__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com <http://mailplus.yahoo.com>

You can read messages from the OLEDB_DEV archive, unsubscribe from
OLEDB_DEV,
or subscribe to other DevelopMentor lists at http://discuss.develop.com
<http://discuss.develop.com> .

You can read messages from the OLEDB_DEV archive, unsubscribe from
OLEDB_DEV, or subscribe to other DevelopMentor lists at
http://discuss.develop.com. You can read messages from the OLEDB_DEV
archive, unsubscribe from OLEDB_DEV, or subscribe to other DevelopMentor
lists at You can read messages from the OLEDB_DEV archive, unsubscribe from
OLEDB_DEV, or subscribe to other DevelopMentor lists at
http://discuss.develop.com. http://discuss.develop.com.

You can read messages from the OLEDB_DEV archive, unsubscribe from
OLEDB_DEV, or subscribe to other DevelopMentor lists at
http://discuss.develop.com.

You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

------_=_NextPart_001_01C2B827.03777170
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">


<meta name=Generator content="Microsoft Word 10 (filtered)">
<title>RE: [OLEDB_DEV] AW: [OLEDB_DEV] OLE DB Consumer Templates</title>

<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Helvetica;
        panose-1:2 11 5 4 2 2 2 2 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {margin-right:0in;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.emailstyle18
        {font-family:Arial;
        color:navy;}
span.emailstyle19
        {font-family:Arial;
        color:navy;}
span.EmailStyle20
        {font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=blue>

<div class=Section1>

<p class=MsoNormal><font size=2 color=blue face=Helvetica><span
style='font-size:10.0pt;font-family:Helvetica;color:blue'>Hi Peter,</span></font></p>

<p class=MsoNormal><font size=2 color=blue face=Helvetica><span
style='font-size:10.0pt;font-family:Helvetica;color:blue'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=blue face=Helvetica><span
style='font-size:10.0pt;font-family:Helvetica;color:blue'>The phrase "could
serialize the DOM directly into the DB using OLE DB" is where the mystery
lies for me.&nbsp; </span></font></p>

<p class=MsoNormal><font size=2 color=blue face=Helvetica><span
style='font-size:10.0pt;font-family:Helvetica;color:blue'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=blue face=Helvetica><span
style='font-size:10.0pt;font-family:Helvetica;color:blue'>In my SP, I need to
do a fairly standard thing (@WRXML is my ntext parameter):</span></font></p>

<p class=MsoNormal><font size=2 color=blue face=Helvetica><span
style='font-size:10.0pt;font-family:Helvetica;color:blue'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=blue face=Helvetica><span
style='font-size:10.0pt;font-family:Helvetica;color:blue'>DECLARE @idoc int&nbsp;
-- XML Document handle</span></font></p>

<p class=MsoNormal><font size=2 color=blue face=Helvetica><span
style='font-size:10.0pt;font-family:Helvetica;color:blue'>-- Prepare the XML</span></font></p>

<p class=MsoNormal><font size=2 color=blue face=Helvetica><span
style='font-size:10.0pt;font-family:Helvetica;color:blue'>EXEC sp_xml_preparedocument
@idoc OUTPUT, @WRXML</span></font></p>

<p class=MsoNormal><font size=2 color=blue face=Helvetica><span
style='font-size:10.0pt;font-family:Helvetica;color:blue'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=blue face=Helvetica><span
style='font-size:10.0pt;font-family:Helvetica;color:blue'>I'm using
ATL/OLEDB because that's what I'm familiar with.&nbsp; I'm
well versed in how to set up accessors that bind string variables to char, varchar,
etc parameters in SQL.&nbsp; However, I've never had a variable/parameter
before with a length that is undetermined at compile time.&nbsp; &nbsp;Yes, in
the code that creates the XML, I could use objects that expose streaming
interfaces (Like MSXML) . &nbsp;However, what I don't understand is the
missing piece in between streaming something from MSXML (or .NET, etc) and
receiving it as a parameter in a SQL Stored Procedure.</span></font></p>

<p class=MsoNormal><font size=2 color=blue face=Helvetica><span
style='font-size:10.0pt;font-family:Helvetica;color:blue'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=blue face=Helvetica><span
style='font-size:10.0pt;font-family:Helvetica;color:blue'>Thanks,</span></font></p>

<p class=MsoNormal><font size=2 color=blue face=Helvetica><span
style='font-size:10.0pt;font-family:Helvetica;color:blue'>Erik</span></font></p>

<p class=MsoNormal><font size=2 color="#00ccff" face=Helvetica><span
style='font-size:10.0pt;font-family:Helvetica;color:#00CCFF'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color="#00ccff" face=Helvetica><span
style='font-size:10.0pt;font-family:Helvetica;color:#00CCFF'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>-----Original Message-----<br>
<b><span style='font-weight:bold'>From:</span></b> Peter Moss
[mailto:[email protected]] <br>
<b><span style='font-weight:bold'>Sent:</span></b> </span></font><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Thursday,
 January 09, 2003</span></font><font size=2 face=Tahoma><span style='font-size:
10.0pt;font-family:Tahoma'> </span></font><font size=2 face=Tahoma><span
 style='font-size:10.0pt;font-family:Tahoma'>2:14 PM</span></font><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'><br>
<b><span style='font-weight:bold'>To:</span></b> [email protected]<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [OLEDB_DEV] AW:
[OLEDB_DEV] OLE DB Consumer Templates</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<div>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=blue face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:blue'>Since we're talking about
memory usage, can we back up 1 minute and ask Erik what is the source of the
XML data?&nbsp; Is it from a DOM, say implemented using MSXML (or for that
matter any object that exposes IStream for serialization)? &nbsp;If so, you
might also look into the fact that the DOM exposes IStream* so you could
serialize the DOM directly into the DB using OLE DB.</span></font></p>

</div>

<div>

<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

</div>

<div>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=blue face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:blue'>If this is the case, I am
sure that I and others have done this in the past and could supply examples. If
your XML source is just in a string somewhere, then proceed along the lines you
are proceeding now.</span></font></p>

</div>

<div>

<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

</div>

<div>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=blue face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:blue'>Peter</span></font></p>

</div>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'>

<p class=MsoNormal style='margin-right:0in;margin-bottom:12.0pt;margin-left:
.5in'><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>-----Original
Message-----<br>
<b><span style='font-weight:bold'>From:</span></b> OLEDB_DEV
[mailto:[email protected]]<b><span style='font-weight:bold'>On
Behalf Of </span></b>Erik Valdes<br>
<b><span style='font-weight:bold'>Sent:</span></b> Thursday, January 09, 2003
4:05 PM<br>
<b><span style='font-weight:bold'>To:</span></b> [email protected]<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [OLEDB_DEV] AW:
[OLEDB_DEV] OLE DB Consumer Templates</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=navy face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:navy'>Hi Duncan, </span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=navy face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:navy'>You've gone one step
further than I expected.&nbsp; I'm not sure I understand the relevance of who
owns the memory. &nbsp;However, I had not tried using DBTYPE_BYREF at all so
that is something I need to try.&nbsp; Why is the memory owner important for
this issue?</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=navy face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:navy'>Thanks,</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=navy face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:navy'>Erik</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>-----Original Message-----<br>
<b><span style='font-weight:bold'>From:</span></b> Duncan Smith
[mailto:[email protected]] <br>
<b><span style='font-weight:bold'>Sent:</span></b> Thursday, January 09, 2003
1:21 PM<br>
<b><span style='font-weight:bold'>To:</span></b> [email protected]<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [OLEDB_DEV] AW:
[OLEDB_DEV] OLE DB Consumer Templates</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>I encountered this exact issue. I
wanted to pass a string buffer containing XML data to the provider using client-owned
memory. The OLE DB data type I use is DBTYPE_STR | DBTYPE_BYREF. Using the
standard OLE DB consumer template macros will result in this being
provider-owned memory (see CAccessorBase::Bind in atldbcli.h). So I created my
own CAccessorBase type class (called CAccessorBaseEx below) with 2 static
methods and created my own bind macro as follows:</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 color=green
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:green'>// This macro is to be used in place of _COLUMN_ENTRY_CODE (in
atldbcli.h) for a parameter or</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 color=green
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:green'>// column whose type has the DBTYPE_BYREF bit set. CAccessorBase::Bind
always sets dwMemOwner</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 color=green
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:green'>// to DBMEMOWNER_PROVIDEROWNED if the DBTYPE_BYREF bit set. This
macro changes that behavior by</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 color=green
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:green'>// setting dwMemOwner to the value passed as the last macro
parameter.</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 color=green
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:green'>// Use COLUMN_ENTRY_EX_BYREF instead of COLUMN_ENTRY_EX (in
atldbcli.h) for DBTYPE_BYREF entries.</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 color=blue
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>#define</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>
_COLUMN_ENTRY_CODE_BYREF(nOrdinal, wType, nLength, nPrecision, nScale,
dataOffset, lengthOffset, statusOffset, dwMemOwner) \</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<font color=blue><span style='color:blue'>if</span></font> (pBuffer != NULL) \</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{ \</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<font color=blue><span style='color:blue'>if</span></font> (!bClearOnly) \</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
CAccessorBaseEx::FreeType(wType, pBuffer + dataOffset, dwMemOwner); \</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
memset(pBuffer + dataOffset, 0, nLength); \</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
} \</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<font color=blue><span style='color:blue'>else</span></font> <font color=blue><span
style='color:blue'>if</span></font> (pBinding != NULL) \</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{ \</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ATLASSERT( pColumnNames != NULL ); \</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
*pColumnNames = NULL; \</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
CAccessorBaseEx::Bind(pBinding, nOrdinal, wType, nLength, nPrecision, nScale,
eParamIO, \</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
dataOffset, lengthOffset, statusOffset, NULL, dwMemOwner); \</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
pColumnNames++; \</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
pBinding++; \</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
} \</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
nColumns++;</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 color=blue
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>#define</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>
COLUMN_ENTRY_EX_BYREF(nOrdinal, wType, nLength, nPrecision, nScale, data,
length, status, dwMemOwner) \</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
_COLUMN_ENTRY_CODE_BYREF(nOrdinal, wType, nLength, nPrecision, nScale, offsetbuf(data),
offsetbuf(length), offsetbuf(status), dwMemOwner)</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 color=blue
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>class</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'> CAccessorBaseEx</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>{</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 color=blue
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>public</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>:</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<font color=blue><span style='color:blue'>static</span></font> <font
color=blue><span style='color:blue'>void</span></font> Bind(DBBINDING*
pBinding, ULONG nOrdinal, DBTYPE wType,</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ULONG nLength, BYTE nPrecision, BYTE nScale, DBPARAMIO eParamIO,</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ULONG nDataOffset, ULONG nLengthOffset = NULL, ULONG nStatusOffset = NULL,</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
DBOBJECT* pdbobject = NULL, DBMEMOWNER dwMemOwner = DBMEMOWNER_CLIENTOWNED) <font
color=blue><span style='color:blue'>throw</span></font>()</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ATL::CAccessorBase::Bind(</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
pBinding,</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
nOrdinal,</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
wType,</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
nLength,</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
nPrecision,</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
nScale,</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
eParamIO,</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nDataOffset,</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
nLengthOffset,</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
nStatusOffset,</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
pdbobject);</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
pBinding-&gt;dwMemOwner = dwMemOwner;</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<font color=blue><span style='color:blue'>static</span></font> <font
color=blue><span style='color:blue'>inline</span></font> <font color=blue><span
style='color:blue'>void</span></font> FreeType(DBTYPE wType, BYTE* pValue,
DBMEMOWNER dwMemOwner) <font color=blue><span style='color:blue'>throw</span></font>()</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<font color=blue><span style='color:blue'>if</span></font> ((wType &amp;
DBTYPE_BYREF) &amp;&amp; (dwMemOwner == DBMEMOWNER_CLIENTOWNED))</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<font color=blue><span style='color:blue'>void</span></font> * pData = *(<font
color=blue><span style='color:blue'>void</span></font> **)pValue;</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<font color=blue><span style='color:blue'>if</span></font> (pData != NULL)</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
CoTaskMemFree(pData);</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<font color=blue><span style='color:blue'>else</span></font></span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ATL::CAccessorBase::FreeType(wType, pValue);</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'>};</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>Then the accessor I used has the
following (the SQL Server data type I am using is text):</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<font color=blue><span style='color:blue'>char</span></font>
*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_pszData;</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
DBLENGTH&nbsp;&nbsp;&nbsp; m_DataLength;</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
DBSTATUS&nbsp;&nbsp;&nbsp; m_DataStatus;</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>...</span></font></p>

<p class=MsoNormal style='margin-left:1.0in;text-indent:.5in'><font size=2
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>COLUMN_ENTRY_EX_BYREF(5,
DBTYPE_STR | DBTYPE_BYREF, <font color=blue><span style='color:blue'>sizeof</span></font>(<font
color=blue><span style='color:blue'>char</span></font> *), 0, 0, m_pszData,
m_DataLength, m_DataStatus, DBMEMOWNER_CLIENTOWNED)</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>Hope this helps.</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>Duncan Smith</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:1.5in'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>-----Original Message-----<br>
<b><span style='font-weight:bold'>From:</span></b> Erik Valdes
[mailto:[email protected]] <br>
<b><span style='font-weight:bold'>Sent:</span></b> Thursday, January 09, 2003
1:17 PM<br>
<b><span style='font-weight:bold'>To:</span></b> [email protected]<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [OLEDB_DEV] AW:
[OLEDB_DEV] OLE DB Consumer Templates</span></font></p>

<p class=MsoNormal style='margin-left:1.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<p style='margin-left:1.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>Hi,</span></font> </p>

<p style='margin-left:1.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>I see what you mean about MS recommending the storage
object way.&nbsp; I've found a lot of articles describing that.&nbsp; However, I'm
having trouble finding anything that gives an example of how to do the
in-memory way.&nbsp; Perhaps someone could point me to an example or a how-to
document?&nbsp; I'd really appreciate it.&nbsp; </span></font></p>

<p style='margin-left:1.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>Thanks,</span></font> <br>
<font size=2><span style='font-size:10.0pt'>Erik</span></font> </p>

<p style='margin-left:1.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>-----Original Message-----</span></font> <br>
<font size=2><span style='font-size:10.0pt'>From: Yuancai Ye [<a
href="mailto:[email protected]">mailto:[email protected]</a>] </span></font><br>
<font size=2><span style='font-size:10.0pt'>Sent: Thursday, January 09, 2003
9:57 AM</span></font> <br>
<font size=2><span style='font-size:10.0pt'>To: [email protected]</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>Subject: Re: [OLEDB_DEV] AW:
[OLEDB_DEV] OLE DB Consumer Templates</span></font> </p>

<p style='margin-left:1.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>Hi,</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp; MS recommends us
to use storage object for sending</span></font> <br>
<font size=2><span style='font-size:10.0pt'>a BLOB into a data source. However,
as I tested, this</span></font> <br>
<font size=2><span style='font-size:10.0pt'>way is bad in many cases since your
code needs to</span></font> <br>
<font size=2><span style='font-size:10.0pt'>create a store object and database
needs to recover</span></font> <br>
<font size=2><span style='font-size:10.0pt'>binnary data from the store object.
You'd better use</span></font> <br>
<font size=2><span style='font-size:10.0pt'>in-memory way to send BLOB for faster
speed. With use</span></font> <br>
<font size=2><span style='font-size:10.0pt'>of in-memory way, the previous two
extra steps are</span></font> <br>
<font size=2><span style='font-size:10.0pt'>avoided. Therefore, in-memory way
is faster. That is</span></font> <br>
<font size=2><span style='font-size:10.0pt'>my guess. Test it yourself.</span></font>
</p>

<p style='margin-left:1.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>Regards,</span></font> </p>

<p style='margin-left:1.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>Yuancai (Charlie) Ye</span></font> </p>

<p style='margin-left:1.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>--- Rudolf Wiener &lt;[email protected]&gt; wrote:</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt; Erik,</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; For reading and writing blobs,
which is what you're</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; in fact using, I use the</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt; technologies recommended and
stream the data with a</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; storage object. The</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt; macro I use in the accessor is</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt; BLOB_ENTRY_LENGTH_STATUS. I'm
not sure if</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; this is the best way to do it
because I have the</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; impression it slows things</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt; down a bit. But I haven't had
the time yet to look</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; into faster alternatives.</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; If you like I can send you
excerpts from my app's</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; code.</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; Regards</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; Rudi</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;
-----Urspr&amp;#40689;gliche Nachricht-----</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp; Von: OLEDB_DEV</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt; [<a
href="mailto:[email protected]">mailto:[email protected]</a>]Im
Auftrag von</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; Erik</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; Valdes</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp; Gesendet:
Donnerstag, 09. J&amp;#37592;ner 2003 17:22</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp; An:
[email protected]</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp; Betreff: Re:
[OLEDB_DEV] OLE DB Consumer Templates</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp; The reason I can't
allocate on the stack is that</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; my variable can be any</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt; length.&nbsp; It essentially
boils down to the string</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; representation of an xml</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt; file.&nbsp; That file can be
any size.&nbsp; When I pass it to</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; my SP, the sp's</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; parameter is ntext (to allow
for any size).&nbsp;&nbsp; What</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; do people do when they</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt; want to pass XML of unknown
length to a SQL Server</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; stored procedure?</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp; -----Original
Message-----</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp; From: Peter Moss [<a
href="mailto:[email protected]">mailto:[email protected]</a>]</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp; Sent: Thursday,
January 09, 2003 7:58 AM</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp; To:
[email protected]</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp; Subject: Re:
[OLEDB_DEV] OLE DB Consumer Templates</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp; If I remember right,
you can't use the macros for</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; heap-allocated</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; variables.&nbsp; If you dig
into the macro definitions, I</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; believe you will find</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt; that pointers offset from the
beginning of 'this'</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; are used.&nbsp; Thus, a</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt; heap-allocated variable like
m_WorkRequest will not</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; work.</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp; Why can't you just
allocate a TCHAR on the stack</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; frame of the object, ie,</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp; TCHAR
m_WorkRequest[257];&nbsp;&nbsp;&nbsp;&nbsp; // Or 1 + the size</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; of your SP parameter size</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp; Then you can just
use COLUMN_ENTRY.</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp; HTH,</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp; Peter</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;
-----Original Message-----</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp; From:
OLEDB_DEV</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; [<a
href="mailto:[email protected]">mailto:[email protected]</a>]On
Behalf Of</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; Erik</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; Valdes</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Sent:
Wednesday, January 08, 2003 5:22 PM</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp; To:
[email protected]</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;
Subject: [OLEDB_DEV] OLE DB Consumer Templates</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp; I'm
having trouble implementing an accessor.</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; I'm trying to use a</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt; variable (m_WorkRequest)
that's dynamically</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; allocated as the variable
that's</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; bound to a parameter in my
accessor (commented line</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; below).&nbsp;&nbsp; The reason
I</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; need it to be dynamic is that
it is XML and can be</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; any length.&nbsp; The stored</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt; proc's parameter is of ntext
type to handle the</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; variable length.&nbsp;
However, I</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; don't know at compile time how
big to make the</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; buffer for my parameter in my</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt; accessor.&nbsp; What's the
proper way to do this?&nbsp; I've</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; tried COLUMN_ENTRY</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt; (access violation),
COLUMN_ENTRY_LENGTH (different</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; variations produce</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt; different errors, but
basically I can't set the</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; length),</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; COLUMN_ENTRY_TYPE_SIZE
(similar problems as the</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; previous).&nbsp; I'm running
out</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; of ideas now.&nbsp; The code
below is just one of many,</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; many variations I've</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt; tried.</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp; class
CAddWorkRequest</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp; {</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;
public:</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
CAddWorkRequest() STD_INIT</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
~CAddWorkRequest()</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (m_WorkRequest)</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
delete [] m_WorkRequest;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
LONG m_RETURNVALUE;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
LPTSTR m_WorkRequest;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
LONG m_lLength;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
void SetStringParam(LPCTSTR szString,int</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; cBytes)</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
m_WorkRequest = (LPTSTR) new</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; TCHAR[cBytes];</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
_tcsncpy(m_WorkRequest,szString,cBytes);</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
m_lLength = _tcslen(m_WorkRequest);</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
})</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;
BEGIN_PARAM_MAP(CAddWorkRequest)</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
SET_PARAM_TYPE(DBPARAMIO_OUTPUT)</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
COLUMN_ENTRY(1, m_RETURNVALUE)</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
SET_PARAM_TYPE(DBPARAMIO_INPUT)</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp; //</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>COLUMN_ENTRY_TYPE_SIZE(2,DBTYPE_STR,_tcslen(m_WorkRequest),</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt; m_WorkRequest)</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;
END_PARAM_MAP()</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp;
DEFINE_COMMAND(CAddWorkRequest, _T(&quot;{ ? = CALL</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt; dbo.AddWorkRequest;1</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt; (?) }&quot;))</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp; };</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp; class
CAddWorkRequestCommand : public</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;
CBsDbCommand&lt;CAddWorkRequest&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp; {</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp; };</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp; foo
(LPTSTR szWor)</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;&nbsp;&nbsp;&nbsp;&nbsp; {</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>&gt;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>=== message truncated ===</span></font>
</p>

<p class=MsoNormal style='margin-left:1.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<p style='margin-left:1.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>__________________________________________________</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>Do you Yahoo!?</span></font> <br>
<font size=2><span style='font-size:10.0pt'>Yahoo! Mail Plus - Powerful.
Affordable. Sign up now.</span></font> <br>
<font size=2><span style='font-size:10.0pt'><a href="http://mailplus.yahoo.com"
target="_blank">http://mailplus.yahoo.com</a></span></font> </p>

<p style='margin-left:1.5in'><font size=2 face="Times New Roman"><span
style='font-size:10.0pt'>You can read messages from the OLEDB_DEV archive,
unsubscribe from OLEDB_DEV,</span></font> <br>
<font size=2><span style='font-size:10.0pt'>or subscribe to other DevelopMentor
lists at <a href="http://discuss.develop.com" target="_blank">http://discuss.develop.com</a>.</span></font>
</p>

<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>You can read messages from the OLEDB_DEV archive,
unsubscribe from OLEDB_DEV, or subscribe to other DevelopMentor lists at
http://discuss.develop.com. You can read messages from the OLEDB_DEV archive,
unsubscribe from OLEDB_DEV, or subscribe to other DevelopMentor lists at You
can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV, or
subscribe to other DevelopMentor lists at http://discuss.develop.com. http://discuss.develop.com.</span></font></p>

</blockquote>

</div>

</body>

</html>
You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV,
You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.
or subscribe to other DevelopMentor lists at http://discuss.develop.com.
------_=_NextPart_001_01C2B827.03777170--