swirl
Guide to OmniMark 9   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
    Other Library Functions  
function  

dbSetTransactionType

 
 

Library: Database access (OMDB legacy)
Include: omdb.xin

Declaration

define external dbSetTransactionType
       value dbDatabase database
    to value integer    mode

Argument definitions

database
is a dbDatabase object obtained by opening a connection to a database using one of the dbOpen functions.
mode
is the desired transaction mode, either auto commit or manual commit.


Purpose

Use dbSetTransactionType to set the mode of a database connection to either auto-commit or manual-commit.

Requirements

You must include the following line at the beginning of your OmniMark program:

  include "omdb.xin"

The dbDatabase object database must be:

The value for mode may be either

Usage Notes

The default mode is auto-commit. In this mode, every insert, delete, or update operation is a permanent change to the database. In manual-commit mode, however, these operations are not permanent until they are committed using dbCommit. In manual-commit mode, operations can be rolled back (canceled) with dbRollback.

Example

The following example shows a simple transaction comprising two database insertions:

     include "omdb.xin"
     process
  
        ; local variables
        local dbDatabase this-db
        local dbTable course
        local dbTable schedule
  
        local stream course-data variable initial
        {   '504' with key 'cid',
              'What is that Sound?' with key 'CourseName'
        }
  
        local stream schedule-data variable initial
        {   '504' with key 'cid',
            '2000/03/21' with key 'CourseDate'
        }
  
        ;  create the database OMX objects
        set this-db to dbOpenODBC 'dbDemo'
        set course to dbTableOpen this-db table 'Course'
        set schedule to dbTableOpen this-db table 'Schedule'
  
        ; start a transaction
        dbSetTransactionType this-db to DB_MANUAL_COMMIT
  
        ; add records to the two tables
        dbTableInsert course from course-data
        dbTableInsert schedule from schedule-data
  
        ; commit the transaction
        dbCommit this-db
  
        ; catch the database exceptions
        catch #external-exception identity catch-id message catch-msg
            output 'An error occurred while accessing an omDB function.%n'
            output '%g(catch-id)  :  %g(catch-msg)%n'
  
            ; if the transaction was not finished,
            ; we must roll it back in the catch
            dbRollback this-db

      Other Library Functions
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 9.1.0 Documentation Generated: September 2, 2010 at 1:38:10 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2010.