The Common Database Interface and Report Generator is a computer program that serves as both (1) a single common interface for data-base application programs to gain access to local or remote data bases by use of Structured Query Language (SQL) operators and (2) a report generator.

The data-base-interface portion of the program enables a calling program to gain access to an Oracle data base by use of all of the basic SQL operators (SELECT, INSERT, UPDATE, DELETE, COMMIT, and ROLLBACK). The program provides capabilities for logging in, logging out, and reporting errors. Each data-base function corresponds to a function callable in the C computing language. The calling data-base function passes the SQL statement as an argument to the called function.

For the SELECT function, the calling function also passes the function-specific callback routine as an argument. The callback routine is executed after each record has been retrieved from the data base. This unique approach allows the SELECT function without buffering of all the retrieved data. Status information is returned in the function return value.

The report-generator part of the program produces a plain text report, based on the contents of a report template. Instead of writing individual functions for each report, the user need only write templates to direct the report generator to generate the report. Any changes in the format of a report can be made by modifying the report template; there is no need to modify any computer code.

The report-generator part of the program invokes a report-template-parser subprogram to read in the report template via a report-template scanner. Then the report-generator part of the program passes, to a reporting-engine subprogram, the report structure and the arguments passed in from the calling program. The reporting engine generates the report output, invoking a data-base-access module to obtain data for the report and invoking a page-construction module to format the output.

The program affords full-featured error reporting capabilities. Multiple tables can be updated from the computer display screen; this feature saves a significant number of hours. Report templates can easily be changed without stopping the program; this feature helps to reduce cost.

The primary benefits afforded by this program are that (1) it yields reusable computer code, thereby reducing the cost of developing and maintaining code, reducing the number of lines of code that must be maintained, and (2) it centralizes the code, thereby making it easy to maintain. Because there is no need for a programmer to write Pro*C code, the level of required programming skill is correspondingly reduced.

This work was done by Fran Y. Mi of United Space Alliance and Kevin N. Shaum of Unisys for Johnson Space Center. For further information, access the Technical Support Package (TSP) free on-line at  under the Information Sciences category.


NASA Tech Briefs Magazine

This article first appeared in the July, 2001 issue of NASA Tech Briefs Magazine.

Read more articles from the archives here.