Select query after insert?

I have the following entity to save images

  [Id('Fid', TIdGenerator.None)]
  Textimgimg = class
    [Column('id', [TColumnProp.Required])]
    Fid: Integer;
    [Column('img', [TColumnProp.Required, TColumnProp.Lazy])]
    Fimg: TBlob;
    property id: Integer read Fid write Fid;
    property img: TBlob read Fimg write Fimg;

I am issuing a post request to a XDATA server usingTXDataClient. The log follows:

INSERT INTO extimgimg (
  id, img)
  :p1, :p2)
p1=292 p2=傉䝎਍ਚ
SELECT AS A_id, A.img AS A_img
FROM extimgimg A
WHERE = :p_0
[Value: POST /url/extimgimg 201 - 67,02 ms]
HttpApiException: HTTP Server API Error.
An operation was attempted on a nonexistent network connection


  1. Why a SELECT sql query runs after the insert?
  2. Why it gives an exception in the end as printed by the following code:
procedure(Args: TModuleExceptionArgs)
memo1.Lines.Add(args.ErrorCode+': '+args.ErrorMessage); 
end );
  1. Why the above inside an CreateAnonymousThread gives "out of system resources"?

More info added:

  1. The out of system resources is probably not Xdata related and happens with Ttask too. I do not know why a thread or task has limited resources.
  2. If no autofilled column exist and all fields are provided, Is there a reason to issue an sql select query after an insert?
  3. The (EHttpApiException) HTTP Server API Error above does not create an exception in the TXDataClient client side. I read that could be caused by a closed connection from the client and I increased the timeout:
ilocal.HttpClient.OnSendingRequest:=procedure(Req: THttpRequest) 

The message continues and now the time reported is ~4358,94 ms for A4 pages saved as images with size that it is less than 1MB.
FireDAC providing DB connections has a ReadTimeout/WriteTimeout for Mysql that is 20 minutes and I have seen a maximum of 6399,30 ms with this error

Being more curious now, I have noticed that in other insert-post requests too (eg for 31ms), this message is reported by the TLoggingMiddleware and XdataMod.Events.OnModuleException with no exception in the client side, having autonumber columns and receiving correctly the select query data in case of autonumbering columns

Should I count on this error?

Because the endpoint returns a JSON with the fully inserted object. Some objects might have been modified by the database server, and the endpoint then returns the final object state.

This is a normal exception that can be ignored. It simply indicates that the client is not available anymore to receive the response. Indeed, if the client request timed out, the client is gone, and the server can't send the response back to the client, thus the error.

You answered this yourself.

1 Like

But the client does not seem to timeout. It closes the connection as I understand before getting back data.
Is that normal?

By the way can I remove and free from TXDataClient.ReturnedEntities a object instance I want?
Or, the TXDataClient will become angry?

I don't know, we would have to analyze exactly what's going on to answer you. All I can say is that error is very normal and can be ignored.

You can do that. The client will just destroy what's there. If you remove the object from the list (for example, using Extract) then you should be ok.