/usr/share/perl5/SWISS/Ref/TitleStore/EMBLOracle.pm is in libswiss-perl 1.67-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | package SWISS::Ref::TitleStore::EMBLOracle;
use Fcntl;
use Carp;
use DBI;
use DBD::Oracle;
use SWISS::Entry;
use Utils qw(_print_args);
%MANDATORY_PARAMS =
(
);
%DEFAULT_PARAMS =
(
Access => O_RDONLY,
);
# RDONLY RDWR APPEND CREAT EXCL TRUNC
sub TIEHASH {
&_print_args;
my $class = shift;
my $params = shift;
my %tmp = %$params if $params;
my $self = {}; %$self=%tmp if %tmp;
bless $self, $class;
# set not specified parameters to their default
foreach $param (keys %DEFAULT_PARAMS){
next if exists $self->{$param};
$self->{$param} = $DEFAULT_PARAMS{$param};
}
# check if all the required parameters are set
foreach $param (keys %MANDATORY_PARAMS){
next if $self->{$param};
die "Mandatory argument '$param' is missing. ".
$MANDATORY_PARAMS{$param};
}
print STDERR "Connecting...\n" if $main::opt_debug;
$self->{CON} = DBI->connect('dbi:Oracle:','/@PRDB1','', {});
unless ($self->{CON}){
croak "Can't connect to server: $DBI::errstr\n";
return 0;
}
print STDERR "Connected.\n" if $main::opt_debug;
return $self;
}
sub FETCH {
&_print_args;
my $self = shift;
my $key = shift;
my $connection=$self->{CON};
unless ($self->{CURSOR}){
$self->{CURSOR} = $connection->prepare
(q{
select primaryid as medlineid,
title
from datalib.pub_xref,
datalib.publication
where pub_xref.primaryid=?
and pub_xref.dbcode='M'
and pub_xref.pubid=publication.pubid
}) || die "$DBI::errstr";
}
$self->{CURSOR}->execute($key) || die "$DBI::errstr";
my ($muid,$title)=$self->{CURSOR}->fetchrow_array;
return $title;
}
sub STORE {
&_print_args;
my $self = shift;
die "Storing is not permitted. Sorry";
}
sub CLEAR {
&_print_args;
my $self = shift;
die "Deleting is not permitted. Sorry";
}
sub EXISTS {
&_print_args;
my $self = shift;
my $key = shift;
my $title = $self->FETCH($key);
return $title ? 1 : 0;
}
sub FIRSTKEY {
&_print_args;
my $self = shift;
my $connection=$self->{CON};
my $key = undef;
if ($self->{KEYCURSOR}){
print STDERR "finishing keycursor\n";
$self->{KEYCURSOR}->finish();
}
$self->{KEYCURSOR} = $connection->prepare
(q{
select primaryid as medlineid
from datalib.pub_xref
}) || die "$DBI::errstr";
$self->{KEYCURSOR}->execute;
($key) = $self->{KEYCURSOR}->fetchrow_array;
return $key;
}
sub NEXTKEY {
&_print_args;
my $self = shift;
my $lastkey = shift;
my $key = undef;
($key) = $self->{KEYCURSOR}->fetchrow_array;
unless ($key){
$self->{KEYCURSOR}->finish;
undef ($self->{KEYCURSOR});
}
return $key;
}
# * debuggin
1;
|