|
|||||
|
||||||
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. |
define external db.table function db.open-table in value db.database database named value stream table
Argument definitions
Use db.open-table to attach a db.table OMX item to an existing table in the database.
The database connection represented by database must be:
The table must exist (else external exception OMDB501).
You may open a table that is already opened. The resulting db.table object behaves independently, unlike a copy.
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