arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

mysql_autocommit

mysql_autocommit enables or disables autocommit mode for the current database connection, returning zero on success or nonzero on failure.

hashtag
Syntax

my_bool mysql_autocommit(MYSQL * mysql, my_bool auto_mode);
  • mysql - a mysql handle, identifier, which was previously allocated by mysql_init() or mysql_real_connect().

  • auto_mode - whether to turn on or not.

hashtag
Description

Toggles autocommit mode on or off for the current database connection. Autocommit mode will be set if mode=1 or unset if mode=0. Returns zero on success, or nonzero if an error occurred. Parameters

circle-info

mode only affects operations on transactional table types. To determine the current state of autocommit mode use the SQL command SELECT @@autocommit. Be aware: the function will not work if autocommit mode is switched on.

hashtag
Turning off autocommit in sql

SET AUTOCOMMIT=0;
mysql_rollback()
spinner
autocommit
Autocommit