emilsjolander / sprinkles

Sprinkles is a boiler-plate-reduction-library for dealing with databases in android applications
Apache License 2.0
772 stars 84 forks source link

Add a short form to query all #22

Closed xanscale closed 10 years ago

xanscale commented 10 years ago

Actually if i need all element i need to do

Query.many(Shipment.class, "select * from Shipment")

it would be better if it was

Query.many(Shipment.class)

emilsjolander commented 10 years ago

In case this would be added i would opt for a different method name, Query.all() comes to mind. However i don't know if i feel that this is a great addition. I feel like this is easily implemented by the user of the library if this type of query is used extensively in a app. I would prefer not to add complexity to the api. I will however leave this issue open for discussion!

troymccabe commented 10 years ago

+1 for adding (and +1 for Query.all()). While it's nothing but convenience, it does help when a) everything is needed and b) sorting/filtering doesn't matter.

I agree on not adding complexity to the API, but several ORMs implement something similar as a query method: ORMLite: http://ormlite.com/javadoc/ormlite-core/com/j256/ormlite/dao/Dao.html#queryForAll() Doctrine: https://doctrine-orm.readthedocs.org/en/latest/tutorials/getting-started.html?highlight=findAll And I feel that One, Many, All are pretty self-explanatory as to what they do.

The one caveat would be "I want all, but sorted", to which the answer would be "use Many", IMO.

MariusVolkhart commented 10 years ago

+1 for Query.all()