Save Paradox Blob format to a file using BDE
C++Builder 10.2 Tokyo does not have BDE installed.
So, Install BDE separately in C++Builder 10.2 Tokyo.
It is after the end of the all of the installation.
Download BDE Installer for RAD Studio, Delphi, C++Builder 10.2 Tokyo
Download the installer from the URL below.
ID: 30752, BDE Installer for RAD Studio, Delphi, C++Builder 10.2 Tokyo
Check the Paradox data.
Use the sample file named biolife.db.
This is sample data of Paradox.
I brought it from C++Builder 5
sample data.
There is a "Graphic" field in biolife.db. "Graphic" is Blob type.
Save the Blob data in the JPEG format
using the BDE.
In VCL, JPEG can be processed using TJPEGImage.
#include <Vcl.Imaging.jpeg.hpp>
Use TTable
to get all of biolife.db.
//--------------------------------------------------------------------------- void __fastcall TfmMain::bde_biofish_save() { // created a new TTable and set the biolife table. std::auto_ptr<TTable> l_table( new TTable(this)); l_table->DatabaseName = "DBDEMOS"; l_table->TableName = "biolife.db"; l_table->Active = true; l_table->FindFirst(); //Loop for acquiring all data. while (! l_table->Eof) { std::tr1::shared_ptr<TJPEGImage> l_jpeg(new TJPEGImage()); std::tr1::shared_ptr<TMemoryStream> l_ms(new TMemoryStream()); //Using the CreateBlobStream() function will create a new TStream. //Instances created with TStream need to be deleted. std::tr1::shared_ptr<TStream> ss(l_table->CreateBlobStream( l_table->FieldByName("Graphic"), TBlobStreamMode::bmRead)); ss->Position = 8; l_ms->CopyFrom(ss.get(), ss->Size-8); l_ms->Position = 0; std::tr1::shared_ptr<TBitmap> b(new TBitmap()); b->LoadFromStream(l_ms.get()); //Convert calling Bitmap data to jpeg. l_jpeg->Assign(b.get()); //When saving JPEG, the file name is "Species No" and "Species Name". l_jpeg->SaveToFile(l_table->FieldByName("Species No")->AsString + "_" + StringReplace(l_table->FieldByName("Species Name")->AsString, " ", "_", TReplaceFlags() <<rfReplaceAll) + ".jpeg"); //Move to the next record. l_table->Next(); } }
Make the file name "Species No" + "Species Name" + ". Jpeg"
.
"Species No" + "Species Name" exists in DB field.
Confirm the output JPEG data


Delphi / C++Builder blogger
Comments
-
Please login first in order for you to submit comments