Method and apparatus for supporting dynamic run-time object definition in a relational database management system6237003Abstract A method and system for providing dynamic run-time object definition in a relational database. A mediating layer is introduced between applications and database objects. This layer mediates access to the physical database objects, such as tables, and allows applications to embed logical instead of physical names. If desired, the mediating layer can be maintained dynamically, as applications are running. The mediating layer preferably can run on a variety of relational databases, overcoming the vendor-specific extensions to SQL that relational database vendors have introduced. Claims What is claimed is: Description FIELD OF THE INVENTION
CREATE TABLE per_source (
per_source_id int NOT NULL,
source_description varchar (255) NULL,
product_id int NULL,
per_source int NULL,
per_last_updated smalldatetime NOT NULL,
per_status smallint NULL,
CONSTRAINT XPKper_source
PRIMARY KEY (per_source_id)
)
CREATE TABLE per_tran_col_type (
column_type smallint NOT NULL,
column_type_desc varchar (31) NOT NULL,
per_source int NULL,
per_last_updated smalldatetime NOT NULL,
per_status smallint NULL,
CONSTRAINT XPKper_tran_col_type
PRIMARY KEY (column_type)
)
CREATE TABLE per_logical_object (
object_id int NOT NULL,
object_name varchar (30) NOT NULL,
per_source int NULL,
per_last_updated smalldatetime NOT NULL,
per_status smallint NULL,
CONSTRAINT XPKper_logical_object
PRIMARY KEY (object_id)
)
CREATE TABLE per_table (
table_name varchar (30) NOT NULL,
storage_type char (10) NULL,
subject_area CHAR (18) NULL,
delete_policy CHAR (18) NULL,
sequence_nbr numeric (10,0) NOT NULL,
per_source int NULL,
per_last_updated smalldatetime NOT NULL,
per_status smallint NULL,
CONSTRAINT XPKper_table
PRIMARY KEY (table_name)
)
CREATE TABLE per_key (
table_name varchar (30) NOT NULL,
key_id smallint NOT NULL,
key_type char (1) NOT NULL,
foreign_table varchar (30) NOT NULL,
per_source int NULL,
per_last_updated smalldatetime NOT NULL,
per_status smallint NULL,
CONSTRAINT XPKper_key
PRIMARY KEY (table_name, key_id)
)
CREATE TABLE per_data_type (
data_type smallint NOT NULL,
data_type_desc varchar (31) NOT NULL,
per_source int NULL,
per_last_updated smalldatetime NOT NULL,
per_status smallint NULL,
CONSTRAINT XPKper_data_type
PRIMARY KEY (data_type)
)
CREATE TABLE per_column (
column_name varchar (30) NOT NULL,
table_name char (18) NULL,
table_sequence smallint NOT NULL,
column_size int NOT NULL,
null_flag smallint NOT NULL,
sequence_flag smallint NOT NULL,
per_source int NULL,
per_last_updated smalldatetime NOT NULL,
per_status smallint NULL,
CONSTRAINT XPKper_column
PRIMARY KEY (colunm_name, table_name)
)
CREATE TABLE per_key_column (
column_name varchar (30) NOT NULL,
table_name varchar (30) NOT NULL,
table_name varchar (30) NOT NULL,
key_id smallint NOT NULL,
per_source int NULL,
per_last_updated smalldatetime NOT NULL,
per_status smallint NULL,
CONSTRAINT XPKper_key_column
PRIMARY KEY (colunm_name, table_name,
table_name, key_id)
)
CREATE TABLE per_tran_type (
tran_type smallint NOT NULL,
tran_type_name varchar (31) NOT NULL,
per_source int NULL,
per_last_updated smalldatetime NOT NULL,
per_status smallint NULL,
CONSTRAINT XPKper_tran_type
PRIMARY KEY (tran_type)
)
CREATE TABLE per_tran (
object_id int NOT NULL,
tran_type smallint NOT NULL,
tran_version char (10) NOT NULL,
per_source int NULL,
per_last_updated smalldatetime NOT NULL,
per_status smallint NULL,
CONSTRAINT XPKper_logical_tra
PRIMARY KEY (object_id, tran_type)
)
CREATE TABLE per_trigger (
object_id int NOT NULL,
tran_type smallint NOT NULL,
trigger_sequence smallint NOT NULL,
trigger_obj_name varchar (30) NOT NULL,
trigger_tran_type smallint NULL,
per_source int NULL,
per_last_updated smalldatetime NOT NULL,
per_status smallint NULL,
CONSTRAINT XPKper_trigger_det
PRIMARY KEY (object_id, tran_type,
trigger_sequence)
)
CREATE TABLE per_logical_column (
object_id int NOT NULL,
logical_col_id smallint NOT NULL,
logical_col_name varchar (30) NOT NULL,
column_name varchar (30) NOT NULL,
table_name varchar (30) NOT NULL,
per_source int NULL,
per_last_updated smalldatetime NOT NULL,
per_status smallint NULL,
CONSTRAINT XPKper_logical_col
PRIMARY KEY (object_id, logical_col_id)
)
CREATE TABLE per_tran_column (
object_id int NOT NULL,
logical_col_id smallint NOT NULL,
tran_type samllint NOT NULL,
column_type smallint NOT NULL,
join_column varchar (30) NOT NULL,
join_table varchar (30) NOT NULL,
where_flag smallint NOT NULL,
order_by_sequence smallint NOT NULL,
group_by_sequence smallint NOT NULL,
sub_tran varchar (30) NULL,
per_source int NULL,
per_last_updated smalldatetime NOT NULL,
per_status smallint NULL,
CONSTRAINT XPKper_trans_detai
PRIMARY KEY (object_id, logical_col_id,
tran_type)
)
CREATE TABLE per_index_type (
index_type smallint NOT NULL,
index_type_desc char (20) NOT NULL,
per_source int NULL,
per_last_updated smalldatetime NOT NULL,
per_status smallint NULL,
CONSTRAINT XPKper_index_type
PRIMARY KEY (index_type)
)
CREATE TABLE per_index_column (
column_sequence smallint NOT NULL,
table_name varchar (30) NOT NULL,
index_sequence smallint NOT NULL,
table_name varchar (30) NOT NULL,
column_name varchar (30) NOT NULL,
per_source int NULL,
per_last_updated smalldatetime NOT NULL,
per_status smallint NULL,
CONSTRAINT XPKper_index_colum
PRIMARY KEY (column_sequence, table_name,
index_sequence)
)
CREATE TABLE per_config (
per_version char (10) NOT NULL,
sp_version char (10) NOT NULL,
doc_version char (10) NOT NULL,
install_date smalldatetime NOT NULL,
per_source int NULL,
per_last_updated smalldatetime NOT NULL,
per_status smallint NULL,
CONSTRAINT XPKper_config
PRIMARY KEY (per_version, sp_version,
doc_version)
)
CREATE TABLE per_status (
per_status_nbr smallint NOT NULL,
per_status_name varchar (31) NOT NULL,
per_source int NULL,
per_last_updated smalldatetime NOT NULL,
per_status smallint NULL,
CONSTRAINT XPKper_status
PRIMARY KEY (per_status_nbr)
)
An exemplary method of operation of the service processor 1150 in accordance with the present invention is depicted in a flow-chart shown in FIG. 2. As shown in FIG. 2, (an instance of) the service processor 1150 receives a request from an application 100 in step 2010. Such requests are encapsulated in a data structure--i.e., the request data structure or RDS--inside an application request. In step 2020, the service processor unpacks the application request and extracts the members of the RDS. The data members include identifiers which are used by the service processor in step 2030 to access the metadata stored in the DEX. In step 2040, the identifiers are processed against the metadata. More specifically, the service processor uses the metadata to de-reference and map the contents of the request to the metadata. This processing results in a translation of identifiers in the RDS into identifiers used in the physical tables 1500. The result returned by the de-referencing procedure is a set of valid physical names for the current instance of the database. The service processor obtains the set of physical names in step 2050. The service processor then uses this data in step 2060 to construct an SQL statement which can be executed directly against the database. The service processor then executes the SQL statement in step 2070 and gathers the results from the processing of the SQL statement. The results of the execution of the SQL statement are remapped in step 2080 to the logical names in the RDS that was received in step 2010. The results are then returned in step 2090 to the application associated with the logical names that the application used when making the request. In this way, the application is entirely insulated from the physical database and the identifiers used therein. In another embodiment of the present invention, additional metadata is stored about DEX data including information as to which entity is authoritative about the data (i.e., which application "owns" the data in the physical tables and which application can update or remove the data). In a further exemplary embodiment, display and formatting information is stored for each logical object and used by an application for rendering the data accessed through the mediating layer on a monitor or in a report. Storing display and formatting information in the metadata allows applications that use such data to dynamically render the data returned to them.
|
Same subclass Same class Consider this |
||||||||||
