On Thu 29 Apr 2004 10:52, Tim Bunce <[EMAIL PROTECTED]> wrote:
> > lep a5:/pro/3gl/CPAN/DBD-Unify-0.40 116 > env HARNESS_PERL_SWITCHES=-MDevel::Cover 
> > make test
> > /pro/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 
> > 'blib/arch')" t/*.t
> > [...]
> > Total                                 18.2   17.2    8.5   21.6  100.0   16.9
> > ----------------------------------- ------ ------ ------ ------ ------ ------
> 
> Yeah. Great. Other driver authors please give it a whirl!
> 
> (And then start improving your test coverage :-)

� All tests now under Test::More
� Added about 2500 tests
� Added a new test script to cover the uncovered sub's

The last point made me cover table_info () in detail, and the (alpha) sub that
was below:

--8<---
# type = "R" ? references me : references
sub link_info ($;$$$$)
{
    my $dbh = shift;
    my ($catalog, $schema, $table, $type, $attr);
    ref $_[0] or ($catalog, $schema, $table, $type) = splice @_, 0, 4;
    if ($attr = shift and ref $attr) {
        exists $attr->{TABLE_SCHEM} and $schema = $attr->{TABLE_SCHEM};
        exists $attr->{TABLE_NAME}  and $table  = $attr->{TABLE_NAME};
        exists $attr->{TABLE_TYPE}  and $type   = $attr->{TABLE_TYPE};
        }
    my @where;
    unless ($type and $type =~ m/^[Rr]/) {
        $schema and push @where, "REFERENCING_OWNER like '$schema'";
        $table  and push @where, "REFERENCING_TABLE like '$table'";
        }
    else {
        $schema and push @where, "REFERENCED_OWNER  like '$schema'";
        $table  and push @where, "REFERENCED_TABLE  like '$table'";
        }
    local $" = " and ";
    my $where = @where ? " where @where" : "";
    my $sth = $dbh->prepare (join "\n",
        "select '', REFERENCED_OWNER, INDEX_NAME, REFERENCED_TABLE,",
        "       REFERENCED_COLUMN, REFERENCED_COLUMN_ORD,",
        "       REFERENCING_OWNER, REFERENCING_TABLE, REFERENCING_COLUMN,",
        "       REFERENCING_COLUMN_ORD ",
        "from   SYS.LINK_INDEXES",
        $where);
    $sth or return;
    $sth->execute;
    $sth;
    } # link_info
-->8---

Now I know that DBI does not have a link_info method (yet), and I was
wondering if there are plans for something like that?

This reports the referential integrety links. (foreign keys in Oracle)

> Tim.

-- 
H.Merijn Brand        Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using perl-5.6.1, 5.8.0 & 633 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3,
     WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.024 &/| DBD-Unify
ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/


Reply via email to