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

db.field

 
 

Library: Database access (OMDB)
Import: omdb.xmd


Purpose

The db.field OMX component allows you to access the data value that exists within a row of a database record set field. This OMX component is a shelf, where each field value is placed in a separate item on the shelf, and each item key is the unique name of the field. Use the db.field OMX component in conjunction with db.database to create a connection to a database and obtain a read-only set of data from that database.

Usage Notes

Within your program, you can create as many instances of the db.field OMX component as you require by declaring global and local shelves of type "db.field". These shelves must be declared as variable.

When you use the db.query, db.execute or db.streaming-execute functions, the db.field shelf is automatically bound to the record set created by the specified SQL query. When you move the data cursor in the record set using the db.move-record function, the db.field shelf is automatically repopulated with whatever values are in the current row. You retrieve values from the db.field OMX variable with the db.reader function.

Please refer to OMX Components for a general description of OMX components and how they are used.

Related OMDB library functions

The functions

are used to establish db.field components. The db.field objects are used by the following OMDB library functions:

Example

Once you have declared your db.field OMX shelves, you can use those variables in the db.query, db.execute and db.streaming-execute functions that are part of the OmniMark Database library. For example:

  import "omdb.xmd" prefixed by db.
  
  process
     local db.database my-database
     local db.field my-query variable
  
     local stream SQL-query initial
     {  "select C.CourseName, S.StudentName, SC.Grade " ||
        "from Student S, Course C, StudentCourse SC " ||
        "where SC.CID = C.CID and S.SID = SC.SID "
     }
  
     set my-database to db.open-odbc "MyDatabase"
  
     db.query my-database SQL sql-query into my-query
  
     repeat
        exit unless db.record-exists my-query
  
        repeat over my-query
           output db.reader of my-query null '-DNF-'
           output '%t' unless #last
        again
  
        output '%n'
  
        db.move-record my-query
      again
     

    Related Syntax
   db.query
   db.move-record
   db.record-exists
   db.reader
   db.field
   db.is-null
 
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.