yamldb/yaml_db

Problem with Sql Server add_limit_offset!

tommasop opened this issue · 3 comments

The activerecord-sqlserver-adapter is not implementing the method.

This is the error:

This has been moved to the SQLServerCompiler in Arel.
/Users/tommasop/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-sqlserver-adapter-3.1.1/lib/active_record/connection_adapters/sqlserver/database_statements.rb:72:in `add_limit_offset!'

The call could be converted like this:

id = table_column_names(table).first.to_sym
quoted_table_name = SerializationHelper::Utils.quote_table(table).to_sym

(0..pages).to_a.each do |page|
sql = Arel::Table.new(quoted_table_name).order(t[id].asc).take(records_per_page).skip(records_per_page * page).to_sql
records = ActiveRecord::Base.connection.select_all(sql)
records = SerializationHelper::Utils.convert_booleans(records, boolean_columns)
yield records
end

See my fork at https://github.com/lostapathy/yaml_db - I think it covers this case. I've got an open pull request for it as well.

This was addressed in #29.