Autor Beitrag
moloch
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 451

Win 2000
D5 Prof
BeitragVerfasst: Mi 09.04.08 09:18 
Hallo,
bei einer MSSQL- DB kann ich ohne Probleme ein Blob-Feld auslesen mit
result := q.fieldbyname('Blobwert').Asstring;

bei paradox kriege ich '' also leer zurück.. was muss ich dort anders machen?

Gruß
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 09.04.08 10:21 
Und so:
ausblenden Delphi-Quelltext
1:
result := q.fieldbyname('Blobwert').Value;					

?

_________________
Markus Kinzler.
moloch Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 451

Win 2000
D5 Prof
BeitragVerfasst: Mi 09.04.08 10:24 
leider auch nicht
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 09.04.08 10:29 
Dann wirst du wohl den Inhalt aus dem Stream laden müssen.

_________________
Markus Kinzler.
moloch Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 451

Win 2000
D5 Prof
BeitragVerfasst: Mi 09.04.08 10:33 
kannst du das beschreiben oder ein beispiel machen bitte
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 09.04.08 10:41 

_________________
Markus Kinzler.
moloch Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 451

Win 2000
D5 Prof
BeitragVerfasst: Mi 09.04.08 10:48 
ok danke das probier ich mal aus..
moloch Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 451

Win 2000
D5 Prof
BeitragVerfasst: Mo 02.06.08 15:46 
@mkinzler
wie hole ich die info jetzt in einen string..
also wenn ich so lese eigentlich (result ist ein string)
ausblenden Delphi-Quelltext
1:
 result := q.fieldbyname('Blobwert').Asstring;					

wie kann ich das anwenden hier wofür du einen link zur verfügung gestellt hast?

gruß
moloch Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 451

Win 2000
D5 Prof
BeitragVerfasst: Di 03.06.08 09:56 
was ist daran falsch? also ich bekomme einfach nichts ausgelesen.. wenn ich mit der maus über .text oder .value oder .asstring halte zeigt ein hint die meldung "ungültiger Ausdruck im Evaluator"

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
function GetBlob: string;
var
  i: Integer;
  sH: string;
  q: TQuery;
  Blobfield: TBlobField;
begin
  sH := 'select * from Table);
  q := GetTheSQL();
  if q <> nil then begin
    Blobfield := TBlobfield.Create(nil);
    try
      q.first;
      for i := 0 to q.RecordCount - 1 do begin
        result := (q.Fieldbyname('
BLOBWERT') as TBlobField).Text;

        break;
      end;
    finally
      Blobfield.Free;
    end;
  end;
end;
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Di 03.06.08 10:03 
user profile iconmoloch hat folgendes geschrieben:
was ist daran falsch? also ich bekomme einfach nichts ausgelesen.. wenn ich mit der maus über .text oder .value oder .asstring halte zeigt ein hint die meldung "ungültiger Ausdruck im Evaluator"

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
function GetBlob: string;
var
  i: Integer;
  sH: string;
  q: TQuery; //Objekt Query..wo wird das erzeugt oder hab ich grad nen Denkfehler?
  Blobfield: TBlobField;
begin
  sH := 'select * from Table'; //Tabelle 'Table'? Sicher??
  q := GetTheSQL();
  if q <> nil then begin
    Blobfield := TBlobfield.Create(nil);
    try
      q.first;
      for i := 0 to q.RecordCount - 1 do begin
        result := (q.Fieldbyname('BLOBWERT') as TBlobField).Text;

        break; //Wozu das break?
      end;
    finally
      Blobfield.Free;
    end;
  end;
end;


Was ich nich versteh...warum machst du ne Schleife und dann sofort n break rein..ist das nur für Debuggingzwecke?

Find die ganze Konstruktion irgendwie..komisch ;-)

LG
Stefan

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
moloch Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 451

Win 2000
D5 Prof
BeitragVerfasst: Di 03.06.08 10:13 
break vergessen bitte... war noch von einem anderen versuch..
bitte aufs wesentliche... hast du einen tip ?
moloch Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 451

Win 2000
D5 Prof
BeitragVerfasst: Di 03.06.08 10:14 
geht wirklich nur um das blobfeld. bei mssql funktioniert alles
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Di 03.06.08 10:31 
Bei Blobs wird die Text / AsString - Eigenschaft nicht gesetzt. Ein TBlobField hat die Blob-Daten jedoch als Stream vorrätig. Erzeuge einen TStringStream, lies die Daten in den StringStream und rufe sie z.B. über die 'DataString'-Eigenschaft ab.

_________________
Na denn, dann. Bis dann, denn.
moloch Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 451

Win 2000
D5 Prof
BeitragVerfasst: Di 03.06.08 10:43 
hast du dafür ein beispiel? habs ja mit blobstream schon versucht..
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Di 03.06.08 10:54 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
Function BlobToString (aBlobField : TBlobField) : String;
Var
  sStringStream : TStringStream;

Begin
  Result := '';
  sStringStream := TStringStream.Create('');
  Try
    aBlobField.SaveToStream(sStringStream);
    Result := sStringStream.DataString;
  Finally
    sStringStream.free
  End;
End;

BLOBs können auch nichtdruckbare Zeichen enthalten. Insofern ist eine Verarbeitung als String nicht zu empfehlen. Ich würde (z.B. für COM) auf Variants umsteigen (Variant Array Of Byte).

_________________
Na denn, dann. Bis dann, denn.
moloch Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 451

Win 2000
D5 Prof
BeitragVerfasst: Di 03.06.08 11:23 
kriege leider weiterhin nichts zurück.. bei mssql funktioniert es jedoch nach deinem beispiel..
evtl liegt es noch am reinschreiben...
so schreibe ich rein

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
function StreamToOraDatabase(sSql, Alias, sSessionName: string; var bs: TMemoryStream): boolean;
var
  OraQuery: TOraQuery;

begin
  result := false;
  SyncFree.BeginWrite;
  try
    OraQuery := GetOraQuery(Alias, sSessionname);
    try
      try
        with OraQuery do begin
          Active := false;
          SQL.Text := sSql;
          Params[0].SetBlobData(bs.Memory, bs.Size);
          Execute;
          result := true;
        end;
      except
        on e: exception do begin
          showmyerror('StreamToOraDatabase: ' + e.Message);
          showmyerror('StreamToOraDatabase: ' + ssql);
        end;
      end;
    finally
    end;
  finally
    SyncFree.endWrite;
  end;
end;
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Di 03.06.08 11:25 
Mit Oracle kenn ich mich leider nicht aus. Was liefert denn ein einfaches SELECT in der Konsole?

_________________
Na denn, dann. Bis dann, denn.
moloch Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 451

Win 2000
D5 Prof
BeitragVerfasst: Di 03.06.08 11:35 
nichts ausser "bindata"
moloch Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 451

Win 2000
D5 Prof
BeitragVerfasst: Di 03.06.08 16:12 
kann denn hier keiner helfen.. das muss doch möglich sein
naja oracle mal wieder
mikhal
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 109

Windows 10 Professional 64-Bit
VS 215 CE, Delphi 10.1 Berlin Professional
BeitragVerfasst: Do 05.06.08 16:31 
Zum Auslesen verwende ich folgendes Verfahren:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm2.qryTestAfterScroll(DataSet: TDataSet);
begin
  if qryTest.FindField('EXT').AsString = '.bmp' then
    imgTest.Picture.Assign((qryTest.FindField('PIC') As TBlobField));
end;


Ich führe in meiner Tabelle immer ein Feld mit der Extension der Datei, die ich im BlobFeld abgelegt habe. In diesem Fall lade ich in ein TImage den Inhalt eines Blobfeldes, das mit einer Bitmap-Grafik gefüllt ist. Für andere Datentypen musst du selbst geeignete Verfahren verwenden. Schreiben kannst du Daten auf die gleiche Art und Weise.

Verwendet habe ich für diesen Schnipsel die ODAC-Zugriffskomponenten von CoreLabs mit Zugriff auf eine Oracle 9i. Es funktioniert aber auch mit anderen Zugriffskomponenten (siehe dazu auch meine Homepage).

Grüße
Mikhal
[edit] Link zur Homepage[/edit]

_________________
Computer erleichtern die Arbeit...
...und die Erde ist eine Scheibe!