Re: BLOB handling in Oracle

From: Rene Rivera <grafik_at_ils.nwu.edu>
Date: Fri, 04 Nov 1994 10:19:49 -0600
Message-ID: <grafik-0411941019490001_at_rivera.ils.nwu.edu>


In article <3205_at_swuts.sbc.com>, gm0564_at_swuts.sbc.com.us wrote:

}In article <381fvo$m6s_at_tricbbs.tricbbs.fn.sub.org>, <cg_at_tricbbs.fn.sub.org>
}writes:
}We've got the same problem. According to the Oracle people we contacted,
}Oracle doesn't have a solution.
}> I looked to all Oracle manuals to find some hints how one should handle
}> BLOBs with Oracle (LONG RAW datatype), but only found the standard
}> paragraphs over and over again (no functions, no indexing, ...).
}>
}> What I need to have is some method to get the size of the field on a fetch,
}> allocate the memory, and do the actual fetch in the tailor-made buffer for
}> the field---IMHO this is the only way to deal with fields that can grow
}> as big as LONG RAW (all other solutions would only impose artificial limits).
The sure fire way to do this is to use a static read buffer and do multiple flng()s dynamically appending the data in the buffer to the real location of the data.
But as you know this is anoying and slow. I'm considering using what the OCI manual
refers to as "LONG VARCHAR" and "LONG VARRAW" external data types, check out page 3-12
of the OCI. These types let you put the length of the data as the first four bytes
of the buffer where you have the data. According to the OCI these work for both input
and output. It si clear how this would work for output to the database, but the OCI
is vauge about how to get this working for input. My current theory goes something
like this:

   1.set up a bogus buffer: ub4 buf[2];
   2.do an odefin(?,?,buf,-1,LONG_VARRAW,...), the -1 tells it to look in the buffer

      for the size.
   3.do an oflng(?,?,buf,-1,LONG_VARRAW,?,0)    4.get the actual size of the long from buf[0]. The unmcertain part of this is wether oracle sets the buf[0] size bytes on the read
to the actual length of the long field or not? If someone gets this to work I would
love to hear about it!!!
}> Thanks

 Hope it helps.
}>
}> Cees
}> --
}> Cees de Groot, Lake of Konstanz, Germany
}> PGP23a: 73 5D BA 7C F8 EF DD 65 56 68 AF BB 2B 58 2C 8B
}> Running Windows on a Pentium is like having a brand new Porsche but only
}> be able to drive backwards with the handbrake on.
-- Grafik +--+ Rene Rivera

rrivera_at_pascal.acm.org |+-|+ Institute for the Learning Sciences
rivera_at_ils.nwu.edu     +|-+| Northwestern University
grafik_at_nwu.edu          +--+ 1890 Maple Avenue; Evanston, IL 60201
-- "I think I'm developing a headache. I can only contemplate the

   infinite for a finite period of time."

  • RAMA REVEALED
Received on Fri Nov 04 1994 - 17:19:49 CET

Original text of this message