on 2011 Apr 26 12:35 AM
It seems as if there is a bug in the arel code of the adapter. Calling "Model.first" generates the following error:
ActiveRecord::StatementInvalid: ActiveRecord::ConnectionAdapters::SQLAnywhereException: Syntax error near '<' on line 1: SELECT TOP #<arel::nodes::limit:0x00000102a0bbf0> "mi_def".* FROM "mi_def"
You can get around it by calling "Model.first(1)", but that doesn't help when you have associations. Trying to access an associated model generates the same error.
Request clarification before answering.
I fixed it myself by changing the following line in activerecord-sqlanywhere-adapter/lib/arel/visitors/sqlanywhere.rb
("TOP #{o.limit}" if o.limit),
to
(visit(Nodes::Top.new(o.limit.expr)) if o.limit),
I will try to submit a patch when I get a chance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for fixing this. Please create a git patch, and email it to sqlany_interfaces@sybase.com.
Thanks.
Hi,
this still appears to be broken. Why wasn't the gem updated? Is there a problem with this patch?
On another note when can we expect Rails 3.1 support?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
62 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.