Issue Details (XML | Word | Printable)

Key: CORE-3952
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Klaus Mühlböck
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Increasing database filesize with Blob in UDF functions

Created: 11/Oct/12 06:57 PM   Updated: 29/May/13 10:03 PM
Component/s: UDF
Affects Version/s: 2.5.1
Fix Version/s: None

Environment: UDF 32bit dll developed with Delphi XE2, 64bit Windows 7and Server 2008
Issue Links:
Relate
 


 Description  « Hide
We use a UDF to upload and download files to the database server. This works fine, but the filesize of the database increasesby the size of the file which is transfered. I think, that the database server uses the database file as a cache. As we are transfering many very large files this causes problems.

procedure GETFILE(FileName: PAnsiChar; Blob: PBlob);
var
  Daten: TMemoryStream;
  Buffer: array [0 .. 4096 - 1] of AnsiChar;
  count: int;
begin
  FillChar(Buffer, SizeOf(Buffer), #0);
  Daten := TMemoryStream.Create;
  try
    Daten.LoadFromFile(StrPas(FileName));
...
      Blob^.MaxSegmentLength := SizeOf(Buffer);
          count := 1;
          while count > 0 do
          begin
            FillChar(Buffer, SizeOf(Buffer), #0);
            count := Daten.Read(Buffer, SizeOf(Buffer));
            Blob^.PutSegment(Blob^.BlobHandle, @Buffer, count);
          end;
 ...
finally
    Daten.Free;

many thanks for your support
Klaus

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Vlad Khorsun added a comment - 11/Oct/12 08:00 PM
It is not a bug, it is how blob works. They are not for transfer between filesystem and client application, they are for storing data in database.
What you want is another feature, like filestream in mssql.

Adriano dos Santos Fernandes added a comment - 11/Oct/12 08:13 PM
I cannot check now, but there is a bpb for temporary blobs. That would fill temporary space instead of the database, would not?

Vlad Khorsun added a comment - 11/Oct/12 08:25 PM
Adriano,
no, there is no use of bpb in fun.epp. It used BLB_create, not BLB_create2 for returned blobs.