Unidac 8.4.1 MultipleConnections with temporary tables

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

Unidac 8.4.1 MultipleConnections with temporary tables

Post by bursch » Thu 04 Mar 2021 15:25

Hello,

[*]With version 8.4.1 there is a new property named MultipleConnections.
[*]The default of this property is true.
[*]Simple use case with temporary table fails

You can use following code to reproduce this issue.

Code: Select all

uses
	System.SysUtils,
	Uni,
	PostgreSQLUniProvider;

procedure Test(const DisableMultipleConnection : boolean);
var
	UniC : TUniConnection;
	UniQ : TUniQuery;
begin
	try
		UniC := TUniConnection.Create(nil);
		try
			UniC.ProviderName := TPostgreSQLUniProvider.GetProviderName();
			UniC.Database := 'postgres';
			UniC.Username := 'postgres';
			UniC.Password := 'postgres';

			if DisableMultipleConnection then begin
				UniC.SpecificOptions.Values['MultipleConnections'] := 'False';
			end;

			UniQ := TUniQuery.Create(nil);
			try
				UniQ.Connection := UniC;
				UniQ.SQL.Text := 'CREATE TEMP TABLE foobar (foobar integer)';
				UniQ.ExecSQL;
				UniQ.SQL.Text := 'INSERT INTO foobar (foobar) VALUES (1)';
				UniQ.ExecSQL;
				UniQ.SQL.Text := 'SELECT * FROM foobar';
				UniQ.Open;
				UniQ.Close;
				UniQ.SQL.Text := 'DROP TABLE foobar';
				UniQ.ExecSQL;
			finally
				UniQ.Free;
			end;

		finally
			UniC.Free;
		end;

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

begin
	try
		Test(True);
		Test(False);
	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: Unidac 8.4.1 MultipleConnections with temporary tables

Post by oleg0k » Tue 16 Mar 2021 21:23

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

Post Reply