[Koha-cvs] CVS: koha/C4 Authorities.pm,1.5,1.6

MJ Ray slef at users.sourceforge.net
Wed Dec 3 12:41:06 CET 2003


Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1:/tmp/cvs-serv8541/C4

Modified Files:
	Authorities.pm 
Log Message:
DBI changes as part of bug 662

Index: Authorities.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Authorities.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** Authorities.pm	14 Nov 2003 22:00:46 -0000	1.5
--- Authorities.pm	3 Dec 2003 11:41:04 -0000	1.6
***************
*** 179,191 ****
  #	warn "==> ($env,$category,$branch,$searchstring,$offset,$pagesize)";
  	my $dbh = C4::Context->dbh;
! 	$searchstring=~ s/\'/\\\'/g;
! 	my $query="Select stdlib,freelib,father,id,hierarchy,level from bibliothesaurus where (category =\"$category\")";
! 	$query .= " and hierarchy='$branch'" if ($branch);
! 	$query .= " and match (category,freelib) AGAINST ('$searchstring')" if ($searchstring);
  #	$query .= " and freelib like \"$searchstring%\"" if ($searchstring);
! 	$query .= " order by category,freelib limit $offset,".($pagesize*4);
  # 	warn "q : $query";
  	my $sth=$dbh->prepare($query);
! 	$sth->execute;
  	my @results;
  	my $old_stdlib="";
--- 179,198 ----
  #	warn "==> ($env,$category,$branch,$searchstring,$offset,$pagesize)";
  	my $dbh = C4::Context->dbh;
! 	my $query="Select stdlib,freelib,father,id,hierarchy,level from bibliothesaurus where category=?";
! 	my @bind=($category);
! 	if ($branch) {
! 		$query .= " and hierarchy=?";
! 		push(@bind,$branch);
! 		}
! 	if ($searchstring) {
! 		$query .= " and match (category,freelib) AGAINST (?)";
! 		push(@bind,$searchstring);
! 		}
  #	$query .= " and freelib like \"$searchstring%\"" if ($searchstring);
! 	$query .= " order by category,freelib limit ?,?";
! 	push(@bind,$offset,($pagesize*4));
  # 	warn "q : $query";
  	my $sth=$dbh->prepare($query);
! 	$sth->execute(@bind);
  	my @results;
  	my $old_stdlib="";
***************
*** 194,205 ****
  	}
  	$sth->finish;
! 	$query="Select count(*) from bibliothesaurus where (category =\"$category\")";
! 	$query .= " and hierarchy='$branch'" if ($branch);
! 	$query .= " and stdlib like \"$searchstring%\"" if ($searchstring);
! 	$query .= "";
  	$sth=$dbh->prepare($query);
! 	$sth->execute;
  	my ($cnt) = $sth->fetchrow;
  	$cnt = $pagesize+1 if ($cnt>$pagesize);
  	return ($cnt,\@results);
  }
--- 201,219 ----
  	}
  	$sth->finish;
! 	$query="Select count(*) from bibliothesaurus where category =?";
! 	@bind=($category);
! 	if ($branch) {
! 		$query .= " and hierarchy=?";
! 		push(@bind,$branch);
! 		}
! 	if ($searchstring) {
! 		$query .= " and stdlib like ?";
! 		push(@bind,"$searchstring%");
! 		}
  	$sth=$dbh->prepare($query);
! 	$sth->execute(@bind);
  	my ($cnt) = $sth->fetchrow;
  	$cnt = $pagesize+1 if ($cnt>$pagesize);
+ 	$sth->finish();
  	return ($cnt,\@results);
  }
***************
*** 229,234 ****
  	my ($category,$father)=@_;
  	my $dbh = C4::Context->dbh;
! 	my $query="Select distinct level,stdlib,father from bibliothesaurus where category =? and father =? order by category,stdlib";
! 	my $sth=$dbh->prepare($query);
  	$sth->execute($category,"$father --");
  	my @results;
--- 243,247 ----
  	my ($category,$father)=@_;
  	my $dbh = C4::Context->dbh;
! 	my $sth=$dbh->prepare("Select distinct level,stdlib,father from bibliothesaurus where category =? and father =? order by category,stdlib");
  	$sth->execute($category,"$father --");
  	my @results;





More information about the Koha-cvs mailing list