RowsAfffected with RETURNING (Postgres)

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
bursch
Posts: 20
Joined: Tue 25 Sep 2018 07:45

RowsAfffected with RETURNING (Postgres)

Post by bursch » Tue 01 Sep 2020 07:56

Hi,

there is a new problem with RowsAffected in combination with RETURNING in your newest build.

If a statement is executed again, the value for RowsAffected is not reset.

Example console app:

Code: Select all

uses
  System.SysUtils,
  Uni,
  PostgreSQLUniProvider;

var
	Query : TUniQuery;
	Connection : TUniConnection;

begin
  try
	Connection := TUniConnection.Create(nil);
	try
		Connection.ProviderName := TPostgreSQLUniProvider.GetProviderName();

		Connection.Database := 'XXX';
		Connection.Username := 'XXX';
		Connection.Password := 'XXX';

		Connection.Connect;

		Query := TUniQuery.Create(nil);
		try
			Query.Connection := Connection;

			Query.SQL.Text := 'CREATE TEMP TABLE TestTable (KeyField integer, ValueField TEXT)';
			Query.ExecSQL;

			Query.SQL.Text := 'INSERT INTO TestTable (ValueField) VALUES (''test'') RETURNING KeyField';
			Query.ExecSQL;

			Writeln(Query.RowsAffected.ToString); // 1 -> correct
			Query.ExecSQL;

			Writeln(Query.RowsAffected.ToString); // 2 -> NOT correct, should be 1
		finally
			Query.Free;
		end;

	finally
   		Connection.Free;
	end;
  except
	on E: Exception do
	  Writeln(E.ClassName, ': ', E.Message);
  end;

  Readln;

oleg0k
Devart Team
Posts: 190
Joined: Wed 11 Mar 2020 08:28

Re: RowsAfffected with RETURNING (Postgres)

Post by oleg0k » Thu 03 Sep 2020 11:52

Hello,
Thank you for the information. We've reproduced the issue and are currently working to resolve it. We'll keep you updated on the progress.

wbr, Oleg
Devart Team

bursch
Posts: 20
Joined: Tue 25 Sep 2018 07:45

Re: RowsAfffected with RETURNING (Postgres)

Post by bursch » Mon 05 Oct 2020 10:34

Is there any timeframe when you fix this issue?

oleg0k
Devart Team
Posts: 190
Joined: Wed 11 Mar 2020 08:28

Re: RowsAfffected with RETURNING (Postgres)

Post by oleg0k » Mon 12 Oct 2020 10:18

Hello,
We're working on the issue and we'll notify you once it's resolved.

wbr, Oleg
Devart Team

bursch
Posts: 20
Joined: Tue 25 Sep 2018 07:45

Re: RowsAfffected with RETURNING (Postgres)

Post by bursch » Wed 16 Dec 2020 09:38

Hello,

again two months have passed and we are still waiting for a solution to this problem. Can we expect a solution in the near future?

With best regards
Manuel

Pir
Posts: 2
Joined: Fri 09 Jan 2009 12:53

Re: RowsAfffected with RETURNING (Postgres)

Post by Pir » Wed 16 Dec 2020 21:52

Same problem here.

Another related, and more serious problem, occurs if you write a InsertSQL and call a Post in a TUniQuery. A exception is raised.

With StrictUpdate = False, exception is not raised, but property RowsAffected is wrong.

oleg0k
Devart Team
Posts: 190
Joined: Wed 11 Mar 2020 08:28

Re: RowsAfffected with RETURNING (Postgres)

Post by oleg0k » Wed 17 Feb 2021 13:07

Hello,
The bug with RowsAfffected with RETURNING clause has been fixed and will be included in the next release of UniDAC and PgDAC. To get a nigthly build with the fix, send us your license number and IDE version through https://devart.com/company/contactform.html In case you subscription expired, we'll send you a trial version of the nigthly build. Note that in a nigthly build, other issues might occur since it's not intended for release.

wbr, Oleg
Devart Team

Post Reply