Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Saving BLOB to Informix Dynamic Server 11

11 views
Skip to first unread message

rsm...@gmail.com

unread,
Nov 10, 2008, 2:15:54 PM11/10/08
to
Hello,
I'm new to Informix and to dbExpress but so far I've managed to solve
problems that have arisen but I just can seem to update a table in the
informix database.
I always get the an exception that says"Illegal attempt to use Text/
Byte host variable". I tried the InformixLob variable and still it
doesnt work. Im using delphi 2007 and here is the table that im trying
to post to.

create table users (
oid INT not null,
given_names VARCHAR(30) not null,
paternal_name VARCHAR(30) not null,
maternal_name VARCHAR(30),
user_name VARCHAR(20) not null,
user_pass VARCHAR(20) not null,
title VARCHAR(7),
home_phone VARCHAR(20),
mobile_phone VARCHAR(20),
email VARCHAR(30),
birthday DATE,
business_phone VARCHAR(20),
rank INT,
created DATETIME YEAR TO SECOND default CURRENT YEAR TO SECOND not
null,
createdby INT not null,
lastmodified DATETIME YEAR TO SECOND,
modifiedby INT,
lockedby INT,
disabled_date DATETIME YEAR TO SECOND,
ops_data blob default NULL,
picture blob default NULL,
icon blob default NULL,
thumb blob default NULL,
rights BLOB default NULL
)

And the following is the BLOB I try to update:

procedure UpdatePicture;
var
M:TMemoryStream;
Pic:TJPEGImage;
Par:TParams;
begin

InformixLob := True; //Doesnt appear to do anything

M := TMemoryStream.Create;
Pic := TJPEGImage.Create;
Par := TParams.Create(nil);
try
Pic.LoadFromFile('C:\MyPic.jpg');
Pic.SaveToStream(M);
Par.Clear;
Par.CreateParam(ftBlob, 'BlobParam', ptInput);
Par.ParamByName('BlobParam').LoadFromStream(M, ftBlob);
M.Free;
M := nil;
SQLConnection.Execute('UPDATE USERS SET THUMB = :BlobParam WHERE
OID = 4823',Par);
finally
Pic.Free;
if Assigned(M) then M.Free;
Par.Free;
end;
end;

What am I doing wrong or what parameter am I missing?
Thanks...

0 new messages