Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

DataMapper::Repository#read with an invalid query returns an ambiguous result #16

Closed
halorgium opened this issue Apr 14, 2011 · 7 comments
Assignees
Milestone

Comments

@halorgium
Copy link
Contributor

If you ask a Repository to read the records for a valid query which returns an empty set, you get an empty set.
If you ask a Repository to read the records for an invalid query, you get an empty set.

It is impossible to determine the difference between these results.

Can we change the behaviour for an invalid query to raise an error?

https://github.com/datamapper/dm-core/blob/master/lib/dm-core/repository.rb#L160-163

@solnic
Copy link
Contributor

solnic commented Apr 14, 2011

Yes there were some discussions about that already and yes we want to change that behavior. Can't say when exactly it'll happen tho but I think it's safe to assume this change will make it into release 1.2.

@halorgium
Copy link
Contributor Author

Is there any reason why someone should be relying on the current behaviour with an invalid query?
It would seem that changing this would only make it less likely that people are hitting cases where their queries are not actually executed.

@mbj
Copy link
Member

mbj commented Jan 12, 2012

@solnic, @emmanuel. Id like to tackle this since I was bid by this multiple times. It has become better since we merged the "raise on invalid property" patches but you can still easily create an invalid query. You'll accept a pull request for 1.3?

@solnic
Copy link
Contributor

solnic commented Jan 12, 2012

@mbj sure man!

@tpitale tpitale assigned tpitale and mbj and unassigned tpitale May 24, 2016
@tpitale
Copy link
Member

tpitale commented May 24, 2016

@mbj Any interest in tackling this still?

@tpitale
Copy link
Member

tpitale commented May 24, 2016

Oh wait, I did add a PR … #295.

@mbj
Copy link
Member

mbj commented May 24, 2016

@mbj Any interest in tackling this still?

No, sorry.

@tpitale tpitale assigned tpitale and unassigned mbj May 24, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants