Re: AW: [OLEDB_DEV] OLE DB Consumer Templates
Peter Moss <[email protected]> Thu, 9 Jan 2003 17:07:22 -0500
| Newsgroups | gmane.comp.windows.devel.oledb.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
------=_NextPart_000_0061_01C2B801.937FCEA0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
RE: [OLEDB_DEV] AW: [OLEDB_DEV] OLE DB Consumer TemplatesBasically, it is a
question of setting up the DBBINDING structure for OLE DB. If you look at
the OLE DB doc, you'll find that the DBOBJECT pointer that is part of
DBBINDING contains 2 members, one of which can specify an IID, in our case,
ISequentialStream. OLE DB is smart enough to know how to serialize data
from that object since the set of interfaces it supports is limited to
obvious ones like IStream, IPersist, etc.
In looking thru all my hack directories, I can't find an eg that goes FROM
XML to the DB, but I found one where I perform a SQL query using FOR XML
syntax, and serialize the results into a MSXML DOM. I'll include some of
the code below, and if you want a ZIP of the whole demo project, send me an
email offline and I'll send it to you. I know this isn't what you want, but
it is all I have right now. But the key is that you have to set up the
DBBINDING struct to work right. I know it is doable, but I can't provide the
details right now. Maybe someone else has a sample of writing to the DB
which is what you want.
First, is a simple CRowset-derived class:
class CDummyAccessor
{
public:
};
class CRowsetStream : public CRowset
{
public:
CRowsetStream();
virtual ~CRowsetStream() {Close();}
public:
CComPtr<ISequentialStream> m_spRowsetStream;
public:
void Close() {m_spRowsetStream.Release();}
IRowset* GetInterface() const
{return((IRowset*)(m_spRowsetStream.p));}
IRowset** GetInterfacePtr()
{return((IRowset**)(&(m_spRowsetStream.p)));}
static const IID& GetIID() {return(IID_ISequentialStream);}
};
and here is a snippet of code from a test app that takes a standard SQL
query as input and serializes the XML result to a DOM:
CString strSQL(m_strSQL); // SQL query string
strSQL += " FOR XML AUTO";
TRACE("CSQL2XMLDlg::OnExecute SQL = '%s'\n", strSQL);
// Create DOM
IXMLDOMDocument2Ptr spDoc;
hr = spDoc.CreateInstance(_T("Msxml2.DOMDocument"));
if (FAILED(hr)) {
strErr.Format("CSQL2XMLDlg::OnExecute CreateInstance(Msxml2.DOMDocument)
failed. hr = %x\n", hr);
TRACE(strErr);
AfxMessageBox(strErr);
return;
}
CCommand<CAccessor<CDummyAccessor>, CRowsetStream> cmd;
CDBPropSet dbProps(DBPROPSET_SQLSERVERSTREAM);
dbProps.AddProperty(SSPROP_STREAM_XMLROOT, OLESTR("MyRoot"));
hr = cmd.Open(m_Session, strSQL, &dbProps);
if (FAILED(hr)) {
strErr.Format("CSQL2XMLDlg::OnExecute Command open failed. hr = %x\n",
hr);
TRACE(strErr);
AtlTraceErrorRecords(hr);
AfxMessageBox(strErr);
return;
}
if (cmd.m_spRowsetStream.p == NULL) {
AfxMessageBox("CSQL2XMLDlg::OnExecute ISequentialStream* = NULL!");
return;
}
try {
IUnknown* pUnknown = NULL;
cmd.m_spRowsetStream.QueryInterface(&pUnknown);
_variant_t vtStream(pUnknown, false);
if (!spDoc->load(vtStream)) {
// load failed
IXMLDOMParseErrorPtr spParseErr = spDoc->parseError;
strErr.Format(_T("ERROR: load\n%s\nSource Line: %d Char: %d\n"),
(TCHAR*)(spParseErr->reason), spParseErr->line, spParseErr->linepos);
TRACE(strErr);
AfxMessageBox(strErr);
return;
}
// Save it out to file
_variant_t vtOutputFile((LPCTSTR)m_strOutputFile);
spDoc->save(vtOutputFile);
IXMLDOMDocumentFragmentPtr df;
}
catch (_com_error& err) {
strErr.Format(_T("ERROR: XML DOM load\n%s\n%s\n"), err.ErrorMessage(),
(TCHAR*)(err.Description()));
TRACE(strErr);
AfxMessageBox(strErr);
return;
}
-----Original Message-----
From: OLEDB_DEV [mailto:[email protected]]On Behalf Of Erik
Valdes
Sent: Thursday, January 09, 2003 4:35 PM
To: [email protected]
Subject: Re: [OLEDB_DEV] AW: [OLEDB_DEV] OLE DB Consumer Templates
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]]
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黱gliche Nachricht-----
> Von: OLEDB_DEV
> [mailto:[email protected]]Im Auftrag von
> Erik
> Valdes
> Gesendet: Donnerstag, 09. J鋘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]]
> 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]]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
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. 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, 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.
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_000_0061_01C2B801.937FCEA0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>RE: [OLEDB_DEV] AW: [OLEDB_DEV] OLE DB Consumer =
Templates</TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2722.900" name=3DGENERATOR>
<STYLE>@font-face {
font-family: Helvetica;
}
@font-face {
font-family: Tahoma;
}
@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.25in 1.0in 1.25in; }
P.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
LI.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
DIV.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
A:link {
COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
COLOR: blue; TEXT-DECORATION: underline
}
P {
FONT-SIZE: 12pt; MARGIN-LEFT: 0in; MARGIN-RIGHT: 0in; FONT-FAMILY: =
"Times New Roman"
}
SPAN.emailstyle18 {
COLOR: navy; FONT-FAMILY: Arial
}
SPAN.emailstyle19 {
COLOR: navy; FONT-FAMILY: Arial
}
SPAN.EmailStyle20 {
COLOR: navy; FONT-FAMILY: Arial
}
DIV.Section1 {
page: Section1
}
</STYLE>
</HEAD>
<BODY lang=3DEN-US vLink=3Dblue link=3Dblue>
<DIV><SPAN class=3D296295221-09012003><FONT face=3DArial color=3D#0000ff =
size=3D2>Basically, it is a question of setting up the DBBINDING =
structure for OLE=20
DB. If you look at the OLE DB doc, you'll find that the DBOBJECT =
pointer=20
that is part of DBBINDING contains 2 members, one of which can specify =
an IID,=20
in our case, ISequentialStream. OLE DB is smart enough to know how =
to=20
serialize data from that object since the set of interfaces it supports =
is=20
limited to obvious ones like IStream, IPersist, etc.</FONT></SPAN></DIV>
<DIV><SPAN class=3D296295221-09012003><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D296295221-09012003><FONT face=3DArial color=3D#0000ff =
size=3D2>In=20
looking thru all my hack directories, I can't find an eg that goes FROM =
XML to=20
the DB, but I found one where I perform a SQL query using FOR XML =
syntax, and=20
serialize the results into a MSXML DOM. I'll include some of the =
code=20
below, and if you want a ZIP of the whole demo project, send me an email =
offline=20
and I'll send it to you. I know this isn't what you want, but it =
is all I=20
have right now. But the key is that you have to set up the =
DBBINDING=20
struct to work right. I know it is doable, but I can't provide the =
details right=20
now. Maybe someone else has a sample of writing to the DB which is =
what=20
you want.</FONT></SPAN></DIV>
<DIV><SPAN class=3D296295221-09012003><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D296295221-09012003><FONT face=3DArial color=3D#0000ff =
size=3D2>First,=20
is a simple CRowset-derived class:</FONT></SPAN></DIV>
<DIV><SPAN class=3D296295221-09012003><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D296295221-09012003><FONT face=3D"Lucida Console" =
color=3D#0000ff=20
size=3D2>class CDummyAccessor<BR>{<BR>public:</FONT></SPAN><SPAN=20
class=3D296295221-09012003><BR><FONT face=3D"Lucida Console" =
color=3D#0000ff=20
size=3D2>};</FONT></DIV>
<DIV><FONT face=3D"Lucida Console" color=3D#0000ff =
size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Lucida Console"><FONT color=3D#0000ff><FONT =
size=3D2>class=20
CRowsetStream : public CRowset =20
<BR>{<BR>public:<BR> CRowsetStream();<BR> virtual=20
~CRowsetStream()<SPAN class=3D296295221-09012003> {Close()</SPAN>;<SPAN=20
class=3D296295221-09012003>}</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3D"Lucida Console" color=3D#0000ff =
size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Lucida Console" color=3D#0000ff=20
size=3D2>public:<BR> CComPtr<ISequentialStream> &nb=
sp;m_spRowsetStream;</FONT></DIV>
<DIV><FONT face=3D"Lucida Console" color=3D#0000ff =
size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Lucida Console"><FONT color=3D#0000ff><FONT=20
size=3D2>public:<BR> void &=
nbsp; Close()<SPAN=20
class=3D296295221-09012003> {m_spRowsetStream.Release()</SPAN>;<SPAN=20
class=3D296295221-09012003>}</SPAN></FONT></FONT></FONT></DIV><FONT=20
face=3D"Lucida Console"><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
class=3D296295221-09012003></SPAN>
<DIV><BR> IRowset* &n=
bsp;GetInterface()=20
const<SPAN class=3D296295221-09012003>=20
{return((IRowset*)(m_spRowsetStream.p));}</SPAN><BR></DIV>
<DIV> IRowset** GetIn=
terfacePtr()<SPAN=20
class=3D296295221-09012003>=20
{return((IRowset**)(&(m_spRowsetStream.p)))</SPAN>;<SPAN=20
class=3D296295221-09012003>}</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=3D"Lucida Console" color=3D#0000ff =
size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Lucida Console" color=3D#0000ff size=3D2> static =
const=20
IID& GetIID()=20
{return(IID_ISequentialStream);}</FONT></DIV>
<DIV><FONT face=3D"Lucida Console" color=3D#0000ff =
size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Lucida Console" color=3D#0000ff =
size=3D2>};<BR></FONT></SPAN></DIV>
<DIV><SPAN class=3D296295221-09012003><FONT face=3DArial color=3D#0000ff =
size=3D2>and=20
here is a snippet of code from a test app that takes a standard SQL =
query as=20
input and serializes the XML result to a DOM:</FONT></SPAN></DIV>
<DIV><SPAN class=3D296295221-09012003><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D296295221-09012003><FONT face=3D"Lucida Console" =
color=3D#0000ff=20
size=3D2> CString strSQL(m_strSQL); // SQL =
query=20
string<BR> strSQL +=3D " FOR XML=20
AUTO";<BR> TRACE("CSQL2XMLDlg::OnExecute SQL =3D '%s'\n",=20
strSQL);</FONT></SPAN></DIV>
<DIV><FONT face=3D"Lucida Console"></FONT> </DIV><SPAN=20
class=3D296295221-09012003><FONT color=3D#0000ff size=3D2>
<DIV><BR><FONT face=3D"Lucida Console"> // Create=20
DOM<BR> IXMLDOMDocument2Ptr spDoc;<BR> hr =3D=20
spDoc.CreateInstance(_T("Msxml2.DOMDocument"));<BR> if (FAILED(hr)) =
{<BR> strErr.Format("CSQL2XMLDlg::OnExecute=20
CreateInstance(Msxml2.DOMDocument) failed. hr =3D %x\n",=20
hr);<BR> TRACE(strErr);<BR> AfxMessageBox(strErr);<=
BR> return;<BR> }<BR></FONT><FONT=20
face=3D"Lucida Console"></FONT></DIV>
<DIV><FONT=20
face=3D"Lucida =
Console"> CCommand<CAccessor<CDummyAccessor>,=20
CRowsetStream> cmd;</FONT></DIV>
<DIV><FONT face=3D"Lucida Console"></FONT> </DIV>
<DIV><FONT=20
face=3D"Lucida =
Console"> CDBPropSet dbProps(DBPROPSET_SQLSERVERSTREAM);<BR>&nb=
sp;dbProps.AddProperty(SSPROP_STREAM_XMLROOT,=20
OLESTR("MyRoot"));</FONT></DIV>
<DIV><FONT face=3D"Lucida Console"></FONT> </DIV>
<DIV><BR><FONT face=3D"Lucida Console"> hr =3D cmd.Open(m_Session, =
strSQL,=20
&dbProps);<BR> if (FAILED(hr))=20
{<BR> strErr.Format("CSQL2XMLDlg::OnExecute Command open =
failed. hr =3D=20
%x\n",=20
hr);<BR> TRACE(strErr);<BR> AtlTraceErrorRecords(hr=
);<BR> AfxMessageBox(strErr);<BR> return;<BR> =
}</FONT></DIV>
<DIV><FONT face=3D"Lucida Console"></FONT> </DIV>
<DIV><FONT face=3D"Lucida Console"> if (cmd.m_spRowsetStream.p =
=3D=3D NULL)=20
{<BR> AfxMessageBox("CSQL2XMLDlg::OnExecute =
ISequentialStream* =3D=20
NULL!");<BR> return;<BR> }</FONT></DIV>
<DIV><FONT face=3D"Lucida Console"></FONT> </DIV>
<DIV><BR><FONT face=3D"Lucida Console"> try =
{<BR> IUnknown*=20
pUnknown =3D=20
NULL;<BR> cmd.m_spRowsetStream.QueryInterface(&pUnknown);<=
BR> _variant_t=20
vtStream(pUnknown, false);<BR> if (!spDoc->load(vtStream)) =
{<BR> // load =
failed<BR> IXMLDOMParseErrorPtr=20
spParseErr =3D =
spDoc->parseError;<BR> strErr.Format(_T("ERROR:=20
load\n%s\nSource Line: %d Char: %d\n"), (TCHAR*)(spParseErr->reason), =
spParseErr->line,=20
spParseErr->linepos);<BR> TRACE(strErr);<BR> &nb=
sp; AfxMessageBox(strErr);<BR> return;<BR> &nb=
sp;}</FONT></DIV>
<DIV><FONT face=3D"Lucida Console"></FONT> </DIV>
<DIV><FONT face=3D"Lucida Console"> // Save it out to=20
file<BR> _variant_t=20
vtOutputFile((LPCTSTR)m_strOutputFile);<BR> spDoc->save(vtO=
utputFile);</FONT></DIV>
<DIV><FONT face=3D"Lucida Console"></FONT> </DIV>
<DIV><FONT face=3D"Lucida =
Console"> IXMLDOMDocumentFragmentPtr=20
df;</FONT></DIV>
<DIV><FONT face=3D"Lucida Console"></FONT> </DIV>
<DIV><FONT face=3D"Lucida Console"> }<BR> catch =
(_com_error& err)=20
{<BR> strErr.Format(_T("ERROR: XML DOM load\n%s\n%s\n"),=20
err.ErrorMessage(),=20
(TCHAR*)(err.Description()));<BR> TRACE(strErr);<BR> &nbs=
p;AfxMessageBox(strErr);<BR> return;<BR> }<BR></FONT></FO=
NT></SPAN></DIV>
<DIV><SPAN class=3D296295221-09012003><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D296295221-09012003><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D296295221-09012003><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D296295221-09012003><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D296295221-09012003><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<BLOCKQUOTE>
<DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma=20
size=3D2>-----Original Message-----<BR><B>From:</B> OLEDB_DEV=20
[mailto:[email protected]]<B>On Behalf Of </B>Erik=20
Valdes<BR><B>Sent:</B> Thursday, January 09, 2003 4:35 =
PM<BR><B>To:</B>=20
[email protected]<BR><B>Subject:</B> Re: [OLEDB_DEV] AW:=20
[OLEDB_DEV] OLE DB Consumer Templates<BR><BR></FONT></DIV>
<DIV class=3DSection1>
<P class=3DMsoNormal><FONT face=3DHelvetica color=3Dblue =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Helvetica">Hi=20
Peter,</SPAN></FONT></P>
<P class=3DMsoNormal><FONT face=3DHelvetica color=3Dblue =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: =
Helvetica"></SPAN></FONT> </P>
<P class=3DMsoNormal><FONT face=3DHelvetica color=3Dblue =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Helvetica">The =
phrase "could=20
serialize the DOM directly into the DB using OLE DB" is where the =
mystery lies=20
for me. </SPAN></FONT></P>
<P class=3DMsoNormal><FONT face=3DHelvetica color=3Dblue =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: =
Helvetica"></SPAN></FONT> </P>
<P class=3DMsoNormal><FONT face=3DHelvetica color=3Dblue =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Helvetica">In my =
SP, I need=20
to do a fairly standard thing (@WRXML is my ntext=20
parameter):</SPAN></FONT></P>
<P class=3DMsoNormal><FONT face=3DHelvetica color=3Dblue =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: =
Helvetica"></SPAN></FONT> </P>
<P class=3DMsoNormal><FONT face=3DHelvetica color=3Dblue =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Helvetica">DECLARE =
@idoc=20
int -- XML Document handle</SPAN></FONT></P>
<P class=3DMsoNormal><FONT face=3DHelvetica color=3Dblue =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Helvetica">-- =
Prepare the=20
XML</SPAN></FONT></P>
<P class=3DMsoNormal><FONT face=3DHelvetica color=3Dblue =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Helvetica">EXEC=20
sp_xml_preparedocument @idoc OUTPUT, @WRXML</SPAN></FONT></P>
<P class=3DMsoNormal><FONT face=3DHelvetica color=3Dblue =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: =
Helvetica"></SPAN></FONT> </P>
<P class=3DMsoNormal><FONT face=3DHelvetica color=3Dblue =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Helvetica">I'm =
using=20
ATL/OLEDB because that's what I'm familiar with. I'm well versed =
in how=20
to set up accessors that bind string variables to char, varchar, etc=20
parameters in SQL. However, I've never had a variable/parameter =
before=20
with a length that is undetermined at compile time. Yes, =
in the=20
code that creates the XML, I could use objects that expose streaming=20
interfaces (Like MSXML) . However, what I don't understand is =
the=20
missing piece in between streaming something from MSXML (or .NET, etc) =
and=20
receiving it as a parameter in a SQL Stored =
Procedure.</SPAN></FONT></P>
<P class=3DMsoNormal><FONT face=3DHelvetica color=3Dblue =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: =
Helvetica"></SPAN></FONT> </P>
<P class=3DMsoNormal><FONT face=3DHelvetica color=3Dblue =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: =
Helvetica">Thanks,</SPAN></FONT></P>
<P class=3DMsoNormal><FONT face=3DHelvetica color=3Dblue =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: =
Helvetica">Erik</SPAN></FONT></P>
<P class=3DMsoNormal><FONT face=3DHelvetica color=3D#00ccff =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: #00ccff; FONT-FAMILY: =
Helvetica"></SPAN></FONT> </P>
<P class=3DMsoNormal><FONT face=3DHelvetica color=3D#00ccff =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: #00ccff; FONT-FAMILY: =
Helvetica"></SPAN></FONT> </P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 0.5in"><FONT face=3DTahoma =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">-----Original=20
Message-----<BR><B><SPAN style=3D"FONT-WEIGHT: bold">From:</SPAN></B> =
Peter Moss=20
[mailto:[email protected]] <BR><B><SPAN=20
style=3D"FONT-WEIGHT: bold">Sent:</SPAN></B> </SPAN></FONT><FONT =
face=3DTahoma=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: =
Tahoma">Thursday, January=20
09, 2003</SPAN></FONT><FONT face=3DTahoma size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"> </SPAN></FONT><FONT =
face=3DTahoma=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">2:14=20
PM</SPAN></FONT><FONT face=3DTahoma size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"><BR><B><SPAN=20
style=3D"FONT-WEIGHT: bold">To:</SPAN></B>=20
[email protected]<BR><B><SPAN=20
style=3D"FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [OLEDB_DEV] AW: =
[OLEDB_DEV]=20
OLE DB Consumer Templates</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 0.5in"><FONT face=3D"Times =
New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: 12pt"></SPAN></FONT> </P>
<DIV>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 0.5in"><FONT face=3DArial =
color=3Dblue=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: =
Arial">Since=20
we're talking about memory usage, can we back up 1 minute and ask Erik =
what is=20
the source of the XML data? Is it from a DOM, say implemented =
using=20
MSXML (or for that matter any object that exposes IStream for =
serialization)?=20
If so, you might also look into the fact that the DOM exposes =
IStream*=20
so you could serialize the DOM directly into the DB using OLE=20
DB.</SPAN></FONT></P></DIV>
<DIV>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 0.5in"><FONT face=3D"Times =
New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: =
12pt"></SPAN></FONT> </P></DIV>
<DIV>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 0.5in"><FONT face=3DArial =
color=3Dblue=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: =
Arial">If this=20
is the case, I am sure that I and others have done this in the past =
and could=20
supply examples. If your XML source is just in a string somewhere, =
then=20
proceed along the lines you are proceeding =
now.</SPAN></FONT></P></DIV>
<DIV>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 0.5in"><FONT face=3D"Times =
New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: =
12pt"></SPAN></FONT> </P></DIV>
<DIV>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 0.5in"><FONT face=3DArial =
color=3Dblue=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: =
Arial">Peter</SPAN></FONT></P></DIV>
<BLOCKQUOTE style=3D"MARGIN-TOP: 5pt; MARGIN-BOTTOM: 5pt">
<P class=3DMsoNormal=20
style=3D"MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 0.5in; MARGIN-RIGHT: =
0in"><FONT=20
face=3DTahoma size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">-----Original=20
Message-----<BR><B><SPAN style=3D"FONT-WEIGHT: =
bold">From:</SPAN></B>=20
OLEDB_DEV [mailto:[email protected]]<B><SPAN=20
style=3D"FONT-WEIGHT: bold">On Behalf Of </SPAN></B>Erik =
Valdes<BR><B><SPAN=20
style=3D"FONT-WEIGHT: bold">Sent:</SPAN></B> Thursday, January 09, =
2003 4:05=20
PM<BR><B><SPAN style=3D"FONT-WEIGHT: bold">To:</SPAN></B>=20
[email protected]<BR><B><SPAN=20
style=3D"FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [OLEDB_DEV] AW:=20
[OLEDB_DEV] OLE DB Consumer Templates</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 0.5in"><FONT face=3DArial =
color=3Dnavy=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: =
Arial">Hi=20
Duncan, </SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 0.5in"><FONT =
face=3D"Times New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 0.5in"><FONT face=3DArial =
color=3Dnavy=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: =
Arial">You've=20
gone one step further than I expected. I'm not sure I =
understand the=20
relevance of who owns the memory. However, I had not tried =
using=20
DBTYPE_BYREF at all so that is something I need to try. Why is =
the=20
memory owner important for this issue?</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 0.5in"><FONT =
face=3D"Times New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 0.5in"><FONT face=3DArial =
color=3Dnavy=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: =
Arial">Thanks,</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 0.5in"><FONT face=3DArial =
color=3Dnavy=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: =
Arial">Erik</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 0.5in"><FONT =
face=3D"Times New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT face=3DTahoma =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">-----Original=20
Message-----<BR><B><SPAN style=3D"FONT-WEIGHT: =
bold">From:</SPAN></B> Duncan=20
Smith [mailto:[email protected]] <BR><B><SPAN=20
style=3D"FONT-WEIGHT: bold">Sent:</SPAN></B> Thursday, January 09, =
2003 1:21=20
PM<BR><B><SPAN style=3D"FONT-WEIGHT: bold">To:</SPAN></B>=20
[email protected]<BR><B><SPAN=20
style=3D"FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [OLEDB_DEV] AW:=20
[OLEDB_DEV] OLE DB Consumer Templates</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT face=3D"Times =
New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT face=3DArial =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">I encountered this =
exact issue.=20
I wanted to pass a string buffer containing XML data to the provider =
using=20
client-owned memory. The OLE DB data type I use is DBTYPE_STR |=20
DBTYPE_BYREF. Using the standard OLE DB consumer template macros =
will result=20
in this being provider-owned memory (see CAccessorBase::Bind in =
atldbcli.h).=20
So I created my own CAccessorBase type class (called CAccessorBaseEx =
below)=20
with 2 static methods and created my own bind macro as=20
follows:</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT face=3D"Times =
New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
color=3Dgreen size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier =
New'">// This=20
macro is to be used in place of _COLUMN_ENTRY_CODE (in atldbcli.h) =
for a=20
parameter or</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
color=3Dgreen size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier =
New'">// column=20
whose type has the DBTYPE_BYREF bit set. CAccessorBase::Bind always =
sets=20
dwMemOwner</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
color=3Dgreen size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier =
New'">// to=20
DBMEMOWNER_PROVIDEROWNED if the DBTYPE_BYREF bit set. This macro =
changes=20
that behavior by</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
color=3Dgreen size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier =
New'">// setting=20
dwMemOwner to the value passed as the last macro=20
parameter.</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
color=3Dgreen size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier =
New'">// Use=20
COLUMN_ENTRY_EX_BYREF instead of COLUMN_ENTRY_EX (in atldbcli.h) for =
DBTYPE_BYREF entries.</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
color=3Dblue size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier =
New'">#define</SPAN></FONT><FONT=20
face=3D"Courier New" size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">=20
_COLUMN_ENTRY_CODE_BYREF(nOrdinal, wType, nLength, nPrecision, =
nScale,=20
dataOffset, lengthOffset, statusOffset, dwMemOwner) =
\</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =20
<FONT color=3Dblue><SPAN style=3D"COLOR: blue">if</SPAN></FONT> =
(pBuffer !=3D=20
NULL) \</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =20
{ \</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =
<FONT color=3Dblue><SPAN style=3D"COLOR: blue">if</SPAN></FONT> =
(!bClearOnly)=20
\</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> &=
nbsp; =20
CAccessorBaseEx::FreeType(wType, pBuffer + dataOffset, dwMemOwner);=20
\</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =
memset(pBuffer + dataOffset, 0, nLength); \</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =20
} \</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =20
<FONT color=3Dblue><SPAN style=3D"COLOR: blue">else</SPAN></FONT> =
<FONT=20
color=3Dblue><SPAN style=3D"COLOR: blue">if</SPAN></FONT> (pBinding =
!=3D NULL)=20
\</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =20
{ \</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =
ATLASSERT( pColumnNames !=3D NULL ); \</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =
*pColumnNames =3D NULL; \</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =
CAccessorBaseEx::Bind(pBinding, nOrdinal, wType, nLength, =
nPrecision,=20
nScale, eParamIO, \</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> &=
nbsp; =20
dataOffset, lengthOffset, statusOffset, NULL, dwMemOwner);=20
\</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =
pColumnNames++; \</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =
pBinding++; \</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =20
} \</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =20
nColumns++;</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT face=3D"Times =
New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
color=3Dblue size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier =
New'">#define</SPAN></FONT><FONT=20
face=3D"Courier New" size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">=20
COLUMN_ENTRY_EX_BYREF(nOrdinal, wType, nLength, nPrecision, nScale, =
data,=20
length, status, dwMemOwner) \</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =20
_COLUMN_ENTRY_CODE_BYREF(nOrdinal, wType, nLength, nPrecision, =
nScale,=20
offsetbuf(data), offsetbuf(length), offsetbuf(status),=20
dwMemOwner)</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT face=3D"Times =
New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT face=3D"Times =
New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
color=3Dblue size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier =
New'">class</SPAN></FONT><FONT=20
face=3D"Courier New" size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">=20
CAccessorBaseEx</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'">{</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
color=3Dblue size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier =
New'">public</SPAN></FONT><FONT=20
face=3D"Courier New" size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'">:</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =20
<FONT color=3Dblue><SPAN style=3D"COLOR: blue">static</SPAN></FONT> =
<FONT=20
color=3Dblue><SPAN style=3D"COLOR: blue">void</SPAN></FONT> =
Bind(DBBINDING*=20
pBinding, ULONG nOrdinal, DBTYPE wType,</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =
ULONG nLength, BYTE nPrecision, BYTE nScale, DBPARAMIO=20
eParamIO,</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =
ULONG nDataOffset, ULONG nLengthOffset =3D NULL, ULONG nStatusOffset =
=3D=20
NULL,</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =
DBOBJECT* pdbobject =3D NULL, DBMEMOWNER dwMemOwner =3D =
DBMEMOWNER_CLIENTOWNED)=20
<FONT color=3Dblue><SPAN=20
style=3D"COLOR: blue">throw</SPAN></FONT>()</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =20
{</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =
ATL::CAccessorBase::Bind(</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> &=
nbsp; =20
pBinding,</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> &=
nbsp; =20
nOrdinal,</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> &=
nbsp; =20
wType,</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> &=
nbsp; =20
nLength,</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> &=
nbsp; =20
nPrecision,</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> &=
nbsp; =20
nScale,</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> &=
nbsp; =20
eParamIO,</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =
nDataOffset,</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> &=
nbsp; =20
nLengthOffset,</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> &=
nbsp; =20
nStatusOffset,</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> &=
nbsp; =20
pdbobject);</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT face=3D"Times =
New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =
pBinding->dwMemOwner =3D dwMemOwner;</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =20
}</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT face=3D"Times =
New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =20
<FONT color=3Dblue><SPAN style=3D"COLOR: blue">static</SPAN></FONT> =
<FONT=20
color=3Dblue><SPAN style=3D"COLOR: blue">inline</SPAN></FONT> <FONT=20
color=3Dblue><SPAN style=3D"COLOR: blue">void</SPAN></FONT> =
FreeType(DBTYPE=20
wType, BYTE* pValue, DBMEMOWNER dwMemOwner) <FONT color=3Dblue><SPAN =
style=3D"COLOR: blue">throw</SPAN></FONT>()</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =20
{</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =
<FONT color=3Dblue><SPAN style=3D"COLOR: blue">if</SPAN></FONT> =
((wType &=20
DBTYPE_BYREF) && (dwMemOwner =3D=3D=20
DBMEMOWNER_CLIENTOWNED))</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =
{</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> &=
nbsp; =20
<FONT color=3Dblue><SPAN style=3D"COLOR: blue">void</SPAN></FONT> * =
pData =3D=20
*(<FONT color=3Dblue><SPAN style=3D"COLOR: blue">void</SPAN></FONT>=20
**)pValue;</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT face=3D"Times =
New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> &=
nbsp; =20
<FONT color=3Dblue><SPAN style=3D"COLOR: blue">if</SPAN></FONT> =
(pData !=3D=20
NULL)</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> &=
nbsp; =20
CoTaskMemFree(pData);</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =
}</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =
<FONT color=3Dblue><SPAN=20
style=3D"COLOR: blue">else</SPAN></FONT></SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> &=
nbsp; =20
ATL::CAccessorBase::FreeType(wType, pValue);</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =20
}</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT face=3DArial =
color=3Dnavy=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: =
Arial">};</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT face=3D"Times =
New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT face=3DArial =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Then the accessor I =
used has the=20
following (the SQL Server data type I am using is =
text):</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT face=3D"Times =
New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =20
<FONT color=3Dblue><SPAN style=3D"COLOR: blue">char</SPAN></FONT>=20
* m_pszData;</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =20
DBLENGTH m_DataLength;</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"> =20
DBSTATUS m_DataStatus;</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'">...</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in; TEXT-INDENT: =
0.5in"><FONT=20
face=3D"Courier New" size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'">COLUMN_ENTRY_EX_BYREF(5,=20
DBTYPE_STR | DBTYPE_BYREF, <FONT color=3Dblue><SPAN=20
style=3D"COLOR: blue">sizeof</SPAN></FONT>(<FONT color=3Dblue><SPAN=20
style=3D"COLOR: blue">char</SPAN></FONT> *), 0, 0, m_pszData, =
m_DataLength,=20
m_DataStatus, DBMEMOWNER_CLIENTOWNED)</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT face=3D"Times =
New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT face=3DArial =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Hope this=20
helps.</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT face=3DArial =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Duncan =
Smith</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT face=3D"Times =
New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1in"><FONT face=3D"Times =
New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1.5in"><FONT =
face=3DTahoma size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">-----Original=20
Message-----<BR><B><SPAN style=3D"FONT-WEIGHT: =
bold">From:</SPAN></B> Erik=20
Valdes [mailto:[email protected]] <BR><B><SPAN=20
style=3D"FONT-WEIGHT: bold">Sent:</SPAN></B> Thursday, January 09, =
2003 1:17=20
PM<BR><B><SPAN style=3D"FONT-WEIGHT: bold">To:</SPAN></B>=20
[email protected]<BR><B><SPAN=20
style=3D"FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [OLEDB_DEV] AW:=20
[OLEDB_DEV] OLE DB Consumer Templates</SPAN></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1.5in"><FONT =
face=3D"Times New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P style=3D"MARGIN-LEFT: 1.5in"><FONT face=3D"Times New Roman" =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">Hi,</SPAN></FONT> </P>
<P style=3D"MARGIN-LEFT: 1.5in"><FONT face=3D"Times New Roman" =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">I see what you mean about MS recommending =
the=20
storage object way. I've found a lot of articles describing=20
that. However, I'm having trouble finding anything that gives =
an=20
example of how to do the in-memory way. Perhaps someone could =
point me=20
to an example or a how-to document? I'd really appreciate =
it. =20
</SPAN></FONT></P>
<P style=3D"MARGIN-LEFT: 1.5in"><FONT face=3D"Times New Roman" =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">Thanks,</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">Erik</SPAN></FONT> </P>
<P style=3D"MARGIN-LEFT: 1.5in"><FONT face=3D"Times New Roman" =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">-----Original Message-----</SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">From: Yuancai Ye [<A=20
href=3D"mailto:[email protected]">mailto:[email protected]</A>]=20
</SPAN></FONT><BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">Sent: Thursday,=20
January 09, 2003 9:57 AM</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">To: =
[email protected]</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: 10pt">Subject: Re: =
[OLEDB_DEV] AW:=20
[OLEDB_DEV] OLE DB Consumer Templates</SPAN></FONT> </P>
<P style=3D"MARGIN-LEFT: 1.5in"><FONT face=3D"Times New Roman" =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">Hi,</SPAN></FONT> <BR><FONT size=3D2><SPAN =
style=3D"FONT-SIZE: 10pt"> MS recommends us to use =
storage=20
object for sending</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">a BLOB into a data source. However, as I =
tested,=20
this</SPAN></FONT> <BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">way is bad=20
in many cases since your code needs to</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">create a store object and database needs =
to=20
recover</SPAN></FONT> <BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">binnary=20
data from the store object. You'd better use</SPAN></FONT> <BR><FONT =
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">in-memory way to send BLOB =
for faster=20
speed. With use</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">of in-memory way, the previous two extra =
steps=20
are</SPAN></FONT> <BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">avoided.=20
Therefore, in-memory way is faster. That is</SPAN></FONT> <BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">my guess. Test it=20
yourself.</SPAN></FONT> </P>
<P style=3D"MARGIN-LEFT: 1.5in"><FONT face=3D"Times New Roman" =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">Regards,</SPAN></FONT> </P>
<P style=3D"MARGIN-LEFT: 1.5in"><FONT face=3D"Times New Roman" =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">Yuancai (Charlie) Ye</SPAN></FONT> </P>
<P style=3D"MARGIN-LEFT: 1.5in"><FONT face=3D"Times New Roman" =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">--- Rudolf Wiener <[email protected]> =
wrote:</SPAN></FONT> <BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">>=20
Erik,</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> For reading and writing blobs, which =
is what=20
you're</SPAN></FONT> <BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">> in=20
fact using, I use the</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> technologies recommended and stream =
the data=20
with a</SPAN></FONT> <BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">>=20
storage object. The</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> macro I use in the accessor =
is</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: 10pt">>=20
BLOB_ENTRY_LENGTH_STATUS. I'm not sure if</SPAN></FONT> <BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> this is the best way =
to do it=20
because I have the</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> impression it slows =
things</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> down a bit. =
But I=20
haven't had the time yet to look</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> into faster =
alternatives.</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">></SPAN></FONT> <BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> If you like I can send =
you=20
excerpts from my app's</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> code.</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> Regards</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> Rudi</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> =
-----Urspr&#40689;gliche=20
Nachricht-----</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> Von: =
OLEDB_DEV</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> [<A=20
=
href=3D"mailto:[email protected]">mailto:[email protected]=
velop.com</A>]Im=20
Auftrag von</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> Erik</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> Valdes</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> Gesendet: Donnerstag, 09. =
J&#37592;ner 2003 17:22</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> An:=20
[email protected]</SPAN></FONT> <BR><FONT size=3D2><SPAN =
style=3D"FONT-SIZE: 10pt">> Betreff: Re: [OLEDB_DEV] =
OLE DB=20
Consumer Templates</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> The reason I can't =
allocate on the=20
stack is that</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> my variable can be any</SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> length. It =
essentially boils=20
down to the string</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> representation of an =
xml</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> file. =
That file=20
can be any size. When I pass it to</SPAN></FONT> <BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> my SP, the =
sp's</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> parameter is =
ntext (to=20
allow for any size). What</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> do people do when they</SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> want to pass XML of =
unknown length=20
to a SQL Server</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> stored procedure?</SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">></SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">></SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">></SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> =
-----Original=20
Message-----</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> From: Peter Moss [<A=20
=
href=3D"mailto:[email protected]">mailto:[email protected]</A>]</SPAN></FON=
T>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> =
Sent:=20
Thursday, January 09, 2003 7:58 AM</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> To:=20
[email protected]</SPAN></FONT> <BR><FONT size=3D2><SPAN =
style=3D"FONT-SIZE: 10pt">> Subject: Re: [OLEDB_DEV] =
OLE DB=20
Consumer Templates</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> If I remember right, you =
can't use=20
the macros for</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> heap-allocated</SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> variables. If =
you dig into=20
the macro definitions, I</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> believe you will find</SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> that pointers offset =
from the=20
beginning of 'this'</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> are used. Thus, a</SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> heap-allocated =
variable like=20
m_WorkRequest will not</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> work.</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> Why can't you just =
allocate a TCHAR=20
on the stack</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> frame of the object, =
ie,</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">></SPAN></FONT> <BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">></SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">></SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> TCHAR=20
m_WorkRequest[257]; // Or 1 + the =
size</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> of your SP =
parameter=20
size</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> Then you can just use=20
COLUMN_ENTRY.</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> HTH,</SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">></SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> =
Peter</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">></SPAN></FONT> <BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">> =20
-----Original Message-----</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> From:=20
OLEDB_DEV</SPAN></FONT> <BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">>=20
[<A=20
=
href=3D"mailto:[email protected]">mailto:[email protected]=
VELOP.COM</A>]On=20
Behalf Of</SPAN></FONT> <BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">>=20
Erik</SPAN></FONT> <BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">>=20
Valdes</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> Sent: =
Wednesday,=20
January 08, 2003 5:22 PM</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> To:=20
[email protected]</SPAN></FONT> <BR><FONT size=3D2><SPAN =
style=3D"FONT-SIZE: 10pt">> Subject: =
[OLEDB_DEV]=20
OLE DB Consumer Templates</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> I'm having =
trouble=20
implementing an accessor.</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> I'm trying to use a</SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> variable =
(m_WorkRequest) that's=20
dynamically</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> allocated as the variable =
that's</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> bound to a =
parameter in=20
my accessor (commented line</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> below). The reason =
I</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> need it to =
be dynamic is=20
that it is XML and can be</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> any length. The =
stored</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> proc's =
parameter is of=20
ntext type to handle the</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> variable length. However, =
I</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> don't know =
at compile=20
time how big to make the</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> buffer for my parameter in =
my</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> =
accessor. What's=20
the proper way to do this? I've</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> tried COLUMN_ENTRY</SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> (access violation),=20
COLUMN_ENTRY_LENGTH (different</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> variations produce</SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> different errors, but =
basically I=20
can't set the</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> length),</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> COLUMN_ENTRY_TYPE_SIZE (similar =
problems as=20
the</SPAN></FONT> <BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">>=20
previous). I'm running out</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> of ideas now. The code below is =
just one=20
of many,</SPAN></FONT> <BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">>=20
many variations I've</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> tried.</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> class=20
CAddWorkRequest</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> =
{</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">></SPAN></FONT> <BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">> =20
public:</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: =
10pt">> =20
CAddWorkRequest() STD_INIT</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: =
10pt">> =20
~CAddWorkRequest()</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: =
10pt">> =20
{</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: =
10pt">> =20
if (m_WorkRequest)</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: =
10pt">> &nb=
sp; =20
delete [] m_WorkRequest;</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: =
10pt">> =20
}</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: =
10pt">> LONG=20
m_RETURNVALUE;</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: =
10pt">> =20
LPTSTR m_WorkRequest;</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: =
10pt">> LONG=20
m_lLength;</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: =
10pt">> void=20
SetStringParam(LPCTSTR szString,int</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> cBytes)</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: =
10pt">> =20
{</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: =
10pt">> =20
m_WorkRequest =3D (LPTSTR) new</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> TCHAR[cBytes];</SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">></SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: =
10pt">> =20
_tcsncpy(m_WorkRequest,szString,cBytes);</SPAN></FONT> <BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">></SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: =
10pt">> =20
m_lLength =3D _tcslen(m_WorkRequest);</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: =
10pt">> =20
})</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> =20
BEGIN_PARAM_MAP(CAddWorkRequest)</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: =
10pt">> =20
SET_PARAM_TYPE(DBPARAMIO_OUTPUT)</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: =
10pt">> =20
COLUMN_ENTRY(1, m_RETURNVALUE)</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: =
10pt">> =20
SET_PARAM_TYPE(DBPARAMIO_INPUT)</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> =
//</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">></SPAN></FONT> <BR><FONT=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: =
10pt">COLUMN_ENTRY_TYPE_SIZE(2,DBTYPE_STR,_tcslen(m_WorkRequest),</SPAN><=
/FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: 10pt">>=20
m_WorkRequest)</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> =20
END_PARAM_MAP()</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> =20
DEFINE_COMMAND(CAddWorkRequest, _T("{ ? =3D CALL</SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> =
dbo.AddWorkRequest;1</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: 10pt">> (?) =
}"))</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">></SPAN></FONT> <BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">></SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">></SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">> =20
};</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> class=20
CAddWorkRequestCommand : public</SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">>=20
CBsDbCommand<CAddWorkRequest></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> =
{</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">></SPAN></FONT> <BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">> =20
};</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> foo (LPTSTR=20
szWor)</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">></SPAN></FONT> <BR><FONT =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">> =
{</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: =
10pt">></SPAN></FONT> <BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">></SPAN></FONT> =
<BR><FONT=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt">=3D=3D=3D message truncated =
=3D=3D=3D</SPAN></FONT>=20
</P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 1.5in"><FONT =
face=3D"Times New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P style=3D"MARGIN-LEFT: 1.5in"><FONT face=3D"Times New Roman" =
size=3D2><SPAN=20
style=3D"FONT-SIZE: =
10pt">__________________________________________________</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: 10pt">Do you =
Yahoo!?</SPAN></FONT>=20
<BR><FONT size=3D2><SPAN style=3D"FONT-SIZE: 10pt">Yahoo! Mail Plus =
- Powerful.=20
Affordable. Sign up now.</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt"><A href=3D"http://mailplus.yahoo.com"=20
target=3D_blank>http://mailplus.yahoo.com</A></SPAN></FONT> </P>
<P style=3D"MARGIN-LEFT: 1.5in"><FONT face=3D"Times New Roman" =
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">You can read messages from the OLEDB_DEV =
archive,=20
unsubscribe from OLEDB_DEV,</SPAN></FONT> <BR><FONT size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt">or subscribe to other DevelopMentor lists =
at <A=20
href=3D"http://discuss.develop.com"=20
target=3D_blank>http://discuss.develop.com</A>.</SPAN></FONT> </P>
<P class=3DMsoNormal style=3D"MARGIN-LEFT: 0.5in"><FONT =
face=3D"Times New Roman"=20
size=3D3><SPAN style=3D"FONT-SIZE: 12pt">You can read messages from =
the=20
OLEDB_DEV archive, unsubscribe from OLEDB_DEV, or subscribe to other =
DevelopMentor lists at http://discuss.develop.com. You can read =
messages=20
from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV, or subscribe =
to=20
other DevelopMentor lists at You can read messages from the =
OLEDB_DEV=20
archive, unsubscribe from OLEDB_DEV, or subscribe to other =
DevelopMentor=20
lists at http://discuss.develop.com.=20
http://discuss.develop.com.</SPAN></FONT></P></BLOCKQUOTE></DIV>You =
can read=20
messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV, You =
can read=20
messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV, or =
subscribe=20
to other DevelopMentor lists at http://discuss.develop.com. or =
subscribe to=20
other DevelopMentor lists at=20
http://discuss.develop.com.</BLOCKQUOTE></BODY></HTML>
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_000_0061_01C2B801.937FCEA0--