The Informix driver for Online (ODS) 7.x, SE 7.x and Universal
Server (IUS) 9.x is implemented in "functions/ifx.ec" and
"functions/php3_ifx.h". At the moment of writing ODS 7.2 support
is fairly complete, with full BLOB support. IUS 9.1 support is
partly finished: the new data types are there, but SLOBS support
is still under construction.
Some notes on the use of BLOBs:
The current version (September 18, 1998) has complete select/insert/update
support for BLOB columns.
BLOBs are normally addressed by integer BLOB identifiers.
Select queries return a "blob id" for every BYTE and TEXT column.
You can get at the contents with "string_var = ifx_get_blob($blob_id);" if
you choose to get the BLOBs in memory (with : "ifx_blobinfile(0);").
If you prefer to receive the content of BLOB columns in a file, use
"ifx_blobinfile(1);", and "ifx_get_blob($blob_id);" will get
you the filename. Use normal file I/O to get at the blob contents.
For insert/update queries you must create these "blob id's" yourself
with "ifx_create_blob(..);". You then plug the blob id's into an array,
and replace the blob columns with a question mark (?) in the query string.
For updates/inserts, you are responsible for setting the blob contents with
ifx_update_blob(...).
The behaviour of BLOB columns can be altered by configuration variables that
also can be set at runtime :
configuration variable : ifx.textasvarchar
configuration variable : ifx.byteasvarchar
runtime functions :
ifx_textasvarchar(0) : use blob id's for select queries with TEXT columns
ifx_byteasvarchar(0) : use blob id's for select queries with BYTE columns
ifx_textasvarchar(1) : return TEXT columns as if they were VARCHAR columns,
without the use of blob id's for select queries.
ifx_byteasvarchar(1) : return BYTE columns as if they were VARCHAR columns,
without the use of blob id's for select queries.
configuration variable : ifx.blobinfile
runtime function :
ifx_blobinfile_mode(0) : return BYTE columns in memory, the blob id lets you
get at the contents.
ifx_blobinfile_mode(1) : return BYTE columns in a file, the blob id lets you
get at the file name.
If you set ifx_text/byteasvarchar to 1, you can use TEXT and BYTE columns
in select queries just like normal (but rather long) VARCHAR fields.
Since all strings are "counted" in PHP3, this remains "binary safe".
It is up to you to handle this correctly. The returned data can contain
anything, you are responsible for the contents.
If you set ifx_blobinfile to 1, use the file name returned by
ifx_get_blob(..) to get at the blob contents.
Note that in this case YOU ARE RESPONSIBLE FOR DELETING THE TEMPORARY
FILES CREATED BY INFORMIX when fetching the row.
Every new row fetched will create new temporary files for every BYTE column.
The location of the temporary files can be influenced by the environment
variable "blobdir", default is "." (the current directory).
Something like : putenv(blobdir=tmpblob"); will ease the cleaning up of temp
files accidentally left behind (their names all start with "blb").