TSQlite3Dataset Blobs lazarus / 16-Databases ---------------------------------------------------------------------- davesimplewear · 2010-10-21 03:30 Hi can anyone tell me if TSQlite3Dataset supports blobs, I see you can specify Blob fields but does the dataset support them ? Regards Dave ---------------------------------------------------------------------- xenblaise · 2010-10-21 04:29 uses db..... // TBlobField uses db function addwithBlob(yourBlobData:?): Integer; var   rs: TSQLQuery;   tptStream: TMemoryStream;   id: Integer; begin   rs := TSQLQuery.Create(nil);   rs.DataBase := mycon;   rs.sql.Text := 'SELECT * FROM yourtable';   rs.Open;   rs.Append;   tptStream := TMemoryStream.Create();   tptStream.write( yourBlobData, yourBlobData.size);   //HERES the blob field   (rs.FieldByName('yourblobfield') as TBlobField).LoadFromStream(tptStream);   rs.post();   rs.ApplyUpdates;   id := rs.FieldByName('ID').AsInteger;   tptStream.Free();   rs.Close();   rs.Free();   addwithBlob := id; end; ---------------------------------------------------------------------- davesimplewear · 2010-10-21 05:31 Thanks for your reply, I see your code was for TSQLQuery not TSqlite3Dataset, does this also work for the TSqlite3Dataset. Regards Dave ---------------------------------------------------------------------- xenblaise · 2010-10-21 09:38 Quotedoes this also work for the TSqlite3Dataset. Yes; (try it, I haven't tried) Just replace rs: TSQLQuery; TO rs: TSQLite3dataset; But why use TSqlite3Dataset which is specific only for SQLite. Use TSQLQuery, for anytime you will change your connection database from sqlite to firebird to anySQL No problem using it.  You dont have to change anycode for dataset properties. TSQLQuery is a global dataset for any connection, its a decendant of TDataSet. ---------------------------------------------------------------------- xenblaise · 2010-10-23 09:49 dave? how is it? ---------------------------------------------------------------------- davesimplewear · 2010-10-23 19:43 Sorry, haven't had time to try yet, will let you know when I have, thanks for the pointer. Regards Dave ---------------------------------------------------------------------- xenblaise · 2010-11-05 06:15 The TSqlite3Dataset that comes with fpc/lazarus does not support yet blob fields. Sqlite itself supports blob fields, just is not implemented in that component. from Luiz, but Im not sure about this mean(but my code does the task). Can you confirm it, since your the one who's really testing it. ---------------------------------------------------------------------- davesimplewear · 2010-11-05 09:33 No, it does not do what I wanted which was to save picture to the blob field, it may do a text blob, SqlitePassDbo saves both, but I much prefer using the Sqlite3dataset, maybe Luiz will get around to doing the Blob support, I am sure he is fairly busy, so what I do currently is save the filepath of the image to the database and work with that, not very elegant I know. Regards dave ---------------------------------------------------------------------- LuizAmérico · 2010-11-05 14:04 Blob support is on my plans. I did not implemented yet because it will be necessary do a radical change in the internal way of storing data. This can lead for some bugs so must be done with caution and lot of testing.