8.4.1: Infinite Loop on Exception

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

8.4.1: Infinite Loop on Exception

Post by bursch » Wed 10 Mar 2021 14:23

Hi,

there is an infinite loop in TPgSQLReadStream.FetchStmt when there is an exception on reading.

You only need a postgres database with UTF8 encoding and you have to ensure that UseUnicode=False in the connection component.

Example project:

Code: Select all

try
		Con := TUniConnection.Create(nil);
		try
			Con.Database := 'xxxx';
			Con.Username := 'xxxx';
			Con.Password := 'xxxx';
			Con.Options.EnableBCD := True;
			Con.Options.EnableFMTBCD := True;
			Con.ProviderName := TPostgreSQLUniProvider.GetProviderName();
			Con.SpecificOptions.Values['ProtocolVersion'] := 'pv30';
			Con.SpecificOptions.Values['MultipleConnections'] := 'False';
			Con.Connect;

			Query := TUniQuery.Create(nil);
			try
				Query.Connection := Con;
				Query.SQL.Text := 'CREATE TEMP TABLE xyz (dummy VARCHAR(20))';
				Query.ExecSQL;

				for i := 1 to 100 do begin
					Query.SQL.Text := 'INSERT INTO xyz (dummy) VALUES (''test'')';
					Query.ExecSQL;
				end;
				Query.SQL.Text := 'INSERT INTO xyz (dummy) VALUES (CONCAT(E''\u4f60'', E''\u597d'', E''\uff0c'', E''\u4e16'', E''\u754c''))';
				Query.ExecSQL;
				for i := 1 to 100 do begin
					Query.SQL.Text := 'INSERT INTO xyz (dummy) VALUES (''test'')';
					Query.ExecSQL;
				end;

				Query.SQL.Text := 'SELECT * FROM xyz';
				Query.Open;

				while not Query.Eof do begin
					Writeln(Query.FieldByName('dummy').AsString);
					Query.Next;
				end;

			finally
				Query.Free();
			end;

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


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

Re: 8.4.1: Infinite Loop on Exception

Post by oleg0k » Mon 05 Apr 2021 12:45

Hello,
The new version of UniDAC containing the fix is already available for download.
Please let us know if you need any further assistance.

wbr, Oleg
Devart Team

Post Reply