lib/couch.rb
# Flushes the given hashes to CouchDB
Flushes the given hashes to CouchDB
Flushes the given hashes to CouchDB
def handle_bulk_flush(bulk, db, block)
        res = post_bulk(db, bulk)
        error_count=0
        if res.body
          begin
            JSON.parse(res.body).each do |d|
              error_count+=1 if d['error']
            end
          end
        end
        if error_count > 0
          puts "Bulk request completed with #{error_count} errors"
        end
        if block
          block.call(res)
        end
        bulk.clear
      end
def handle_bulk_flush ( bulk , db , block ) res = post_bulk ( db , bulk ) error_count = 0 if res . body begin JSON . parse ( res . body ) . each do | d | error_count += 1 if d [ 'error' ] end end end if error_count > 0 puts "Bulk request completed with #{error_count} errors" end if block block . call ( res ) end bulk . clear end
Flushes the given hashes to CouchDB
Flushes the given hashes to CouchDB
bulk
<not_specific>
db
<not_specific>
block
<not_specific>