# File lib/rubyrep/replication_extenders/mysql_replication.rb, line 134
      def sequence_values(rep_prefix, table_name)
        # check if the table has an auto_increment column, return if not
        sequence_row = select_one("show columns from `\#{table_name}` where extra = 'auto_increment'\n")
        return {} unless sequence_row
        column_name = sequence_row['Field']

        # check if the sequences table exists, create if necessary
        sequence_table_name = "#{rep_prefix}_sequences"
        unless tables.include?(sequence_table_name)
          create_table "#{sequence_table_name}".to_sym,
            :id => false, :options => 'ENGINE=MyISAM' do |t|
            t.column :name, :string
            t.column :current_value, :integer
            t.column :increment, :integer
            t.column :offset, :integer
          end
          ActiveRecord::Base.connection.execute("ALTER TABLE \"\#{sequence_table_name}\"\nADD CONSTRAINT \#{sequence_table_name}_pkey\nPRIMARY KEY (name)\n") rescue nil
        end

        sequence_row = select_one("select current_value, increment, offset from #{sequence_table_name} where name = '#{table_name}'")
        if sequence_row == nil
          current_max = select_one("select max(`\#{column_name}`) as current_max from `\#{table_name}`\n")['current_max'].to_i
          return {column_name => {
              :increment => 1,
              :value => current_max
            }
          }
        else
          return {column_name => {
              :increment => sequence_row['increment'].to_i,
              :value => sequence_row['offset'].to_i
            }
          }
        end
      end