mysql_autocommit - Online Linux Manual PageSection : 3
Updated :
Source : Version 3.2.2
Note : MariaDB Connector/C

Namemysql_autocommit − Toggles autocommit mode

Synopsis #include <mysql.h> my_bool mysql_autocommit(MYSQL * mysql, my_bool auto_mode);

DescriptionToggles 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 is a connection identifier, which was previously allocated by mysql_init(3) and connected by mysql_real_connect(3). • auto_mode − whether to turn autocommit on or not.

Notes• Autocommit mode only affects operations on transactional table types. To determine the current state of autocommit mode use the SQL command SELECT @@autocommit or check the server status (see example below). • Be aware: the [mysql_rollback()}(mysql_rollback() function will not work if autocommit mode is switched on.

Examples

SQL # Turn of autocmmit SET AUTOCOMMIT=0; # Retrieve autocommit SELECT @@autocommit; +−−−−−−−−−−−−−−+ | @@autocommit | +−−−−−−−−−−−−−−+ | 0 | +−−−−−−−−−−−−−−+

MariaDB Connector/C static int test_autocommit(MYSQL *mysql) { int rc; unsigned int server_status; /* Turn autocommit off */ rc= mysql_autocommit(mysql, 0); if (rc) return rc; /* Error */ /* If autocommit = 0 succeeded, the last OK packet updated the server status */ rc= mariadb_get_infov(mysql, MARIADB_CONNECTION_SERVER_STATUS, &server_status); if (rc) return rc; /* Error */ if (server_status & SERVER_STATUS_AUTOCOMMIT) { printf("Error: autocommit is on\n"); return 1; } printf("OK: autocommit is off\n"); return 0; }
0
Johanes Gumabo
Data Size   :   7,351 byte
man-mysql_autocommit.3Build   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   3 / 191,421
Visitor ID   :     :  
Visitor IP   :   3.141.192.174   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.