# File lib/kirbybase.rb, line 1154 def update_records(table, recs) with_write_locked_table(table) do |fptr| recs.each do |rec| line = rec[:rec].join('|') # This doesn't actually 'delete' the line, it just # makes it all spaces. That way, if the updated # record is the same or less length than the old # record, we can write the record back into the # same spot. If the updated record is greater than # the old record, we will leave the now spaced-out # line and write the updated record at the end of # the file. write_record(table, fptr, rec[:fpos], ' ' * rec[:line_length]) if line.length > rec[:line_length] fptr.seek(0, IO::SEEK_END) new_fpos = fptr.tell write_record(table, fptr, 'end', line) incr_del_ctr(table, fptr) update_recno_index(table, rec[:rec].first, new_fpos) else write_record(table, fptr, rec[:fpos], line) end update_to_indexes(table, rec[:rec]) end # Return the number of records updated. return recs.size end end