Autor Beitrag
JoelH
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Mi 05.12.07 12:18 
Ich hab folgenden Code um aus der Datenbank ein Blobfeld auszulesen und die dort gespeicherte Datei auf Platte zu schreiben.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
procedure Tmain.erzeuge_file(filename:String;mailid:Integer);
var xs:TFilestream;
    bs:TBlobstream;
begin
  deletefile(filename);
  with qry_anhang do
  begin
    close;
    sql.clear;
    sql.add('SELECT DATEI "datei" FROM DB.EMAIL_VERSAND ');
    sql.add(' WHERE LFDNR = :p_LFDNR');
    ParamByName('p_LFDNR').asInteger := mailid;
  end;
  qry_anhang.Open;
  bs := TBlobstream.Create(TBlobfield(qry_anhang.FieldByName('datei')),bmread);
  xs := TFileStream.Create(filename,fmCreate);
  xs.CopyFrom(bs,0);
  xs.Free;
  bs.Free;
end;

Der funktioniert aber irgendwie nicht ganz. Er speichert immer nur die ersten 32 KB. Sprich, ist das File in der DB kleiner als 32 KB funtioniert der Code, ist das File im Blobfeld größer hab ich pech :( Ich denke es ist ein kleines Detailproblem, allerdings steh ich total auf dem Schlauch im Moment.

_________________
mfg. Joel
Stefan.Buchholtz
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 612

WIN 2000, WIN XP, Mac OS X
D7 Enterprise, XCode, Eclipse, Ruby On Rails
BeitragVerfasst: Mi 05.12.07 12:40 
Arbeitest du mit der BDE? In der BDE gibt es für eine Datenbankverbindung den Parameter BLOB SIZE, der die Größe von Blob-Daten begrenzt. Der ist standardmäßig auf 32 KB eingestellt. Den kannst du bis maximal 999 hochsetzen, um größere Blobs lesen zu können.

Stefan

_________________
Ein Computer ohne Windows ist wie eine Schokoladentorte ohne Senf.
JoelH Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Mi 05.12.07 13:07 
Ich wusste dass es etwas total triviales ist. Aber manchmal steht man gerade dann wie der Ochs vorm Berg.

Danke!

_________________
mfg. Joel