* perl5.swg
*
* Perl5 runtime library
- * $Header: /home/cvsroot/idis/perl/Attic/IDZebra_wrap.c,v 1.18 2003-05-21 08:03:02 pop Exp $
+ * $Header: /home/cvsroot/idis/perl/Attic/IDZebra_wrap.c,v 1.19 2003-07-07 10:59:33 pop Exp $
* ----------------------------------------------------------------------------- */
#define SWIGPERL
ZebraHandle arg1 ;
recordGroup *arg2 ;
char *arg3 ;
- int arg4 ;
+ int *arg4 ;
char *arg5 ;
char *arg6 ;
char *arg7 ;
int arg8 ;
int arg9 ;
int result;
+ int dvalue4 ;
int argvi = 0;
+ SV * _saved[1] ;
dXSARGS;
if ((items < 9) || (items > 9)) {
}
if (!SvOK((SV*) ST(2))) arg3 = 0;
else arg3 = (char *) SvPV(ST(2), PL_na);
- arg4 = (int) SvIV(ST(3));
+ {
+ SV *tempsv;
+ if (!SvROK(ST(3))) {
+ SWIG_croak("expected a reference");
+ }
+ tempsv = SvRV(ST(3));
+ if (!SvIOK(tempsv)) {
+ SWIG_croak("expected a integer reference");
+ }
+ dvalue4 = SvIV(tempsv);
+ arg4 = &dvalue4;
+ }
if (!SvOK((SV*) ST(4))) arg5 = 0;
else arg5 = (char *) SvPV(ST(4), PL_na);
if (!SvOK((SV*) ST(5))) arg6 = 0;
else arg7 = (char *) SvPV(ST(6), PL_na);
arg8 = (int) SvIV(ST(7));
arg9 = (int) SvIV(ST(8));
+ _saved[0] = ST(3);
result = (int)zebra_insert_record(arg1,arg2,(char const *)arg3,arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,arg8,arg9);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++), (IV) result);
+ {
+ SV *tempsv;
+ tempsv = SvRV(_saved[0]);
+ sv_setiv(tempsv, (IV) *arg4);
+ }
XSRETURN(argvi);
fail:
(void) _swigerr;
ZebraHandle arg1 ;
recordGroup *arg2 ;
char *arg3 ;
- int arg4 ;
+ int *arg4 ;
char *arg5 ;
char *arg6 ;
char *arg7 ;
int arg8 ;
int arg9 ;
int result;
+ int dvalue4 ;
int argvi = 0;
+ SV * _saved[1] ;
dXSARGS;
if ((items < 9) || (items > 9)) {
}
if (!SvOK((SV*) ST(2))) arg3 = 0;
else arg3 = (char *) SvPV(ST(2), PL_na);
- arg4 = (int) SvIV(ST(3));
+ {
+ SV *tempsv;
+ if (!SvROK(ST(3))) {
+ SWIG_croak("expected a reference");
+ }
+ tempsv = SvRV(ST(3));
+ if (!SvIOK(tempsv)) {
+ SWIG_croak("expected a integer reference");
+ }
+ dvalue4 = SvIV(tempsv);
+ arg4 = &dvalue4;
+ }
if (!SvOK((SV*) ST(4))) arg5 = 0;
else arg5 = (char *) SvPV(ST(4), PL_na);
if (!SvOK((SV*) ST(5))) arg6 = 0;
else arg7 = (char *) SvPV(ST(6), PL_na);
arg8 = (int) SvIV(ST(7));
arg9 = (int) SvIV(ST(8));
+ _saved[0] = ST(3);
result = (int)zebra_update_record(arg1,arg2,(char const *)arg3,arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,arg8,arg9);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++), (IV) result);
+ {
+ SV *tempsv;
+ tempsv = SvRV(_saved[0]);
+ sv_setiv(tempsv, (IV) *arg4);
+ }
XSRETURN(argvi);
fail:
(void) _swigerr;
ZebraHandle arg1 ;
recordGroup *arg2 ;
char *arg3 ;
- int arg4 ;
+ int *arg4 ;
char *arg5 ;
char *arg6 ;
char *arg7 ;
int arg8 ;
int arg9 ;
int result;
+ int dvalue4 ;
int argvi = 0;
+ SV * _saved[1] ;
dXSARGS;
if ((items < 9) || (items > 9)) {
}
if (!SvOK((SV*) ST(2))) arg3 = 0;
else arg3 = (char *) SvPV(ST(2), PL_na);
- arg4 = (int) SvIV(ST(3));
+ {
+ SV *tempsv;
+ if (!SvROK(ST(3))) {
+ SWIG_croak("expected a reference");
+ }
+ tempsv = SvRV(ST(3));
+ if (!SvIOK(tempsv)) {
+ SWIG_croak("expected a integer reference");
+ }
+ dvalue4 = SvIV(tempsv);
+ arg4 = &dvalue4;
+ }
if (!SvOK((SV*) ST(4))) arg5 = 0;
else arg5 = (char *) SvPV(ST(4), PL_na);
if (!SvOK((SV*) ST(5))) arg6 = 0;
else arg7 = (char *) SvPV(ST(6), PL_na);
arg8 = (int) SvIV(ST(7));
arg9 = (int) SvIV(ST(8));
+ _saved[0] = ST(3);
result = (int)zebra_delete_record(arg1,arg2,(char const *)arg3,arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,arg8,arg9);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++), (IV) result);
+ {
+ SV *tempsv;
+ tempsv = SvRV(_saved[0]);
+ sv_setiv(tempsv, (IV) *arg4);
+ }
XSRETURN(argvi);
fail:
(void) _swigerr;
ZebraHandle arg1 ;
char *arg2 ;
char *arg3 ;
+ int *arg4 ;
int result;
+ int dvalue4 ;
int argvi = 0;
+ SV * _saved[1] ;
dXSARGS;
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: search_PQF(zh,pqf_query,setname);");
+ if ((items < 4) || (items > 4)) {
+ SWIG_croak("Usage: search_PQF(zh,pqf_query,setname,hits);");
}
{
ZebraHandle * argp;
else arg2 = (char *) SvPV(ST(1), PL_na);
if (!SvOK((SV*) ST(2))) arg3 = 0;
else arg3 = (char *) SvPV(ST(2), PL_na);
- result = (int)zebra_search_PQF(arg1,(char const *)arg2,(char const *)arg3);
+ {
+ SV *tempsv;
+ if (!SvROK(ST(3))) {
+ SWIG_croak("expected a reference");
+ }
+ tempsv = SvRV(ST(3));
+ if (!SvIOK(tempsv)) {
+ SWIG_croak("expected a integer reference");
+ }
+ dvalue4 = SvIV(tempsv);
+ arg4 = &dvalue4;
+ }
+ _saved[0] = ST(3);
+ result = (int)zebra_search_PQF(arg1,(char const *)arg2,(char const *)arg3,arg4);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++), (IV) result);
+ {
+ SV *tempsv;
+ tempsv = SvRV(_saved[0]);
+ sv_setiv(tempsv, (IV) *arg4);
+ }
XSRETURN(argvi);
fail:
(void) _swigerr;
}
arg5[i] = NULL;
}
- result = (int)sort(arg1,arg2,(char const *)arg3,(char const *)arg4,(char const **)arg5);
+ result = (int)zebra_sort_by_specstr(arg1,arg2,(char const *)arg3,(char const *)arg4,(char const **)arg5);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++), (IV) result);
arg4 = *argp;
}
{
- int i;
- if (!SvIOK(ST(4)))
- croak("Argument 5 is not an integer.");
- i = SvIV(ST(4));
- arg5 = &i;
+ if (SWIG_ConvertPtr(ST(4), (void **) &arg5, SWIGTYPE_p_int,0) < 0) {
+ SWIG_croak("Type error in argument 5 of data1_nodetogr. Expected _p_int");
+ }
}
result = (Z_GenericRecord *)data1_nodetogr(arg1,arg2,arg3,arg4,arg5);
}
arg3 = (int) SvIV(ST(2));
{
- int i;
- if (!SvIOK(ST(3)))
- croak("Argument 4 is not an integer.");
- i = SvIV(ST(3));
- arg4 = &i;
+ if (SWIG_ConvertPtr(ST(3), (void **) &arg4, SWIGTYPE_p_int,0) < 0) {
+ SWIG_croak("Type error in argument 4 of data1_nodetobuf. Expected _p_int");
+ }
}
result = (char *)data1_nodetobuf(arg1,arg2,arg3,arg4);
}
arg4 = (int) SvIV(ST(3));
{
- int i;
- if (!SvIOK(ST(4)))
- croak("Argument 5 is not an integer.");
- i = SvIV(ST(4));
- arg5 = &i;
+ if (SWIG_ConvertPtr(ST(4), (void **) &arg5, SWIGTYPE_p_int,0) < 0) {
+ SWIG_croak("Type error in argument 5 of data1_nodetomarc. Expected _p_int");
+ }
}
result = (char *)data1_nodetomarc(arg1,arg2,arg3,arg4,arg5);
}
arg3 = (int) SvIV(ST(2));
{
- int i;
- if (!SvIOK(ST(3)))
- croak("Argument 4 is not an integer.");
- i = SvIV(ST(3));
- arg4 = &i;
+ if (SWIG_ConvertPtr(ST(3), (void **) &arg4, SWIGTYPE_p_int,0) < 0) {
+ SWIG_croak("Type error in argument 4 of data1_nodetoidsgml. Expected _p_int");
+ }
}
result = (char *)data1_nodetoidsgml(arg1,arg2,arg3,arg4);
}
arg3 = (int) SvIV(ST(2));
{
- int i;
- if (!SvIOK(ST(3)))
- croak("Argument 4 is not an integer.");
- i = SvIV(ST(3));
- arg4 = &i;
+ if (SWIG_ConvertPtr(ST(3), (void **) &arg4, SWIGTYPE_p_int,0) < 0) {
+ SWIG_croak("Type error in argument 4 of data1_nodetosoif. Expected _p_int");
+ }
}
result = (char *)data1_nodetosoif(arg1,arg2,arg3,arg4);
-# $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
# =============================================================================
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);
}
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 {
unless ($rectype) {
$rectype="";
}
- return ($rg, $rectype, $sysno, $match, $fname, $buff, $len, $force);
+ return ($rg, $rectype, \$sysno, $match, $fname, $buff, $len, $force);
}
# -----------------------------------------------------------------------------
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,
#!perl
# =============================================================================
-# $Id: 03_record_update.t,v 1.5 2003-04-15 20:56:33 pop Exp $
+# $Id: 03_record_update.t,v 1.6 2003-07-07 10:59:33 pop Exp $
#
# Perl API header
# =============================================================================
use strict;
use warnings;
-use Test::More tests => 17;
+use Test::More tests => 18;
# ----------------------------------------------------------------------------
# Session opening and closing
$sess->begin_trans;
-$sysno = $sess->update_record(data => $rec2,
- recordType => 'grs.perl.pod',
- groupName => "demo1",
- );
+my $sysno1 = $sess->update_record(data => $rec2,
+ recordType => 'grs.perl.pod',
+ groupName => "demo1",
+ );
-$sysno = $sess->update_record(data => $rec2,
- recordType => 'grs.perl.pod',
- groupName => "demo1",
- );
+my $sysno2 = $sess->update_record(data => $rec2,
+ recordType => 'grs.perl.pod',
+ groupName => "demo1",
+ );
$stat = $sess->end_trans;
ok(($stat->{inserted} == 0), "Inserted 0 records");
ok(($stat->{updated} == 1), "Updated $stat->{updated} records");
-ok(($sysno > 0),"Inserted got valid sysno");
+ok(($sysno1 > 0),"Updated record got valid sysno");
+ok(($sysno2 < 0),"Unupdated record got invalid sysno");
$sess->begin_trans;
$sysno = $sess->delete_record(data => $rec3,