Hi, I searched through the list archives for anything related to this and I could not find anything so I wanted to write it up to get some advice. Some changes made to the abstract adapter in version 1.9.0 of active record now result in me not being able to use MSSQL server. The 1.8.0 version of the add_limit method in the abstract connector was def add_limit!(sql, limit) sql << " LIMIT #{limit}" end The 1.9.0 version is 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 end This breaks the mssql adapter which does not pass an array to the add_limit method. It passes nil [add_limit!(sql, nil)]. This causes the add_limit method to call the add_limit_without_offset method which is implemented in the mssql server connector thusly: def add_limit_without_offset!(sql, limit) raise ArgumentError, ''add_limit_without_offset! not implemented'' end This results in any sql operations to mssql server throwing an error. I would like to get this working ASAP since I am trying to demo rails here at my company. Downgrading to 0.10 isn''t appealing since I make use of the new image and stylesheet tag functions in .11. In the short term I simply commented out the raise ArgumentError line: def add_limit_without_offset!(sql, limit) # raise ArgumentError, ''add_limit_without_offset! not implemented'' end This allowed me to list and create entries in the db which is all I need at the moment, but I am new to ruby and rails and do not know what effects that will have. Is there a bugzilla I can report this to? Did anyone else have the same problem? Thanks in advance, Amir Brown
DeLynn Berry
2005-Mar-24 19:17 UTC
RE: Active Record 1.9.0 Sql Server Connector Adapter Errors
Amir, I submitted a patch for the SQL Adapter yesterday, and David put it into "edge" Rails. You can get the updated version by going to http://dev.rubyonrails.com/file/trunk/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb. Feel free to let me know if you have any problems with the adapter. -- DeLynn Berry delynnb-+9FQAZFMD0vCste6SmUHRhL4W9x8LtSr@public.gmane.org -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org on behalf of Amir Brown Sent: Thu 3/24/2005 11:21 AM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Cc: Subject: [Rails] Active Record 1.9.0 Sql Server Connector Adapter Errors Hi, I searched through the list archives for anything related to this and I could not find anything so I wanted to write it up to get some advice. Some changes made to the abstract adapter in version 1.9.0 of active record now result in me not being able to use MSSQL server. The 1.8.0 version of the add_limit method in the abstract connector was def add_limit!(sql, limit) sql << " LIMIT #{limit}" end The 1.9.0 version is 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 end This breaks the mssql adapter which does not pass an array to the add_limit method. It passes nil [add_limit!(sql, nil)]. This causes the add_limit method to call the add_limit_without_offset method which is implemented in the mssql server connector thusly: def add_limit_without_offset!(sql, limit) raise ArgumentError, ''add_limit_without_offset! not implemented'' end This results in any sql operations to mssql server throwing an error. I would like to get this working ASAP since I am trying to demo rails here at my company. Downgrading to 0.10 isn''t appealing since I make use of the new image and stylesheet tag functions in .11. In the short term I simply commented out the raise ArgumentError line: def add_limit_without_offset!(sql, limit) # raise ArgumentError, ''add_limit_without_offset! not implemented'' end This allowed me to list and create entries in the db which is all I need at the moment, but I am new to ruby and rails and do not know what effects that will have. Is there a bugzilla I can report this to? Did anyone else have the same problem? Thanks in advance, Amir Brown _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Amir Brown
2005-Mar-24 19:57 UTC
RE: Active Record 1.9.0 Sql Server Connector Adapter Errors
DeLynn: Thanks so much! I dropped in the new adapter and have had no problems so far. -Amir -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of DeLynn Berry Sent: Thursday, March 24, 2005 2:18 PM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org; rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails] Active Record 1.9.0 Sql Server Connector Adapter Errors Amir, I submitted a patch for the SQL Adapter yesterday, and David put it into "edge" Rails. You can get the updated version by going to http://dev.rubyonrails.com/file/trunk/activerecord/lib/active_record/con nection_adapters/sqlserver_adapter.rb. Feel free to let me know if you have any problems with the adapter. -- DeLynn Berry delynnb-+9FQAZFMD0vCste6SmUHRhL4W9x8LtSr@public.gmane.org -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org on behalf of Amir Brown Sent: Thu 3/24/2005 11:21 AM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Cc: Subject: [Rails] Active Record 1.9.0 Sql Server Connector Adapter Errors Hi, I searched through the list archives for anything related to this and I could not find anything so I wanted to write it up to get some advice. Some changes made to the abstract adapter in version 1.9.0 of active record now result in me not being able to use MSSQL server. The 1.8.0 version of the add_limit method in the abstract connector was def add_limit!(sql, limit) sql << " LIMIT #{limit}" end The 1.9.0 version is 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 end This breaks the mssql adapter which does not pass an array to the add_limit method. It passes nil [add_limit!(sql, nil)]. This causes the add_limit method to call the add_limit_without_offset method which is implemented in the mssql server connector thusly: def add_limit_without_offset!(sql, limit) raise ArgumentError, ''add_limit_without_offset! not implemented'' end This results in any sql operations to mssql server throwing an error. I would like to get this working ASAP since I am trying to demo rails here at my company. Downgrading to 0.10 isn''t appealing since I make use of the new image and stylesheet tag functions in .11. In the short term I simply commented out the raise ArgumentError line: def add_limit_without_offset!(sql, limit) # raise ArgumentError, ''add_limit_without_offset! not implemented'' end This allowed me to list and create entries in the db which is all I need at the moment, but I am new to ruby and rails and do not know what effects that will have. Is there a bugzilla I can report this to? Did anyone else have the same problem? Thanks in advance, Amir Brown _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails