aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/mysql_adapter.rb')
-rwxr-xr-xactiverecord/lib/active_record/connection_adapters/mysql_adapter.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
index 89633639d3..c11ce3772a 100755
--- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
@@ -172,11 +172,17 @@ module ActiveRecord
structure += select_one("SHOW CREATE TABLE #{table.to_a.first.last}")["Create Table"] + ";\n\n"
end
end
-
- def add_limit_with_offset!(sql, limit, offset)
- sql << " LIMIT #{offset}, #{limit}"
+
+ def add_limit_offset!(sql, options)
+ return if options[:limit].nil?
+
+ if options[:offset].blank?
+ sql << " LIMIT #{options[:limit]}"
+ else
+ sql << " LIMIT #{options[:offset]}, #{options[:limit]}"
+ end
end
-
+
def recreate_database(name)
drop_database(name)
create_database(name)