/[webpac2]/trunk/lib/WebPAC/Output/DBI.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/Output/DBI.pm

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

revision 1211 by dpavlin, Sat May 30 15:34:55 2009 UTC revision 1212 by dpavlin, Sat May 30 20:30:26 2009 UTC
# Line 38  sub init { Line 38  sub init {
38    
39          $log->info($self->dsn);          $log->info($self->dsn);
40    
         $self->{_rows} = {};  
41          $self->{_sth} = {};          $self->{_sth} = {};
42    
43          $self->{_dbh} = DBI->connect( $self->dsn, $self->user, $self->passwd, { RaiseError => 1 } );          $self->{_dbh} = DBI->connect( $self->dsn, $self->user, $self->passwd, { RaiseError => 1 } );
44    
45            $self->{_dbh}->begin_work;
46    
47          if ( -e $self->schema ) {          if ( -e $self->schema ) {
48                  foreach my $sql ( split(/;/, scalar read_file( $self->schema )) ) {                  foreach my $sql ( split(/;/, scalar read_file( $self->schema )) ) {
49                          $log->debug( $sql );                          $log->debug( $sql );
# Line 108  sub add { Line 109  sub add {
109                          $log->debug( "row $table ", sub { dump( $row ) } );                          $log->debug( "row $table ", sub { dump( $row ) } );
110                          $sth->execute( map { $row->{$_} } @cols );                          $sth->execute( map { $row->{$_} } @cols );
111                    
                         push @{ $self->{_rows}->{$table} }, $_ foreach @rows;  
   
112                  }                  }
113          }          }
114    
# Line 129  sub finish { Line 128  sub finish {
128    
129          $log->info('finish');          $log->info('finish');
130    
131  #       warn dump( $self->{_rows} );          $self->{_dbh}->commit;
132            
133            $log->info('commit done');
134    
135          return 1;          return 1;
136  }  }

Legend:
Removed from v.1211  
changed lines
  Added in v.1212

  ViewVC Help
Powered by ViewVC 1.1.26