reference/mysqli/mysqli/commit.xml
63b99082ef83eade08151f8cb528246fded81db9
...
...
@@ -9,15 +9,18 @@
9
9

10
10
<refsect1 role="description">
11
11
&reftitle.description;
12
-
<para>Object oriented style (method)</para>
13
-
<methodsynopsis>
14
-
<type>bool</type><methodname>mysqli::commit</methodname>
15
-
<void />
16
-
</methodsynopsis>
17
-
<para>Procedural style:</para>
12
+
<para>&style.oop;</para>
13
+
<methodsynopsis role="mysqli">
14
+
<modifier>public</modifier> <type>bool</type><methodname>mysqli::commit</methodname>
15
+
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>0</initializer></methodparam>
16
+
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>name</parameter><initializer>&null;</initializer></methodparam>
17
+
</methodsynopsis>
18
+
<para>&style.procedural;</para>
18
19
<methodsynopsis>
19
20
<type>bool</type><methodname>mysqli_commit</methodname>
20
-
<methodparam><type>mysqli</type><parameter>link</parameter></methodparam>
21
+
<methodparam><type>mysqli</type><parameter>mysql</parameter></methodparam>
22
+
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>0</initializer></methodparam>
23
+
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>name</parameter><initializer>&null;</initializer></methodparam>
21
24
</methodsynopsis>
22
25
<para>
23
26
Commits the current transaction for the database connection.
...
...
@@ -29,6 +32,22 @@
29
32
<para>
30
33
<variablelist>
31
34
&mysqli.link.description;
35
+
<varlistentry>
36
+
<term><parameter>flags</parameter></term>
37
+
<listitem>
38
+
<para>
39
+
A bitmask of <constant>MYSQLI_TRANS_COR_*</constant> constants.
40
+
</para>
41
+
</listitem>
42
+
</varlistentry>
43
+
<varlistentry>
44
+
<term><parameter>name</parameter></term>
45
+
<listitem>
46
+
<para>
47
+
If provided then <literal>COMMIT/*name*/</literal> is executed.
48
+
</para>
49
+
</listitem>
50
+
</varlistentry>
32
51
</variablelist>
33
52
</para>
34
53
</refsect1>
...
...
@@ -40,89 +59,65 @@
40
59
</para>
41
60
</refsect1>
42
61

62
+
<refsect1 role="errors">
63
+
&reftitle.errors;
64
+
&mysqli.conditionalexception;
65
+
</refsect1>
66
+

67
+
<refsect1 role="changelog">
68
+
&reftitle.changelog;
69
+
<para>
70
+
<informaltable>
71
+
<tgroup cols="2">
72
+
<thead>
73
+
<row>
74
+
<entry>&Version;</entry>
75
+
<entry>&Description;</entry>
76
+
</row>
77
+
</thead>
78
+
<tbody>
79
+
<row>
80
+
<entry>8.0.0</entry>
81
+
<entry>
82
+
<parameter>name</parameter> is now nullable.
83
+
</entry>
84
+
</row>
85
+
</tbody>
86
+
</tgroup>
87
+
</informaltable>
88
+
</para>
89
+
</refsect1>
90
+

43
91
<refsect1 role="examples">
44
92
&reftitle.examples;
45
93
<para>
46
-
<example>
47
-
<title>Object oriented style</title>
48
-
<programlisting role="php">
49
-
<![CDATA[
50
-
<?php
51
-
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
52
-

53
-
/* check connection */
54
-
if (mysqli_connect_errno()) {
55
-
printf("Connect failed: %s\n", mysqli_connect_error());
56
-
exit();
57
-
}
58
-

59
-
$mysqli->query("CREATE TABLE Language LIKE CountryLanguage Type=InnoDB");
60
-

61
-
/* set autocommit to off */
62
-
$mysqli->autocommit(FALSE);
63
-

64
-
/* Insert some values */
65
-
$mysqli->query("INSERT INTO Language VALUES ('DEU', 'Bavarian', 'F', 11.2)");
66
-
$mysqli->query("INSERT INTO Language VALUES ('DEU', 'Swabian', 'F', 9.4)");
67
-

68
-
/* commit transaction */
69
-
$mysqli->commit();
70
-

71
-
/* drop table */
72
-
$mysqli->query("DROP TABLE Language");
73
-

74
-
/* close connection */
75
-
$mysqli->close();
76
-
?>
77
-
]]>
78
-
</programlisting>
79
-
</example>
80
-
<example>
81
-
<title>Procedural style</title>
82
-
<programlisting role="php">
83
-
<![CDATA[
84
-
<?php
85
-
$link = mysqli_connect("localhost", "my_user", "my_password", "test");
86
-

87
-
/* check connection */
88
-
if (!$link) {
89
-
printf("Connect failed: %s\n", mysqli_connect_error());
90
-
exit();
91
-
}
92
-

93
-
/* set autocommit to off */
94
-
mysqli_autocommit($link, FALSE);
95
-

96
-
mysqli_query($link, "CREATE TABLE Language LIKE CountryLanguage Type=InnoDB");
97
-

98
-
/* Insert some values */
99
-
mysqli_query($link, "INSERT INTO Language VALUES ('DEU', 'Bavarian', 'F', 11.2)");
100
-
mysqli_query($link, "INSERT INTO Language VALUES ('DEU', 'Swabian', 'F', 9.4)");
101
-

102
-
/* commit transaction */
103
-
mysqli_commit($link);
104
-

105
-
/* close connection */
106
-
mysqli_close($link);
107
-
?>
108
-
]]>
109
-
</programlisting>
110
-
</example>
94
+
See the <link linkend="mysqli.begin-transaction.example.basic"><methodname>mysqli::begin_transaction</methodname> example</link>.
111
95
</para>
112
96
</refsect1>
113
97

98
+
<refsect1 role="notes">
99
+
&reftitle.notes;
100
+
<note>
101
+
<para>
102
+
This function does not work with non transactional table types (like
103
+
MyISAM or ISAM).
104
+
</para>
105
+
</note>
106
+
</refsect1>
107
+

114
108
<refsect1 role="seealso">
115
109
&reftitle.seealso;
116
110
<para>
117
111
<simplelist>
118
112
<member><function>mysqli_autocommit</function></member>
113
+
<member><function>mysqli_begin_transaction</function></member>
119
114
<member><function>mysqli_rollback</function></member>
115
+
<member><function>mysqli_savepoint</function></member>
120
116
</simplelist>
121
117
</para>
122
118
</refsect1>
123
119

124
120
</refentry>
125
-

126
121
<!-- Keep this comment at the end of the file
127
122
Local variables:
128
123
mode: sgml
129
124