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;