Home TADOBlobStream rewrite this class to ZEOS DB components and many more
Reply: 1

TADOBlobStream rewrite this class to ZEOS DB components and many more

user9044066
1#
user9044066 Published in 2018-02-13 16:30:28Z

Whenever ADO (DBgo) will be disontinued or someone wants to bring an ADO-Windows based application to the UNIX world withourt rewritting the application a translation of the ADO classes given in the unit unit Data.Win.ADODB; to new correponding ZEOS based classed might help here. For TADOConnection a mapping into TZConnection during this excange is obvious, same for TADOTable, TADOQuery .....

For starting this job for not yet existing classes now need to convert this code is using the TADOBlobStream class. As mentioned I want to create a TZEOSBLobStream Class instead of it to minimize code refactoring work

What is the best way to create a compatible class in ZEOS ? And how to consider the other classes given in the ADO unit like

  • TADOCommand = class; TCustomADODataSet = class; TADODataSet = class; TParameters = class; .....

    TADOCommand = class;

    TCustomADODataSet = class;

    TADODataSet = class;

    TParameters = class;

    ;

Victoria
2#
Victoria Reply to 2018-02-14 05:36:27Z

You're not supposed to use specific BLOB stream implementation nor implement your own. That's what the libraries are shipped with. You're expected to use abstract layer interface provided by the common TDataSet class. It has the CreateBlobStream method that returns instance of a specific library BLOB stream class implementation as abstract TStream class to interface with.

And working just with this returned TStream instance is in most cases all you really need. It's very common way to work with BLOB streams, independent from the used library. For example in code like this, MyDataSet can be ADO, ZEOS or theoretically any properly implemented dataset object:

var
  Stream: TStream;
begin
  Stream := MyDataSet.CreateBlobStream(MyDataSet.FieldByName('MyBlob'), bmReadWrite);
  try
    { ← read of write from or to the Stream here }
  finally
    Stream.Free;
  end;
end;

So even if that may be difficult in your case, I would highly recommend you to refactor your code to use the abstract layer of the TDataSet class wherever possible.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.485846 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO