Recent

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

loaded

  • Sr. Member
  • ****
  • Posts: 312
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.
Lazarus V2.0.10 32 Bit + Intel I5 8250U + 12GB RAM + Win 10 Home 64 Bit = red pill
Morpheus: "You take the blue pill...the story ends, you wake up in your bed and believe whatever you want to believe. You take the red pill...you stay in Wonderland, and I show you how deep the rabbit hole goes."

 

TinyPortal © 2005-2018