swirl
Guide to OmniMark 8   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax   Related Concepts   Other Library Functions  
function  

db.open-table

 
 

Library: Database access (OMDB)
Import: omdb.xmd
Return type: db.table

Returns: A specific table of type db.table.


Declaration

define external db.table function db.open-table
  in    value   db.database  database
  named value   stream      table

Argument definitions

database
is a db.database object representing an open database connection.
table
is the name of the table in the database you wish to access.


Purpose

Use db.open-table to attach a db.table OMX item to an existing table in the database.

Requirements

The database connection represented by database must be:

The table must exist (else external exception OMDB501).

Usage Notes

You may open a table that is already opened. The resulting db.table object behaves independently, unlike a copy.

Example

This code sample shows two different ways of opening a table. The choice depends on whether you want to reuse the table connection or not.

  import "omdb.xmd" prefixed by db.
  
  process
      local db.database this-db
      local db.table course
      local db.table course-2
      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 table 'Course'
      db.execute-in this-db sql SQL-insert
  
      db.insert into db.open-table in this-db table 'Course' from course-data

    Related Syntax
   db.database
   dbTableClose
   db.insert
   db.update
   db.delete
   db.table
 
Related Concepts
   Using the OMDB library
 
Other Library Functions
   db.advance-recordset
   db.close
   db.commit
   db.compile-statement
   db.database
   db.delete
   db.discard
   db.document-writer-sedna
   db.execute
   db.execute-in
   db.field
   db.insert
   db.is-null
   db.move-dynamic-record
   db.move-record
   db.omdb-version
   db.omdb-version-oci10g
   db.omdb-version-oci11g
   db.omdb-version-oci8i
   db.omdb-version-oci9i
   db.omdb-version-odbc
   db.omdb-version-sedna
   db.open-oci10g
   db.open-oci11g
   db.open-oci8i
   db.open-oci9i
   db.open-odbc
   db.open-procedure
   db.open-sedna
   db.open-table
   db.prepare
   db.procedure
   db.query
   db.reader
   db.record-exists
   db.rollback
   db.set-transaction-type
   db.statement
   db.streaming-execute
   db.table
   db.update
   db.writer
 
 

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

OmniMark 8.2.0 Documentation Generated: March 13, 2008 at 3:27:39 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2008.