 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
sener Guest
|
Posted: Tue Jul 22, 2003 7:18 am Post subject: How pass the Blob field (BlobField.AsString) to Client |
|
|
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
|
Posted: Tue Jul 22, 2003 12:26 pm Post subject: Re: How pass the Blob field (BlobField.AsString) to Client |
|
|
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 |
|
 |
|
|
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
|
|