Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I insert and retrieve a file to/from a BINARY BLOB?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How do I insert and retrieve a file to/from a binary BLOB?
 
What programming language are you using?

For example, take a statement like:

INSERT INTO mypictures (ID, PICTURE) VALUES (1, :myblobparam)

In Delphi, you can prepare the statement, then call the ParamByName('myblobparam').LoadFromFile and so on...

Hope this helps,
Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
 
It seems easy, but how to retrieve the file?

What I mean is how to retrieve the data from the blob (what I inserted) to a file?

to insert i use:

ibquery1.close;
ibquery1.sql.clear;
ibquery1.sql.add ('INSERT INTO mytable ' +
'DATA ' +
') VALUES (' +
':data ' +
');');
ibquery1.parambyname ('DATA').loadfromfile ('data.dat',ftblob);
ibquery1.open;

HOW TO RETRIEVE THE FILE THAT I INSERTED WHERE???
 
Try the Delphi help ...

TBLOBField -> the class that represents blob fields in a resultset, has two methods to help you with that: SaveToFile and SaveToStream.

Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top