Page 1 of 1
Loading while post or retrieve large BLOB field, HOW ?
Posted: Mon 13 Apr 2009 12:48
by munggaran
I have BLOB field about 15 Megs per field which want to be stored/retrieved via client/server application. My user wants :
1. Information on how much the stream has been stored/retrieved during the process (like progress bar, or something)
2. Cancel progress (in case the user feel the progress is too long, he can cancel the process)
Is that possible to do with uniDAC ?
Regards,
Eldi Munggaran
ps.
I'm sorry if I have posted on wrong thread here :
http://devart.com/forums/viewtopic.php?p=44579#44579
I repost here my question (for uniDAC, not pgDAC) :
Posted: Tue 14 Apr 2009 06:51
by Plash
The latest version of UniDAC (2.50.0.6) contains the TUniLoader component that can be used in the same way as TPgLoader.
Posted: Tue 14 Apr 2009 10:20
by munggaran
Thanx dude..., goin ~~~
Posted: Wed 15 Apr 2009 07:39
by munggaran
@plash
could you give me an example ?, or is there any help I can go with ?
Posted: Thu 16 Apr 2009 07:18
by Plash
You can find an example in general UniDacDemo that is located in
\Demos\Win32\UniDacDemo.
See Loader in this demo.
You can also see the description of TUniLoader in UniDAC help.
Posted: Thu 16 Apr 2009 23:14
by munggaran
I opened the demo, but it seems to working on multiple records

. Well what I want just a loader for single field I need to fetch, e.g. "SELECT fMyRichText FROM tbMyTable WHERE id = 1"
errr......., it would be grateful if you could give an example

Posted: Fri 17 Apr 2009 13:22
by Plash
UniDAC loads BLOB value as one operation. You cannot display its progresst. But loading one BLOB value should be fast. So progress bar is not required.
You can display progress on reading BLOB value. Set the CacheLobs specific option of Oracle provider to False for the TUniQuery component. In this case TUniQuery does not reads BLOB value when you open the query. You can read BLOB value in your code (add MemData unit to USES):
Code: Select all
const
BlockSize = $F000;
var
Blob: TBlob;
Buffer: array of byte;
p: pointer;
Pos, Count: integer;
begin
UniQuery1.Open;
Blob := UniQuery1.GetBlob('f_blob');
SetLength(Buffer, Blob.Size);
ProgressBar.Position := 0;
Application.ProcessMessages;
Pos := 0;
p := Buffer;
repeat
Count := Blob.Read(Pos, BlockSize, p);
ProgressBar.Position := Round(Pos/Blob.Size * 100);
Application.ProcessMessages;
Pos := Pos + Count;
p := Pointer(Integer(p) + Count);
until Count < BlockSize;
end;
Posted: Mon 20 Apr 2009 07:07
by munggaran
@plash
im using UniDAC with postgreSQL, err... i've also look on TUniQuery but found no CacheLobs property, is CacheLobs only for oracleDAC ?
Posted: Tue 21 Apr 2009 07:03
by Plash
Please specify whether your table has BYTEA field or OID field that references to a large object.
TUniQuery has the CacheBlobs specific option for the PostgreSQL provider. But this option is used only for OID fields that references to a large object.
Posted: Tue 21 Apr 2009 11:13
by munggaran
i'm using BYTEA field..., should I change into OID ?, fyi i'm using the field to store richEdit memory stream.
Posted: Wed 22 Apr 2009 08:00
by Plash
You should not change the data type of the column because Large Objects are complicated in use.
UniDAC loads and reads a value of BYTEA field as one operation. You cannot display progress for it. This operation should not take much time.