[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2362) InformixDialect : Informix support offset but the InformixDialect uses max for limit

Adrian Mitev (JIRA) noreply at atlassian.com
Tue Jan 16 06:19:45 EST 2007


InformixDialect : Informix support offset but the InformixDialect  uses max for limit
-------------------------------------------------------------------------------------

         Key: HHH-2362
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2362
     Project: Hibernate3
        Type: Improvement

  Components: query-hql  
 Environment: Informix 10
    Reporter: Adrian Mitev
    Priority: Minor


This is the code in the current version of the InformixDialect:
public boolean useMaxForLimit() {
    return true;
}

public boolean supportsLimitOffset() {
    return false;
}

public String getLimitString(String querySelect, int offset, int limit) {
	if (offset>0) throw new UnsupportedOperationException("informix has no offset");
	return new StringBuffer( querySelect.length()+8 ).append(querySelect).insert( querySelect.toLowerCase().indexOf( "select" ) + 6, " first " + limit ).toString();
}

But  Informix supports offset ("skip"). Here is the code that should be replaced in the InformixDialect  in order to use that informix feature:

public boolean useMaxForLimit() {
    return false;
}

public boolean supportsLimitOffset() {
    return true;
}

public String getLimitString(String querySelect, int offset, int limit) {
    StringBuffer limitString = new StringBuffer(20);
    limitString.append((offset > 0) ? " skip " + offset : "");
    limitString.append((limit > 0) ? " first " + limit : "");
    return new StringBuffer(querySelect.length() + 8).append(querySelect).insert(querySelect.toLowerCase().indexOf("select") + 6,
                        limitString.toString()).toString();
}



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list