0

My application deserializes XML that is stored in a CLOB column in Oracle database to dynamically create forms. This approach allows relatively easy update deployment, but is too slow when a user connects through a VPN using e.g. 3G network.

I wonder is there a way to store those objects (forms) on the users's file system so that no parsing is needed?

I don't have any code to show but I hope this question is scoped narrowly enough to be acceptable.

M. Underhill
  • 105
  • 1
  • 10
  • You say taht this process is slow when a user conects through 3G network. I'm guessing that the reason for this might be relatively large size of stored XML. So you should try to optimize your serialization process to lower the amount of data that is stored in that XML to the bare monimum. For instance when delphi is storing form information in DFM files only the non default information i stored. All default information is hardcoded into component classes. So trying to implement similar mechanizm using XML might lower the size of that XML for quite a bit – SilverWarior Sep 10 '19 at 13:36
  • Another thing that you might consider is switching from serialization that relies on XML files to a JSON based serialization. As far as I know using JSON for serialization uses less space and is even more powerful. And finally if you wan't to reduce the amount of that even more you can simply switch from JSON (text based serialization) to BSON (binary based serialiazion) which are both interchangable. – SilverWarior Sep 10 '19 at 13:39
  • But other than that your question is to brad and its possible answers can only be opinion based therefore it is not suitable for SO. – SilverWarior Sep 10 '19 at 13:41
  • Looking at a few dozen DFM files here, most are only a few hundred bytes to a few kilobytes, so I find it hard to imagine that the encoding method is the bottleneck in sending them over the wire. I think you should thoroughly investigate what is causing your bottleneck, because it is far more lkely to be something else. But until you do, and refine your q, I agree with @SilverWarior that it is too broad for SO. – MartynA Sep 10 '19 at 14:49
  • I don't think the potential answers to my question might be opinion-based. Neither do I think it's too broad for Stack Overflow. I may have wrote too much unrelated information. What I'm looking for is a way to store a bunch of objects in memory (a form with it's controls) so that I can skip parsing when loading them later. – M. Underhill Sep 10 '19 at 16:58
  • 1
    If that's what you're looking for, you need to rewrite your q. Meanwhile, -1. Btw, if you download the DFM(s) in binary format, there is nothing to parse. – MartynA Sep 10 '19 at 17:38
  • I've just rewritten my question. The DFM in binary format pointed me towards finding out about TMemoryStream.ReadComponent. Not sure if that's exactly it (internally), but it sure sounds like what I was looking for. – M. Underhill Sep 10 '19 at 18:58

1 Answers1

2

My suggestion:

  1. Make sure your form(s) is saved to the database in binary form, not as a text representation.

  2. In your client app, request the CLOB column data from the DB and save it to a TMemoryStream. Then, you can instantiate the form by loading it from the TMemoryStream and it doesn't need to go near the file system on the client side. That way, no parsing of the Form data from the db is necessary.

The accepted answer to this q shows how to read a form from a memory stream - see the call to MemStream.ReadComponent et seq. Obviously, using tje method in that q, the CLOB data should have been created using the memorystream steps of its SaveComponentToFile.

MartynA
  • 30,454
  • 4
  • 32
  • 73