我在尝试在内存中实例化太多对象时遇到此错误。这是一个Rails 2.3.x应用程序,以SQL Server作为数据库。
>> Shop.count
=> 14111
>> Shop.all
ActiveRecord::StatementInvalid: ArgumentError: negative string size (or size too big): SELECT * FROM [shop]
from /Users/lunks/.rvm/gems/ree-1.8.7-2011.03@ums/gems/activerecord-2.3.14/ lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
from /Users/lunks/.rvm/ gems/ree-1.8.7-2011.03@ums/gems/activerecord-sqlserver-adapter-2.3.24/lib/active_record/connection_adapters/sqlserver_adapter.rb:1004:in `raw_select'
from /Users/lunks/.rvm/gems/ree-1.8.7-2011.03@ ums/gems/activerecord-sqlserver-adapter-2.3.24/lib/active_record/connection_adapters/sqlserver_adapter.rb:965:in `select'
from /Users/lunks/.rvm/gems/ree-1. 8.7-2011.03@ums/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
from /Users/lunks/.rvm /gems/ree-1.8.7-2011.03@ums/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all'
from /Users/lu nks/.rvm/gems/ree-1.8.7-2011.03@ums/gems/activerecord-2.3.14/lib/active_record/base.rb:665:in `find_by_sql'
from /Users/lunks/.rvm/gems/ree-1.8.7-2011.03@ums/gem s/activerecord-2.3.14/lib/active_record/base.rb:1582:in `find_every'
f rom /Users/lunks/.rvm/gems/ree-1.8.7-2011.03@ums/gems/activerecord-2.3.14/lib/active_record/base.rb:619:in `find'
from /Users/lunks/.rvm/gems/ree-1.8.7-2011.03@ums/ge ms/activerecord-2.3.14/lib/active_record/base.rb:639:in `all'
from (irb):3`
答案 0 :(得分:0)
解决了更改ODBC gem需要odbc_utf8
而不是odbc
。但是整理是在Latin1中。 :P