ESQL/C and BLOBS....
Posted in 1997
Greetings!
We just bought a RAID array to which we would like to transfer our
database
environment. Unfortunately we happen to have about 9Gb worth of data in
our
blobspace (about 7Gb of it comes from just one table and the rest comes
from the very same table in another database).
The way to go about this would of course be simply exporting the
information from the databases to files, then re-create the databases on
the RAID box and populate it with the information on the files.
But as we all know, the tools available for exporting information out
from
an Informix database seem to think that 32 bits is quite enough, thank
you.
What I don't really understand here is just why should dbexport have to
be
able to lseek() in a file it only keeps appending.
Anyway, as I found out about this 2Gb file limit, I decided to make my
own
tools for exporting these largish tables. I printed out the values for
the
normal columns and then I exported the column of type BYTE as a file.
Then
I made a tool for importing the information back to the database.
Here I have bit of a problem with the ESQL/C and blob interface. The
filename of the blob can be found in the file where all the other
columns
are stored. That is not a problem. I set up the locator like this:
a_contents.loc_size = -1;
a_contents.loc_loctype = LOCFNAME;
a_contents.loc_fname = bfname;
a_contents.loc_oflags = LOC_RONLY;
Here bfname is the name of the blob file. Then I have an insert
statement:
EXEC SQL insert into e_generic (... a_contents, ...)
values (... :a_contents, ...);
Ok? Not ok... After this statement I test the value sqlca.sqlcode and it
invariably is 0, but the contents of these blobs are all NULL in the
database. What do I do wrong here? And where have all the blobs gone...
HTK
--
/-----------------------------+-----------------------------------------\\
| Heikki.Karhunen@helsinki.fi | There is always a job for a theoretical
|
| Heikki.Karhunen@kone.com | physicist -- at least in theory.
|
\\-----------------------------+-----------------------------------------/