[Koha-cvs] CVS: koha/z3950 processz3950queue,1.13,1.13.2.1

Paul POULAIN tipaul at users.sourceforge.net
Wed Mar 30 11:53:42 CEST 2005


Update of /cvsroot/koha/koha/z3950
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25494/z3950

Modified Files:
      Tag: rel_2_2
	processz3950queue 
Log Message:
copying processz3950queue from 2.0 branch. The 2.2 version misses an important fix

Index: processz3950queue
===================================================================
RCS file: /cvsroot/koha/koha/z3950/processz3950queue,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -C2 -r1.13 -r1.13.2.1
*** processz3950queue	17 Nov 2004 12:43:54 -0000	1.13
--- processz3950queue	30 Mar 2005 09:53:39 -0000	1.13.2.1
***************
*** 105,113 ****
      $<=$uid;
  }
! my $db_driver = $context->{"config"}{"db_scheme"} || "mysql";
! my $db_name   = $context->{"config"}{"database"};
! my $db_host   = $context->{"config"}{"hostname"};
! my $db_user   = $context->{"config"}{"user"};
! my $db_passwd = $context->{"config"}{"pass"};
  my $dbh = DBI->connect("DBI:$db_driver:$db_name:$db_host",$db_user, $db_passwd);
  
--- 105,113 ----
      $<=$uid;
  }
! my $db_driver = C4::Context->config("db_scheme") || "mysql";
! my $db_name   = C4::Context->config("database");
! my $db_host   = C4::Context->config("hostname");
! my $db_user   = C4::Context->config("user");
! my $db_passwd = C4::Context->config("pass");
  my $dbh = DBI->connect("DBI:$db_driver:$db_name:$db_host",$db_user, $db_passwd);
  
***************
*** 133,137 ****
  while (1) {
  	if ((time-$lastrun)>5) {
- 		print "starting loop\n";
  		$checkqueue = 1; # FIXME during testing, this line forces the loop. REMOVE it to use SIG{HUP} when "daemonized" !
  # clean DB
--- 133,136 ----
***************
*** 184,194 ****
  						} else {
  # and connect to z3950 server
! # new connection required ($dbi) because we might have forked (thanks Harry Jackson)
! 							my $db_driver = $context->{"config"}{"db_scheme"} || "mysql";
! 							my $db_name   = $context->{"config"}{"database"};
! 							my $db_host   = $context->{"config"}{"hostname"};
! 							my $db_user   = $context->{"config"}{"user"};
! 							my $db_passwd = $context->{"config"}{"pass"};
  							my $dbi = DBI->connect("DBI:$db_driver:$db_name:$db_host",$db_user, $db_passwd);
  							my ($name, $server, $database, $user, $password,$syntax) = split(/\//, $serverinfo, 6);
  							$globalname=$name;
--- 183,194 ----
  						} else {
  # and connect to z3950 server
! #FIXME: why do we need $dbi ? can't we use $dbh ?
! 							my $db_driver = C4::Context->config("db_scheme") || "mysql";
! 							my $db_name   = C4::Context->config("database");
! 							my $db_host   = C4::Context->config("hostname");
! 							my $db_user   = C4::Context->config("user");
! 							my $db_passwd = C4::Context->config("pass");
  							my $dbi = DBI->connect("DBI:$db_driver:$db_name:$db_host",$db_user, $db_passwd);
+ 							$dbh->{"InactiveDestroy"} = "true";
  							my ($name, $server, $database, $user, $password,$syntax) = split(/\//, $serverinfo, 6);
  							$globalname=$name;
***************
*** 258,262 ****
  								print "$$/$id : connected to $globalname\n";
   								eval {$conn->option(elementSetName => 'F')};
! 								eval { $conn->option(preferredRecordSyntax => Net::Z3950::RecordSyntax::USMARC);} if ($globalsyntax eq "USMARC");
   								eval { $conn->option(preferredRecordSyntax => Net::Z3950::RecordSyntax::UNIMARC);} if ($globalsyntax eq "UNIMARC");
   								if ($@) {
--- 258,262 ----
  								print "$$/$id : connected to $globalname\n";
   								eval {$conn->option(elementSetName => 'F')};
! 								eval { $conn->option(preferredRecordSyntax => Net::Z3950::RecordSyntax::USMARC);} if ($globalsyntax eq "MARC21");
   								eval { $conn->option(preferredRecordSyntax => Net::Z3950::RecordSyntax::UNIMARC);} if ($globalsyntax eq "UNIMARC");
   								if ($@) {
***************
*** 283,294 ****
   										my $marcdata;
  										# use render() or rawdata() depending on the type of the returned record
- 										my $marcrecord;
  										if (ref($rec) eq "Net::Z3950::Record::USMARC") {
  											$marcdata = $rec->rawdata();
- 											$marcrecord = MARC::File::USMARC::decode($rec->rawdata())
  										}
  										if (ref($rec) eq "Net::Z3950::Record::UNIMARC") {
! 											$marcdata = $rec->render();
! 											$marcrecord = MARC::File::USMARC::decode($rec->render())
  										}
  										$globalencoding = ref($rec);
--- 283,291 ----
   										my $marcdata;
  										# use render() or rawdata() depending on the type of the returned record
  										if (ref($rec) eq "Net::Z3950::Record::USMARC") {
  											$marcdata = $rec->rawdata();
  										}
  										if (ref($rec) eq "Net::Z3950::Record::UNIMARC") {
! 											$marcdata = $rec->rawdata();
  										}
  										$globalencoding = ref($rec);





More information about the Koha-cvs mailing list