Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

141
M D B 1 A Schema Integration Prototype for a Multidatabase System Technical Manual A Thesis Presented to the Faculty of the College of Computer Studies De La Salle University In Partial Fulfillment of the Requirements for the Degree of Bachelor of Science in Computer Science with Specialization in Software Technology by Cua, Samuel V. Gaw, Gilbert O. Kiok, Joseph T. Lau, Jerwynn Glenn N. Ms. Charibeth Ko Faculty Adviser August 11, 1999

Transcript of Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

Page 1: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

M D B 1 A Schema Integration Prototype

for a Multidatabase System

Technical Manual

A Thesis Presented to

the Faculty of the College of Computer Studies De La Salle University

In Partial Fulfillment of the Requirements for the Degree of

Bachelor of Science in Computer Science with Specialization in Software Technology

by Cua, Samuel V. Gaw, Gilbert O. Kiok, Joseph T.

Lau, Jerwynn Glenn N.

Ms. Charibeth Ko Faculty Adviser

August 11, 1999

Page 2: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

1

Table of Contents 1.0 System Modules .....................................................................................................1

1.1. Global Schema Editor ......................................................................................1 1.2. Component Schema Manager...........................................................................5 1.3. Mapping Editor................................................................................................6 1.4. Middleware......................................................................................................8

1.4.1. The Update Process..................................................................................9 1.4.2. Update Log File .....................................................................................13

2.0 Programming Standards and Conventions ........................................................15 2.1. Hungarian Notation........................................................................................15 2.2. C++ Class Naming Conventions ....................................................................16

3.0 System Files..........................................................................................................18 3.1. Schema Integration Tool ................................................................................18 3.2. Middleware....................................................................................................20 3.3. Client Application..........................................................................................21

4.0 SQL Datatypes.....................................................................................................22 4.1. Oracle Datatypes............................................................................................22 4.2. Sybase Datatypes ...........................................................................................22 4.3. Sybase to Oracle Datatype Conversion...........................................................24

5.0 SQL Statements Used ..........................................................................................25 5.1. Oracle Database queries .................................................................................25 5.2. Sybase Database queries ................................................................................26

6.0 Class References ..................................................................................................28 6.1. Database Schema Classes...............................................................................28 6.2. Mapping Rule Classes....................................................................................66

6.2.1. Core Mapping Rule classes ....................................................................66 6.2.2. Supporting Classes for Mapping Rules ...................................................95

6.3. Function Catalog classes ..............................................................................112 6.4. Schema Error Definition classes...................................................................124

Page 3: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

1

List of Figures Figure 1-1. Global Schema data structure ........................................................................1 Figure 1-2. Component Schema Data Structure ...............................................................5 Figure 1-3. The Mapping Rule classes inheritance tree ....................................................6 Figure 1-4. The Middleware ............................................................................................8 Figure 1-5. Verify Schema Changes ................................................................................9 Figure 1-6. Create Component schemas.........................................................................10 Figure 1-7. Load Component Data.................................................................................11 Figure 1-8. Integrate Data..............................................................................................12

List of Tables Table 2-1. Hungarian prefixes for variables ..................................................................15 Table 2-2. Prefixes for control variables .......................................................................16 Table 2-3. Class naming conventions............................................................................17

Listings Listing 1-1. Log File of a Successful Update Process.....................................................13 Listing 1-2. Log File of an Unsuccessful Update Process...............................................14

Page 4: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

1

Chapter 1

1 System Modules The MDB1 system is a tightly coupled federated database system that employs a global schema that employs a global schema to abstract global clients from heterogenous database systems. The system is comprised of three primary components namely the Schema Integration Tool, the Middleware, and the Client Application.

The succeeding sections outlines the major modules of the system including the data structures and algorithms involved in their implementation. These are the Global Schema Editor, the Component Schema Manager, the Mapping Editor, and the Middleware. 1.1. Global Schema Editor The main function of the Global Schema Editor is to assists the user in defining a global database. It also enables the user to define rule mapping definitions between the global schema and the component schemata. Data Structures

The Global Schema Editor uses three classes that serve to represent the global schema, the global table, and the global field. As shown in the figure, the classes that comprise a global schema are the DGlobalSchema, DGlobalTable, the DGlobalField, the definitions of which are detailed in Chapter 6.

Figure 1-1. Global Schema data structure

Global Table 1

Global Table 2

Global Table 3

Global Field 1

Global Field 1Global Field 2

Global Field 1

Global Field 2

Global Field 2

Global Field 3

Global Field 3

Global Schema Table List

Global Table 1 Field List

Global Table 2 Field List

Global Table 3 Field List

Global Field 3

Page 5: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

2

These 3 classes are derived from the DBSchema, DBTableDef, and the DBFieldDef base classes, respectively. Pseudocode A. Creating a Global Schema

1. Get the name of the global schema and check if it is a reserved word. If it is, display an error message. If not, proceed to Step 2.

2. Check if there are global tables created for the global schema. If there aren’t any, display an error message. If not, proceed to Step 3.

3. Store the global schema along with the created global tables in a pointer for a DGlobalSchema object.

B. Adding of Global Tables

1. Get the global table name and check if it is a reserved word. If it is, display an error message. If not, proceed to Step 2.

2. Check if global fields are created for the global table. If there aren’t any, display an error message. If not, proceed to Step 3.

3. Get the primary keys of the global table and store it to a CString object. Separate the primary keys with a “,” character.

4. Store the global table name, list of primary keys, and the global fields created into a pointer for a DGlobalTable object. Go to Step 5.

5. Before adding the global table to the global schema, check if the table name does not exist in the object array. If it exists, display an error message and go back to Step 1. If not, proceed to Step 6.

6. If the global table is being edited. Check if the number of Primary Keys has changed. If it does, display an error message regarding foreign key assignment. If “Yes” was selected, delete the foreign key from the object array of the global table. Otherwise, set the primary key constraint back to the original. Go to Step 7.

7. If the table name of the global table was changed and this global table is being referenced by foreign keys, search the lists of foreign keys from the global schema and changed the previous name into the new one. Go to Step 8.

8. Update the object array count of the global schema and add the global table into the object array of the current global schema.

C. Adding of Global Fields

1. Get the global field name and check if it is a reserved word. If it is, display an error message. If not, proceed to Step 2.

2. Get the field type of the global field. If it is an “AUTONUMBER” data type, get the starting index and increment value of the global field and proceed to Step 3. If it is a

Page 6: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

3

“CHAR” data type, get the length input and proceed to Step 4. If it is a “DATE” data type, no input is further required. If it is a “NUMBER” data type, get the precision and scale input and proceed to Step 5. Ignore if there are no precision and scale input. If it is a “VARCHAR2” data type, get the length input and proceed to Step 6.

3. If the increment value is equal to 0, display an error message and go back to Step 2. If not, go to Step 7.

4. If the value for the length is greater than 255 or is equal to 0, display an error message and go back to Step 2. If there is no input for the length value, set the value to 1. If there are no errors, proceed to Step 7.

5. If the precision value is greater than 38 or is equal to 0, display an error message and go back to Step 2. If there is an input for the scale and there is none for the precision, display an error message and go back to Step 2. If there are no more errors, proceed to Step 7.

6. If the value for the length is greater than 2000 is equal to 0, display an error message and go back to Step 2. If there is no input, also display an error message and go back to Step 2. If there are no more errors, proceed to Step 7.

7. Check the if the constraints for the global field has been set namely the primary key, null value and unique constraints. Also check if either the indexed ascending or indexed descending has been set. Proceed to Step 8.

8. Store the name, type, and all other values into a pointer for a DGlobalField object. Go to Step 9.

9. Before adding the global field to the global table, check if the field name does not exists in the object array. If it exists, display an error message and go back to Step 1. Otherwise, proceed to Step 10.

10. If the global field properties are being edited, and the global field is a foreign key or is being referenced by other global fields, display an error message. If “Yes” was selected, delete the foreign key from the lists of foreign keys of the global schema. Otherwise, return the field properties to the previous one. Go to Step 11.

11. If the field name was changed, and the global field is either a foreign key or is a reference to other foreign keys, search the lists of foreign keys from the global schema and changed the previous name into the new one. Go to Step 12.

12. Update the object array count of the global table and add the global field into the object array of the current global table.

D. Assigning of Foreign Key Constraints to Global Tables

1. Get the list of foreign keys. 2. If the global tables being referenced have composite keys instead

of primary keys, check if the all the fields have been referenced. If not, display an error message. If “Yes” was selected in the message box, proceed to Step 3. Otherwise proceed to Step 4. If there are no more errors, proceed to Step 5.

3. Delete the all the fields that are currently begin assigned as foreign keys. Go back to Step 1.

Page 7: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

4

4. Wait for the global user to assign the remaining into foreign keys and return to Step 2.

5. Store the foreign key assignment into a pointer for a DForeignKey object. Go to Step 6.

6. Update the object array count of the global table that stores the list of foreign keys and add the foreign key into the object array of the current global table.

E. Deleting Global Tables

1. Get the name of the global table to be deleted in the list. Go to Step 2.

2. If the global table is being referenced by foreign keys, display an error message. If “Yes” was selected, delete the foreign keys that are referencing the global table and go to Step 3. Otherwise, do not delete the global table. If there are no more errors, go to Step 3.

3. Delete the global table from the object array owned by the global schema.

F. Deleting Global Fields

1. Get the name of the global field to be deleted in the list. Go to Step 2.

2. If the global field is a foreign key or is a reference to other foreign keys, display an error message. If “Yes” was selected, delete the foreign keys in the lists of the global schema that contain the name of the global field and go to Step 3. Otherwise, do not delete the global field. If there are no more errors, go to Step 3.

3. Delete the global field from the object array owned by the global table.

Page 8: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

5

1.2. Component Schema Manager The Component Schema Manager enables the DBA to add component databases to the project, and view the schema definitions of these databases. It consists of the Connection Manager and the Component Schema Viewer modules. The queries used by this module are presented in Chapter 5 – SQL Statements. SQL data types in the Oracle and Sybase databases, and their conversions are listed in Chapter 5 –SQL data types. Data Structure The Component Schema catalog stores a collection of component schemata (Figure 1-2). The catalog is basically an object array that holds references to the component schemata. The Component Schema Catalog is basically comprised of DcomponentSchema, DComponentTable and DcomponentField objects.

Each component schema is represented by a DComponentSchema object. The DComponentSchema class is derived from the DBSchema base class, which is detaild in Chapter 6. It contains DComponentTable and DcomponentField objects that represent database tables and fields, respectively.

The DComponentTable class is derived from the DBTableDef base class,

while the DComponentField class is derived from the DBFieldDef base class. These classes are described in more detail in Chapter 6 – Class Reference.

Figure 1-2. Component Schema Data Structure

DComponentSchema

DComponentSchema

DComponentSchema

DComponentTableDComponentTable

DComponentTable

DComponentTable

DComponentTable

DComponentTable

DComponentTableDComponentTable

DComponentTable

Component Schema 1

Component Schema 2

Component Schema 3

DComponentField

DComponentFieldDComponentField

DComponentField

DComponentField

DComponentField

DComponenField

DComponentField

DComponentField

Page 9: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

6

1.3. Mapping Editor The Mapping Editor module enables the DBA to map fields in the component databases to the global schema. The mapping editor is designed to resolve various kinds of schema conflicts. Data Structures

The proponents defined a mapping rule class that would hold mapping information for a single field element in the Global Database. This class is called the DMappingRule class. And since there are different types of mapping rules, DMappingRule is made the base class for all types of mapping rules, and consequently defined several derived mapping rule classes (Figure 1-1) namely DMTValue, DMTField, DMTCondition, DMTTransformation, and DMTAggregate.

Global Field : DOIDMapping Type : string

DMappingRule

Value : string

DMTValue

Source Field : DOID

DMTField

Condition StatementsDefault Value : string

DMTCondition

Function NameParameters

DMTAggregate

Function ObjectParameters

DMTTransformation

Sequence name

DMTAutonumber

Figure 1-3. The Mapping Rule classes inheritance tree

These derived classes hold mapping-specific information for each type of

mapping. For example, DMTField holds a reference to a database field, DMTCondition holds a condition statement object, while DMTAggregate holds the name of a function and its associated parameters, and so on.

To represents mapping rule collections for global schema tables, the proponents

defined two classes – DTableMapping and DMappingRuleSet. DTableMapping defines the mapping rules for an entire database table. However, a table (in the Global Schema) can have several disjoint mapping definitions. For example, to map a global table to two different databases wherein the results of each mapping is disjoint from the other, and those two different sets of results are supposed to be “UNIONed” (in SQL terms). Such cases require several mapping entries for each table.

The DMappingRuleSet class was created to represent a table mapping entry. DMappingRuleSet is a set (or collection) of mapping rules. Likewise, it binds this collection of mapping rules through one or more join condition.

Page 10: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

7

The internal structure of these mapping rule classes are detailed in Chapter 6 – Class References. Pseudocodes A. Adding a Mapping Rule Entry

1. Get the table name currently selected. 2. Attach a new DMappingRuleSet object to the DTableMapping object

of the table. 3. Display the Define Mapping Entry dialog and update all screen

information. 4. After the user has finish with all the field mapping, check if

binding factors are needed.

B. Adding a Mapping Rule

1. Check if the current field already has a mapping. If it does, create a backup of the current mapping. If the field is defined as an autonumber, don’t allow any mapping.

2. Create a DMappingRule derived object and attach to the DMappingRuleSet object.

3. Check what type of mapping is desired and display the appropriate dialog for the mapping.

4. If the user chose to cancel his work, delete the new DMappingRule object and revert to the old DMappingRule object if applicable.

C. Adding a Binding Factor

1. Get the two fields specified by the user to bind. Create a new DBindField object and store the two fieldnames.

2. After the user clicks on OK. A final check is done to see whether all of the required binding factors are present.

3. The first test is to check whether all of the participating tables are included in the binding factors. Meaning to say, that at least one field of each participating tables is binded.

4. The second test is to see if all of the binding factors are interconnected.

D. Adding a Condition Mapping

1. Initialize a DMTCondition object and attach it to the DMappingRuleSet.

2. Allow the user to add condition statements (DConditionStmt) to the condition mapping (DMappingRuleSet).

3. Allow the user to add conditions (DCondition) to the condition statement (DConditionStmt). Each condition statement has a result, either a field or value.

A condition mapping can consist of one or more condition statement. At the same time, a condition statement can consist of one or more conditions.

Page 11: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

8

1.4. Middleware The Middleware component builds the Global Database by integrating data from the different component databases. It is comprised of three major modules, namely: the Data Loader, the Data Integrator, and the Update Manager. The Data Loader and Data Integrator modules work closely together and perform the vital part of the integration process. Thus, they are discussed in this section. Whereas, the Update Manager is discussed in the succeeding section. Figure 1-4 below depicts the middleware architecture and the interactions internally and externally.

Oracle8 Database

Global Database

Component DB1 Component DB2

Update Manager

Data Integrator

Data Loader

Middleware

PL/SQL Engine

Figure 1-4. The Middleware

Page 12: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

9

1.4.1. The Update Process The Middleware’s main function is to integrate data from the component databases into the Global Database. This data integration process may be done periodically, as defined by the DBA thru the Update Manager. The proponents refer to this integration process as the Update Process since it updates the data in Global Database. The steps involved in the Update Process are outlined and explained below: Step 1: Verify Schema Changes In order to ensure a correct update process, the Middleware checks for any schema changes in the component databases. First, the middleware connects to each participating database and queries the component schema. Then, it compares the latest schema against the schema previously recorded by the system. If there are any critical schema changes that might result in failure during data integration, the DBA is notified. (Figure 1-5)

loadschema

Middleware

CDB1 CDB2

loadschema

queryschema

queryschema

Figure 1-5. Verify Schema Changes

Page 13: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

10

Step 2: Create Component Tables In preparation for the actual data integration phase, the system needs to create a copy of the component data in the Global DB. In this step, the system creates a database schema in the Global DB for each component database. A database user (corresponding to a schema) is created for each component database. (Figure 1-6)

Accounting

Component Databases

Marketing

Global Database

UserAccounting

UserMarketing

Figure 1-6. Create Component schemas

Page 14: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

11

Step 3: Load Component Data After the component schemata are created in the Global DB, the Middleware loads the data from the component databases to their designated storage locations in the Global DB. These component data will be used to produce the integrated data in the latter steps (see Figure 1-7 below ).

Global Database

Middleware

CDB1

returns valuesfrom each table

TemporaryData

IntegratedData

copies valuesinto temporary

storage

Figure 1-7. Load Component Data

Step 4: Create Global Schema This step creates the Global Schema that would hold the final, integrated data. The system runs the scripts that are generated by the Schema Integration Tool. Included in these scripts are commands to create global tables, assign foreign keys, create indexes, and also sequences. Step 5: Create Stored Functions Next, user-defined PL/SQL functions are created in the Global Database by running the scripts defining PL/SQL functions.

Page 15: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

12

Step 6: Execute Data Integration Scripts The final step is the actual integration of data. Based from Figure 1-8, the Data Integrator module reads the scripts used for data integration (in the form of PL/SQL). Then, these PL/SQL statements are executed on the Oracle Database. Oracle’s PL/SQL Engine performs the actual parsing and executing of commands. The Engine then performs the scripts on the temporary storage of Oracle and stores the resulting data into the global database of the MDB1 system. The data produced from running the scripts are then stored into the global database.

Oracle Database

Data Integrator

Data Integration Scripts

execute PL/SQL statementsread script file

IntegratedData

TemporaryData

PL/SQL Engine

Figure 1-8. Integrate Data

Page 16: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

13

1.4.2. Update Log File The Middleware is responsible for updating the global database either periodically or manually so it is expected to be running in the network most of the time. Because of this, it will be very impractical for the DBA to personally keep track of what is happening in the Middleware all the time. To resolve this problem, the Middleware maintains a log file during the update process that will contain the participating schemata, the steps involved in the update process and a status whether each step executed successfully or not. The log file also records the exact date and time when the update process was started. For each UPM file, there is one log file that will be generated. Logs for a new update session is appended at the end of the existing log file. The update log file allows the DBA to determine whether the last update process executed successfully or not. In case there is an error during the update process, the possible cause of the error and the SQL string involved (if there is any) will be recorded in the log file. This will help the DBA to determine the cause of the error and eventually help the DBA figure out on how to resolve the error. Listing 5-12 and Listing 5-13 shows a sample log file of an update process that executes successfully and a sample log file of an update process that executes with errors.

Listing 1-1. Log File of a Successful Update Process

================================================== Update Log for Jul 21, 1999 (Thu) 02:02:42 PM -------------------------------------------------------------------------------- Participating Schemata : team_spurs, team_lakers Detect Schema Change : OK Create Error Table : OK Dump Component Data : OK Create Global Schema Script : OK PL/SQL Function Catalog Script(s) : OK PL/SQL Integration Script(s) : OK Update Process Successfully Completed. ==================================================

Page 17: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

14

Listing 1-2. Log File of an Unsuccessful Update Process

Based from Listing 1-1, the log file indicates that all the steps executed successfully. On the other hand, Listing 1-2 shows a log file wherein all the steps executed successfully except for the last step, which is the execution of the generated PL/SQL Integration Scripts. To help the DBA figure out what causes the error, there is a summary of errors right after the summary of steps involved. This will require the DBA to check out the PL/SQL Integration Script file and correct the possible problem.

Update Log for Jul 13, 1999 (Wed) 02:36:19 PM -------------------------------------------------------------------------------- Participating Schemas : team_spurs, team_lakers Detect Schema Change : OK Create Error Table : OK Dump Component Data : OK Create Global Schema Script : OK PL/SQL Function Catalog Script(s) : OK PL/SQL Integration Script(s) : FAIL Summary of error : Error encountered when executing the Integration scripts: ORA-06550: line 60, column 16: PLS-00302: component 'HEIGHT2' must be declared ORA-06550: line 60, column 1: PL/SQL: Statement ignored ORA-06550: line 67, column 7: PLS-00302: component 'POSITION2' must be declared ORA-06550: line 67, column 1: PL/SQL: Statement ignored ORA-06550: line 69, column 7: PLS-00302: component 'POSITION2' must be declared ORA-06550: line 69, column 1: PL/SQL: Statement ignored ORA-06550: line 71, column 7: PLS-00302: component 'POSITION2' must be declared ORA-06550: line 71, column 1: PL/SQL: Statement ignored =============================================================

====

Page 18: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

15

Chapter 2

2 Programming Standards and Conventions The proponents used several programming standards and conventions in the implementation of the system. These standards are mostly related to programming in Microsoft Visual C++. 2.1. Hungarian Notation Throughout the implementation of the system in Visual C++, the proponents used the Hungarian notation in naming variables. Table 2-1 lists the prefixes used for different types of program variables. For example, in declaring class member variables, the prefix m_ is used. Variables of type number are prefixed with n, string with str, boolean with b, and so on. Thus, if a class member variable is of type string, then the variable will have an overall prefix of m_str.

Prefix Variable Type

a Array

b Boolean

d Double

g_ Global variable

h Handle

i Integer (index into)

l Long

m_ Member variable

n Integer (number of)

p Pointer to

str CString

u Unsigned integer

Table 2-1. Hungarian prefixes for variables

In addition, the proponents defined additional conventions for variables not covered:

Prefix Variable Type

oa Object Array

sa String Array

r Reference to

Page 19: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

16

For MFC control variables, the proponents used the following conventions listed in the table below:

Prefix Control Type

anim Animate

btn Button

ckbox Check Box

cmbox Combo Box

edit Edit Box

grbox Group Box

hscr Horizontal Scroll Bar

hotkey Hot Key

lbox List Box

lctrl List Control

pic Picture

progr Progress

rabox Radio Button

redit Rich Edit

sldr Slider

spin Spin

stext Static Text

tbctrl Tab Control

trctrl Tree Control

vscr Vertical Scroll Bar

Table 2-2. Prefixes for control variables

2.2. C++ Class Naming Conventions The proponents made a set of naming conventions for its C++ classes. Such conventions proved useful as it made identifying classes easier, especially with so many classes in the Visual C++ IDE.

Prefix Class Type Example

D Data structures DBSchema, DBTableDef, DBFieldDef, DMappingRule, DTableMapping, DMappingCatalog

Page 20: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

17

C MFC windows, dialogs CGlobalSchemaEditor, CMappingEditor, CDefineFunction, CDefineEntry

M System modules MSchemaLoader, MMappingGenerator, MDataIntegrator, MDumpData

E Error definition classes ESchemaDef, ETBaseClass

Table 2-3. Class naming conventions

Page 21: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

18

Chapter 3

3 System Files 3.1. Schema Integration Tool The following table lists the classes that comprise the Schema Integration Tool, and the source files where they are located.

Class Name Header File Source File CAddCondition AddCondition.h AddCondition.cpp CAddConversionFormula AddConversionFormula.h AddConversionFormula.cpp CAddFilter AddFilter.h AddFilter.cpp CAddParameter AddParameter.h AddParameter.cpp CAnimateIcon AnimateIcon.h AnimateIcon.cpp CAssignForeignKey AssignForeignKey.h AssignForeignKey.cpp CBindingFactors BindingFactors.h BindingFactors.cpp CChildFrm ChildFrm.h ChildFrm.cpp CColorStaticST ColorStaticST.h ColorStaticST.cpp CConnectionManager ConnectionManager.h ConnectionManager.cpp CConversionFormulaMan ConversionFormulaMan.h ConversionFormulaMan.cpp CCreateGlobalField CreateGlobalField.h CreateGlobalField.cpp CCreateGlobalTable CreateGlobalTable.h CreateGlobalTable.cpp CDefineAggregate DefineAggregate.h DefineAggregate.cpp CDefineCondition DefineCondition.h DefineCondition.cpp CDefineConversionFormula DefineConversionFormula.h DefineConversionFormula.cpp CDefineEntry DefineEntry.h DefineEntry.cpp CDefineFunction DefineFunction.h DefineFunction.cpp CDefineMap DefineMap.h DefineMap.cpp CDefineTransform DefineTransform.h DefineTransform.cpp CDefineTransformParameters DefineTransformParameters.h DefineTransformParameters.cpp CEditProfile EditProfile.h EditProfile.cpp CEntryList EntryList.h EntryList.cpp CErrorDialog ErrorDialog.h ErrorDialog.cpp CFieldBox FieldBox.h FieldBox.cpp CFieldList FieldList.h FieldList.cpp CGlobalProfile GlobalProfile.h GlobalProfile.cpp CGlobalSchemaEditor GlobalSchemaEditor.h GlobalSchemaEditor.cpp CInvalidateMappingDlg InvalidateMappingDlg.h InvalidateMappingDlg.cpp CMainFrm MainFrm.h MainFrm.cpp CMappingEditor MappingEditor.h MappingEditor.cpp Cmdb1_a1 mdb1_a1.h mdb1_a1.cpp Cmdb1_a1Doc mdb1_a1Doc.h mdb1_a1Doc.cpp Cmdb1_a1View mdb1_a1View.h mdb1_a1View.cpp CMdb1CompView Mdb1CompView.h Mdb1CompView.cpp CMdb1FormView Mdb1FormView.h Mdb1FormView.cpp CMdb1GlobalView Mdb1GlobalView.h Mdb1GlobalView.cpp CMdb1MapView Mdb1MapView.h Mdb1MapView.cpp CMdb1Splitter Mdb1Splitter.h Mdb1Splitter.cpp CMultiLineListBox MultiLineListBox.h MultiLineListBox.cpp CMyListCtrl MyListCtrl.h MyListCtrl.cpp

Page 22: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

19

CMySplashWnd MySplashWnd.h MySplashWnd.cpp CNewDocument NewDocument.h NewDocument.cpp CPLSQLFunctionsMan PLSQLFunctionsMan.h PLSQLFunctionsMan.cpp CProgressBar ProgressBar.h ProgressBar.cpp CSelectSchema SelectSchema.h SelectSchema.cpp CShowConnectMessage ShowConnectMessage.h ShowConnectMessage.cpp CTableFilterDlg TableFilterDlg.h TableFilterDlg.cpp CUnsupportedFields UnsupportedFields.h UnsupportedFields.cpp CViewComponentDatabase ViewComponentDatabase.h ViewComponentDatabase.cpp CWizardIntegrate1 WizardIntegrate1.h WizardIntegrate1.cpp CWizardIntegrate2 WizardIntegrate2.h WizardIntegrate2.cpp CWizardIntegrate3 WizardIntegrate3.h WizardIntegrate3.cpp CWizardIntegrate4 WizardIntegrate4.h WizardIntegrate4.cpp CWizardNew1 WizardNew1.h WizardNew1.cpp CWizardNew2 WizardNew2.h WizardNew2.cpp CWizardNew3 WizardNew3.h WizardNew3.cpp CWizardNew4 WizardNew4.h WizardNew4.cpp CWizardNew5 WizardNew5.h WizardNew5.cpp CWizardNew6 WizardNew6.h WizardNew6.cpp DBFieldDef DBFieldDef.h DBFieldDef.cpp DBindField DBindField.h DBindField.cpp DBSchema DBSchema.h DBSchema.cpp DBTableDef DBTableDef.h DBTableDef.cpp DCatalogFunction DCatalogFunction.h DCatalogFunction.cpp DComponentField DComponentField.h DComponentField.cpp DComponentSchema DComponentSchema.h DComponentSchema.cpp DComponentTable DComponentTable.h DComponentTable.cpp DCondition DCondition.h DCondition.cpp DConditionFunction DConditionFunction.h DConditionFunction.cpp DConditionStmt DConditionStmt.h DConditionStmt.cpp DConversionFormula DConversionFormula.h DConversionFormula.cpp DConversionFormulaCatalog DConversionFormulaCatalog.h DConversionFormulaCatalog.cpp DConversionFunction DConversionFunction.h DConversionFunction.cpp DCOperand DCOperand.h DCOperand.cpp DDatabaseProfile DDatabaseProfile.h DDatabaseProfile.cpp DExportField DExportField.h DExportField.cpp DExportSchema DExportSchema.h DExportSchema.cpp DExportTable DExportTable.h DExportTable.cpp DFilterEntry DFilterEntry.h DFilterEntry.cpp DForeignKey DForeignKey.h DForeignKey.cpp DFunctionCollection DFunctionCollection.h DFunctionCollection.cpp DFunctionParam DFunctionParam.h DFunctionParam.cpp DGlobalField DGlobalField.h DGlobalField.cpp DGlobalSchema DGlobalSchema.h DGlobalSchema.cpp DGlobalTable DGlobalTable.h DGlobalTable.cpp DMappingCatalog DMappingCatalog.h DMappingCatalog.cpp DMappingRule DMappingRule.h DMappingRule.cpp DMappingRuleSet DMappingRuleSet.h DMappingRuleSet.cpp DMapStringToString DMapStringToString.h DMapStringToString.cpp DMTAggregate DMTAggregate.h DMTAggregate.cpp DMTAutoNumber DMTAutoNumber.h DMTAutoNumber.cpp DMTCondition DMTCondition.h DMTCondition.cpp DMTField DMTField.h DMTField.cpp

Page 23: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

20

DMTTransformation DMTTransformation.h DMTTransformation.cpp DMTValue DMTValue.h DMTValue.cpp DOID DOID.h DOID.cpp DPLFunctionCatalog DPLFunctionCatalog.h DPLFunctionCatalog.cpp DStringList DStringList.h DStringList.cpp DTableFilter DTableFilter.h DTableFilter.cpp DTableList DTableList.h DTableList.cpp DTableMapping DTableMapping.h DTableMapping.cpp DTransformFunction DTransformFunction.h DTransformFunction.cpp ESchemaDef ESchemaDef.h ESchemaDef.cpp ETBaseClass ETBaseClass.h ETBaseClass.cpp ETDatabase ETDatabase.h ETDatabase.cpp ETField ETField.h ETField.cpp ETSchema ETSchema.h ETSchema.cpp ETTable ETTable.h ETTable.cpp MCheckMapCatalog MCheckMapCatalog.h MCheckMapCatalog.cpp MDatabaseConnection MDatabaseConnection.h MDatabaseConnection.cpp MDetectSchemaChange MdetectSchemaChange.h MDetectSchemaChange.cpp MDuplicateObject MduplicateObject.h MDuplicateObject.cpp MFile MFile.h MFile.cpp MForeignTableDetector MForeignTableDetector.h MForeignTableDetector.cpp MGetReferencingTables MGetReferencingTables.h MGetReferencingTables.cpp MMappingGenerator MMappingGenerator.h MMappingGenerator.cpp MSchemaLoader MSchemaLoader.h MSchemaLoader.cpp MSchemaWriter MSchemaWriter.h MSchemaWriter.cpp MTextFileWriter MTextFileWriter.h MTextFileWriter.cpp StdAfx.h StdAfx.cpp

3.2. Middleware The following table lists the classes that comprise the Middleware, and the source files where they are located.

Class Name Header File Source File CAnimateIcon AnimateIcon.h AnimateIcon.cpp CErrorDialog ErrorDialog.h ErrorDialog.cpp CMainFrm MainFrm.h MainFrm.cpp CMySplashWnd MySplashWnd.h MySplashWnd.cpp CProgressBar ProgressBar.h ProgressBar.cpp CSetTimerInterval SetTimerInterval.h SetTimerInterval.cpp CShowConnectMessage ShowConnectMessage.h ShowConnectMessage.cpp CUpdateDialog UpdateDialog.h UpdateDialog.cpp CUpdateManager UpdateManager.h UpdateManager.cpp CUpdateManagerDoc UpdateManagerDoc.h UpdateManagerDoc.cpp CUpdateManagerView UpdateManagerView.h UpdateManagerView.cpp DBFieldDef DBFieldDef.h DBFieldDef.cpp DBSchema DBSchema.h DBSchema.cpp DBTableDef DBTableDef.h DBTableDef.cpp DComponentField DComponentField.h DComponentField.cpp DComponentSchema DComponentSchema.h DComponentSchema.cpp DComponentTable DComponentTable.h DComponentTable.cpp

Page 24: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

21

DDatabaseProfile DDatabaseProfile.h DDatabaseProfile.cpp DExportField DExportField.h DExportField.cpp DExportSchema DExportSchema.h DExportSchema.cpp DExportTable DExportTable.h DExportTable.cpp DForeignKey DForeignKey.h DForeignKey.cpp DStringList DStringList.h DStringList.cpp DTableList DTableList.h DTableList.cpp DUpdateTimerInterval DUpdateTimerInterval.h DUpdateTimerInterval.cpp ESchemaDef ESchemaDef.h ESchemaDef.cpp ETBaseClass ETBaseClass.h ETBaseClass.cpp ETDatabase ETDatabase.h ETDatabase.cpp ETField ETField.h ETField.cpp ETSchema ETSchema.h ETSchema.cpp ETTable ETTable.h ETTable.cpp MCountItems MCountItems.h MCountItems.cpp MCreateErrorTable MCreateErrorTable.h MCreateErrorTable.cpp MCreateGlobalUser MCreateGlobalUser.h MCreateGlobalUser.cpp MDatabaseConnection MDatabaseConnection.h MDatabaseConnection.cpp MDataIntegrator2 MDataIntegrator2.h MDataIntegrator2.cpp MDateToString MDateToString.h MDateToString.cpp MDetectSchemaChange MDetectSchemaChange.h MDetectSchemaChange.cpp MDropAllGlobalTables MDropAllGlobalTables.h MDropAllGlobalTables.cpp MDumpData MDumpData.h MDumpData.cpp MDuplicateObject MDuplicateObject.h MDuplicateObject.cpp MGetReferencingTables MGetReferencingTables.h MGetReferencingTables.cpp MSchemaLoader MSchemaLoader.h MSchemaLoader.cpp MTextFileWriter MTextFileWriter.h MTextFileWriter.cpp MUpdateProcess MUpdateProcess.h MUpdateProcess.cpp StdAfx.h StdAfx.cpp

3.3. Client Application The following table lists the classes that comprise the Client Application, and the source files where they are located.

Class Name Header File Source File CClientApp ClientApp.h ClientApp.cpp CClientAppDoc ClientAppDoc.h ClientAppDoc.cpp CClientAppView ClientAppView.h ClientAppView.cpp CMainFrm MainFrm.h MainFrm.cpp CMyListCtrl MyListCtrl.h MyListCtrl.cpp CMySplashWnd MySplashWnd.h MySplashWnd.cpp CRecordsetEx RecordsetEx.h RecordsetEx.cpp CShowMessage ShowMessage.h ShowMessage.cpp StdAfx.h StdAfx.cpp

Page 25: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

22

Chapter 4

4 SQL Datatypes 4.1. Oracle Datatypes

Oracle Datatype Description

VARCHAR2(size) Variable-length character string having maximum length size bytes. Maximum size is 4000, and minimum is 1. You must specify size for a VARCHAR2.

NVARCHAR2(size) Variable-length character string having maximum length size characters or bytes, depending on the choice of national character set. Maximum size is determined by the number of bytes required to store each character, with an upper limit of 4000 bytes. You must specify size for NVARCHAR2.

NUMBER(p,s) Number having precision p and scale s. The precision p can range from 1 to 38. The scale s can range from -84 to 127.

DATE Valid date range from January 1, 4712 BC to December 31, 4712 AD.

CHAR(size) Fixed length character data of length size bytes. Maximum size is 2000 bytes. Default and minimum size is 1 byte.

NCHAR(size) Fixed-length character data of length size characters or bytes, depending on the choice of national character set. Maximum size is determined by the number of bytes required to store each character, with an upper limit of 2000 bytes. Default and minimum size is 1 character or 1 byte, depending on the character set.

4.2. Sybase Datatypes

Sybase Datatype Description

CHAR[(size)] Character data of maximum length size. If size is omitted, the default is 1. The maximum size allowed is 32,767.

CHARACTER[(size)] Same as CHAR[(size)].

VARCHAR[(size)] Same as CHAR[(size)].

CHARACTER

VARYING[(size)] Same as CHAR[(size)].

LONG VARCHAR Arbitrary length character data. The maximum size is

Page 26: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

23

limited by the maximum size of the database file (currently 2 gigabytes).

DECIMAL[(p[,s])] A decimal number with p total digits and with scale of the digits after the decimal point. The defaults are s = 6 and p = 30.

DOUBLE A double precision floating-point number stored in 8 bytes. The range of values is 2.22507385850720160e-308 to 1.79769313486231560e+308. Values held as DOUBLE are accurate to 15 significant digits, but may be subject to round-off error beyond the fifteenth digit.

FLOAT Same as REAL.

INT Signed integer of maximum value 2,147,483,647 requiring 4 bytes of storage.

INTEGER Same as INT.

NUMERIC[(p[,s])] Same as DECIMAL.

REAL A single precision floating-point number stored in 4 bytes. The range of values is 1.175494351e-38 to 3.402823466e+38. Values held as REAL are accurate to 6 significant digits, but may be subject to round-off error beyond the sixth digit.

SMALLINT Signed integer of maximum value 32,767 requiring 2 bytes of storage.

DATE A calendar date, such as a year, month and day. The year can be from the year 0001 to 9999. For historical reasons, a DATE column can also contain an hour and minute, but the TIMESTAMP data type is now recommended for anything with hours and minutes. A DATE value requires 4 bytes of storage.

TIME A time of day, containing hour, minute, second and fraction of a second. The fraction is stored to 6 decimal places. A TIME value requires 8 bytes of storage. (ODBC standards restrict TIME data type to an accuracy of seconds. For this reason you should use Time data types in WHERE clause comparisons that rely on a higher accuracy than seconds.)

TIMESTAMP A point in time, containing year, month, day, hour, minute, second and fraction of a second. The fraction is stored to 6 decimal places. A TIMESTAMP value requires 8 bytes of storage.

Page 27: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

24

4.3. Sybase to Oracle Datatype Conversion

Sybase Data Type Equivalent Oracle Data Type

CHAR CHAR

CHARACTER CHAR

VARCHAR VARCHAR2

CHARACTER VARYING VARCHAR2

DECIMAL NUMBER

DOUBLE NUMBER

FLOAT NUMBER

INT NUMBER

INTEGER NUMBER

NUMERIC NUMBER

SMALLINT NUMBER

REAL NUMBER

DATE DATE

Page 28: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

25

Chapter 5

5 SQL Statements Used 5.1. Oracle Database queries The following SQL statements are used to query the schema of an Oracle database. They are used in the MSchemaLoader class. v To query all the user tables

SELECT TABLE_NAME FROM USER_TABLES

v To query the fields and properties of a table

SELECT COLUMN_NAME, DATA_TYPE, NULLABLE, DATA_LENGTH, DATA_PRECISION, DATA_SCALE FROM USER_TAB_COLUMNS WHERE TABLE_NAME = <TABLE_NAME>

v To query the unique fields of a table

SELECT COLUMN_NAME FROM USER_CONSTRAINTS A, USER_CONS_COLUMNS B WHERE CONSTRAINT_TYPE='U' AND A.CONSTRAINT_NAME=B.CONSTRAINT_NAME AND A.TABLE_NAME = <TABLE_NAME>

v To query the primary key of a table

SELECT COLUMN_NAME FROM USER_CONSTRAINTS A, USER_CONS_COLUMNS B WHERE CONSTRAINT_TYPE='P' AND A.CONSTRAINT_NAME=B.CONSTRAINT_NAME AND A.TABLE_NAME = <TABLE_NAME>

v To query the primary keys in all tables (optimized query on primary keys)

SELECT A.TABLE_NAME, COLUMN_NAME FROM USER_CONSTRAINTS A, USER_CONS_COLUMNS B WHERE CONSTRAINT_TYPE='P' AND A.CONSTRAINT_NAME=B.CONSTRAINT_NAME ORDER BY A.TABLE_NAME ASC

v To query the unique fields in all tables (optimized query on unique fields)

SELECT A.TABLE_NAME, COLUMN_NAME FROM USER_CONSTRAINTS A, USER_CONS_COLUMNS B WHERE CONSTRAINT_TYPE='U' AND A.CONSTRAINT_NAME=B.CONSTRAINT_NAME ORDER BY A.TABLE_NAME ASC

v To query all the foreign key constraints in a table

SELECT R_CONSTRAINT_NAME, COLUMN_NAME FROM USER_CONSTRAINTS A, USER_CONS_COLUMNS B WHERE CONSTRAINT_TYPE='R' AND A.CONSTRAINT_NAME=B.CONSTRAINT_NAME AND A.TABLE_NAME= <Table name>

Page 29: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

26

ORDER BY b.constraint_name, b.position

v To query foreign key referenced tables and fields

SELECT TABLE_NAME, COLUMN_NAME FROM USER_CONS_COLUMNS WHERE CONSTRAINT_NAME = <constraint_name> ORDER BY POSITION

v To check if a composite foreign key exists

SELECT TABLE_NAME, COLUMN_NAME FROM USER_CONS_COLUMNS WHERE CONSTRAINT_NAME = <CONSTRAINT_NAME>

v To set the date and time format for the Oracle session

ALTER SESSION SET NLS_DATE_FORMAT = 'MM-DD-YYYY HH24:MI:SS'

5.2. Sybase Database queries The following SQL statements are used to query the schema of a Sybase database. They are used in the MSchemaLoader class. v To query all the user tables created by user <Username>

SELECT DISTINCT TNAME FROM SYS.SYSCOLUMNS WHERE CREATOR= <USERNAME>

v To query the fields and properties of a table

SELECT CNAME, COLTYPE, NULLS, LENGTH, SYSLENGTH, IN_PRIMARY_KEY FROM SYSCOLUMNS WHERE TNAME = <TNAME>

v To query the foreign key and other fields which are needed to query the

reference key and reference table

SELECT A.FOREIGN_KEY_ID, A.FOREIGN_TABLE_ID, A.PRIMARY_TABLE_ID, D.COLUMN_NAME FROM SYSFOREIGNKEY A, SYSTABLE B, SYS.SYSFKCOL C, SYSCOLUMN D WHERE A.FOREIGN_TABLE_ID=C.FOREIGN_TABLE_ID AND A.FOREIGN_KEY_ID=C.FOREIGN_KEY_ID AND B.TABLE_ID = A.FOREIGN_TABLE_ID AND B.TABLE_ID=D.TABLE_ID AND C.FOREIGN_COLUMN_ID=D.COLUMN_ID AND B.TABLE_NAME=<Table name>

v To query if the foreign key of a table is composite or not

SELECT A.FOREIGN_TABLE_ID, A.PRIMARY_TABLE_ID, D.COLUMN_NAME FROM SYSFOREIGNKEY A, SYSTABLE B, SYS.SYSFKCOL C, SYSCOLUMN D WHERE A.FOREIGN_TABLE_ID=C.FOREIGN_TABLE_ID AND A.FOREIGN_KEY_ID=C.FOREIGN_KEY_ID AND B.TABLE_ID= A.FOREIGN_TABLE_ID AND B.TABLE_ID=D.TABLE_ID AND C.FOREIGN_COLUMN_ID=D.COLUMN_ID AND B.TABLE_NAME=<Table name> AND A.FOREIGN_KEY_ID = <FOREIGN_KEY_ID>

Page 30: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

27

v To query a foreign key reference table

SELECT TABLE_NAME FROM SYS.SYSFOREIGNKEY, SYS.SYSTABLE WHERE PRIMARY_TABLE_ID = <primary_table_id> AND TABLE_ID = PRIMARY_TABLE_ID AND FOREIGN_TABLE_ID = <FOREIGN_TABLE_ID>

v To query a foreign key reference field

SELECT CNAME FROM SYS.SYSCOLUMNS WHERE IN_PRIMARY_KEY = 'Y' AND TNAME = <TNAME>

Page 31: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

28

Chapter 6

6 Class References 6.1. Database Schema Classes This section provides a reference to the C++ classes that make up the database schema data structure. There are 3 base classes in which the system uses: DBFieldDef, DBSchema, and DBTableDef. These 3 classes will be the foundation in which the 3 types of schema are based: component, export, and global schemata.

The DComponentField, DExportField, and DGlobalField classes derive from DBFieldDef. The DComponentSchema, DExportSchema, and DGlobalSchema classes derive from DBSchema. The DComponentTable, DExportTable, and DGlobalTable classes derive from DBTableDef.

DBFieldDef The DBFieldDef class is the base class used by the Global Editor, Component Schema Viewer and the Update Manager modules. It is derived from the CObject class. The reason for this is so that the class may use the Serialize( ) method of the CObject class to save data in the document. This class is used by the system to logically store the field of an existing table that is part of a schema whether it be in the component database or in the global database. It provides functions for manipulating the properties of a normal field in a database such a s the name, type, default value properties. Other properties include the length, scale and preicison properties. The class also includes functions for setting constraints on a field such as the Primary Key, Unique, and NULL properties. Lastly, it provides functions that lets the user create an index for the field object whether it be sorted in an ascending or descending order.

Class Members Attributes

Name Type Description

m_strFieldName CString CString member variable that is used to store the name of a field object.

m_strDataType CString CString member variable that is used to store the type of a field object.

m_strDefaultValue CString CString member variable that stores the value for the default value property for the field object.

m_nScale int Integer member variable that would contain the value for the scale property of the field object.

m_nPrecision int Integer member variable that would contain the value for

Page 32: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

29

the precision property of the field object.

m_nLength

int Integer member variable that would contain the value for the length property of the field object.

m_bNull

bool Bool member variable that would contain value for the NULL property of the object.

m_bIndexed

bool Bool member variable that would determine whether a field is to be created an index sorted in an ascending fashion.

m_bIndexed2

bool Bool member variable that would determine whether a field is to be created an index sorted in a descending fashion.

m_bUnique

bool Bool member variable that would contain the value for the Unique property of the field object.

m_bPrimary

bool Bool member variable that would contain the value for the Primary Key property of the field object.

Methods

Name Description

DBFieldDef Constructs an empty DBFieldDef object.

IsIndexed Called to determine if the field is to be created an index arranged in an ascending fashion.

IsIndexed2

Called to determine if the field is to be created an index arranged in a descending fashion.

IsNull Called to determine if the field is set to accept NULL values.

IsPrimary Called to determine whether a field is a primary key or not.

IsUnique Called to determine whether a field is accepting unique values.

GetDefaultValue

Called to determine if a field has any default value. It returns NONE if the field does not have any default values.

GetFieldName Called to return the given name of a field.

GetFieldType Called to determine the given type of a field.

GetLength Called to determine the length of a field given that the field type is either CHAR or VARCHAR2.

GetPrecision Called to determine the precision of a field given that the field type is NUMBER.

GetScale

Called to determine the scale of a precision of a field given that the field type is NUMBER.

SetDefaultValue Called to set the default value of a field.

SetFieldName Called to set the name of a field.

SetFieldType Called to set the type of a field.

SetIndexed

Called to set the indexed property of a field that is to be sorted in an ascending fashion.

SetIndexed2

Called to set the indexed property of a field that is to be sorted in a descending fashion.

Page 33: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

30

SetLength

Called to set the length property of a field if the given type is either CHAR or VARHCAR2.

SetNull Called to set the NULL property of a field.

SetPrecision

Called to set the precision property of a field if the field type is NUMBER.

SetPrimary Called to set the Primary Key property of a field.

SetScale

Called to set the scale property of a field if the field type is NUMBER.

SetUnique Called to set the Unique property of a field.

Serialize Reads or writes this object from or to an archive.

Function Specifications DBFieldDef::DBFieldDef

DBFieldDef ( ); Remarks Call this function to construct an empty DBFieldDef object.

DBFieldDef::IsIndexed

bool IsIndexed ( ); Return Value TRUE if the field is to be indexed ascendingly. FALSE if otherwise. Remarks Call this function to determine if the field is to be created an index arranged in an ascending fashion. DBFieldDef::IsIndexed2

bool IsIndexed2 ( ); Return Value TRUE if the field is to be indexed descendingly. FALSE if otherwise. Remarks Call this function to determine if the field is to be created an index arranged in a descending fashion. DBFieldDef::IsNull

bool IsNull ( ); Return Value TRUE if the field is set to accept NULL values. FALSE if otherwise. Remarks Call this function to Called to determine if the field is set to accept NULL values.

Page 34: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

31

DBFieldDef::IsPrimary

bool IsPrimary ( ); Return Value TRUE if the field is to be a primary key. FALSE if otherwise. Remarks Call this function to determine whether a field is a primary key or not. DBFieldDef::IsUnique

bool IsUnique ( ); Return Value TRUE if the field is set to have unique values. FALSE if otherwise. Remarks Call this function to determine whether a field is accepting unique values.

DBFieldDef::GetDefaultValue

CString GetDefaultValue ( ); Return Value CString that contains the default value of a field if there is any. Initially, the value is set to NONE. Remarks Call this function to determine if a field has any default value. It returns NONE if the field does not have any default values.

DBFieldDef::GetFieldName

CString GetFieldName ( ); Return Value CString that contains the given name of a field. Remarks Call this function to return the given name of a field. DBFieldDef::GetFieldType

CString GetFieldType ( ); Return Value CString that returns the given type of a field. The value could be one of four: DATE, AUTONUMBER, CHAR, NUMBER, and VARCHAR2. Remarks Call this function to determine the given type of a field. DBFieldDef::GetLength

int GetLength ( );

Page 35: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

32

Return Value Integer that returns the length of a field if its field type is either CHAR or VARCHAR2. Remarks Call this function to determine the length of a field given that the field type is either CHAR or VARCHAR2. DBFieldDef::GetPrecision

int GetPrecision ( ); Return Value Integer that returns the precision of a field if its field type is a NUMBER. Remarks Call this function to determine the precision of a field given that the field type is NUMBER. DBFieldDef::GetScale

int GetScale ( ); Return Value Integer that returns the scale of a field if its field type is a NUMBER. Remarks Call this function to determine the scale of a precision of a field given that the field type is NUMBER. DBFieldDef::Serialize

virtual void Serialize (CArchive &ar); Parameter ar

A CArchive object to serialize to or from. Remarks Call this function to read or write this object from or to an archive. DBFieldDef::SetDefaultValue

void SetDefaultValue (CString Default_Value); Parameter Default_Value

CString containing the value for the default value property of a field. Remarks Call this function to set the default value of a field. DBFieldDef::SetFieldName

void SetFieldName (CString fname); Parameter fname

CString containing the given name of a field.

Page 36: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

33

Remarks Call this function to set the name of a field. DBFieldDef::SetFieldType

void SetFieldType (CString type); Parameter type

CString containing the given type of a field Remarks Call this function to set the type of a field. DBFieldDef::SetIndexed

void SetIndexed (bool indexed); Parameter indexed

Bool that determines whether a field is to be indexed ascendingly. Remarks Call this function to set the indexed property of a field that is to be sorted in an ascending fashion. DBFieldDef::SetIndexed2

void SetIndexed2 (bool indexed); Parameter indexed

Bool that determines whether a field is to be indexed descendingly. Remarks Call this function to set the indexed property of a field that is to be sorted in a descending fashion. DBFieldDef::SetLength

void SetLength (int length); Parameter length

Integer that contains the value for the length property of a field. Remarks Call this function to set the length property of a field if the given type is either CHAR or VARCHAR2. DBFieldDef::SetNull

void SetNull (bool value); Parameter value

Bool that would determine whether a field is to accept NULL values. Remarks Call this function to set the NULL property of a field.

Page 37: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

34

DBFieldDef::SetPrecision

int SetPrecision (int precision); Parameter precision

Integer that contains the value for the precision property of a field if the given type is NUMBER. Remarks Call this function to set the precision property of a field if the field type is NUMBER. DBFieldDef::SetPrimary

void SetPrimary (bool prime); Parameter prime

Bool that would determine whether a field is to become a primary key. Remarks Call this function to set the Primary Key property of a field. DBFieldDef::SetScale

void SetScale (int scale); Parameter scale

Integer that contains the value for the scale property of a field. Remarks Call this function to set the scale property of a field if the field type is NUMBER. DBFieldDef::SetUnique

void SetUnique (bool unique); Parameter unique

Bool that would determine if field is to accept unique values. Remarks Call this function to set the Unique property of a field.

Page 38: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

35

DBSchema The DBSchema class is the base class used by the Global Editor, Component Schema Viewer and the Update Manager modules. It is derived from the CObject class. The reason for this is so that the class may use the Serialize( ) method of CObject to save data in the document.

This class is used by the system to logically store the schema of an existing component database or of the global database. It provides functions such as the addition, removal, and retrieval of tables stored by the DBTableDef class. The class uses the CTypedPtrArray class provided, by the Microsoft Foundation Classes, to store the tables in a array, represented by its member variable, m_TableList.

Class Members Attributes

Name Type Description

m_TableList

Table_List Declared as Table_List, which is a type variable declared as a CTypedPtrArray<CObArray, DBTableDef*>. m_TableList is a pointer array that represents the list of tables of class DBTableDef used by DBSchema.

m_strSchemaName

CString CString member variable that is used to store the name of the schema pointed to by m_TableList.

t_count

int Integer member variable that is used to store the number of tables in the list pointed to by m_TableList.

Methods

Name Description

AddTable Called when an element is to be added to the array.

DBSchema Constructs an empty DBSchema data structure.

DeleteTable Called to delete an element in the array specified by the index.

GetSchemaName Called to retrieve the schema name.

GetTable

Called to retrieve an element in the array specified either by index and table_name.

GetTableCount Called to get the number of elements currently in the array.

GetTableIndex

Called to get the zero-based index of the element containing the table name string specified by table.

GetTableNames Called to get the table name of each table in the schema.

Serialize Reads or writes this object from or to an archive.

SetSchemaName

Called when the schema is to be given a name specified by DB_Name.

SetTableAt

Sets the array element of m_TableList at the specified index. SetTableAt( ) will not cause the array to grow.

Page 39: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

36

Function Specifications DBSchema::AddTable

void AddTable (DBTableDef* tbl); Parameter tbl

A pointer to the DBTableDef class to be added in the array. Remarks Call this function to add an element to the array.

DBSchema::DBSchema

DBSchema ( ); Remarks Call this function to construct an empty DBSchema data structure. DBSchema::DeleteTable

bool DeleteTable (int index); bool DeleteTable (CString Table_Name); Return Value TRUE if the element in the array is deleted. FALSE if the element is not found. Parameters index

The zero-based index of the element to be deleted in the array. Table_Name

CString containing the table name of the element to be deleted in the array. Remarks Call this function to delete an element in the array specified by the index. DBSchema::GetSchemaName

CString GetSchemaName ( ); Return Value The name of the schema. Remarks Call this function to retrieve the schema name. DBSchema::GetTable

DBTableDef* GetTable (int index); DBTableDef* GetTable (CString table_name); Return Value

Page 40: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

37

A pointer to the element specified by index. Parameters index

The zero-based index of the element to be retrieved in the array. table_name

CString containing the table name of the element to be retrieved in the array. Remarks Call this function to retrieve an element in the array specified either by index and table_name. DBSchema::GetTableCount

int GetTableCount ( ); Return Value The number of elements in the array. Remarks Call this function to get the number of elements currently in the array. DBSchema::GetTableIndex

int GetTableIndex (CString table); Return Value The zero-based index of the element containing the table name specified by table. Parameter table

CString containing the table name to be located in the array. Remarks Call this function to get the zero-based index of the element containing the table name string specified by table. DBSchema::GetTableNames

int GetTableNames (DStringList &rTables); Return Value The number of items in m_TableList. It also stores to a DStringList class, rTables, the table names of each element in m_TableList. Parameter rTables

Reference to the DStringList class which would contain the table name of each element in m_TableList. Remarks Call this function to get the table name of each table in the schema. DBSchema::Serialize

virtual void Serialize (CArchive &ar);

Page 41: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

38

Parameter ar

A CArchive object to serialize to or from. Remarks Call this function to read or write this object from or to an archive. DBSchema::SetSchemaName

void SetSchemaName (CString DB_Name); Parameter DB_Name

CString that contains the name for the schema. Remarks Call this function to give the schema a name specified by DB_Name. DBSchema::SetTableAt

void SetTableAt (int index, DBTableDef* pTable); Parameters index

An integer index that is greater than or equal to 0 and is 1 less than the value returned by GetTableCount( ). pTable

An object pointer to be that is to replace the previous element in the array. Remarks Call this function to set the array element of m_TableList at the specified index. SetTableAt( ) will not cause the array to grow.

Page 42: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

39

DBTableDef The DBTableDef class is the base class used by the Global Editor, Component Schema Viewer and the Update Manager modules. It is derived from the CObject class. The reason for this is so that the class may use the Serialize( ) method of CObject to save data in the document. This class is used by the system to logically store the table of a schema of an existing component database or of the global database. It provides functions such as the addition, removal, and retrieval of fields stored by the DBFieldDef class. The class also provides functions for adding, removing, and retrieving foreign keys, which is an essential component in database table creation. The class uses the CTypedPtrArray class provided, by the Microsoft Foundation Classes, to store the tables in an array, represented by its member variable, m_FieldList.

Class Members Attributes

Name Type Description

m_FieldList

Field_List Declared as Field_List, which is a type variable declared as a CTypedPtrArray<CObArray, DBFieldDef*>. m_FieldList is a pointer array that represents the list of fields of class DBFieldDef used by DBTableDef.

nForeignKey

int Integer member variable that stores the number of fields that the table currently has.

m_oaForeignKeySet CObArray CObArray object that contains the set of foreign keys that the table owns.

m_strTableName CString CString member variable that contains the given name of the table.

m_strPrimaryKey

CString CString member variable that contains the primary or composite key string of the table. If m_strPrimaryKey is a composite key, the fields included would be separated by the '+' character.

m_strFilter

CString CString member variable that contains the filter string of the table.

m_strSeqName

CString CString member variable that contains the name of the sequence created when the data type of the field is “AUTONUMBER”.

f_count

int Integer that contains the number of fields that the table currently has.

Methods

Name Description

Page 43: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

40

AddField Called when an element is to be added to the array.

AddForeignKey Called when a foreign key is to be added to the table.

DBTableDef Constructs an empty DBTableDef object array.

DeleteField Called to delete an element in the array specified by the index.

DeleteForeignKey

Called to delete a foreign key in the array, specified by index, that the table owns.

FindFieldName Called to determine if the field, specified by fname, exists in the array.

GetField

Called to retrieve an element in the array specified either by index and table_name.

GetFieldCount Called to determine the number of elements in the array.

GetFieldIndex

Called to get the zero-based index of the element containing the field name string specified by field.

GetFieldNames Called to get the field name of each table in the schema.

GetFilter Called to return the filter string of the table.

GetForeignKeyAt

Called to return a pointer of a foreign key in the array specified by index.

GetForeignKeyCount

Returns the number of foreign key assignments that the table currently has.

GetPrimaryKey Returns the string containing the primary or composite key of the table.

GetSeqName

Returns the name of the sequence created when the field type is “AUTONUMBER”.

GetTableName Returns the given name of the table.

RemoveAllForeignKey Removes all Foreign Key from the table.

Serialize Reads or writes this object from or to an archive.

SetFieldAt

Sets the array element of m_FieldList at the specified index. SetFieldAt( ) will not cause the array to grow.

SetFilter Called to set the filter string of the table.

SetPrimaryKey Sets the primary or composite key string of the table.

SetSeqName

Sets the name of the sequence created when the field type is “AUTONUMBER”.

SetTableName Called when the schema is to be given a name specified by tbl.

Function Specifications DBTableDef::AddField

void AddField (DBFieldDef* fld); Parameter fld

Pointer to the DBFieldDef class to be added in the array. Remarks

Page 44: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

41

Call this function to add an element to the array. DBTableDef::AddForeignKey

void AddForeignKey (DForeignKey* foreign); Parameter foreign

Pointer to the DForeignKey class to be added to the array foreign keys that the table owns. Remarks Call this function to add a a foreign key is to the table.

DBTableDef::DBTableDef

DBTableDef ( ); Remarks Call this function to construct an empty DBTableDef object array. DBTableDef::DeleteField

bool DeleteField (int index); bool DeleteField (CString Field_Name); Return Value TRUE if the element is found and deleted in the array. FALSE if the element is not found in the array. Parameters index

The zero-based index of the element to be deleted in the array. Field_Name

CString containing the field name of the element to be deleted in the array. Remarks Call this function to delete an element in the array specified by the index. DBTableDef::DeleteForeignKey

bool DeleteForeignKey (int index); Return Value TRUE if the foreign key is found and deleted in the table. FALSE if the foreign key is not found. Parameter index

The zero-based index of the foreign key to be deleted in the array. Remarks Call this function to delete a foreign key in the array, specified by index, that the table owns. DBTableDef::FindFieldName

bool FindFieldName (CString fname);

Page 45: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

42

Return Value TRUE if the element is found in the array. FALSE if the element is not found in the array. Parameter fname

CString containing the field name of the element to be located in the array. Remarks Call this function to determine if the field, specified by fname, exists in the array. DBTableDef::GetField

DBFieldDef* GetField (int index); DBFieldDef* GetField (CString field_name); Return Value Pointer to the element specified by index. Parameters index

The zero-based index of the foreign key to be retrieved in the array. field_name

CString containing the field name of the element to be retrieved in the array. Remarks Call this function to retrieve an element in the array specified either by index and table_name. DBTableDef::GetFieldCount

int GetFieldCount ( ); Return Value The current number of elements in the array. Remarks Call this function to determine the number of elements in the array. DBTableDef::GetFieldIndex

int GetFieldIndex (CString field); Return Value The zero-based index of the element containing the field name specified by field. Parameter field

CString containing the field name to be located in the array. Remarks Call this function to get the zero-based index of the element containing the field name string specified by field. DBTableDef::GetFieldNames

int GetFieldNames (DStringList &rFields);

Page 46: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

43

Return Value The number of items in m_FieldList. It also stores to a DStringList class, rFields, the field names of each element in m_FieldList. Parameter rFields

Reference to the DStringList class, which would contain the field name of each element in m_FieldList. Remarks Call this function to get the field name of each table in the schema. DBTableDef::GetFilter

CString GetFilter ( ); Return Value CString containing the filter string of the table. Remarks Call this function to return the filter string of the table. DBTableDef::GetForeignKeyAt

DForeignKey* GetForeignKeyAt (int index); Return Value Pointer to a DForeignKey class containing the foreign key. Parameter index

The zero-based index of the foreign key element in the array owned by the table Remarks Call this function to return a pointer of a foreign key in the array specified by index. DBTableDef::GetForeignKeyCount

int GetForeignKeyCount ( ); Return Value Integer that contains the number of foreign key that the table has. Remarks Call this function to return the number of foreign key assignments that the table currently has. DBTableDef::GetPrimaryKey

CString GetPrimaryKey ( ); Return Value CString that contains the primary or composite key string of the table. Remarks Call this function to Returns the string containing the primary or composite key of the table.

Page 47: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

44

DBTableDef::GetSeqName

CString GetSeqName ( ); Return Value CString containing the name of the sequence created. Remarks Call this function to return the name of the sequence created when the field type is “AUTONUMBER”. DBTableDef::GetTableName

CString GetTableName ( ); Return Value CString containing the name of the table. Remarks Call this function to return the given name of the table. DBTableDef::RemoveAllForeignKey

void RemoveAllForeignKey ( ); Remarks Call this function to remove all foreign keys from the table. DBTableDef::Serialize

virtual void Serialize (CArchive &ar); Parameter ar

A CArchive object to serialize to or from. Remarks Call this function to read or write this object from or to an archive. DBTableDef::SetFieldAt

void SetFieldAt (int index, DBFieldDef* pField); Parameters index

An integer index that is greater than or equal to 0 and is 1 less than the value returned by GetFieldCount( ). pField

An object pointer to be that is to replace the previous element in the array. Remarks Call this function to set the array element of m_FieldList at the specified index. SetFieldAt( ) will not cause the array to grow. DBTableDef::SetFilter

void SetFilter (CString Filter_String);

Page 48: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

45

Parameter Filter_String

CString that contains the filter string for the table. Remarks Call this function to set the filter string of the table. DBTableDef::SetPrimaryKey

void SetPrimaryKey (CString key); Parameter key

CString that contains the list primary or composite key of the table. Remarks Call this function to set the primary or composite key string of the table. DBTableDef::SetSeqName

void SetSeqName (CString strSeqName); Parameter strSeqName

Contains the name of the sequence created when the type is “AUTONUMBER”. Remarks Call this function to set the name of the sequence created when the field type is “AUTONUMBER”. DBTableDef::SetTableName

void SetTableName (CString tbl); Parameter tbl

CString that contains the name for the table. Remarks Call this function to give the schema a name specified by tbl.

Page 49: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

46

DComponentField The DComponentField class is derived from the DBFieldDef class. It is used by the Component Schema Manager and the Middleware modules. This class represents the fields of a participating schema. It has a CString type member variable that stores the canonical data type of the field object. In addition, functions for setting and getting the value of this member variable is also provided.

Class Members Attributes

Attribute Name Type Description

m_strNativeFieldType CString CString member variable that is used to store the canonical data type of the field object.

Methods

Name Description

DComponentField Constructs an empty DComponentField object.

GetNativeFieldType Called to determine the canonical data type of the field object.

Serialize Reads or writes this object from or to an archive.

SetNativeFieldType Called to set the canonical data type of the field object.

Function Specifications DComponentField::DComponentField

DComponentField ( ); Remarks Call this function to construct an empty DComponentField object. DComponentField::GetNativeFieldType

CString GetNativeFieldType ( ); Return Value A CString containing the canonical data type of the field object. Remarks Call this functions to determine the canonical data type of the field object. DComponentField::Serialize

virtual void Serialize (CArchive &ar);

Page 50: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

47

Parameter ar

A CArchive object to serialize to or from. Remarks Call this function to read or write this object from or to an archive. DComponentField::SetNativeFieldType

void SetNativeFieldType (CString strNativeFieldType); Parameter strNativeFieldType

The canonical data type of the field object. Remarks Call this function to set the canonical data type of the field object.

Page 51: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

48

DComponentSchema The DComponentSchema class is derived from the DBSchema class. It is used by the Component Schema Manager, Mapping Editor and the Middleware modules. This class is used to represent the participating schemas that have been selected from the export schema. The component schema is structurally similar to the export schema except that the former is in a proprietary schema format and the latter is in the canonical schema format.

Class Members Methods

Name Description

DComponentSchema Constructs an empty DComponentSchema object.

Serialize Reads or writes this object from or to an archive.

Function Specifications DComponentSchema::DComponentSchema

DComponentSchema ( ); Remarks Call this function to construct an empty DComponentSchema object. DComponentSchema::Serialize

virtual void Serialize (CArchive &ar); Parameter ar

A CArchive object to serialize to or from. Remarks Call this function to read or write this object from or to an archive.

Page 52: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

49

DComponentTable The DComponentTable class is derived from the DBTableDef class. It is used by the Component Schema Manager and the Middleware modules. This class represents the tables of a participating schema.

Class Members Methods

Name Description

DComponentTable Constructs an empty DComponentTable object.

Serialize Reads or writes this object from or to an archive.

Function Specifications DComponentTable::DComponentTable

DComponentTable ( ); Remarks Call this function to construct an empty DComponentTable object. DComponentTable::Serialize

virtual void Serialize (CArchive &ar); Parameter ar

A CArchive object to serialize to or from.

Remarks Call this function to read or write this object from or to an archive.

Page 53: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

50

DDatabaseProfile The DDatabaseProfile class, used by the Connection Manager and Middleware modules, represents the profile of the different component databases being referenced to by the global database. The DDatabaseProfile is derived from the CObject class. The reason for this is so that the class may use the Serialize( ) method of CObject to save data in the document.

The Connection Manager module uses the class when it connects to the component database. It does so by storing the login parameters into a DDatabaseProfile object. The login parameters include the profile name, Data Source Name (DSN), Transparent Network Substrate (TNS), username, password, and the database connection type. The same is also true for the Middleware module when it uses the class’ stored login information to connect to the different component databases during the global database’s update process.

The DDatabaseProfile class also provides functions for setting and getting essential information, such as the profile name, DSN, TNS, username, password, and the database connection type.

Class Members Attributes

Attribute Name Type Description

m_strDatabaseType CString CString member variable that contains the connection type used when connecting to a component database. Database connection type could either be Sybase (ODBC), Oracle (ODBC) and Oracle (OCI).

m_strDSN CString CString member variable that contains the DSN or TNS. For ODBC databases, this variable stores the DSN. For Oracle database which uses OCI (Oracle Call Interface), this variable stores the TNS.

m_strPassword CString CString member variable that contains the password of a component database connection.

m_strProfileName CString CString member variable that contains the schema name of a component schema.

m_strUsername CString CString member variable that contains the username of a component database connection.

Methods

Name Description

DDatabaseProfile Constructs an empty DDatabaseProfile object.

GetDatabaseType Called to get the connection type used when connecting to a component database.

GetDSN Called to get the DSN or TNS of a component database.

GetPassword Called to get the password of a component database connection.

Page 54: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

51

GetProfileName Called to get the schema name of a component schema.

GetUsername Called to get the username of a component database connection.

Serialize Reads or writes this object from or to an archive.

SetDatabaseType Called to set the connection type of a component database.

SetDSN Called to set the DSN or TNS of a component database.

SetPassword Called to set the password of a component database connection.

SetProfileName Called to set the schema name of a component schema.

SetUsername Called to set the username of a component database connection.

Function Specifications DDatabaseProfile::DDatabaseProfile

DDatabaseProfile ( ); Remarks Call this function to construct an empty DDatabaseProfile object. DDatabaseProfile::GetDatabaseType

CString GetDatabaseType ( ); Return Value A CString containing the connection type used when connecting to a component database. Remarks Call this function to get the connection type used when connecting to a component database. DDatabaseProfile::GetDSN

CString GetDSN ( ); Return Value A CString containing the Data Service Name (DSN) or Transparent Network Substrate (TNS) of a component database. For ODBC databases, this returns the DSN. For Oracle database which uses OCI (Oracle Call Interface), this returns the TNS. Remarks Call this function to get the DSN or TNS of a component database. DDatabaseProfile::GetPassword

CString GetPassword ( ); Return Value A CString containing the password of a component database connection. Remarks Call this function to get the password of a component database connection.

Page 55: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

52

DDatabaseProfile::GetProfileName

CString GetProfileName ( ); Return Value A CString containing the schema name of a component schema. Remarks Call this function to get the schema name of a component schema. DDatabaseProfile::GetUsername

CString GetUsername ( ); Return Value A CString containing the username of a component database connection. Remarks Call this function to get the username of a component database connection. DDatabaseProfile::Serialize

virtual void Serialize (CArchive &ar); Parameter ar

A CArchive object to serialize to or from. Remarks Call this function to read or write this object from or to an archive. DDatabaseProfile::SetDatabaseType

void SetDatabaseType (CString strDatabaseType); Parameter strDatabaseType

A CString that contains the connection type used when connecting to a component

Remarks Call this function to set the connection type of a component database. DDatabaseProfile::SetDSN

void SetDSN (CString strDSN); Parameter strDSN

A CString that contains the DSN or TNS. For ODBC databases, this variable stores the DSN. For Oracle database which uses OCI (Oracle Call Interface), this variable stores the TNS.

Remarks Call this function to set the DSN or TNS of a component database. DDatabaseProfile::SetPassword

Page 56: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

53

void SetPassword (CString strPassword); Parameter strPassword

A CString that contains the password of a component database connection. Remarks Called to set the password of a component database connection. DDatabaseProfile::SetProfileName

void SetProfileName ( CString strProfileName ); Parameters strProfileName

A CString that contains the schema name of a component schema. Remarks Called to set the schema name of a component schema. DDatabaseProfile::SetUsername

void SetUsername ( CString strUsername ); Parameters strUsername

A CString that contains the username of a component database connection.

Remarks Called to set the username of a component database connection.

Page 57: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

54

DExportField The DExportField class is derived from the DBFieldDef class. It is used by the Component Schema Manager and the Middleware modules. This class represents the export fields that has been loaded from the database.

Class Members Methods

Name Description

DExportField Constructs an empty DExportField object.

Serialize Reads or writes this object from or to an archive.

Function Specifications DExportField::DExportField

DExportField ( ); Remarks Call this function to construct an empty DExportField object. DExportField::Serialize

virtual void Serialize (CArchive &ar); Parameter ar

A CArchive object to serialize to or from.

Remarks Call this function to read or write this object from or to an archive.

Page 58: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

55

DExportSchema The DExportSchema class is derived from the DBSchema class. It is used by the Component Schema Manager and the Middleware modules. This class is used to represent the export schema that has been loaded from the database.

Class Members Methods

Name Description

DExportSchema Constructs an empty DExportSchema object.

Serialize Reads or writes this object from or to an archive.

Function Specifications DExportSchema::DExportSchema

DExportSchema ( ); Remarks Call this function construct an empty DExportSchema object. DExportSchema::Serialize

virtual void Serialize (CArchive &ar); Parameter ar

A CArchive object to serialize to or from.

Remarks Call this function to read or write this object from or to an archive.

Page 59: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

56

DExportTable The DExportTable class is derived from the DBTableDef class. It is used by the Component Schema Manager and the Middleware modules.

This class represents the export tables of an export schema that has been loaded from the database. It has a boolean type member variable that determine whether an export table should be visible in the component schema viewer or not.

Class Members Attributes

Attribute Name Type Description

m_bHide bool Boolean member variable that is used to store the state whether the object should be visible or not in the schema component viewer.

Methods

Name Description

DExportTable Constructs an empty DExportTable object.

IsHide Called to determine if the object should be visible in the component schema viewer or not.

Serialize Reads or writes this object from or to an archive.

SetHide Called to set the object visible or invisible in the component schema viewer.

Function Specification DExportTable::DExportTable

DExportTable ( ); Remarks Call this function to construct an empty DExportTable object. DExportTable::IsHide

bool IsHide ( ); Return Value FALSE if the object should be visible in the component schema viewer. TRUE if otherwise. Remarks Call this function to determine if the object should be visible in the component schema viewer or not.

Page 60: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

57

DExportTable::Serialize

virtual void Serialize (CArchive &ar); Parameter ar

A CArchive object to serialize to or from.

Remarks Call this funtion to read or write this object from or to an archive. DExportTable::SetHide

void SetHide ( bool bHide ); Parameter bHide

Bool variable that determines whether the object should be visible in the component schema viewer or not.

Remarks Call this function to set the object visible or invisible in the component schema viewer.

Page 61: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

58

DForeignKey The DForeignKey class is the class being used by the Global Schema Editor, Component Schema Viewer, and the Update Manager modules. The DBTableDef makes use of DForeignKey. The DForeignKey class is being used to allow the user to add foreign key assignments to their database tables. It provides functions for the addition, deletion, and retrieval of foreign key assignments. The DForeignKey class makes use of two DStringList objects to store the list of field names either from the foreign key or from the fields that has referenced. It also has a member variable, a CString object, that stores the name of the table owning the fields that are being referenced by the foreign key set.

Class Members Attributes

Name Type Description

CString m_strReferenceTable

CString CString that contains the name of the table that the foreign key has referenced.

DStringList m_saForeignKey

DStringList DStringList object that contains the list of field name(s) that would form the foreign key set.

DStringList m_saReferenceKey

DStringList DStringList object that contains the list of field name(s) that would form the set that the foreign key has referenced.

int m_nCount

int Integer that contains the current number of foreign keys that the table owns.

Methods

Name Description

AddForeignKey

Called to add a foreign key assignment in the array, which would include the name of the foreign key and the name of the field that it has referenced.

DForeignKey Constructs an empty DForeignKey object.

GetCount Returns the number of foreign key in the array.

GetForeignKey Returns the list of foreign key names.

GetReferenceKey Returns the list of field names begin referenced by the foreign key set.

GetReferenceTable Returns the name of the table that owns the fields begin referenced by the foreign key set.

Serialize Reads or writes this object from or to an archive.

SetForeignKey Called to set the name of the foreign key in the array specified by nIndex.

SetReferenceKey Called to set the name of the field that is being referenced by the foreign key in the array specified by nIndex.

SetReferenceTable Called to set the name of the reference table or the table that owns field(s) being referenced by the foreign key.

Page 62: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

59

Function Specifications DForeignKey::AddForeignKey

void AddForeignKey (CString strForeignKey, CString strRefKey); Parameters strForeignKey

CString that contains the foreign key name. strRefKey

CString that contains the name of the field that is being referenced by the foreign key. Remarks Call this function to to add a foreign key assignment in the array, which would include the name of the foreign key and the name of the field that it has referenced. DForeignKey::DForeignKey

DForeignKey ( ); Remarks Call this function to construct an empty DForeignKey object. DForeignKey::GetCount

int GetCount ( ); Return Value Integer that contains the number of foreign key in the array. Remarks Call this function to return the number of foreign key in the array. DForeignKey::GetForeignKey

int GetForeignKey (DStringList &saFKeys); CString GetForeignKey (); Return Value Returns either one of the following: An integer that contains the number of names in the list or a CString that contains the list of foreign key names separated by a comma. Parameter saFKeys

Reference to a DStringList that contains the list of foreign key names. Remarks Call this function to return the list of foreign key names. DForeignKey::GetReferenceKey

int GetReferenceKey (DStringList &saRefKeys); CString GetReferenceKey ( );

Page 63: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

60

Return Value Returns either one of the following: An integer that contains the number of names in the list or a CString that contains the list of field names separated by a comma. Parameter saRefKeys

Reference to a DStringList that contains the list of field names that foreign key set has referenced. Remarks Call this function to return the list of field names begin referenced by the foreign key set. DForeignKey::GetReferenceTable

CString GetReferenceTable ( ); Return Value CString that contains the name of the table that owns the fields being referenced by the foreign key set. Remarks Call this function to return the name of the table that owns the fields begin referenced by the foreign key set. DForeignKey::Serialize

void Serialize (CArchive &ar); Parameter ar

A CArchive object to serialize to or from. Remarks Call this function to read or write this object from or to an archive. DForeignKey::SetForeignKey

void SetForeignKey (int nIndex, CString strFKey); Parameters nIndex

The zero-based index of the element to be replaced in the array strFKey

CString that contains the name of the foreign key. Remarks Call this function to set the name of the foreign key in the array specified by nIndex. DForeignKey::SetReferenceKey

void SetReferenceKey (int nIndex, CString strRKey); Parameters nIndex

The zero-based index of the element to be replaced in the array.

Page 64: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

61

strRefKey CString that contains the name of the field being referenced by the foreign key.

Remarks Call this function to set the name of the field that is being referenced by the foreign key in the array specified by nIndex. DForeignKey::SetReferenceTable

void SetReferenceTable (CString strReferenceTable); Parameter strReferenceTable

CString that contains the name of the table that the foreign key has referenced. Remarks Call this function to set the name of the reference table or the table that owns field(s) being referenced by the foreign key.

Page 65: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

62

DGlobalField The DGlobalField class is the class used by the Global Schema Editor module. From this class, the Global Schema Editor module is enabling the Global User to define global fields for the global tables to own, which will be mapped to the fields owned by the different component tables. This class derived from the DBFieldDef class so all functions regarding field property manipulation, such as the SetFieldName( ) and SetFieldType( ) functions, that it owns will also be made available to the Global User by using the DGlobalField class.

Class Members Attributes

Name Type Description

m_strDescription

CString CString that contains the description of the global field that will be displayed in the Global Schema Editor module.

Methods

Name Description

DGlobalField Constructs an empty DGlobalField object.

GetDescription Returns the description given to the global field.

Serialize Reads or writes this object from or to an archive

SetDescription Called to set the description of the global field.

Function Specifications

DGlobalField::DGlobalField

DGlobalField ( ); Remarks Call this function to construct an empty DGlobalField object. DGlobalField::GetDescription

CString GetDescription ( ); Return Value CString that would contain the description of the global field. Remarks Call this function to return the description given to the global field.

DGlobalField::SetDescription

Page 66: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

63

void SetDescription (CString desc); Parameter desc

CString that would contain the given description of the global field. Remarks Call this function to set the description of the global field.

DGlobalField::Serialize

virtual void Serialize (CArchive &ar); Parameter ar

A CArchive object to serialize to or from. Remarks Call this function to read or write this object from or to an archive.

Page 67: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

64

DGlobalSchema The DGlobalSchema class is the class used by the Global Schema Editor module. From this class, the Global Schema Editor module is enabling the Global User to define global schemas, which will be mapped to the different component schemas. This class derived from the DBSchema class so all functions regarding table creation and manipulation that it owns will also be made available to the Global User by using the DGlobalSchema class.

Class Members Method

Name Description

DGlobalSchema Constructs an empty DGlobalSchema object array.

Serialize Reads or writes this object from or to an archive.

Member Functions

DGlobalSchema::DGlobalSchema

DGlobalSchema ( ); Remarks Call this function to Constructs an empty DGlobalSchema object array. DGlobalSchema::Serialize

virtual void Serialize (CArchive &ar); Parameter ar

A CArchive object to serialize to or from. Remarks Call this function to read or write this object from or to an archive.

Page 68: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

65

DGlobalTable The DGlobalTable class is the class used by the Global Schema Editor module. From this class, the Global Schema Editor module is enabling the Global User to define global tables for the global schemas, which will be mapped to the tables owned by the different component schemas. This class derived from the DBTableDef class so all functions regarding field creation and manipulation as well as the creation and manipulation of foreign key assignments that it owns will also be made available to the Global User by using the DGlobalTable class.

Class Members Methods

Name Description

DGlobalTable Constructs an empty DGlobalTable object array.

Serialize Reads or writes this object from or to an archive.

Member Functions

DGlobalTable::DGlobalTable

DGlobalTable ( ); Remarks Call this function to construct an empty DGlobalTable object. DGlobalTable::Serialize

virtual void Serialize (CArchive &ar); Parameter ar

A CArchive object to serialize to or from. Remarks Call this function to read or write this object from or to an archive.

Page 69: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

66

6.2. Mapping Rule Classes This section provides a reference to the C++ classes that make up the mapping rule data structure. The reference is divided into two sub-sections – the core mapping rule classes and the supporting classes. The core mapping rule classes include DMappingCatalog, DTableMapping, DMappingRuleSet, DOID, the DMappingRule base class, and its derived classes. The supporting classes include DBindField, DCondition, DConditionStmt, DCOperand, DFilterEntry, DStringList, and DTableFilter.

6.2.1. Core Mapping Rule classes

DMappingCatalog The DMappingCatalog serves as the main repository of all mapping rule definitions in a multidatabase project. The DMappingCatalog class basically contains a collection of DTableMapping objects -- which in turn contains DMappingRuleSet and DMappingRule classes, as shown below.

DMappingCatalog DTableMappingcontains

DMappingRuleSetcontains

DMappingRulecontains

Class Members Attributes

Name Type Description

m_oaTableMapping CObArray object array containing all table mapping objects

m_nCount int count of table mapping objects

Methods

Name Description

~DMappingCatalog Class destructor.

AddTableMap Adds a table mapping object to the catalog.

DMappingCatalog Class constructor.

GetCount Gets the count of table mapping objects.

GetTableMap Gets a table mapping object.

GetTableNames Gets a list of global tables.

RemoveAllMapping Removes all mapping definitions in the catalog.

RemoveTableMap Removes a table mapping object from the catalog.

RenameSchema Renames all global schema references.

Page 70: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

67

RenameTable Renames all references to a global table.

Serialize Object serialization method.

Function Specifications DMappingCatalog::AddTableMap

void AddTableMap (CString strTable, DTableMapping* pTableMap); Parameters strTable Name of the global table whose table map object will be added. pTableMap Pointer to a table mapping object. DMappingCatalog::GetCount

int GetCount( ); Return Value Number of table mapping objects in the catalog. DMappingCatalog::GetTableMap

DTableMapping* GetTableMap (int index); Return Value Table map object at the given index. NULL if index is out of range. Parameter index Zero-based index of the object to be retrieved. DMappingCatalog::GetTableMap

DTableMapping* GetTableMap (CString strTable); Return Value Table map object of the given table. NULL no mapping object is found. Parameter strTable Name of the global table whose table map the object is to be retrieved. DMappingCatalog::GetTableNames

int GetTableNames (CStringArray& pTableNames); Return Value Number of table names returned in the string array.

Page 71: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

68

Parameter pTableNames Reference to a string array that would be populated with names of tables. DMappingCatalog::RemoveAllMappings

void RemoveAllMapping( ); DMappingCatalog::RemoveTableMap

void RemoveTableMap (CString strTable); Parameter strTable Name of table whose mapping would be removed. DMappingCatalog::RenameSchema

void RenameSchema (CString strNewSchema); Parameter strNewSchema Name of the new schema. DMappingCatalog::RenameTable

void RenameTable (CString strOld, CString strNew); Parameter strOld Old name of a table to be renamed. strNew New name to be given to a table. DMappingCatalog::Serialize

virtual void Serialize (CArchive& ar); Parameter ar Reference to a CArchive where the object is to be serialized.

Page 72: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

69

DMappingRule The DMappingRule class serves as the parent class of mapping rule classes. Since all mapping rules must have a target database field (a global schema field), this class contains a reference to a global schema field. It also contains the type of mapping rule. The global schema field is represented using an object identifier class, which we called DOID.

Class Members Attributes

Name Type Description

m_oGlobalField DOID Stores the full name of the global field

m_strMappingType CString Stores the type of mapping rule

Methods

Name Description

~DMappingRule Class destructor.

DMappingRule Class constructor.

GetGlobalFieldID Gets the field name of the global field.

GetGlobalID Gets the full id (schema.table.field) of the global field.

GetGlobalSchemaID Gets the schema name of the global field.

GetGlobalTableID Gets the table name of the global field.

GetMappingType Gets the type of mapping rule.

RenameField Renames the field name of the global field.

RenameSchema Renames the schema name of the global field.

RenameTable Renames the table name of the global field.

Serialize Serializes (writes the object) to a file.

SetGlobalID Sets the full id (schema.table.field) of the global field.

SetMappingType Sets the mapping type of the mapping rule.

Function Specifications DMappingRule::GetGlobalFieldID

CString GetGlobalFieldID( ); Return Value Field name of the global field. DMappingRule:: GetGlobalID

Page 73: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

70

CString GetGlobalID( ); Return Value Full ID of the global field. DMappingRule:: GetGlobalSchemaID

CString GetGlobalSchemaID( ); Return Value Schema name of the global field. DMappingRule:: GetGlobalTableID

CString GetGlobalTableID( ); Return Value Table name of the global field. DMappingRule:: GetMappingType

CString GetMappingType( ); Return Value Mapping type of the mapping rule. DMappingRule:: RenameField

void RenameField (CString strNewName); Parameter strNewName New field name. DMappingRule:: RenameSchema

void RenameSchema (CString strNewName); Parameter strNewName New schema name. DMappingRule:: RenameTable

void RenameTable (CString strNewName); Parameter strNewName New table name. DMappingRule:: Serialize

virtual void Serialize (CArchive &ar); Parameter

Page 74: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

71

ar Reference to the CArchive where the object is serialized. DMappingRule:: SetGlobalID

void SetGlobalID(CString strSchema, CString strTable, CString strField); Parameters strSchema Schema name for the global field ID. strTable Table name for the global field ID. strField Field name for the global field ID. DMappingRule:: SetMappingType

void SetMappingType(CString strType); Parameter strType Mapping type of the mapping rule.

Page 75: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

72

DMappingRuleSet DMappingRuleSet contains an object array that holds mapping rules (DMappingRule) defined for each field in the Global table. It also contains a validity flag that indicates whether the mapping rule is in a valid state. In order to bind the participating tables from different databases, a binding factor attribute is utilized to specify the join conditions between participating tables. Lastly, it has a DTableFilter data structure for filtering the rows that will be inserted to the global table.

Class Members Attributes

Name Type Description

m_oaMappingRule CObArray object array that holds the collection of mapping rules for a rule set.

m_nCount int count of mapping rules in the object array.

m_TableFilter DTableFilter* object pointer to a Table Filter

m_oaBindFactor CObArray object array that holds the collection of binding factors for a rule set.

m_nBindCount int count of binding factors in the object array

m_bValid bool flag for determining if a ruleset is valid or not

Methods

Name Description

~DMappingRuleSet Class destructor.

AddBind Add a binding factor.

AddReplaceRule Adds or replaces a mapping rule for a field.

AddRule Adds a mapping rule to the set.

CheckBindComplete Checks if the binding factor is complete and correct.

CheckMissingTables Checks if there are participating tables that are not included in binding factors.

CheckReferencedFields Collects missing component fields referenced by the mapping rule set.

CheckReferencedTables Collects missing component tables referenced by the mapping rule set.

DeleteRule Deletes a mapping rule from the set.

DMappingRuleSet Class constructor.

GetBind Gets a binding factor object.

GetBindCount Gets the number of binding factors.

GetBindFactorTables Collects names of tables that participated in binding factors.

GetCount Gets the number of mapping rules.

GetParticipatingFields Collects all names of participating fields.

Page 76: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

73

GetParticipatingFunctions Collects all names of participating functions.

GetParticipatingTables Collects all names of participating tables.

GetRule Gets a pointer to a mapping rule object.

GetTableFilter Gets a reference to the Table Filter.

IsValid Checks if the mapping rule is valid.

RemoveAllBind Removes all binding factors.

RemoveBind Removes a binding factor object.

RenameField Renames a global field referenced in the mapping rule set.

RenameSchema Renames the global schema referenced in the mapping rule set.

RenameTable Renames a global table referenced in the mapping rule set.

Serialize Writes the object to file or reads the object from file.

SetTableFilter Sets the Table Filter object for the mapping rule set.

SetValid Sets the mapping rule set as valid or invalid.

Function Specifications DMappingRuleSet::AddBind

void AddBind (DBindField* pBind); Parameter pBind DBindField object pointer to add to the array.

DMappingRuleSet:: AddReplaceRule

void AddReplaceRule (DMappingRule* pRule); Parameter pRule Pointer to the mapping rule object. DMappingRuleSet:: AddRule void AddRule (DMappingRule* pRule); Parameter pRule Pointer to the mapping rule object. DMappingRuleSet:: CheckBindComplete

bool CheckBindComplete (DStringList &SetA, DStringList &SetB); Return Value TRUE if binding factors is complete. If binding is not complete, the list of tables not bound is returned in SetB string array.

Page 77: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

74

Parameters SetA List of participating table names. SetB List of tables not bound. DMappingRuleSet:: CheckMissingTables

int CheckMissingTables (CStringArray &pTables); Return Value Number of tables which were not bound. Parameter pTables List of participating tables. DMappingRuleSet:: CheckReferencedFields

int CheckReferencedFields (DStringList saComponentFields, DStringList &saMissingFields); Return Value Number of missing component fields referenced in the ruleset. Parameter saComponentFields List of component fields. saMissingFields List of missing component fields referenced in the ruleset. DMappingRuleSet:: CheckReferencedTables

int CheckReferencedTables (DStringList saComponentTables, DStringList &saMissingTables); Return Value Number of missing component tables referenced in the ruleset. Parameters saComponentFields List of component tables. saMissingFields List of missing component tables referenced in the ruleset. DMappingRuleSet:: DeleteRule

void DeleteRule (CString strField); Parameter strField

Name of the field whose mapping rule is to be deleted.

Page 78: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

75

DMappingRuleSet:: GetBind

DBindField* GetBind (int iIndex); Return Value Pointer to a DBindField object. Parameter index Zero-based index of the binding factor. DMappingRuleSet:: GetBindCount

int GetBindCount ( ); Return Value Count of binding factors in the ruleset. DMappingRuleSet:: GetBindFactorTables

int GetBindFactorTables (DStringList &rTables); Return Value Number of participating tables in the binding factors. Parameter rTables List of participating tables in the binding factors. DMappingRuleSet:: GetCount

int GetCount ( ); Return Value Count of mapping rules. DMappingRuleSet:: GetParticipatingFields

int GetParticipatingFields (DStringList &pFields); Return Value Count of participating component fields. Parameter pField List of participating component fields. DMappingRuleSet:: GetParticipatingFunctions

int GetParticipatingFunctions (DStringList &aFunctions); Return Value Count of participating functions. Parameter

Page 79: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

76

pFields List of participating functions. DMappingRuleSet:: GetParticipatingTables

int GetParticipatingTables (DStringList &pTables); Return Value Count of participating component tables. Parameter pFields List of participating component tables. DMappingRuleSet:: GetRule

DMappingRule* GetRule (int iIndex); DMappingRule* GetRule (CString strField); Return Value Pointer to mapping rule object. Parameters index Zero-based index of the mapping rule object. strSchema Field name associated with the mapping rule object. DMappingRuleSet:: GetTableFilter

DTableFilter* GetTableFilter ( ); Return Value Pointer to a Table Filter. DMappingRuleSet:: IsValid

bool IsValid ( ); Return Value TRUE if the mapping ruleset is valid. DMappingRuleSet:: RemoveAllBind

void RemoveAllBind ( ); DMappingRuleSet:: RemoveBind

void RemoveBind (int iIndex); Parameter index Zero-based index of the binding factor to be deleted.

Page 80: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

77

DMappingRuleSet:: RenameField

void RenameField (CString strOldField, CString strNewField); Parameters strOldField Current field name to be renamed. strNewField New field name. DMappingRuleSet:: RenameSchema

void RenameSchema (CString strNewSchema); Parameter strNewSchema New schema name. DMappingRuleSet:: RenameTable

void RenameTable (CString strTable); Parameter strTable New table name. DMappingRuleSet:: Serialize

virtual void Serialize (CArchive &ar); Parameter ar CArchive where the object is serialized. DMappingRuleSet:: SetTableFilter

void SetTableFilter (DTableFilter* pTableFilter); Parameter pTableFilter Pointer to the Table Filter object to be set. DMappingRuleSet:: SetValid

void SetValid (bool bValid); Parameter bValid New state of the mapping ruleset (TRUE-valid or FALSE-invalid).

Page 81: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

78

DMTAggregate public DMappingRule The DMTAggregate class is used to map a global field to the evaluated result of an aggregate function. It is derived from the DMappingRule base class. DMTAggregate has attributes for storing the function name, and the collection of function arguments (in the form of DCOperand objects). The aggregate functions supported are CONCATENATE, SUM, and AVERAGE.

Class Members Attributes

Name Type Description

m_strFunctionName CString stores the name of the aggregate function

m_strOperandType CString stores the type of operand supported by the aggregate function

m_oaOperands CObArray object array containing the function parameter objects

m_nCount int count of parameter objects in the array

Methods

Name Description

~DMTAggregate Class destructor.

AddValue Adds a function parameter value.

DMTAggregate Class constructor.

GetFunctionName Gets the name of the aggregate function.

GetOperandType Sets a user-defined value for the mapping rule.

GetParticipatingFields Collects the names of participating component fields.

GetParticipatingTables Collects the names of participating component tables.

GetValue Gets the value of a function parameter.

GetValuesCount Gets the count of function parameters.

RemoveValue Removes a function parameter.

Serialize Object serialization function.

SetFunctionName Sets the name of the aggregate function.

Function Specifications DMTAggregate:: AddValue

void AddValue (CString strSchema, CString strTable, CString strField); void AddValue (CString strValue);

Page 82: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

79

Parameters strSchema Schema name of the function argument (database field). strTable Table name of the function argument (database field). strField Field name of the function argument (database field). strValue String value of the function argument (user-defined). DMTAggregate:: GetFunctionName

CString GetFunctionName ( ); Return Value Function name. DMTAggregate:: GetOperandType

CString GetOperandType ( ); Return Value Operand type. DMTAggregate:: GetParticipatingFields

void GetParticipatingFields (DStringList &rFields); Return Value List of participating component fields in rFields. Parameter rFields String array that will contain the list of participating fields. DMTAggregate:: GetParticipatingTables

void GetParticipatingTables (DStringList &rTables); Return Value List of participating component tables in rTables. Parameter rTables String array that will contain the list of participating tables. DMTAggregate:: GetValue

CString GetValue (int iIndex); Return Value

Page 83: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

80

Value of the function argument. Parameter iIndex Zero-based index of the function argument. DMTAggregate:: GetValuesCount

int GetValuesCount ( ); Return Value Count of function arguments. DMTAggregate:: RemoveValue

void RemoveValue (int iIndex); Parameter iIndex Zero-based index of the function argument. DMTAggregate:: SetFunctionName

void SetFunctionName(CString strName); Parameters strName Name of the aggregate function.

Page 84: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

81

DMTAutonumber public DMappingRule The DMTAutonumber class is used to map a global field to an autonumber (sequence object in Oracle). It is derived from the DMappingRule base class. It contains an attribute of type string for holding the sequence name. Likewise, it has methods for getting and setting the value for the sequence attribute.

Class Members Attributes

Name Type Description

m_strSequenceName CString stores the sequence name for generating autonumbers

Methods

Name Description

~DMTAutoNumber Class destructor.

DMTAutoNumber Class constructor.

GetSequenceName Gets the sequence name for generating autonumbers.

Serialize Object serialization function.

SetSequenceName Sets the sequence name for generating autonumbers.

Function Specifications DMTAutonumber:: GetSequenceName

CString GetSequenceName ( ); Return Value Name of the Oracle sequence object. DMTAutonumber:: SetSequenceName

void SetSequenceName (CString strName); Parameter strName Name of the Oracle sequence object.

Page 85: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

82

DMTCondition public DMappingRule The DMTCondition class is used to map a global field to the result of a condition statement. It is derived from the DMappingRule base class. It contains a collection of condition statement objects called DConditionStmt. The global field gets the specified result value of a condition statement if the conditions are satisfied. A DMTCondition mapping can have many condition statements. Thus, if the first condition statement is not satisfied, the next satisfying condition statements may supply the mapping value. Likewise, this class contains a default value attribute, in case none of the condition statements are satisfied.

Class Members Attributes

Name Type Description

m_oDefaultItem DCOperand stores the default value for the condition mapping

m_oaConditionStmt CObArray object array containing the collection of condition statement objects

m_nCount int count of condition statements in the array

Methods

Method Description

~DMTCondition Class destructor.

AddStmt Adds a condition statement object.

DeleteStmt Deletes a condition statement object.

DMTCondition Class constructor.

GetCount Gets the number of condition statement objects in the array.

GetDefaultValue Gets the default value for the condition mapping.

GetParticipatingFields Gets the field names of participating component fields.

GetParticipatingTables Gets the table names of participating component fields.

GetStmtAt Gets the condition statement object at a given index.

Serialize Object serialization function.

SetDefaultValue Sets the default value for the condition mapping.

Function Specifications DMTCondition:: AddStmt

void AddStmt(int iIndex, DConditionStmt* pStmt); void AddStmt (DConditionStmt* pStmt);

Page 86: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

83

Parameters iIndex Zero-based index of the object to be added. pStmt Pointer to a condition statement object to be added. DMTCondition:: DeleteStmt

void DeleteStmt (int iIndex); Parameter iIndex Zero-based index of the object to be deleted. DMTCondition:: GetCount

int GetCount ( ); Return Value Count of condition statements. DMTCondition:: GetDefaultValue

CString GetDefaultValue ( ); Return Value Default value of the condition mapping result. DMTCondition:: GetParticipatingFields

void GetParticipatingFields (DStringList& rFields); Parameter rFields String array containing the list of participating component fields. DMTCondition:: GetParticipatingTables

void GetParticipatingTables (DStringList& rTables); Parameter rTables String array containing the list of participating component tables. DMTCondition:: GetStmtAt

DConditionStmt* GetStmtAt(int iIndex); Return Value Pointer to a condition statement object. Parameter iIndex Index of the condition statement object.

Page 87: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

84

DMTCondition:: SetDefaultValue

void SetDefaultValue(CString strValue); Parameter strValue String value to be set as the default condition result.

Page 88: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

85

DMTField public DMappingRule The DMTField class is used to map a global field to a field in the component database. It is derived from the DMappingRule base class. It contains an attribute of type DOID that refers to the component field. In addition, it has an attribute for storing a formula string, in case the DBA specified a conversion formula for the field.

Class Members Attributes

Name Type Description

m_oSourceField DOID stores a reference to a component field

m_strEmbeddedFunction CString stores the formula expression associated with the mapping rule

Methods

Name Description

~DMTField Class destructor.

DMTField Class constructor.

GetFunction Gets the formula expression.

GetSourceFieldID Gets the field name of the mapped component field.

GetSourceID Gets the id (schema.table.field) of the mapped component field.

GetSourceSchemaID Gets the schema name of the mapped component field.

GetSourceTableID Gets the table name of the mapped component field.

Serialize Object serialization function.

SetFunction Sets the formula expression.

SetSourceID Sets the id (schema.table.field) of the mapped component field.

DMTField:: GetFunction

CString GetFunction ( ); Return Value Formula expression associated with the mapping. DMTField:: GetSourceFieldID

CString GetSourceFieldID ( ); Return Value Field name of the component field.

Page 89: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

86

DMTField:: GetSourceID

CString GetSourceID ( ); Return Value Full ID (schema.table.field) of the component field. DMTField:: GetSourceSchemaID

CString GetSourceSchemaID ( ); Return Value Schema name of the component field DMTField:: GetSourceTableID

CString GetSourceTableID ( ); Return Value Table name of the component field DMTField:: SetFunction

void SetFunction(CString strFunction); Parameter strFunction Formula expression to be associated with the field mapping. DMTField:: SetSourceID

void SetSourceID(CString strSchema, CString strTable, CString strField); Parameters strSchema Schema name of the component field to be mapped. strTable Table name of the component field to be mapped. strField Field name of the component field to be mapped.

Page 90: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

87

DMTTransformation public DMappingRule The DMTTransformation class is used to map a global field to the evaluated result of a PL/SQL function. It is derived from the DMappingRule base class. DMTTransformation contains the function name, and the collection of function arguments (in the form of DCOperand objects).

Class Members Attributes

Name Type Description

m_strFunctionName CString stores the name of the PL/SQL function

m_oaParamItem CObArray object array containing the parameter objects

m_nCount int count of function parameters

Methods

Name Description

~DMTTransformation Class destructor.

DMTTransformation Class constructor.

GetArgumentCount Gets the count of function arguments or parameters.

GetFunctionName Gets the name of the function.

GetParamValue Gets the value of a function parameter at an index.

GetParticipatingFields Collects the names of participating fields in the function.

GetParticipatingTables Collects the names of participating tables in the function.

RemoveParamValue Removes a parameter object.

Serialize Object serialization function.

SetFunction Sets the name of the function.

SetParamValue Sets a function parameter value.

Function Specifications DMTTransformation:: GetArgumentCount

int GetArgumentCount ( ); Return Value Count of function arguments DMTTransformation:: GetArgumentCount

CString GetFunctionName ( );

Page 91: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

88

Return Value Name of PL/SQL stored function DMTTransformation:: GetArgumentCount

DCOperand* GetParamValue(int iIndex); Return Value Pointer to a function argument object. Parameter iIndex Index of the function argument. DMTTransformation:: GetArgumentCount

void GetParticipatingFields (DStringList &rFields); Parameter rFields String array containing the list of participating fields. DMTTransformation:: GetArgumentCount

void GetParticipatingTables (DStringList &rTables); Parameter rTables String array containing the list of participating tables. DMTTransformation:: GetArgumentCount

void RemoveParamValue(int iIndex); Parameter iIndex Index of the function argument. DMTTransformation:: GetArgumentCount

void SetFunction (DTransformFunction* pFunction); Parameter pFunction Pointer to a Function object. DMTTransformation:: GetArgumentCount

void SetParamValue (int iIndex, DCOperand* pOp); Parameters iIndex Index of function argument. pOp Pointer to a functin argument object.

Page 92: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

89

DMTValue public DMappingRule The DMTValue class is used to map a global field to a user-defined value. It is derived from the DMappingRule base class. It contains an attribute of type string for holding the user-defined value.

Class Members Attributes

Name Type Description

m_strValue CString variable to store the user-defined value

Methods

Name Description

~DMTValue(); Class destructor.

DMTValue(); Class constructor.

GetValue Gets the user-defined value.

Serialize Serializes the object to or from file.

SetValue Sets a user-defined value for the mapping rule.

Function Specifications DMTValue::GetValue

CString GetValue ( ); Return Value String value of the user-defined value map. DMTValue::SetValue

void SetValue(CString strValue); Parameters strValue String value to be set on the value-mapping.

Page 93: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

90

DOID public CObject DOID is an object identifier class for a database field. It contains member variables for storing the schema name, table name, and field name. The DOID class is used in several data structures and modules of the system as object and parameter reference, including the Mapping Rule classes, Condition Statement classes, and Function classes.

Class Members Attributes

Name Type Description

m_strSchemaID CString stores the schema name of a database field

m_strTableID CString stores the table name of a database field

m_strFieldID CString stores the field name of a database field

Methods

Name Description

~DOID Class destructor.

DOID Class constructor.

GetFieldID Gets field name of the database field.

GetFullID Gets full id (schema.table.field) of the database field.

GetSchemaID Gets schema name of the database field.

GetTableID Gets table name of the database field.

Serialize Object serialization function.

SetFieldID Sets the field name of the database field.

SetID Sets the full id (schema.table.field) of the database field.

SetSchemaID Sets the schema name of the database field.

SetTableID Sets the table name of the database field.

Function Specifications DOID::GetFieldID

CString GetFieldID ( ); Return Value Field name of the database field. DOID:: GetFullID

CString GetFullID ( );

Page 94: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

91

Return Value Full ID (schema.table.field) of the database field. DOID:: GetSchemaID

CString GetSchemaID ( ); Return Value Schema name of the database field. DOID:: GetTableID

CString GetTableID ( ); Return Value Table name of the database field. DOID:: SetFieldID

void SetFieldID (CString strField); Parameter strField Field name of the database field. DOID:: SetID

void SetID(CString strSchema, CString strTable, CString strField); Parameter strSchema Schema name of the database field.. strTable Table name of the database field. strField Field name of the database field. DOID:: SetSchemaID

void SetSchemaID (CString strSchema); Parameter strSchema Schema name of the database field. DOID:: SetTableID

void SetTableID (CString strTable); Parameter strTable Table name of the database field..

Page 95: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

92

DTableMapping The DTableMapping class contains all the mapping rules for a global table. It contains an object array that holds an unlimited number of mapping entries (DMappingRuleSet).

Class Members Attributes

Name Type Description

m_strTableName CString stores the name of the global table

m_nCount int count of mapping rule entries or rulesets

m_oaMappingRuleSet CObArray object array containing the mapping rule entires (mapping rulesets)

m_bValid bool flag determining if the table mapping is valid

Methods

Name Description

~DTableMapping Class destructor.

AddEntry Adds a mapping rule entry (or ruleset) for the global table.

DTableMapping Class constructor.

GetEntry Gets a mapping rule entry (or ruleset) in the global table.

GetEntryCount Gets the count of mapping rule entries.

GetTableName Gets the name of the global table.

InsertEntry Inserts a mapping rule entry (or ruleset) in the global table.

IsValid Checks if the table mapping is in a valid state.

RemoveEntry Removes a mapping rule entry (or ruleset) in the global table.

RenameField Renames all references to a global field.

RenameSchema Renames all references to the global schema.

RenameTable Renames all references to the global table.

Serialize Object serialization method.

SetTableName Sets the name of the global table.

SetValid Sets the valid flag of the table mapping.

Function Specifications DTableMapping:: AddEntry

void AddEntry (DMappingRuleSet* pRuleSet);

Page 96: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

93

Parameter pRuleSet Pointer to the mapping ruleset to add. DTableMapping:: DTableMapping

DTableMapping(CString strTable=""); Parameters strTable Name of the global table. DTableMapping:: GetEntry

DMappingRuleSet* GetEntry(int iIndex); Return Value Pointer to a mapping ruleset. Parameter iIndex Index of the mapping ruleset. DTableMapping:: GetEntryCount

int GetEntryCount ( ); Return Value Count of mapping entries or rulesets. DTableMapping:: GetTableName

CString GetTableName ( ); Return Value Name of the global table. DTableMapping:: InsertEntry

void InsertEntry (int index, DMappingRuleSet *pRuleSet); Parameters index Index on where the mapping ruleset is to be inserted in the array. pRuleSet Pointer to the mapping rule set. DTableMapping:: IsValid

bool IsValid ( ); Return Value TRUE if the table mapping is in a valid state, else FALSE. DTableMapping:: RemoveEntry

Page 97: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

94

void RemoveEntry (int iIndex); Parameter iIndex Index of the mapping entry to remove. DTableMapping:: RenameField

void RenameField (CString strOldField, CString strNewField); Parameters strOldField Current name of the global database field to rename. strNewField New name to give the global database field. DTableMapping:: RenameSchema

void RenameSchema (CString strNewSchema); Parameter strNewSchema New schema name. DTableMapping:: RenameTable

void RenameTable (CString strNewName); Parameter strNewTable New table name. DTableMapping:: SetTableName

void SetTableName (CString strTable); Parameter strTable Name to assign the global table mapping. DTableMapping:: SetValid

void SetValid (bool bValid); Parameter bValid TRUE to set a table map as valid, else FALSE for invalid.

Page 98: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

95

6.2.2. Supporting Classes for Mapping Rules

DBindField The DBindField is used to bind two database fields, similar to a join condition. This class used the DOID class to reference the two database fields to be bound.

Class Members Attributes

Name Type Description

m_oField1 DOID Stores the full ID (schema.table.field) of the first database field.

m_oField2 DOID Stores the full ID (schema.table.field) of the second database field.

Methods

Name Description

GetField1 Gets the name of the first database field

GetField2 Gets the name of the second database field

GetTableID Gets the table name of either one of the two database fields

SetField1 Sets the database field name of the first

SetField2 Sets the database field name of the second

Function Specifications DBindField:: GetTableID

CString GetTableID (int nField); Return Value Table name of the first database field if nField is 1, or the second database field if nField is 2. Parameter nField Index of the database field (1-first, 2-second). DBindField:: GetField1

CString GetField1 ( ); Return Value Name of the first field. DBindField:: GetField2

Page 99: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

96

CString GetField2 ( ); Return Value Name of the first field. DBindField:: SetField1

void SetField1 (CString strSchema, CString strTable, CString strField); Parameters strSchema Schema name of the database field. strTable Table name of the database field. strField Field name of the database field. DBindField:: SetField2

void SetField2 (CString strSchema, CString strTable, CString strField); Parameters strSchema Schema name of the database field. strTable Table name of the database field. strField Field name of the database field.

Page 100: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

97

DCondition The DCondition class represents a condition in a condition statement (or a Table Filter). It is comprised of a left operand (type DCOperand), a right operand (type DCOperand), and a relational operator (>,<,=,>=,<=, <>).

Class Members Attributes

Name Type Description

m_oLeft DCOperand stores the left operand value of a condition

m_oRight DCOperand stores the right operand value of a condition

m_strRelop CString stores the relational operator of a condition

Methods

Name Description

~DCondition Class destructor.

DCondition Class constructor.

GetLeftValue Gets the value of the left operand.

GetParticipatingFields Collect the names of participating component fields.

GetParticipatingTables Collect the names of participating component tables.

GetRelop Gets the relational operator.

GetRightValue Gets the value of the right operand.

Serialize Object serialization method.

SetLeftValue Sets the value of the left operand.

SetRelop Sets the relational operator.

SetRightValue Sets the value of the right operand.

Function Specifications DCondition:: GetLeftValue

CString GetLeftValue ( ); Return Value String value of the left operand. DCondition:: GetParticipatingFields

void GetParticipatingFields (DStringList &rFields);

Page 101: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

98

Parameter rFields String array containing the list of participating component fields. DCondition:: GetParticipatingTables

void GetParticipatingTables (DStringList &rTables); Parameter rTables String array containing the list of participating component tables. DCondition:: GetRelop

CString GetRelop ( ); Return Value String value of the relational operator. DCondition:: GetRightValue

CString GetRightValue ( ); Return Value Value of the right operand. DCondition:: SetLeftValue

void SetLeftValue (CString strSchema, CString strTable, CString strField); void SetLeftValue(CString strValue); Parameters strSchema Schema name if the operand is a database field. strTable Table name if the operand is a database field. strField Field name if the operand is a database field. strValue String value of the operand. DCondition:: SetRelop

void SetRelop(CString strRelop); Parameter strRelop String value of the relational operator. DCondition:: SetRightValue

void SetRightValue (CString strSchema, CString strTable, CString strField);

Page 102: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

99

void SetRightValue(CString strValue); Parameters strSchema Schema name if the operand is a database field. strTable Table name if the operand is a database field. strField Field name if the operand is a database field. strValue String value of the operand.

Page 103: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

100

DConditionStmt A condition statement is represented as by the DConditionStmt class. Condition statements contain a series of conditions that produce a result value when evaluated to true. It is likened to the if <condition-list> then <result> in programming constructs. The difference is that the conditions that comprise DConditionStmt are evaluated by ANDing all of them, and there is no else statement. DConditionStmt holds a collection of DCondition objects representing conditions, and a result value of type DCOperand.

Class Members Attributes

Name Type Description

m_oaCondition CObArray object array storing condition objects

m_nCount int count of condition objects in the array

m_oResult DCOperand stores the result value for the condition statement

Methods

Name Description

~DConditionStmt Class destructor.

AddCondition Adds a condition object.

DConditionStmt Class constructor.

DeleteCondition Deletes a condition object.

GetConditionAt Gets a pointer to a condition object.

GetCount Gets the count of condition objects.

GetParticipatingFields Gets the names of participating component fields.

GetParticipatingTables Gets the names of participating component tables.

GetResultValue Gets the result value of the condition statement.

Serialize Object serialization function.

SetResultValue Sets the result value of the condition statement.

Function Specifications DConditionStmt:: AddCondition

void AddCondition (DCondition* pCond); Parameter

Page 104: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

101

pCond Pointer to a conditon object to add. DConditionStmt:: DeleteCondition

void DeleteCondition (int iIndex); Parameter iIndex Index of the condition object to delete. DConditionStmt:: GetConditionAt

DCondition* GetConditionAt(int iIndex); Return Value Pointer to a condition object. Parameter iIndex Index of the condition object. DConditionStmt:: GetCount

int GetCount ( ); Return Value Count of condition objects in the array. DConditionStmt:: GetParticipatingFields

void GetParticipatingFields (DStringList &rFields); Parameter rFields String array containing the list of participating component fields. DConditionStmt:: GetParticipatingTables

void GetParticipatingTables (DStringList &rTables); Parameter rTables String array containing the list of participating component tables. . DConditionStmt:: GetResultValue

CString GetResultValue ( ); Return Value String value of the condition statement result. DConditionStmt:: SetResultValue

Page 105: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

102

void SetResultValue (CString strSchema, CString strTable, CString strField); void SetResultValue(CString strValue); Parameters strSchema Schema name if the condition result is a database field. strTable Table name if the condition result is a database field. strField Field name if the condition result is a database field. strValue String value if the condition result is a user-defined value.

Page 106: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

103

DCOperand The DCOperand class was designed to store a user-defined values or a database field reference. For example, it can store “Manila” or “dlsu.student_address.city”. This class is used in classes such as DCondition, DConditionStmt, DMTTransformation, DMTAggregate, etc. to represent operands/arguments, which may either be in the form of a user-defined value or database field.

Class Members Attributes

Name Type Description

m_strItemType CString stores the type of item: value or field

m_oField DOID stores a database field if operand type is field

m_strValue CString stores a user-defined value if operand type is value

Methods

Name Description

~DCOperand Class destructor.

DCOperand Class constructor.

GetItemType Gets type of operand item.

GetOperand Gets the item value.

Serialize Object serialization method.

SetOperand Sets the value of the operand item.

Function Specifications DCOperand:: GetItemType

CString GetItemType ( ); Return Value Operand item type (“Field” or “Value”). DCOperand:: GetOperand

CString GetOperand ( ); Return Value String value of the operand. DCOperand:: SetOperand

void SetOperand(CString strValue);

Page 107: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

104

void SetOperand(CString strSchema, CString strTable, CString strField); Parameters strSchema Schema name if the operand type is a database field. strTable Table name if the operand type is a database field. strField Field name if the operand type is a database field. strValue String value to the operand.

Page 108: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

105

DFilterEntry The DFilterEntry class serves to contain the filters used by the Mapping Editor. Filters allow the user to “filter” out data coming from the temporary storage by specifying conditions. Each mapping rule set can only have one filter entry; each filter entry, in turn, contains an array of conditions. A filter entry is a set of conditions or filters. These filters serve as the minimum requirement condition for the data of component database.

Class Members Attributes

Name Type Description

m_oaCondition CObArray Object array containing the DCondition objects

m_nCount int Count of DCondition objects in the array

Methods

Name Description

AddCondition Adds a DCondition object

GetConditionAt Gets a DCondition object at a given index.

GetCount Gets the number of DCondition objects in the array.

GetParticipatingTables Collects the list of participating component tables.

RemoveCondition Removes a DCondition object in the array.

Function Specifications DFilterEntry:: AddCondition

void AddCondition(DCondition* pCond); Parameter pCond Pointer to the DCondition object to be added. DFilterEntry:: GetConditionAt

DCondition* GetConditionAt(int iIndex); Return Value Pointer to a DCondition object retrieved at the index. Parameter iIndex Index of the object to retrieve from the array. DFilterEntry:: GetCount

Page 109: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

106

int GetCount ( ); Return Value Count of DCondition objects. DFilterEntry:: GetParticipatingTables

void GetParticipatingTables (DStringList &saTables); Parameter saTables Reference to a string array containing the list of participating tables. DFilterEntry:: RemoveCondition

void RemoveCondition(int iIndex); Parameter iIndex Index of the object to remove.

Page 110: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

107

DStringList The DStringList class is a generic string array class with extended features. DStringList stores unique string values. It provides functions such as finding and sorting strings in the array. It utilizes MFC’s CStringArray class internally to store actual strings.

Class Members Attributes

Name Type Description

m_aString CStringArray string array for storing actual values

m_nCount int count of elements in the string array

Methods

Name Description

~DStringList Class destructor.

Add Adds a string element to the list.

DStringList Class constructor.

Find Finds a specified string in the string array. Returns TRUE if found, else returns FALSE.

GetAt Get the string value at an index.

GetCount Gets the element count in the string array.

LookUp Looks up if a string. Returns the index if found, else return –1.

Remove Removes a string element.

RemoveAll Removes all elements in the array.

Serialize Object serialization function.

SetAt Sets the string value at a given index.

Sort Sorts the string elements alphabetically.

Function Specifications DStringList:: Add

void Add (CString strValue); Parameter strValue String value to add to the array. DStringList:: Find

Page 111: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

108

bool Find (CString strValue); Return Value TRUE if the string is found, else FALSE. Parameter strValue String value to find in the array. DStringList:: GetAt

CString GetAt (int iIndex); Return Value String value at the given index. Parameter iIndex Index to get the string. DStringList:: GetCount

int GetCount ( ); Return Value Count of elements in the array. DStringList:: LookUp

int LookUp (CString strValue); Return Value Index of the string if found in the array, else –1. Parameter strValue String value to look up in the array. DStringList:: Remove

void Remove (CString strValue); Parameter strValue String value to remove from the array. DStringList:: RemoveAll

void RemoveAll ( ); Remarks Removes all elements in the array, and the sets the count to 0. DStringList:: SetAt

void SetAt(int nIndex, CString strItem);

Page 112: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

109

Parameters nIndex Index to set the array element. strItem String item to set at the given index. DStringList:: Sort

void Sort ( ); Remarks Sorts the string array in alphabetical (ascending) order.

Page 113: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

110

DTableFilter The DTableFilter data structure is used for filtering the rows that will be inserted to the global table. The DTableFilter class contains an object array storing multiple DFilterEntry objects, allowing multiple filter conditions to be defined. The DTableFilter class is used inside a DMappingRuleSet class.

Class Members Attributes

Name Type Description

m_oaFilterEntry CObArray Object array containing the list of DFilterEntry objects

m_nCount int Count of DFilterEntry objects in the array

Methods

Name Description

AddEntry Adds a DFilterEntry object.

GetCount Gets the count of DFilterEntry objects.

GetFilterEntry Gets the pointer to a DFilterEntry object.

GetParticipatingTables Collects the list of participating component tables.

RemoveAllEntries Removes all filter entries.

RemoveEntry Removes a DFilterEntry object.

SetEntryAt Sets a DFilterEntry object at an index.

Function Specifications DTableFilter:: AddEntry

void AddEntry(DFilterEntry* pEntry); Parameter pEntry Pointer to the DFilterEntry object to add. DTableFilter:: GetCount

int GetCount ( ); Return Value Count of DFilterEntry objects in the array. DTableFilter:: GetFilterEntry

DFilterEntry* GetFilterEntry(int iIndex); Return Value

Page 114: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

111

Pointer to a DFilterEntry object at the index. Parameter iIndex Index of the DFilterEntry object to get. DTableFilter:: GetParticipatingTables

void GetParticipatingTables (DStringList &saTables); Parameter saTables A reference to a string array containing the list of participating tables. DTableFilter:: RemoveAllEntries

void RemoveAllEntries ( ); DTableFilter:: RemoveEntry

void RemoveEntry(int iIndex); Parameter iIndex Index of the DFilterEntry object to remove. DTableFilter:: SetEntryAt

void SetEntryAt (int iSel, DFilterEntry* pFilterEntry); Parameters iSel Index to set the object to. pFilterEntry Pointer to a DFilterEntry object to set.

Page 115: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

112

6.3. Function Catalog classes This section provides a reference to the C++ classes that make up the function catalog. These classes include DConversionFormula, DConversionFormulaCatalog, DFunctionParam, DTransformFunction, and DPLFunctionCatalog.

DConversionFormula The DConversionFormula class contains the name of the formula and the actual formula string.

Class Members Attributes

Name Type Description

m_strFormulaName CString Name of the conversion formula

m_strFormulaString CString Formula expression string

Methods

Name Description

GetFormulaName Gets the formula name.

GetFormulaString Gets the formula expression.

SetFormulaName Sets the formula name.

SetFormulaString Sets the formula expression.

Function Specifications DConversionFormula::GetFormulaName

CString GetFormulaName ( ); Return Value Formula name. DConversionFormula::GetFormulaString

CString GetFormulaString ( ); Return Value Formula expression string. DConversionFormula::SetFormulaName

void SetFormulaName (CString strName); Parameter

Page 116: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

113

strName Formula name. DConversionFormula::SetFormulaString

void SetFormulaString (CString strFormula); Parameter strFormula Formula expression string.

Page 117: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

114

DConversionFormulaCatalog The DConversionFormulaCatalog, stores a collection of conversion formula objects. It contains an array of DConversionFormula objects, which represent the conversion formulas.

Class Members Attributes

Name Type Description

m_oaFormula CObArray Object array containing DConversionFormula objects

m_nCount int Count of DConversionFormula objects

Methods

Name Description

AddFormula Adds a formula object to the catalog.

GetCount Gets the number of formula objects.

GetFormula Gets a formula object in the catalog.

LoadCollection Loads the formula catalog from file.

LookUp Looks up a formula name in the catalog.

RemoveFormula Removes a formula object in the catalog.

SaveCollection Saves the formula catalog to file.

Function Specifications DConversionFormulaCatalog::AddFormula

void AddFormula (DConversionFormula* pFormula); Parameters pFormula Pointer to the formula object to add. DConversionFormulaCatalog:: GetCount

int GetCount ( ); Return Value Count of formula objects. DConversionFormulaCatalog:: GetFormula

DConversionFormula* GetFormula (const char* strFormulaName); DConversionFormula* GetFormula (int iIndex);

Page 118: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

115

Return Value Pointer to the formula object in the array. Parameters strFormulaName Formula name. iIndex Index of the formula object. DConversionFormulaCatalog:: LoadCollection

int LoadCollection ( ); Return Value 0 if the loading was successful and a non-zero error code if not. DConversionFormulaCatalog:: LookUp

int LookUp (const char* strFormulaName); Return Value Index of the formula object if found. –1 if the formula was not found. Parameters strFormulaName Name of the formula to retrieve. DConversionFormulaCatalog:: RemoveFormula

void RemoveFormula (int iIndex); void RemoveFormula (const char* strFormulaName); Parameters iIndex Index of the formula to remove. strFormulaName Name of the formula to remove. DConversionFormulaCatalog:: SaveCollection

int SaveCollection ( ); Return Value 0 if saving was successful, otherwise a non-zero error code.

Page 119: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

116

DFunctionParam Function parameters are represented through the DFunctionParam class. A function parameter object is owned by one and only one DTransformFunction object. DFunctionParam contains the parameter name and the data type.

Class Members Attributes

Name Type Description

m_strParamName CString Function parameter name

m_strDataType CString Parameter data type

Methods

Name Description

DFunctionParam Class constructor.

GetParamName Gets the name of a function parameter.

GetParamType Gets the data type of a function parameter.

SetParamName Sets the name of a function parameter.

SetParamType Sets the data type of a function parameter.

Function Specifications DFunctionParam:: DFunctionParam

DFunctionParam(CString strName="", CString strType=""); Parameters strName Name of the function parameter. strType Data type of the function parameter. DFunctionParam:: GetParamName

CString GetParamName ( ); Return Value Name of the function parameter. DFunctionParam:: GetParamType

CString GetParamType ( );

Page 120: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

117

Return Value Data type of the function parameter. DFunctionParam:: SetParamName

void SetParamName(CString strName); Parameter strName Name of the function parameter. DFunctionParam:: SetParamType

void SetParamType(CString strType); Parameter strType Data type of the function parameter.

Page 121: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

118

DPLFunctionCatalog The PL/SQL function catalog, named DPLFunctionCatalog, stores a collection of PL/SQL functions. The DPLFunctionCatalog class contains an array of DTransformFunction objects, which represent PL/SQL stored functions.

Class Members Attributes

Name Type Description

m_oaFunctions CObArray Object array containing DTransformFunction objects

m_nCount int Count of function objects in the array

Methods

Name Description

AddFunction Adds a function object to the catalog.

GetCount Returns the count of function objects in the catalog.

GetFunction Gets the pointer to a function object.

GetFunctionNames Gets a string list of function names

LoadCollection Loads the Function catalog from file

LookUp Looks up a function in the catalog

RemoveFunction Removes a function from the catalog

SaveCollection Saves the catalog to file

Function Specifications DPLFunctionCatalog:: AddFunction

void AddFunction (DTransformFunction* pFunction); Parameter pFunction Pointer to the function object to add. DPLFunctionCatalog:: GetCount

int GetCount ( ); Return Value Count of function objects in the catalog. DPLFunctionCatalog:: GetFunction

Page 122: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

119

DTransformFunction* GetFunction (CString strFunctionName); DTransformFunction* GetFunction (int iIndex); Return Value Pointer to the function object in the array. Parameters strFunctionName Name of the function object to get. iIndex Index of the function object to get. DPLFunctionCatalog:: GetFunctionNames

int GetFunctionNames (DStringList &saFunctionNames); Return Value Number of functions in the catalog. Parameter saFunctionNames String array containing the list of function names. DPLFunctionCatalog:: LoadCollection

int LoadCollection (CString strPathname); Return Value 0 if the loading was successful and a non-zero error code if not. Parameter strPathname The full path of the file to load the catalog from. DPLFunctionCatalog:: LookUp

int LookUp (CString strFunctionName); Return Value Index of the function object if found, else –1 if not found. Parameter strFunctionName Name of the function to look for. DPLFunctionCatalog:: RemoveFunction

void RemoveFunction (CString strFunctionName); void RemoveFunction (int iIndex);

Page 123: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

120

Parameters strFunctionName Name of the function object to remove. iIndex Index of the function object to remove. DPLFunctionCatalog:: SaveCollection

int SaveCollection (CString strPathname); Return Value 0 if saving was successful and a non-zero error code if not. Parameter strPathname The full path of the file to save the catalog to.

Page 124: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

121

DTransformFunction The DTransformFunction class contains attributes for storing the function name, function body, function parameters, number of parameters, local variables, and return type. Function parameters are represented through an array of parameter objects (DFunctionParam).

Class Members Attributes

Name Type Description

m_strFunctionName CString Function name

m_strReturnType CString Data type of the return value

m_strFunctionBody CString Attribute containing the function code/body

m_strLocalVariables CString Attribute containing the declaration of local variables

m_nParamCount int Number of function parameters

m_oaParameter CObArray Object array containing function parameter objects

Methods

Name Description

AddParam Adds a function parameter object.

DeleteAllParam Deletes all function parameter object.

DeleteParam Deletes a function parameter object.

GetFunctionBody Gets the function body text.

GetFunctionName Gets the function name.

GetLocalVariables Gets the local variable declaration text.

GetParam Gets the pointer to a function parameter object.

GetParamCount Gets the count of function parameters.

GetReturnType Gets the return type of the function.

SetFunctionBody sets the function body text.

SetFunctionName Sets the function name.

SetLocalVariables Sets the local variable declaration text.

SetReturnType Sets the return type of the function.

Function Specifications DTransformFunction::AddParam

Page 125: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

122

void AddParam(DFunctionParam* pParam); Parameter DFunctionParam A pointer to the function parameter object to add. DTransformFunction:: DeleteAllParam

void DeleteAllParam(); DTransformFunction:: DeleteParam

void DeleteParam(int iIndex); Parameter iIndex Index of the function parameter to delete. DTransformFunction:: GetFunctionBody

CString GetFunctionBody ( ); Return Value Text of the function body. DTransformFunction:: GetFunctionName

CString GetFunctionName ( ); Return Value Function name. DTransformFunction:: GetLocalVariables

CString GetLocalVariables ( ); Return Value Text of local variable declaration. DTransformFunction:: GetParam

DFunctionParam* GetParam(int iIndex); Return Value Pointer to a function parameter object. Parameter iIndex Index to a function parameter. DTransformFunction:: GetParamCount

int GetParamCount ( );

Page 126: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

123

Return Value Number of function parameters. DTransformFunction:: GetReturnType

CString GetReturnType ( ); Return Value Return type of the function. This can be any PL/SQL data types. DTransformFunction:: SetFunctionBody

void SetFunctionBody(CString strBody); Parameter strBody Text of the function body. DTransformFunction:: SetFunctionName

void SetFunctionName(CString strName); Parameter strName Function name. DTransformFunction:: SetLocalVariables

void SetLocalVariables(CString strLocals); Parameter strLocals Text of local variable declarations. DTransformFunction:: SetReturnType

void SetReturnType(CString strType); Parameter strType Return type of the function.

Page 127: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

124

6.4. Schema Error Definition classes This section provides a reference to the C++ classes that make up the schema error catalog. These classes include ESchemaDef, the ETBaseClass, and its derived classes.

ESchemaDef The ESchemaDef class contains all schema definition errors in component databases. When the system detected changes in the schema of component databases, these errors are cataloged in this data structure. ESchemaDef holds an array of error definition objects (ETBaseClass).

Class Members Attributes

Name Type Description

m_oaError CObArray Object array containing ETBaseClass objects

m_nCount int Count of ETBaseClass objects in the array

Methods

Name Description

Add Adds an error definition (ETBaseClass) object .

DeleteAll Deletes all error definition (ETBaseClass) objects.

GetCount Gets the count of error definition (ETBaseClass) objects.

GetAt Gets the pointer to an error definition (ETBaseClass) object .

Function Specifications ESchemaDef::Add

void Add (ETBaseClass* pET); Parameters pET Pointer to an error definition object. ESchemaDef::DeleteAll

void DeleteAll ( ); ESchemaDef::GetCount

int GetCount ( ); Return Value

Page 128: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

125

Count of error definition objects in the array. ESchemaDef::GetAt

ETBaseClass* GetAt (int index); Return Value Pointer to an the error definition object. Parameter index Index of the error definition object.

Page 129: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

126

ETBaseClass The ETBaseClass serves as the parent class of schema definition error objects. The classes that inherit from this class are ETField, ETDatabase, ETSchema, and ETTable. ETBaseClass contains attributes that are shared by these derived classes, namely error scope, error code, and error description.

Class Members Attributes

Name Type Description

m_nErrorScope int Scope of the error.

m_strErrorCode CString Specific error-code.

m_strErrorType CString Type and description of error.

Methods

Name Description

GetErrorCode Gets the error code of the schema error.

GetErrorScope Gets the error scope of the schema error. The error scope can be at the database level, schema level, table level, or field level.

GetErrorType Gets the error description of the schema error.

SetErrorCode Sets the error code of the schema error.

This table lists the error codes and their corresponding description.

ErrorCode Description Database scope

DB-001 Schema not found Schema scope

SC-001 Table has been dropped or renamed Table scope

TB-001 Primary key altered TB-002 Primary key dropped

TB-003 Foreign key Field dropped TB-004 Foreign key Table Reference altered TB-005 Foreign key Field Reference altered TB-006 Foreign key Reference Table not found TB-007 Foreign key Reference Field not found TB-008 Field has been dropped or renamed

Field scope FD-001 Datatype changed FD-002 field attribute Precision altered

Page 130: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

127

FD-003 field attribute Scale altered FD-004 field attribute Length altered FD-005 field attribute Unique altered FD-006 field attribute Null altered FD-007 field attribute Primary key altered

Function Specifications ETBaseClass::GetErrorCode

CString GetErrorCode ( ); Return Value Specific error code of the item. ETBaseClass:: GetErrorScope

int GetErrorScope ( ); Return Value Error code of the item. ETBaseClass:: GetErrorType

CString GetErrorType ( ); Return Value Error description of the item. ETBaseClass::SetErrorCode

void SetErrorCode (CString strCode); Parameter strCode Error code of the item.

Page 131: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

128

ETDatabase The ETDatabase class is used to store a schema error of database scope. It is derived from ETBaseClass.

Class Members Attributes

Name Type Description

m_strDatabase CString Name of the database

m_strSchema CString Name of the schema in the database

Methods

Name Description

GetDatabaseName Gets the name of the database.

GetErrorDescription Gets the error description.

GetSchema Gets the name of the schema in the database.

SetDatabaseName Sets the database name.

SetSchema Sets the schema name in the database.

Function Specifications ETDatabase:: GetDatabaseName

CString GetDatabaseName ( ); Return Value Name of the database. ETDatabase:: GetErrorDescription

virtual CString GetErrorDescription ( ); Return Value Description of the error. ETDatabase:: GetSchema

CString GetSchema ( ); Return Value Schema name involved in the error. ETDatabase:: SetDatabaseName

Page 132: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

129

void SetDatabaseName (CString strName); Parameter strName Name of the database where an error occurred. ETDatabase:: SetSchema

void SetSchema (CString strSchema); Parameter strSchema Name of the schema in the database.

Page 133: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

130

ETField The ETField class is used to store a schema error of database field scope. It is derived from ETBaseClass.

Class Members Attributes

Name Type Description

m_iAttribValue int stores integer values of field attributes

m_strFieldID CString ID of the field (schema.table.field)

m_strAttribute CString stores string values of field attributes

m_bAttribValue bool stores boolean values of field attributes

m_strNewDataType CString stores the new data type of a field if it was changed

m_strOldDataType CString stores the old data type of the field if it was changed

Methods

Name Description

GetAttribIntValue Gets the integer value of an attribute.

GetAttribute Gets the string value of an attribute.

GetAttribValue Gets the boolean value of an attribute.

GetErrorDescription Gets the error description.

GetFieldID Gets the ID of the field involved in the error.

GetNewDataType Gets the new data type if it was changed.

GetOldDataType Gets the old data type if it was changed.

SetAttribute Sets the value of an attribute.

SetAttributeValue Sets the value of an attribute.

SetFieldID Sets the ID of the field involved in the error.

SetNewDataType Sets the new data type if it were data type changes.

SetOldDataType Sets the old data type if it were data type changes.

Function Specifications ETField:: GetAttribIntValue

Page 134: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

131

int GetAttribIntValue ( ); Return Value Integer value of a field attribute. ETField:: GetAttribute

CString GetAttribute ( ); Return Value String value of a field attribute. ETField:: GetAttribValue

bool GetAttribValue ( ); Return Value Boolean value of a field attribute. ETField:: GetErrorDescription

virtual CString GetErrorDescription ( ); Return Value Error description. ETField:: GetFieldID

CString GetFieldID ( ); Return Value ID of database field involved in the error. ETField:: GetNewDataType

CString GetNewDataType ( ); Return Value New data type of the field. ETField:: GetOldDataType

CString GetOldDataType ( ); Return Value Previous data type of the field. ETField:: SetAttribute

void SetAttribute (CString strAttribute); Parameter strAttribute String value to set a field attribute to.

Page 135: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

132

ETField:: SetAttributeValue

void SetAttributeValue(int iValue); void SetAttributeValue (bool bOldValue); Parameters iValue Integer value to set a field attribute to. bOldValue Boolean value to set a field attribute to. ETField:: SetFieldID

void SetFieldID (CString strFieldID); Parameters strFieldID ID of the field involved in the error. ETField:: SetNewDataType

void SetNewDataType (CString strDataType); Parameter strDataType New data type of the field. ETField:: SetOldDataType

void SetOldDataType (CString strDataType); Parameter strDataType Old data type of the field.

Page 136: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

133

ETSchema The ETSchema class is used to store a schema error of database schema scope. It is derived from ETBaseClass.

Class Members Attributes

Name Type Description

m_strSchema CString Name of the database schema.

m_strTable CString Name of the database table involved in the error (schema.table)

Methods

Name Description

GetErrorDescription Gets the error description.

GetSchema Gets the name of the database schema involved in the error.

GetTable Gets the name of the database table involved in the error.

SetSchema Sets the name of the database schema involved in the error.

SetTable Sets the name of the database table involved in the error.

Function Specifications ETSchema:: GetErrorDescription

virtual CString GetErrorDescription ( ); Return Value Error description. ETSchema:: GetSchema

CString GetSchema ( ); Return Value Name of the database schema involved in the error. ETSchema:: GetTable

CString GetTable ( ); Return Value Name of the database table involved in the error. ETSchema:: SetSchema

Page 137: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

134

void SetSchema (CString strSchema); Parameter strSchema Name of the database schema involved in the error. ETSchema:: SetTable

void SetTable (CString strTable); Parameter strTable Name of the database table involved in the error.

Page 138: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

135

ETTable The ETTable class is used to store a schema error of database table scope. It is derived from ETBaseClass.

Class Members Attributes

Name Type Description

m_strTableID CString Name of the table (schema.table) involved in the error.

m_strField CString Name of the field (schema.table.field) involved in the error.

m_strNewPK CString Name of the new primary key.

m_strOldPK CString Name of the previous primary key.

m_strFKField CString Name of the foreign key field.

m_strFKRefTable CString Name of the foreign key reference table.

m_strFKRefField CString Name of the foreign key reference field.

Methods

Name Description

GetErrorDescription Gets the error description.

GetField Gets the name of the database field involved in the error.

GetFKField Gets the name of the foreign key field involved in the error.

GetFKRefField Gets the name of the foreign key reference field involved in the error.

GetFKRefTable Gets the name of the foreign key reference table involved in the error.

GetNewPK Gets the name of the new primary key.

GetOldPK Gets the name of the old primary key.

GetTable Gets the name of the database table involved in the error.

SetField Sets the name of the database field involved in the error.

SetFKField Sets the name of the foreign key field involved in the error.

SetFKRefField Sets the name of the foreign key reference field involved in the error.

SetFKRefTable Sets the name of the foreign key reference table involved in the error.

SetNewPK Sets the name of the new primary key.

SetOldPK Sets the name of theold primary key.

Page 139: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

136

SetTable Sets the name of the database table involved in the error.

Function Specifications ETTable:: GetErrorDescription

virtual CString GetErrorDescription(); Return Value Error description. ETTable:: GetField

CString GetField ( ); Return Value Name of the database field involved in the error. ETTable:: GetFKField

CString GetFKField ( ); Return Value Name of the foreign key field involved in the error. ETTable:: GetFKRefField

CString GetFKRefField ( ); Return Value Name of the foreign key reference field involved in the error. ETTable:: GetFKRefTable

CString GetFKRefTable ( ); Return Value Name of the foreign key reference table involved in the error. ETTable:: GetNewPK

CString GetNewPK ( ); Return Value Name of the new primary key. ETTable:: GetOldPK

CString GetOldPK (CString strField); Return Value Name of the old primary key.

Page 140: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

137

Parameter strField Name of the database field involved in the error. ETTable:: GetTable

CString GetTable ( ); Return Value Name of the database table involved in the error. ETTable:: SetField

void SetField (CString strField); Parameter strField Name of the database field involved in the error. ETTable:: SetFKField

void SetFKField (CString strField); Parameter strField Name of the foreign key field involved in the error. ETTable:: SetFKRefField

void SetFKRefField (CString strField); Parameter strField Name of the foreign key reference field involved in the error. ETTable:: SetFKRefTable

void SetFKRefTable (CString strTable); Parameter strTable Name of the foreign key reference table involved in the error. ETTable:: SetNewPK

void SetNewPK (CString strField); Parameter strField Name of the new primary key involved in the error. ETTable:: SetOldPK

void SetOldPK (CString strField);

Page 141: Technical Manual - MDB1: A Schema Integration Prototype for a Multidatabase System

138

Parameter strField Name of the old primary key involved in the error. ETTable:: SetTable

void SetTable (CString strTableID); Parameter strTable Name of the database table involved in the error.