Reexecute unidirectional query after restart the server

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
CristianP
Posts: 79
Joined: Fri 07 Dec 2012 07:44
Location: Timișoara, Romania

Reexecute unidirectional query after restart the server

Post by CristianP » Wed 27 Feb 2013 07:38

Hallo,

I use UniConnection.OnConnectionLost() to ask the user to retry (rmReconnectExecute).
With SQL Server and MySQL all is fine after restart the server and reconnect.
But with PostgreSQL if I have a unidirectional UniQuery there is an error after reconnecting:
"Active transaction is required for using FetchAll = False mode." into the TPgSQLRecordSet.ExecCommand

Best Regards,
Cristian Peţa

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Reexecute unidirectional query after restart the server

Post by AlexP » Wed 27 Feb 2013 09:03

Hello,

We cannot reproduce the problem, please specife the UniDAC and IDE versions

CristianP
Posts: 79
Joined: Fri 07 Dec 2012 07:44
Location: Timișoara, Romania

Re: Reexecute unidirectional query after restart the server

Post by CristianP » Wed 27 Feb 2013 11:52

Hallo,

I use last UniDAC 4.6.12, XE3, PostgreSQL 9.2
I was send an email with a test project to you because it was not easy to reproduce outside my application.

Best Regards,
Cristian Peţa

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Reexecute unidirectional query after restart the server

Post by AlexP » Thu 28 Feb 2013 07:13

Hello,

Thank you for the information, we have reproduced the problem and will try to fix it as soon as possible. For the time being, to solve the problem, you can set the CursorWithHold option to True.

CristianP
Posts: 79
Joined: Fri 07 Dec 2012 07:44
Location: Timișoara, Romania

Re: Reexecute unidirectional query after restart the server

Post by CristianP » Thu 28 Feb 2013 09:31

Hallo,

thank you for the information.
Now I understand why there are two connections. Second is for opening transaction for FetchAll=False.

And a little suggestion. This second internal connection can use ApplicationName? First time I was not sure from where is this connection because on server ApplicationName is empty.

Best Regards,
Cristian Peţa

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Reexecute unidirectional query after restart the server

Post by AlexP » Thu 28 Feb 2013 13:16

Hello,

When setting the UniDirectional property to True, the FetchAll property is set automatically to False, as on FetchAll = True the UniDirectional option has no sense.
We have fixed the ApplicationName property setting for internal connections.

CristianP
Posts: 79
Joined: Fri 07 Dec 2012 07:44
Location: Timișoara, Romania

Re: Reexecute unidirectional query after restart the server

Post by CristianP » Thu 28 Feb 2013 15:23

AlexP wrote: ... on FetchAll = True the UniDirectional option has no sense.
The UniDirectional mode use less memory only because it is not fetched all records?
In this case if my query return only one row (or less than FetchRows) it is a non sens to use UniDirectional mode?

Best Regards,
Cristian Peţa

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Reexecute unidirectional query after restart the server

Post by AlexP » Fri 01 Mar 2013 10:27

Hello,

The UniDirectional mode is designed for decreasing memory usage when reading a large dataset. This is achieved by the fact that memory stores only the number of records, that is specified in the FetchRows property; when obtaining a sequential portion of data, the previous data is deleted (navigation is also possible only within the current fetched block). If the number of data is less than the FetchRows value, the UniDirectional mode has no sense, since all data will be retrieved at once in any way.

CristianP
Posts: 79
Joined: Fri 07 Dec 2012 07:44
Location: Timișoara, Romania

Re: Reexecute unidirectional query after restart the server

Post by CristianP » Fri 01 Mar 2013 11:01

Hello,

Thank you for clarification. I assumed wrong as there are other things out of fetched rows count with unidirectional mode because I recently moved from dbExpress (TSQLQuery and TSQLQuery+TDataSetProvider+TClientDataSet).

Best Regards,
Cristian Peţa

Post Reply