use offset for key for tables with primary key
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 14 Nov 2010 13:29:57 +0000 (14:29 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 14 Nov 2010 13:29:57 +0000 (14:29 +0100)
koha/koha2riak-search.pl

index 6ce1867..c6ac166 100755 (executable)
@@ -48,6 +48,7 @@ while(1) {
     while (my $row = $sth->fetchrow_hashref() ) {
 
         my $key = join('_', map { $row->{$_} } @pk);
+               $key ||= "o.$offset";
                my $biblionumber = $row->{biblionumber};
 
         if ( my $marcxml = delete $row->{marcxml} ) {
@@ -69,9 +70,10 @@ while(1) {
                }
 
                $riak->request( 'PUT' => "/koha.$table/$key", $row, $headers );
+
+               $offset++;
     }
 
-       $offset += $sth->rows;
        last if $sth->rows < $batch_size;
 
 }