odbcSetAutoCommit: ODBC Set Auto-Commit Mode

View source: R/RODBC.R

odbcSetAutoCommitR Documentation

ODBC Set Auto-Commit Mode

Description

Set ODBC database connection's auto-commit mode.

Usage

odbcSetAutoCommit(channel, autoCommit = TRUE)

odbcEndTran(channel, commit = TRUE)

Arguments

channel

RODBC connection object returned by odbcConnect.

autoCommit

logical. Set auto-commit on?

commit

logical. Commit or rollback pending transaction?

Details

Auto-commit is a concept supported only by ODBC connections to transactional DBMSs.

If a connection to a transactional DBMS is in auto-commit mode (the default), then all its SQL statements will be executed and committed as individual transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by an execution of commit or rollback. Switching a connection to auto-commit mode commits the pending transaction.

By default, new connections are in auto-commit mode. If auto-commit mode has been disabled, a call to odbcEndTran or an SQL commit statement must be executed in order to commit changes; otherwise, pending database changes will not be saved.

Value

odbcSetAutoCommit stops if channel is an invalid connection. The function returns -1 on error, 0 on success and on success with a message that would be returned by odbcGetErrMsg.

Author(s)

Norman Yamada, Yasser El-Zein


RODBC documentation built on Nov. 25, 2023, 5:07 p.m.