mysql_autocommit — Toggles autocommit mode on or off

my_bool mysql_autocommit(MYSQL * mysql,
                         my_bool auto_mode);

Toggles autocommit mode on or off for the current database connection. Autocommit mode will be set if mode=1 or unset if mode=0.

Parameters

mysql

A mysql handle, which was previously allocated by mysql_init() or mysql_real_connect().

auto_mode

Whether to turn autocommit on or not.

Return value

Returns zero on success, or nonzero if an error occured.

[Note]
  • Autocommit mode only affects operations on transactional table types

  • To determine the current state of autocommit mode use the SQL command SELECT @@autocommit

  • Be aware: mysql_rollback function will not work if autocommit mode is switched on.

See also