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

dbSetTransactionType

 
 

Library: Database access (OMDB) legacy library
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
   dbClose
   dbCommit
   dbDatabase
   dbExecute
   dbField
   dbFieldPrepare
   dbFieldSink
   dbFieldValue
   dbIsVersionCompatible
   dbLibraryVersion
   dbLibraryVersionOCI8
   dbLibraryVersionOCI8i
   dbLibraryVersionODBC
   dbOpenOCI8
   dbOpenOCI8i
   dbOpenODBC
   dbProcedure
   dbProcedureClose
   dbProcedureExecute
   dbProcedureOpen
   dbQuery
   dbRecordExists
   dbRecordMove
   dbRecordSetMove
   dbRollback
   dbSetTransactionType
   dbStatement
   dbStatementCompile
   dbStatementDiscard
   dbStatementExecute
   dbStatementStreamingExecute
   dbTable
   dbTableClose
   dbTableDelete
   dbTableInsert
   dbTableOpen
   dbTableUpdate
 
 

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

OmniMark 7.1.2 Documentation Generated: June 28, 2005 at 5:45:07 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.