Search found 26 matches

by bursch
Mon 09 May 2022 10:02
Forum: Universal Data Access Components
Topic: Postgres: "Unexpected server response" calling Ping (Unidirectional=True, Prepared=True)
Replies: 1
Views: 1218

Postgres: "Unexpected server response" calling Ping (Unidirectional=True, Prepared=True)

Hello,

we are checking the connection state with TUniConnection.Ping. With Unidirectional=True and Prepared=True we can't call the Ping-method because it raises an exception. The connection is not usable after the Ping call.

Here is an example to reproduce the issue:

Code: Select all

var
	Connection : TUniConnection;
	Query : TUniQuery;
	i : integer;

begin
		Connection := TUniConnection.Create(nil);
		Connection.ProviderName := TPostgreSQLUniProvider.GetProviderName();
		Connection.SpecificOptions.Values['CharSet'] := 'UTF8';
		Connection.SpecificOptions.Values['UseUnicode'] := 'True';
		Connection.SpecificOptions.Values['ProtocolVersion'] := 'pv30';
        	// multiconnection must be False
		Connection.SpecificOptions.Values['MultipleConnections'] := 'False';
		Connection.Server := 'localhost';
		Connection.Database := 'XXX';
		Connection.Username := 'XXX';
		Connection.Password := 'XXX';
		Connection.Connect;

		// create temp table with records
		Query := TUniQuery.Create(nil);
		Query.Connection := Connection;
		Query.SQL.Text := 'CREATE TEMP TABLE FOOBAR (Key INTEGER)';
		Query.ExecSQL;
		for i := 0 to 100 do begin
			Query.SQL.Text := 'INSERT INTO FOOBAR (Key) VALUES (' + i.ToString + ')';
			Query.ExecSQL;
		end;

		// setup unidirectional, prepared query
		Query.SQL.Text := 'SELECT * FROM FOOBAR';
		Query.Prepared := True;
		Query.UniDirectional := True;

		Query.Open;
		Query.First;
		Query.Close;

		
		if Connection.Connected then
			Connection.Ping; // check connection state -> raises exception
	
Best reagards,
Manuel Bursch
by bursch
Wed 08 Dec 2021 12:36
Forum: Universal Data Access Components
Topic: (Postgres) GENERATED AS IDENTITY
Replies: 7
Views: 9193

Re: (Postgres) GENERATED AS IDENTITY

Hi,

any news for this?

Best regards,
Manuel
by bursch
Wed 28 Jul 2021 13:47
Forum: Universal Data Access Components
Topic: (Postgres) GENERATED AS IDENTITY
Replies: 7
Views: 9193

Re: (Postgres) GENERATED AS IDENTITY

Hello,

is this feature already implemented?
by bursch
Tue 27 Apr 2021 06:03
Forum: Universal Data Access Components
Topic: Postgres / TDateTime
Replies: 1
Views: 2215

Postgres / TDateTime

Hello,

under Postgres, very small date values (<01.01.0100) are always set to the value MinDateTime. TimeStamp values, on the other hand, work without problems.

Very small values can lead to inaccuracies, but there is no reason for this restriction. The Postgres database supports values from 4713BC.

Since there is no need for this restriction for timestamp values and this is also interpreted as TDateTime, it would only be logical to remove this restriction.

Code: Select all

unit PGClassesUni;

(...)

class procedure TPgBinaryConverter.ReadDate(Source: TPgSQLNet; Dest: IntPtr);
At least the date 01/01/0000 should still be possible.

Greetings,
Manuel
by bursch
Wed 10 Mar 2021 14:23
Forum: Universal Data Access Components
Topic: 8.4.1: Infinite Loop on Exception
Replies: 1
Views: 1249

8.4.1: Infinite Loop on Exception

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;

by bursch
Wed 10 Mar 2021 14:05
Forum: Universal Data Access Components
Topic: 8.4.1: RecordCount is 1 if PageSize not correct
Replies: 1
Views: 1444

8.4.1: RecordCount is 1 if PageSize not correct

Hi,

there is a timing problem in unit PgSQLProtocolUni.

Code: Select all

function TPgSQLReadStream.HasData: boolean;
(....)
        if FCurrentPosition < PageSize then
          Result := True
        else
          Result := False;  // in this case the record count will be set to 1 and stays 1 for ever

Code: Select all

procedure TPgSQLRecordSet.FetchBlock(Block: PBlockHeader; FetchBack: boolean; out RowsObtained: Integer);
(...)
      Command.FReadStream.UseUnicode := Protocol.Net.UseUnicode;
      if Command.FReadStream.HasData or not Command.FReadStream.IsLastRow then
        RowsObtained := Command.FReadStream.FetchStmt(FFetchRows, Block, ReceiveFetchBuffer)
      else
        RowsObtained := 0;
 (...)
 end;
Since it is a timing problem, a test project is difficult to create. The problem does not occur on every computer.
by bursch
Tue 09 Mar 2021 14:03
Forum: Universal Data Access Components
Topic: After Update to 8.4.1. Query creates additional connection
Replies: 1
Views: 1024

After Update to 8.4.1. Query creates additional connection

Hi,

after upgrading to version 8.4.1 a simple console application creates multiple connections to postgres,

Code: Select all

	Con := TUniConnection.Create(nil);
	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.SpecificOptions.Values['UseUnicode'] := 'True';
	Con.SpecificOptions.Values['CharSet'] := 'UTF8';
	Con.SpecificOptions.Values['Schema'] := 'xxxx';
	Con.SpecificOptions.Values['ApplicationName'] := 'foobar';
	Con.Connect;

	Query := TUniQuery.Create(nil);
	try
		Query.Connection := Con;
		Query.SQL.Text := 'SELECT SAK_KONTO, SAK_DATUMAB FROM AGF_SAK ORDER BY SAK_KONTO, SAK_DATUMAB';
		Query.Open;
	finally
		Query.Free();
	end;

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

Code: Select all

TPgSQLRecordSet.GetExtFieldsInfo;

Code: Select all

TPgSQLCommand(RecordSet.GetCommand).FForceSwapConnection := True;
This connection is not needed and stays active until the query component is closed.
by bursch
Thu 04 Mar 2021 15:25
Forum: Universal Data Access Components
Topic: Unidac 8.4.1 MultipleConnections with temporary tables
Replies: 1
Views: 1153

Unidac 8.4.1 MultipleConnections with temporary tables

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;
by bursch
Thu 04 Mar 2021 14:45
Forum: Universal Data Access Components
Topic: Upgrade 8.3.2 >> 8.4.1
Replies: 12
Views: 12835

Re: Upgrade 8.3.2 >> 8.4.1

We also have issues with MultipleConnections enabled.

- application runs very slow
- problems with accessing temporary tables

Why is such a property enabled by default? Do you have automatic tests?
by bursch
Thu 18 Feb 2021 15:17
Forum: Universal Data Access Components
Topic: (Postgres) GENERATED AS IDENTITY
Replies: 7
Views: 9193

Re: (Postgres) GENERATED AS IDENTITY

Hello,

will you fix this issue for your next release?
by bursch
Wed 16 Dec 2020 09:38
Forum: Universal Data Access Components
Topic: RowsAfffected with RETURNING (Postgres)
Replies: 6
Views: 3252

Re: RowsAfffected with RETURNING (Postgres)

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
by bursch
Mon 30 Nov 2020 09:30
Forum: Universal Data Access Components
Topic: Support for Postgres 13
Replies: 4
Views: 1382

Support for Postgres 13

Hi,

is there a timeframe for offical postgres 13 support?

https://www.devart.com/unidac/docs/compatibility.htm
by bursch
Thu 26 Nov 2020 09:03
Forum: Universal Data Access Components
Topic: (Postgres) GENERATED AS IDENTITY
Replies: 7
Views: 9193

(Postgres) GENERATED AS IDENTITY

Hi,

since Postgres 10 there is an option to create an column as IDENTITY. Postgres creates an internal sequence which cannot be dropped.

see https://www.postgresql.org/docs/12/sql-createtable.html

The problem is that the unidac components are not aware of this option an so the IsAutoIncrement in the FieldDesc is false.

To get this information you have to look in the pg_attributte catalog an look if attidentity is not an empty char.
see https://www.postgresql.org/docs/10/cata ... ibute.html

Please implement this as soon as possible.

Greetings
Manuel Bursch
by bursch
Mon 05 Oct 2020 10:39
Forum: Universal Data Access Components
Topic: (Postgres) pgbouncer in transaction mode
Replies: 4
Views: 3329

Re: (Postgres) pgbouncer in transaction mode

Hi,

is there something new about this issue?

Greetings,
Manuel
by bursch
Mon 05 Oct 2020 10:34
Forum: Universal Data Access Components
Topic: RowsAfffected with RETURNING (Postgres)
Replies: 6
Views: 3252

Re: RowsAfffected with RETURNING (Postgres)

Is there any timeframe when you fix this issue?