Advertisement

08.11.2005 at 05:48PM PDT, ID: 21524611
[x]
Attachment Details

Reading/Writing BLOB fields

Asked by alternativeit in Interbase / Firebird Database

Tags: blob

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...
alternativeitStart Free Trial
[+][-]08.12.2005 at 02:23PM PDT, ID: 14664724

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Interbase / Firebird Database
Tags: blob
Sign Up Now!
Solution Provided By: NickUpson
Participating Experts: 2
Solution Grade: B
 
 
[+][-]08.15.2005 at 01:48AM PDT, ID: 14673114

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.16.2005 at 02:27AM PDT, ID: 14681108

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]08.16.2005 at 05:28PM PDT, ID: 14688092

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32