BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How pass the Blob field (BlobField.AsString) to Client

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Multi-Tier)
View previous topic :: View next topic  
Author Message
sener
Guest





PostPosted: Tue Jul 22, 2003 7:18 am    Post subject: How pass the Blob field (BlobField.AsString) to Client Reply with quote




How can I pass the Blob field (BlobField.AsString) to
client by using CDS.DataRequest and Provider's OnDataRequest on
AppSrvr.

Clent
var Data: OleVariant;
Data := CDS.Request(..);
// the length of result string is wrong
// Cutted at first #0

AppSrvr
ProviderOnDataRequest(..): OleVariant;
// read somthing from SQLDataSet having BLOB field
Result := SQLdsBLOB_FIELD.AsString;
// Length is OK

thanks
Sener

Back to top
Jaroslav Demin
Guest





PostPosted: Tue Jul 22, 2003 12:26 pm    Post subject: Re: How pass the Blob field (BlobField.AsString) to Client Reply with quote



Good morning/Evening!

I'm not sure if that's what you need.

1. Save value of blob field to stream;
TblobField(aField).SaveToStream(MemoryStream);

2. Convert Stream to Variant
procedure edllVarArrayToStream(const Data: OleVariant; Stream: TStream);
var
p: Pointer;
begin
p := variants.VarArrayLock(Data);
try
Stream.Write(p^, VarArrayHighBound(Data,1) + 1); //assuming low bound =
0
finally
VarArrayUnlock(Data);
end;
end;

function edllStreamToVarArray(Stream: TStream): OleVariant;
var
p: Pointer;
begin
Result := VarArrayCreate([0, Stream.Size - 1], varByte);
p := VarArrayLock(Result);
try
Stream.Position := 0; //start from beginning of stream
Stream.Read(p^, Stream.Size);
finally
VarArrayUnlock(Result);
end;
end;

3. Send it To client;

Hope, it was usefull



"sener" <sdemiral (AT) netscape (DOT) net> wrote

Quote:

How can I pass the Blob field (BlobField.AsString) to
client by using CDS.DataRequest and Provider's OnDataRequest on
AppSrvr.

Clent
var Data: OleVariant;
Data := CDS.Request(..);
// the length of result string is wrong
// Cutted at first #0

AppSrvr
ProviderOnDataRequest(..): OleVariant;
// read somthing from SQLDataSet having BLOB field
Result := SQLdsBLOB_FIELD.AsString;
// Length is OK

thanks
Sener




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Multi-Tier) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.