
DataObjects adaptor raises ArgumentError
Reported by Camilo Lopez | May 8th, 2008 @ 05:10 PM
When trying to access a resource using MySQL and there is a connection error ArgumentError is raised instead of the correspondent MySQL error.
Quick patch attached ( just removing an extra argument)
Comments and changes to this ticket
-
-
Scott Bauer May 8th, 2008 @ 10:59 PM
- State changed from new to open
Camilo, can you give me a few more details? A stacktrace would be good. What happened to Mysql that caused the connection to be interrupted, and when did it occur? The patch you attached just comments out a "p se, sql", which shouldn't be there anyway :), is that what was causing the error in the first place?
-
Sam Smoot May 8th, 2008 @ 11:27 PM
- Milestone cleared.
-
Camilo Lopez May 9th, 2008 @ 08:35 AM
Sure,
I defined a DataMapper resource that uses the MySQL adapter
class FooModel
include DataMapper::Resource
property :bar, String
end
when I tried to
FooModel.first :bar => 'abc'
I got:
usr/lib/ruby/gems/1.8/gems/dm-core-0.9.0/lib/data_mapper/adapters/data_objects_adapter.rb:290:in
`p': wrong number of arguments (2 for 1) (ArgumentError)
from
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.0/lib/data_mapper/adapters/data_objects_adapter.rb:290:in
`read_set_with_sql'
from
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.0/lib/data_mapper/support/lazy_array.rb:86:in
`[]'
from
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.0/lib/data_mapper/support/lazy_array.rb:86:in
`lazy_load!'
from
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.0/lib/data_mapper/support/lazy_array.rb:32:in
`first'
from
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.0/lib/data_mapper/repository.rb:39:in
`first'
from
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.0/lib/data_mapper/resource.rb:374:in
`first'
from
/usr/lib/ruby/gems/1.8/gems/merb-core-0.9.3/lib/merb-core/rack/adapter/runner.rb:24:in
`find_by_bar'
from
/usr/lib/ruby/gems/1.8/gems/merb-core-0.9.3/lib/merb-core/rack/adapter/runner.rb:32
Instead of the :
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.0/lib/data_mapper/adapters/data_objects_adapter.rb:283:in
`execute_reader': Table 'camilo.foo_models' doesn't exist (MysqlError)
I was expecting, I though that ArgumentError was misleading ;).
On Thu, May 8, 2008 at 11:59 PM, Lighthouse
wrote:
-
Scott Bauer May 9th, 2008 @ 06:30 PM
- State changed from open to resolved
Ah, it was just the "p se, sql". Gotcha. Fixed: http://github.com/sam/dm-core/co...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
People watching this ticket
- Nobody is watching this ticket.