diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-01 17:20:04 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-01 17:20:04 +0000 |
commit | f2a29ca43cb0de38a25bf7f68bca5c11871692ce (patch) | |
tree | 49fafc3247a77dc1b8797e4425b28923af6a51d0 /activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | |
parent | 64612db7cf85aee8434e7b9b4fd8d6d0249c60e4 (diff) | |
download | rails-f2a29ca43cb0de38a25bf7f68bca5c11871692ce.tar.gz rails-f2a29ca43cb0de38a25bf7f68bca5c11871692ce.tar.bz2 rails-f2a29ca43cb0de38a25bf7f68bca5c11871692ce.zip |
Added support for ODBC connections to MS SQL Server so you can connect from a non-Windows machine #1569 [Mark Imbriaco/DeLynn Berry] Added support for limit/offset with the MS SQL Server driver so that pagination will now work #1569 [DeLynn Berry]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1583 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract_adapter.rb')
-rwxr-xr-x | activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index 2be587dc79..0503dbebea 100755 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -352,21 +352,15 @@ module ActiveRecord # Returns a string of the CREATE TABLE SQL statements for recreating the entire structure of the database. def structure_dump() end - def add_limit!(sql, limit) - if limit.is_a? Array - limit, offset = *limit - add_limit_with_offset!(sql, limit.to_i, offset.to_i) - else - add_limit_without_offset!(sql, limit) - end + def add_limit!(sql, options) + return unless options + add_limit_offset!(sql, options) end - def add_limit_with_offset!(sql, limit, offset) - sql << " LIMIT #{limit} OFFSET #{offset}" - end - - def add_limit_without_offset!(sql, limit) - sql << " LIMIT #{limit}" + def add_limit_offset!(sql, options) + return if options[:limit].nil? + sql << " LIMIT #{options[:limit]}" + sql << " OFFSET #{options[:offset]}" if options.has_key?(:offset) and !options[:offset].nil? end def initialize_schema_information |