Custom Search
|
|
Schema Data Definition Language (DDL) The schema data definition language (DDL) is used for describing a database, which maybe shared by many programs written in many languages. This description is in terms of the names and characteristics of the data items, data aggregates, records, areas, and sets included in the database, and the relationships that exist and must be maintained between occurrences of those elements in the database. l Data item. A data item is an occurrence of the smallest unit of named data. It is represented in a database by a value. l Data aggregate. A data aggregate is an occurrence of a named collection of data items within a record. There are two kinds-vectors and repeating groups. A vector is a one-dimensional sequence of data items, all of which have identical characteristics. A repeating group is a collection of data that occurs a number of times within a record occurrence. The collection may consist of data items, vectors, and repeating groups. l Record. A record is an occurrence of a named collection of zero, one, or more data items or data aggregates. This collection is specified in the schema DDL by means of a record entry. Each record entry in the schema for a database determines a type of record, of which there may be an arbitrary number of record occurrences (records) in the database. For example, there would be one occurrence of a PAYROLL-RECORD type of record for each employee. A database key is a unique value that identifies a record in the database to a run unit (program(s)). The value is made available to the run unit when a record is selected or stored and maybe used by the run unit to reselect the same record. . Set. A set is an occurrence of a named collection of records. The collection is specified in the schema DDL by means of a set entry. Each set entry in the schema for a database determines a type of set, of which there may be an arbitrary number of set occurrences (sets) in the database. Each type of set specified in the schema may have one type of record declared as its owner type of record, and one or more types of records declared as its member type of record. Each set occurrence (set) must contain one occurrence of its defined owner type of record and may contain an arbitrary number of occurrences of each of its defined member type of record types. For example, if a set type QUALIFICATIONS was defined as having owner record type EMPLOYEE and member record types JOB and SKILL, each occurrence of set type QUALIFICATIONS must contain one occurrence of record type EMPLOYEE, and may contain an arbitrary number of occurrences of record types JOB and SKILL. l Area. An area is a named collection of records that need not preserve owner/member relationships. An area may contain occurrences of one or more record types, and a record type may have occurrences in more than one area. A particular record is assigned to a single area and may not migrate between areas. l Database. A database consists of all the records, sets, and areas that are controlled by a specific schema. If a facility has multiple databases, there must be a separate schema for each database. Furthermore, the content of each database is assumed to be independent. l Program. A program is a set or group of instructions in a host language such as COBOL or FORTRAN. For the purpose of this chapter, a run unit is an execution of one or more programs. Data Manipulation Languages (DMLs) A data manipulation language (DML) is a language used to cause data to be transferred between a run unit and the database. A DML is not a complete language by itself. It is called a query language by some manufacturers. It relies on a host language to provide a framework for it and to provide the procedural capabilities required to manipulate data. DBMS Events To depict DBMS events, we selected the READ function. The sequence depicted in figure 3-15 provides a conceptual example of an application
Figure 3-15.\A conceptual view of the events that take place when an application program reads a record in a system interfaced with a DBMS. program of a particular software system reading a record. It is intended as a conceptual training aid for instructional purposes only. The numbered arrows in figure 3-15 trace a call for data by application Program 1 of System A. (Calls for data by other programs maybe handled concurrently by the DBMS, but this is not depicted in the figure.) The following events (numbered to correspond with figure 3-15) take place, depending on the software system in use, when a program attempts to read a record: 1. DML Program 1 of System A makes a call for data from Database (A) to the DBMS. 2. The DBMS analyzes the call and supplements the arguments provided in the call itself with information provided by the schema for Database (A), \ and the subschema referenced by Program 1. 3. The DBMS obtains the subschema used for System A and retrieves the description of the data in question. 4. The DBMS examines the database physical description and keys the actual physical record to read. 5. On the basis of the call for its services and the information obtained from the schema and subschema, the DBMS requests physical I/O operations, as required to execute the call, from the operating system. 6. The operating system (OS) interacts with the storage media containing the database. 7. The operating system then delivers the requested data from the actual database to the system buffers. 8. The DBMS transfers data, as required to fulfill the call, between the system buffers and the user work area (UWA) of Program 1, which originated the call. Any required data transformations between the representation of the data as it appears in the database (as declared in the schema) and the representation of the data as it appears in a program's UWA (as declared by the subschema) are handled by the DBMS. The DBMS provides status information to program 1 based on the outcome of its call, for example, error indications. The data in Program 1's UWA may be manipulated as required, using the facilities in the host language. The system buffers are shared by all programs serviced by the DBMS. Remember, programs interact with the system buffers entirely through the DBMS. |
||