Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

SQL.Commit

Saves any changes and ends the current transaction.

Component Version macOS Windows Linux Server iOS SDK
SQL 2.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "SQL.Commit"; Connection )   More

Parameters

Parameter Description Example
Connection The connection reference number gained with SQL.NewConnection. $Connection

Result

Returns "OK" or error message.

Description

Saves any changes and ends the current transaction.
Use Commit method to write transaction changes permanently to a database. It commits the work of all commands that associated with that connection.
All changes to the database since the last commit are made permanent and cannot be undone. Before a commit, all changes made since the start of the transaction can be rolled back using SQL.Rollback method.

Examples

Run something in transaction:

Set Variable [ $Command; Value: MBS("SQL.NewCommand"; $Connection; “BEGIN TRANSACTION“ ) ]
# run it
Set Variable [ $result2; Value: MBS("SQL.Execute"; $Command) ]
# and free command
Set Variable [ $result4; Value: MBS("SQL.FreeCommand"; $Command) ]

# create command
Set Variable [ $Command; Value: MBS("SQL.NewCommand"; $Connection; "some other SQL command here" ) ]
# run it
Set Variable [ $result2; Value: MBS("SQL.Execute"; $Command) ]
# and free command
Set Variable [ $result4; Value: MBS("SQL.FreeCommand"; $Command) ]


# create command
Set Variable [ $Command; Value: MBS("SQL.NewCommand"; $Connection; "some other SQL command here") ]
# run it
Set Variable [ $result2; Value: MBS("SQL.Execute"; $Command) ]
# and free command
Set Variable [ $result4; Value: MBS("SQL.FreeCommand"; $Command) ]

# commit changed
Set Variable [ $result3; Value: MBS("SQL.Commit"; $Connection) ]

See also

Example Databases

Blog Entries

This function is free to use.

Created 18th August 2014, last changed 5th September 2025


SQL.CommandType - SQL.Connect