summaryrefslogtreecommitdiffstats
path: root/libmariadb/man/mysql_autocommit.3
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:24:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:24:36 +0000
commit06eaf7232e9a920468c0f8d74dcf2fe8b555501c (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /libmariadb/man/mysql_autocommit.3
parentInitial commit. (diff)
downloadmariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.tar.xz
mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libmariadb/man/mysql_autocommit.3')
-rw-r--r--libmariadb/man/mysql_autocommit.382
1 files changed, 82 insertions, 0 deletions
diff --git a/libmariadb/man/mysql_autocommit.3 b/libmariadb/man/mysql_autocommit.3
new file mode 100644
index 00000000..9b12b9de
--- /dev/null
+++ b/libmariadb/man/mysql_autocommit.3
@@ -0,0 +1,82 @@
+.\" Automatically generated by Pandoc 2.5
+.\"
+.TH "mysql_autocommit" "3" "" "Version 3.3.1" "MariaDB Connector/C"
+.hy
+.SS Name
+.PP
+mysql_autocommit \- Toggles autocommit mode
+.SS Synopsis
+.IP
+.nf
+\f[C]
+#include <mysql.h>
+
+my_bool mysql_autocommit(MYSQL * mysql, my_bool auto_mode);
+\f[R]
+.fi
+.SS Description
+.PP
+Toggles autocommit mode on or off for the current database connection.
+Autocommit mode will be set if mode=1 or unset if mode=0.
+.SS Parameters:
+.IP \[bu] 2
+\f[C]mysql\f[R] is a connection identifier, which was previously
+allocated by \f[B]mysql_init(3)\f[R] and connected by
+\f[B]mysql_real_connect(3)\f[R].
+.IP \[bu] 2
+\f[C]auto_mode\f[R] \- whether to turn autocommit on or not.
+.SS Notes
+.IP \[bu] 2
+Autocommit mode only affects operations on transactional table types.
+To determine the current state of autocommit mode use the SQL command
+\f[C]SELECT \[at]\[at]autocommit\f[R] or check the server status (see
+example below).
+.IP \[bu] 2
+Be aware: the [mysql_rollback()}(mysql_rollback() function will not work
+if autocommit mode is switched on.
+.SS Examples
+.SS SQL
+.IP
+.nf
+\f[C]
+# Turn of autocmmit
+SET AUTOCOMMIT=0;
+
+# Retrieve autocommit
+SELECT \[at]\[at]autocommit;
++\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
+| \[at]\[at]autocommit |
++\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
+| 0 |
++\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
+\f[R]
+.fi
+.SS MariaDB Connector/C
+.IP
+.nf
+\f[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(\[dq]Error: autocommit is on\[rs]n\[dq]);
+ return 1;
+ }
+ printf(\[dq]OK: autocommit is off\[rs]n\[dq]);
+ return 0;
+}
+\f[R]
+.fi