/* begin transaction (add write lock) (zebraapi.c) */
%name(begin_trans)
-void zebra_begin_trans (ZebraHandle zh);
+int zebra_begin_trans (ZebraHandle zh, int rw);
/* end transaction (remove write lock) (zebraapi.c) */
%name(end_trans)
-.cvsignore
IDZebra_wrap.c
MANIFEST
Makefile.PL
demo/pod.abs
demo/pod.pm
demo/zebra.cfg
-demo/register
-demo/lock
-demo/tmp
lib/IDZebra.pm
lib/IDZebra/Data1.pm
lib/IDZebra/Filter.pm
t/06_retrieval.t
t/07_sort.t
t/08_scan.t
-zebra_api_ext.c
-zebra_api_ext.h
zebra_perl.c
zebra_perl.h
WriteMakefile(
'NAME' => 'IDZebra',
- 'OBJECT' => 'IDZebra_wrap.o zebra_api_ext.o zebra_perl.o' ,
+ 'OBJECT' => 'IDZebra_wrap.o zebra_perl.o' ,
'INC' => "-I../index -I../include @YAZINC@",
'LIBS' => "-L../index -lzebra -L../data1 -ldata1 @ZPERL_LIBS@ @TCL_LIB@ @YAZLIB@",
'OPTIMIZE' => '-g -O2'
-# $Id: Session.pm,v 1.11 2003-03-04 19:33:52 pop Exp $
+# $Id: Session.pm,v 1.12 2003-03-05 00:28:16 pop Exp $
#
# Zebra perl API header
# =============================================================================
use IDZebra::Resultset;
use IDZebra::ScanList;
use IDZebra::RetrievalRecord;
- our $VERSION = do { my @r = (q$Revision: 1.11 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+ our $VERSION = do { my @r = (q$Revision: 1.12 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
# our @ISA = qw(IDZebra::Logger);
}
sub begin_trans {
my ($self) = @_;
$self->checkzh;
- IDZebra::begin_trans($self->{zh});
+ if (my $err = IDZebra::begin_trans($self->{zh},1)) {
+ if ($self->errCode == 2) {
+ croak ("TRANS_RW not allowed within TRANS_RO");
+ } else {
+ croak("Error starting transaction; code:".
+ $self->errCode . " message: " . $self->errString);
+ }
+ }
}
sub end_trans {
#!perl -Tw
# =============================================================================
-# $Id: 01_base.t,v 1.2 2003-03-04 19:33:53 pop Exp $
+# $Id: 01_base.t,v 1.3 2003-03-05 00:28:16 pop Exp $
#
# Perl API header
# =============================================================================
use strict;
use warnings;
-use Test::More tests=>9;
+use Test::More tests=>10;
# ----------------------------------------------------------------------------
# Session opening and closing
}
use pod;
+# ----------------------------------------------------------------------------
+# Just to be sure...
+mkdir ("demo/tmp");
+mkdir ("demo/lock");
+mkdir ("demo/register");
# ----------------------------------------------------------------------------
# Session opening and closing
ok(($sess->group->{databaseName} eq "demo2"),"Record group is selected");
+# ---------------------------------------------------------------------------
+# Transactions
+$sess->begin_read;
+eval {$sess->begin_trans;};
+ok (($@ ne ""), $@);
+$sess->end_read;
+
+
+
+
# ----------------------------------------------------------------------------
# Close session
+
$sess->close;
+++ /dev/null
-#include <assert.h>
-#include <stdio.h>
-#ifdef WIN32
-#include <io.h>
-#include <process.h>
-#include <direct.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <yaz/diagbib1.h>
-#include "index.h"
-#include <charmap.h>
-#include <data1.h>
-#include "zebra_perl.h"
-#include "zebra_api_ext.h"
-#include "yaz/log.h"
-#include <yaz/sortspec.h>
-
-
+++ /dev/null
-#ifndef ZEBRA_API_EXT_H
-#define ZEBRA_API_EXT_H
-
-#include "zebraapi.h"
-
-void api_records_retrieve (ZebraHandle zh, ODR stream,
- const char *setname, Z_RecordComposition *comp,
- oid_value input_format, int num_recs,
- ZebraRetrievalRecord *recs);
-
-#endif