Recent

Author Topic: How to use memory stream with asbcd.  (Read 745 times)

loaded

  • Hero Member
  • *****
  • Posts: 825
How to use memory stream with asbcd.
« on: September 24, 2021, 10:07:40 am »
Hi All,
There is a database that I created using Postgresql, in this database;
Code: Pascal  [Select][+][-]
  1. 'DOC BYTEA,'
I have a blob column that I have defined, in this column I intend to store binary data to files.
Using opendialog, I transfer the file I selected to MemoryStream, then the SQL query is set to the parameter value.

Code: Pascal  [Select][+][-]
  1.  var
  2. fc,fof:TMemoryStream;
  3. ....
  4. DataModule1.ZQuery_CRecord.SQL.Clear;
  5. DataModule1.ZQuery_CRecord.SQL.Add(
  6.         ' UPDATE '+ table_name+ ' SET '+
  7.         ' DOC '+
  8.         '=:DOC WHERE ID=:ID;'
  9.         );
  10.         DataModule1.ZQuery_CRecord.Params.ParamByName('ID').AsString:=DataModule1.ZQuery_VZ.FieldByName('id').AsString;
  11.         DataModule1.ZQuery_CRecord.Params.ParamByName('DOC').LoadFromStream(fc,ftBlob);
  12.         DataModule1.ZQuery_CRecord.ExecSQL;  
  13.  

I transfer it in the form and save it in the relevant database. No problem, I'm coming here.

But by making a change; This process is not with the sql query, but directly in the field of the sql query;
I want to transfer the memory stream to the
Code: Pascal  [Select][+][-]
  1. ZQuery.FieldByName('DOC').AsBCD:=how to use fc;
feature, is it possible?
I would be very grateful if you could help. Regards.
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

 

TinyPortal © 2005-2018