[Lazarus] Inserting images in mysql records [resolved]
Hugues Moisy
hugues.moisy at gmail.com
Fri May 4 14:49:32 CEST 2012
Hi Michael,
Thank you for your answer.
No my field is declared as BLOB and not text. But after searching on web,
I found that BLOB type in 64KB. I have to use MEDIUMBLOB and LONGBLOB
instead.
Hope it'll be useful for anybody else.
Hugues
Le Fri, 04 May 2012 15:15:47 +0530, <michael.vancanneyt at wisa.be> a écrit:
>
>
> On Fri, 4 May 2012, Hugues Moisy wrote:
>
>> 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 ?
>
> It depends on the type of field you created in the database. If it is a
> 'Text' field, then I think Mysql limits the content to 64k bytes.
>
> sqldb by itself does not impose limits, as far as I know.
>
> Michael.
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
--
Utilisant le logiciel de courrier révolutionnaire d'Opera :
http://www.opera.com/mail/
More information about the Lazarus
mailing list