Hi all,
I've been struggling with this problem for some time, and thought the IB gurus here may be able to assist.
Basically, I have a table in an Interbase 6 database that contains two columns; table structure is below.
CREATE TABLE INBOXBLOB
(
INBLOBKEY VARCHAR(16) NOT NULL,
INBLOB BLOB SUB_TYPE 0 SEGMENT SIZE 80,
CONSTRAINT INBOXBLOBPK PRIMARY KEY (INBLOBKEY)
);
The INBLOBKEY column contains file names; these are referenced back to another table in the DB for identification purposes. The INBLOB column contains a TIFF image, which is programatically accessed from the application that uses this DB and displayed within the GUI.
What I want to do is write a script or app that will loop over all of the rows in the table and extract the data from the INBLOB column out to a file within the filesystem (with the filename from the INBLOBKEY column).
I'll then use a batch graphics conversion app to compress these TIFF's (I don't need any help with this step).
Once all the images have been a) dumped from the table and b) compressed, I then want to run a process of looping over the list of TIFF's within the filesystem, and inserting the image back into a new (clean) DB table, with the same structure as the original table.
I've got a solid programming history, and am comfortable with the filesystem-related aspects of this process. I also have a good experience with T-SQL, but what I DON'T have much experience with is Interbase, specifically BLOB fields.
What I'm looking for is a code example of how to acheive the steps of:
a) exporting the blob fields from the DB to the filesystem
b) inserting the files from the filesystem back into a BLOB field within a table
As for the language, I'd be happy with VB, VBScript, JScript, PHP, ASP, or Perl... or <other>, if that's what you know. I just want to make this happen :) (I'm currently dealing with databases of 10-20GB in size, which are full of uncompressed TIFF's; If I can get the above process working, I'm looking at reducing those database sizes by around 90%!!!)
Cheers all...
alternativeit
by: NickUpsonPosted on 2005-08-12 at 14:23:38ID: 14664724
Please start by looking at the API Guide and the Embedded SQL Guide from the interbase 6 manual set on writing blob filters.
you should be able to write one that does the compression so that you just have to use it to update the blob fields, avoiding the export and insert.
Please bear in mind that intberase 6 is fairly old and has several known bugs, consider upgrading to interbase 7.5 (Borland) or Firebird (1.5)
from www.ibphoenix.com (OpenSource)