X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=perl%2Flib%2FIDZebra%2FSession.pm;h=ea49deb785a2919df7e7a2eeff8ed14f1e7c293c;hb=8c703765dad3228649e340337b293f76603ca9de;hp=12837025f0f1390ea2c864c29304092fabcb6ad7;hpb=c163115e3641d9f586c7aa5723e2685a31084ab3;p=idzebra-moved-to-github.git diff --git a/perl/lib/IDZebra/Session.pm b/perl/lib/IDZebra/Session.pm index 1283702..ea49deb 100644 --- a/perl/lib/IDZebra/Session.pm +++ b/perl/lib/IDZebra/Session.pm @@ -1,4 +1,4 @@ -# $Id: Session.pm,v 1.17 2003-05-21 08:03:02 pop Exp $ +# $Id: Session.pm,v 1.18 2003-07-07 10:59:33 pop Exp $ # # Zebra perl API header # ============================================================================= @@ -16,7 +16,7 @@ BEGIN { use IDZebra::ScanList; use IDZebra::RetrievalRecord; require Exporter; - our $VERSION = do { my @r = (q$Revision: 1.17 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; + our $VERSION = do { my @r = (q$Revision: 1.18 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; our @ISA = qw(IDZebra::Logger Exporter); our @EXPORT = qw (TRANS_RW TRANS_RO); } @@ -455,22 +455,30 @@ sub _update_args { sub insert_record { my ($self, %args) = @_; $self->checkzh; - return(IDZebra::insert_record($self->{zh}, - $self->_record_update_args(%args))); + my @args = $self->_record_update_args(%args); + my $stat = IDZebra::insert_record($self->{zh}, @args); + my $sysno = $args[2]; $stat = -1 * $stat if ($stat > 0); + return $stat ? $stat : $$sysno; + if ($stat) { return ($stat); } else { return $sysno}; } sub update_record { my ($self, %args) = @_; $self->checkzh; - return(IDZebra::update_record($self->{zh}, - $self->_record_update_args(%args))); + my @args = $self->_record_update_args(%args); + my $stat = IDZebra::update_record($self->{zh}, @args); + my $sysno = $args[2]; $stat = -1 * $stat if ($stat > 0); + return $stat ? $stat : $$sysno; + if ($stat) { return ($stat); } else { return $$sysno}; } sub delete_record { my ($self, %args) = @_; $self->checkzh; - return(IDZebra::delete_record($self->{zh}, - $self->_record_update_args(%args))); + my @args = $self->_record_update_args(%args); + my $stat = IDZebra::delete_record($self->{zh}, @args); + my $sysno = $args[2]; $stat = -1 * $stat if ($stat > 0); + return $stat ? $stat : $$sysno; } sub _record_update_args { @@ -517,7 +525,7 @@ sub _record_update_args { unless ($rectype) { $rectype=""; } - return ($rg, $rectype, $sysno, $match, $fname, $buff, $len, $force); + return ($rg, $rectype, \$sysno, $match, $fname, $buff, $len, $force); } # ----------------------------------------------------------------------------- @@ -615,9 +623,13 @@ sub _new_setname { sub _search_pqf { my ($self, $query, $setname) = @_; - my $hits = IDZebra::search_PQF($self->{zh}, + + my $hits = 0; + + my $res = IDZebra::search_PQF($self->{zh}, $query, - $setname); + $setname, + \$hits); my $rs = IDZebra::Resultset->new($self, name => $setname,