In order to read blobs into Informix 4GL, use the locate mechanism. You have the option of locate (ing) into memory or a disk file. Let's do the eacy way:
In database testdb we have table x_test which has at least columns:
somecol CHAR(50)
blobcol TEXT
Here's the 4GL example locating one row from x_test in text fil "test.fil"
DATABASE testdb
MAIN
DEFINE file_name CHAR(50),
testblob TEXT
LET file_name = "test.fil"
LOCATE testblob IN FILE file_name
SELECT blobcol
INTO testblob
FROM x_test where somecol = "SOMETEXT"
IF sqlca.sqlcode != 0
THEN
error "Can NOT access Blob: ", sqlca.sqlcode
END IF
END MAIN
# end 4GL test
Now, process the file somehow. I've written callable 4GL functions located in Online FAQ, faq179-2007, which will help you do that.
You can locate in memory in Informix 4GL:
LOCATE testblob IN MEMORY
but then you need a callable "C" function to read the RAM.
I've done this in the past, but it's not worth the effort if you're reading TEXT blobs.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.