Can't write an image into BLOB MySql, Zeos lazarus / 16-Databases ---------------------------------------------------------------------- syalyshev · 2012-05-09 00:09 Windows. I want to write Print Screen into Blob-field of Mysql table. The Stream is filled with Clipboard from Print Screen. The following code works (compiled correctly) but no record to MySql table is added. ... if (ZTable.State <> dsEdit) and (ZTable.State <> dsInsert) then ZTable.Edit; Stream.Position := 0; TBlobField(ZTable.FieldByName('image_inform')).LoadFromStream(Stream); ... Maybe ZTable parameters are wrong? Please help! ---------------------------------------------------------------------- ludob · 2012-05-09 07:54 Your code works fine with zeos 7.0.0-dev and fpc 2.7.1. Here is my test: Code: [Select]var   fs:TFileStream; begin   fs:=TFileStream.Create('b:\test.jpg',fmOpenRead);   ZTable1.Open;   ZTable1.Insert;   TBlobField(ZTable1.FieldByName('filedata')).LoadFromStream(fs);   TBlobField(ZTable1.FieldByName('bindata')).LoadFromStream(fs);   ZTable1.Post;   fs.Free; end; How did you define the blob field in the database? 'filedata' is defined in my test table as LongText and binary data doesn't get stored correctly. 'bindata' is a LongBlob and data is stored correctly. Quotebut no record to MySql table is added.No record at all or a record with an empty blob field? ---------------------------------------------------------------------- syalyshev · 2012-05-11 06:08 Thanks for your reply! I simply can't realize your recommendations having no fpc 2.7.1 and zeos 7.0.0. Could you give me an idea where to get them? ---------------------------------------------------------------------- syalyshev · 2012-05-11 06:19 Thanks for your reply! I simply can't realize your recommendations having no fpc 2.7.1 and zeos 7.0.0. Could you give me an idea where to get them? QuoteHow did you define the blob field in the database? 'filedata' is defined in my test table as LongText and binary data doesn't get stored correctly. 'bindata' is a LongBlob and data is stored correctly.My blob field is defined as LongBlob. My MySql table has two fields only 'idx' and 'image_inform'. No record added after '... LoadFromStream(stream);' statement. ---------------------------------------------------------------------- BigChimp · 2012-05-11 06:29 Get it using SVN? Found this older wiki page http://wiki.lazarus.freepascal.org/Zeos_tutorial (I'm sure updates are welcome, I don't use Zeos myself) and http://wiki.lazarus.freepascal.org/ZeosDBO Forum search on "zeos 7.0 svn" gives hits such as http://lazarus.freepascal.org/index.php/topic,16615.msg90663.html#msg9 0663 ... which describes downloading an archive if you don't use subversion... Good luck. ---------------------------------------------------------------------- ludob · 2012-05-11 08:32 Quote from: syalyshev on May 11, 2012, 08:19:08 amI simply can't realize your recommendations having no fpc 2.7.1 and zeos 7.0.0. Could you give me an idea where to get them? It wasn't a recommendation but a simple reminder of my environment and a subtle reminder to you that specifying the used environment is necessary when asking for help When using zeos, fpc 2.6.0 is good enough. I wouldn't upgrade to 2.7.1. See BigChimps reply for getting Zeos. Quote from: syalyshev on May 11, 2012, 08:19:08 amMy blob field is defined as LongBlob. My MySql table has two fields only 'idx' and 'image_inform'. No record added after '... LoadFromStream(stream);' statement. I hope you didn't forget the ZTable1.Post and, in case Ztable1.CachedUpdates is true, a Ztable1.ApplyUpdates . ---------------------------------------------------------------------- syalyshev · 2012-06-17 12:02 Hello, dear ludob! I'm very grateful for your replies. Now I have Lazarus-1.1-37668-fpc-2.7.1-20120617-win32.exe on my mashine and tried to install the last version of ZEOSDBO. Unfortunately I failed to install zeos package. Could you kindly send your zeosdbo package working with fpc-2.7.1 to me: syalyshev@mail.ru? ---------------------------------------------------------------------- ludob · 2012-06-17 19:21 I'm using the version from the official svn repository. A tarball can be downloaded from http://zeoslib.svn.sourceforge.net/viewvc/zeoslib/trunk/?view=tar ---------------------------------------------------------------------- syalyshev · 2012-06-19 09:59 QuoteI'm using the version from the official svn repository.Me too, but it can't be installed... Thanks anyway! ---------------------------------------------------------------------- ludob · 2012-06-19 10:17 QuoteMe too, but it can't be installed...Where does it fail? What is the message? ---------------------------------------------------------------------- syalyshev · 2012-06-19 14:24 Surprize!!! Everything installed!!! Though I don't understand how... Maybe because I've just refreshed zeoslib svn. Now i'll make another attempt to write the blob... Thanks a lot once more!!!