On 16/09/11 6:57 PM, Durchholz, Joachim wrote:
User.fetch( dataContext,
new Query(
User.FIRSTNAME.like( "joe%" )
.and(User.AGE.between( 20, 30 )))
.sort( User.FIRSTNAME.asc().then( User.LASTNAME.asc() )
)
Another approach is to use the keys only as function parameters.
User.where(User.FIRSTNAME, Query.LIKE, "joe%").and(User.AGE, Query.BETWEEN,
"20,30").sort(User.FIRSTNAME, Query.ASC).sort(User.LASTNAME, Query.ASC).limit(10)
or with strings:
User.where("firstname LIKE joe%").and("age BETWEEN 20,30").sort("firstname
ASC").sort("lastname ASC").limit(10)
You could also pre-define qualifiers like this:
debtors = User.where("owing > 0)
and then later on use it in this nice natural speech kind of way:
debtors.where("firstname LIKE joe%")
All we need for this is to make .and() and .where() equivalent functions.
Please reply to the dev@ list only.
Thanks
Ari
--
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A