# File lib/kirbybase.rb, line 1252
    def rename_column(table, old_col_name, new_col_name)
        col_index = table.field_names.index(old_col_name)
        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
            
            temp_fields = header_rec[col_index+3].split(':')
            temp_fields[0] = new_col_name.to_s
            header_rec[col_index+3] = temp_fields.join(':')

            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