Hi,
just a note to tell I have updated simpleorm in the 'franck' branch to
(hopefully) better handle offset and limit options.
What I have done is :
1) add a setLimit(long limit) and setOffset(long offset) moethod to
SQuery. The previous way (instanciating a SPreparedStatment and passing
as a execute parameter) was too complicated for me :)
2) create three OffsetStrategy to choose from by the SDriver :
- JDBC : use scrollable ResultSet jdbc feature
- QUERY : use proprietary sql statment like 'LIMIT OFFSET' (Postgresql,
MySql)
- BULK : keep the actual implementation, that is Simpleorm will iterate
over the whole resultset and skip the n first rows
So you can :
query().eq(field,
value).ascending(field).setLimit(5).setOffset(250).execute()
to get records from 251 to 255. Specific SDriver will take care of using
the most efficient way to do so...
Right now I have set SDriveOracle to return JDBC and SDriverPostgresql
to return QUERY and implement LIMIT OFFSET sql.
Regards,
Franck