Documentation Home
MySQL 9.2 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 40.5Mb
PDF (A4) - 40.6Mb
Man Pages (TGZ) - 259.7Kb
Man Pages (Zip) - 366.8Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb


MySQL 9.2 Reference Manual  /  ...  /  JavaScript Transaction API

27.3.6.9 JavaScript Transaction API

As of MySQL 9.2.0, MLE supports a JavaScript MySQL transaction API which mimics the actions of most MySQL transactional SQL statements. All of the functions listed here, along with their descriptions and SQL equivalents, are methods of the Session object:

  • commit(): Commit the ongoing transaction.

    Equivalent to COMMIT.

  • releaseSavepoint(): Release a given savepoint from an ongoing transaction. Throw an error if the savepoint name is empty.

    Equivalent to RELEASE SAVEPOINT.

  • rollback(): Roll back the ongoing transaction.

    Equivalent to ROLLBACK.

  • rollbackTo(): Go back to an existing savepoint. Throw an error if the savepoint name is empty.

    Equivalent to ROLLBACK TO SAVEPOINT.

  • setSavepoint(): Create a new savepoint with the given name (and return it). If no savepoint name is provided, one is generated.

    Equivalent to SAVEPOINT.

  • startTransaction(): Begin a new transaction.

    Equivalent to START TRANSACTION.

  • autocommit(): Get or set the value of the autocommit system variable: If session.autocommit() is called without a value, it returns the current value of autocommit; otherwise, it sets the value of autocommit.

    Equivalent to SET AUTOCOMMIT.