/[webpac2]/trunk/lib/WebPAC/Input/Koha.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/WebPAC/Input/Koha.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1233 by dpavlin, Thu Jul 9 22:01:11 2009 UTC revision 1234 by dpavlin, Fri Jul 10 13:53:28 2009 UTC
# Line 37  sub new { Line 37  sub new {
37    
38          my $log = $self->_get_logger();          my $log = $self->_get_logger();
39    
40          $log->info("opening Koha database '$arg->{dsn}'");          if ( -e $arg->{path} ) {
41                    $log->info("Koha marc dump ", $arg->{path}, " exists");
42                    $self->{_koha_size} = 0;
43            } else {
44    
45          $self->{_dbh} = DBI->connect( $arg->{dsn}, $arg->{user}, $arg->{passwd}, { RaiseError => 1 } );                  $log->info("opening Koha database '$arg->{dsn}'");
         $self->{_sth} = $self->{_dbh}->prepare( $arg->{sql} );  
         $self->{_sth}->execute;  
46    
47          warn "got ", $self->{_sth}->rows, " rows for ", $arg->{sql};                  $self->{_dbh} = DBI->connect( $arg->{dsn}, $arg->{user}, $arg->{passwd}, { RaiseError => 1 } );
48                    $self->{_sth} = $self->{_dbh}->prepare( $arg->{sql} );
49                    $self->{_sth}->execute;
50                    $self->{_koha_size} = $self->{_sth}->rows;
51    
52          open( $self->{_koha_fh}, '>', $arg->{path} ) || warn "not creating $arg->{path}: $!";                  warn "got ", $self->{_koha_size}, " rows for ", $arg->{sql};
53    
54                    open( $self->{_koha_fh}, '>', $arg->{path} ) || die "can't create $arg->{path}: $!";
55    
56            }
57    
58          $self ? return $self : return undef;          $self ? return $self : return undef;
59  }  }
# Line 87  Return number of records in database Line 95  Return number of records in database
95    
96  sub size {  sub size {
97          my $self = shift;          my $self = shift;
98          return $self->{_sth}->rows;          return $self->{_koha_size};
99  }  }
100    
101    

Legend:
Removed from v.1233  
changed lines
  Added in v.1234

  ViewVC Help
Powered by ViewVC 1.1.26