storage image in mysql
Posted: Thu 31 May 2018 02:27
Dear all,
Just try to switch the database from MSSQL to Mysql. everything works fine except image fields.
In MSSQL, field is defined as image, the save & read is fine.
but in MYSql, I changed the field type as blob, but it got error when I type to save the record
#42000You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '??眙煠:`#??5?......' at line 3
var Stream2:TStream;
var lUniImage: TUniDBImage;
begin
lUniImage:=TUniDBImage.Create(self);
lUniImage.Picture.LoadFromFile(AStream.FileName);
dsDetails.DataSet.Edit;
TBlobField(dsDetails.DataSet.FieldByName('Picture')).LoadFromStream(AStream);
Stream2:=dsDetails.DataSet.CreateBlobStream(dsDetails.DataSet.FieldByName('Picture'),bmwrite);
dsDetails.DataSet.Post;
Vesrion 7.2.6 for RAD studio 10.2
Just try to switch the database from MSSQL to Mysql. everything works fine except image fields.
In MSSQL, field is defined as image, the save & read is fine.
but in MYSql, I changed the field type as blob, but it got error when I type to save the record
#42000You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '??眙煠:`#??5?......' at line 3
var Stream2:TStream;
var lUniImage: TUniDBImage;
begin
lUniImage:=TUniDBImage.Create(self);
lUniImage.Picture.LoadFromFile(AStream.FileName);
dsDetails.DataSet.Edit;
TBlobField(dsDetails.DataSet.FieldByName('Picture')).LoadFromStream(AStream);
Stream2:=dsDetails.DataSet.CreateBlobStream(dsDetails.DataSet.FieldByName('Picture'),bmwrite);
dsDetails.DataSet.Post;
Vesrion 7.2.6 for RAD studio 10.2