swirl
Guide to OmniMark 9   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Topics   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 Topics
 
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.