Loading while post or retrieve large BLOB field, HOW ?

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
munggaran
Posts: 18
Joined: Sat 11 Apr 2009 08:50

Loading while post or retrieve large BLOB field, HOW ?

Post by munggaran » Mon 13 Apr 2009 12:48

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) :

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 14 Apr 2009 06:51

The latest version of UniDAC (2.50.0.6) contains the TUniLoader component that can be used in the same way as TPgLoader.

munggaran
Posts: 18
Joined: Sat 11 Apr 2009 08:50

Post by munggaran » Tue 14 Apr 2009 10:20

Thanx dude..., goin ~~~

munggaran
Posts: 18
Joined: Sat 11 Apr 2009 08:50

Post by munggaran » Wed 15 Apr 2009 07:39

@plash
could you give me an example ?, or is there any help I can go with ?

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Thu 16 Apr 2009 07:18

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.

munggaran
Posts: 18
Joined: Sat 11 Apr 2009 08:50

Post by munggaran » Thu 16 Apr 2009 23:14

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 :D

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Fri 17 Apr 2009 13:22

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;

munggaran
Posts: 18
Joined: Sat 11 Apr 2009 08:50

Post by munggaran » Mon 20 Apr 2009 07:07

@plash
im using UniDAC with postgreSQL, err... i've also look on TUniQuery but found no CacheLobs property, is CacheLobs only for oracleDAC ?

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 21 Apr 2009 07:03

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.

munggaran
Posts: 18
Joined: Sat 11 Apr 2009 08:50

Post by munggaran » Tue 21 Apr 2009 11:13

i'm using BYTEA field..., should I change into OID ?, fyi i'm using the field to store richEdit memory stream.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 22 Apr 2009 08:00

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.

Post Reply