Commit - Maple Help

Connection

 Commit
 commit the current transaction

 Calling Sequence connection:-Commit( )

Parameters

 connection - Connection module

Description

 • Commit closes the current transaction and applies all the changes to the database.  After Commit has been called, a new transaction is in effect.
 • The current transaction can be canceled by calling Rollback.
 • Depending on the transaction isolation of the current Connection, updates made within a transaction may not be visible to other processes accessing the database until the changes are committed.  For more information about transaction isolation, see SetOptions.

Examples

Execute an update.

 > $\mathrm{driver}≔\mathrm{Database}\left[\mathrm{LoadDriver}\right]\left(\right):$
 > $\mathrm{conn}≔\mathrm{driver}:-\mathrm{OpenConnection}\left(\mathrm{url},\mathrm{name},\mathrm{pass}\right):$$\mathrm{conn}:-\mathrm{ExecuteUpdate}\left("INSERT INTO animals\left( id, name, number, mass \right) VALUES\left( 12, \text{'}cow\text{'}, 2, 513 \right)"\right):$

At this point the new row is not in the database.  If you were to exit Maple the row would be discarded.  The update must be committed before it enters the database.

 > $\mathrm{conn}:-\mathrm{Commit}\left(\right)$

Now that Commit has been executed, the new row has been added to the database.