Fórum Arquivos no banco de dados, executados pelo delphi... #337022
31/01/2007
0
estou desenvolvendo um sistema de organização de arquivos, eu gostaria de poder armazenar arquivos no banco de dados e executa-los quando for preciso, arquivos como .Doc, .XLS,.Pdf...
Como que eu faço para gravar no banco?(Utilizo IB6)
Como que eu executo o arquivo que está gravado no banco de dados?
agradeço a ajuda
Daniel Martins
Curtir tópico
+ 0Posts
01/02/2007
Daniel Martins
Gostei + 0
01/02/2007
Fortaum
procedure AbrirArquivo(F: String); var r: String; begin case ShellExecute(Application.Handle, nil, PChar(F), nil, nil, SW_SHOWNORMAL) of ERROR_FILE_NOT_FOUND: r := ´The specified file was not found.´; ERROR_PATH_NOT_FOUND: r := ´The specified path was not found.´; ERROR_BAD_FORMAT: r := ´The .EXE file is invalid (non-Win32 .EXE or error in .EXE image).´; SE_ERR_ACCESSDENIED: r := ´Windows 95 only: The operating system denied access to the specified file.´; SE_ERR_ASSOCINCOMPLETE: r := ´The filename association is incomplete or invalid.´; SE_ERR_DDEBUSY: r := ´The DDE transaction could not be completed because other DDE transactions were being processed.´; SE_ERR_DDEFAIL: r := ´The DDE transaction failed.´; SE_ERR_DDETIMEOUT: r := ´The DDE transaction could not be completed because the request timed out.´; SE_ERR_DLLNOTFOUND: r := ´Windows 95 only: The specified dynamic-link library was not found.´; SE_ERR_NOASSOC: r := ´There is no application associated with the given filename extension.´; SE_ERR_OOM: r := ´Windows 95 only: There was not enough memory to complete the operation.´; SE_ERR_SHARE: r := ´A sharing violation occurred.´; else Exit; end; ShowMessage(r); end;
Gostei + 0
01/02/2007
Macario
Qual a necessidade dos arquivos armazenados em um SGBDR?
Questão de segurança? Em qual nível?
[]´s
Gostei + 0
01/02/2007
Daniel Martins
eu já uso a sugestão de Gravar o endereço do arquivo numa string e executar com a ShellApi..
Só queria armazenar os arquivos em banco por isso...
se existir uma forma melhor, agradeço..
Gostei + 0
05/02/2007
Daniel Martins
acho q vou fazer isso...
Gostei + 0
05/02/2007
Weber
Antes de executar o arquivo carregue do blob e salve em pasta temporária.
Gostei + 0
05/02/2007
Daniel Martins
Esse é o detalhe, como que grava no blob?
Gostei + 0
05/02/2007
Weber
arq_nome varchar(30)
arq_blob blob
var FStream : TMemoryStream;
//Ler FStream := TMemoryStream.Create; FStream.Position := 0; FStream.CopyFrom(IBQuery1.CreateBlobStream(IBQuery1.FieldByName(´arq_blob´),bmRead),0); FStream.SaveToFile(IBQuery1.FieldByName(´arq_nome´).asString); FStream.free;
//Gravar FStream := TMemoryStream.create; FStream.position := 0; FStream.LoadFromFile(´C:\ARQUIVO.EXE´); if FStream <> nil then begin FStream.Position := 0; IBQuery1.SQL.Clear; IBQuery1.SQL.Add(´INSERT INTO SUATABELA (ARQ_NOME,ARQ_BLOB) VALUES (´); IBQuery1.SQL.Add(´´´ARQUIVO.EXE´´,´); IBQuery1.SQL.Add(:ARQ_BLOB)´); IBQuery1.ParamByName(´ARQ_BLOB´).LoadFromStream(FStream,ftBlob); IBQuery1.ExecSQL; end; FStream.Free;
Não testei, mas deve funcionar!
Gostei + 0
06/02/2007
Daniel Martins
vlw pela ajuda!!!
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)