HP 3000 Manuals

Mapping HP SQL Into System Dictionary [ HP System Dictionary XL Gen. Ref. Vol. 1 ] MPE/iX 5.0 Documentation


HP System Dictionary XL Gen. Ref. Vol. 1

Mapping HP SQL Into System Dictionary 

The System Dictionary core set supports the HP SQL objects listed below
in Figure 7-7.  This subsection provides a description of each of these
objects, to show how to define them in the dictionary.
_____________________________________
|                                   |
|     column                        |
|                                   |
|     table                         |
|                                   |
|     view                          |
|                                   |
|     index                         |
|                                   |
|     DBEFileSet                    |
|                                   |
|     DBEFile                       |
|                                   |
|     module                        |
|                                   |
|     authorization group           |
|                                   |
|     user                          |
|                                   |
|     owner                         |
|                                   |
|     grants                        |
|                                   |
|     DBEnvironment                 |
|                                   |
_____________________________________

          Figure 7-7.  HP SQL Objects 

Column 

A column is an ELEMENT entity.  The data type of a column is stored in
the element attributes element-type, byte-length, display-length, and
decimal.  The HP SQL data types map into System Dictionary core set data
types as follows:

     HP SQL                       System Dictionary

                        element-type    display-   byte-     decimal
                                        length     length

     CHAR(n)                 X            n          n         -
     VARCHAR(n)              S            n          *note1    -
     INTEGER                 I           10          4         -
     SHORTINT                I            5          2         -
     FLOAT                   E           27          8         -
     DECIMAL(p[,s])          P            p          *note2    s

                                    *note1:
                                       Pascal string byte length

                                    *note2:
                                       if p is odd:  byte-length = (p+1)/2
                                       if p is even: byte-length = (p+2)/2

Table 

A table is an HPSQL-TABLE entity.  The lock mode of a table is defined in
the hpsql-table attribute hpsql-lock-mode.

For each table there should be a RECORD entity occurrence that defines
the record layout of that table.  The record layout consists of the
columns (elements) of that table, which is defined with the RECORD 
contains ELEMENT relationship type.  You should specify a byte offset for
the relative position of that element within that record.  The record
should be related to the HPSQL-TABLE entity occurrence that it describes.
This relationship is established with the HPSQL-TABLE contains RECORD 
relationship type.  Typically, only one record is related to a table to
define a table record layout.  However, you have the flexibility of
defining more than one record layout for a table entity.  Each table can
have one primary record layout which is indicated with the hpsql-table
contains record relationship type attribute primary-record.  The NOT NULL 
specification for a column is defined in the attribute not-null of the
record contains element relationship type, where the record is the
primary record of the table.

The HPDBE-FILESET contains HPSQL-TABLE relationship type defines where
the rows of the table are stored.

View 

A view is an HPSQL-VIEW entity.  The variable length attribute
hpsql-select-command defines the select command from which the view is
derived.

For each view there should be a RECORD entity occurrence that defines the
record layout of that view.  The record layout consists of the columns
(elements) of that view, which is defined with the RECORD contains 
ELEMENT relationship type.  You should specify a byte offset for the
relative position of that element within that record.  The record should
be related to the hpsql-view entity occurrence that it describes.  This
relationship is established with the HPSQL-VIEW contains RECORD 
relationship type.  Typically, only one record is related to a view to
define a view record layout.  However, you have the flexibility of
defining more than one record layout for a view entity.  Each view can
have one primary record layout which is indicated with the HPSQL-VIEW
contains RECORD relationship attribute primary-record.

Index 

An index is an HPSQL-INDEX entity.  To define the columns of the index,
use the HPSQL-INDEX contains ELEMENT relationship type.  That is, relate
each element (column), in the order they appear in the index, to the
index entity occurrence.  Relate the index occurrence to the table that
it is an index of with the HPSQL-TABLE key HPSQL-INDEX relationship type.
Attributes of the hpsql-table key hpsql-index relationship type include
hpsql-clustering to indicate whether clustering is specified for the
index and unique to specify if index values must be unique.

DBEfileset and DBEfile 

A DBEFileSet is an HPDBE-FILESET entity.  A DBEFile is an HPDBE-FILE 
entity with attributes hpdbe-file-type to define the DBEFile type and
hpdbe-pages to define the number of pages in the DBEFile.  The
relationship type HPDBE-FILESET contains HPDBE-FILE defines the DBEFiles
that belong to a DBEFileSet.  The relationship type HPDBE-FILE contains 
FILE defines the system file name by which the DBEFile is known to MPE.

Module 

A module is a module entity.

Authorization Groups and Users 

An Authorization Group and an HP SQL user are an HPSQL-AUTH-NAME entity
with the attribute hpsql-auth-name-type to indicate authorization group
or user, and with the attributes hpsql-connect-auth, hpsql-dba-auth and
hpsql-resource-auth to define the HP SQL special authorities granted an
authorization group or user (an HP SQL GRANT). To fully define a 'user'
HPSQL-AUTH-NAME entity use the relationship type HPSQL-AUTH-NAME contains 
USER MPE-ACCOUNT (3-way) to define the user and account that the 'user'
is made up of.

The relationship HPSQL-AUTH-NAME contains HPSQL-AUTH-NAME defines the
authorization groups and users that belong to an authorization group.

Owner 

HP SQL tables, views, modules and authorization groups are owned by
either an authorization group or a user.  Relationship HPSQL-AUTH-NAME 
owns HPSQL-TABLE defines the owner of an HP SQL table.  Relationship
HPSQL-AUTH-NAME owns HPSQL-VIEW defines the owner of an HP SQL view.
Relationship HPSQL-AUTH-NAME owns MODULE defines the owner of a module.
Relationship HPSQL-AUTH-NAME owns HPSQL-AUTH-NAME defines the owner of an
HP SQL authorization group.

Grants 

Privileges can be granted to a user or an authorization group regarding
access to tables, views and modules.

Relationship type HPSQL-AUTH-NAME accesses HPSQL-TABLE establishes that
the user or authorization group has access to an HP SQL table.
Relationship type HPSQL-AUTH-NAME accesses HPSQL-VIEW establishes that
the user or authorization group has access to an HP SQL view.  Both of
these relationship types have the attributes hpsql-alter-auth,
hpsql-delete-auth, hpsql-index-auth, hpsql-insert-auth, hpsql-select-auth 
and hpsql-update-auth to define the authorities the user or authorization
group has to the table or view.

Relationship type HPSQL-AUTH-NAME accesses MODULE establishes that the
user or authorization group has the authority to run the module.

The authority to update a column within a table or view can be granted to
a user or an authorization group.  Relationship type HPSQL-AUTH-NAME 
accesses ELEMENT HPSQL-TABLE (3-way) establishes that a user or
authorization group has update authority on a column within the specified
table.  Relationship type HPSQL-AUTH-NAME accesses ELEMENT HPSQL-VIEW 
(3-way) establishes that a user or authorization group has update
authority on a column within the specified view.

HP SQL has a special category of user called PUBLIC. To grant privileges
to the PUBLIC, create an hpsql-auth-name called PUBLIC and create any of
the 'accesses' relationships listed above that are needed to define what
authorities the PUBLIC has been granted.  For example, the authorities
granted the PUBLIC to table TABLE-ONE are defined by the relationship
hpsql-auth-name accesses hpsql-table where the hpsql-auth-name entity is
PUBLIC and the hpsql-table entity is TABLE-ONE with the HP SQL
authorities attributes set to define which authorities the PUBLIC has to
TABLE-ONE.

DBEnvironment 

An HP SQL DBEnvironment is an HPDBENVIRONMENT entity.  The
HPDBENVIRONMENT contains HPSQL-TABLE relationship type defines the tables
in the HP SQL DBEnvironment.  The HPDBENVIRONMENT contains HPSQL-VIEW 
relationship type defines the views in the HP SQL DBEnvironment.  The
HPDBENVIRONMENT contains HPSQL-AUTH-NAME relationship type defines the
authorization groups in the HP SQL DBEnvironment.  The HPDBENVIRONMENT 
contains HPDBE-FILESET relationship type defines the DBEFileSets in the
HP SQL DBEnvironment.  The HPDBENVIRONMENT contains HPDBE-LOGFILE 
relationship type defines the logfiles used in the HP SQL DBEnvironment.
The HPDBE-LOGFILE contains FILE relationship type defines the system file
by which the logfile is known by MPE.

[]
Figure 7-8
[]
Figure 7-9


MPE/iX 5.0 Documentation