BLOB Question
Posted in 1999
Topics: Stored Procedures & SPL
Hello All, I'm wondering if anyone has any experience in inserting an image (i.e binary file - GIF/JPEG) into a blob type field from a unix shell. We are using Informix Online and wish to be able to insert a default image into a table. For instance, in the partial HTML form from an AppPage below: <INPUT TYPE="file" NAME=image SIZE=20> Once the form is submitted the following syntax is executed: <?MIBLOCK COND=$(NXST,$image)> <?MISQL SQL="execute procedure insert blob ('$field1','$field2')"> <?/MISQL> <?/MIBLOCK> So the above code will execute a stored procedure that will contain SYSTEM command(s) that insert the default image from a file already on the HD. I remember hearing something about loadblob(?), is there someway this can be achieved? Is there a way a stored procedure can achieve the result without a SYSTEM command being used? Thanks, Steven Livanes
Steven Livanes wrote: > Hello All, > I'm wondering if anyone has any experience in inserting an image (i.e binary > file - GIF/JPEG) into a blob type field from a unix shell. > We are using Informix Online and wish to be able to insert a default image > into a table. [SNIP] > So the above code will execute a stored procedure that will contain SYSTEM > command(s) that insert the default image from a file already on the HD. > I remember hearing something about loadblob(?), is there someway this can be > achieved? Is there a way a stored procedure can achieve the result without > a SYSTEM command being used? You cannot load a BLOB using a stored procedure (except copying it from another SQL object). You can however write an ESQL/C program/function and call it from a CGI to load the BLOB directly from the file. Look at LOCFILE or LOCFNAME values of the loc_loctype field in struct loc_t in the ESQL/C manual section on dynamic SQL and in $INFORMIXDIR/incl/esql/locator.h. Art S. Kagel