db.commit

function

Library: Database access (OMDB)
Import : omdb.xmd

Declaration
define external function db.commit
       value db.database database

Argument definitions

database
is a db.database object obtained by opening a connection to a database using one of the db.open functions.


Purpose

Use db.commit to commit all the insert, delete, or update operations performed since the last db.commit or db.rollback.

Requirements

The db.database object database must be:

Usage Notes

Calls to this function are only required if the database transaction type is db.manual-commit.

You may call the db.commit function if the transaction type for the database is auto-commit without generating an exception.

Example


  import "omdb.xmd" prefixed by db.
  
  process
      local db.database this-db
      local db.table course
      local stream SQL-insert initial
      {  "insert into Course values " ||
          " ( '503', 'Learning Through Pain'  )"
      }
  
      local stream course-data variable initial
      {   '504' with key 'CID',
            'What is that Sound?' with key 'CourseName'
      }
  
      set this-db to db.open-odbc 'dbDemo'
      set course to db.open-table in this-db named 'Course'
      db.set-transaction-type of this-db to db.manual-commit
  
      db.execute-in this-db sql SQL-insert
  
      db.insert into course from course-data
  
      db.commit this-db