nissim,

java.sql.Statement.setMaxRows( int ) is supposed to already give you this
functionality, I believe.
http://java.sun.com/products//jdk/1.2/docs/api/java/sql/Statement.html

*although* it's completely up to the implementor of the JDBC driver whether
and how it's supported.

the most general way to implement this would be to create a subclass of
Statement/ResultSet that would just stop returning rows when a limit was
reached.  you could add this as the default behavior of all databases in
Turbine and then specialize the implementation to take advantage of the
functionality that a particular database might have.

in seems like you would want to avoid having too much functionality that
works for some databases but not others.  otherwise you end up writing a lot
of code that looks like this:

if ( db.supportsLimit() )
{
        crit.setLimit( 500 );
        // ...
}
else
{
        // now what ...?
}

PaulO.


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Nissim
Sent: Thursday, August 03, 2000 10:29 AM
To: Turbine
Subject: Re: PROPOSAL: Limiting resultsets with Criteria and BasePeer


Some changes:

Nissim wrote:
>
> The proposal is to add the following:
>
> In Criteria:
> public void setLimit(int n)
Would it be bad to make it public Criteria setLimit(int n) which would
return this?

> In DB:
> public abstract boolean supportsLimit()
I made this not abstract, and it returns false, so only subclasses which
need to return true have to implement it.

[shnip]



------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to