Documentation Home
MySQL 9.4 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 41.2Mb
PDF (A4) - 41.3Mb
Man Pages (TGZ) - 262.8Kb
Man Pages (Zip) - 368.8Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb


27.3.6.11 JavaScript Transaction API

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 theSession object:

  • commit(): Commit the ongoing transaction.

    Equivalent toCOMMIT.

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

    Equivalent toRELEASE SAVEPOINT.

  • rollback(): Roll back the ongoing transaction.

    Equivalent toROLLBACK.

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

    Equivalent toROLLBACK TO SAVEPOINT.

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

    Equivalent toSAVEPOINT.

  • startTransaction(): Begin a new transaction.

    Equivalent toSTART TRANSACTION.

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

    Equivalent toSET AUTOCOMMIT.