You are not logged in.
Hello administrator,
Can you create within SynSQLite3.pas a function to return a TMemoryStream directly.
It would be like:
TSQLRequest.FieldBlob function (Col: integer): RawByteString;
something like:
TSQLRequest.FieldBlob function (Col: integer): TMemoryStream;
Or someone shows me how to create a function to it.
I appreciate any help.
Offline
Just use TRawByteStringStream.Create(aRequest.FieldBlob) - it will return a read-only TStream containing the content.
Do not forget to Free this TRawByteStringStream instance when you do not need it any more.
TRawByteStringStream is defined in SynCommons.pas.
Offline
Thank you,
I solved this problem with your help.
You can show me an example of how to write in a SQLite TMemoryStream.
Something like:
procedure UpdateBlob(const SQL: string; BlobStream: TMemoryStream);
begin
...
end;
Offline
Something like:
procedure UpdateBlob(DB: TSQLite3DB; const SQL: string; BlobStream: TMemoryStream);
var Req: TSQLRequest;
begin // SQL statement should have BLOBFIELD=?
Req.Prepare(DB,StringToUTF8(SQL));
Req.Bind(1,BlobStream.Memory,BlobStream.Size);
Req.Execute;
end;
I've added new TSQLRequest.FieldBlobToStream and TSQLRequest.Bind(TCustomMemoryStream) methods, if it can help you.
See http://synopse.info/fossil/info/40f8985541
Offline
Thank you!
What I wanted was to save and retrieve a component Tkbmmentable with the data in the SQLite and now I get with these changes you made in synSQLite3 unit.
This is an excellent project.
Offline