Article View: borland.public.cppbuilder.database.ado
Article #590Re: ADODB.Stream objects and Variants
From: Viatcheslav V. Vassiliev
Date: Sat, 17 Sep 2005 10:02
Date: Sat, 17 Sep 2005 10:02
67 lines
2598 bytes
2598 bytes
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:
<432be961$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<432aa5ea$1@newsgroups.borland.com> <432b48dd$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: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <432aa5ea$1@newsgroups.borland.com> <432b48dd$1@newsgroups.borland.com> Subject: Re: ADODB.Stream objects and Variants Date: Sat, 17 Sep 2005 14:02:28 +0400 Lines: 69 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2670 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 85.93.138.132 Message-ID: <432be961$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1126951265 85.93.138.132 (17 Sep 2005 03:01:05 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail