Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: "Error creating variant or safe array" in TClientDataSet.LoadFromStream().


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0
Askarali Azimov

Posts: 1
Registered: 2/10/17
"Error creating variant or safe array" in TClientDataSet.LoadFromStream().  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 9, 2017 6:33 PM
Hello!

I am working on a client-server application.
The client (TCP Client) is a Delphi application that sends commands to the server (TCP Server, C++ Builder application).
Both of them were written in XE2.
The server, in response to commands, fetches data from SQL Server and sends it to the client.
The server uses TClientDataSet and saves it to TMemoryStream that is sent to the client.
The client also uses TClientDataSet and calls TClientDataSet.LoadFromStream() on the stream received from the server.
This is working well.
But there is a case where size of data is larger (~160 MB) in which sometimes "Error creating variant or safe array" is being thrown upon calling TClientDataSet.LoadFromStream() in the client.

The server sends the stream to the client in this way:

//...
FContext->Connection->IOHandler->LargeStream = true;
FContext->Connection->IOHandler->Write(Stream, 0, true);


The client receives it in this way:

AClient.IOHandler.LargeStream := True;
AClient.IOHandler.ReadStream(Stream, -1, False);


After the client receives, it calls TClientDataSet.LoadFromStream():

//...
Stream.Position := 0;
MemTable.LoadFromStream(Stream);


And LoadFromStream() is throwing "Error creating variant or safe array".
But there were cases in which it worked without errors.

Does anyone have any idea?

Many thanks!
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02