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

db.reader

 
 

Library: Database access (OMDB)
Import: omdb.xmd
Return type: String source

Returns: Requested field data as a source.


Declaration

define external string source function db.reader of   value db.field  field null value string   null
        optional

      

Argument definitions

field
is a db.field object associated with a field in the current record in an active SQL query record set.
null
is an optional string that will be returned instead of a zero-length string when the field value is NULL.


Purpose

The db.reader function returns the requested field data as an OmniMark source.

Requirements

The database connection represented by db.database must be:

The db.field object field must be associated with a query (else external exception OMDB302).

The data cursor must be positioned on an existing row (else external exception OMDB205).

Usage Notes

To avoid external exception OMDB205, use the db.record-exists function to verify that the row exists prior to retrieving a field value.

If the record has a date, time, or timestamp field, the field's value will be formatted 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.)

If the field value is NULL, this function returns either an empty string or a string specified as argument null. The argument null, if it is used, should be outside of the normal range of field values. If no such value exists, it is safer to use db.is-null function instead.

Example


        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.field
   db.query
   db.move-record
   db.record-exists
   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.