swirl Guide to OmniMark 5   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesOMX VariablesErrors
 
      Other Library Functions  
function   dbTableInsert    

Library: omdb - high level database access
Include: omdb.xin

Declaration

  define external function dbTableInsert
             value      dbTable     table
    from   read-only     stream   values
    null    value           stream    null       optional

Where:
table


values
null

Purpose

This function inserts a record into a table using the data values in a stream shelf. NULL data values may be represented as unattached streams or as an optionally defined string. The column name is identified as the key of each shelf item in the "values" argument.

Date and time fields

If the record has a date, time, or timestamp field, you must represent the field's value in the OmniMark Date and Time library format. (This format returns the time with a time zone offset from UTC time, which most databases do not provide.)

The following program adds two new courses to a curriculum. The table records can be added using two different methods. The first is to execute an SQL statement on the database. The second approach is to use the dbTable OMX component.

  process

      ; local variables
      local dbDatabase this-db
      local dbTable 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'
      }
      ;  create the database OMX objects
      set this-db to dbOpenODBC 'dbDemo'
      set course to dbTableOpen this-db table 'Course'

      ; add record to the table (Method #1)
      dbExecute this-db sql SQL-insert

      ; add record to the table (Method #2)
      dbTableInsert course from course-data

      ; 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'

        Other Library Functions
   dbClose
   dbExecute
   dbFieldValue
   dbIsVersionCompatible
   dbLibraryVersion
   dbOpenODBC
   dbQuery
   dbRecordExists
   dbRecordMove
   dbTableClose
   dbTableDelete
   dbTableInsert
   dbTableOpen
   dbTableUpdate
 
----  

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

Generated: August 11, 2000 at 3:07:07 pm
If you have any comments about this section of the documentation, send email to docerrors@omnimark.com

Copyright © OmniMark Technologies Corporation, 1988-2000.