php8.5
Home/ Manual/ mysql_xdevapi / session/ Session::commit

Session::commit

PHP function Edit on GitHub ✎

Commit transaction

Description

mysql_xdevapi\Session::commit(): Object

Commit the transaction.

Parameters Parameters

Return Values

An SqlStatementResult object.

Examples

mysql_xdevapi\Session::commit() example

php
<?php
$session    = mysql_xdevapi\getSession("mysqlx://user:password@localhost");
$collection = $session->getSchema("addressbook")->getCollection("friends");

$session->startTransaction();

$collection->add('{"John":42, "Sam":33}')->execute();
$savepoint = $session->setSavepoint();

$session->commit();
$session->close();

Source: reference/mysql_xdevapi/mysql_xdevapi/session/commit.xml · from the official PHP manual (php/doc-en)