utPLSQL logo

[ Home | Getting Started | Build Test Packages | Examples | User Guide | Release Notes | Document Map ]

< Previous Section: utOutput Package | Next Section: Defining Test Suites >

utRecEq Package

This package contains the following procedures and functions:

utRecEq.add Add a record type comparison function
utRecEq.compile Compile a package's record type comparison functions
utRecEq.rem Remove record type comparison functions

Generate functions to compare record types

This package (created by Dan Spencer) allows the creation of functions to allow the comparison of record types based on tables or views (%ROWTYPE records in other words). They are generated by the add procedure:

PROCEDURE add(
   pkg_name_in IN ut_package.name%TYPE,
   record_in  IN ut_receq.name%TYPE,
   rec_owner_in  IN ut_receq.created_by%TYPE := USER
);

The pkg_name_in parameter contains the name of a tested package you wish to associate with this record type. Note that this package name should already exist in the ut_package table. The record_in parameter contains the name of the view or table whose record type is to be compared. The final (optional) parameter contains the name of the schema in which the table or view exists. It defaults to the current user.

The generated function will be named EQ_{Record_Schema_}Record_Name. The schema is only inserted when the record type is not within the current one. The function will return TRUE if the two records are identical on a field-by-field comparison and FALSE otherwise. Note that NULL fields are considered equal.

The details of the EQ_* functions and their association with tested packages held in two tables:

Compile a package's record comparison functions

This routine recompiles all the EQ_* functions associated with a given package:

PROCEDURE compile(pkg_name_in IN ut_package.name%TYPE);

when autocompiling is turned on, this is called by utplsql.test or utplsql.testsuite before the test packages themselves are recompiled.

Remove record comparison functions

To remove record comparison functions, use the following:

PROCEDURE rem(
   name_in  IN ut_receq.name%TYPE,
   rec_owner_in   IN ut_receq.created_by%TYPE := USER
   for_package_in IN BOOLEAN := FALSE
);

If for_package_in is FALSE, then name_in is taken to refer to a record type to remove, with rec_owner_in specifying the schema the record type is in. All package associations for this record type are removed and the EQ_* function is dropped.

On the other hand, if for_package_in is TRUE, then name_in is taken to refer to a package. In this case, all the package's associations are removed. If no other package is associated with a given record, then the EQ_* function is dropped. (Note that the rec_owner_in parameter is ignored here).

< Previous Section: utOutput Package | Next Section: Defining Test Suites >

utPLSQL logo

Valid XHTML 1.0 Strict