add LIMIT clause to DataSet

View: New views
3 Messages — Rating Filter:   Alert me  

add LIMIT clause to DataSet

by Mingfai :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi,

quick question, is there any way to add a LIMIT cause to the DataSet SQL? e.g. select * from mytable LIMIT 10

the methods in the API do not seem to provide that extension. http://groovy.codehaus.org/api/groovy/sql/DataSet.html

regards,
mingfai

Re: add LIMIT clause to DataSet

by Paul King :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Not at the moment, but it would be a nice feature to add at some point.

Paul.

Mingfai wrote:

> hi,
>
> quick question, is there any way to add a LIMIT cause to the DataSet
> SQL? e.g. select * from mytable LIMIT 10
>
> the methods in the API do not seem to provide that extension.
> http://groovy.codehaus.org/api/groovy/sql/DataSet.html
>
> regards,
> mingfai


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: add LIMIT clause to DataSet

by Erick Erickson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This seems to work for me...

     def sql = Sql.newInstance(dataSourceSnap)
     sql.withStatement() {it.setMaxRows(<limit number here>)}


Don't know if it could be more easily done, but I stopped looking after
it worked <G>.

Best
Erick

+1 on better groovy SQL support for this.

On Sun, Jul 6, 2008 at 6:38 AM, Mingfai <mingfai.ma@gmail.com> wrote:
hi,

quick question, is there any way to add a LIMIT cause to the DataSet SQL? e.g. select * from mytable LIMIT 10

the methods in the API do not seem to provide that extension. http://groovy.codehaus.org/api/groovy/sql/DataSet.html

regards,
mingfai