# CHAPTER 1: Introduction

## 1.1 Overview

There are several levels of the Host Language Interface to Empress as described below:

1. Command Language Interface

   The Command Language Interface allows SQL commands to be issued from the operating system, or within a program. There are three types of Command Language Interface:

   - UNIX Shell and Windows NT Batch Interface

     The Shell Interface allows a shell program to execute an Empress Query Language command in the UNIX environment. The Batch Interface allows a batch command file to execute an Empress Query Language command in the Windows NT environment.

   - The Standard Interface

     The Standard Interface allows a C program to execute a Query Language command and access data from Empress databases or the operating system data file which is in Empress recognizable DUMP format.

   - The SQL Precompiler

     The SQL Precompiler allows a C program to execute Query Language statements (static and dynamic embedded SQL statements) and process the data record by record.

2. Database Manipulation Language Interface

   The Database Manipulation procedures, which provide detailed, record-at-a-time access to a database. The Database Manipulation procedures comprise the mx routines and the mr routines. The mx routines are relatively simple to use and flexible enough for most applications. The mr routines are more complex, providing database access at a lower level. They are recommended only for those operations which require finer control than that provided by the mx routines. The mx routines are documented in the Empress Host Language: C Interface - mx Routines manual and the mr routines are documented in the Empress Host Language: C Kernel Level Interface - mr Routines manual.

In this manual we only discuss the Command Language Interface for UNIX Shell, Windows NT Batch and the Standard Interfaces. For Static and Dynamic Embedded SQL programming, please refer to Empress Host Language: The SQL Precompiler.

## 1.2 Database Used for the Examples

To illustrate the use of these Host Language Interfaces, examples will be taken from a database called `repairs` containing the tables `personnel` and `loans` . The `personnel` table stores information about employees - a personnel number, name, phone number, and credit limit. The `loans` table stores information about loans made to these employees - the employee name, the date the loan was made, and the amount involved. The commands used to create the two tables, and their contents, are shown below.

       CREATE TABLE personnel
            (number INTEGER,
             name CHAR (25,1),
             phone CHAR (15,1),
             credit_limit DOLLAR (6,1));

       CREATE TABLE loans
            (name CHAR (25,1),
             date DATE (1),
             amount DOLLAR (6,1));

       *** Table: personnel ***

       number  name          phone      credit_limit

       10      Kilroy        426-9681        $500.00
        3      Jones         667-2951        $500.00
        5      Mosca         544-2243        $750.00
       17      Wladislaw     723-6073        $200.00
        8      Peterson      978-6060        $250.00
        4      Scarlatti     961-7363        $100.00

       *** Table: loans ***
       name          date                   amount

       Mosca          2 February 1992      $150.00
       Jones          7 February 1992       $33.95
       Kilroy        16 February 1992      $250.00
       Wladislaw     27 February 1992       $55.00
       Jones          3 April 1992          $25.00
       Mosca          4 May 1992           $200.00
       Wladislaw     12 May 1992            $25.00
       Peterson       6 June 1992           $50.00
       Wladislaw     25 June 1992           $75.00
       Jones         12 August 1992        $300.00
       Scarlatti      5 November 1992      $120.00

You are strongly encouraged to create a database containing these two tables, and use them in working through the examples presented in this manual. However, do not run or test database applications from within your database directory. Work from a separate directory, as this reduces the danger of destroying database files if an application creates new files.

## 1.3 References

We assume that you are familiar with the C programming language, the UNIX shell or Batch commands, and database principles. If you are not, the following is a listing of recommended reference material. This manual is intended as a specific guide and reference for accessing Empress with C, the UNIX shell and Batch command files, and not as a general guide to programming or creating Empress applications.

### 1.3.1 References for UNIX

All the UNIX shell examples are based on the Bourne shell; however, they are all quite simple and should be easily understood by anyone familiar with the UNIX shell.

- Bourne, S. R. (1978). "An Introduction to the UNIX Shell." The UNIX Programmer's Manual, Vol. 2, B. W. Kernighan & M. D. McIlroy (editors), Bell Telephone Laboratories, Inc., Murray Hill, New Jersey.
- Date, C. J. (1977). An Introduction to Database Systems. Addison-Wesley, Reading, Mass., 3rd. ed.
- Kernighan, B. W., & Ritchie, D. M. (1978). The C Programming Language. Prentice-Hall, Inc., Englewood Cliffs, New Jersey 07632.
- Kernighan, B. W. & Ritchie, D. M. (1978). "UNIX Programming Second Edition." The UNIX Programmer's Manual, Vol. 2, B. W. Kernighan & M. D. McIlroy (editors), Bell Telephone Laboratories, Inc., Murray Hill, New Jersey.
- Tsichritzis, D. T., & Lochovsky, F. H. (1977). Database Management Systems. Academic Press.

### 1.3.2 References for Windows NT

- Date, C.J. (1977). An Introduction to Database Systems. Addison-Wesley, Reading, Mass., 3rd ed.
- Tsichritzis, D. T., & Lochovsky, F. H. (1977). Database Management Systems. Academic Press.
- Disk Operating System Reference, from International Business Machines.
- VC++ 4.0 On-Line Help from Microsoft Corporation.