RE: Blobs: How to tell when I retrieved a null blob
Posted in 1997
1) Locate the blob in memory and and let it=null
2) you can use the "is null" test in boolean expressions both in sql (=where
clauses) and 4gl statements.
A word of warning. Don't test blob variables unless you have located them.
A "let test=var is null" evaluates to *false* (I have tested this - you also
get a -450 error, btw) if var has not been located; once var has, the test
behaves sensibly, that is yelds true if it has been located in memory or a
non existing file, and false if the file exists or after you select something
in it.
HTH,
Marco
____________________________________________________________________________
rem radioterapia, which I immeritately manage, seldom agrees with what I say
marco greco (Catania, Italy) Work:
marcog@ctonline.it rem radioterapia 39 95 447828 fax 446558
(was mar.greco@agora.stm.it) Achea 39 95 503117
--- On Thu, 13 Feb 1997 10:17:37 GMT Jacob Salomon <jake@apparel.net> wrote:
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 |
+-----------------------------------------------------------+
-----------------End of Original Message-----------------