DBD-Informix

 view release on metacpan or  search on metacpan

lib/DBD/Informix/TestHarness.pm  view on Meta::CPAN

In looking for the three values, it examines the environment variables
DBD_INFORMIX_DATABASE, DBD_INFORMIX_USERNAME and
DBD_INFORMIX_PASSWORD.
If the database is not determined, it looks at the DBI_DBNAME
environment variable (which is essentially obsolete as far as DBI is
concerned, but which is documented by the esqltest code -- an
alternative was to remove support for DBI_DBNAME from esqltest.ec).
If DBI_DBNAME is not set, then the default database name is 'stores'
with no version suffix.
If the username and password are not set, then empty strings are
returned.

=head2 Using secondary_connection

The secondary_connection function also returns three values, the
database name, the username and the password for the secondary test
connection.
This is used in the multiple connection tests.

    my ($dbase, $user, $pass) = &secondary_connection();
    my ($dbh) = DBI->connect("dbi:Informix:$dbase", $user, $pass)
                    or die "$DBI::errstr\n";

In looking for the three values, it examines the environment variables
DBD_INFORMIX_DATABASE2, DBD_INFORMIX_USERNAME2 and
DBD_INFORMIX_PASSWORD2.
If the database is not determined, it uses the primary_connection
method above to specify the values.

=head2 Using tertiary_connection

The C<tertiary_connection> function also returns three values, the
database name, the username and the password for the tertiary test
connection.
This is used in the multiple connection tests.

    my ($dbase, $user, $pass) = &tertiary_connection();
    my ($dbh) = DBI->connect("dbi:Informix:$dbase", $user, $pass)
                    or die "$DBI::errstr\n";

In looking for the three values, it examines the environment variables
DBD_INFORMIX_DATABASE3, DBD_INFORMIX_USERNAME3 and
DBD_INFORMIX_PASSWORD3.
If the database is not determined, it uses the primary_connection
method above to specify the values.

=head2 Using smart_blob_space_name

The C<smart_blob_space_name> function is used to determine the name of a
smart blob space that the program should use.
It takes a database handle, and uses the environment variables
DBD_INFORMIX_NO_SBSPACE and DBD_INFORMIX_SBSPACE to determine whether
smart blobs should be tested.

The return value is either an empty string (do not test smart blobs) or
the name of a valid smart blob space.

=head2 Using validate_unordered_unique_data

The C<validate_unordered_unique_data> function is used to ensure that
exactly the correct data is returned from a cursor-like statement handle
which has already had the $sth->execute method executed on it.

The data in $val is a hash indexed by the key value containing the
expected values for each column corresponding to the key value:-

    &validate_unordered_unique_data($sth, $keycol, \%expected);

    &validate_unordered_unique_data($sth, 'c1',
        {
            'c1-value1' => { 'c1' => 'c1-value1', 'c2' => 'c2-value1', 'c3' => 'c3-value1' },
            'c1-value2' => { 'c1' => 'c1-value1', 'c2' => 'c2-value2', 'c3' => 'c3-value2' },
        });

Note that the key (c1) and expected value (c1-value1) are repeated in
the data for each row; this is a consistency check that the function enforces.

This function assumes that each row in result set is supposed to appear
exactly once.
Any extra result rows are erroneous; any missing result rows are
erroneous.
Any missing columns are erroneous; any extra columns are erroneous.
The results from C<fetchrow_hashref>() must be unambiguous, meaning that
each selected column must have a unique name.
The key data must be a single column.

This routine (or its hypothetical relatives such as
C<validate_ordered_unique_data>, C<validate_unordered_duplicate_data>,
and C<validate_ordered_duplicate_data>) should be used to ensure that
the correct results are returned.  Note that there might not be any need
for separate routine for unique and duplicate ordered data.

=head2 Using set_verbosity

The C<set_verbosity> function takes a value 0, 1 or 2 and sets the
verbosity of the validate_* functions accordingly.

    &set_verbosity(0);

=head2 Note

All these routines can also be used without parentheses or the &, so that
the following is also valid:

    select_zero_data $dbh, $stmt;

=head1 AUTHOR

At various times:

=over 2

=item *
Jonathan Leffler (johnl@informix.com) # obsolete email address

=item *
Jonathan Leffler (j.leffler@acm.org)

=item *
Jonathan Leffler (jleffler@informix.com) # obsolete email address



( run in 1.298 second using v1.01-cache-2.11-cpan-140bd7fdf52 )