Database Functions - Overview

Opus Pro provides the ability to connect to a database. Please note that it is intended to provide an easy route to display the contents of individual records and not huge lists of records. Nor should it be seen as a replacement for dedicated tools for more sophisticated database programming requirements.

Note:
A full description of databases is provided in the main Opus Help file. To open the help, click on Contents & Index option in the Help menu at the top of the Opus Editor. Search for the word databases in the Index tab of the help file for more information.

The Database OpusScript functions are unique to Database objects created in a script. In other words, you must create a new Database object in your script that references a DSN, before you can use the OpusScript Database functions.

Below are three examples, showing you how you can create a new Database object:

For a file DSN on drive d

 var myDB = new Database("FILEDSN=d:\\catalogue.dsn;")

For a DSN in default path of Opus

 var myDB = new Database("FILEDSN=catalogue.dsn;")

For Machine DSN’s

var myDB = new Database("DSN=catalogue;")

Hierarchy:

Only the specific functions listed under the Functions: heading below can be used with Database objects:

Class Hierarchy:

Database

Hierarchy of objects in Opus

Functions:

AutoCommit

Turn AutoCommit on or off for a database

Commit

Commit to database – permanently stored on database

Connect

Connect to SQL server

ExecuteSQL

The SQL database command to execute

FirstRecord

Go to First record in record set

GetCurrentRecordNumber

Get current record number in record set

GetIdentQuoteChar

Identify quote character required for table or field names containing spaces

GetLastError

Get the last database error message

GetNumberOfRecords

Get total number of records in record set

GetRecordAt

Go to a specific record number in a record set

GetRecordAtRelative

Go to a specific record number relative to current number

IsAutoCommitOn

Check if AutoCommit is on in a database

LastRecord

Go to Last record in record set

NextRecord

Go to Next record in record set

PreviousRecord

Go to Previous record in record set

Rollback

Go back to point in database before changes were made or last commit sent