I'm mostly +1 on eliminating any non-explicit orderby on limitby. Any sane user in the need of pagination would need to specify the order explicitely.
On the other hand, on the grid with non-explicit orderby, the current approach is the only one that can guarantee in any backend consistent results.
On the upper-side of things, I agree that order by an id AND by the reference to it (Foreign key) is unuseful, and if it happens it should be stripped from the query only if it's not explicitely passed as orderby but.... at DAL level, not on grid's level.
--
-- mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
---
You received this message because you are subscribed to the Google Groups "web2py-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py-develop...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
With two arguments, the first argument specifies the offset of the first row to return, and the second specifies the maximum number of rows to return. The offset of the initial row is 0 (not 1):
SELECT * FROM tbl LIMIT 5,10; # Retrieve rows 6-15
pped from the query only if it's not explicitely passed as orderby but.... at DAL level, not on grid's level.What are your thoughts on the grid implicitly adding a primary key orderby even if the user explicitly specifies their own orderby (just in case the explicit orderby does not have unique values for all records and therefore won't guarantee a consistent order)? Currently that does not happen (the implicit orderby is only added if the user specifies no orderby at all).Anthony
I'm all up for letting the user deal with it. The more DAL is consistent with SQL syntax the less unpredictable things will happen. So...
no explicit --> grid adds it because the pagination will be screwed if no orderby at all is "issued to the backend"
explicit --> grid (and/or DAL) doesn't do anything. If the user choosed a field "unelegible" for pagination, he explicitely wanted a "bad" behaviour and he should have it (then he can deal with it or accept it as it is).
grid = SQLFORM.grid(db.address)
grid = SQLFORM.grid(db.address, orderby=db.address.state)
Than why not default orderby_on_limitby to false except in the case of the grid?
@Anthony: I think we should agree on disagreeing in this one ... however I don't have a strong opinion about it, so feel free to do as you say (adding always pk)
Why not add an optional parameter to DAL __init__() ?
@Anthony: I think we should agree on disagreeing in this one ... however I don't have a strong opinion about it, so feel free to do as you say (adding always pk)@Massimo: last time I checked breaking backward compatibility was an issue. If someone relies on the implicit orderby added right now, you're screwing (badly) their code.
I am not sure GAE allows it.
On GAE you can sort by IT but I am not sure can sort by something else and ID always.
#1 is providing safe defaults, #2 is getting in the way.
On Thursday, October 10, 2013 4:53:52 PM UTC-4, Tim Richardson wrote:
--
-- mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py-developers/nklB1tRh_zU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py-develop...@googlegroups.com.
--
-- mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
---
You received this message because you are subscribed to the Google Groups "web2py-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py-develop...@googlegroups.com.