Blobs: How to tell when I retrieved a null blob
Posted in 1997
Hi folks,
2 questions, after verbose explanation.
I am writing a small program to insert & retrieve blobs. Right now it's
very simple: When a user wants to insert a blob, they type the name of
a .gif file in a field in the form. My program LOCATEs the blob
variable in the file and does the insert.
If the user omits the file name, I still do the insert but first I
locate the blob variable in /dev/null. I have confirmed that when I
locate in /dev/null, the onstat -d shows no fewer free blob pages. So
this works, though I'm sure there is a better way. My first weustion is:
1. Is there something I can do in 4GL to specify a null location, so
that my code won't even bother opening /dev/null? (For that matter,
are the 4GL library functions smart enough to recognize /dev/null and
skip opening it already?)
Next is the issue of how I recognize a null blob when I read it back in.
For now, I have hard coded the location before fetching the blob i.e.
Before fetching it I code:
LOCATE blobvar IN FILE "yutz.blob"
FETCH blobcurs INTO blobvar
2. How can I recognize when the blob data is null? In ESQL I could look
at the length member variable of the locator structure (I think) but
what do I look at in 4GL to see a 0-length? BTW, when I do the
retrieval, I can see that the file "yutz.blob" is indeed 0 bytes
long. I don't see anything in the sqlca that would warn me.
Thanks much.
--
-- Jake (With a non-zero supply of hot air)
. .
_..-'( )`-.._
./'. '||\\\\. }\\_/{ .//||` .`\\.
./'.|'.'||||\\\\|.. )o o( ..|//||||`.`|.`\\.
./'..|'.|| |||||\\`````` \\,@,/ ''''''/||||| ||.`|..`\\.
./'.||'.|||| ||||||||||||. ||| .|||||||||||| ||||.`||.`\\.
/'|||'.|||||| ||||||||||||{ | }|||||||||||| ||||||.`|||`\\
'.|||'.||||||| ||||||||||||{ | }|||||||||||| |||||||.`|||.`
'.||| ||||||||| |/' ``\\||`` | ''||/'' `\\| ||||||||| |||.`
|/' \\./' `\\./ \\!|\\ /|!/ \\./' `\\./ `\\|
V V V }' `\\ /' `{ V V V
\\ \\ \\ V / / /
+-----------------------------------------------------------+
| Impeccable Logic: A thought process which successfully |
| resists chicken bites |
+-----------------------------------------------------------+