maxRows attribute in select statements

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

maxRows attribute in select statements

raupach
Hi,

why don't we have a maxRows attribute? JDBC supports it and its handy
every once in a while. Especially when your application has to work
with different databases and every dialect uses a different approach
to limit the result set.

SELECT TOP 10 column FROM table // SQL Server
SELECT column FROM table LIMIT 10 // MySQL
SELECT column FROM table WHERE ROWNUM <= 10 // Oracle
SELECT column FROM table FETCH FIRST 10 ROWS ONLY // DB2

<select id="selectValues" maxRows="10">
SELECT column FROM table
</select>

I opened ticket 65 for this one and included a patch in case someone
might find this useful. Btw. how can I change defect to feature?

Keep up the good work!
Björn