change_column_required (KirbyBase::KBEngine)

    # File lib/kirbybase.rb, line 1587
        def change_column_required(table, col_name, required)
            with_write_lock(table.name) do
                fptr = open(table.filename, 'r')
                new_fptr = open(table.filename+'temp', 'w')

                line = fptr.readline.chomp

                if line[0..0] == 'Z'
                    header_rec = unencrypt_str(line[1..-1]).split('|')
                else
                    header_rec = line.split('|')
                end

                if header_rec[table.field_names.index(col_name)+3
                 ] =~ /Required->/
                    hr_chunks = \
                     header_rec[table.field_names.index(col_name)+3].split(':')
                    if not required
                        hr_chunks = hr_chunks.delete_if {|x| x =~ /Required->/}
                        header_rec[table.field_names.index(col_name)+3] = \
                         hr_chunks.join(':')
                    else
                        hr_chunks.collect! do |x|
                            if x =~ /Required->/
                                'Default->%s' % required
                            else
                                x
                            end
                        end
                        header_rec[table.field_names.index(col_name)+3] = \
                         hr_chunks.join(':')
                    end
                else
                    if not required
                    else
                        header_rec[table.field_names.index(col_name)+3] += \
                         ':Required->%s' % required
                    end
                end

                if line[0..0] == 'Z'
                    new_fptr.write('Z' + encrypt_str(header_rec.join('|')) +
                     "\n")
                else
                    new_fptr.write(header_rec.join('|') + "\n")
                end

                begin
                    while true
                        new_fptr.write(fptr.readline)
                    end
                # Here's how we break out of the loop...

                rescue EOFError
                end

                # Close the table and release the write lock.

                fptr.close
                new_fptr.close
                File.delete(table.filename)
                FileUtils.mv(table.filename+'temp', table.filename)
            end
        end