Update in 'franck' branch : limit/offset
Franck Routier <[email protected]>
| Newsgroups | gmane.comp.java.orm.simpleorm |
|---|---|
| Organization | Axège Sarl |
| Message-ID | <1204884957.9659.35.camel@franck-gusty> |
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
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/SimpleORM/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/SimpleORM/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[email protected]
mailto:[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/