I want to make a query to postgresql that will look like this:

SELECT * FROM emp LIMIT 7

For those not familiar with postgres syntax (I think mysql works like
this too) this selects the first 7 records from the table.

In SQL Server 7.0 you can say 

SELECT TOP 7 * FROM emp

I don't know how it's done in other DB's.

The proposal is to add the following:

In Criteria:
public void setLimit(int n)
public int getLimit()

In DB:
public abstract boolean supportsLimit()
public boolean getLimitStyle()
public static final int's for none, pqsql/mysql, sql server limit style

In Query:
public setTop(String top)
public setLimit(String limit)
change toString to build the new words into the query if necessary

In BasePeer.createQueryString add logic to check if the db supports
limit, and if so, call the appropriate method in Query based on the
db.getLimitStyle.

        -Nissim


------------------------------------------------------------
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