我使用pg_connect和pg_query一個項目。 但我真的不確定這是否是使用AutoCommit模式的pg_connect?PHP:PGSQL驅動程序和AutoCommit?
是很重要的問題,因爲我需要寫在交易的一些塊,如果語句之一將被服務器忽略,數據庫會出現不一致......
而且有趣的問題是做pg_query執行後提交?
例如:
pg_query('begin; update table1...; update table2...; commit');
是相同
pg_query('begin;');
pg_query('update table1...;');
pg_query('update table2...;');
pg_query('commit');
,是
pg_query('begin; update table1...; update table2...; commit');
在自動提交模式下工作,所以開始和提交仍然是?
感謝您的幫助: DD
那麼這是一個什麼新功能呢? http://www.postgresql.org/docs/9.3/static/ecpg-sql-set-autocommit.html – Eddified 2014-02-15 21:34:10
@Eddified:不,這是老了。 [ECPG(http://www.postgresql.org/docs/current/static/ecpg.html)隱含打開交易,這就是所謂的「autcommit關」。參見[管理事務](http://www.postgresql.org/docs/current/static/ecpg-commands.html#ECPG-TRANSACTIONS) – 2014-02-16 22:10:23