Subject | Confused about blobs/streams and isc_seek_blob |
---|---|
Author | Geoff Worboys |
Post date | 2012-04-01T06:12:36Z |
Hi All,
I've never needed to use stream blobs before, but now I have a
class where I wanted to implement isc_seek_blob and thought
I should do some research first ... and now I'm confused.
This article surprised me by suggesting that stream blobs and
segmented blobs were stored differently:
http://www.ibphoenix.com/resources/documents/search/doc_112
I always thought that blobs were blobs, and that the stream
interface API was just another way to access them. Indeed when
I look at jrd/utl.cpp (v2.5.1 source) and the implementation of
Bopen that is exactly what I find. There are no special bpb
parameters being passed when calling isc_create_blob2 or
isc_open_blob2, and the get/put functions just call get_segment
and put_segment. Yippee! I thought, this sounds easy.
But further research indicates that isc_seek_blob will
apparently only work with explicitly stream blobs, and inside
jrd/blb.cpp I find that there is indeed a flag associated with
each blob indicating whether it's streamed or segmented. So it
begins to look like isc_seek_blob may or may not work depending
on circumstances I haven't been able to work out.
This all leads to questions:
. Do I need to care about the distinction between stream
and segment blobs in all my existing code that just uses
get_segment and put_segment calls? (I'm guessing no,
since that seems to be all that happens beneath everything
anyway, but I don't want nasty surprises if I start
creating stream blobs in databases where only segment
blobs existed in the past.)
. More particularly, if I want to use the isc_seek_blob API
do I need to _create_ a blob a using isc_bpb_type_stream,
or is this happening automatically for me somewhere in
the background?
. Can I obtain an explicitly stream blob by opening an
existing (possibly segmented) blob with isc_bpb_type_stream?
Or will this give me strange results with offsets referring
to segments rather than the entire blob - one post I saw in
the archives suggested something like this.
. If blobs don't default to stream type, then isn't it very
strange that Bopen doesn't actually create stream blobs?
ie. Look at the link above and note that it indicates that
isc_seek_blob can be used with the handle available in the
BSTREAM structure (which seems logical).
. If blobs don't default to stream type then this would also
seem to mean that wanting to use isc_seek_blob on an
existing database will mean some sort of special upgrade
process where all blobs are recreated as stream blobs.
(And this begins to make isc_seek_blob something to be
left alone.)
Can anyone enlighten me as to what is going on here?
--
Geoff Worboys
Telesis Computing Pty Ltd
I've never needed to use stream blobs before, but now I have a
class where I wanted to implement isc_seek_blob and thought
I should do some research first ... and now I'm confused.
This article surprised me by suggesting that stream blobs and
segmented blobs were stored differently:
http://www.ibphoenix.com/resources/documents/search/doc_112
I always thought that blobs were blobs, and that the stream
interface API was just another way to access them. Indeed when
I look at jrd/utl.cpp (v2.5.1 source) and the implementation of
Bopen that is exactly what I find. There are no special bpb
parameters being passed when calling isc_create_blob2 or
isc_open_blob2, and the get/put functions just call get_segment
and put_segment. Yippee! I thought, this sounds easy.
But further research indicates that isc_seek_blob will
apparently only work with explicitly stream blobs, and inside
jrd/blb.cpp I find that there is indeed a flag associated with
each blob indicating whether it's streamed or segmented. So it
begins to look like isc_seek_blob may or may not work depending
on circumstances I haven't been able to work out.
This all leads to questions:
. Do I need to care about the distinction between stream
and segment blobs in all my existing code that just uses
get_segment and put_segment calls? (I'm guessing no,
since that seems to be all that happens beneath everything
anyway, but I don't want nasty surprises if I start
creating stream blobs in databases where only segment
blobs existed in the past.)
. More particularly, if I want to use the isc_seek_blob API
do I need to _create_ a blob a using isc_bpb_type_stream,
or is this happening automatically for me somewhere in
the background?
. Can I obtain an explicitly stream blob by opening an
existing (possibly segmented) blob with isc_bpb_type_stream?
Or will this give me strange results with offsets referring
to segments rather than the entire blob - one post I saw in
the archives suggested something like this.
. If blobs don't default to stream type, then isn't it very
strange that Bopen doesn't actually create stream blobs?
ie. Look at the link above and note that it indicates that
isc_seek_blob can be used with the handle available in the
BSTREAM structure (which seems logical).
. If blobs don't default to stream type then this would also
seem to mean that wanting to use isc_seek_blob on an
existing database will mean some sort of special upgrade
process where all blobs are recreated as stream blobs.
(And this begins to make isc_seek_blob something to be
left alone.)
Can anyone enlighten me as to what is going on here?
--
Geoff Worboys
Telesis Computing Pty Ltd