[Koha-cvs] CVS: koha/C4 Database.pm,1.2.2.2,1.2.2.3

Alan Millar amillar at users.sourceforge.net
Fri Jun 14 08:14:08 CEST 2002


Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv13796/C4

Modified Files:
      Tag: rel-1-2
	Database.pm 
Log Message:
Parameter check routine for DBI handle

Index: Database.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Database.pm,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -C2 -r1.2.2.2 -r1.2.2.3
*** Database.pm	30 Apr 2002 09:30:52 -0000	1.2.2.2
--- Database.pm	14 Jun 2002 06:13:59 -0000	1.2.2.3
***************
*** 11,15 ****
      
  @ISA = qw(Exporter);
! @EXPORT = qw(&C4Connect);
  
  
--- 11,17 ----
      
  @ISA = qw(Exporter);
! @EXPORT = qw(
! 	&C4Connect &requireDBI
! );
  
  
***************
*** 39,43 ****
     my $dbh=DBI->connect("DBI:mysql:$database:$hostname",$user,$pass);
    return $dbh;
! }    
  
  
--- 41,60 ----
     my $dbh=DBI->connect("DBI:mysql:$database:$hostname",$user,$pass);
    return $dbh;
! } # sub C4Connect
! 
! #------------------
! # Helper subroutine to make sure database handle was passed properly
! sub requireDBI {
!     my (
! 	$dbh,
! 	$subrname,	# name of calling subroutine
!     )=@_;
! 
!     unless ( ref($dbh) =~ /DBI::db/ ) {
! 	print "<pre>\nERROR: Subroutine $subrname called without proper DBI handle.\n" .
! 		"Please contact system administrator.\n</pre>\n";
! 	die "ERROR: Subroutine $subrname called without proper DBI handle.\n";
!     }
! } # sub requireDBI
  
  





More information about the Koha-cvs mailing list