diff --git a/reference/mysqlnd_ms/concepts.xml b/reference/mysqlnd_ms/concepts.xml
index 2fe7ad2ecb..f49e48a5b9 100755
--- a/reference/mysqlnd_ms/concepts.xml
+++ b/reference/mysqlnd_ms/concepts.xml
@@ -180,8 +180,23 @@
of a SQL transaction. Please, find details in the examples section.
- Future versions of the plugin might offer special settings to make
- plugin transaction safe.
+ The latest version of the mysqlnd library, as found in
+ PHP 5.3.99, allows the plugin to subclass the library C API call
+ trx_autocommit() to
+ detect the status of the autocommit mode. The PHP MySQL
+ extensions either issue a query such as SET AUTOCOMMIT=0|1
+ or use the mysqlnd library call trx_autcommit() to control
+ the autocommit setting. If an extension makes use of
+ trx_autocommit(), the plugin can be made transaction aware.
+ Transaction awareness cannot be achieved, if using SQL to set the autocommit
+ mode.
+
+
+ The experimental pluging configuration option
+ trx_stickiness=master can be used to make the plugin
+ transaction aware if using PHP 5.3.99. In this mode the plugin stops load
+ balancing if autocommit gets disabled and directs all statements to the
+ master until autocommit gets enabled.
diff --git a/reference/mysqlnd_ms/quickstart.xml b/reference/mysqlnd_ms/quickstart.xml
index d422dbd838..8a3eed1793 100755
--- a/reference/mysqlnd_ms/quickstart.xml
+++ b/reference/mysqlnd_ms/quickstart.xml
@@ -582,11 +582,90 @@ $mysqli->close();
- Future versions of the plugin may be made aware of transactions started,
- rolled back and committed using API calls. Therefore, whenever possible
- you should start using API calls to control transactions unlike using
- SQL statements, as shown in the above example.
-
+ Starting with PHP 5.3.99 the mysqlnd library allows the
+ plugin to monitor the status of the autocommit mode, if
+ the mode is set by API calls instead of using SQL statements such as
+ SET AUTOCOMMIT=0. This makes it possible for the plugin to
+ become transaction aware.
+
+
+ If using PHP 5.3.99, API calls to set the autocommit mode
+ and setting the experimental plugin configuration option
+ trx_stickiness=master
+ the plugin can automatically disable load balancing and connection switches
+ for SQL transactions. In this configuration the plugin stops load balancing,
+ if autocommit is disabled and directs all statements to
+ the master. This is done to prevent connection switches in the middle of
+ a transaction. Once autocommit gets enabled again, the plugin
+ starts to load balance statements again.
+
+
+
+ Experimental trx_stickiness setting
+
+
+
+
+
+
+
+ Outlook: transaction aware
+
+autocommit(FALSE);
+
+if (!$mysqli->query("INSERT INTO test(id) VALUES (1)")) {
+ /* Please do proper ROLLBACK in your code, don't just die */
+ die(sprintf("[%d] %s\n", $mysqli->errno, $mysqli->error));
+}
+if ($res = $mysqli->query("SELECT COUNT(*) AS _num FROM test")) {
+ $row = $res->fetch_assoc();
+ $res->close();
+ if ($row['_num'] > 1000) {
+ if (!$mysqli->query("INSERT INTO events(task) VALUES ('cleanup')")) {
+ die(sprintf("[%d] %s\n", $mysqli->errno, $mysqli->error));
+ }
+ }
+} else {
+ die(sprintf("[%d] %s\n", $mysqli->errno, $mysqli->error));
+}
+if (!$mysqli->query("UPDATE log SET last_update = NOW()")) {
+ die(sprintf("[%d] %s\n", $mysqli->errno, $mysqli->error));
+}
+if (!$mysqli->commit()) {
+ die(sprintf("[%d] %s\n", $mysqli->errno, $mysqli->error));
+}
+
+/* Plugin assumes that the transaction has ended and starts load balancing again */
+$mysqli->autocommit(TRUE);
+$mysqli->close();
+?>
+]]>
+
+
+
+
+
+ The plugin configuration option
+ trx_stickiness=master
+ is an experimental feature. It requires PHP 5.3.99.
+
+