Jacques,

I can confirm the behavior you get from your gist. I'm not yet sure
though if that is supposed to work anyway. Here's a probably more
idiomatic way to write your stuff: http://pastie.org/639450

cheers
snusnu

On Fri, Oct 2, 2009 at 14:07, Jacques Crocker <[email protected]> wrote:
>
> Hi. I found another weird edge case that is causing datamapper to blow
> up with a binding mismatch error. It seems to be the result of chained
> all queries with :conditions specified.
>
> Here is the script that isolates the problem.
> http://gist.github.com/199685
>
> Here's the output I get from it
>
> ~ (0.000042) SELECT sqlite_version(*)
> ~ (0.000060) DROP TABLE IF EXISTS "posts"
> ~ (0.000017) PRAGMA table_info("posts")
> ~ (0.000277) CREATE TABLE "posts" ("id" INTEGER NOT NULL PRIMARY KEY
> AUTOINCREMENT, "name" VARCHAR(50), "description" TEXT)
> ~ Binding mismatch: 1 for 0
> /Users/jc/.gem/ruby/1.8/gems/data_objects-0.10.0/lib/data_objects/
> command.rb:73:in `escape_sql': Binding mismatch: 1 for 0 (ArgumentError)
>        from /Users/jc/.gem/ruby/1.8/gems/dm-core-0.10.1/lib/dm-core/adapters/
> data_objects_adapter.rb:88:in `execute_reader'
>        from /Users/jc/.gem/ruby/1.8/gems/dm-core-0.10.1/lib/dm-core/adapters/
> data_objects_adapter.rb:88:in `read'
>        from /Users/jc/.gem/ruby/1.8/gems/dm-core-0.10.1/lib/dm-core/adapters/
> data_objects_adapter.rb:266:in `with_connection'
>        from /Users/jc/.gem/ruby/1.8/gems/dm-core-0.10.1/lib/dm-core/adapters/
> data_objects_adapter.rb:84:in `read'
>        from /Users/jc/.gem/ruby/1.8/gems/dm-core-0.10.1/lib/dm-core/
> repository.rb:141:in `read'
>        from /Users/jc/.gem/ruby/1.8/gems/dm-core-0.10.1/lib/dm-core/
> collection.rb:1001:in `lazy_load'
>        from /opt/local/lib/ruby/gems/1.8/gems/extlib-0.9.13/lib/extlib/
> lazy_array.rb:451:in `map'
>        from /Users/jc/.gem/ruby/1.8/gems/dm-core-0.10.1/lib/dm-core/
> collection.rb:902:in `inspect'
>
>
> Please let me know if the syntax is correct on the gist. Want to make
> sure I'm not doing something boneheaded. I should also mention that
> this same script runs fine in Datamapper 0.9.11.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to