Multiple statements support


(navigatorsoftware) #1

Hi,

We are using RO 9.6beta + Delphi 10.3 FireDAC + PG + Linux and we are getting multiple statements error from FireDAC.
To support multiple statements we introduced in
function TDAEFireDACQuery.DoExecute: integer;
TFDQuery(DataSet).ResourceOptions.DirectExecute := True;

If you find it useful, please introduce in further releases.

Thank you and best regards.


(EvgenyK) #2

Hi,

according to http://docwiki.embarcadero.com/Libraries/Rio/en/FireDAC.Stan.Option.TFDResourceOptions.DirectExecute :

Changing default value can be dangerous for our other users and may cause different failures. as a result, better to leave this option as is.

If you want, I can give instruction how to create your own FireDAC driver based on current one, so you haven’t to include this change for every new DA release.


(navigatorsoftware) #3

Thank you.

If someone want to execute a statement in PG like

start transaction;
update table_a set id = id;  
update table_b set id = id;  
commit;

then it won’t work through dataset.Execute
This was the only solution that we found to achieve the functionality.
On Windows we are using Zeos driver and there wasn’t a problem. We needed to achieve compatibility with FireDAC on Linux.

Best regards.


(EvgenyK) #4

Why you can’t execute 2 separated commands in your code, like

connection.BeginTransaction;
try
   command1.execute;
   command2.execute;
   connection.CommitTransaction;
except
  connection.RollbackTransaction;
end;

?


(navigatorsoftware) #5

I know this solution, but from client side I’m getting SQL transaction.
I wrote this topic to help others if they are having the same problem.