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

db.open-table

 
 

Library: Interfaces, Database access (OMDB)
Import: omdb.xmd
Return type: dbTable
Returns: 

A specific table of type dbTable.


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.execute
   db.execute-in
   db.field
   db.insert
   db.move-record
   db.omdb-version
   db.omdb-version-oci8
   db.omdb-version-oci8i
   db.omdb-version-odbc
   db.open-oci8
   db.open-oci8i
   db.open-odbc
   db.open-procedure
   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 ] [ LEGACYLIBRARIES ] [ ERRORS ]

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

Copyright © Stilo Corporation, 1988-2005.