Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Anyone know hoe to read blobs in 4gl programs

Status
Not open for further replies.

Firecloud

Programmer
Jun 22, 2002
1
AU
Hey,

I'm after exact Informix 4gl syntax to read blobs from an Informix database.

Any ideas would be appreciated.

Cheers

Rob
 
Rob:

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.

Regards,


Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top