postgreSQL.connection.setAutoCommit

Syntax

postgreSQL.connection.setAutoCommit (connectionRef, flAutoCommit)

Params

connectionRef is a reference to a connection as returned by postgreSQL.connection.open or postgreSQL.connection.grab.

flAutoCommit is a boolean indication whether to switch auto-commit mode on or off.

Action

Switch auto-commit mode on if flAutoCommit is true, otherwise switch it off.

Returns

True.

Examples

postgreSQL.connection.setAutoCommit (connectionRef, true)

« true

Notes

By default, auto-commit mode is switched off. This means that all database queries run inside a transaction with the transaction isolation level set to serializable. Therefore, any changes you make to the database will not become permanent and visible to other users until you call postgreSQL.connection.commit.

The PostgreSQL extension keeps track internally of when you committed or rolled back transactions, so that it will only send the respective commands to the database server when neccessary. For this feature to work correctly, you should refrain from running BEGIN, COMMIT, END, or ABORT commands directly through the query interface while auto-commit mode is switched off.

Switching auto-commit mode on will cause every query to be run in its own transaction, and you can also safely send BEGIN, COMMIT, END, or ABORT commands directly through the query interface.

See Also

postgreSQL.connection.commit

postgreSQL.connection.rollback