[Lazarus] Inserting images in mysql records

Hugues Moisy hugues.moisy at gmail.com
Fri May 4 11:41:01 CEST 2012


Hi all,

I'm trying to insert gif file content into a blob field in a mysql  
database. Insertion process works, but the size of the data inserted is  
cut to 64 Kbytes, so the images are cut and impossible to read (crash),  
except those that are less than 64KB.

my function is this :

       conn := getConnection(_TypeConnection);
       query.DataBase := conn;
       query.UsePrimaryKeyAsKey:=false;

       query.SQL.clear;
       query.SQL.Add('update volumepage set page_image = :image,  
image_filename = :imgname where volume_id = :vol and page_index = :page');
       query.Params.ParamByName('vol').Value:=pVolumeId;
       query.Params.ParamByName('page').Value:=pPageIndex;
       query.Params.ParamByName('image').LoadFromFile(pFileName,ftBlob);
       query.Params.ParamByName('imgname').Value:=pFileName;

       query.ExecSQL;

could somebody explain me the origin of the problem : is it a problem in  
the database, or in the LoadFromFile ?

Thanks in advance. Hugues

-- 
Utilisant le logiciel de courrier révolutionnaire d'Opera :  
http://www.opera.com/mail/




More information about the Lazarus mailing list