Previous | Table of Contents | Next

Page 379

Application Programming Interface

As you are developing your applications using Designer/2000, you will realize that there are some activities that you want to do that are not easily done using even the most sophisticated tools it provides. The user extensibility feature of DES2K can be helpful in putting the extensions you created in the repository. The API opens the repository by allowing you to input and output information from the repository as well as the user extensibility features that you create. The API basically allows you to manipulate the repository in any way you want and thus bypass any limitation that you may encounter with the DES2K functionality. The API will also allow you to customize certain functionality according to your project needs, rather than be forced to use the DES2K functionality. This results in a direct increase in productivity and higher percentage of generation. It is important to understand that working with the API will require creating program code and that there will be a learning curve. It is therefore important to be sure that the functionality you are looking for is really not provided by DES2K. In the long run, it will help to identify the best method of getting your task accomplished.

Using the API

The API is a set of database views and PL/SQL packages in the repository owner's schema that enables safe manipulation of the repository. The repository consists of a set of tables, and the relationship among these tables is not documented. The API consists of several important views of these tables and PL/SQL packages that allow you to perform DML on these tables without using the DES2K interface.

A good SQL and PL/SQL knowledge is recommended to be able to use the API effectively. It will be useful to have a thorough understanding of the elements and properties that you intend to manipulate. After you know which elements and properties you wish to work with, look through the API documentation, including the online help and the meta-model diagrams that ship with the product, to get a better understanding of all the API that you can use. The meta-model diagrams that ship with Designer/2000 are very useful and show the API views and their relationships. These diagrams are grouped into subsets:

Page 380

Use the appropriate model based on what you want to achieve. Once the details about the element and the API to use are understood, the next step is to create PL/SQL procedures and packages to do the needed manipulation.

API Views and Packages

The repository base tables have names with the prefix SDD_ and CDI_. The API views have names with the prefix CI_. All the repository views have some important columns, such as:

The online help system is very powerful in the determination of the view descriptions.

API packages are prefixed with CIO, and more than 300 PL/SQL packages comprise the API, one package for each type of repository element. These packages contain procedures with the following prefixes:

The online help system provides useful information about the packages as well. In addition to the API calls mentioned above, there are API calls that implement a set of statements instead of individual statements, thereby acting as a transaction model. The transaction model temporarily disables constraint checking until the transaction is complete. As a result, complex relationships can be established and the constraint checking is deferred until the end, when the transaction is committed. The CDAPI package is mostly responsible for handling the transaction model.

The following steps can be used to implement the transaction model:

  1. Declare the application system and version you will be using.
  2. Open the transaction.
  3. Load the value of record variable.
  4. Load the indicator of record variable.
  5. Perform the DML and validate it.
  6. If the previous steps are successful, commit the transaction; otherwise, roll back the transaction.

Page 381

API Limitations

Even though we have seen that the API is a powerful and flexible feature, it has some limitations. For example, you cannot manipulate text types such as notes, descriptions, PL/SQL blocks, and where clauses. This text can be queried from the CDI_TEXT table, but performing DML on these texts is not recommended. The structure of the CDI_TEXT table is described in Table 15.6.

Table 15.6Structure of the CDI_TEXT Table

Column Name Null? Type Comments
TXT_REF Not Null NUMBER(38) Element ID
TXT_SEQ Not Null NUMBER(6) Line number for the record
TXT_TYPE Not Null VARCHAR2(6) The type of text
TXT_TEXT Null VARCHAR2(240) The text

Another limitation of the API is that it cannot be called directly from Oracle Forms.

Troubleshooting Designer/2000

Although Designer/2000 is "perfect," there are times when non-user errors occur, and you need to determine the cause of the error and resolve it. This section discusses several common errors and also different strategies that can be used to diagnose Designer/2000 errors.

Checking Common Errors

During the install, the Repository Administration Utility checks its work and stops if there is a problem. Common errors include:

Previous | Table of Contents | Next