Created
June 20, 2012 16:09
-
-
Save robertberry-zz/2960705 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use DBI; | |
use Test::More; | |
my $user; # set these | |
my $sid; | |
my $host; | |
my $pass; | |
my $dbh = DBI->connect("DBI:Oracle:sid=$sid;host=$host", $user, $pass); | |
sub is_publication_used { | |
my ($dbh, $publication_id) = @_; | |
my ($used) = $dbh->selectrow_array(qq{ | |
SELECT eprints_api.is_publication_used(?) | |
FROM dual | |
}, undef, $publication_id); | |
$used eq "Y"; | |
} | |
sub publication_usage { | |
my ($dbh, $publication_id) = @_; | |
my ($usage) = $dbh->selectrow_array(qq{ | |
SELECT eprints_api.publication_usage(?) | |
FROM dual | |
}, undef, $publication_id); | |
$usage; | |
} | |
ok is_publication_used($dbh, 586596), "Publication #58596 should be flagged as used."; | |
ok !is_publication_used($dbh, 587416), "Publication #587416 should not be flagged as used."; | |
print STDERR publication_usage($dbh, 586596); | |
done_testing; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment