Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increasing database filesize with Blob in UDF functions [CORE3952] #4285

Open
firebird-automations opened this issue Oct 11, 2012 · 6 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Klaus Mühlböck (1a-archiv)

Relate to CORE3953
Relate to CORE3951

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

@firebird-automations
Copy link
Collaborator Author

Modified by: Klaus Mühlböck (1a-archiv)

security: Developers [ 10012 ] =>

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

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.

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

I cannot check now, but there is a bpb for temporary blobs. That would fill temporary space instead of the database, would not?

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Adriano,
no, there is no use of bpb in fun.epp. It used BLB_create, not BLB_create2 for returned blobs.

@firebird-automations
Copy link
Collaborator Author

Modified by: Sean Leyne (seanleyne)

Link: This issue relate to CORE3953 [ CORE3953 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: Sean Leyne (seanleyne)

Link: This issue relate to CORE3951 [ CORE3951 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant