Hi,
I might miss something, but I can't find any option to avoid auto commit when using TPgSQL.execute.
Let assume I have different methods using TPgSQL to update, delete or insert data to different tables and all using the same TPgConnection. And I want the caller of those methods or even the caller of the caller to decide when to commit or rollback the data.
How to achieve that?
I read about the AutoCommit property that is available for TPgQuery but with my small test it looks like even it's set to false, the execute method of TPGQuery does a commit. So, using TPgQuery instead doesn't looks like a workaround.
Appreciacte any advice.
Thanks
How to avoid auto commit with TPgSQL.execute
Re: How to avoid auto commit with TPgSQL.execute
Hello,
You should manually start the transaction for TPgConnection: PgConnection.StartTransaction, and then commit or rollback the transaction after performing the necessary operations: PgConnection.Commit or PgConnection.Rollback, respectively. Visit our documentation for more information: https://www.devart.com/pgdac/docs/devar ... tion().htm
wbr, Oleg
Devart Team
You should manually start the transaction for TPgConnection: PgConnection.StartTransaction, and then commit or rollback the transaction after performing the necessary operations: PgConnection.Commit or PgConnection.Rollback, respectively. Visit our documentation for more information: https://www.devart.com/pgdac/docs/devar ... tion().htm
wbr, Oleg
Devart Team
Re: How to avoid auto commit with TPgSQL.execute
In other words AutoCommit is not working?
But what if a manual start transaction is not an option?
But what if a manual start transaction is not an option?
Re: How to avoid auto commit with TPgSQL.execute
Hello,
Some database systems, e.g., Oracle, allow executing DML statements without a commit statement, but that's not the case for PostgreSQL. We'll consider the possibility of implementing an implicit transaction start when AutoCommit=False. Currently the only way to control transactions in PgDAC is to manually start them with StartTransaction and end with Commmit or Rollback when necessary.
wbr, Oleg
Devart Team
Some database systems, e.g., Oracle, allow executing DML statements without a commit statement, but that's not the case for PostgreSQL. We'll consider the possibility of implementing an implicit transaction start when AutoCommit=False. Currently the only way to control transactions in PgDAC is to manually start them with StartTransaction and end with Commmit or Rollback when necessary.
wbr, Oleg
Devart Team