Article View: borland.public.cppbuilder.database.ado
Article #594Re: ADODB.Stream objects and Variants
From: Russell Allen
Date: Fri, 23 Sep 2005 11:11
Date: Fri, 23 Sep 2005 11:11
77 lines
3048 bytes
3048 bytes
Thanks guys,
This looks like exactly what I was after! Very much appreciated. :)
Russ
"Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote:
>You can use
>
>TVariant v = iunk;
>
>instead of pStream and pass it to ADO. This will remove a need to have
>second stream.
>
>//------------------------------------------
>Regards,
>Vassiliev V. V.
>http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
>ADO.Net
>http://www.oledbdirect.com - The fastest way to access MS SQL Server,
>MS Jet (Access) and Interbase (through OLEDB)
>
>"Mark Guerrieri" <mguerrieri@nospam_cmsgrp.com> �������/�������� � ��������
>���������: news:432b48dd$1@newsgroups.borland.com...
>> Import the ADO type library and include the resulting import file, i.e.
>>
>> #include "AdoDb_TLB.H"
>>
>> Then you can do this:
>>
>> void putStream (TMemoryStream *memStream)
>> {
>> StreamPtr pStream = CoStream::Create();
>> OLECHECK(pStream->Open( {appropriate open parameters} ));
>>
>> memStream->Seek(0, soFromBeginning);
>> bool FReleaseStream = true;
>> TStreamAdapter *sa = new TStreamAdapter(memStream, soReference);
>> if(!sa)
>> throw Exception("Could not create Stream interface");
>> try
>> {
>> IUnknown* iunk = NULL;
>> try
>> {
>> OLECHECK(sa->QueryInterface(IID_IUnknown, (LPVOID*)&iunk));
>> if(iunk == NULL)
>> throw Exception("Stream interface does not implement the IUnknown
>> interface");
>>
>> TVariant v = iunk;
>>
>> OLECHECK2(pStream->Write(v));
>> }
>> __finally
>> {
>> if(iunk)
>> {
>> FReleaseStream = false;
>> iunk->Release();
>> }
>> }
>> }
>> __finally
>> {
>> if(FReleaseStream && sa)
>> delete sa;
>> }
>> }
>>
>>
>> Mark
>>
>>
>
>
Technical Details
Message-ID:
<4333e2fb$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!83.128.0.11.MISMATCH!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!bandi.nntp.kabelfoon.nl!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<432aa5ea$1@newsgroups.borland.com> <432b48dd$1@newsgroups.borland.com> <432be961$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,2a0e8802e733b24c X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII From: "Russell Allen" <russell.allen@bt.com> Sender: "Russell Allen" <russell.allen@bt.com> Reply-To: "Russell Allen" <russell.allen@bt.com> Subject: Re: ADODB.Stream objects and Variants Newsgroups: borland.public.cppbuilder.database.ado X-User-Info: 193.113.57.163 X-Forwarded-For: 10.229.16.56 References: <432aa5ea$1@newsgroups.borland.com> <432b48dd$1@newsgroups.borland.com> <432be961$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <4333e2fb$1@newsgroups.borland.com> Date: 23 Sep 2005 04:11:55 -0700 X-Trace: newsgroups.borland.com 1127473915 207.105.83.66 (23 Sep 2005 04:11:55 -0700) Lines: 78 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!83.128.0.11.MISMATCH!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!bandi.nntp.kabelfoon.nl!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail