Ver Mensaje Individual
  #7  
Antiguo 07-06-2018
Avatar de duilioisola
[duilioisola] duilioisola is offline
Miembro Premium
 
Registrado: ago 2007
Ubicación: Barcelona, España
Posts: 1.732
Reputación: 20
duilioisola Es un diamante en brutoduilioisola Es un diamante en brutoduilioisola Es un diamante en bruto
También se me ocurre que tenga el mismo "problema" que los componentes FIBPlus para Firebird.
El componente FBQuery no puede cargar ni leer BLOBs. los devuelve como el texto "Blob".

Para cargar imágenes utilizo TFIBDataSet
Agrego un SelectSQL que no me devuelva nada y un InsertSQL con el que trabajaré

Código Delphi [-]
SelectSQL.Text := 'SELECT CODIGO, NOMBRE, IMAGEN, FORMATO, ORIGEN, RUTA FROM SYS_IMAGENES WHERE CODIGO = 0';
// RefreshSQL.Text := 'SELECT CODIGO, NOMBRE, IMAGEN, FORMATO, ORIGEN, RUTA FROM SYS_IMAGENES WHERE CODIGO = :CODIGO';
InsertSQL.Text := 'INSERT INTO SYS_IMAGENES (CODIGO, NOMBRE, IMAGEN, FORMATO, ORIGEN, RUTA) VALUES (:CODIGO, :NOMBRE, :IMAGEN, :FORMATO, :ORIGEN, :RUTA)';
[...]
// Abro el DataSet
Open;
// Lo pongo en modo dsInsert
Insert;
b := DS.CreateBlobStream(FieldByName('IMAGEN'), bmWrite);
try
    f := TFileStream.Create(Archivo, fmOpenRead);
    try
       b.CopyFrom(f, f.Size);
    finally
       f.Free;
    end;
finally
   b.Free;
end;
FieldByName('NOMBRE').AsString := aFileName;
FieldByName('FORMATO').AsString := aFileExt;
[...]
// Guardo los cambios
Post;
// Cierro el DataSet
Close;
[...]
Responder Con Cita