reference/mysqli/mysqli/rollback.xml
63b99082ef83eade08151f8cb528246fded81db9
...
...
@@ -10,17 +10,17 @@
10
10
<refsect1 role="description">
11
11
&reftitle.description;
12
12
<para>&style.oop;</para>
13
-
<methodsynopsis role="oop">
14
-
<type>bool</type><methodname>mysqli::rollback</methodname>
15
-
<methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam>
16
-
<methodparam choice="opt"><type>string</type><parameter>name</parameter></methodparam>
13
+
<methodsynopsis role="mysqli">
14
+
<modifier>public</modifier> <type>bool</type><methodname>mysqli::rollback</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
17
</methodsynopsis>
18
18
<para>&style.procedural;</para>
19
19
<methodsynopsis>
20
20
<type>bool</type><methodname>mysqli_rollback</methodname>
21
-
<methodparam><type>mysqli</type><parameter>link</parameter></methodparam>
22
-
<methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam>
23
-
<methodparam choice="opt"><type>string</type><parameter>name</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>
24
24
</methodsynopsis>
25
25
<para>
26
26
Rollbacks the current transaction for the database.
...
...
@@ -59,6 +59,11 @@
59
59
</para>
60
60
</refsect1>
61
61

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

62
67
<refsect1 role="changelog">
63
68
&reftitle.changelog;
64
69
<para>
...
...
@@ -72,10 +77,9 @@
72
77
</thead>
73
78
<tbody>
74
79
<row>
75
-
<entry>5.5.0</entry>
80
+
<entry>8.0.0</entry>
76
81
<entry>
77
-
Added <parameter>flags</parameter> and <parameter>name</parameter>
78
-
parameters.
82
+
<parameter>name</parameter> is now nullable.
79
83
</entry>
80
84
</row>
81
85
</tbody>
...
...
@@ -86,114 +90,19 @@
86
90

87
91
<refsect1 role="examples">
88
92
&reftitle.examples;
89
-
<example>
90
-
<title><methodname>mysqli::rollback</methodname> example</title>
91
-
<para>&style.oop;</para>
92
-
<programlisting role="php">
93
-
<![CDATA[
94
-
<?php
95
-
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
96
-

97
-
/* check connection */
98
-
if (mysqli_connect_errno()) {
99
-
printf("Connect failed: %s\n", mysqli_connect_error());
100
-
exit();
101
-
}
102
-

103
-
/* disable autocommit */
104
-
$mysqli->autocommit(FALSE);
105
-

106
-
$mysqli->query("CREATE TABLE myCity LIKE City");
107
-
$mysqli->query("ALTER TABLE myCity Type=InnoDB");
108
-
$mysqli->query("INSERT INTO myCity SELECT * FROM City LIMIT 50");
109
-

110
-
/* commit insert */
111
-
$mysqli->commit();
112
-

113
-
/* delete all rows */
114
-
$mysqli->query("DELETE FROM myCity");
115
-

116
-
if ($result = $mysqli->query("SELECT COUNT(*) FROM myCity")) {
117
-
$row = $result->fetch_row();
118
-
printf("%d rows in table myCity.\n", $row[0]);
119
-
/* Free result */
120
-
$result->close();
121
-
}
122
-

123
-
/* Rollback */
124
-
$mysqli->rollback();
125
-

126
-
if ($result = $mysqli->query("SELECT COUNT(*) FROM myCity")) {
127
-
$row = $result->fetch_row();
128
-
printf("%d rows in table myCity (after rollback).\n", $row[0]);
129
-
/* Free result */
130
-
$result->close();
131
-
}
132
-

133
-
/* Drop table myCity */
134
-
$mysqli->query("DROP TABLE myCity");
135
-

136
-
$mysqli->close();
137
-
?>
138
-
]]>
139
-
</programlisting>
140
-
<para>&style.procedural;</para>
141
-
<programlisting role="php">
142
-
<![CDATA[
143
-
<?php
144
-
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
145
-

146
-
/* check connection */
147
-
if (mysqli_connect_errno()) {
148
-
printf("Connect failed: %s\n", mysqli_connect_error());
149
-
exit();
150
-
}
151
-

152
-
/* disable autocommit */
153
-
mysqli_autocommit($link, FALSE);
154
-

155
-
mysqli_query($link, "CREATE TABLE myCity LIKE City");
156
-
mysqli_query($link, "ALTER TABLE myCity Type=InnoDB");
157
-
mysqli_query($link, "INSERT INTO myCity SELECT * FROM City LIMIT 50");
158
-

159
-
/* commit insert */
160
-
mysqli_commit($link);
161
-

162
-
/* delete all rows */
163
-
mysqli_query($link, "DELETE FROM myCity");
164
-

165
-
if ($result = mysqli_query($link, "SELECT COUNT(*) FROM myCity")) {
166
-
$row = mysqli_fetch_row($result);
167
-
printf("%d rows in table myCity.\n", $row[0]);
168
-
/* Free result */
169
-
mysqli_free_result($result);
170
-
}
171
-

172
-
/* Rollback */
173
-
mysqli_rollback($link);
174
-

175
-
if ($result = mysqli_query($link, "SELECT COUNT(*) FROM myCity")) {
176
-
$row = mysqli_fetch_row($result);
177
-
printf("%d rows in table myCity (after rollback).\n", $row[0]);
178
-
/* Free result */
179
-
mysqli_free_result($result);
180
-
}
181
-

182
-
/* Drop table myCity */
183
-
mysqli_query($link, "DROP TABLE myCity");
93
+
<para>
94
+
See the <link linkend="mysqli.begin-transaction.example.basic"><methodname>mysqli::begin_transaction</methodname> example</link>.
95
+
</para>
96
+
</refsect1>
184
97

185
-
mysqli_close($link);
186
-
?>
187
-
]]>
188
-
</programlisting>
189
-
&examples.outputs;
190
-
<screen>
191
-
<![CDATA[
192
-
0 rows in table myCity.
193
-
50 rows in table myCity (after rollback).
194
-
]]>
195
-
</screen>
196
-
</example>
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>
197
106
</refsect1>
198
107

199
108
<refsect1 role="seealso">
...
...
@@ -209,7 +118,6 @@ mysqli_close($link);
209
118
</refsect1>
210
119

211
120
</refentry>
212
-

213
121
<!-- Keep this comment at the end of the file
214
122
Local variables:
215
123
mode: sgml
216
124