lib/eol/db.rb
# NOTE: ensures that there is at least one row in the tmp table! So you
# cannot swap an empty table into place, sorry.
ensures that there is at least one row in the tmp table. So you
cannot swap an empty table into place, sorry.
ensures that there is at least one row in the tmp table . So you cannot swap an empty table into place sorry .
def swap_tmp_table(klass)
        EOL.log_call
        count = begin
          klass.connection.select_value("SELECT COUNT(*) "\
            "FROM #{klass.table_name}_tmp")
        rescue
          0
        end
        if count > 0
          klass.connection.execute("RENAME TABLE #{klass.table_name} "\
            "TO #{klass.table_name}_swap, "\
            "#{klass.table_name}_tmp TO #{klass.table_name}, "\
            "#{klass.table_name}_swap TO #{klass.table_name}_tmp")
        end
      end
def swap_tmp_table ( klass ) EOL . log_call count = begin klass . connection . select_value ( "SELECT COUNT(*) " "FROM #{klass.table_name}_tmp" ) rescue 0 end if count > 0 klass . connection . execute ( "RENAME TABLE #{klass.table_name} " "TO #{klass.table_name}_swap, " "#{klass.table_name}_tmp TO #{klass.table_name}, " "#{klass.table_name}_swap TO #{klass.table_name}_tmp" ) end end
NOTE: ensures that there is at least one row in the tmp table!
NOTE : ensures that there is at least one row in the tmp table!
klass
<not_specific>