Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

CLOB / BLOB

Status
Not open for further replies.

St0rMz

Computer
Feb 24, 2005
2
Hi all,

I'm still new with this sql thingy. I'm just wondering what're the differences between BLOB and CLOB. And how to declare them and use them properly. Any help will be appreciated. Thanks.

Regards,

Dimaz Pramudya
 
Replies continue below

Recommended for you

CLOB = Character Large OBject
BLOB = Binary Large OBjects
I saw CLOB on Oracle engine, BLOB on Firebird/Interbase, for me they are the same meaning.
What a BLOB does ? I quote from Firebird documentation:

A Blob is used to store very large data objects of indeterminate and variable size, such as bitmapped graphics images, vector drawings, sound files, video segments, chapter or book-length documents, or any other kind of multimedia information. Because a Blob can hold different kinds of
information, it requires special processing for reading and writing.
 
Hi rtmpxr,

Thanks for your explanation. Do you have any example about this CLOB / BLOB thingy? I just wanna know how to declare it and use it. Thanks.

Regards,

Dimaz Pramudya
 
Create a table with a blob field (see the docs of the sql engine how to do it). Then create an interface with the database to load the blob. For example you want to create a database with mp3's.

Load the blob into the table (Delphi language):
procedure TForm1.Button1Click(Sender: TObject);
begin
OpenDialog1.Execute; //search for the mp3 file
if IBDataSet1.State = dsBrowse then IBDataSet1.Edit;
IBDataSet1MP3_FILE.LoadFromFile(OpenDialog1.FileName);
end;

PLay the file from database using MediaPlayer component (Delphi language). Suppose you are on the 4 record in database:
procedure TForm1.Button3Click(Sender: TObject);
begin
MediaPlayer1.Close;
IBDataSet1MP3_FILE.SaveToFile('e:\temp.mp3');
MediaPlayer1.FileName := 'e:\temp.mp3';
MediaPlayer1.Open;
end;

Here IBDataSet1MP3_FILE is the blob field of the IBDataSet1 database component.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor